summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2016-12-21 11:00:47 +0200
committerSebastian Dröge <sebastian@centricular.com>2016-12-21 11:17:11 +0200
commit9b5de053995488d5ddc78c1bf4df651101271d70 (patch)
tree07755463428bf4460852180dc4d3155cc28bf488
parent0fdd4e2539cc8c2c794419b13594ed7761d5fccd (diff)
Remove various unported plugins
If they were not ported after 4+ years it seems unlikely that anybody is ever going to need them again. They're still in the GIT history if needed. https://bugzilla.gnome.org/show_bug.cgi?id=774530
-rw-r--r--config.h.meson42
-rw-r--r--configure.ac232
-rw-r--r--docs/plugins/Makefile.am10
-rw-r--r--docs/plugins/gst-plugins-bad-plugins-sections.txt116
-rw-r--r--docs/plugins/gst-plugins-bad-plugins.signals32
-rw-r--r--ext/Makefile.am62
-rw-r--r--ext/apexsink/LGPL-3.0.txt165
-rw-r--r--ext/apexsink/Makefile.am12
-rw-r--r--ext/apexsink/gstapexplugin.c44
-rw-r--r--ext/apexsink/gstapexraop.c798
-rw-r--r--ext/apexsink/gstapexraop.h148
-rw-r--r--ext/apexsink/gstapexsink.c665
-rw-r--r--ext/apexsink/gstapexsink.h98
-rw-r--r--ext/libvisual/Makefile.am15
-rw-r--r--ext/libvisual/visual-gl.c1248
-rw-r--r--ext/meson.build9
-rw-r--r--ext/nas/Makefile.am11
-rw-r--r--ext/nas/nassink.c583
-rw-r--r--ext/nas/nassink.h72
-rw-r--r--ext/sdl/Makefile.am19
-rw-r--r--ext/sdl/gstsdl.c45
-rw-r--r--ext/sdl/sdlaudiosink.c439
-rw-r--r--ext/sdl/sdlaudiosink.h65
-rw-r--r--ext/sdl/sdlvideosink.c1006
-rw-r--r--ext/sdl/sdlvideosink.h82
-rw-r--r--ext/sndio/Makefile.am11
-rw-r--r--ext/sndio/gstsndio.c53
-rw-r--r--ext/sndio/sndiosink.c527
-rw-r--r--ext/sndio/sndiosink.h67
-rw-r--r--ext/sndio/sndiosrc.c524
-rw-r--r--ext/sndio/sndiosrc.h67
-rw-r--r--ext/timidity/gsttimidity.c821
-rw-r--r--ext/timidity/gsttimidity.h84
-rw-r--r--ext/wildmidi/Makefile.am (renamed from ext/timidity/Makefile.am)16
-rw-r--r--ext/wildmidi/README (renamed from ext/timidity/README)0
-rw-r--r--ext/wildmidi/gstwildmidi.c (renamed from ext/timidity/gstwildmidi.c)0
-rw-r--r--ext/wildmidi/gstwildmidi.h (renamed from ext/timidity/gstwildmidi.h)0
-rw-r--r--ext/xvid/Makefile.am9
-rw-r--r--ext/xvid/gstxvid.c371
-rw-r--r--ext/xvid/gstxvid.h57
-rw-r--r--ext/xvid/gstxviddec.c673
-rw-r--r--ext/xvid/gstxviddec.h73
-rw-r--r--ext/xvid/gstxvidenc.c1403
-rw-r--r--ext/xvid/gstxvidenc.h137
-rw-r--r--gst/audiobuffer/Makefile.am10
-rw-r--r--gst/audiobuffer/gstaudioringbuffer.c1178
-rw-r--r--gst/audiobuffer/meson.build12
-rw-r--r--gst/cdxaparse/Makefile.am24
-rw-r--r--gst/cdxaparse/gstcdxaparse.c585
-rw-r--r--gst/cdxaparse/gstcdxaparse.h75
-rw-r--r--gst/cdxaparse/gstvcdparse.c409
-rw-r--r--gst/cdxaparse/gstvcdparse.h64
-rw-r--r--gst/cdxaparse/meson.build13
-rw-r--r--gst/dccp/Makefile.am25
-rw-r--r--gst/dccp/gstdccp.c560
-rw-r--r--gst/dccp/gstdccp.h94
-rw-r--r--gst/dccp/gstdccp_common.h56
-rw-r--r--gst/dccp/gstdccpclientsink.c335
-rw-r--r--gst/dccp/gstdccpclientsink.h82
-rw-r--r--gst/dccp/gstdccpclientsrc.c405
-rw-r--r--gst/dccp/gstdccpclientsrc.h72
-rw-r--r--gst/dccp/gstdccpplugin.c60
-rw-r--r--gst/dccp/gstdccpserversink.c465
-rw-r--r--gst/dccp/gstdccpserversink.h91
-rw-r--r--gst/dccp/gstdccpserversrc.c390
-rw-r--r--gst/dccp/gstdccpserversrc.h88
-rw-r--r--gst/dccp/meson.build17
-rw-r--r--gst/faceoverlay/Makefile.am13
-rw-r--r--gst/faceoverlay/gstfaceoverlay.c452
-rw-r--r--gst/faceoverlay/gstfaceoverlay.h94
-rw-r--r--gst/faceoverlay/meson.build12
-rw-r--r--gst/games/Makefile.am13
-rw-r--r--gst/games/gstpuzzle.c576
-rw-r--r--gst/games/gstvideoimage.c946
-rw-r--r--gst/games/gstvideoimage.h114
-rw-r--r--gst/games/meson.build13
-rw-r--r--gst/hdvparse/Makefile.am12
-rw-r--r--gst/hdvparse/gsthdvparse.c888
-rw-r--r--gst/hdvparse/gsthdvparse.h56
-rw-r--r--gst/hdvparse/meson.build12
-rw-r--r--gst/meson.build30
-rw-r--r--gst/mixmatrix/Makefile.am9
-rw-r--r--gst/mixmatrix/meson.build12
-rw-r--r--gst/mixmatrix/mixmatrix.c530
-rw-r--r--gst/mve/Makefile.am21
-rw-r--r--gst/mve/TODO5
-rw-r--r--gst/mve/gstmve.c46
-rw-r--r--gst/mve/gstmvedemux.c1153
-rw-r--r--gst/mve/gstmvedemux.h114
-rw-r--r--gst/mve/gstmvemux.c1486
-rw-r--r--gst/mve/gstmvemux.h127
-rw-r--r--gst/mve/meson.build20
-rw-r--r--gst/mve/mve.h62
-rw-r--r--gst/mve/mveaudiodec.c82
-rw-r--r--gst/mve/mveaudioenc.c154
-rw-r--r--gst/mve/mvevideodec16.c849
-rw-r--r--gst/mve/mvevideodec8.c802
-rw-r--r--gst/mve/mvevideoenc16.c1652
-rw-r--r--gst/mve/mvevideoenc8.c1733
-rw-r--r--gst/nuvdemux/Makefile.am10
-rw-r--r--gst/nuvdemux/gstnuvdemux.c940
-rw-r--r--gst/nuvdemux/gstnuvdemux.h173
-rw-r--r--gst/nuvdemux/meson.build12
-rw-r--r--gst/overlay/Makefile.am14
-rw-r--r--gst/overlay/gstoverlay.c357
-rw-r--r--gst/overlay/gstoverlay.h67
-rw-r--r--gst/overlay/meson.build12
-rw-r--r--gst/patchdetect/Makefile.am19
-rw-r--r--gst/patchdetect/gstpatchdetect.c1235
-rw-r--r--gst/patchdetect/gstpatchdetect.h58
-rw-r--r--gst/patchdetect/meson.build12
-rw-r--r--gst/rtjpeg/.gitignore7
-rw-r--r--gst/rtjpeg/Makefile.am10
-rw-r--r--gst/rtjpeg/README12
-rw-r--r--gst/rtjpeg/RTjpeg.c3448
-rw-r--r--gst/rtjpeg/RTjpeg.h52
-rw-r--r--gst/rtjpeg/gstrtjpeg.c43
-rw-r--r--gst/rtjpeg/gstrtjpegdec.c123
-rw-r--r--gst/rtjpeg/gstrtjpegdec.h70
-rw-r--r--gst/rtjpeg/gstrtjpegenc.c123
-rw-r--r--gst/rtjpeg/gstrtjpegenc.h71
-rw-r--r--gst/rtjpeg/meson.build15
-rw-r--r--gst/sdi/Makefile.am13
-rw-r--r--gst/sdi/gstsdi.c44
-rw-r--r--gst/sdi/gstsdidemux.c537
-rw-r--r--gst/sdi/gstsdidemux.h76
-rw-r--r--gst/sdi/gstsdimux.c312
-rw-r--r--gst/sdi/gstsdimux.h54
-rw-r--r--gst/sdi/meson.build13
-rw-r--r--gst/tta/Makefile.am13
-rw-r--r--gst/tta/crc32.h114
-rw-r--r--gst/tta/filters.h110
-rw-r--r--gst/tta/gsttta.c40
-rw-r--r--gst/tta/gstttadec.c444
-rw-r--r--gst/tta/gstttadec.h84
-rw-r--r--gst/tta/gstttaparse.c507
-rw-r--r--gst/tta/gstttaparse.h79
-rw-r--r--gst/tta/meson.build14
-rw-r--r--gst/tta/ttadec.h144
-rw-r--r--gst/vbidec/Makefile.am10
-rw-r--r--gst/vbidec/gstvbidec.c381
-rw-r--r--gst/vbidec/gstvbidec.h22
-rw-r--r--gst/vbidec/meson.build14
-rw-r--r--gst/vbidec/vbidata.c1201
-rw-r--r--gst/vbidec/vbidata.h59
-rw-r--r--gst/vbidec/vbiscreen.c825
-rw-r--r--gst/vbidec/vbiscreen.h50
-rw-r--r--meson.build3
-rw-r--r--po/POTFILES.in3
-rw-r--r--po/POTFILES.skip3
-rw-r--r--sys/Makefile.am42
-rw-r--r--sys/avc/Makefile.am25
-rw-r--r--sys/avc/gstavcplugin.cpp41
-rw-r--r--sys/avc/gstavcsrc.cpp423
-rw-r--r--sys/avc/gstavcsrc.h67
-rw-r--r--sys/dxr3/.gitignore1
-rw-r--r--sys/dxr3/Makefile.am30
-rw-r--r--sys/dxr3/ac3_padder.c254
-rw-r--r--sys/dxr3/ac3_padder.h129
-rw-r--r--sys/dxr3/dxr3audiosink.c740
-rw-r--r--sys/dxr3/dxr3audiosink.h112
-rw-r--r--sys/dxr3/dxr3common.h39
-rw-r--r--sys/dxr3/dxr3init.c56
-rw-r--r--sys/dxr3/dxr3marshal.list5
-rw-r--r--sys/dxr3/dxr3spusink.c513
-rw-r--r--sys/dxr3/dxr3spusink.h86
-rw-r--r--sys/dxr3/dxr3videosink.c717
-rw-r--r--sys/dxr3/dxr3videosink.h96
-rw-r--r--sys/linsys/Makefile.am26
-rw-r--r--sys/linsys/gstlinsys.c47
-rw-r--r--sys/linsys/gstlinsyssdisink.c488
-rw-r--r--sys/linsys/gstlinsyssdisink.h59
-rw-r--r--sys/linsys/gstlinsyssdisrc.c551
-rw-r--r--sys/linsys/gstlinsyssdisrc.h62
-rw-r--r--sys/linsys/include/asi.h255
-rw-r--r--sys/linsys/include/master.h69
-rw-r--r--sys/linsys/include/sdi.h115
-rw-r--r--sys/linsys/include/sdiaudio.h149
-rw-r--r--sys/linsys/include/sdivideo.h155
-rw-r--r--sys/meson.build7
-rw-r--r--sys/pvr2d/Makefile.am22
-rw-r--r--sys/pvr2d/gstpvr.c113
-rw-r--r--sys/pvr2d/gstpvr.h46
-rw-r--r--sys/pvr2d/gstpvrbufferpool.c381
-rw-r--r--sys/pvr2d/gstpvrbufferpool.h83
-rw-r--r--sys/pvr2d/gstpvrvideosink.c1479
-rw-r--r--sys/pvr2d/gstpvrvideosink.h153
-rw-r--r--sys/pvr2d/pvr_includes/dri2_ws.h176
-rw-r--r--sys/pvr2d/pvr_includes/img_defs.h123
-rw-r--r--sys/pvr2d/pvr_includes/img_types.h143
-rw-r--r--sys/pvr2d/pvr_includes/pvr2d.h669
-rw-r--r--sys/pvr2d/pvr_includes/services.h1211
-rw-r--r--sys/pvr2d/pvr_includes/servicesext.h855
-rw-r--r--sys/pvr2d/pvr_includes/wsegl.h285
-rw-r--r--sys/qcam/Makefile.am12
-rw-r--r--sys/qcam/dark.c258
-rw-r--r--sys/qcam/exposure.c287
-rw-r--r--sys/qcam/gstqcamsrc.c445
-rw-r--r--sys/qcam/gstqcamsrc.h78
-rw-r--r--sys/qcam/qcam-Linux.c277
-rw-r--r--sys/qcam/qcam-Linux.h32
-rw-r--r--sys/qcam/qcam-lib.c849
-rw-r--r--sys/qcam/qcam-os.c277
-rw-r--r--sys/qcam/qcam-os.h32
-rw-r--r--sys/qcam/qcam.h134
-rw-r--r--sys/qcam/qcamip.h67
-rw-r--r--sys/wininet/Makefile.am11
-rw-r--r--sys/wininet/gstwininetsrc.c450
-rw-r--r--sys/wininet/gstwininetsrc.h69
-rw-r--r--tests/check/Makefile.am18
-rw-r--r--tests/check/elements/timidity.c74
-rw-r--r--tests/icles/dccp/README52
-rw-r--r--tests/icles/dccp/call/DCCPClient.c152
-rw-r--r--tests/icles/dccp/call/DCCPServer.c145
-rw-r--r--tests/icles/dccp/call/README1
-rw-r--r--tests/icles/dccp/file/DCCPClientSaveFile.c113
-rw-r--r--tests/icles/dccp/file/DCCPServerSendFile.c112
-rw-r--r--tests/icles/dccp/mic/DCCPClientPlayMic.c116
-rw-r--r--tests/icles/dccp/mic/DCCPServerMic.c111
-rw-r--r--tests/icles/dccp/mp3/DCCPClientPlayMP3.c117
-rw-r--r--tests/icles/dccp/mp3/DCCPServerSendMP3.c113
-rw-r--r--tests/icles/dccp/mp3Speex/DCCPClientPlaySpeexMP3.c120
-rw-r--r--tests/icles/dccp/mp3Speex/DCCPServerSendSpeexMP3.c128
-rw-r--r--tests/icles/dccp/mp3Stream/DCCPClientPlayMP3Stream.c113
-rw-r--r--tests/icles/dccp/mp3Stream/DCCPServerSendMP3Stream.c113
225 files changed, 15 insertions, 56120 deletions
diff --git a/config.h.meson b/config.h.meson
index 551e4315c..e24ba97d2 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -94,9 +94,6 @@
/* Define to enable Android Media (used by androidmedia). */
#mesondefine HAVE_ANDROID_MEDIA
-/* Define to enable AirPort Express Wireless sink (used by apexsink). */
-#mesondefine HAVE_APEXSINK
-
/* Define to enable Apple video (used by applemedia). */
#mesondefine HAVE_APPLE_MEDIA
@@ -229,12 +226,6 @@
/* Define to 1 if you have the <fcntl.h> header file. */
#mesondefine HAVE_FCNTL_H
-/* FIONREAD ioctl found in sys/filio.h */
-#mesondefine HAVE_FIONREAD_IN_SYS_FILIO
-
-/* FIONREAD ioctl found in sys/ioclt.h */
-#mesondefine HAVE_FIONREAD_IN_SYS_IOCTL
-
/* Define to enable Flite plugin (used by flite). */
#mesondefine HAVE_FLITE
@@ -322,12 +313,6 @@
/* Define if libusb 1.x is installed */
#mesondefine HAVE_LIBUSB
-/* Define to enable libvisual visualization library (used by libvisual). */
-#mesondefine HAVE_LIBVISUAL
-
-/* Define to enable Linear Systems SDI plugin (used by linsys). */
-#mesondefine HAVE_LINSYS
-
/* Define if we have liblrdf */
#mesondefine HAVE_LRDF
@@ -364,9 +349,6 @@
/* Define to enable MythTV client plugins (used by mythtvsrc). */
#mesondefine HAVE_MYTHTV
-/* Define to enable nas plug-in (used by nassink). */
-#mesondefine HAVE_NAS
-
/* Define to enable neon http client plugins (used by neonhttpsrc). */
#mesondefine HAVE_NEON
@@ -454,9 +436,6 @@
/* Define to enable Schroedinger video codec (used by schro). */
#mesondefine HAVE_SCHRO
-/* Define to enable SDL plug-in (used by sdlvideosink sdlaudiosink). */
-#mesondefine HAVE_SDL
-
/* Define to enable POSIX shared memory source and sink (used by shm). */
#mesondefine HAVE_SHM
@@ -466,9 +445,6 @@
/* Define to enable sndfile plug-in (used by sfdec sfenc). */
#mesondefine HAVE_SNDFILE
-/* Define to enable sndio audio (used by sndio). */
-#mesondefine HAVE_SNDIO
-
/* Define to enable soundtouch plug-in (used by soundtouch). */
#mesondefine HAVE_SOUNDTOUCH
@@ -523,9 +499,6 @@
/* Define if libtiger is available */
#mesondefine HAVE_TIGER
-/* Define to enable timidity midi soft synth plugin (used by timidity). */
-#mesondefine HAVE_TIMIDITY
-
/* Define to 1 if you have the <unistd.h> header file. */
#mesondefine HAVE_UNISTD_H
@@ -574,12 +547,6 @@
/* Define to 1 if you have the <windows.h> header file. */
#mesondefine HAVE_WINDOWS_H
-/* Define to enable Windows internet library (used by wininet). */
-#mesondefine HAVE_WININET
-
-/* Define to 1 if you have the <wininet.h> header file. */
-#mesondefine HAVE_WININET_H
-
/* Define to enable Winks plug-in (used by winks). */
#mesondefine HAVE_WINKS
@@ -595,9 +562,6 @@
/* Define if you have X11 library */
#mesondefine HAVE_X11
-/* Define to enable xvid plugins (used by xvid). */
-#mesondefine HAVE_XVID
-
/* Define to enable ZBar barcode detector (used by zbar). */
#mesondefine HAVE_ZBAR
@@ -607,9 +571,6 @@
/* library dir */
#mesondefine LIBDIR
-/* directory in which the detected libvisual's plugins are located */
-#mesondefine LIBVISUAL_PLUGINSBASEDIR
-
/* gettext locale dir */
#mesondefine LOCALEDIR
@@ -668,9 +629,6 @@
/* the target CPU */
#mesondefine TARGET_CPU
-/* Define location of timidity.cfg */
-#mesondefine TIMIDITY_CFG
-
/* Use Mali FB EGL platform */
#mesondefine USE_EGL_MALI_FB
diff --git a/configure.ac b/configure.ac
index 10bdca764..dfe2f9d97 100644
--- a/configure.ac
+++ b/configure.ac
@@ -164,16 +164,8 @@ AX_CREATE_STDINT_H
AC_CHECK_HEADERS([pthread.h], HAVE_PTHREAD_H=yes)
AM_CONDITIONAL(HAVE_PTHREAD_H, test "x$HAVE_PTHREAD_H" = "xyes")
-if test "x$HAVE_PTHREAD_H" != "xyes"; then
- GST_PLUGINS_SELECTED=`echo $GST_PLUGINS_SELECTED | $SED -e s/dccp//`
-fi
-
dnl *** checks for types/defines ***
-dnl Check for FIONREAD ioctl declaration
-dnl used in gst/dccp
-GST_CHECK_FIONREAD
-
dnl *** checks for structures ***
dnl *** checks for compiler characteristics ***
@@ -467,21 +459,6 @@ dnl used in examples
AG_GST_DEFAULT_ELEMENTS
dnl *** plug-ins to include ***
-dnl Non ported plugins (non-dependant, then dependant)
-dnl Make sure you have a space before and after all plugins
-GST_PLUGINS_NONPORTED=" cdxaparse \
- dccp faceoverlay \
- hdvparse \
- mve nuvdemux \
- patchdetect \
- sdi tta \
- linsys \
- apexsink \
- nas sdl timidity \
- wininet \
- xvid sndio libvisual"
-
-AC_SUBST(GST_PLUGINS_NONPORTED)
dnl these are all the gst plug-ins, compilable without additional libs
AG_GST_CHECK_PLUGIN(accurip)
@@ -498,13 +475,10 @@ AG_GST_CHECK_PLUGIN(audiovisualizers)
AG_GST_CHECK_PLUGIN(autoconvert)
AG_GST_CHECK_PLUGIN(bayer)
AG_GST_CHECK_PLUGIN(camerabin2)
-AG_GST_CHECK_PLUGIN(cdxaparse)
AG_GST_CHECK_PLUGIN(coloreffects)
-AG_GST_CHECK_PLUGIN(dccp)
AG_GST_CHECK_PLUGIN(debugutils)
AG_GST_CHECK_PLUGIN(dvbsuboverlay)
AG_GST_CHECK_PLUGIN(dvdspu)
-AG_GST_CHECK_PLUGIN(faceoverlay)
AG_GST_CHECK_PLUGIN(festival)
AG_GST_CHECK_PLUGIN(fieldanalysis)
AG_GST_CHECK_PLUGIN(freeverb)
@@ -512,7 +486,6 @@ AG_GST_CHECK_PLUGIN(frei0r)
AG_GST_CHECK_PLUGIN(gaudieffects)
AG_GST_CHECK_PLUGIN(geometrictransform)
AG_GST_CHECK_PLUGIN(gdp)
-AG_GST_CHECK_PLUGIN(hdvparse)
AG_GST_CHECK_PLUGIN(id3tag)
AG_GST_CHECK_PLUGIN(inter)
AG_GST_CHECK_PLUGIN(interlace)
@@ -526,17 +499,13 @@ AG_GST_CHECK_PLUGIN(mpegdemux)
AG_GST_CHECK_PLUGIN(mpegtsdemux)
AG_GST_CHECK_PLUGIN(mpegtsmux)
AG_GST_CHECK_PLUGIN(mpegpsmux)
-AG_GST_CHECK_PLUGIN(mve)
AG_GST_CHECK_PLUGIN(mxf)
AG_GST_CHECK_PLUGIN(netsim)
-AG_GST_CHECK_PLUGIN(nuvdemux)
AG_GST_CHECK_PLUGIN(onvif)
-AG_GST_CHECK_PLUGIN(patchdetect)
AG_GST_CHECK_PLUGIN(pcapparse)
AG_GST_CHECK_PLUGIN(pnm)
AG_GST_CHECK_PLUGIN(rawparse)
AG_GST_CHECK_PLUGIN(removesilence)
-AG_GST_CHECK_PLUGIN(sdi)
AG_GST_CHECK_PLUGIN(sdp)
AG_GST_CHECK_PLUGIN(segmentclip)
AG_GST_CHECK_PLUGIN(siren)
@@ -545,7 +514,6 @@ AG_GST_CHECK_PLUGIN(speed)
AG_GST_CHECK_PLUGIN(subenc)
AG_GST_CHECK_PLUGIN(stereo)
AG_GST_CHECK_PLUGIN(timecode)
-AG_GST_CHECK_PLUGIN(tta)
AG_GST_CHECK_PLUGIN(videofilters)
AG_GST_CHECK_PLUGIN(videoparsers)
AG_GST_CHECK_PLUGIN(videosignal)
@@ -600,13 +568,6 @@ if test "x$HAVE_WINSOCK2_H" = "xyes"; then
AC_SUBST(WINSOCK2_LIBS)
fi
-if test "x$HAVE_PTHREAD_H" = "xyes"; then
- DCCP_LIBS="$DCCP_LIBS $PTHREAD_LIBS"
- AC_SUBST(DCCP_LIBS)
-else
- AG_GST_DISABLE_PLUGIN(dccp)
-fi
-
dnl *** opengl ***
AC_ARG_ENABLE([opengl],
[ --enable-opengl Enable Desktop OpenGL support @<:@default=auto@:>@],
@@ -2098,24 +2059,6 @@ AG_GST_CHECK_FEATURE(VOAACENC, [vo-aacenc library], vo-aacenc, [
AG_GST_PKG_CHECK_MODULES(VOAACENC, vo-aacenc >= 0.1.0)
])
-dnl *** apexsink ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_APEXSINK, true)
-AG_GST_CHECK_FEATURE(APEXSINK, [AirPort Express Wireless sink], apexsink, [
- PKG_CHECK_MODULES(APEXSINK, [ openssl >= 0.9.5 libcrypto ], [
- HAVE_APEXSINK="yes"
- saved_LIBS="$LIBS"
- LIBS=""
- AC_SEARCH_LIBS(socket, [socket], [ ], [ APEXSINK="no" ])
- AC_SEARCH_LIBS(gethostbyname, [nsl], [ ], [ APEXSINK="no" ])
- APEXSINK_LIBS="$APEXSINK_LIBS $LIBS"
- LIBS="$saved_LIBS"
- AC_SUBST(APEXSINK_CFLAGS)
- AC_SUBST(APEXSINK_LIBS)
- ], [
- APEXSINK="no"
- ])
-])
-
dnl *** bs2b ***
translit(dnm, m, l) AM_CONDITIONAL(USE_BS2B, true)
AG_GST_CHECK_FEATURE(BS2B, [bs2b], bs2b, [
@@ -2525,19 +2468,6 @@ AG_GST_CHECK_FEATURE(TTML, [TTML plugin], ttml, [
fi
])
-dnl *** linsys ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_LINSYS, true)
-AG_GST_CHECK_FEATURE(LINSYS, [Linear Systems SDI plugin], linsys, [
- case "$host" in
- *-*linux*)
- HAVE_LINSYS=yes
- ;;
- *)
- HAVE_LINSYS=no
- ;;
- esac
-])
-
dnl *** modplug ***
translit(dnm, m, l) AM_CONDITIONAL(USE_MODPLUG, true)
AG_GST_CHECK_FEATURE(MODPLUG, modplug, modplug, [
@@ -2745,21 +2675,6 @@ AG_GST_CHECK_FEATURE(MUSEPACK, [musepackdec], musepack, [
], [HAVE_MUSEPACK="no"])])
])
-dnl *** nas ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_NAS, true)
-AG_GST_CHECK_FEATURE(NAS, [nas plug-in], nassink, [
- HAVE_NAS="no"
- if test "x$HAVE_X" = "xyes"; then
- save_cppflags=$CFLAGS
- CPPFLAGS="$CPPFLAGS $X_CFLAGS"
- AG_GST_CHECK_LIBHEADER(NAS, audio, AuOpenServer, $X_LIBS, audio/audiolib.h,
- NAS_LIBS="$X_LIBS -laudio" NAS_CFLAGS="$X_CFLAGS")
- CPPFLAGS="$save_cppflags"
- fi
- AC_SUBST(NAS_CFLAGS)
- AC_SUBST(NAS_LIBS)
-])
-
dnl *** neon ***
translit(dnm, m, l) AM_CONDITIONAL(USE_NEON, true)
AG_GST_CHECK_FEATURE(NEON, [neon http client plugins], neonhttpsrc, [
@@ -2901,20 +2816,6 @@ AG_GST_CHECK_FEATURE(OPUS, [opus], opus, [
AC_SUBST(OPUS_LIBS)
])
-dnl *** pvr ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_PVR, true)
-AG_GST_CHECK_FEATURE(PVR, [pvrvideosink], pvr, [
- PKG_CHECK_MODULES([PVR], [libtimemmgr], HAVE_PVR=yes, HAVE_PVR=no)
- AC_SUBST(PVR_CFLAGS)
- AC_SUBST(PVR_LIBS)
-])
-
- AC_ARG_WITH([pvr-external-headers],
- AS_HELP_STRING([--with-pvr-external-headers],[Use system installed PVR2D headers]),
- [AS_IF([test "x$with_pvr_external_headers" = "xno"],
- [PVR_CFLAGS="$PVR_CFLAGS -I\$(srcdir)/pvr_includes"])],
- [PVR_CFLAGS="$PVR_CFLAGS -I\$(srcdir)/pvr_includes"])
-
dnl *** rsvg ***
translit(dnm, m, l) AM_CONDITIONAL(USE_RSVG, true)
AG_GST_CHECK_FEATURE(RSVG, [rsvg decoder], rsvg, [
@@ -3077,50 +2978,6 @@ AG_GST_CHECK_FEATURE(VULKAN, [Vulkan elements], vulkan, [
], [])
])
-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 x$HAVE_LIBVISUAL = xyes; then
- LIBVIS_PLUGINSDIR="`$PKG_CONFIG --variable=pluginsbasedir libvisual-0.4`"
- 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 *** timidity ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_TIMIDITY, true)
-AG_GST_CHECK_FEATURE(TIMIDITY, [timidity midi soft synth plugin], timidity, [
- PKG_CHECK_MODULES(TIMIDITY, libtimidity, [
- HAVE_TIMIDITY="yes",
- AC_MSG_CHECKING([for timidity.cfg])
- timidity_cfg=""
- if test -r /etc/timidity.cfg; then
- timidity_cfg=/etc/timidity.cfg
- elif test -r /etc/timidity/timidity.cfg; then
- timidity_cfg=/etc/timidity/timidity.cfg
- elif test -r /usr/share/timidity/timidity.cfg; then
- timidity_cfg=/usr/share/timidity/timidity.cfg
- elif test -r /usr/local/share/timidity/timidity.cfg; then
- timidity_cfg=/usr/local/share/timidity/timidity.cfg
- fi
- if test "x$timidity_cfg" != "x"; then
- AC_MSG_RESULT($timidity_cfg)
- AC_DEFINE_UNQUOTED(TIMIDITY_CFG, "$timidity_cfg", [Define location of timidity.cfg])
- else
- AC_MSG_RESULT([not found])
- fi
- ], [
- HAVE_TIMIDITY="no"
- ])
- AC_SUBST(TIMIDITY_CFLAGS)
- AC_SUBST(TIMIDITY_LIBS)
-])
-
dnl *** teletextdec ***
translit(dnm, m, l) AM_CONDITIONAL(USE_TELETEXTDEC, true)
AG_GST_CHECK_FEATURE(TELETEXTDEC, [Teletext decoder], teletextdec, [
@@ -3149,12 +3006,6 @@ AG_GST_CHECK_FEATURE(WILDMIDI, [wildmidi midi soft synth plugin], wildmidi, [
AC_SUBST(WILDMIDI_LIBS)
])
-dnl *** SDL ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_SDL, true)
-AG_GST_CHECK_FEATURE(SDL, [SDL plug-in], sdlvideosink sdlaudiosink, [
- AM_PATH_SDL(, HAVE_SDL=yes, HAVE_SDL=no)
-])
-
dnl **** Smooth Streaming ****
translit(dnm, m, l) AM_CONDITIONAL(USE_SMOOTHSTREAMING, true)
AG_GST_CHECK_FEATURE(SMOOTHSTREAMING, [Smooth Streaming plug-in], smoothstreaming, [
@@ -3247,36 +3098,6 @@ AG_GST_CHECK_FEATURE(GME, [gme decoder], gme, [
fi
])
-dnl *** XVID ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_XVID, true)
-AG_GST_CHECK_FEATURE(XVID, [xvid plugins], xvid, [
- HAVE_XVID=no
- AC_CHECK_HEADER(xvid.h, [
- OLD_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBM"
- AC_CHECK_LIB(xvidcore, xvid_encore, [
- AC_CHECK_LIB(xvidcore, xvid_decore, [
- AC_CHECK_LIB(xvidcore, xvid_global, [
- AC_MSG_CHECKING([for up-to-date XviD API version])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <xvid.h>]], [[
- #if XVID_API_MAJOR(XVID_API) != 4
- #error "Incompatible XviD API version"
- #endif
- #if XVID_API_MAJOR(XVID_API) == 4 && XVID_API_MINOR(XVID_API) < 3
- #error "Incompatible XviD API version"
- #endif
- ]])],[ AC_MSG_RESULT(yes)
- XVID_LIBS="-lxvidcore $LIBM"
- AC_SUBST(XVID_LIBS)
- HAVE_XVID=yes
- ],[AC_MSG_RESULT(no) ])
- ], )
- ], )
- ], )
- LIBS="$OLD_LIBS"
- ], )
-])
-
dnl *** dvb ***
translit(dnm, m, l) AM_CONDITIONAL(USE_DVB, true)
AG_GST_CHECK_FEATURE(DVB, [DVB Source], dvb, [
@@ -3295,16 +3116,6 @@ AG_GST_CHECK_FEATURE(DVB, [DVB Source], dvb, [
], [HAVE_DVB="no"])
])
-dnl *** wininet ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_WININET, true)
-AG_GST_CHECK_FEATURE(WININET, [Windows internet library], wininet, [
- AC_MSG_CHECKING([Checking for windows internet support])
- AC_CHECK_HEADERS([windows.h wininet.h],
- [HAVE_WININET="yes"], [HAVE_WININET="no"],
- [AC_INCLUDES_DEFAULT
-#include <windows.h>])
-])
-
dnl *** acm ***
translit(dnm, m, l) AM_CONDITIONAL(USE_ACM, true)
AG_GST_CHECK_FEATURE(ACM, [Windows ACM library], acm, [
@@ -3398,19 +3209,6 @@ AG_GST_CHECK_FEATURE(SPANDSP, [Spandsp], spandsp, [
AC_SUBST(SPANDSP_CFLAGS)
AC_SUBST(SPANDSP_LIBS)
-dnl *** sndio ***
-translit(dnm, m, l) AM_CONDITIONAL(USE_SNDIO, true)
-AG_GST_CHECK_FEATURE(SNDIO, [sndio audio], sndio, [
- AC_CHECK_HEADER(sndio.h, HAVE_SNDIO="yes", HAVE_SNDIO="no")
- if test "x$HAVE_SNDIO" = "xyes"; then
- AC_CHECK_LIB(sndio, sio_open, HAVE_SNDIO="yes", HAVE_SNDIO="no")
- if test "x$HAVE_SNDIO" = "xyes"; then
- SNDIO_LIBS=-lsndio
- AC_SUBST(SNDIO_LIBS)
- fi
- fi
-])
-
dnl *** hls-crypto ***
AC_ARG_WITH([hls-crypto],
AS_HELP_STRING([--with-hls-crypto=auto|nettle|libgcrypt|openssl], [
@@ -3509,7 +3307,6 @@ dnl but we still need to set the conditionals
AM_CONDITIONAL(USE_ASSRENDER, false)
AM_CONDITIONAL(USE_VOAMRWBENC, false)
AM_CONDITIONAL(USE_VOAACENC, false)
-AM_CONDITIONAL(USE_APEXSINK, false)
AM_CONDITIONAL(USE_BS2B, false)
AM_CONDITIONAL(USE_BZ2, false)
AM_CONDITIONAL(USE_CHROMAPRINT, false)
@@ -3544,12 +3341,10 @@ AM_CONDITIONAL(USE_LADSPA, false)
AM_CONDITIONAL(USE_LV2, false)
AM_CONDITIONAL(USE_LIBDE265, false)
AM_CONDITIONAL(USE_LIBMMS, false)
-AM_CONDITIONAL(USE_LINSYS, false)
AM_CONDITIONAL(USE_MODPLUG, false)
AM_CONDITIONAL(USE_MPEG2ENC, false)
AM_CONDITIONAL(USE_MPLEX, false)
AM_CONDITIONAL(USE_MUSEPACK, false)
-AM_CONDITIONAL(USE_NAS, false)
AM_CONDITIONAL(USE_NEON, false)
AM_CONDITIONAL(USE_OFA, false)
AM_CONDITIONAL(USE_OPENAL, false)
@@ -3558,12 +3353,8 @@ AM_CONDITIONAL(USE_OPENEXR, false)
AM_CONDITIONAL(USE_OPENJPEG, false)
AM_CONDITIONAL(USE_OPENNI2, false)
AM_CONDITIONAL(USE_OPUS, false)
-AM_CONDITIONAL(USE_PVR, false)
AM_CONDITIONAL(USE_QT, false)
-AM_CONDITIONAL(USE_LIBVISUAL, false)
-AM_CONDITIONAL(USE_TIMIDITY, false)
AM_CONDITIONAL(USE_WILDMIDI, false)
-AM_CONDITIONAL(USE_SDL, false)
AM_CONDITIONAL(USE_SMOOTHSTREAMING, false)
AM_CONDITIONAL(USE_SNDFILE, false)
AM_CONDITIONAL(USE_SOUNDTOUCH, false)
@@ -3571,9 +3362,7 @@ AM_CONDITIONAL(USE_SPANDSP, false)
AM_CONDITIONAL(USE_SPC, false)
AM_CONDITIONAL(USE_SRTP, false)
AM_CONDITIONAL(USE_GME, false)
-AM_CONDITIONAL(USE_XVID, false)
AM_CONDITIONAL(USE_DVB, false)
-AM_CONDITIONAL(USE_WININET, false)
AM_CONDITIONAL(USE_ACM, false)
AM_CONDITIONAL(USE_VDPAU, false)
AM_CONDITIONAL(USE_SBC, false)
@@ -3582,7 +3371,6 @@ AM_CONDITIONAL(USE_ZBAR, false)
AM_CONDITIONAL(USE_RSVG, false)
AM_CONDITIONAL(USE_RTMP, false)
AM_CONDITIONAL(USE_TELETEXTDEC, false)
-AM_CONDITIONAL(USE_SNDIO, false)
AM_CONDITIONAL(USE_UVCH264, false)
AM_CONDITIONAL(USE_WEBP, false)
AM_CONDITIONAL(USE_WEBRTCDSP, false)
@@ -3690,13 +3478,10 @@ gst/audiovisualizers/Makefile
gst/autoconvert/Makefile
gst/bayer/Makefile
gst/camerabin2/Makefile
-gst/cdxaparse/Makefile
gst/coloreffects/Makefile
-gst/dccp/Makefile
gst/debugutils/Makefile
gst/dvbsuboverlay/Makefile
gst/dvdspu/Makefile
-gst/faceoverlay/Makefile
gst/festival/Makefile
gst/fieldanalysis/Makefile
gst/freeverb/Makefile
@@ -3704,7 +3489,6 @@ gst/frei0r/Makefile
gst/gaudieffects/Makefile
gst/geometrictransform/Makefile
gst/gdp/Makefile
-gst/hdvparse/Makefile
gst/id3tag/Makefile
gst/inter/Makefile
gst/interlace/Makefile
@@ -3719,17 +3503,13 @@ gst/mpegtsdemux/Makefile
gst/mpegtsmux/Makefile
gst/mpegtsmux/tsmux/Makefile
gst/mpegpsmux/Makefile
-gst/mve/Makefile
gst/mxf/Makefile
gst/netsim/Makefile
-gst/nuvdemux/Makefile
gst/onvif/Makefile
-gst/patchdetect/Makefile
gst/pcapparse/Makefile
gst/pnm/Makefile
gst/rawparse/Makefile
gst/removesilence/Makefile
-gst/sdi/Makefile
gst/sdp/Makefile
gst/segmentclip/Makefile
gst/siren/Makefile
@@ -3737,7 +3517,6 @@ gst/smooth/Makefile
gst/speed/Makefile
gst/subenc/Makefile
gst/stereo/Makefile
-gst/tta/Makefile
gst/timecode/Makefile
gst/videofilters/Makefile
gst/videoparsers/Makefile
@@ -3787,7 +3566,6 @@ sys/dshowvideosink/Makefile
sys/dvb/Makefile
sys/fbdev/Makefile
sys/kms/Makefile
-sys/linsys/Makefile
sys/msdk/Makefile
sys/nvenc/Makefile
sys/opensles/Makefile
@@ -3796,9 +3574,7 @@ sys/tinyalsa/Makefile
sys/uvch264/Makefile
sys/vcd/Makefile
sys/vdpau/Makefile
-sys/pvr2d/Makefile
sys/wasapi/Makefile
-sys/wininet/Makefile
sys/winks/Makefile
sys/winscreencap/Makefile
tests/Makefile
@@ -3835,7 +3611,6 @@ tests/icles/Makefile
ext/voamrwbenc/Makefile
ext/voaacenc/Makefile
ext/assrender/Makefile
-ext/apexsink/Makefile
ext/bs2b/Makefile
ext/bz2/Makefile
ext/chromaprint/Makefile
@@ -3861,13 +3636,11 @@ ext/ladspa/Makefile
ext/lv2/Makefile
ext/libde265/Makefile
ext/libmms/Makefile
-ext/libvisual/Makefile
ext/Makefile
ext/modplug/Makefile
ext/mpeg2enc/Makefile
ext/mplex/Makefile
ext/musepack/Makefile
-ext/nas/Makefile
ext/neon/Makefile
ext/ofa/Makefile
ext/openal/Makefile
@@ -3883,23 +3656,20 @@ ext/resindvd/Makefile
ext/rtmp/Makefile
ext/sbc/Makefile
ext/schroedinger/Makefile
-ext/sdl/Makefile
ext/smoothstreaming/Makefile
ext/sndfile/Makefile
ext/soundtouch/Makefile
ext/spandsp/Makefile
-ext/sndio/Makefile
ext/srtp/Makefile
ext/teletextdec/Makefile
ext/gme/Makefile
ext/spc/Makefile
-ext/timidity/Makefile
+ext/wildmidi/Makefile
ext/vulkan/Makefile
ext/vulkan/xcb/Makefile
ext/vulkan/wayland/Makefile
ext/webp/Makefile
ext/x265/Makefile
-ext/xvid/Makefile
ext/zbar/Makefile
ext/dtls/Makefile
ext/webrtcdsp/Makefile
diff --git a/docs/plugins/Makefile.am b/docs/plugins/Makefile.am
index 87dbd46f2..69e8f882f 100644
--- a/docs/plugins/Makefile.am
+++ b/docs/plugins/Makefile.am
@@ -103,10 +103,7 @@ EXTRA_HFILES = \
$(top_srcdir)/ext/rtmp/gstrtmpsink.h \
$(top_srcdir)/ext/spandsp/gstspanplc.h \
$(top_srcdir)/ext/spandsp/gstdtmfdetect.h \
- $(top_srcdir)/ext/sdl/sdlaudiosink.h \
- $(top_srcdir)/ext/sdl/sdlvideosink.h \
- $(top_srcdir)/ext/timidity/gsttimidity.h \
- $(top_srcdir)/ext/timidity/gstwildmidi.h \
+ $(top_srcdir)/ext/wildmidi/gstwildmidi.h \
$(top_srcdir)/ext/voaacenc/gstvoaacenc.h \
$(top_srcdir)/ext/voamrwbenc/gstvoamrwbenc.h \
$(top_srcdir)/ext/webrtcdsp/gstwebrtcdsp.h \
@@ -121,10 +118,6 @@ EXTRA_HFILES = \
$(top_srcdir)/gst/audiovisualizers/gstwavescope.h \
$(top_srcdir)/gst/camerabin2/gstcamerabin2.h \
$(top_srcdir)/gst/coloreffects/gstcoloreffects.h \
- $(top_srcdir)/gst/dccp/gstdccpclientsink.h \
- $(top_srcdir)/gst/dccp/gstdccpclientsrc.h \
- $(top_srcdir)/gst/dccp/gstdccpserversink.h \
- $(top_srcdir)/gst/dccp/gstdccpserversrc.h \
$(top_srcdir)/gst/debugutils/fpsdisplaysink.h \
$(top_srcdir)/gst/dvdspu/gstdvdspu.h \
$(top_srcdir)/gst/festival/gstfestival.h \
@@ -156,7 +149,6 @@ EXTRA_HFILES = \
$(top_srcdir)/gst/mpegtsmux/mpegtsmux.h \
$(top_srcdir)/gst/mxf/mxfdemux.h \
$(top_srcdir)/gst/mxf/mxfmux.h \
- $(top_srcdir)/gst/nuvdemux/gstnuvdemux.h \
$(top_srcdir)/gst/pcapparse/gstpcapparse.h \
$(top_srcdir)/gst/rawparse/gstaudioparse.h \
$(top_srcdir)/gst/rawparse/gstvideoparse.h \
diff --git a/docs/plugins/gst-plugins-bad-plugins-sections.txt b/docs/plugins/gst-plugins-bad-plugins-sections.txt
index 1e4a5cf63..8d420a32c 100644
--- a/docs/plugins/gst-plugins-bad-plugins-sections.txt
+++ b/docs/plugins/gst-plugins-bad-plugins-sections.txt
@@ -836,62 +836,6 @@ gst_dc1394_get_type
</SECTION>
<SECTION>
-<FILE>element-dccpclientsink</FILE>
-<TITLE>dccpclientsink</TITLE>
-GstDCCPClientSink
-<SUBSECTION Standard>
-GstDCCPClientSinkClass
-GST_DCCP_CLIENT_SINK
-GST_DCCP_CLIENT_SINK_CLASS
-GST_IS_DCCP_CLIENT_SINK
-GST_IS_DCCP_CLIENT_SINK_CLASS
-GST_TYPE_DCCP_CLIENT_SINK
-gst_dccp_client_sink_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-dccpclientsrc</FILE>
-<TITLE>dccpclientsrc</TITLE>
-GstDCCPClientSrc
-<SUBSECTION Standard>
-GstDCCPClientSrcClass
-GST_DCCP_CLIENT_SRC
-GST_DCCP_CLIENT_SRC_CLASS
-GST_IS_DCCP_CLIENT_SRC
-GST_IS_DCCP_CLIENT_SRC_CLASS
-GST_TYPE_DCCP_CLIENT_SRC
-gst_dccp_client_src_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-dccpserversink</FILE>
-<TITLE>dccpserversink</TITLE>
-GstDCCPServerSink
-<SUBSECTION Standard>
-GstDCCPServerSinkClass
-GST_DCCP_SERVER_SINK
-GST_DCCP_SERVER_SINK_CLASS
-GST_IS_DCCP_SERVER_SINK
-GST_IS_DCCP_SERVER_SINK_CLASS
-GST_TYPE_DCCP_SERVER_SINK
-gst_dccp_server_sink_get_type
-</SECTION>
-
-<SECTION>
-<FILE>element-dccpserversrc</FILE>
-<TITLE>dccpserversrc</TITLE>
-GstDCCPServerSrc
-<SUBSECTION Standard>
-GstDCCPServerSrcClass
-GST_DCCP_SERVER_SRC
-GST_DCCP_SERVER_SRC_CLASS
-GST_IS_DCCP_SERVER_SRC
-GST_IS_DCCP_SERVER_SRC_CLASS
-GST_TYPE_DCCP_SERVER_SRC
-gst_dccp_server_src_get_type
-</SECTION>
-
-<SECTION>
<FILE>element-debugspy</FILE>
<TITLE>debugspy</TITLE>
GstDebugSpy
@@ -2818,21 +2762,6 @@ gst_net_sim_get_type
</SECTION>
<SECTION>
-<FILE>element-nuvdemux</FILE>
-<TITLE>nuvdemux</TITLE>
-GstNuvDemux
-<SUBSECTION Standard>
-GstNuvDemuxClass
-GstNuvDemuxState
-GST_NUV_DEMUX
-GST_NUV_DEMUX_CLASS
-GST_IS_NUV_DEMUX
-GST_IS_NUV_DEMUX_CLASS
-GST_TYPE_NUV_DEMUX
-gst_nuv_demux_get_type
-</SECTION>
-
-<SECTION>
<FILE>element-neonhttpsrc</FILE>
<TITLE>neonhttpsrc</TITLE>
GstNeonhttpSrc
@@ -3297,37 +3226,6 @@ gst_rtp_onvif_timestamp_get_type
</SECTION>
<SECTION>
-<FILE>element-sdlaudiosink</FILE>
-<TITLE>sdlaudiosink</TITLE>
-GstSDLAudioSink
-<SUBSECTION Standard>
-GstSDLAudioSinkClass
-GST_SDLAUDIOSINK
-GST_SDLAUDIOSINK_CLASS
-GST_IS_SDLAUDIOSINK
-GST_IS_SDLAUDIOSINK_CLASS
-GST_TYPE_SDLAUDIOSINK
-gst_sdlaudio_sink_get_type
-<SUBSECTION Private>
-gstsdl_semaphore
-</SECTION>
-
-<SECTION>
-<FILE>element-sdlvideosink</FILE>
-<TITLE>sdlvideosink</TITLE>
-GstSDLVideoSink
-<SUBSECTION Standard>
-GstSDLVideoSinkFlags
-GstSDLVideoSinkClass
-GST_SDLVIDEOSINK
-GST_SDLVIDEOSINK_CLASS
-GST_IS_SDLVIDEOSINK
-GST_IS_SDLVIDEOSINK_CLASS
-GST_TYPE_SDLVIDEOSINK
-gst_sdlvideosink_get_type
-</SECTION>
-
-<SECTION>
<FILE>element-sdpdemux</FILE>
<TITLE>sdpdemux</TITLE>
GstSDPDemux
@@ -3842,20 +3740,6 @@ gst_tone_generate_src_get_type
</SECTION>
<SECTION>
-<FILE>element-timidity</FILE>
-<TITLE>timidity</TITLE>
-GstTimidity
-<SUBSECTION Standard>
-GstTimidityClass
-GST_TIMIDITY
-GST_TIMIDITY_CLASS
-GST_IS_TIMIDITY
-GST_IS_TIMIDITY_CLASS
-GST_TYPE_TIMIDITY
-gst_timidity_get_type
-</SECTION>
-
-<SECTION>
<FILE>element-tunnel</FILE>
<TITLE>tunnel</TITLE>
GstTunnel
diff --git a/docs/plugins/gst-plugins-bad-plugins.signals b/docs/plugins/gst-plugins-bad-plugins.signals
index 7fecee4f1..87145c2ec 100644
--- a/docs/plugins/gst-plugins-bad-plugins.signals
+++ b/docs/plugins/gst-plugins-bad-plugins.signals
@@ -33,38 +33,6 @@ gint64 arg3
</SIGNAL>
<SIGNAL>
-<NAME>GstDCCPClientSrc::connected</NAME>
-<RETURNS>void</RETURNS>
-<FLAGS>f</FLAGS>
-GstDCCPClientSrc *gstdccpclientsrc
-gint arg1
-</SIGNAL>
-
-<SIGNAL>
-<NAME>GstDCCPServerSink::connected</NAME>
-<RETURNS>void</RETURNS>
-<FLAGS>f</FLAGS>
-GstDCCPServerSink *gstdccpserversink
-gint arg1
-</SIGNAL>
-
-<SIGNAL>
-<NAME>GstDCCPClientSink::connected</NAME>
-<RETURNS>void</RETURNS>
-<FLAGS>f</FLAGS>
-GstDCCPClientSink *gstdccpclientsink
-gint arg1
-</SIGNAL>
-
-<SIGNAL>
-<NAME>GstDCCPServerSrc::connected</NAME>
-<RETURNS>void</RETURNS>
-<FLAGS>f</FLAGS>
-GstDCCPServerSrc *gstdccpserversrc
-gint arg1
-</SIGNAL>
-
-<SIGNAL>
<NAME>GstCameraBin::img-done</NAME>
<RETURNS>gboolean</RETURNS>
<FLAGS>l</FLAGS>
diff --git a/ext/Makefile.am b/ext/Makefile.am
index fdce19efe..534b9ac7b 100644
--- a/ext/Makefile.am
+++ b/ext/Makefile.am
@@ -10,12 +10,6 @@ else
VOAMRWBENC_DIR =
endif
-if USE_APEXSINK
-APEXSINK_DIR = apexsink
-else
-APEXSINK_DIR =
-endif
-
if USE_BS2B
BS2B_DIR=bs2b
else
@@ -178,12 +172,6 @@ else
LIBMMS_DIR=
endif
-if USE_LIBVISUAL
-LIBVISUAL_DIR=libvisual
-else
-LIBVISUAL_DIR=
-endif
-
if USE_MODPLUG
MODPLUG_DIR=modplug
else
@@ -208,12 +196,6 @@ else
MUSEPACK_DIR=
endif
-if USE_NAS
-NAS_DIR=nas
-else
-NAS_DIR=
-endif
-
if USE_NEON
NEON_DIR=neon
else
@@ -274,18 +256,12 @@ else
RSVG_DIR=
endif
-if USE_TIMIDITY
-TIMIDITY_DIR=timidity
-endif
-
if USE_WILDMIDI
-TIMIDITY_DIR=timidity
+WILDMIDI_DIR=wildmidi
endif
if !USE_WILDMIDI
-if !USE_TIMIDITY
-TIMIDITY_DIR=
-endif
+WILDMIDI_DIR=
endif
if USE_FLUIDSYNTH
@@ -304,12 +280,6 @@ else
SCHRO_DIR=
endif
-if USE_SDL
-SDL_DIR=sdl
-else
-SDL_DIR=
-endif
-
if USE_SMOOTHSTREAMING
SMOOTHSTREAMING_DIR = smoothstreaming
else
@@ -328,12 +298,6 @@ else
SNDFILE_DIR=
endif
-if USE_SNDIO
-SNDIO_DIR = sndio
-else
-SNDIO_DIR =
-endif
-
if USE_SOUNDTOUCH
SOUNDTOUCH_DIR=soundtouch
else
@@ -370,12 +334,6 @@ else
TELETEXTDEC_DIR=
endif
-if USE_XVID
-XVID_DIR=xvid
-else
-XVID_DIR=
-endif
-
if USE_ZBAR
ZBAR_DIR=zbar
else
@@ -434,7 +392,6 @@ SUBDIRS=\
$(VOAACENC_DIR) \
$(ASSRENDER_DIR) \
$(VOAMRWBENC_DIR) \
- $(APEXSINK_DIR) \
$(AUDIOFILE_DIR) \
$(BS2B_DIR) \
$(BZ2_DIR) \
@@ -463,12 +420,10 @@ SUBDIRS=\
$(LV2_DIR) \
$(LIBDE265_DIR) \
$(LIBMMS_DIR) \
- $(LIBVISUAL_DIR) \
$(MODPLUG_DIR) \
$(MPEG2ENC_DIR) \
$(MPLEX_DIR) \
$(MUSEPACK_DIR) \
- $(NAS_DIR) \
$(NEON_DIR) \
$(OFA_DIR) \
$(OPENAL_DIR) \
@@ -481,19 +436,16 @@ SUBDIRS=\
$(RSVG_DIR) \
$(SBC_DIR) \
$(SCHRO_DIR) \
- $(SDL_DIR) \
$(SMOOTHSTREAMING_DIR) \
$(SMOOTHWAVE_DIR) \
$(SNDFILE_DIR) \
- $(SNDIO_DIR) \
$(SOUNDTOUCH_DIR) \
$(SPANDSP_DIR) \
$(GME_DIR) \
$(SPC_DIR) \
$(SRTP_DIR) \
$(TELETEXTDEC_DIR) \
- $(TIMIDITY_DIR) \
- $(XVID_DIR) \
+ $(WILDMIDI_DIR) \
$(ZBAR_DIR) \
$(RTMP_DIR) \
$(HLS_DIR) \
@@ -506,7 +458,6 @@ SUBDIRS=\
DIST_SUBDIRS = \
assrender \
- apexsink \
bs2b \
bz2 \
chromaprint \
@@ -527,7 +478,6 @@ DIST_SUBDIRS = \
kate \
libde265 \
libmms \
- libvisual \
lv2 \
daala \
dts \
@@ -538,7 +488,6 @@ DIST_SUBDIRS = \
mpeg2enc \
mplex \
musepack \
- nas \
neon \
ofa \
openal \
@@ -552,20 +501,17 @@ DIST_SUBDIRS = \
resindvd \
sbc \
schroedinger \
- sdl \
smoothstreaming \
sndfile \
- sndio \
soundtouch \
spandsp \
spc \
srtp \
gme \
teletextdec \
- timidity \
+ wildmidi \
voaacenc \
voamrwbenc \
- xvid \
zbar \
rtmp \
webp \
diff --git a/ext/apexsink/LGPL-3.0.txt b/ext/apexsink/LGPL-3.0.txt
deleted file mode 100644
index fc8a5de7e..000000000
--- a/ext/apexsink/LGPL-3.0.txt
+++ /dev/null
@@ -1,165 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/ext/apexsink/Makefile.am b/ext/apexsink/Makefile.am
deleted file mode 100644
index f799c0794..000000000
--- a/ext/apexsink/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-plugin_LTLIBRARIES = libgstapexsink.la
-
-libgstapexsink_la_SOURCES = gstapexplugin.c gstapexraop.c gstapexsink.c
-libgstapexsink_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(APEXSINK_CFLAGS)
-libgstapexsink_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \
- -lgstaudio-$(GST_API_VERSION) -lgstinterfaces-$(GST_API_VERSION) \
- $(GST_BASE_LIBS) $(GST_LIBS) $(APEXSINK_LIBS)
-libgstapexsink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstapexsink_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-noinst_HEADERS = gstapexraop.h gstapexsink.h
diff --git a/ext/apexsink/gstapexplugin.c b/ext/apexsink/gstapexplugin.c
deleted file mode 100644
index a6d64a86b..000000000
--- a/ext/apexsink/gstapexplugin.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* GStreamer AirPort Express Plugin
- *
- * Copyright (C) 2008 Jérémie Bernard [GRemi] <gremimail@gmail.com>
- *
- * gstapexpugin.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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gstapexsink.h>
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- return gst_element_register (plugin, GST_APEX_SINK_NAME, GST_RANK_NONE,
- GST_TYPE_APEX_SINK);
-}
-
-/* plugin export resolution */
-GST_PLUGIN_DEFINE
- (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- apexsink,
- "Apple AirPort Express Plugin",
- plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/apexsink/gstapexraop.c b/ext/apexsink/gstapexraop.c
deleted file mode 100644
index af4f573c0..000000000
--- a/ext/apexsink/gstapexraop.c
+++ /dev/null
@@ -1,798 +0,0 @@
-/* GStreamer - Remote Audio Access Protocol (RAOP) as used in Apple iTunes to stream music to the Airport Express (ApEx) -
- *
- * RAOP is based on the Real Time Streaming Protocol (RTSP) but with an extra challenge-response RSA based authentication step.
- * This interface accepts RAW PCM data and set it as AES encrypted ALAC while performing emission.
- *
- * Copyright (C) 2008 Jérémie Bernard [GRemi] <gremimail@gmail.com>
- *
- * gstapexraop.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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include "gstapexraop.h"
-
-/* private constants */
-#define GST_APEX_RAOP_VOLUME_MIN -144
-#define GST_APEX_RAOP_VOLUME_MAX 0
-
-#define GST_APEX_RAOP_HDR_DEFAULT_LENGTH 1024
-#define GST_APEX_RAOP_SDP_DEFAULT_LENGTH 2048
-
-const static gchar GST_APEX_RAOP_RSA_PUBLIC_MOD[] =
- "59dE8qLieItsH1WgjrcFRKj6eUWqi+bGLOX1HL3U3GhC/j0Qg90u3sG/1CUtwC"
- "5vOYvfDmFI6oSFXi5ELabWJmT2dKHzBJKa3k9ok+8t9ucRqMd6DZHJ2YCCLlDR"
- "KSKv6kDqnw4UwPdpOMXziC/AMj3Z/lUVX1G7WSHCAWKf1zNS1eLvqr+boEjXuB"
- "OitnZ/bDzPHrTOZz0Dew0uowxf/+sG+NCK3eQJVxqcaJ/vEHKIVd2M+5qL71yJ"
- "Q+87X6oV3eaYvt3zWZYD6z5vYTcrtij2VZ9Zmni/UAaHqn9JdsBWLUEpVviYnh"
- "imNVvYFZeCXg/IdTQ+x4IRdiXNv5hEew==";
-
-const static gchar GST_APEX_RAOP_RSA_PUBLIC_EXP[] = "AQAB";
-
-const static gchar GST_APEX_RAOP_USER_AGENT[] =
- "iTunes/4.6 (Macintosh; U; PPC Mac OS X 10.3)";
-
-const static guchar GST_APEX_RAOP_FRAME_HEADER[] = { // Used by gen. 1
- 0x24, 0x00, 0x00, 0x00,
- 0xF0, 0xFF, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00
-};
-
-const static int GST_APEX_RAOP_FRAME_HEADER_SIZE = 16; // Used by gen. 1
-const static int GST_APEX_RTP_FRAME_HEADER_SIZE = 12; // Used by gen. 2
-
-const static int GST_APEX_RAOP_ALAC_HEADER_SIZE = 3;
-
-/* string extra utility */
-static gint
-g_strdel (gchar * str, gchar rc)
-{
- int i = 0, j = 0, len, num = 0;
- len = strlen (str);
- while (i < len) {
- if (str[i] == rc) {
- for (j = i; j < len; j++)
- str[j] = str[j + 1];
- len--;
- num++;
- } else {
- i++;
- }
- }
- return num;
-}
-
-/* socket utilities */
-static int
-gst_apexraop_send (int desc, void *data, size_t len)
-{
- int total = 0, bytesleft = len, n = 0;
-
- while (total < len) {
- n = send (desc, ((const char *) data) + total, bytesleft, 0);
- if (n == -1)
- break;
- total += n;
- bytesleft -= n;
- }
-
- return n == -1 ? -1 : total;
-}
-
-static int
-gst_apexraop_recv (int desc, void *data, size_t len)
-{
- memset (data, 0, len);
- return recv (desc, data, len, 0);
-}
-
-/* public opaque handle resolution */
-typedef struct
-{
- guchar aes_ky[AES_BLOCK_SIZE]; /* AES random key */
- guchar aes_iv[AES_BLOCK_SIZE]; /* AES random initial vector */
-
- guchar url_abspath[16]; /* header url random absolute path addon, ANNOUNCE id */
- gint cseq; /* header rtsp inc cseq */
- guchar cid[24]; /* header client instance id */
- gchar *session; /* header raop negotiated session id, once SETUP performed */
- gchar *ua; /* header user agent */
-
- GstApExJackType jack_type; /* APEX connected jack type, once ANNOUNCE performed */
- GstApExJackStatus jack_status; /* APEX connected jack status, once ANNOUNCE performed */
-
- GstApExGeneration generation; /* Different devices accept different audio streams */
- GstApExTransportProtocol transport_protocol; /* For media stream, not RAOP/RTSP */
-
- gchar *host; /* APEX target ip */
- guint ctrl_port; /* APEX target control port */
- guint data_port; /* APEX negotiated data port, once SETUP performed */
-
- int ctrl_sd; /* control socket */
- struct sockaddr_in ctrl_sd_in;
-
- int data_sd; /* data socket */
- struct sockaddr_in data_sd_in;
-
- short rtp_seq_num; /* RTP sequence number, used by gen. 2 */
- int rtp_timestamp; /* RTP timestamp, used by gen. 2 */
-}
-_GstApExRAOP;
-
-/* raop apex struct allocation */
-GstApExRAOP *
-gst_apexraop_new (const gchar * host,
- const guint16 port,
- const GstApExGeneration generation,
- const GstApExTransportProtocol transport_protocol)
-{
- _GstApExRAOP *apexraop;
-
- apexraop = (_GstApExRAOP *) g_malloc0 (sizeof (_GstApExRAOP));
-
- apexraop->host = g_strdup (host);
- apexraop->ctrl_port = port;
- apexraop->ua = g_strdup (GST_APEX_RAOP_USER_AGENT);
- apexraop->jack_type = GST_APEX_JACK_TYPE_UNDEFINED;
- apexraop->jack_status = GST_APEX_JACK_STATUS_DISCONNECTED;
- apexraop->generation = generation;
- apexraop->transport_protocol = transport_protocol;
- apexraop->rtp_seq_num = 0;
- apexraop->rtp_timestamp = 0;
-
- return (GstApExRAOP *) apexraop;
-}
-
-/* raop apex struct freeing */
-void
-gst_apexraop_free (GstApExRAOP * con)
-{
- _GstApExRAOP *conn;
- conn = (_GstApExRAOP *) con;
-
- g_free (conn->host);
- g_free (conn->session);
- g_free (conn->ua);
- g_free (conn);
-}
-
-/* host affectation */
-void
-gst_apexraop_set_host (GstApExRAOP * con, const gchar * host)
-{
- _GstApExRAOP *conn;
- conn = (_GstApExRAOP *) con;
-
- g_free (conn->host);
- conn->host = g_strdup (host);
-}
-
-/* host reader */
-gchar *
-gst_apexraop_get_host (GstApExRAOP * con)
-{
- _GstApExRAOP *conn;
- conn = (_GstApExRAOP *) con;
-
- return g_strdup (conn->host);
-}
-
-/* control port affectation */
-void
-gst_apexraop_set_port (GstApExRAOP * con, const guint16 port)
-{
- _GstApExRAOP *conn;
- conn = (_GstApExRAOP *) con;
-
- conn->ctrl_port = port;
-}
-
-/* control port reader */
-guint16
-gst_apexraop_get_port (GstApExRAOP * con)
-{
- _GstApExRAOP *conn;
- conn = (_GstApExRAOP *) con;
-
- return conn->ctrl_port;
-}
-
-/* user agent affectation */
-void
-gst_apexraop_set_useragent (GstApExRAOP * con, const gchar * useragent)
-{
- _GstApExRAOP *conn;
- conn = (_GstApExRAOP *) con;
-
- g_free (conn->ua);
- conn->ua = g_strdup (useragent);
-}
-
-/* user agent reader */
-gchar *
-gst_apexraop_get_useragent (GstApExRAOP * con)
-{
- _GstApExRAOP *conn;
- conn = (_GstApExRAOP *) con;
-
- return g_strdup (conn->ua);
-}
-
-/* raop apex connection sequence */
-GstRTSPStatusCode
-gst_apexraop_connect (GstApExRAOP * con)
-{
- gchar *ac, *ky, *iv, *s, inaddr[INET_ADDRSTRLEN],
- creq[GST_APEX_RAOP_SDP_DEFAULT_LENGTH],
- hreq[GST_APEX_RAOP_HDR_DEFAULT_LENGTH], *req;
- RSA *rsa;
- guchar *mod, *exp, rsakey[512];
- union gst_randbytes
- {
- struct asvals
- {
- guint32 url_key;
- guint64 conn_id;
- guchar challenge[16];
- } v;
- guchar buf[4 + 8 + 16];
- } randbuf;
- gsize size;
- struct sockaddr_in ioaddr;
- socklen_t iolen;
- GstRTSPStatusCode res;
- _GstApExRAOP *conn;
-
- conn = (_GstApExRAOP *) con;
-
- if ((conn->ctrl_sd = socket (AF_INET, SOCK_STREAM, 0)) < 0)
- return GST_RTSP_STS_DESTINATION_UNREACHABLE;
-
- conn->ctrl_sd_in.sin_family = AF_INET;
- conn->ctrl_sd_in.sin_port = htons (conn->ctrl_port);
-
- if (!inet_aton (conn->host, &conn->ctrl_sd_in.sin_addr)) {
- struct hostent *hp = (struct hostent *) gethostbyname (conn->host);
- if (hp == NULL)
- return GST_RTSP_STS_DESTINATION_UNREACHABLE;
- memcpy (&conn->ctrl_sd_in.sin_addr, hp->h_addr, hp->h_length);
- }
-
- if (connect (conn->ctrl_sd, (struct sockaddr *) &conn->ctrl_sd_in,
- sizeof (conn->ctrl_sd_in)) < 0)
- return GST_RTSP_STS_DESTINATION_UNREACHABLE;
-
- RAND_bytes (randbuf.buf, sizeof (randbuf));
- sprintf ((gchar *) conn->url_abspath, "%u", randbuf.v.url_key);
- sprintf ((char *) conn->cid, "%16" G_GINT64_MODIFIER "x", randbuf.v.conn_id);
-
- RAND_bytes (conn->aes_ky, AES_BLOCK_SIZE);
- RAND_bytes (conn->aes_iv, AES_BLOCK_SIZE);
-
- rsa = RSA_new ();
- mod = g_base64_decode (GST_APEX_RAOP_RSA_PUBLIC_MOD, &size);
- rsa->n = BN_bin2bn (mod, size, NULL);
- exp = g_base64_decode (GST_APEX_RAOP_RSA_PUBLIC_EXP, &size);
- rsa->e = BN_bin2bn (exp, size, NULL);
- size =
- RSA_public_encrypt (AES_BLOCK_SIZE, conn->aes_ky, rsakey, rsa,
- RSA_PKCS1_OAEP_PADDING);
-
- ky = g_base64_encode (rsakey, size);
- iv = g_base64_encode (conn->aes_iv, AES_BLOCK_SIZE);
- g_strdel (ky, '=');
- g_strdel (iv, '=');
-
- iolen = sizeof (struct sockaddr);
- getsockname (conn->ctrl_sd, (struct sockaddr *) &ioaddr, &iolen);
- inet_ntop (AF_INET, &(ioaddr.sin_addr), inaddr, INET_ADDRSTRLEN);
-
- ac = g_base64_encode (randbuf.v.challenge, 16);
- g_strdel (ac, '=');
-
- sprintf (creq,
- "v=0\r\n"
- "o=iTunes %s 0 IN IP4 %s\r\n"
- "s=iTunes\r\n"
- "c=IN IP4 %s\r\n"
- "t=0 0\r\n"
- "m=audio 0 RTP/AVP 96\r\n"
- "a=rtpmap:96 AppleLossless\r\n"
- "a=fmtp:96 %d 0 %d 40 10 14 %d 255 0 0 %d\r\n"
- "a=rsaaeskey:%s\r\n"
- "a=aesiv:%s\r\n",
- conn->url_abspath,
- inaddr,
- conn->host,
- conn->generation == GST_APEX_GENERATION_ONE
- ? GST_APEX_RAOP_V1_SAMPLES_PER_FRAME
- : GST_APEX_RAOP_V2_SAMPLES_PER_FRAME,
- GST_APEX_RAOP_BYTES_PER_CHANNEL * 8,
- GST_APEX_RAOP_CHANNELS, GST_APEX_RAOP_BITRATE, ky, iv);
-
- sprintf (hreq,
- "ANNOUNCE rtsp://%s/%s RTSP/1.0\r\n"
- "CSeq: %d\r\n"
- "Client-Instance: %s\r\n"
- "User-Agent: %s\r\n"
- "Content-Type: application/sdp\r\n"
- "Content-Length: %u\r\n"
- "Apple-Challenge: %s\r\n",
- conn->host,
- conn->url_abspath, ++conn->cseq, conn->cid, conn->ua,
- (guint) strlen (creq), ac);
-
- RSA_free (rsa);
- g_free (ky);
- g_free (iv);
- g_free (ac);
- g_free (mod);
- g_free (exp);
-
- req = g_strconcat (hreq, "\r\n", creq, NULL);
-
- if (gst_apexraop_send (conn->ctrl_sd, req, strlen (req)) <= 0) {
- g_free (req);
- return GST_RTSP_STS_GONE;
- }
-
- g_free (req);
-
- if (gst_apexraop_recv (conn->ctrl_sd, hreq,
- GST_APEX_RAOP_HDR_DEFAULT_LENGTH) <= 0)
- return GST_RTSP_STS_GONE;
-
- {
- int tmp;
- sscanf (hreq, "%*s %d", &tmp);
- res = (GstRTSPStatusCode) tmp;
- }
-
- if (res != GST_RTSP_STS_OK)
- return res;
-
- s = g_strrstr (hreq, "Audio-Jack-Status");
-
- if (s != NULL) {
- gchar status[128];
- sscanf (s, "%*s %s", status);
-
- if (strcmp (status, "connected;") == 0)
- conn->jack_status = GST_APEX_JACK_STATUS_CONNECTED;
- else if (strcmp (status, "disconnected;") == 0)
- conn->jack_status = GST_APEX_JACK_STATUS_DISCONNECTED;
- else
- conn->jack_status = GST_APEX_JACK_STATUS_UNDEFINED;
-
- s = g_strrstr (s, "type=");
-
- if (s != NULL) {
- strtok (s, "=");
- s = strtok (NULL, "\n");
-
- if (strcmp (s, "analog"))
- conn->jack_type = GST_APEX_JACK_TYPE_ANALOG;
- else if (strcmp (s, "digital"))
- conn->jack_type = GST_APEX_JACK_TYPE_DIGITAL;
- else
- conn->jack_type = GST_APEX_JACK_TYPE_UNDEFINED;
- }
- }
-
- sprintf (hreq,
- "SETUP rtsp://%s/%s RTSP/1.0\r\n"
- "CSeq: %d\r\n"
- "Client-Instance: %s\r\n"
- "User-Agent: %s\r\n"
- "Transport: RTP/AVP/TCP;unicast;interleaved=0-1;mode=record\r\n"
- "\r\n", conn->host, conn->url_abspath, ++conn->cseq, conn->cid, conn->ua);
-
- if (gst_apexraop_send (conn->ctrl_sd, hreq, strlen (hreq)) <= 0)
- return GST_RTSP_STS_GONE;
-
- if (gst_apexraop_recv (conn->ctrl_sd, hreq,
- GST_APEX_RAOP_HDR_DEFAULT_LENGTH) <= 0)
- return GST_RTSP_STS_GONE;
-
- {
- int tmp;
- sscanf (hreq, "%*s %d", &tmp);
- res = (GstRTSPStatusCode) tmp;
- }
-
- if (res != GST_RTSP_STS_OK)
- return res;
-
- s = g_strrstr (hreq, "Session");
-
- if (s != NULL) {
- gchar session[128];
- sscanf (s, "%*s %s", session);
- conn->session = g_strdup (session);
- } else
- return GST_RTSP_STS_PRECONDITION_FAILED;
-
- s = g_strrstr (hreq, "server_port");
- if (s != NULL) {
- sscanf (s, "server_port=%d", &conn->data_port);
- } else
- return GST_RTSP_STS_PRECONDITION_FAILED;
-
- sprintf (hreq,
- "RECORD rtsp://%s/%s RTSP/1.0\r\n"
- "CSeq: %d\r\n"
- "Client-Instance: %s\r\n"
- "User-Agent: %s\r\n"
- "Session: %s\r\n"
- "Range: npt=0-\r\n"
- "RTP-Info: seq=0;rtptime=0\r\n"
- "\r\n",
- conn->host,
- conn->url_abspath, ++conn->cseq, conn->cid, conn->ua, conn->session);
-
- if (gst_apexraop_send (conn->ctrl_sd, hreq, strlen (hreq)) <= 0)
- return GST_RTSP_STS_GONE;
-
- if (gst_apexraop_recv (conn->ctrl_sd, hreq,
- GST_APEX_RAOP_HDR_DEFAULT_LENGTH) <= 0)
- return GST_RTSP_STS_GONE;
-
- {
- int tmp;
- sscanf (hreq, "%*s %d", &tmp);
- res = (GstRTSPStatusCode) tmp;
- }
-
- if (res != GST_RTSP_STS_OK)
- return res;
-
- if (conn->transport_protocol == GST_APEX_TCP) {
- if ((conn->data_sd = socket (AF_INET, SOCK_STREAM, 0)) < 0)
- return GST_RTSP_STS_DESTINATION_UNREACHABLE;
- } else if (conn->transport_protocol == GST_APEX_UDP) {
- if ((conn->data_sd = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
- return GST_RTSP_STS_DESTINATION_UNREACHABLE;
- } else
- return GST_RTSP_STS_METHOD_NOT_ALLOWED;
-
- conn->data_sd_in.sin_family = AF_INET;
- conn->data_sd_in.sin_port = htons (conn->data_port);
-
- memcpy (&conn->data_sd_in.sin_addr, &conn->ctrl_sd_in.sin_addr,
- sizeof (conn->ctrl_sd_in.sin_addr));
-
- if (connect (conn->data_sd, (struct sockaddr *) &conn->data_sd_in,
- sizeof (conn->data_sd_in)) < 0)
- return GST_RTSP_STS_DESTINATION_UNREACHABLE;
-
- return res;
-}
-
-/* raop apex jack type access */
-GstApExJackType
-gst_apexraop_get_jacktype (GstApExRAOP * con)
-{
- _GstApExRAOP *conn;
-
- conn = (_GstApExRAOP *) con;
-
- if (!conn)
- return GST_APEX_JACK_TYPE_UNDEFINED;
-
- return conn->jack_type;
-}
-
-/* raop apex jack status access */
-GstApExJackStatus
-gst_apexraop_get_jackstatus (GstApExRAOP * con)
-{
- _GstApExRAOP *conn;
-
- conn = (_GstApExRAOP *) con;
-
- if (!conn)
- return GST_APEX_JACK_STATUS_UNDEFINED;
-
- return conn->jack_status;
-}
-
-/* raop apex generation access */
-GstApExGeneration
-gst_apexraop_get_generation (GstApExRAOP * con)
-{
- _GstApExRAOP *conn;
-
- conn = (_GstApExRAOP *) con;
-
- if (!conn)
- return GST_APEX_GENERATION_ONE;
-
- return conn->generation;
-}
-
-/* raop apex transport protocol access */
-GstApExTransportProtocol
-gst_apexraop_get_transport_protocol (GstApExRAOP * con)
-{
- _GstApExRAOP *conn;
-
- conn = (_GstApExRAOP *) con;
-
- if (!conn)
- return GST_APEX_TCP;
-
- return conn->transport_protocol;
-}
-
-/* raop apex sockets close */
-void
-gst_apexraop_close (GstApExRAOP * con)
-{
- gchar hreq[GST_APEX_RAOP_HDR_DEFAULT_LENGTH];
- _GstApExRAOP *conn;
-
- conn = (_GstApExRAOP *) con;
-
- sprintf (hreq,
- "TEARDOWN rtsp://%s/%s RTSP/1.0\r\n"
- "CSeq: %d\r\n"
- "Client-Instance: %s\r\n"
- "User-Agent: %s\r\n"
- "Session: %s\r\n"
- "\r\n",
- conn->host,
- conn->url_abspath, ++conn->cseq, conn->cid, conn->ua, conn->session);
-
- gst_apexraop_send (conn->ctrl_sd, hreq, strlen (hreq));
- gst_apexraop_recv (conn->ctrl_sd, hreq, GST_APEX_RAOP_HDR_DEFAULT_LENGTH);
-
- if (conn->ctrl_sd != 0)
- close (conn->ctrl_sd);
- if (conn->data_sd != 0)
- close (conn->data_sd);
-}
-
-/* raop apex volume set */
-GstRTSPStatusCode
-gst_apexraop_set_volume (GstApExRAOP * con, const guint volume)
-{
- gint v;
- gchar creq[GST_APEX_RAOP_SDP_DEFAULT_LENGTH],
- hreq[GST_APEX_RAOP_HDR_DEFAULT_LENGTH], *req, vol[128];
- GstRTSPStatusCode res;
- _GstApExRAOP *conn;
-
- conn = (_GstApExRAOP *) con;
-
- v = GST_APEX_RAOP_VOLUME_MIN + (GST_APEX_RAOP_VOLUME_MAX -
- GST_APEX_RAOP_VOLUME_MIN) * volume / 100.;
- sprintf (vol, "volume: %d.000000\r\n", v);
-
- sprintf (creq, "%s\r\n", vol);
-
- sprintf (hreq,
- "SET_PARAMETER rtsp://%s/%s RTSP/1.0\r\n"
- "CSeq: %d\r\n"
- "Client-Instance: %s\r\n"
- "User-Agent: %s\r\n"
- "Session: %s\r\n"
- "Content-Type: text/parameters\r\n"
- "Content-Length: %u\r\n",
- conn->host,
- conn->url_abspath,
- ++conn->cseq, conn->cid, conn->ua, conn->session, (guint) strlen (creq)
- );
-
- req = g_strconcat (hreq, "\r\n", creq, NULL);
-
- if (gst_apexraop_send (conn->ctrl_sd, req, strlen (req)) <= 0) {
- g_free (req);
- return GST_RTSP_STS_GONE;
- }
-
- g_free (req);
-
- if (gst_apexraop_recv (conn->ctrl_sd, hreq,
- GST_APEX_RAOP_HDR_DEFAULT_LENGTH) <= 0)
- return GST_RTSP_STS_GONE;
-
- {
- int tmp;
- sscanf (hreq, "%*s %d", &tmp);
- res = (GstRTSPStatusCode) tmp;
- }
-
- return res;
-}
-
-/* raop apex raw data alac encapsulation, encryption and emission, http://wiki.multimedia.cx/index.php?title=Apple_Lossless_Audio_Coding */
-static void inline
-gst_apexraop_write_bits (guchar * buffer, int data, int numbits,
- int *bit_offset, int *byte_offset)
-{
- const static guchar masks[] =
- { 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF };
-
- if (((*bit_offset) != 0) && (((*bit_offset) + numbits) > 8)) {
- gint numwritebits;
- guchar bitstowrite;
-
- numwritebits = 8 - (*bit_offset);
- bitstowrite =
- (guchar) ((data >> (numbits - numwritebits)) << (8 - (*bit_offset) -
- numwritebits));
- buffer[(*byte_offset)] |= bitstowrite;
- numbits -= numwritebits;
- (*bit_offset) = 0;
- (*byte_offset)++;
- }
-
- while (numbits >= 8) {
- guchar bitstowrite;
-
- bitstowrite = (guchar) ((data >> (numbits - 8)) & 0xFF);
- buffer[(*byte_offset)] |= bitstowrite;
- numbits -= 8;
- (*bit_offset) = 0;
- (*byte_offset)++;
- }
-
- if (numbits > 0) {
- guchar bitstowrite;
- bitstowrite =
- (guchar) ((data & masks[numbits]) << (8 - (*bit_offset) - numbits));
- buffer[(*byte_offset)] |= bitstowrite;
- (*bit_offset) += numbits;
- if ((*bit_offset) == 8) {
- (*byte_offset)++;
- (*bit_offset) = 0;
- }
- }
-}
-
-guint
-gst_apexraop_write (GstApExRAOP * con, gpointer rawdata, guint length)
-{
- guchar *buffer, *frame_data;
- gushort len;
- gint bit_offset, byte_offset, i, out_len, res;
- EVP_CIPHER_CTX aes_ctx;
- _GstApExRAOP *conn = (_GstApExRAOP *) con;
- const int frame_header_size = conn->generation == GST_APEX_GENERATION_ONE
- ? GST_APEX_RAOP_FRAME_HEADER_SIZE : GST_APEX_RTP_FRAME_HEADER_SIZE;
-
- buffer =
- (guchar *) g_malloc0 (frame_header_size +
- GST_APEX_RAOP_ALAC_HEADER_SIZE + length);
-
- if (conn->generation == GST_APEX_GENERATION_ONE) {
- g_assert (frame_header_size == GST_APEX_RAOP_FRAME_HEADER_SIZE);
- memcpy (buffer, GST_APEX_RAOP_FRAME_HEADER, frame_header_size);
-
- len = length + frame_header_size + GST_APEX_RAOP_ALAC_HEADER_SIZE - 4;
-
- buffer[2] = len >> 8;
- buffer[3] = len & 0xff;
- } else {
- /* Gen. 2 uses RTP-like header (RFC 3550). */
- short network_seq_num;
- int network_timestamp, unknown_const;
- static gboolean first = TRUE;
-
- buffer[0] = 0x80;
- if (first) {
- buffer[1] = 0xe0;
- first = FALSE;
- } else
- buffer[1] = 0x60;
-
- network_seq_num = htons (conn->rtp_seq_num++);
- memcpy (buffer + 2, &network_seq_num, 2);
-
- network_timestamp = htons (conn->rtp_timestamp);
- memcpy (buffer + 4, &network_timestamp, 4);
- conn->rtp_timestamp += GST_APEX_RAOP_V2_SAMPLES_PER_FRAME;
-
- unknown_const = 0xdeadbeef;
- memcpy (buffer + 8, &unknown_const, 4);
- }
-
- bit_offset = 0;
- byte_offset = 0;
- frame_data = buffer + frame_header_size;
-
- gst_apexraop_write_bits (frame_data, 1, 3, &bit_offset, &byte_offset); /* channels, 0 mono, 1 stereo */
- gst_apexraop_write_bits (frame_data, 0, 4, &bit_offset, &byte_offset); /* unknown */
- gst_apexraop_write_bits (frame_data, 0, 8, &bit_offset, &byte_offset); /* unknown (12 bits) */
- gst_apexraop_write_bits (frame_data, 0, 4, &bit_offset, &byte_offset);
- gst_apexraop_write_bits (frame_data, 0, 1, &bit_offset, &byte_offset); /* has size flag */
- gst_apexraop_write_bits (frame_data, 0, 2, &bit_offset, &byte_offset); /* unknown */
- gst_apexraop_write_bits (frame_data, 1, 1, &bit_offset, &byte_offset); /* no compression flag */
-
- for (i = 0; i < length; i += 2) {
- gst_apexraop_write_bits (frame_data, ((guchar *) rawdata)[i + 1], 8,
- &bit_offset, &byte_offset);
- gst_apexraop_write_bits (frame_data, ((guchar *) rawdata)[i], 8,
- &bit_offset, &byte_offset);
- }
-
- EVP_CIPHER_CTX_init (&aes_ctx);
- EVP_CipherInit_ex (&aes_ctx, EVP_aes_128_cbc (), NULL, conn->aes_ky,
- conn->aes_iv, AES_ENCRYPT);
- EVP_CipherUpdate (&aes_ctx, frame_data, &out_len, frame_data, /*( */
- GST_APEX_RAOP_ALAC_HEADER_SIZE +
- length /*) / AES_BLOCK_SIZE * AES_BLOCK_SIZE */ );
- EVP_CIPHER_CTX_cleanup (&aes_ctx);
-
- res =
- gst_apexraop_send (conn->data_sd, buffer,
- frame_header_size + GST_APEX_RAOP_ALAC_HEADER_SIZE + length);
-
- g_free (buffer);
-
- return (guint) ((res >=
- (frame_header_size +
- GST_APEX_RAOP_ALAC_HEADER_SIZE)) ? (res -
- frame_header_size - GST_APEX_RAOP_ALAC_HEADER_SIZE) : 0);
-}
-
-/* raop apex buffer flush */
-GstRTSPStatusCode
-gst_apexraop_flush (GstApExRAOP * con)
-{
- gchar hreq[GST_APEX_RAOP_HDR_DEFAULT_LENGTH];
- GstRTSPStatusCode res;
- _GstApExRAOP *conn;
-
- conn = (_GstApExRAOP *) con;
-
- sprintf (hreq,
- "FLUSH rtsp://%s/%s RTSP/1.0\r\n"
- "CSeq: %d\r\n"
- "Client-Instance: %s\r\n"
- "User-Agent: %s\r\n"
- "Session: %s\r\n"
- "RTP-Info: seq=%d;rtptime=%d\r\n"
- "\r\n",
- conn->host,
- conn->url_abspath,
- ++conn->cseq,
- conn->cid,
- conn->ua, conn->session, conn->rtp_seq_num, conn->rtp_timestamp);
-
- if (gst_apexraop_send (conn->ctrl_sd, hreq, strlen (hreq)) <= 0)
- return GST_RTSP_STS_GONE;
-
- if (gst_apexraop_recv (conn->ctrl_sd, hreq,
- GST_APEX_RAOP_HDR_DEFAULT_LENGTH) <= 0)
- return GST_RTSP_STS_GONE;
-
- {
- int tmp;
- sscanf (hreq, "%*s %d", &tmp);
- res = (GstRTSPStatusCode) tmp;
- }
-
- return res;
-}
diff --git a/ext/apexsink/gstapexraop.h b/ext/apexsink/gstapexraop.h
deleted file mode 100644
index a4f947e4f..000000000
--- a/ext/apexsink/gstapexraop.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/* GStreamer - Remote Audio Access Protocol (RAOP) as used in Apple iTunes to stream music to the Airport Express (ApEx) -
- *
- * RAOP is based on the Real Time Streaming Protocol (RTSP) but with an extra challenge-response RSA based authentication step.
- * This interface accepts RAW PCM data and set it as AES encrypted ALAC while performing emission.
- *
- * Copyright (C) 2008 Jérémie Bernard [GRemi] <gremimail@gmail.com>
- *
- * gstapexraop.h
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef __GST_APEXRAOP_H__
-#define __GST_APEXRAOP_H__
-
-#include <gst/gst.h>
-#include <gst/rtsp/gstrtspdefs.h>
-
-#include <openssl/rand.h>
-#include <openssl/rsa.h>
-#include <openssl/aes.h>
-#include <openssl/evp.h>
-
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <netinet/in.h>
-#include <netdb.h>
-
-#include <arpa/inet.h>
-
-G_BEGIN_DECLS
-
-/* raop fixed parameters */
-#define GST_APEX_RAOP_BITRATE 44100
-#define GST_APEX_RAOP_V1_SAMPLES_PER_FRAME 4096
-#define GST_APEX_RAOP_V2_SAMPLES_PER_FRAME 352
-#define GST_APEX_RAOP_BYTES_PER_CHANNEL 2
-#define GST_APEX_RAOP_CHANNELS 2
-#define GST_APEX_RAOP_BYTES_PER_SAMPLE (GST_APEX_RAOP_CHANNELS * GST_APEX_RAOP_BYTES_PER_CHANNEL)
-
-/* gst associated caps fields specification */
-#define GST_APEX_RAOP_INPUT_TYPE "audio/x-raw-int"
-#define GST_APEX_RAOP_INPUT_WIDTH "16"
-#define GST_APEX_RAOP_INPUT_DEPTH GST_APEX_RAOP_INPUT_WIDTH
-#define GST_APEX_RAOP_INPUT_ENDIAN "LITTLE_ENDIAN"
-#define GST_APEX_RAOP_INPUT_CHANNELS "2"
-#define GST_APEX_RAOP_INPUT_BIT_RATE "44100"
-#define GST_APEX_RAOP_INPUT_SIGNED "TRUE"
-
-typedef enum
-{
- GST_APEX_JACK_TYPE_UNDEFINED = 0,
- GST_APEX_JACK_TYPE_ANALOG,
- GST_APEX_JACK_TYPE_DIGITAL,
-}
-GstApExJackType;
-
-typedef enum
-{
- GST_APEX_JACK_STATUS_UNDEFINED = 0,
- GST_APEX_JACK_STATUS_DISCONNECTED,
- GST_APEX_JACK_STATUS_CONNECTED,
-}
-GstApExJackStatus;
-
-typedef enum
-{
- GST_APEX_GENERATION_ONE = 1,
- GST_APEX_GENERATION_TWO,
-}
-GstApExGeneration;
-
-typedef enum
-{
- GST_APEX_TCP = 0,
- GST_APEX_UDP,
-}
-GstApExTransportProtocol;
-
-/* raop context handle */
-typedef struct
-{
-} GstApExRAOP;
-
-/* host might be null and port might be 0 while instanciating */
-GstApExRAOP *gst_apexraop_new (const gchar * host,
- const guint16 port,
- const GstApExGeneration generation,
- const GstApExTransportProtocol transport_protocol);
-void gst_apexraop_free (GstApExRAOP * conn);
-
-/* must not be connected yet while setting the host target */
-void gst_apexraop_set_host (GstApExRAOP * conn, const gchar * host);
-gchar *gst_apexraop_get_host (GstApExRAOP * conn);
-
-/* must not be connected yet while setting the port target */
-void gst_apexraop_set_port (GstApExRAOP * conn, const guint16 port);
-guint16 gst_apexraop_get_port (GstApExRAOP * conn);
-
-/* optional affectation, default iTunes user agent internaly used */
-void gst_apexraop_set_useragent (GstApExRAOP * conn, const gchar * useragent);
-gchar *gst_apexraop_get_useragent (GstApExRAOP * conn);
-
-/* once allocation and configuration performed, manages the raop ANNOUNCE, SETUP and RECORD sequences,
- * open both ctrl and data channels */
-GstRTSPStatusCode gst_apexraop_connect (GstApExRAOP * conn);
-
-/* close the currently used session, manages raop TEARDOWN sequence and closes the used sockets */
-void gst_apexraop_close (GstApExRAOP * conn);
-
-/* once connected, set the apex target volume, manages SET_PARAMETER sequence */
-GstRTSPStatusCode gst_apexraop_set_volume (GstApExRAOP * conn,
- const guint volume);
-
-/* write raw samples typed as defined by the fixed raop parameters, flush the apex buffer */
-guint gst_apexraop_write (GstApExRAOP * conn, gpointer rawdata, guint length);
-GstRTSPStatusCode gst_apexraop_flush (GstApExRAOP * conn);
-
-/* retrieve the connected apex jack type and status */
-GstApExJackType gst_apexraop_get_jacktype (GstApExRAOP * conn);
-GstApExJackStatus gst_apexraop_get_jackstatus (GstApExRAOP * conn);
-
-/* retrieve the generation */
-GstApExGeneration gst_apexraop_get_generation (GstApExRAOP * conn);
-
-/* retrieve the transport protocol */
-GstApExTransportProtocol gst_apexraop_get_transport_protocol (GstApExRAOP * conn);
-
-G_END_DECLS
-
-#endif
-
diff --git a/ext/apexsink/gstapexsink.c b/ext/apexsink/gstapexsink.c
deleted file mode 100644
index df5c5f256..000000000
--- a/ext/apexsink/gstapexsink.c
+++ /dev/null
@@ -1,665 +0,0 @@
-/* GStreamer - AirPort Express Audio Sink -
- *
- * Remote Audio Access Protocol (RAOP) as used in Apple iTunes to stream music to the Airport Express (ApEx) -
- * RAOP is based on the Real Time Streaming Protocol (RTSP) but with an extra challenge-response RSA based authentication step.
- *
- * RAW PCM input only as defined by the following GST_STATIC_PAD_TEMPLATE
- *
- * Copyright (C) 2008 Jérémie Bernard [GRemi] <gremimail@gmail.com>
- *
- * gstapexsink.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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include "gstapexsink.h"
-
-GST_DEBUG_CATEGORY_STATIC (apexsink_debug);
-#define GST_CAT_DEFAULT apexsink_debug
-
-static GstStaticPadTemplate gst_apexsink_sink_factory = GST_STATIC_PAD_TEMPLATE
- ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS
- (GST_APEX_RAOP_INPUT_TYPE ","
- "width = (int) " GST_APEX_RAOP_INPUT_WIDTH ","
- "depth = (int) " GST_APEX_RAOP_INPUT_DEPTH ","
- "endianness = (int) " GST_APEX_RAOP_INPUT_ENDIAN ","
- "channels = (int) " GST_APEX_RAOP_INPUT_CHANNELS ","
- "rate = (int) " GST_APEX_RAOP_INPUT_BIT_RATE ","
- "signed = (boolean) " GST_APEX_RAOP_INPUT_SIGNED)
- );
-
-
-enum
-{
- APEX_PROP_HOST = 1,
- APEX_PROP_PORT,
- APEX_PROP_VOLUME,
- APEX_PROP_JACK_TYPE,
- APEX_PROP_JACK_STATUS,
- APEX_PROP_GENERATION,
- APEX_PROP_TRANSPORT_PROTOCOL,
-};
-
-#define DEFAULT_APEX_HOST ""
-#define DEFAULT_APEX_PORT 5000
-#define DEFAULT_APEX_VOLUME 1.0
-#define DEFAULT_APEX_JACK_TYPE GST_APEX_JACK_TYPE_UNDEFINED
-#define DEFAULT_APEX_JACK_STATUS GST_APEX_JACK_STATUS_UNDEFINED
-#define DEFAULT_APEX_GENERATION GST_APEX_GENERATION_ONE
-#define DEFAULT_APEX_TRANSPORT_PROTOCOL GST_APEX_TCP
-
-/* genum apex jack resolution */
-GType
-gst_apexsink_jackstatus_get_type (void)
-{
- static GType jackstatus_type = 0;
- static const GEnumValue jackstatus[] = {
- {GST_APEX_JACK_STATUS_UNDEFINED, "GST_APEX_JACK_STATUS_UNDEFINED",
- "Jack status undefined"},
- {GST_APEX_JACK_STATUS_DISCONNECTED, "GST_APEX_JACK_STATUS_DISCONNECTED",
- "Jack disconnected"},
- {GST_APEX_JACK_STATUS_CONNECTED, "GST_APEX_JACK_STATUS_CONNECTED",
- "Jack connected"},
- {0, NULL, NULL},
- };
-
- if (!jackstatus_type) {
- jackstatus_type = g_enum_register_static ("GstApExJackStatus", jackstatus);
- }
-
- return jackstatus_type;
-}
-
-GType
-gst_apexsink_jacktype_get_type (void)
-{
- static GType jacktype_type = 0;
- static const GEnumValue jacktype[] = {
- {GST_APEX_JACK_TYPE_UNDEFINED, "GST_APEX_JACK_TYPE_UNDEFINED",
- "Undefined jack type"},
- {GST_APEX_JACK_TYPE_ANALOG, "GST_APEX_JACK_TYPE_ANALOG", "Analog jack"},
- {GST_APEX_JACK_TYPE_DIGITAL, "GST_APEX_JACK_TYPE_DIGITAL", "Digital jack"},
- {0, NULL, NULL},
- };
-
- if (!jacktype_type) {
- jacktype_type = g_enum_register_static ("GstApExJackType", jacktype);
- }
-
- return jacktype_type;
-}
-
-GType
-gst_apexsink_generation_get_type (void)
-{
- static GType generation_type = 0;
- static const GEnumValue generation[] = {
- {GST_APEX_GENERATION_ONE, "generation-one",
- "First generation (e.g., original AirPort Express)"},
- {GST_APEX_GENERATION_TWO, "generation-two",
- "Second generation (e.g., Apple TV v2)"},
- {0, NULL, NULL},
- };
-
- if (!generation_type) {
- generation_type = g_enum_register_static ("GstApExGeneration", generation);
- }
-
- return generation_type;
-}
-
-GType
-gst_apexsink_transport_protocol_get_type (void)
-{
- static GType transport_protocol_type = 0;
- static const GEnumValue transport_protocol[] = {
- {GST_APEX_TCP, "tcp", "TCP"},
- {GST_APEX_UDP, "udp", "UDP"},
- {0, NULL, NULL},
- };
-
- if (!transport_protocol_type) {
- transport_protocol_type =
- g_enum_register_static ("GstApExTransportProtocol", transport_protocol);
- }
-
- return transport_protocol_type;
-}
-
-
-static void gst_apexsink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_apexsink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void gst_apexsink_finalise (GObject * object);
-
-static gboolean gst_apexsink_open (GstAudioSink * asink);
-static gboolean gst_apexsink_prepare (GstAudioSink * asink,
- GstRingBufferSpec * spec);
-static guint gst_apexsink_write (GstAudioSink * asink, gpointer data,
- guint length);
-static gboolean gst_apexsink_unprepare (GstAudioSink * asink);
-static guint gst_apexsink_delay (GstAudioSink * asink);
-static void gst_apexsink_reset (GstAudioSink * asink);
-static gboolean gst_apexsink_close (GstAudioSink * asink);
-static GstStateChangeReturn gst_apexsink_change_state (GstElement * element,
- GstStateChange transition);
-
-/* mixer interface standard api */
-static void gst_apexsink_interfaces_init (GType type);
-static void gst_apexsink_implements_interface_init (GstImplementsInterfaceClass
- * iface);
-static void gst_apexsink_mixer_interface_init (GstMixerInterface * iface);
-
-static gboolean gst_apexsink_interface_supported (GstImplementsInterface *
- iface, GType iface_type);
-static const GList *gst_apexsink_mixer_list_tracks (GstMixer * mixer);
-static void gst_apexsink_mixer_set_volume (GstMixer * mixer,
- GstMixerTrack * track, gint * volumes);
-static void gst_apexsink_mixer_get_volume (GstMixer * mixer,
- GstMixerTrack * track, gint * volumes);
-
-GST_BOILERPLATE_FULL (GstApExSink, gst_apexsink, GstAudioSink,
- GST_TYPE_AUDIO_SINK, gst_apexsink_interfaces_init);
-
-/* apex sink interface(s) stuff */
-static void
-gst_apexsink_interfaces_init (GType type)
-{
- static const GInterfaceInfo implements_interface_info =
- { (GInterfaceInitFunc) gst_apexsink_implements_interface_init, NULL,
- NULL
- };
- static const GInterfaceInfo mixer_interface_info =
- { (GInterfaceInitFunc) gst_apexsink_mixer_interface_init, NULL, NULL };
-
- g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE,
- &implements_interface_info);
- g_type_add_interface_static (type, GST_TYPE_MIXER, &mixer_interface_info);
-}
-
-static void
-gst_apexsink_implements_interface_init (GstImplementsInterfaceClass * iface)
-{
- iface->supported = gst_apexsink_interface_supported;
-}
-
-static void
-gst_apexsink_mixer_interface_init (GstMixerInterface * iface)
-{
- GST_MIXER_TYPE (iface) = GST_MIXER_SOFTWARE;
-
- iface->list_tracks = gst_apexsink_mixer_list_tracks;
- iface->set_volume = gst_apexsink_mixer_set_volume;
- iface->get_volume = gst_apexsink_mixer_get_volume;
-}
-
-static gboolean
-gst_apexsink_interface_supported (GstImplementsInterface * iface,
- GType iface_type)
-{
- g_return_val_if_fail (iface_type == GST_TYPE_MIXER, FALSE);
-
- return TRUE;
-}
-
-static const GList *
-gst_apexsink_mixer_list_tracks (GstMixer * mixer)
-{
- GstApExSink *apexsink = GST_APEX_SINK (mixer);
-
- return apexsink->tracks;
-}
-
-static void
-gst_apexsink_mixer_set_volume (GstMixer * mixer, GstMixerTrack * track,
- gint * volumes)
-{
- GstApExSink *apexsink = GST_APEX_SINK (mixer);
-
- apexsink->volume = volumes[0];
-
- if (apexsink->gst_apexraop != NULL)
- gst_apexraop_set_volume (apexsink->gst_apexraop, apexsink->volume);
-}
-
-static void
-gst_apexsink_mixer_get_volume (GstMixer * mixer, GstMixerTrack * track,
- gint * volumes)
-{
- GstApExSink *apexsink = GST_APEX_SINK (mixer);
-
- volumes[0] = apexsink->volume;
-}
-
-/* sink base init */
-static void
-gst_apexsink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_static_metadata (element_class,
- "Apple AirPort Express Audio Sink", "Sink/Audio/Wireless",
- "Output stream to an AirPort Express",
- "Jérémie Bernard [GRemi] <gremimail@gmail.com>");
- gst_element_class_add_static_pad_template (element_class,
- &gst_apexsink_sink_factory);
-}
-
-/* sink class init */
-static void
-gst_apexsink_class_init (GstApExSinkClass * klass)
-{
- GST_DEBUG_CATEGORY_INIT (apexsink_debug, GST_APEX_SINK_NAME, 0,
- "AirPort Express sink");
-
- parent_class = g_type_class_peek_parent (klass);
-
- ((GObjectClass *) klass)->get_property =
- GST_DEBUG_FUNCPTR (gst_apexsink_get_property);
- ((GObjectClass *) klass)->set_property =
- GST_DEBUG_FUNCPTR (gst_apexsink_set_property);
- ((GObjectClass *) klass)->finalize =
- GST_DEBUG_FUNCPTR (gst_apexsink_finalise);
-
- ((GstAudioSinkClass *) klass)->open = GST_DEBUG_FUNCPTR (gst_apexsink_open);
- ((GstAudioSinkClass *) klass)->prepare =
- GST_DEBUG_FUNCPTR (gst_apexsink_prepare);
- ((GstAudioSinkClass *) klass)->write = GST_DEBUG_FUNCPTR (gst_apexsink_write);
- ((GstAudioSinkClass *) klass)->unprepare =
- GST_DEBUG_FUNCPTR (gst_apexsink_unprepare);
- ((GstAudioSinkClass *) klass)->delay = GST_DEBUG_FUNCPTR (gst_apexsink_delay);
- ((GstAudioSinkClass *) klass)->reset = GST_DEBUG_FUNCPTR (gst_apexsink_reset);
- ((GstAudioSinkClass *) klass)->close = GST_DEBUG_FUNCPTR (gst_apexsink_close);
-
- ((GstElementClass *) klass)->change_state =
- GST_DEBUG_FUNCPTR (gst_apexsink_change_state);
-
- g_object_class_install_property ((GObjectClass *) klass, APEX_PROP_HOST,
- g_param_spec_string ("host", "Host", "AirPort Express target host",
- DEFAULT_APEX_HOST, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property ((GObjectClass *) klass, APEX_PROP_PORT,
- g_param_spec_uint ("port", "Port", "AirPort Express target port", 0,
- 32000, DEFAULT_APEX_PORT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- /* we need to expose the volume as a double for playbin. Internally we keep
- * it as an int between 0 and 100, where 75 corresponds to 1.0.
- * FIXME we should store the volume as a double. */
- g_object_class_install_property ((GObjectClass *) klass, APEX_PROP_VOLUME,
- g_param_spec_double ("volume", "Volume", "AirPort Express target volume",
- 0.0, 10.0, DEFAULT_APEX_VOLUME,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property ((GObjectClass *) klass, APEX_PROP_JACK_TYPE,
- g_param_spec_enum ("jack-type", "Jack Type",
- "AirPort Express connected jack type", GST_APEX_SINK_JACKTYPE_TYPE,
- DEFAULT_APEX_JACK_TYPE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property ((GObjectClass *) klass,
- APEX_PROP_JACK_STATUS, g_param_spec_enum ("jack-status", "Jack Status",
- "AirPort Express jack connection status",
- GST_APEX_SINK_JACKSTATUS_TYPE, DEFAULT_APEX_JACK_STATUS,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property ((GObjectClass *) klass,
- APEX_PROP_GENERATION, g_param_spec_enum ("generation", "Generation",
- "AirPort device generation",
- GST_APEX_SINK_GENERATION_TYPE, DEFAULT_APEX_GENERATION,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property ((GObjectClass *) klass,
- APEX_PROP_TRANSPORT_PROTOCOL, g_param_spec_enum ("transport-protocol",
- "Transport Protocol", "AirPort transport protocol",
- GST_APEX_SINK_TRANSPORT_PROTOCOL_TYPE,
- DEFAULT_APEX_TRANSPORT_PROTOCOL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-}
-
-/* sink plugin instance init */
-static void
-gst_apexsink_init (GstApExSink * apexsink, GstApExSinkClass * g_class)
-{
- GstMixerTrack *track = NULL;
-
- track = g_object_new (GST_TYPE_MIXER_TRACK, NULL);
- track->label = g_strdup ("Airport Express");
- track->num_channels = GST_APEX_RAOP_CHANNELS;
- track->min_volume = 0;
- track->max_volume = 100;
- track->flags = GST_MIXER_TRACK_OUTPUT;
-
- apexsink->host = g_strdup (DEFAULT_APEX_HOST);
- apexsink->port = DEFAULT_APEX_PORT;
- apexsink->volume = CLAMP (DEFAULT_APEX_VOLUME * 75, 0, 100);
- apexsink->gst_apexraop = NULL;
- apexsink->tracks = g_list_append (apexsink->tracks, track);
- apexsink->clock = gst_system_clock_obtain ();
- apexsink->clock_id = NULL;
-
- GST_INFO_OBJECT (apexsink,
- "ApEx sink default initialization, target=\"%s\", port=\"%d\", volume=\"%d%%\"",
- apexsink->host, apexsink->port, apexsink->volume);
-}
-
-/* apex sink set property */
-static void
-gst_apexsink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstApExSink *sink = GST_APEX_SINK (object);
-
- switch (prop_id) {
- case APEX_PROP_HOST:
- if (sink->gst_apexraop == NULL) {
- g_free (sink->host);
- sink->host = g_value_dup_string (value);
-
- GST_INFO_OBJECT (sink, "ApEx sink target set to \"%s\"", sink->host);
- } else {
- G_OBJECT_WARN_INVALID_PSPEC (object, "host", prop_id, pspec);
- }
- break;
- case APEX_PROP_PORT:
- if (sink->gst_apexraop == NULL) {
- sink->port = g_value_get_uint (value);
-
- GST_INFO_OBJECT (sink, "ApEx port set to \"%d\"", sink->port);
- } else {
- G_OBJECT_WARN_INVALID_PSPEC (object, "port", prop_id, pspec);
- }
- break;
- case APEX_PROP_VOLUME:
- {
- gdouble volume;
-
- volume = g_value_get_double (value);
- volume *= 75.0;
-
- sink->volume = CLAMP (volume, 0, 100);
-
- if (sink->gst_apexraop != NULL)
- gst_apexraop_set_volume (sink->gst_apexraop, sink->volume);
-
- GST_INFO_OBJECT (sink, "ApEx volume set to \"%d%%\"", sink->volume);
- break;
- }
- case APEX_PROP_GENERATION:
- if (sink->gst_apexraop == NULL) {
- sink->generation = g_value_get_enum (value);
-
- GST_INFO_OBJECT (sink, "ApEx generation set to \"%d\"",
- sink->generation);
- } else {
- GST_WARNING_OBJECT (sink,
- "SET-PROPERTY : generation property may not be set when apexsink opened !");
- }
- break;
- case APEX_PROP_TRANSPORT_PROTOCOL:
- if (sink->gst_apexraop == NULL) {
- sink->transport_protocol = g_value_get_enum (value);
-
- GST_INFO_OBJECT (sink, "ApEx transport protocol set to \"%d\"",
- sink->transport_protocol);
- } else {
- GST_WARNING_OBJECT (sink,
- "SET-PROPERTY : transport protocol property may not be set when apexsink opened !");
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/* apex sink get property */
-static void
-gst_apexsink_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstApExSink *sink = GST_APEX_SINK (object);
-
- switch (prop_id) {
- case APEX_PROP_HOST:
- g_value_set_string (value, sink->host);
- break;
- case APEX_PROP_PORT:
- g_value_set_uint (value, sink->port);
- break;
- case APEX_PROP_VOLUME:
- g_value_set_double (value, ((gdouble) sink->volume) / 75.0);
- break;
- case APEX_PROP_JACK_TYPE:
- g_value_set_enum (value, gst_apexraop_get_jacktype (sink->gst_apexraop));
- break;
- case APEX_PROP_JACK_STATUS:
- g_value_set_enum (value,
- gst_apexraop_get_jackstatus (sink->gst_apexraop));
- break;
- case APEX_PROP_GENERATION:
- g_value_set_enum (value,
- gst_apexraop_get_generation (sink->gst_apexraop));
- break;
- case APEX_PROP_TRANSPORT_PROTOCOL:
- g_value_set_enum (value,
- gst_apexraop_get_transport_protocol (sink->gst_apexraop));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/* apex sink finalize */
-static void
-gst_apexsink_finalise (GObject * object)
-{
- GstApExSink *sink = GST_APEX_SINK (object);
-
- if (sink->tracks) {
- g_list_foreach (sink->tracks, (GFunc) g_object_unref, NULL);
- g_list_free (sink->tracks);
- sink->tracks = NULL;
- }
-
- gst_object_unref (sink->clock);
-
- g_free (sink->host);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/* sink open : open the device */
-static gboolean
-gst_apexsink_open (GstAudioSink * asink)
-{
- int res;
- GstApExSink *apexsink = (GstApExSink *) asink;
-
- apexsink->gst_apexraop = gst_apexraop_new (apexsink->host,
- apexsink->port, apexsink->generation, apexsink->transport_protocol);
-
- if ((res = gst_apexraop_connect (apexsink->gst_apexraop)) != GST_RTSP_STS_OK) {
- GST_ERROR_OBJECT (apexsink,
- "%s : network or RAOP failure, connection refused or timeout, RTSP code=%d",
- apexsink->host, res);
- return FALSE;
- }
-
- GST_INFO_OBJECT (apexsink,
- "OPEN : ApEx sink successfully connected to \"%s:%d\", ANNOUNCE, SETUP and RECORD requests performed",
- apexsink->host, apexsink->port);
-
- switch (gst_apexraop_get_jackstatus (apexsink->gst_apexraop)) {
- case GST_APEX_JACK_STATUS_CONNECTED:
- GST_INFO_OBJECT (apexsink, "OPEN : ApEx jack is connected");
- break;
- case GST_APEX_JACK_STATUS_DISCONNECTED:
- GST_WARNING_OBJECT (apexsink, "OPEN : ApEx jack is disconnected !");
- break;
- default:
- GST_WARNING_OBJECT (apexsink, "OPEN : ApEx jack status is undefined !");
- break;
- }
-
- switch (gst_apexraop_get_jacktype (apexsink->gst_apexraop)) {
- case GST_APEX_JACK_TYPE_ANALOG:
- GST_INFO_OBJECT (apexsink, "OPEN : ApEx jack type is analog");
- break;
- case GST_APEX_JACK_TYPE_DIGITAL:
- GST_INFO_OBJECT (apexsink, "OPEN : ApEx jack type is digital");
- break;
- default:
- GST_WARNING_OBJECT (apexsink, "OPEN : ApEx jack type is undefined !");
- break;
- }
-
- if ((res =
- gst_apexraop_set_volume (apexsink->gst_apexraop,
- apexsink->volume)) != GST_RTSP_STS_OK) {
- GST_WARNING_OBJECT (apexsink,
- "%s : could not set initial volume to \"%d%%\", RTSP code=%d",
- apexsink->host, apexsink->volume, res);
- } else {
- GST_INFO_OBJECT (apexsink,
- "OPEN : ApEx sink successfully set volume to \"%d%%\"",
- apexsink->volume);
- }
-
- return TRUE;
-}
-
-/* prepare sink : configure the device with the specified format */
-static gboolean
-gst_apexsink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec)
-{
- GstApExSink *apexsink = (GstApExSink *) asink;
- GstApExGeneration gen = gst_apexraop_get_generation (apexsink->gst_apexraop);
-
- apexsink->latency_time = spec->latency_time;
-
- spec->segsize = gen == GST_APEX_GENERATION_ONE
- ? GST_APEX_RAOP_V1_SAMPLES_PER_FRAME * GST_APEX_RAOP_BYTES_PER_SAMPLE
- : GST_APEX_RAOP_V2_SAMPLES_PER_FRAME * GST_APEX_RAOP_BYTES_PER_SAMPLE;
- spec->segtotal = 2;
-
- memset (spec->silence_sample, 0, sizeof (spec->silence_sample));
-
- GST_INFO_OBJECT (apexsink,
- "PREPARE : ApEx sink ready to stream at %dHz, %d bytes per sample, %d channels, %d bytes segments (%dkB/s)",
- spec->rate, spec->bytes_per_sample, spec->channels, spec->segsize,
- spec->rate * spec->bytes_per_sample / 1000);
-
- return TRUE;
-}
-
-/* sink write : write samples to the device */
-static guint
-gst_apexsink_write (GstAudioSink * asink, gpointer data, guint length)
-{
- guint written;
- GstApExSink *apexsink = (GstApExSink *) asink;
-
- if ((written =
- gst_apexraop_write (apexsink->gst_apexraop, data,
- length)) != length) {
- GST_INFO_OBJECT (apexsink,
- "WRITE : %d of %d bytes sent, skipping frame samples...", written,
- length);
- } else {
- GST_INFO_OBJECT (apexsink, "WRITE : %d bytes sent", length);
- /* NOTE, previous calculation subtracted apexsink->latency_time from this;
- * however, the value below is less than apexsink->latency_time for generation 2.
- * In this case, the number went negative (actualy wrapped around into a big number).
- */
- apexsink->clock_id = gst_clock_new_single_shot_id (apexsink->clock,
- (GstClockTime) (gst_clock_get_time (apexsink->clock) +
- ((length * 1000000000.)
- / (GST_APEX_RAOP_BITRATE * GST_APEX_RAOP_BYTES_PER_SAMPLE))));
- gst_clock_id_wait (apexsink->clock_id, NULL);
- gst_clock_id_unref (apexsink->clock_id);
- apexsink->clock_id = NULL;
- }
-
- return length;
-}
-
-/* unprepare sink : undo operations done by prepare */
-static gboolean
-gst_apexsink_unprepare (GstAudioSink * asink)
-{
- GST_INFO_OBJECT (asink, "UNPREPARE");
-
- return TRUE;
-}
-
-/* delay sink : get the estimated number of samples written but not played yet by the device */
-static guint
-gst_apexsink_delay (GstAudioSink * asink)
-{
- GST_LOG_OBJECT (asink, "DELAY");
-
- return 0;
-}
-
-/* reset sink : unblock writes and flush the device */
-static void
-gst_apexsink_reset (GstAudioSink * asink)
-{
- int res;
- GstApExSink *apexsink = (GstApExSink *) asink;
-
- GST_INFO_OBJECT (apexsink, "RESET : flushing buffer...");
-
- if ((res = gst_apexraop_flush (apexsink->gst_apexraop)) == GST_RTSP_STS_OK) {
- GST_INFO_OBJECT (apexsink, "RESET : ApEx buffer flush success");
- } else {
- GST_WARNING_OBJECT (apexsink,
- "RESET : could not flush ApEx buffer, RTSP code=%d", res);
- }
-}
-
-/* sink close : close the device */
-static gboolean
-gst_apexsink_close (GstAudioSink * asink)
-{
- GstApExSink *apexsink = (GstApExSink *) asink;
-
- gst_apexraop_close (apexsink->gst_apexraop);
- gst_apexraop_free (apexsink->gst_apexraop);
-
- GST_INFO_OBJECT (apexsink, "CLOSE : ApEx sink closed connection");
-
- return TRUE;
-}
-
-static GstStateChangeReturn
-gst_apexsink_change_state (GstElement * element, GstStateChange transition)
-{
- GstApExSink *apexsink = (GstApExSink *) element;
-
- if (apexsink->clock_id && transition == GST_STATE_CHANGE_PAUSED_TO_READY) {
- gst_clock_id_unschedule (apexsink->clock_id);
- gst_clock_id_unref (apexsink->clock_id);
- apexsink->clock_id = NULL;
- }
- return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-}
diff --git a/ext/apexsink/gstapexsink.h b/ext/apexsink/gstapexsink.h
deleted file mode 100644
index 711cd3725..000000000
--- a/ext/apexsink/gstapexsink.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* GStreamer - AirPort Express (ApEx) Audio Sink -
- *
- * Remote Audio Access Protocol (RAOP) as used in Apple iTunes to stream music to the Airport Express (ApEx) -
- * RAOP is based on the Real Time Streaming Protocol (RTSP) but with an extra challenge-response RSA based authentication step.
- *
- * RAW PCM input only as defined by the following GST_STATIC_PAD_TEMPLATE regarding the expected gstapexraop input format.
- *
- * Copyright (C) 2008 Jérémie Bernard [GRemi] <gremimail@gmail.com>
- *
- * gstapexsink.h
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef __GST_APEXSINK_H__
-#define __GST_APEXSINK_H__
-
-#include "gstapexraop.h"
-
-#include <gst/audio/gstaudiosink.h>
-#include <gst/interfaces/mixer.h>
-
-G_BEGIN_DECLS
-
-/* standard gstreamer macros */
-#define GST_TYPE_APEX_SINK (gst_apexsink_get_type())
-#define GST_APEX_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_APEX_SINK,GstApExSink))
-#define GST_APEX_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_APEX_SINK,GstApExSinkClass))
-#define GST_IS_APEX_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_APEX_SINK))
-#define GST_IS_APEX_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_APEX_SINK))
-#define GST_APEX_SINK_CAST(obj) ((GstApExSink*)(obj))
-#define GST_APEX_SINK_NAME "apexsink"
-#define GST_APEX_SINK_JACKTYPE_TYPE (gst_apexsink_jacktype_get_type())
-#define GST_APEX_SINK_JACKSTATUS_TYPE (gst_apexsink_jackstatus_get_type())
-#define GST_APEX_SINK_GENERATION_TYPE (gst_apexsink_generation_get_type())
-#define GST_APEX_SINK_TRANSPORT_PROTOCOL_TYPE (gst_apexsink_transport_protocol_get_type())
-/* ApEx classes declaration */
-typedef struct _GstApExSink GstApExSink;
-typedef struct _GstApExSinkClass GstApExSinkClass;
-
-struct _GstApExSink
-{
- /* base definition */
- GstAudioSink sink;
-
- /* public read/write sink properties */
- gchar *host;
- guint port;
- guint volume;
- GstApExGeneration generation;
- GstApExTransportProtocol transport_protocol;
-
- /* private attributes :
- * latency time local copy
- * tracks list of the mixer interface
- * clock for sleeping
- * clock ID for sleeping / canceling sleep
- */
- guint64 latency_time;
- GList *tracks;
- GstClock *clock;
- GstClockID clock_id;
-
- /* private apex client */
- GstApExRAOP *gst_apexraop;
-};
-
-struct _GstApExSinkClass
-{
- GstAudioSinkClass parent_class;
-};
-
-/* genums */
-GType gst_apexsink_jackstatus_get_type (void);
-GType gst_apexsink_jacktype_get_type (void);
-GType gst_apexsink_generation_get_type (void);
-GType gst_apexsink_transport_protocol_get_type (void);
-
-/* audio sink standard api */
-GType gst_apexsink_get_type (void);
-
-G_END_DECLS
-
-#endif
diff --git a/ext/libvisual/Makefile.am b/ext/libvisual/Makefile.am
deleted file mode 100644
index 1eba9af2f..000000000
--- a/ext/libvisual/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-plugin_LTLIBRARIES = libgstlibvisualgl.la
-
-libgstlibvisualgl_la_SOURCES = visual-gl.c
-
-libgstlibvisualgl_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(LIBVISUAL_CFLAGS) \
- -I$(top_srcdir)/gst-libs \
- -I$(top_srcdir)/gst-libs/gst/gl
-
-libgstlibvisualgl_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/gl/libgstgl-$(GST_API_VERSION).la \
- $(GST_PLUGINS_BASE_LIBS) $(GST_LIBS) $(LIBVISUAL_LIBS)
-
-libgstlibvisualgl_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstlibvisualgl_la_LIBTOOLFLAGS = --tag=disable-static
-
diff --git a/ext/libvisual/visual-gl.c b/ext/libvisual/visual-gl.c
deleted file mode 100644
index c796d4b47..000000000
--- a/ext/libvisual/visual-gl.c
+++ /dev/null
@@ -1,1248 +0,0 @@
-/* GStreamer
- * Copyright (C) 2004 Benjamin Otte <otte@gnome.org>
- * Copyright (C) 2009 Jonathan Matthew <notverysmart@gmail.com>
- * Copyright (C) 2011 Julien Isorce <julien.isorce@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/**
- * SECTION:element-libvisualgl
- *
- * Wrapper for libvisual plugins that use OpenGL
- *
- * <refsect2>
- * <title>Examples</title>
- * |[
- * gst-launch-1.0 -v audiotestsrc ! libvisual_gl_lv_flower ! glimagesink
- * ]|
- * </refsect2>
- */
-
-#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 <gst/gl/gstglbuffer.h>
-#include <gst/gl/gstgldisplay.h>
-
-#include <libvisual/libvisual.h>
-
-#define GST_TYPE_VISUAL_GL (gst_visual_gl_get_type())
-#define GST_IS_VISUAL_GL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VISUAL_GL))
-#define GST_VISUAL_GL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VISUAL_GL,GstVisualGL))
-#define GST_IS_VISUAL_GL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VISUAL_GL))
-#define GST_VISUAL_GL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VISUAL_GL,GstVisualGLClass))
-#define GST_VISUAL_GL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VISUAL_GL, GstVisualGLClass))
-
-typedef struct _GstVisualGL GstVisualGL;
-typedef struct _GstVisualGLClass GstVisualGLClass;
-
-/* XXX use same category as libvisual plugin in -base? */
-GST_DEBUG_CATEGORY_STATIC (libvisual_debug);
-#define GST_CAT_DEFAULT (libvisual_debug)
-
-/* amounf of samples before we can feed libvisual */
-#define VISUAL_SAMPLES 512
-
-#define DEFAULT_WIDTH 320
-#define DEFAULT_HEIGHT 240
-#define DEFAULT_FPS_N 25
-#define DEFAULT_FPS_D 1
-
-struct _GstVisualGL
-{
- GstElement element;
-
- /* pads */
- GstPad *sinkpad;
- GstPad *srcpad;
- GstSegment segment;
-
- /* GL stuff */
- GstGLDisplay *display;
- GLuint fbo;
- GLuint depthbuffer;
- GLuint midtexture;
- GLdouble actor_projection_matrix[16];
- GLdouble actor_modelview_matrix[16];
- GLboolean is_enabled_gl_depth_test;
- GLint gl_depth_func;
- GLboolean is_enabled_gl_blend;
- GLint gl_blend_src_alpha;
-
- /* libvisual stuff */
- VisAudio *audio;
- VisVideo *video;
- VisActor *actor;
- int actor_setup_result;
-
- /* audio/video state */
- gint channels;
- gint rate; /* Input samplerate */
- gint bps;
- VisAudioSampleRateType libvisual_rate;
-
- /* 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 _GstVisualGLClass
-{
- GstElementClass parent_class;
-
- VisPluginRef *plugin;
-};
-
-GType gst_visual_gl_get_type (void);
-
-
-static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_GL_VIDEO_CAPS)
- );
-
-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 }, "
- "rate = (int) { 8000, 11250, 22500, 32000, 44100, 48000, 96000 }")
- );
-
-
-static void gst_visual_gl_class_init (gpointer g_class, gpointer class_data);
-static void gst_visual_gl_init (GstVisualGL * visual);
-static void gst_visual_gl_dispose (GObject * object);
-
-static GstStateChangeReturn gst_visual_gl_change_state (GstElement * element,
- GstStateChange transition);
-static GstFlowReturn gst_visual_gl_chain (GstPad * pad, GstBuffer * buffer);
-static gboolean gst_visual_gl_sink_event (GstPad * pad, GstEvent * event);
-static gboolean gst_visual_gl_src_event (GstPad * pad, GstEvent * event);
-
-static gboolean gst_visual_gl_src_query (GstPad * pad, GstQuery * query);
-
-static gboolean gst_visual_gl_sink_setcaps (GstPad * pad, GstCaps * caps);
-static gboolean gst_visual_gl_src_setcaps (GstPad * pad, GstCaps * caps);
-static GstCaps *gst_visual_gl_getcaps (GstPad * pad);
-static void libvisual_log_handler (const char *message, const char *funcname,
- void *priv);
-
-static GstElementClass *parent_class = NULL;
-
-GType
-gst_visual_gl_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo info = {
- sizeof (GstVisualGLClass),
- NULL,
- NULL,
- gst_visual_gl_class_init,
- NULL,
- NULL,
- sizeof (GstVisualGL),
- 0,
- (GInstanceInitFunc) gst_visual_gl_init,
- };
-
- type = g_type_register_static (GST_TYPE_ELEMENT, "GstVisualGL", &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_gl_class_init (gpointer g_class, gpointer class_data)
-{
- GstVisualGLClass *klass = GST_VISUAL_GL_CLASS (g_class);
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- GObjectClass *object = G_OBJECT_CLASS (g_class);
-
- klass->plugin = class_data;
-
- element_class->change_state = gst_visual_gl_change_state;
-
- if (class_data == NULL) {
- parent_class = g_type_class_peek_parent (g_class);
- } else {
- char *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_static_pad_template (element_class, &src_template);
- gst_element_class_add_static_pad_template (element_class, &sink_template);
-
- gst_element_class_set_metadata (element_class,
- longname, "Visualization", klass->plugin->info->about,
- "Benjamin Otte <otte@gnome.org>");
-
- g_free (longname);
- }
-
- object->dispose = gst_visual_gl_dispose;
-}
-
-static void
-gst_visual_gl_init (GstVisualGL * 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_gl_sink_setcaps);
- gst_pad_set_chain_function (visual->sinkpad, gst_visual_gl_chain);
- gst_pad_set_event_function (visual->sinkpad, gst_visual_gl_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_gl_src_setcaps);
- gst_pad_set_getcaps_function (visual->srcpad, gst_visual_gl_getcaps);
- gst_pad_set_event_function (visual->srcpad, gst_visual_gl_src_event);
- gst_pad_set_query_function (visual->srcpad, gst_visual_gl_src_query);
- gst_element_add_pad (GST_ELEMENT (visual), visual->srcpad);
-
- visual->adapter = gst_adapter_new ();
-
- visual->actor = NULL;
-
- visual->display = NULL;
- visual->fbo = 0;
- visual->depthbuffer = 0;
- visual->midtexture = 0;
-
- visual->is_enabled_gl_depth_test = GL_FALSE;
- visual->gl_depth_func = GL_LESS;
- visual->is_enabled_gl_blend = GL_FALSE;
- visual->gl_blend_src_alpha = GL_ONE;
-}
-
-static void
-gst_visual_gl_clear_actors (GstVisualGL * 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_gl_dispose (GObject * object)
-{
- GstVisualGL *visual = GST_VISUAL_GL (object);
-
- if (visual->adapter) {
- gst_object_unref (visual->adapter);
- visual->adapter = NULL;
- }
-
- GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
-}
-
-static void
-gst_visual_gl_reset (GstVisualGL * 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_gl_getcaps (GstPad * pad)
-{
- GstCaps *ret;
- GstVisualGL *visual = GST_VISUAL_GL (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) == 0) {
- /* We don't handle non-GL plugins */
- goto beach;
- }
-
- GST_DEBUG_OBJECT (visual, "libvisual-gl plugin supports depths %u (0x%04x)",
- depths, depths);
- /* only do GL output */
- gst_caps_append (ret, gst_caps_from_string (GST_GL_VIDEO_CAPS));
-
-beach:
-
- GST_DEBUG_OBJECT (visual, "returning caps %" GST_PTR_FORMAT, ret);
- gst_object_unref (visual);
- return ret;
-}
-
-static gboolean
-gst_visual_gl_src_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstVisualGL *visual = GST_VISUAL_GL (gst_pad_get_parent (pad));
- GstStructure *structure;
-
- 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_fraction (structure, "framerate", &visual->fps_n,
- &visual->fps_d))
- goto error;
-
- /* precalc some values */
- 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_gl_display_gen_texture (visual->display, &visual->midtexture,
- visual->width, visual->height);
-
- gst_gl_display_gen_fbo (visual->display, visual->width, visual->height,
- &visual->fbo, &visual->depthbuffer);
-
- 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_gl_sink_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstVisualGL *visual = GST_VISUAL_GL (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);
-
- switch (visual->rate) {
- case 8000:
- visual->libvisual_rate = VISUAL_AUDIO_SAMPLE_RATE_8000;
- break;
- case 11250:
- visual->libvisual_rate = VISUAL_AUDIO_SAMPLE_RATE_11250;
- break;
- case 22500:
- visual->libvisual_rate = VISUAL_AUDIO_SAMPLE_RATE_22500;
- break;
- case 32000:
- visual->libvisual_rate = VISUAL_AUDIO_SAMPLE_RATE_32000;
- break;
- case 44100:
- visual->libvisual_rate = VISUAL_AUDIO_SAMPLE_RATE_44100;
- break;
- case 48000:
- visual->libvisual_rate = VISUAL_AUDIO_SAMPLE_RATE_48000;
- break;
- case 96000:
- visual->libvisual_rate = VISUAL_AUDIO_SAMPLE_RATE_96000;
- break;
- default:
- gst_object_unref (visual);
- return FALSE;
- }
-
- /* 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_gl_src_negotiate (GstVisualGL * visual)
-{
- GstCaps *othercaps, *target;
- 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) {
- target = gst_caps_intersect (othercaps, caps);
- gst_caps_unref (othercaps);
- gst_caps_unref (caps);
-
- if (gst_caps_is_empty (target))
- goto no_format;
-
- gst_caps_truncate (target);
- } 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
- * 320x240x25 by convention. */
- structure = gst_caps_get_structure (target, 0);
- gst_structure_fixate_field_nearest_int (structure, "width", DEFAULT_WIDTH);
- gst_structure_fixate_field_nearest_int (structure, "height", DEFAULT_HEIGHT);
- gst_structure_fixate_field_nearest_fraction (structure, "framerate",
- DEFAULT_FPS_N, DEFAULT_FPS_D);
-
- 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 (target);
- return FALSE;
- }
-}
-
-static gboolean
-gst_visual_gl_sink_event (GstPad * pad, GstEvent * event)
-{
- GstVisualGL *visual;
- gboolean res;
-
- visual = GST_VISUAL_GL (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_gl_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_gl_src_event (GstPad * pad, GstEvent * event)
-{
- GstVisualGL *visual;
- gboolean res;
-
- visual = GST_VISUAL_GL (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;
-}
-
-static gboolean
-gst_visual_gl_src_query (GstPad * pad, GstQuery * query)
-{
- gboolean res;
- GstVisualGL *visual;
-
- visual = GST_VISUAL_GL (gst_pad_get_parent (pad));
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_LATENCY:
- {
- /* We need to send the query upstream and add the returned latency to our
- * own */
- GstClockTime min_latency, max_latency;
- gboolean us_live;
- GstClockTime our_latency;
- guint max_samples;
-
- if ((res = gst_pad_peer_query (visual->sinkpad, query))) {
- gst_query_parse_latency (query, &us_live, &min_latency, &max_latency);
-
- GST_DEBUG_OBJECT (visual, "Peer latency: min %"
- GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
- GST_TIME_ARGS (min_latency), GST_TIME_ARGS (max_latency));
-
- /* the max samples we must buffer buffer */
- max_samples = MAX (VISUAL_SAMPLES, visual->spf);
- our_latency =
- gst_util_uint64_scale_int (max_samples, GST_SECOND, visual->rate);
-
- GST_DEBUG_OBJECT (visual, "Our latency: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (our_latency));
-
- /* we add some latency but only if we need to buffer more than what
- * upstream gives us */
- min_latency += our_latency;
- if (max_latency != -1)
- max_latency += our_latency;
-
- GST_DEBUG_OBJECT (visual, "Calculated total latency : min %"
- GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
- GST_TIME_ARGS (min_latency), GST_TIME_ARGS (max_latency));
-
- gst_query_set_latency (query, TRUE, min_latency, max_latency);
- }
- break;
- }
- case GST_QUERY_CUSTOM:
- {
- GstStructure *structure = gst_query_get_structure (query);
- gchar *name = gst_element_get_name (visual);
-
- res = g_strcmp0 (name, gst_structure_get_name (structure)) == 0;
- g_free (name);
-
- if (!res)
- res = gst_pad_query_default (pad, query);
- break;
- }
- default:
- res = gst_pad_peer_query (visual->sinkpad, query);
- 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 (GstVisualGL * visual, GstGLBuffer ** outbuf)
-{
- /* we don't know an output format yet, pick one */
- if (GST_PAD_CAPS (visual->srcpad) == NULL) {
- if (!gst_vis_gl_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));
-
- *outbuf = gst_gl_buffer_new (visual->display, visual->width, visual->height);
- if (*outbuf == NULL)
- return GST_FLOW_ERROR;
-
- gst_buffer_set_caps (GST_BUFFER (*outbuf), GST_PAD_CAPS (visual->srcpad));
- return GST_FLOW_OK;
-}
-
-static void
-actor_setup (GstGLDisplay * display, GstVisualGL * visual)
-{
- /* save and clear top of the stack */
- glPushAttrib (GL_ALL_ATTRIB_BITS);
-
- glMatrixMode (GL_PROJECTION);
- glPushMatrix ();
- glLoadIdentity ();
-
- glMatrixMode (GL_MODELVIEW);
- glPushMatrix ();
- glLoadIdentity ();
-
- visual->actor_setup_result = visual_actor_realize (visual->actor);
- if (visual->actor_setup_result == 0) {
- /* store the actor's matrices for rendering the first frame */
- glGetDoublev (GL_MODELVIEW_MATRIX, visual->actor_modelview_matrix);
- glGetDoublev (GL_PROJECTION_MATRIX, visual->actor_projection_matrix);
-
- visual->is_enabled_gl_depth_test = glIsEnabled (GL_DEPTH_TEST);
- glGetIntegerv (GL_DEPTH_FUNC, &visual->gl_depth_func);
-
- visual->is_enabled_gl_blend = glIsEnabled (GL_BLEND);
- glGetIntegerv (GL_BLEND_SRC_ALPHA, &visual->gl_blend_src_alpha);
-
- /* retore matrix */
- glMatrixMode (GL_PROJECTION);
- glPopMatrix ();
-
- glMatrixMode (GL_MODELVIEW);
- glPopMatrix ();
-
- glPopAttrib ();
- }
-}
-
-static void
-actor_negotiate (GstGLDisplay * display, GstVisualGL * visual)
-{
- gint err = VISUAL_OK;
-
- err = visual_video_set_depth (visual->video, VISUAL_VIDEO_DEPTH_GL);
- if (err != VISUAL_OK)
- g_warning ("failed to visual_video_set_depth\n");
-
- err =
- visual_video_set_dimension (visual->video, visual->width, visual->height);
- if (err != VISUAL_OK)
- g_warning ("failed to visual_video_set_dimension\n");
-
- err = visual_actor_video_negotiate (visual->actor, 0, FALSE, FALSE);
- if (err != VISUAL_OK)
- g_warning ("failed to visual_actor_video_negotiate\n");
-}
-
-static void
-check_gl_matrix (void)
-{
- GLdouble projection_matrix[16];
- GLdouble modelview_matrix[16];
- gint i = 0;
- gint j = 0;
-
- glGetDoublev (GL_PROJECTION_MATRIX, projection_matrix);
- glGetDoublev (GL_MODELVIEW_MATRIX, modelview_matrix);
-
- for (j = 0; j < 4; ++j) {
- for (i = 0; i < 4; ++i) {
- if (projection_matrix[i + 4 * j] != projection_matrix[i + 4 * j])
- g_warning ("invalid projection matrix at coordiante %dx%d: %f\n", i, j,
- projection_matrix[i + 4 * j]);
- if (modelview_matrix[i + 4 * j] != modelview_matrix[i + 4 * j])
- g_warning ("invalid modelview_matrix matrix at coordiante %dx%d: %f\n",
- i, j, modelview_matrix[i + 4 * j]);
- }
- }
-}
-
-static void
-render_frame (GstVisualGL * visual)
-{
- const guint16 *data;
- VisBuffer *lbuf, *rbuf;
- guint16 ldata[VISUAL_SAMPLES], rdata[VISUAL_SAMPLES];
- guint i;
- gcahr *name;
-
- /* Read VISUAL_SAMPLES samples per channel */
- data =
- (const guint16 *) gst_adapter_peek (visual->adapter,
- VISUAL_SAMPLES * visual->bps);
-
- 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 < VISUAL_SAMPLES; i++) {
- ldata[i] = *data++;
- rdata[i] = *data++;
- }
- } else {
- for (i = 0; i < VISUAL_SAMPLES; i++) {
- ldata[i] = *data;
- rdata[i] = *data++;
- }
- }
-
- visual_audio_samplepool_input_channel (visual->audio->samplepool,
- lbuf, visual->libvisual_rate, VISUAL_AUDIO_SAMPLE_FORMAT_S16,
- VISUAL_AUDIO_CHANNEL_LEFT);
- visual_audio_samplepool_input_channel (visual->audio->samplepool,
- rbuf, visual->libvisual_rate, VISUAL_AUDIO_SAMPLE_FORMAT_S16,
- VISUAL_AUDIO_CHANNEL_RIGHT);
-
- visual_object_unref (VISUAL_OBJECT (lbuf));
- visual_object_unref (VISUAL_OBJECT (rbuf));
-
- visual_audio_analyze (visual->audio);
-
- /* apply the matrices that the actor set up */
- glPushAttrib (GL_ALL_ATTRIB_BITS);
-
- glMatrixMode (GL_PROJECTION);
- glPushMatrix ();
- glLoadMatrixd (visual->actor_projection_matrix);
-
- glMatrixMode (GL_MODELVIEW);
- glPushMatrix ();
- glLoadMatrixd (visual->actor_modelview_matrix);
-
- /* This line try to hacks compatiblity with libprojectM
- * If libprojectM version <= 2.0.0 then we have to unbind our current
- * fbo to see something. But it's incorrect and we cannot use fbo chainning (append other glfilters
- * after libvisual_gl_projectM will not work)
- * To have full compatibility, libprojectM needs to take care of our fbo.
- * Indeed libprojectM has to unbind it before the first rendering pass
- * and then rebind it before the final pass. It's done from 2.0.1
- */
- name = gst_element_get_name (GST_ELEMENT (visual));
- if (g_ascii_strncasecmp (name, "visualglprojectm", 16) == 0
- && !HAVE_PROJECTM_TAKING_CARE_OF_EXTERNAL_FBO)
- glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
- g_free (name);
-
- actor_negotiate (visual->display, visual);
-
- if (visual->is_enabled_gl_depth_test) {
- glEnable (GL_DEPTH_TEST);
- glDepthFunc (visual->gl_depth_func);
- }
-
- if (visual->is_enabled_gl_blend) {
- glEnable (GL_BLEND);
- glBlendFunc (visual->gl_blend_src_alpha, GL_ZERO);
- }
-
- visual_actor_run (visual->actor, visual->audio);
-
- check_gl_matrix ();
-
- glMatrixMode (GL_PROJECTION);
- glPopMatrix ();
-
- glMatrixMode (GL_MODELVIEW);
- glPopMatrix ();
-
- glPopAttrib ();
-
- glDisable (GL_DEPTH_TEST);
- glDisable (GL_BLEND);
-
- /*glDisable (GL_LIGHT0);
- glDisable (GL_LIGHTING);
- glDisable (GL_POLYGON_OFFSET_FILL);
- glDisable (GL_COLOR_MATERIAL);
- glDisable (GL_CULL_FACE); */
-
- GST_DEBUG_OBJECT (visual, "rendered one frame");
-}
-
-static void
-bottom_up_to_top_down (gint width, gint height, guint texture,
- GstVisualGL * visual)
-{
-
- glEnable (GL_TEXTURE_2D);
- glBindTexture (GL_TEXTURE_2D, texture);
-
- glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glMatrixMode (GL_PROJECTION);
- glLoadIdentity ();
-
- glBegin (GL_QUADS);
- glTexCoord2i (0, 0);
- glVertex2i (-1, 1);
- glTexCoord2i (width, 0);
- glVertex2i (1, 1);
- glTexCoord2i (width, height);
- glVertex2i (1, -1);
- glTexCoord2i (0, height);
- glVertex2i (-1, -1);
- glEnd ();
-
- glBindTexture (GL_TEXTURE_2D, 0);
- glDisable (GL_TEXTURE_2D);
-
- GST_DEBUG_OBJECT (visual, "bottom up to top down");
-}
-
-static GstFlowReturn
-gst_visual_gl_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstGLBuffer *outbuf = NULL;
- GstVisualGL *visual = GST_VISUAL_GL (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;
- 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 VISUAL_SAMPLES samples */
- if (avail < VISUAL_SAMPLES * 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);
- qostime += visual->duration;
-
- 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;
- }
- }
-
- /* 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;
- }
- }
-
- /* render libvisual plugin to our target */
- gst_gl_display_use_fbo_v2 (visual->display,
- visual->width, visual->height, visual->fbo, visual->depthbuffer,
- visual->midtexture, (GLCB_V2) render_frame, (gpointer *) visual);
-
- /* gst video is top-down whereas opengl plan is bottom up */
- gst_gl_display_use_fbo (visual->display,
- visual->width, visual->height, visual->fbo, visual->depthbuffer,
- outbuf->texture, (GLCB) bottom_up_to_top_down,
- visual->width, visual->height, visual->midtexture,
- 0, visual->width, 0, visual->height, GST_GL_DISPLAY_PROJECTION_ORTHO2D,
- (gpointer *) visual);
-
- GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
- GST_BUFFER_DURATION (outbuf) = visual->duration;
-
- ret = gst_pad_push (visual->srcpad, GST_BUFFER (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_gl_buffer_unref (outbuf);
-
- gst_object_unref (visual);
-
- return ret;
-}
-
-static GstStateChangeReturn
-gst_visual_gl_change_state (GstElement * element, GstStateChange transition)
-{
- GstVisualGL *visual = GST_VISUAL_GL (element);
- GstStateChangeReturn ret;
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- {
- GstElement *parent = GST_ELEMENT (gst_element_get_parent (visual));
- GstStructure *structure = NULL;
- GstQuery *query = NULL;
- gboolean isPerformed = FALSE;
- gchar *name;
-
- if (!parent) {
- GST_ELEMENT_ERROR (visual, CORE, STATE_CHANGE, (NULL),
- ("A parent bin is required"));
- return FALSE;
- }
-
- name = gst_element_get_name (visual);
- structure = gst_structure_new (name, NULL);
- query = gst_query_new_application (GST_QUERY_CUSTOM, structure);
- g_free (name);
-
- isPerformed = gst_element_query (parent, query);
-
- if (isPerformed) {
- const GValue *id_value =
- gst_structure_get_value (structure, "gstgldisplay");
- if (G_VALUE_HOLDS_POINTER (id_value))
- /* at least one gl element is after in our gl chain */
- visual->display =
- gst_object_ref (GST_GL_DISPLAY (g_value_get_pointer (id_value)));
- else {
- /* this gl filter is a sink in terms of the gl chain */
- visual->display = gst_gl_display_new ();
- gst_gl_display_create_context (visual->display, 0);
- //TODO visual->external_gl_context);
- }
-
- gst_visual_gl_reset (visual);
-
- visual->actor =
- visual_actor_new (GST_VISUAL_GL_GET_CLASS (visual)->plugin->info->
- plugname);
- visual->video = visual_video_new ();
- visual->audio = visual_audio_new ();
-
- if (!visual->actor || !visual->video)
- goto actor_setup_failed;
-
- gst_gl_display_thread_add (visual->display,
- (GstGLDisplayThreadFunc) actor_setup, visual);
-
- if (visual->actor_setup_result != 0)
- goto actor_setup_failed;
- else
- visual_actor_set_video (visual->actor, visual->video);
- }
-
- gst_query_unref (query);
- gst_object_unref (GST_OBJECT (parent));
-
- if (!isPerformed)
- return GST_STATE_CHANGE_FAILURE;
- }
- 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:
- {
- if (visual->fbo) {
- gst_gl_display_del_fbo (visual->display, visual->fbo,
- visual->depthbuffer);
- visual->fbo = 0;
- visual->depthbuffer = 0;
- }
- if (visual->midtexture) {
- gst_gl_display_del_texture (visual->display, visual->midtexture,
- visual->width, visual->height);
- visual->midtexture = 0;
- }
- if (visual->display) {
- gst_object_unref (visual->display);
- visual->display = NULL;
- }
-
- gst_visual_gl_clear_actors (visual);
- }
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- break;
- default:
- break;
- }
-
- return ret;
-
- /* ERRORS */
-actor_setup_failed:
- {
- GST_ELEMENT_ERROR (visual, LIBRARY, INIT, (NULL),
- ("could not set up actor"));
- gst_visual_gl_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_gl_actor_plugin_is_gl (VisObject * plugin, const gchar * name)
-{
- gboolean is_gl;
- gint depth;
-
- depth = VISUAL_ACTOR_PLUGIN (plugin)->vidoptions.depth;
- is_gl = (depth & VISUAL_VIDEO_DEPTH_GL) != 0;
-
- if (!is_gl) {
- GST_DEBUG ("plugin %s is not a GL plugin (%d), ignoring", name, depth);
- } else {
- GST_DEBUG ("plugin %s is a GL plugin (%d), registering", 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 ();
-
- count = visual_collection_size (VISUAL_COLLECTION (list));
-
- 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 (GstVisualGLClass),
- NULL,
- NULL,
- gst_visual_gl_class_init,
- NULL,
- ref,
- sizeof (GstVisualGL),
- 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 {
- /* only register plugins that support GL */
- skip = !(gst_visual_gl_actor_plugin_is_gl (visplugin->info->plugin,
- visplugin->info->plugname));
- }
-
- visual_plugin_unload (visplugin);
-
- if (!skip) {
- name = g_strdup_printf ("GstVisualGL%s", ref->info->plugname);
- make_valid_name (name);
- type = g_type_register_static (GST_TYPE_VISUAL_GL, name, &info, 0);
- g_free (name);
-
- name = g_strdup_printf ("libvisual_gl_%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-gl",
- "libvisual-gl visualization plugins",
- plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/meson.build b/ext/meson.build
index 62af78950..0eba7b49a 100644
--- a/ext/meson.build
+++ b/ext/meson.build
@@ -1,4 +1,3 @@
-#subdir('apexsink')
subdir('assrender')
#subdir('bs2b')
subdir('bz2')
@@ -25,13 +24,11 @@ subdir('kate')
#subdir('ladspa')
subdir('libde265')
subdir('libmms')
-#subdir('libvisual')
#subdir('lv2')
#subdir('modplug')
#subdir('mpeg2enc')
#subdir('mplex')
#subdir('musepack')
-#subdir('nas')
#subdir('neon')
#subdir('ofa')
#subdir('openal')
@@ -41,16 +38,13 @@ subdir('openh264')
subdir('openjpeg')
#subdir('openni2')
subdir('opus')
-#subdir('qt')
subdir('resindvd')
subdir('rsvg')
subdir('rtmp')
subdir('sbc')
subdir('schroedinger')
-#subdir('sdl')
subdir('smoothstreaming')
#subdir('sndfile')
-#subdir('sndio')
if cc.get_id() != 'msvc'
# soundtouch doesn't do exporting of symbols for DLLs and I'm not sure how to
# do that for C++ classes. -- Nirbheek
@@ -62,7 +56,7 @@ endif
#subdir('spc')
subdir('srtp')
#subdir('teletextdec')
-#subdir('timidity')
+#subdir('wildmidi')
subdir('ttml')
subdir('voaacenc')
#subdir('voamrwbenc')
@@ -71,5 +65,4 @@ subdir('wayland')
#subdir('webrtcdsp')
subdir('webp')
subdir('x265')
-#subdir('xvid')
subdir('zbar')
diff --git a/ext/nas/Makefile.am b/ext/nas/Makefile.am
deleted file mode 100644
index ef1162abc..000000000
--- a/ext/nas/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-plugin_LTLIBRARIES = libgstnassink.la
-
-libgstnassink_la_SOURCES = nassink.c
-libgstnassink_la_CFLAGS = \
- $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(NAS_CFLAGS)
-libgstnassink_la_LIBADD = \
- $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_API_VERSION) $(NAS_LIBS)
-libgstnassink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstnassink_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-noinst_HEADERS = nassink.h
diff --git a/ext/nas/nassink.c b/ext/nas/nassink.c
deleted file mode 100644
index 2d6404b8b..000000000
--- a/ext/nas/nassink.c
+++ /dev/null
@@ -1,583 +0,0 @@
-/* GStreamer
- * Copyright (C) <2003> Laurent Vivier <Laurent.Vivier@bull.net>
- * Copyright (C) <2004> Arwed v. Merkatz <v.merkatz@gmx.net>
- *
- * Based on esdsink.c:
- * Copyright (C) <2001> Richard Boulton <richard-gst@tartarus.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <string.h>
-#include <audio/audiolib.h>
-#include <audio/soundlib.h>
-#include "nassink.h"
-
-#define NAS_SOUND_PORT_DURATION (2)
-
-GST_DEBUG_CATEGORY_STATIC (nas_debug);
-#define GST_CAT_DEFAULT nas_debug
-
-enum
-{
- ARG_0,
- ARG_MUTE,
- ARG_HOST
-};
-
-#define DEFAULT_MUTE FALSE
-#define DEFAULT_HOST NULL
-
-static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- 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) [ 1000, 96000 ], "
- "channels = (int) [ 1, 2 ]; "
- "audio/x-raw-int, "
- "signed = (boolean) FALSE, "
- "width = (int) 8, "
- "depth = (int) 8, "
- "rate = (int) [ 1000, 96000 ], " "channels = (int) [ 1, 2 ]")
- );
-
-static void gst_nas_sink_finalize (GObject * object);
-
-static gboolean gst_nas_sink_open (GstAudioSink * sink);
-static gboolean gst_nas_sink_close (GstAudioSink * sink);
-static gboolean gst_nas_sink_prepare (GstAudioSink * sink,
- GstRingBufferSpec * spec);
-static gboolean gst_nas_sink_unprepare (GstAudioSink * sink);
-static guint gst_nas_sink_write (GstAudioSink * asink, gpointer data,
- guint length);
-static guint gst_nas_sink_delay (GstAudioSink * asink);
-static void gst_nas_sink_reset (GstAudioSink * asink);
-static GstCaps *gst_nas_sink_getcaps (GstBaseSink * pad);
-
-static void gst_nas_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_nas_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static void NAS_flush (GstNasSink * sink);
-static void NAS_sendData (GstNasSink * sink, AuUint32 numBytes);
-static AuBool NAS_EventHandler (AuServer * aud, AuEvent * ev,
- AuEventHandlerRec * handler);
-static AuDeviceID NAS_getDevice (AuServer * aud, int numTracks);
-
-GST_BOILERPLATE (GstNasSink, gst_nas_sink, GstAudioSink, GST_TYPE_AUDIO_SINK);
-
-static void
-gst_nas_sink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_static_pad_template (element_class, &sink_factory);
- gst_element_class_set_static_metadata (element_class, "NAS audio sink",
- "Sink/Audio",
- "Plays audio to a Network Audio Server",
- "Laurent Vivier <Laurent.Vivier@bull.net>, "
- "Arwed v. Merkatz <v.merkatz@gmx.net>");
-}
-
-static void
-gst_nas_sink_class_init (GstNasSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstBaseSinkClass *gstbasesink_class;
- GstAudioSinkClass *gstaudiosink_class;
-
- gobject_class = (GObjectClass *) klass;
- gstbasesink_class = (GstBaseSinkClass *) klass;
- gstaudiosink_class = (GstAudioSinkClass *) klass;
-
- gobject_class->set_property = gst_nas_sink_set_property;
- gobject_class->get_property = gst_nas_sink_get_property;
- gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_nas_sink_finalize);
-
- g_object_class_install_property (gobject_class, ARG_MUTE,
- g_param_spec_boolean ("mute", "mute", "Whether to mute playback",
- DEFAULT_MUTE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, ARG_HOST,
- g_param_spec_string ("host", "host",
- "host running the NAS daemon (name of X/Terminal, default is "
- "$AUDIOSERVER or $DISPLAY)", DEFAULT_HOST,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
-
- gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_nas_sink_getcaps);
-
- gstaudiosink_class->open = GST_DEBUG_FUNCPTR (gst_nas_sink_open);
- gstaudiosink_class->close = GST_DEBUG_FUNCPTR (gst_nas_sink_close);
- gstaudiosink_class->prepare = GST_DEBUG_FUNCPTR (gst_nas_sink_prepare);
- gstaudiosink_class->unprepare = GST_DEBUG_FUNCPTR (gst_nas_sink_unprepare);
- gstaudiosink_class->write = GST_DEBUG_FUNCPTR (gst_nas_sink_write);
- gstaudiosink_class->delay = GST_DEBUG_FUNCPTR (gst_nas_sink_delay);
- gstaudiosink_class->reset = GST_DEBUG_FUNCPTR (gst_nas_sink_reset);
-}
-
-static void
-gst_nas_sink_init (GstNasSink * nassink, GstNasSinkClass * klass)
-{
- /* properties will automatically be set to their default values */
- nassink->audio = NULL;
- nassink->flow = AuNone;
- nassink->need_data = 0;
-}
-
-static void
-gst_nas_sink_finalize (GObject * object)
-{
- GstNasSink *nassink = GST_NAS_SINK (object);
-
- g_free (nassink->host);
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static GstCaps *
-gst_nas_sink_getcaps (GstBaseSink * bsink)
-{
- GstNasSink *nassink = GST_NAS_SINK (bsink);
- const GstCaps *templatecaps;
- AuServer *server;
- GstCaps *fixated, *caps;
- int i;
-
- server = nassink->audio;
-
- templatecaps = gst_static_pad_template_get_caps (&sink_factory);
-
- if (server == NULL)
- return gst_caps_copy (templatecaps);
-
- fixated = gst_caps_copy (templatecaps);
- for (i = 0; i < gst_caps_get_size (fixated); i++) {
- GstStructure *structure;
- gint min, max;
-
- min = AuServerMinSampleRate (server);
- max = AuServerMaxSampleRate (server);
-
- structure = gst_caps_get_structure (fixated, i);
-
- if (min == max)
- gst_structure_set (structure, "rate", G_TYPE_INT, max, NULL);
- else
- gst_structure_set (structure, "rate", GST_TYPE_INT_RANGE, min, max, NULL);
- }
-
- caps = gst_caps_intersect (fixated, templatecaps);
- gst_caps_unref (fixated);
-
- if (nassink->audio == NULL)
- AuCloseServer (server);
-
- return caps;
-}
-
-static gint
-gst_nas_sink_sink_get_format (const GstRingBufferSpec * spec)
-{
- gint result;
-
- switch (spec->format) {
- case GST_U8:
- result = AuFormatLinearUnsigned8;
- break;
- case GST_S8:
- result = AuFormatLinearSigned8;
- break;
- case GST_S16_LE:
- result = AuFormatLinearSigned16LSB;
- break;
- case GST_S16_BE:
- result = AuFormatLinearSigned16MSB;
- break;
- case GST_U16_LE:
- result = AuFormatLinearUnsigned16LSB;
- break;
- case GST_U16_BE:
- result = AuFormatLinearUnsigned16MSB;
- break;
- default:
- result = 0;
- break;
- }
- return result;
-}
-
-static gboolean
-gst_nas_sink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec)
-{
- GstNasSink *sink = GST_NAS_SINK (asink);
- AuElement elements[2];
- AuUint32 buf_samples;
- unsigned char format;
-
- format = gst_nas_sink_sink_get_format (spec);
- if (format == 0) {
- GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS, (NULL),
- ("Unable to get format %d", spec->format));
- return FALSE;
- }
- GST_DEBUG_OBJECT (sink, "Format: %d %d\n", spec->format, format);
-
- sink->flow = AuGetScratchFlow (sink->audio, NULL);
- if (sink->flow == 0) {
- GST_DEBUG_OBJECT (sink, "couldn't get flow");
- return FALSE;
- }
-
- buf_samples = spec->rate * NAS_SOUND_PORT_DURATION;
- /*
- spec->segsize = gst_util_uint64_scale (buf_samples * spec->bytes_per_sample,
- spec->latency_time, GST_SECOND / GST_USECOND);
- spec->segsize -= spec->segsize % spec->bytes_per_sample;
- spec->segtotal = spec->buffer_time / spec->latency_time;
- */
- spec->segsize = buf_samples * spec->bytes_per_sample;
- spec->segtotal = 1;
-
- memset (spec->silence_sample, 0, spec->bytes_per_sample);
- GST_DEBUG_OBJECT (sink, "Bytes per sample %d", spec->bytes_per_sample);
-
- GST_DEBUG_OBJECT (sink, "Rate %d Format %d tracks %d bufs %d %d/%d w %d",
- spec->rate, format, spec->channels, (gint) buf_samples, spec->segsize,
- spec->segtotal, spec->width);
- AuMakeElementImportClient (&elements[0], /* element */
- spec->rate, /* rate */
- format, /* format */
- spec->channels, /* number of tracks */
- AuTrue, /* discart */
- buf_samples, /* max samples */
- (AuUint32) (buf_samples / 100 * AuSoundPortLowWaterMark),
- /* low water mark */
- 0, /* num actions */
- NULL);
-
- sink->device = NAS_getDevice (sink->audio, spec->channels);
- if (sink->device == AuNone) {
- GST_DEBUG_OBJECT (sink, "no device with %i tracks found", spec->channels);
- return FALSE;
- }
-
- AuMakeElementExportDevice (&elements[1], /* element */
- 0, /* input */
- sink->device, /* device */
- spec->rate, /* rate */
- AuUnlimitedSamples, /* num samples */
- 0, /* num actions */
- NULL); /* actions */
-
- AuSetElements (sink->audio, /* server */
- sink->flow, /* flow ID */
- AuTrue, /* clocked */
- 2, /* num elements */
- elements, /* elements */
- NULL);
-
- AuRegisterEventHandler (sink->audio, /* server */
- AuEventHandlerIDMask, /* value mask */
- 0, /* type */
- sink->flow, /* flow ID */
- NAS_EventHandler, /* callback */
- (AuPointer) sink); /* data */
-
- AuStartFlow (sink->audio, sink->flow, NULL);
-
- return TRUE;
-}
-
-static gboolean
-gst_nas_sink_unprepare (GstAudioSink * asink)
-{
- GstNasSink *sink = GST_NAS_SINK (asink);
-
- if (sink->flow != AuNone) {
- AuBool clocked;
- int num_elements;
- AuStatus status;
- AuElement *oldelems;
-
- GST_DEBUG_OBJECT (sink, "flushing buffer");
- NAS_flush (sink);
-
- oldelems =
- AuGetElements (sink->audio, sink->flow, &clocked, &num_elements,
- &status);
- if (num_elements > 0) {
- GST_DEBUG_OBJECT (sink, "GetElements status: %i", status);
- if (oldelems)
- AuFreeElements (sink->audio, num_elements, oldelems);
- }
-
- AuStopFlow (sink->audio, sink->flow, NULL);
- AuReleaseScratchFlow (sink->audio, sink->flow, NULL);
- sink->flow = AuNone;
- }
- sink->need_data = 0;
-
- return TRUE;
-}
-
-static guint
-gst_nas_sink_delay (GstAudioSink * asink)
-{
- GST_DEBUG_OBJECT (asink, "nas_sink_delay");
- return 0;
-}
-
-static void
-gst_nas_sink_reset (GstAudioSink * asink)
-{
- GstNasSink *sink = GST_NAS_SINK (asink);
-
- GST_DEBUG_OBJECT (sink, "reset");
-
- if (sink->flow != AuNone)
- AuStopFlow (sink->audio, sink->flow, NULL);
-}
-
-static guint
-gst_nas_sink_write (GstAudioSink * asink, gpointer data, guint length)
-{
- GstNasSink *nassink = GST_NAS_SINK (asink);
- int used = 0;
-
- NAS_flush (nassink);
- if (!nassink->mute && nassink->audio != NULL && nassink->flow != AuNone) {
-
- if (nassink->need_data == 0)
- return 0;
-
- used = nassink->need_data > length ? length : nassink->need_data;
- AuWriteElement (nassink->audio, nassink->flow, 0, used, data, AuFalse,
- NULL);
- nassink->need_data -= used;
- if (used == length)
- AuSync (nassink->audio, AuFalse);
- } else
- used = length;
- return used;
-}
-
-static void
-gst_nas_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstNasSink *nassink;
-
- nassink = GST_NAS_SINK (object);
-
- switch (prop_id) {
- case ARG_MUTE:
- nassink->mute = g_value_get_boolean (value);
- break;
- case ARG_HOST:
- g_free (nassink->host);
- nassink->host = g_value_dup_string (value);
- if (nassink->host == NULL)
- nassink->host = g_strdup (g_getenv ("AUDIOSERVER"));
- if (nassink->host == NULL)
- nassink->host = g_strdup (g_getenv ("DISPLAY"));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_nas_sink_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstNasSink *nassink;
-
- nassink = GST_NAS_SINK (object);
-
- switch (prop_id) {
- case ARG_MUTE:
- g_value_set_boolean (value, nassink->mute);
- break;
- case ARG_HOST:
- g_value_set_string (value, nassink->host);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static gboolean
-gst_nas_sink_open (GstAudioSink * asink)
-{
- GstNasSink *sink = GST_NAS_SINK (asink);
-
- GST_DEBUG_OBJECT (sink, "opening, host = '%s'", GST_STR_NULL (sink->host));
-
- /* Open Server */
- sink->audio = AuOpenServer (sink->host, 0, NULL, 0, NULL, NULL);
- if (sink->audio == NULL) {
- GST_DEBUG_OBJECT (sink, "opening failed");
- return FALSE;
- }
- sink->flow = AuNone;
- sink->need_data = 0;
-
- /* Start a flow */
- GST_DEBUG_OBJECT (asink, "opened audio device");
- return TRUE;
-}
-
-static gboolean
-gst_nas_sink_close (GstAudioSink * asink)
-{
- GstNasSink *sink = GST_NAS_SINK (asink);
-
- if (sink->audio) {
- AuCloseServer (sink->audio);
- sink->audio = NULL;
- }
-
- GST_DEBUG_OBJECT (sink, "closed audio device");
- return TRUE;
-}
-
-static void
-NAS_flush (GstNasSink * sink)
-{
- AuEvent ev;
-
- AuNextEvent (sink->audio, AuTrue, &ev);
- AuDispatchEvent (sink->audio, &ev);
-}
-
-static void
-NAS_sendData (GstNasSink * sink, AuUint32 numBytes)
-{
- sink->need_data += numBytes;
- return;
-}
-
-static AuBool
-NAS_EventHandler (AuServer * aud, AuEvent * ev, AuEventHandlerRec * handler)
-{
- GstNasSink *sink = (GstNasSink *) handler->data;
- AuElementNotifyEvent *notify;
-
- switch (ev->type) {
-
- case AuEventTypeElementNotify:
-
- notify = (AuElementNotifyEvent *) ev;
-
- switch (notify->kind) {
-
- case AuElementNotifyKindLowWater:
- NAS_sendData (sink, notify->num_bytes);
- break;
-
- case AuElementNotifyKindState:
-
- switch (notify->cur_state) {
-
- case AuStateStop:
-
- if (sink->flow != AuNone) {
- if (notify->reason == AuReasonEOF)
- AuStopFlow (handler->aud, sink->flow, NULL);
- AuReleaseScratchFlow (handler->aud, sink->flow, NULL);
- sink->flow = AuNone;
- }
- AuUnregisterEventHandler (handler->aud, handler);
- break;
-
- case AuStatePause:
-
- switch (notify->reason) {
- case AuReasonUnderrun:
- case AuReasonOverrun:
- case AuReasonEOF:
- case AuReasonWatermark:
-
- NAS_sendData (sink, notify->num_bytes);
-
- break;
-
- case AuReasonHardware:
-
- if (AuSoundRestartHardwarePauses)
- AuStartFlow (handler->aud, sink->flow, NULL);
- else
- AuStopFlow (handler->aud, sink->flow, NULL);
-
- break;
- }
- break;
- }
- break;
- }
- break;
- }
-
- return AuTrue;
-}
-
-static AuDeviceID
-NAS_getDevice (AuServer * aud, int numTracks)
-{
- int i;
-
- for (i = 0; i < AuServerNumDevices (aud); i++) {
- if ((AuDeviceKind (AuServerDevice (aud, i))
- == AuComponentKindPhysicalOutput) &&
- (AuDeviceNumTracks (AuServerDevice (aud, i)) == numTracks)) {
-
- return AuDeviceIdentifier (AuServerDevice (aud, i));
-
- }
- }
-
- return AuNone;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (nas_debug, "NAS", 0, NULL);
-
- if (!gst_element_register (plugin, "nassink", GST_RANK_NONE,
- GST_TYPE_NAS_SINK)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- nas,
- "NAS (Network Audio System) support for GStreamer",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
diff --git a/ext/nas/nassink.h b/ext/nas/nassink.h
deleted file mode 100644
index 14ab5fd93..000000000
--- a/ext/nas/nassink.h
+++ /dev/null
@@ -1,72 +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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifndef __GST_NAS_SINK_H__
-#define __GST_NAS_SINK_H__
-
-#include <gst/gst.h>
-#include <gst/audio/gstaudiosink.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_NAS_SINK \
- (gst_nas_sink_get_type())
-#define GST_NAS_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_NAS_SINK,GstNasSink))
-#define GST_NAS_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_NAS_SINK,GstNasSinkClass))
-#define GST_IS_NAS_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_NAS_SINK))
-#define GST_IS_NAS_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_NAS_SINK))
-
-typedef struct _GstNasSink GstNasSink;
-typedef struct _GstNasSinkClass GstNasSinkClass;
-
-struct _GstNasSink {
- GstAudioSink audiosink;
-
- /*< private >*/
-
- /* instance properties */
-
- gboolean mute;
- gchar* host;
-
- /* Server info */
-
- AuServer *audio;
- AuFlowID flow;
- AuDeviceID device;
-
- /* buffer */
-
- AuUint32 need_data;
-};
-
-struct _GstNasSinkClass {
- GstAudioSinkClass parent_class;
-};
-
-GType gst_nas_sink_get_type(void);
-
-G_END_DECLS
-
-#endif /* __GST_NAS_SINK_H__ */
diff --git a/ext/sdl/Makefile.am b/ext/sdl/Makefile.am
deleted file mode 100644
index d0c5b1a95..000000000
--- a/ext/sdl/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-plugin_LTLIBRARIES = libgstsdl.la
-
-libgstsdl_la_SOURCES = \
- gstsdl.c \
- sdlvideosink.c \
- sdlaudiosink.c
-
-libgstsdl_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(SDL_CFLAGS)
-libgstsdl_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \
- -lgstvideo-$(GST_API_VERSION) \
- -lgstaudio-$(GST_API_VERSION) \
- -lgstinterfaces-$(GST_API_VERSION) \
- $(SDL_LIBS)
-libgstsdl_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstsdl_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-noinst_HEADERS = \
- sdlvideosink.h \
- sdlaudiosink.h
diff --git a/ext/sdl/gstsdl.c b/ext/sdl/gstsdl.c
deleted file mode 100644
index 8813edb95..000000000
--- a/ext/sdl/gstsdl.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* GStreamer
- * Copyright (C) <2005> Edgard Lima <edgard.lima@indt.org.br>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "sdlvideosink.h"
-#include "sdlaudiosink.h"
-
-
-GST_DEBUG_CATEGORY (sdl_debug);
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-
- if (!gst_element_register (plugin, "sdlvideosink", GST_RANK_NONE,
- GST_TYPE_SDLVIDEOSINK) ||
- !gst_element_register (plugin, "sdlaudiosink", GST_RANK_NONE,
- GST_TYPE_SDLAUDIOSINK)) {
- return FALSE;
- }
-
- GST_DEBUG_CATEGORY_INIT (sdl_debug, "sdl", 0, "SDL elements");
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- sdl,
- "SDL (Simple DirectMedia Layer) support for GStreamer",
- plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/sdl/sdlaudiosink.c b/ext/sdl/sdlaudiosink.c
deleted file mode 100644
index ff03782d1..000000000
--- a/ext/sdl/sdlaudiosink.c
+++ /dev/null
@@ -1,439 +0,0 @@
-/* GStreamer
- * Copyright (C) <2005> Edgard Lima <edgard.lima@indt.org.br>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "sdlaudiosink.h"
-
-#include <SDL_byteorder.h>
-#include <string.h>
-
-#include <unistd.h>
-
-#include <gst/glib-compat-private.h>
-
-GST_DEBUG_CATEGORY_EXTERN (sdl_debug);
-#define GST_CAT_DEFAULT sdl_debug
-
-static void gst_sdlaudio_sink_dispose (GObject * object);
-
-static GstCaps *gst_sdlaudio_sink_getcaps (GstBaseSink * bsink);
-
-static gboolean gst_sdlaudio_sink_open (GstAudioSink * asink);
-static gboolean gst_sdlaudio_sink_close (GstAudioSink * asink);
-static gboolean gst_sdlaudio_sink_prepare (GstAudioSink * asink,
- GstRingBufferSpec * spec);
-static gboolean gst_sdlaudio_sink_unprepare (GstAudioSink * asink);
-static guint gst_sdlaudio_sink_write (GstAudioSink * asink, gpointer data,
- guint length);
-
-#if 0
-static guint gst_sdlaudio_sink_delay (GstAudioSink * asink);
-static void gst_sdlaudio_sink_reset (GstAudioSink * asink);
-#endif
-
-
-/* SdlaudioSink signals and args */
-enum
-{
- LAST_SIGNAL
-};
-
-#define SEMAPHORE_INIT(s,f) \
- do { \
- s.cond = g_cond_new(); \
- s.mutex = g_mutex_new(); \
- s.mutexflag = f; \
- } while(0)
-
-#define SEMAPHORE_CLOSE(s) \
- do { \
- if ( s.cond ) { \
- g_cond_free(s.cond); \
- s.cond = NULL; \
- } \
- if ( s.mutex ) { \
- g_mutex_free(s.mutex); \
- s.mutex = NULL; \
- } \
- } while(0)
-
-#define SEMAPHORE_UP(s) \
- do \
- { \
- g_mutex_lock(s.mutex); \
- s.mutexflag = TRUE; \
- g_mutex_unlock(s.mutex); \
- g_cond_signal(s.cond); \
- } while(0)
-
-#define SEMAPHORE_DOWN(s, e) \
- do \
- { \
- while (1) { \
- g_mutex_lock(s.mutex); \
- if (!s.mutexflag) { \
- if ( e ) { \
- g_mutex_unlock(s.mutex); \
- break; \
- } \
- g_cond_wait(s.cond,s.mutex); \
- } \
- else { \
- s.mutexflag = FALSE; \
- g_mutex_unlock(s.mutex); \
- break; \
- } \
- g_mutex_unlock(s.mutex); \
- } \
- } while(0)
-
-
-static GstStaticPadTemplate sdlaudiosink_sink_factory =
- GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) { " G_STRINGIFY (G_BYTE_ORDER) " }, "
- "signed = (boolean) { TRUE, FALSE }, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) [ 1, MAX ], "
- "channels = (int) [ 1, 2 ]; "
- "audio/x-raw-int, "
- "endianness = (int) { " G_STRINGIFY (G_BYTE_ORDER) " }, "
- "signed = (boolean) { TRUE, FALSE }, "
- "width = (int) 8, "
- "depth = (int) 8, "
- "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]")
- );
-
-GST_BOILERPLATE (GstSDLAudioSink, gst_sdlaudio_sink, GstAudioSink,
- GST_TYPE_AUDIO_SINK);
-
-static void
-gst_sdlaudio_sink_dispose (GObject * object)
-{
- GstSDLAudioSink *sdlaudiosink = GST_SDLAUDIOSINK (object);
-
- SEMAPHORE_CLOSE (sdlaudiosink->semB);
-
- SEMAPHORE_CLOSE (sdlaudiosink->semA);
-
- if (sdlaudiosink->buffer) {
- g_free (sdlaudiosink->buffer);
- }
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-
-}
-
-static void
-gst_sdlaudio_sink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_static_metadata (element_class, "SDL audio sink",
- "Sink/Audio",
- "Output to a sound card via SDLAUDIO",
- "Edgard Lima <edgard.lima@indt.org.br>");
-
- gst_element_class_add_static_pad_template (element_class,
- &sdlaudiosink_sink_factory);
-}
-
-static void
-gst_sdlaudio_sink_class_init (GstSDLAudioSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstBaseSinkClass *gstbasesink_class;
- GstAudioSinkClass *gstaudiosink_class;
-
- gobject_class = (GObjectClass *) klass;
- gstbasesink_class = (GstBaseSinkClass *) klass;
- gstaudiosink_class = (GstAudioSinkClass *) klass;
-
- gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_sdlaudio_sink_dispose);
-
- gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_sdlaudio_sink_getcaps);
-
- gstaudiosink_class->open = GST_DEBUG_FUNCPTR (gst_sdlaudio_sink_open);
- gstaudiosink_class->close = GST_DEBUG_FUNCPTR (gst_sdlaudio_sink_close);
- gstaudiosink_class->prepare = GST_DEBUG_FUNCPTR (gst_sdlaudio_sink_prepare);
- gstaudiosink_class->unprepare =
- GST_DEBUG_FUNCPTR (gst_sdlaudio_sink_unprepare);
- gstaudiosink_class->write = GST_DEBUG_FUNCPTR (gst_sdlaudio_sink_write);
-
-#if 0
- gstaudiosink_class->delay = GST_DEBUG_FUNCPTR (gst_sdlaudio_sink_delay);
- gstaudiosink_class->reset = GST_DEBUG_FUNCPTR (gst_sdlaudio_sink_reset);
-#endif
-
-}
-
-static void
-gst_sdlaudio_sink_init (GstSDLAudioSink * sdlaudiosink,
- GstSDLAudioSinkClass * g_class)
-{
- GST_DEBUG ("initializing sdlaudiosink");
-
- memset (&sdlaudiosink->fmt, 0, sizeof (SDL_AudioSpec));
-
- sdlaudiosink->buffer = NULL;
- sdlaudiosink->eos = FALSE;
-
- SEMAPHORE_INIT (sdlaudiosink->semA, TRUE);
-
- SEMAPHORE_INIT (sdlaudiosink->semB, FALSE);
-
-}
-
-static GstCaps *
-gst_sdlaudio_sink_getcaps (GstBaseSink * bsink)
-{
- return gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SINK_PAD
- (bsink)));
-}
-
-static gint
-gst_sdlaudio_sink_get_format (GstBufferFormat fmt)
-{
- gint result = GST_UNKNOWN;
-
- switch (fmt) {
- case GST_U8:
- result = AUDIO_U8;
- break;
- case GST_S8:
- result = AUDIO_S8;
- break;
- case GST_S16_LE:
- result = AUDIO_S16LSB;
- break;
- case GST_S16_BE:
- result = AUDIO_S16MSB;
- break;
- case GST_U16_LE:
- result = AUDIO_U16LSB;
- break;
- case GST_U16_BE:
- result = AUDIO_U16MSB;
- break;
- default:
- break;
- }
- return result;
-}
-
-static gboolean
-gst_sdlaudio_sink_open (GstAudioSink * asink)
-{
- GstSDLAudioSink *sdlaudio;
-
- sdlaudio = GST_SDLAUDIOSINK (asink);
-
- if (SDL_Init (SDL_INIT_AUDIO) < 0) {
- goto open_failed;
- }
-
- return TRUE;
-
-open_failed:
- {
- GST_ELEMENT_ERROR (sdlaudio, LIBRARY, INIT,
- ("Unable to init SDL: %s\n", SDL_GetError ()), (NULL));
- return FALSE;
- }
-}
-
-static gboolean
-gst_sdlaudio_sink_close (GstAudioSink * asink)
-{
- GstSDLAudioSink *sdlaudio = GST_SDLAUDIOSINK (asink);
-
- sdlaudio->eos = TRUE;
- SEMAPHORE_UP (sdlaudio->semA);
- SEMAPHORE_UP (sdlaudio->semB);
- SDL_QuitSubSystem (SDL_INIT_AUDIO);
- return TRUE;
-}
-
-static guint
-gst_sdlaudio_sink_write (GstAudioSink * asink, gpointer data, guint length)
-{
- GstSDLAudioSink *sdlaudio = GST_SDLAUDIOSINK (asink);
-
- if (sdlaudio->fmt.size != length) {
- GST_ERROR ("ring buffer segment length (%u) != sdl buffer len (%u)", length,
- sdlaudio->fmt.size);
- }
-
- SEMAPHORE_DOWN (sdlaudio->semA, sdlaudio->eos);
-
- if (!sdlaudio->eos)
- memcpy (sdlaudio->buffer, data, length);
-
- SEMAPHORE_UP (sdlaudio->semB);
-
- return sdlaudio->fmt.size;
-}
-
-
-static void
-mixaudio (void *unused, Uint8 * stream, int len)
-{
- GstSDLAudioSink *sdlaudio;
-
- sdlaudio = GST_SDLAUDIOSINK (unused);
-
- if (sdlaudio->fmt.size != len) {
- GST_ERROR ("fmt buffer len (%u) != sdl callback len (%d)",
- sdlaudio->fmt.size, len);
- }
-
- SEMAPHORE_DOWN (sdlaudio->semB, sdlaudio->eos);
-
- if (!sdlaudio->eos)
- SDL_MixAudio (stream, sdlaudio->buffer, sdlaudio->fmt.size,
- SDL_MIX_MAXVOLUME);
-
- SEMAPHORE_UP (sdlaudio->semA);
-
-}
-
-static gboolean
-gst_sdlaudio_sink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec)
-{
- GstSDLAudioSink *sdlaudio;
- gint power2 = -1;
-
- sdlaudio = GST_SDLAUDIOSINK (asink);
-
- sdlaudio->fmt.format = gst_sdlaudio_sink_get_format (spec->format);
- if (sdlaudio->fmt.format == 0)
- goto wrong_format;
-
- if (spec->width != 16 && spec->width != 8)
- goto dodgy_width;
-
- sdlaudio->fmt.freq = spec->rate;
- sdlaudio->fmt.channels = spec->channels;
- sdlaudio->fmt.samples =
- spec->segsize / (spec->channels * ((sdlaudio->fmt.format & 0xFF) >> 3));
- sdlaudio->fmt.callback = mixaudio;
- sdlaudio->fmt.userdata = sdlaudio;
-
- GST_DEBUG ("set segsize: %d, segtotal: %d, samples: %d", spec->segsize,
- spec->segtotal, sdlaudio->fmt.samples);
-
- while (sdlaudio->fmt.samples) {
- sdlaudio->fmt.samples >>= 1;
- ++power2;
- }
-
- sdlaudio->fmt.samples = 1;
- sdlaudio->fmt.samples <<= power2;
-
- GST_DEBUG ("set segsize: %d, segtotal: %d, samples: %d", spec->segsize,
- spec->segtotal, sdlaudio->fmt.samples);
-
- if (SDL_OpenAudio (&sdlaudio->fmt, NULL) < 0) {
- goto unable_open;
- }
-
- spec->segsize = sdlaudio->fmt.size;
-
- sdlaudio->buffer = g_malloc (sdlaudio->fmt.size);
- memset (sdlaudio->buffer, sdlaudio->fmt.silence, sdlaudio->fmt.size);
-
- GST_DEBUG ("set segsize: %d, segtotal: %d, samples: %d", spec->segsize,
- spec->segtotal, sdlaudio->fmt.samples);
-
- spec->bytes_per_sample =
- spec->channels * ((sdlaudio->fmt.format & 0xFF) >> 3);
- memset (spec->silence_sample, sdlaudio->fmt.silence, spec->bytes_per_sample);
-
- SDL_PauseAudio (0);
-
- return TRUE;
-
-unable_open:
- {
- GST_ELEMENT_ERROR (sdlaudio, RESOURCE, OPEN_READ,
- ("Unable to open audio: %s", SDL_GetError ()), (NULL));
- return FALSE;
- }
-wrong_format:
- {
- GST_ELEMENT_ERROR (sdlaudio, RESOURCE, OPEN_READ,
- ("Unable to get format %d", spec->format), (NULL));
- return FALSE;
- }
-dodgy_width:
- {
- GST_ELEMENT_ERROR (sdlaudio, RESOURCE, OPEN_READ,
- ("unexpected width %d", spec->width), (NULL));
- return FALSE;
- }
-}
-
-static gboolean
-gst_sdlaudio_sink_unprepare (GstAudioSink * asink)
-{
-
- SDL_CloseAudio ();
-
- return TRUE;
-
-#if 0
- if (!gst_sdlaudio_sink_close (asink))
- goto couldnt_close;
-
- if (!gst_sdlaudio_sink_open (asink))
- goto couldnt_reopen;
-
- return TRUE;
-
-couldnt_close:
- {
- GST_DEBUG ("Could not close the audio device");
- return FALSE;
- }
-couldnt_reopen:
- {
- GST_DEBUG ("Could not reopen the audio device");
- return FALSE;
- }
-#endif
-
-}
-
-#if 0
-static guint
-gst_sdlaudio_sink_delay (GstAudioSink * asink)
-{
- GstSDLAudioSink *sdlaudio;
-
- sdlaudio = GST_SDLAUDIOSINK (asink);
-
- return 0;
-}
-
-static void
-gst_sdlaudio_sink_reset (GstAudioSink * asink)
-{
-}
-#endif
diff --git a/ext/sdl/sdlaudiosink.h b/ext/sdl/sdlaudiosink.h
deleted file mode 100644
index 8532f3ffd..000000000
--- a/ext/sdl/sdlaudiosink.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* GStreamer
- * Copyright (C) <2005> Edgard Lima <edgard.lima@indt.org.br>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more
- */
-
-#ifndef __GST_SDLAUDIOSINK_H__
-#define __GST_SDLAUDIOSINK_H__
-
-
-#include <gst/gst.h>
-#include <gst/audio/gstaudiosink.h>
-
-#include <SDL.h>
-#include <SDL_audio.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_SDLAUDIOSINK (gst_sdlaudio_sink_get_type())
-#define GST_SDLAUDIOSINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SDLAUDIOSINK,GstSDLAudioSink))
-#define GST_SDLAUDIOSINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SDLAUDIOSINK,GstSDLAudioSinkClass))
-#define GST_IS_SDLAUDIOSINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SDLAUDIOSINK))
-#define GST_IS_SDLAUDIOSINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SDLAUDIOSINK))
-
-typedef struct _GstSDLAudioSink GstSDLAudioSink;
-typedef struct _GstSDLAudioSinkClass GstSDLAudioSinkClass;
-
-typedef struct _gstsdl_semaphore {
- GCond *cond;
- GMutex *mutex;
- gboolean mutexflag;
-
-} gstsdl_semaphore;
-
-struct _GstSDLAudioSink {
- GstAudioSink sink;
-
- SDL_AudioSpec fmt;
- guint8 *buffer;
-
- gstsdl_semaphore semA;
-
- gstsdl_semaphore semB;
-
- gboolean eos;
-
-};
-
-struct _GstSDLAudioSinkClass {
- GstAudioSinkClass parent_class;
-};
-
-GType gst_sdlaudio_sink_get_type(void);
-
-G_END_DECLS
-
-#endif /* __GST_SDLAUDIOSINK_H__ */
diff --git a/ext/sdl/sdlvideosink.c b/ext/sdl/sdlvideosink.c
deleted file mode 100644
index 7f05dcad8..000000000
--- a/ext/sdl/sdlvideosink.c
+++ /dev/null
@@ -1,1006 +0,0 @@
-/* GStreamer SDL 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/* let's not forget to mention that all this was based on aasink ;-) */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <signal.h>
-#include <string.h>
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#include <stdlib.h>
-
-#include <gst/glib-compat-private.h>
-#include <gst/interfaces/xoverlay.h>
-#include <gst/interfaces/navigation.h>
-
-#include "sdlvideosink.h"
-
-GST_DEBUG_CATEGORY_EXTERN (sdl_debug);
-#define GST_CAT_DEFAULT sdl_debug
-
-/* These macros are adapted from videotestsrc.c
- * and/or gst-plugins/gst/games/gstvideoimage.c */
-#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))
-
-
-enum
-{
- PROP_0,
- PROP_FULLSCREEN
-};
-
-static void gst_sdlvideosink_interface_init (GstImplementsInterfaceClass *
- klass);
-static gboolean gst_sdlvideosink_supported (GstImplementsInterface * iface,
- GType type);
-
-static void gst_sdlvideosink_xoverlay_init (GstXOverlayClass * klass);
-static void gst_sdlvideosink_xoverlay_set_window_handle
- (GstXOverlay * overlay, guintptr parent);
-
-static gboolean gst_sdlvideosink_lock (GstSDLVideoSink * sdl);
-static void gst_sdlvideosink_unlock (GstSDLVideoSink * sdl);
-
-static gboolean gst_sdlvideosink_initsdl (GstSDLVideoSink * sdl);
-static void gst_sdlvideosink_deinitsdl (GstSDLVideoSink * sdl);
-
-static gboolean gst_sdlvideosink_create (GstSDLVideoSink * sdl);
-static void gst_sdlvideosink_destroy (GstSDLVideoSink * sdl);
-
-static gboolean gst_sdlvideosink_setcaps (GstBaseSink * bsink, GstCaps * caps);
-
-static GstFlowReturn gst_sdlvideosink_show_frame (GstBaseSink * bsink,
- GstBuffer * buff);
-
-static void gst_sdlvideosink_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_sdlvideosink_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-static GstStateChangeReturn
-gst_sdlvideosink_change_state (GstElement * element, GstStateChange transition);
-
-static void gst_sdlvideosink_navigation_init (GstNavigationInterface * iface);
-
-static void gst_sdlv_process_events (GstSDLVideoSink * sdlvideosink);
-
-static GstPadTemplate *sink_template;
-
-static void
-_do_init (GType type)
-{
- static const GInterfaceInfo iface_info = {
- (GInterfaceInitFunc) gst_sdlvideosink_interface_init,
- NULL,
- NULL,
- };
- static const GInterfaceInfo xoverlay_info = {
- (GInterfaceInitFunc) gst_sdlvideosink_xoverlay_init,
- NULL,
- NULL,
- };
- static const GInterfaceInfo navigation_info = {
- (GInterfaceInitFunc) gst_sdlvideosink_navigation_init,
- NULL,
- NULL,
- };
-
- g_type_add_interface_static (type,
- GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info);
- g_type_add_interface_static (type, GST_TYPE_X_OVERLAY, &xoverlay_info);
- g_type_add_interface_static (type, GST_TYPE_NAVIGATION, &navigation_info);
-
-}
-
-GST_BOILERPLATE_FULL (GstSDLVideoSink, gst_sdlvideosink, GstVideoSink,
- GST_TYPE_VIDEO_SINK, _do_init);
-
-static void
-gst_sdlvideosink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- GstCaps *capslist;
- gint i;
- guint32 formats[] = {
- GST_MAKE_FOURCC ('I', '4', '2', '0'),
- GST_MAKE_FOURCC ('Y', 'V', '1', '2'),
- GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'),
- GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'),
- GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y')
- };
-
- /* make a list of all available caps */
- capslist = gst_caps_new_empty ();
- for (i = 0; i < G_N_ELEMENTS (formats); i++) {
- gst_caps_append_structure (capslist,
- gst_structure_new ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, formats[i],
- "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
- "height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
- "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 100, 1, NULL));
- }
-
- sink_template = gst_pad_template_new ("sink",
- GST_PAD_SINK, GST_PAD_ALWAYS, capslist);
-
- gst_element_class_add_pad_template (element_class, sink_template);
- gst_element_class_set_static_metadata (element_class, "SDL video sink",
- "Sink/Video", "An SDL-based videosink",
- "Ronald Bultje <rbultje@ronald.bitfreak.net>, "
- "Edgard Lima <edgard.lima@indt.org.br>, "
- "Jan Schmidt <thaytan@mad.scientist.com>");
-}
-
-static void
-gst_sdlvideosink_finalize (GObject * obj)
-{
- g_mutex_free (GST_SDLVIDEOSINK (obj)->lock);
-
- G_OBJECT_CLASS (parent_class)->finalize (obj);
-}
-
-static void
-gst_sdlvideosink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
- GstClockTime * start, GstClockTime * end)
-{
- GstSDLVideoSink *sdlvideosink = GST_SDLVIDEOSINK (basesink);
- GstClockTime timestamp, duration;
-
- timestamp = GST_BUFFER_TIMESTAMP (buffer);
- if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
- *start = timestamp;
- duration = GST_BUFFER_DURATION (buffer);
- if (GST_CLOCK_TIME_IS_VALID (duration)) {
- *end = timestamp + duration;
- } else {
- if (sdlvideosink->framerate_n > 0) {
- *end = timestamp +
- gst_util_uint64_scale_int (GST_SECOND, sdlvideosink->framerate_d,
- sdlvideosink->framerate_n);
- }
- }
- }
-}
-
-static void
-gst_sdlvideosink_class_init (GstSDLVideoSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
- GstBaseSinkClass *gstvs_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
- gstvs_class = (GstBaseSinkClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->set_property = gst_sdlvideosink_set_property;
- gobject_class->get_property = gst_sdlvideosink_get_property;
-
- gobject_class->finalize = gst_sdlvideosink_finalize;
-
- gstelement_class->change_state =
- GST_DEBUG_FUNCPTR (gst_sdlvideosink_change_state);
-
- gstvs_class->set_caps = GST_DEBUG_FUNCPTR (gst_sdlvideosink_setcaps);
- gstvs_class->get_times = GST_DEBUG_FUNCPTR (gst_sdlvideosink_get_times);
- gstvs_class->preroll = GST_DEBUG_FUNCPTR (gst_sdlvideosink_show_frame);
- gstvs_class->render = GST_DEBUG_FUNCPTR (gst_sdlvideosink_show_frame);
-
- g_object_class_install_property (gobject_class, PROP_FULLSCREEN,
- g_param_spec_boolean ("fullscreen", "Fullscreen",
- "If true it will be Full screen", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /*gstvs_class->set_video_out = gst_sdlvideosink_set_video_out;
- gstvs_class->push_ui_event = gst_sdlvideosink_push_ui_event;
- gstvs_class->set_geometry = gst_sdlvideosink_set_geometry; */
-}
-
-#if 0
-/* FIXME */
-static GstBuffer *
-gst_sdlvideosink_buffer_new (GstBufferPool * pool,
- gint64 location, guint size, gpointer user_data)
-{
- GstSDLVideoSink *sdlvideosink = GST_SDLVIDEOSINK (user_data);
- GstBuffer *buffer;
-
- if (!sdlvideosink->overlay)
- return NULL;
-
- if (!gst_sdlvideosink_lock (sdlvideosink)) {
- return NULL;
- }
-
- /* this protects the buffer from being written over multiple times */
- g_mutex_lock (sdlvideosink->lock);
-
- buffer = gst_buffer_new ();
- GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_DONTFREE);
- GST_BUFFER_DATA (buffer) = sdlvideosink->overlay->pixels[0];
- if (sdlvideosink->format == SDL_YV12_OVERLAY ||
- sdlvideosink->format == SDL_IYUV_OVERLAY) {
- GST_BUFFER_SIZE (buffer) =
- sdlvideosink->width * sdlvideosink->height * 3 / 2;
- } else {
- GST_BUFFER_SIZE (buffer) = sdlvideosink->width * sdlvideosink->height * 2;
- }
- GST_BUFFER_MAXSIZE (buffer) = GST_BUFFER_SIZE (buffer);
-
- return buffer;
-}
-
-static void
-gst_sdlvideosink_buffer_free (GstBufferPool * pool,
- GstBuffer * buffer, gpointer user_data)
-{
- GstSDLVideoSink *sdlvideosink = GST_SDLVIDEOSINK (user_data);
-
- g_mutex_unlock (sdlvideosink->lock);
- gst_sdlvideosink_unlock (sdlvideosink);
-
- gst_buffer_default_free (buffer);
-}
-
-
-static GstBufferPool *
-gst_sdlvideosink_get_bufferpool (GstPad * pad)
-{
- GstSDLVideoSink *sdlvideosink = GST_SDLVIDEOSINK (gst_pad_get_parent (pad));
-
- if (sdlvideosink->overlay)
- return sdlvideosink->bufferpool;
-
- return NULL;
-}
-#endif
-
-static void
-gst_sdlvideosink_init (GstSDLVideoSink * sdlvideosink,
- GstSDLVideoSinkClass * g_class)
-{
-
- sdlvideosink->width = -1;
- sdlvideosink->height = -1;
- sdlvideosink->framerate_n = 0;
- sdlvideosink->framerate_d = 1;
- sdlvideosink->full_screen = FALSE;
-
- sdlvideosink->overlay = NULL;
- sdlvideosink->screen = NULL;
-
- sdlvideosink->xwindow_id = 0;
-
- //sdlvideosink->capslist = capslist;
-
- sdlvideosink->init = FALSE;
-
- sdlvideosink->event_thread = NULL;
- sdlvideosink->running = FALSE;
-
- sdlvideosink->lock = g_mutex_new ();
-}
-
-static void
-gst_sdlvideosink_interface_init (GstImplementsInterfaceClass * klass)
-{
- klass->supported = gst_sdlvideosink_supported;
-}
-
-static gboolean
-gst_sdlvideosink_supported (GstImplementsInterface * interface,
- GType iface_type)
-{
- GstSDLVideoSink *sdlvideosink = GST_SDLVIDEOSINK (interface);
- gboolean result = FALSE;
-
- /* check SDL for whether it was compiled against X, FB, etc. */
- if (iface_type == GST_TYPE_X_OVERLAY) {
- gchar tmp[4];
-
- if (!sdlvideosink->init) {
- g_mutex_lock (sdlvideosink->lock);
- SDL_Init (SDL_INIT_VIDEO);
-
- /* True if the video driver is X11 */
- result = (strcmp ("x11", SDL_VideoDriverName (tmp, 4)) == 0);
- SDL_QuitSubSystem (SDL_INIT_VIDEO);
- g_mutex_unlock (sdlvideosink->lock);
- } else
- result = sdlvideosink->is_xwindows;
- } else if (iface_type == GST_TYPE_NAVIGATION)
- result = TRUE;
-
- return result;
-}
-
-/* SDL Video sink and X overlay:
- *
- * SDL supports creating an Xv window/overlay within an existing X window
- * through the horrible mechanism of setting the WINDOWID environment
- * variable.
- * It will then display the x overlay within that window, but not at the
- * full window size. Instead, we need to explicitly tell SDL the size.
- *
- * Unfortunately, the XOverlay interface in GStreamer doesn't supply
- * that information. The only way to get it would be to do what X[v]imagesink
- * does and retrieve it using X11 calls, and linking to Xlib. That would
- * defeat the whole purpose of using the SDL abstraction and plugin entirely
- * however.
- *
- * I have no nice solution to this problem for you, dear readers.
- */
-static void
-gst_sdlvideosink_xoverlay_init (GstXOverlayClass * klass)
-{
- klass->set_window_handle = gst_sdlvideosink_xoverlay_set_window_handle;
-}
-
-static void
-gst_sdlvideosink_xoverlay_set_window_handle (GstXOverlay * overlay,
- guintptr handle)
-{
- GstSDLVideoSink *sdlvideosink = GST_SDLVIDEOSINK (overlay);
- unsigned long parent = (unsigned long) handle;
-
- if (sdlvideosink->xwindow_id == parent)
- return;
-
- sdlvideosink->xwindow_id = parent;
-
- /* are we running yet? */
- if (sdlvideosink->init) {
- gboolean negotiated;
-
- g_mutex_lock (sdlvideosink->lock);
-
- negotiated = (sdlvideosink->overlay != NULL);
-
- if (negotiated)
- gst_sdlvideosink_destroy (sdlvideosink);
-
- /* Call initsdl to set the WINDOWID env var urk */
- gst_sdlvideosink_initsdl (sdlvideosink);
-
- if (negotiated)
- gst_sdlvideosink_create (sdlvideosink);
-
- g_mutex_unlock (sdlvideosink->lock);
- }
-}
-
-static guint32
-gst_sdlvideosink_get_sdl_from_fourcc (GstSDLVideoSink * sdlvideosink,
- guint32 code)
-{
- switch (code) {
- /* Note: SDL_IYUV_OVERLAY does not always work for I420 */
- case GST_MAKE_FOURCC ('I', '4', '2', '0'):
- return SDL_YV12_OVERLAY;
- case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
- return SDL_YV12_OVERLAY;
- case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
- return SDL_YUY2_OVERLAY;
- case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
- return SDL_UYVY_OVERLAY;
- case GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'):
- return SDL_YVYU_OVERLAY;
- default:
- return 0;
- }
-}
-
-static gboolean
-gst_sdlvideosink_lock (GstSDLVideoSink * sdlvideosink)
-{
- /* assure that we've got a screen */
- if (!sdlvideosink->screen || !sdlvideosink->overlay)
- goto no_setup;
-
- /* Lock SDL/yuv-overlay */
- if (SDL_MUSTLOCK (sdlvideosink->screen)) {
- if (SDL_LockSurface (sdlvideosink->screen) < 0)
- goto could_not_lock;
- }
- if (SDL_LockYUVOverlay (sdlvideosink->overlay) < 0)
- goto lock_yuv;
-
- return TRUE;
-
- /* ERRORS */
-no_setup:
- {
- GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL),
- ("Tried to lock screen without being set-up"));
- return FALSE;
- }
-could_not_lock:
- {
- GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL),
- ("SDL: couldn't lock the SDL video window: %s", SDL_GetError ()));
- return FALSE;
- }
-lock_yuv:
- {
- GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL),
- ("SDL: couldn\'t lock the SDL YUV overlay: %s", SDL_GetError ()));
- return FALSE;
- }
-}
-
-
-static void
-gst_sdlvideosink_unlock (GstSDLVideoSink * sdlvideosink)
-{
- /* Unlock SDL_overlay */
- SDL_UnlockYUVOverlay (sdlvideosink->overlay);
- if (SDL_MUSTLOCK (sdlvideosink->screen))
- SDL_UnlockSurface (sdlvideosink->screen);
-}
-
-/* Must be called with ->lock held */
-static void
-gst_sdlvideosink_deinitsdl (GstSDLVideoSink * sdlvideosink)
-{
- if (sdlvideosink->init) {
- sdlvideosink->running = FALSE;
- if (sdlvideosink->event_thread) {
- g_mutex_unlock (sdlvideosink->lock);
- g_thread_join (sdlvideosink->event_thread);
- g_mutex_lock (sdlvideosink->lock);
- sdlvideosink->event_thread = NULL;
- }
-
- SDL_QuitSubSystem (SDL_INIT_VIDEO);
- sdlvideosink->init = FALSE;
-
- }
-}
-
-/* Process pending events. Call with ->lock held */
-static void
-gst_sdlv_process_events (GstSDLVideoSink * sdlvideosink)
-{
- SDL_Event event;
- int numevents;
- char *keysym = NULL;
-
- do {
- SDL_PumpEvents ();
- numevents = SDL_PeepEvents (&event, 1, SDL_GETEVENT,
- SDL_KEYDOWNMASK | SDL_KEYUPMASK |
- SDL_MOUSEMOTIONMASK | SDL_MOUSEBUTTONDOWNMASK |
- SDL_MOUSEBUTTONUPMASK | SDL_QUITMASK | SDL_VIDEORESIZEMASK);
-
- if (numevents > 0 && (event.type == SDL_KEYUP || event.type == SDL_KEYDOWN)) {
- keysym = SDL_GetKeyName (event.key.keysym.sym);
- }
-
- if (numevents > 0) {
- g_mutex_unlock (sdlvideosink->lock);
- switch (event.type) {
- case SDL_MOUSEMOTION:
- gst_navigation_send_mouse_event (GST_NAVIGATION (sdlvideosink),
- "mouse-move", 0, event.motion.x, event.motion.y);
- break;
- case SDL_MOUSEBUTTONDOWN:
- gst_navigation_send_mouse_event (GST_NAVIGATION (sdlvideosink),
- "mouse-button-press",
- event.button.button, event.button.x, event.button.y);
- break;
- case SDL_MOUSEBUTTONUP:
- gst_navigation_send_mouse_event (GST_NAVIGATION (sdlvideosink),
- "mouse-button-release",
- event.button.button, event.button.x, event.button.y);
- break;
- case SDL_KEYUP:
- GST_DEBUG ("key press event %s !",
- SDL_GetKeyName (event.key.keysym.sym));
- gst_navigation_send_key_event (GST_NAVIGATION (sdlvideosink),
- "key-release", keysym);
- break;
- case SDL_KEYDOWN:
- if (SDLK_ESCAPE != event.key.keysym.sym) {
- GST_DEBUG ("key press event %s !",
- SDL_GetKeyName (event.key.keysym.sym));
- gst_navigation_send_key_event (GST_NAVIGATION (sdlvideosink),
- "key-press", keysym);
- break;
- } else {
- /* fall through */
- }
- case SDL_QUIT:
- sdlvideosink->running = FALSE;
- GST_ELEMENT_ERROR (sdlvideosink, RESOURCE, OPEN_WRITE,
- ("Video output device is gone."),
- ("We were running fullscreen and user "
- "pressed the ESC key, stopping playback."));
- break;
- case SDL_VIDEORESIZE:
- /* create a SDL window of the size requested by the user */
- g_mutex_lock (sdlvideosink->lock);
- GST_VIDEO_SINK_WIDTH (sdlvideosink) = event.resize.w;
- GST_VIDEO_SINK_HEIGHT (sdlvideosink) = event.resize.h;
- gst_sdlvideosink_create (sdlvideosink);
- g_mutex_unlock (sdlvideosink->lock);
- break;
- }
- g_mutex_lock (sdlvideosink->lock);
- }
- } while (numevents > 0);
-}
-
-static gpointer
-gst_sdlvideosink_event_thread (GstSDLVideoSink * sdlvideosink)
-{
- g_mutex_lock (sdlvideosink->lock);
- while (sdlvideosink->running) {
- gst_sdlv_process_events (sdlvideosink);
-
- /* Done events, sleep for 50 ms */
- g_mutex_unlock (sdlvideosink->lock);
- g_usleep (50000);
- g_mutex_lock (sdlvideosink->lock);
- }
- g_mutex_unlock (sdlvideosink->lock);
-
- return NULL;
-}
-
-/* Must be called with the SDL lock held */
-static gboolean
-gst_sdlvideosink_initsdl (GstSDLVideoSink * sdlvideosink)
-{
- gst_sdlvideosink_deinitsdl (sdlvideosink);
-
- if (sdlvideosink->is_xwindows && !sdlvideosink->xwindow_id) {
- g_mutex_unlock (sdlvideosink->lock);
- gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (sdlvideosink));
- g_mutex_lock (sdlvideosink->lock);
- }
-
- if (!sdlvideosink->xwindow_id) {
- g_unsetenv ("SDL_WINDOWID");
- } else {
- char SDL_hack[32];
-
- sprintf (SDL_hack, "%lu", sdlvideosink->xwindow_id);
- g_setenv ("SDL_WINDOWID", SDL_hack, 1);
- }
-
- /* Initialize the SDL library */
- if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0)
- goto init_failed;
-
- sdlvideosink->init = TRUE;
-
- sdlvideosink->running = TRUE;
- sdlvideosink->event_thread =
- g_thread_create ((GThreadFunc) gst_sdlvideosink_event_thread,
- sdlvideosink, TRUE, NULL);
-
- return TRUE;
-
- /* ERRORS */
-init_failed:
- {
- GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, INIT, (NULL),
- ("Couldn't initialize SDL: %s", SDL_GetError ()));
- return FALSE;
- }
-}
-
-/* Must be called with the sdl lock held */
-static void
-gst_sdlvideosink_destroy (GstSDLVideoSink * sdlvideosink)
-{
- if (sdlvideosink->overlay) {
- SDL_FreeYUVOverlay (sdlvideosink->overlay);
- sdlvideosink->overlay = NULL;
- }
-
- if (sdlvideosink->screen) {
- SDL_FreeSurface (sdlvideosink->screen);
- sdlvideosink->screen = NULL;
- }
- sdlvideosink->xwindow_id = 0;
-}
-
-/* Must be called with the sdl lock held */
-static gboolean
-gst_sdlvideosink_create (GstSDLVideoSink * sdlvideosink)
-{
- if (GST_VIDEO_SINK_HEIGHT (sdlvideosink) <= 0)
- GST_VIDEO_SINK_HEIGHT (sdlvideosink) = sdlvideosink->height;
- if (GST_VIDEO_SINK_WIDTH (sdlvideosink) <= 0)
- GST_VIDEO_SINK_WIDTH (sdlvideosink) = sdlvideosink->width;
-
- gst_sdlvideosink_destroy (sdlvideosink);
-
- if (sdlvideosink->is_xwindows && !sdlvideosink->xwindow_id) {
- g_mutex_unlock (sdlvideosink->lock);
- gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (sdlvideosink));
- g_mutex_lock (sdlvideosink->lock);
- }
-
- /* create a SDL window of the size requested by the user */
- if (sdlvideosink->full_screen) {
- sdlvideosink->screen =
- SDL_SetVideoMode (GST_VIDEO_SINK_WIDTH (sdlvideosink),
- GST_VIDEO_SINK_HEIGHT (sdlvideosink), 0,
- SDL_SWSURFACE | SDL_FULLSCREEN);
- } else {
- sdlvideosink->screen =
- SDL_SetVideoMode (GST_VIDEO_SINK_WIDTH (sdlvideosink),
- GST_VIDEO_SINK_HEIGHT (sdlvideosink), 0, SDL_HWSURFACE | SDL_RESIZABLE);
- }
- if (sdlvideosink->screen == NULL)
- goto no_screen;
-
- /* create a new YUV overlay */
- sdlvideosink->overlay = SDL_CreateYUVOverlay (sdlvideosink->width,
- sdlvideosink->height, sdlvideosink->format, sdlvideosink->screen);
- if (sdlvideosink->overlay == NULL)
- goto no_overlay;
-
-
- GST_DEBUG ("Using a %dx%d %dbpp SDL screen with a %dx%d \'%"
- GST_FOURCC_FORMAT "\' YUV overlay", GST_VIDEO_SINK_WIDTH (sdlvideosink),
- GST_VIDEO_SINK_HEIGHT (sdlvideosink),
- sdlvideosink->screen->format->BitsPerPixel, sdlvideosink->width,
- sdlvideosink->height, GST_FOURCC_ARGS (sdlvideosink->format));
-
- sdlvideosink->rect.x = 0;
- sdlvideosink->rect.y = 0;
- sdlvideosink->rect.w = GST_VIDEO_SINK_WIDTH (sdlvideosink);
- sdlvideosink->rect.h = GST_VIDEO_SINK_HEIGHT (sdlvideosink);
-
- /*SDL_DisplayYUVOverlay (sdlvideosink->overlay, &(sdlvideosink->rect)); */
-
- GST_DEBUG ("sdlvideosink: setting %08x (%" GST_FOURCC_FORMAT ")",
- sdlvideosink->format, GST_FOURCC_ARGS (sdlvideosink->format));
-
- return TRUE;
-
- /* ERRORS */
-no_screen:
- {
- GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL),
- ("SDL: Couldn't set %dx%d: %s", GST_VIDEO_SINK_WIDTH (sdlvideosink),
- GST_VIDEO_SINK_HEIGHT (sdlvideosink), SDL_GetError ()));
- return FALSE;
- }
-no_overlay:
- {
- GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL),
- ("SDL: Couldn't create SDL YUV overlay (%dx%d \'%" GST_FOURCC_FORMAT
- "\'): %s", sdlvideosink->width, sdlvideosink->height,
- GST_FOURCC_ARGS (sdlvideosink->format), SDL_GetError ()));
- return FALSE;
- }
-}
-
-static gboolean
-gst_sdlvideosink_setcaps (GstBaseSink * bsink, GstCaps * vscapslist)
-{
- GstSDLVideoSink *sdlvideosink;
- GstStructure *structure;
- gboolean res = TRUE;
-
- sdlvideosink = GST_SDLVIDEOSINK (bsink);
-
- structure = gst_caps_get_structure (vscapslist, 0);
- gst_structure_get_fourcc (structure, "format", &sdlvideosink->fourcc);
- sdlvideosink->format =
- gst_sdlvideosink_get_sdl_from_fourcc (sdlvideosink, sdlvideosink->fourcc);
- gst_structure_get_int (structure, "width", &sdlvideosink->width);
- gst_structure_get_int (structure, "height", &sdlvideosink->height);
- gst_structure_get_fraction (structure, "framerate",
- &sdlvideosink->framerate_n, &sdlvideosink->framerate_d);
-
- g_mutex_lock (sdlvideosink->lock);
- if (!sdlvideosink->format || !gst_sdlvideosink_create (sdlvideosink))
- res = FALSE;
- g_mutex_unlock (sdlvideosink->lock);
-
- return res;
-}
-
-
-static GstFlowReturn
-gst_sdlvideosink_show_frame (GstBaseSink * bsink, GstBuffer * buf)
-{
-
- GstSDLVideoSink *sdlvideosink;
-
- sdlvideosink = GST_SDLVIDEOSINK (bsink);
-
- g_mutex_lock (sdlvideosink->lock);
- if (!sdlvideosink->init ||
- !sdlvideosink->overlay || !sdlvideosink->overlay->pixels)
- goto not_init;
-
- /* if (GST_BUFFER_DATA (buf) != sdlvideosink->overlay->pixels[0]) */
- if (TRUE) {
- guint8 *out;
- gint l;
-
- if (!gst_sdlvideosink_lock (sdlvideosink))
- goto cannot_lock;
-
- /* buf->yuv - FIXME: bufferpool! */
- if (sdlvideosink->format == SDL_YV12_OVERLAY) {
- guint8 *y, *u, *v;
-
- switch (sdlvideosink->fourcc) {
- case GST_MAKE_FOURCC ('I', '4', '2', '0'):
- y = GST_BUFFER_DATA (buf);
- /* I420 is YV12 with switched colour planes and different offsets */
- v = y + I420_U_OFFSET (sdlvideosink->width, sdlvideosink->height);
- u = y + I420_V_OFFSET (sdlvideosink->width, sdlvideosink->height);
- break;
- case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
- y = GST_BUFFER_DATA (buf);
- u = y + I420_U_OFFSET (sdlvideosink->width, sdlvideosink->height);
- v = y + I420_V_OFFSET (sdlvideosink->width, sdlvideosink->height);
- break;
- default:
- gst_sdlvideosink_unlock (sdlvideosink);
- g_mutex_unlock (sdlvideosink->lock);
- g_return_val_if_reached (GST_FLOW_ERROR);
- }
-
- /* Y Plane */
- out = sdlvideosink->overlay->pixels[0];
- for (l = 0; l < sdlvideosink->height; l++) {
- memcpy (out, y, I420_Y_ROWSTRIDE (sdlvideosink->width));
- out += sdlvideosink->overlay->pitches[0];
- y += I420_Y_ROWSTRIDE (sdlvideosink->width);
- }
-
- /* U plane */
- out = sdlvideosink->overlay->pixels[1];
- for (l = 0; l < (sdlvideosink->height / 2); l++) {
- memcpy (out, u, I420_U_ROWSTRIDE (sdlvideosink->width));
- out += sdlvideosink->overlay->pitches[1];
- u += I420_U_ROWSTRIDE (sdlvideosink->width);
- }
-
- /* V plane */
- out = sdlvideosink->overlay->pixels[2];
- for (l = 0; l < (sdlvideosink->height / 2); l++) {
- memcpy (out, v, I420_V_ROWSTRIDE (sdlvideosink->width));
- out += sdlvideosink->overlay->pitches[2];
- v += I420_V_ROWSTRIDE (sdlvideosink->width);
- }
- } else {
- guint8 *in = GST_BUFFER_DATA (buf);
- gint in_stride = sdlvideosink->width * 2;
-
- out = sdlvideosink->overlay->pixels[0];
-
- for (l = 0; l < sdlvideosink->height; l++) {
- memcpy (out, in, in_stride);
- out += sdlvideosink->overlay->pitches[0];
- in += in_stride;
- }
- }
- gst_sdlvideosink_unlock (sdlvideosink);
- }
-
- /* Show, baby, show! */
- SDL_DisplayYUVOverlay (sdlvideosink->overlay, &(sdlvideosink->rect));
-
- /* Handle any resize */
- gst_sdlv_process_events (sdlvideosink);
-
- g_mutex_unlock (sdlvideosink->lock);
-
- return GST_FLOW_OK;
-
- /* ERRORS */
-not_init:
- {
- GST_ELEMENT_ERROR (sdlvideosink, CORE, NEGOTIATION, (NULL),
- ("not negotiated."));
- g_mutex_unlock (sdlvideosink->lock);
- return GST_FLOW_NOT_NEGOTIATED;
- }
-cannot_lock:
- {
- /* lock function posted detailed message */
- g_mutex_unlock (sdlvideosink->lock);
- return GST_FLOW_ERROR;
- }
-}
-
-
-static void
-gst_sdlvideosink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstSDLVideoSink *sdlvideosink;
-
- sdlvideosink = GST_SDLVIDEOSINK (object);
-
- switch (prop_id) {
- case PROP_FULLSCREEN:
- sdlvideosink->full_screen = g_value_get_boolean (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-static void
-gst_sdlvideosink_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstSDLVideoSink *sdlvideosink;
-
- sdlvideosink = GST_SDLVIDEOSINK (object);
-
- switch (prop_id) {
- case PROP_FULLSCREEN:
- g_value_set_boolean (value, sdlvideosink->full_screen);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-static GstStateChangeReturn
-gst_sdlvideosink_change_state (GstElement * element, GstStateChange transition)
-{
- GstSDLVideoSink *sdlvideosink;
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
-
- g_return_val_if_fail (GST_IS_SDLVIDEOSINK (element),
- GST_STATE_CHANGE_FAILURE);
- sdlvideosink = GST_SDLVIDEOSINK (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- sdlvideosink->is_xwindows = GST_IS_X_OVERLAY (sdlvideosink);
- g_mutex_lock (sdlvideosink->lock);
- if (!gst_sdlvideosink_initsdl (sdlvideosink)) {
- g_mutex_unlock (sdlvideosink->lock);
- goto init_failed;
- }
- GST_OBJECT_FLAG_SET (sdlvideosink, GST_SDLVIDEOSINK_OPEN);
- g_mutex_unlock (sdlvideosink->lock);
- break;
- default: /* do nothing */
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- sdlvideosink->framerate_n = 0;
- sdlvideosink->framerate_d = 1;
- g_mutex_lock (sdlvideosink->lock);
- gst_sdlvideosink_destroy (sdlvideosink);
- g_mutex_unlock (sdlvideosink->lock);
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- g_mutex_lock (sdlvideosink->lock);
- gst_sdlvideosink_deinitsdl (sdlvideosink);
- GST_OBJECT_FLAG_UNSET (sdlvideosink, GST_SDLVIDEOSINK_OPEN);
- g_mutex_unlock (sdlvideosink->lock);
- break;
- default: /* do nothing */
- break;
- }
- return ret;
-
-init_failed:
- {
- /* method posted detailed error message */
- GST_DEBUG_OBJECT (sdlvideosink, "init failed");
- return GST_STATE_CHANGE_FAILURE;
- }
-}
-
-
-static void
-gst_sdlvideosink_navigation_send_event (GstNavigation * navigation,
- GstStructure * structure)
-{
- GstSDLVideoSink *sdlvideosink = GST_SDLVIDEOSINK (navigation);
- GstEvent *event;
- GstVideoRectangle dst = { 0, };
- GstVideoRectangle src = { 0, };
- GstVideoRectangle result;
- double x, y, old_x, old_y;
- GstPad *pad = NULL;
-
- src.w = GST_VIDEO_SINK_WIDTH (sdlvideosink);
- src.h = GST_VIDEO_SINK_HEIGHT (sdlvideosink);
- dst.w = sdlvideosink->width;
- dst.h = sdlvideosink->height;
- gst_video_sink_center_rect (src, dst, &result, FALSE);
-
- event = gst_event_new_navigation (structure);
-
- /* Our coordinates can be wrong here if we centered the video */
-
- /* Converting pointer coordinates to the non scaled geometry */
- if (gst_structure_get_double (structure, "pointer_x", &old_x)) {
- x = old_x;
-
- if (x >= result.x && x <= (result.x + result.w)) {
- x -= result.x;
- x *= sdlvideosink->width;
- x /= result.w;
- } else {
- x = 0;
- }
- GST_DEBUG_OBJECT (sdlvideosink, "translated navigation event x "
- "coordinate from %f to %f", old_x, x);
- gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE, x, NULL);
- }
- if (gst_structure_get_double (structure, "pointer_y", &old_y)) {
- y = old_y;
-
- if (y >= result.y && y <= (result.y + result.h)) {
- y -= result.y;
- y *= sdlvideosink->height;
- y /= result.h;
- } else {
- y = 0;
- }
- GST_DEBUG_OBJECT (sdlvideosink, "translated navigation event y "
- "coordinate from %f to %f", old_y, y);
- gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE, y, NULL);
- }
-
- pad = gst_pad_get_peer (GST_VIDEO_SINK_PAD (sdlvideosink));
-
- if (GST_IS_PAD (pad) && GST_IS_EVENT (event)) {
- gst_pad_send_event (pad, event);
-
- gst_object_unref (pad);
- }
-}
-
-static void
-gst_sdlvideosink_navigation_init (GstNavigationInterface * iface)
-{
- iface->send_event = gst_sdlvideosink_navigation_send_event;
-}
diff --git a/ext/sdl/sdlvideosink.h b/ext/sdl/sdlvideosink.h
deleted file mode 100644
index eff752f38..000000000
--- a/ext/sdl/sdlvideosink.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* GStreamer SDL 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_SDLVIDEOSINK_H__
-#define __GST_SDLVIDEOSINK_H__
-
-#include <gst/video/gstvideosink.h>
-
-#include <SDL.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_SDLVIDEOSINK \
- (gst_sdlvideosink_get_type())
-#define GST_SDLVIDEOSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SDLVIDEOSINK,GstSDLVideoSink))
-#define GST_SDLVIDEOSINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SDLVIDEOSINK,GstSDLVideoSinkClass))
-#define GST_IS_SDLVIDEOSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SDLVIDEOSINK))
-#define GST_IS_SDLVIDEOSINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SDLVIDEOSINK))
-
-typedef enum {
- GST_SDLVIDEOSINK_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
-
- GST_SDLVIDEOSINK_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2),
-} GstSDLVideoSinkFlags;
-
-typedef struct _GstSDLVideoSink GstSDLVideoSink;
-typedef struct _GstSDLVideoSinkClass GstSDLVideoSinkClass;
-
-struct _GstSDLVideoSink {
- GstVideoSink videosink;
-
- guint32 format; /* the SDL format */
- guint32 fourcc; /* our fourcc from the caps */
-
- gint width, height; /* the size of the incoming YUV stream */
- unsigned long xwindow_id;
- gboolean is_xwindows;
-
- gint framerate_n;
- gint framerate_d;
-
- gboolean full_screen;
- gboolean init;
- gboolean running;
- GThread *event_thread;
- SDL_Surface *screen;
- SDL_Overlay *overlay;
- SDL_Rect rect;
-
- GMutex *lock;
-};
-
-struct _GstSDLVideoSinkClass {
- GstVideoSinkClass parent_class;
-
-};
-
-GType gst_sdlvideosink_get_type(void);
-
-G_END_DECLS
-
-#endif /* __GST_SDLVIDEOSINK_H__ */
diff --git a/ext/sndio/Makefile.am b/ext/sndio/Makefile.am
deleted file mode 100644
index 03a42b1a5..000000000
--- a/ext/sndio/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-plugin_LTLIBRARIES = libgstsndio.la
-
-libgstsndio_la_SOURCES = gstsndio.c sndiosink.c sndiosrc.c
-libgstsndio_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-libgstsndio_la_LIBADD = \
- $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) \
- $(SNDIO_LIBS)
-libgstsndio_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-
-noinst_HEADERS = sndiosink.h sndiosrc.h
-EXTRA_DIST =
diff --git a/ext/sndio/gstsndio.c b/ext/sndio/gstsndio.c
deleted file mode 100644
index af8252ec0..000000000
--- a/ext/sndio/gstsndio.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) <2008> Jacob Meuser <jakemsr@sdf.lonestar.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "sndiosink.h"
-#include "sndiosrc.h"
-
-#include "gst/gst-i18n-plugin.h"
-
-GST_DEBUG_CATEGORY (gst_sndio_debug);
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- if (!gst_element_register (plugin, "sndiosrc", GST_RANK_PRIMARY,
- GST_TYPE_SNDIOSRC) ||
- !gst_element_register (plugin, "sndiosink", GST_RANK_PRIMARY,
- GST_TYPE_SNDIOSINK)) {
- return FALSE;
- }
-
- GST_DEBUG_CATEGORY_INIT (gst_sndio_debug, "sndio", 0, "sndio elements");
-
-#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 TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "sndio",
- "sndio support for GStreamer",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/sndio/sndiosink.c b/ext/sndio/sndiosink.c
deleted file mode 100644
index c9d0f719a..000000000
--- a/ext/sndio/sndiosink.c
+++ /dev/null
@@ -1,527 +0,0 @@
-/*
- * Copyright (C) <2008> Jacob Meuser <jakemsr@sdf.lonestar.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/**
- * SECTION:element-sndiosink
- * @see_also: #GstAutoAudioSink
- *
- * <refsect2>
- * <para>
- * This element outputs sound to a sound card using sndio.
- * </para>
- * <para>
- * Simple example pipeline that plays an Ogg/Vorbis file via sndio:
- * <programlisting>
- * gst-launch-1.0 -v filesrc location=foo.ogg ! decodebin ! audioconvert ! audioresample ! sndiosink
- * </programlisting>
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "sndiosink.h"
-#include <unistd.h>
-#include <errno.h>
-
-#include <gst/gst-i18n-plugin.h>
-
-GST_DEBUG_CATEGORY_EXTERN (gst_sndio_debug);
-#define GST_CAT_DEFAULT gst_sndio_debug
-
-enum
-{
- PROP_0,
- PROP_HOST
-};
-
-static GstStaticPadTemplate sndio_sink_factory =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) { 1234, 4321 }, "
- "signed = (boolean) { TRUE, FALSE }, "
- "width = (int) { 8, 16, 24, 32 }, "
- "depth = (int) { 8, 16, 24, 32 }, "
- "rate = (int) [ 8000, 192000 ], " "channels = (int) [ 1, 16 ] ")
- );
-
-static void gst_sndiosink_finalize (GObject * object);
-
-static GstCaps *gst_sndiosink_getcaps (GstBaseSink * bsink);
-
-static gboolean gst_sndiosink_open (GstAudioSink * asink);
-static gboolean gst_sndiosink_close (GstAudioSink * asink);
-static gboolean gst_sndiosink_prepare (GstAudioSink * asink,
- GstRingBufferSpec * spec);
-static gboolean gst_sndiosink_unprepare (GstAudioSink * asink);
-static guint gst_sndiosink_write (GstAudioSink * asink, gpointer data,
- guint length);
-static guint gst_sndiosink_delay (GstAudioSink * asink);
-static void gst_sndiosink_reset (GstAudioSink * asink);
-
-static void gst_sndiosink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_sndiosink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void gst_sndiosink_cb (void *addr, int delta);
-
-GST_BOILERPLATE (GstSndioSink, gst_sndiosink, GstAudioSink,
- GST_TYPE_AUDIO_SINK);
-
-static void
-gst_sndiosink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_static_metadata (element_class,
- "Sndio audio sink",
- "Sink/Audio",
- "Plays audio through sndio", "Jacob Meuser <jakemsr@sdf.lonestar.org>");
-
- gst_element_class_add_static_pad_template (element_class,
- &sndio_sink_factory);
-}
-
-static void
-gst_sndiosink_class_init (GstSndioSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstBaseSinkClass *gstbasesink_class;
- GstBaseAudioSinkClass *gstbaseaudiosink_class;
- GstAudioSinkClass *gstaudiosink_class;
-
- gobject_class = (GObjectClass *) klass;
- gstbasesink_class = (GstBaseSinkClass *) klass;
- gstbaseaudiosink_class = (GstBaseAudioSinkClass *) klass;
- gstaudiosink_class = (GstAudioSinkClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->finalize = gst_sndiosink_finalize;
-
- gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_sndiosink_getcaps);
-
- gstaudiosink_class->open = GST_DEBUG_FUNCPTR (gst_sndiosink_open);
- gstaudiosink_class->close = GST_DEBUG_FUNCPTR (gst_sndiosink_close);
- gstaudiosink_class->prepare = GST_DEBUG_FUNCPTR (gst_sndiosink_prepare);
- gstaudiosink_class->unprepare = GST_DEBUG_FUNCPTR (gst_sndiosink_unprepare);
- gstaudiosink_class->write = GST_DEBUG_FUNCPTR (gst_sndiosink_write);
- gstaudiosink_class->delay = GST_DEBUG_FUNCPTR (gst_sndiosink_delay);
- gstaudiosink_class->reset = GST_DEBUG_FUNCPTR (gst_sndiosink_reset);
-
- gobject_class->set_property = gst_sndiosink_set_property;
- gobject_class->get_property = gst_sndiosink_get_property;
-
- /* default value is filled in the _init method */
- g_object_class_install_property (gobject_class, PROP_HOST,
- g_param_spec_string ("host", "Host",
- "Device or socket sndio will access", NULL, G_PARAM_READWRITE));
-}
-
-static void
-gst_sndiosink_init (GstSndioSink * sndiosink, GstSndioSinkClass * klass)
-{
- sndiosink->hdl = NULL;
- sndiosink->host = g_strdup (g_getenv ("AUDIODEVICE"));
-}
-
-static void
-gst_sndiosink_finalize (GObject * object)
-{
- GstSndioSink *sndiosink = GST_SNDIOSINK (object);
-
- gst_caps_replace (&sndiosink->cur_caps, NULL);
- g_free (sndiosink->host);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static GstCaps *
-gst_sndiosink_getcaps (GstBaseSink * bsink)
-{
- GstSndioSink *sndiosink;
-
- sndiosink = GST_SNDIOSINK (bsink);
-
- /* no hdl, we're done with the template caps */
- if (sndiosink->cur_caps == NULL) {
- GST_LOG_OBJECT (sndiosink, "getcaps called, returning template caps");
- return NULL;
- }
-
- GST_LOG_OBJECT (sndiosink, "returning %" GST_PTR_FORMAT, sndiosink->cur_caps);
-
- return gst_caps_ref (sndiosink->cur_caps);
-}
-
-static gboolean
-gst_sndiosink_open (GstAudioSink * asink)
-{
- GstPadTemplate *pad_template;
- GstSndioSink *sndiosink;
- struct sio_par par;
- struct sio_cap cap;
- GArray *rates, *chans;
- GValue rates_v = { 0 };
- GValue chans_v = { 0 };
- GValue value = { 0 };
- struct sio_enc enc;
- struct sio_conf conf;
- int confs[SIO_NCONF];
- int rate, chan;
- int i, j, k;
- int nconfs;
-
- sndiosink = GST_SNDIOSINK (asink);
-
- GST_DEBUG_OBJECT (sndiosink, "open");
-
- /* conect */
- sndiosink->hdl = sio_open (sndiosink->host, SIO_PLAY, 0);
-
- if (sndiosink->hdl == NULL)
- goto couldnt_connect;
-
- /* Use sndio defaults as the only encodings, but get the supported
- * sample rates and number of channels.
- */
-
- if (!sio_getpar (sndiosink->hdl, &par))
- goto no_server_info;
-
- if (!sio_getcap (sndiosink->hdl, &cap))
- goto no_server_info;
-
- rates = g_array_new (FALSE, FALSE, sizeof (int));
- chans = g_array_new (FALSE, FALSE, sizeof (int));
-
- /* find confs that have the default encoding */
- nconfs = 0;
- for (i = 0; i < cap.nconf; i++) {
- for (j = 0; j < SIO_NENC; j++) {
- if (cap.confs[i].enc & (1 << j)) {
- enc = cap.enc[j];
- if (enc.bits == par.bits && enc.sig == par.sig && enc.le == par.le) {
- confs[nconfs] = i;
- nconfs++;
- break;
- }
- }
- }
- }
-
- /* find the rates and channels of the confs that have the default encoding */
- for (i = 0; i < nconfs; i++) {
- conf = cap.confs[confs[i]];
- /* rates */
- for (j = 0; j < SIO_NRATE; j++) {
- if (conf.rate & (1 << j)) {
- rate = cap.rate[j];
- for (k = 0; k < rates->len && rate; k++) {
- if (rate == g_array_index (rates, int, k))
- rate = 0;
- }
- /* add in ascending order */
- if (rate) {
- for (k = 0; k < rates->len; k++) {
- if (rate < g_array_index (rates, int, k))
- {
- g_array_insert_val (rates, k, rate);
- break;
- }
- }
- if (k == rates->len)
- g_array_append_val (rates, rate);
- }
- }
- }
- /* channels */
- for (j = 0; j < SIO_NCHAN; j++) {
- if (conf.pchan & (1 << j)) {
- chan = cap.pchan[j];
- for (k = 0; k < chans->len && chan; k++) {
- if (chan == g_array_index (chans, int, k))
- chan = 0;
- }
- /* add in ascending order */
- if (chan) {
- for (k = 0; k < chans->len; k++) {
- if (chan < g_array_index (chans, int, k))
- {
- g_array_insert_val (chans, k, chan);
- break;
- }
- }
- if (k == chans->len)
- g_array_append_val (chans, chan);
- }
- }
- }
- }
- /* not sure how this can happen, but it might */
- if (cap.nconf == 0) {
- g_array_append_val (rates, par.rate);
- g_array_append_val (chans, par.pchan);
- }
-
- g_value_init (&rates_v, GST_TYPE_LIST);
- g_value_init (&chans_v, GST_TYPE_LIST);
- g_value_init (&value, G_TYPE_INT);
-
- for (i = 0; i < rates->len; i++) {
- g_value_set_int (&value, g_array_index (rates, int, i));
- gst_value_list_append_value (&rates_v, &value);
- }
- for (i = 0; i < chans->len; i++) {
- g_value_set_int (&value, g_array_index (chans, int, i));
- gst_value_list_append_value (&chans_v, &value);
- }
-
- g_array_free (rates, TRUE);
- g_array_free (chans, TRUE);
-
- pad_template = gst_static_pad_template_get (&sndio_sink_factory);
- sndiosink->cur_caps =
- gst_caps_copy (gst_pad_template_get_caps (pad_template));
- gst_object_unref (pad_template);
-
- for (i = 0; i < sndiosink->cur_caps->structs->len; i++) {
- GstStructure *s;
-
- s = gst_caps_get_structure (sndiosink->cur_caps, i);
- gst_structure_set (s, "endianness", G_TYPE_INT, par.le ? 1234 : 4321, NULL);
- gst_structure_set (s, "signed", G_TYPE_BOOLEAN, par.sig ? TRUE : FALSE,
- NULL);
- gst_structure_set (s, "width", G_TYPE_INT, par.bits, NULL);
- // gst_structure_set (s, "depth", G_TYPE_INT, par.bps * 8, NULL); /* XXX */
- gst_structure_set_value (s, "rate", &rates_v);
- gst_structure_set_value (s, "channels", &chans_v);
- }
-
- return TRUE;
-
- /* ERRORS */
-couldnt_connect:
- {
- GST_ELEMENT_ERROR (sndiosink, RESOURCE, OPEN_WRITE,
- (_("Could not establish connection to sndio")),
- ("can't open connection to sndio"));
- return FALSE;
- }
-no_server_info:
- {
- GST_ELEMENT_ERROR (sndiosink, RESOURCE, OPEN_WRITE,
- (_("Failed to query sndio capabilities")),
- ("couldn't get sndio info!"));
- return FALSE;
- }
-}
-
-static gboolean
-gst_sndiosink_close (GstAudioSink * asink)
-{
- GstSndioSink *sndiosink = GST_SNDIOSINK (asink);
-
- GST_DEBUG_OBJECT (sndiosink, "close");
-
- gst_caps_replace (&sndiosink->cur_caps, NULL);
- sio_close (sndiosink->hdl);
- sndiosink->hdl = NULL;
-
- return TRUE;
-}
-
-static void
-gst_sndiosink_cb (void *addr, int delta)
-{
- GstSndioSink *sndiosink = GST_SNDIOSINK ((GstAudioSink *) addr);
-
- sndiosink->realpos += delta;
-
- if (sndiosink->realpos >= sndiosink->playpos)
- sndiosink->latency = 0;
- else
- sndiosink->latency = sndiosink->playpos - sndiosink->realpos;
-}
-
-static gboolean
-gst_sndiosink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec)
-{
- GstSndioSink *sndiosink = GST_SNDIOSINK (asink);
- struct sio_par par;
- int spec_bpf;
-
- GST_DEBUG_OBJECT (sndiosink, "prepare");
-
- sndiosink->playpos = sndiosink->realpos = sndiosink->latency = 0;
-
- sio_initpar (&par);
- par.sig = spec->sign;
- par.le = !spec->bigend;
- par.bits = spec->width;
- // par.bps = spec->depth / 8; /* XXX */
- par.rate = spec->rate;
- par.pchan = spec->channels;
-
- spec_bpf = ((spec->width / 8) * spec->channels);
-
- par.appbufsz = (spec->segsize * spec->segtotal) / spec_bpf;
-
- if (!sio_setpar (sndiosink->hdl, &par))
- goto cannot_configure;
-
- sio_getpar (sndiosink->hdl, &par);
-
- spec->sign = par.sig;
- spec->bigend = !par.le;
- spec->width = par.bits;
- // spec->depth = par.bps * 8; /* XXX */
- spec->rate = par.rate;
- spec->channels = par.pchan;
-
- sndiosink->bpf = par.bps * par.pchan;
-
- spec->segsize = par.round * par.pchan * par.bps;
- spec->segtotal = par.bufsz / par.round;
-
- /* FIXME: this is wrong for signed ints (and the
- * audioringbuffers should do it for us anyway) */
- spec->silence_sample[0] = 0;
- spec->silence_sample[1] = 0;
- spec->silence_sample[2] = 0;
- spec->silence_sample[3] = 0;
-
- sio_onmove (sndiosink->hdl, gst_sndiosink_cb, sndiosink);
-
- if (!sio_start (sndiosink->hdl))
- goto cannot_start;
-
- GST_INFO_OBJECT (sndiosink, "successfully opened connection to sndio");
-
- return TRUE;
-
- /* ERRORS */
-cannot_configure:
- {
- GST_ELEMENT_ERROR (sndiosink, RESOURCE, OPEN_WRITE,
- (_("Could not configure sndio")), ("can't configure sndio"));
- return FALSE;
- }
-cannot_start:
- {
- GST_ELEMENT_ERROR (sndiosink, RESOURCE, OPEN_WRITE,
- (_("Could not start sndio")), ("can't start sndio"));
- return FALSE;
- }
-}
-
-static gboolean
-gst_sndiosink_unprepare (GstAudioSink * asink)
-{
- GstSndioSink *sndiosink = GST_SNDIOSINK (asink);
-
- if (sndiosink->hdl == NULL)
- return TRUE;
-
- sio_stop (sndiosink->hdl);
-
- return TRUE;
-}
-
-static guint
-gst_sndiosink_write (GstAudioSink * asink, gpointer data, guint length)
-{
- GstSndioSink *sndiosink = GST_SNDIOSINK (asink);
- guint done;
-
- done = sio_write (sndiosink->hdl, data, length);
-
- if (done == 0)
- goto write_error;
-
- sndiosink->playpos += (done / sndiosink->bpf);
-
- data = (char *) data + done;
-
- return done;
-
- /* ERRORS */
-write_error:
- {
- GST_ELEMENT_ERROR (sndiosink, RESOURCE, WRITE,
- ("Failed to write data to sndio"), GST_ERROR_SYSTEM);
- return 0;
- }
-}
-
-static guint
-gst_sndiosink_delay (GstAudioSink * asink)
-{
- GstSndioSink *sndiosink = GST_SNDIOSINK (asink);
-
- if (sndiosink->latency == (guint) - 1) {
- GST_WARNING_OBJECT (asink, "couldn't get latency");
- return 0;
- }
-
- GST_DEBUG_OBJECT (asink, "got latency: %u", sndiosink->latency);
-
- return sndiosink->latency;
-}
-
-static void
-gst_sndiosink_reset (GstAudioSink * asink)
-{
- /* no way to flush the buffers with sndio ? */
-
- GST_DEBUG_OBJECT (asink, "reset called");
-}
-
-static void
-gst_sndiosink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstSndioSink *sndiosink = GST_SNDIOSINK (object);
-
- switch (prop_id) {
- case PROP_HOST:
- g_free (sndiosink->host);
- sndiosink->host = g_value_dup_string (value);
- break;
- default:
- break;
- }
-}
-
-static void
-gst_sndiosink_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstSndioSink *sndiosink = GST_SNDIOSINK (object);
-
- switch (prop_id) {
- case PROP_HOST:
- g_value_set_string (value, sndiosink->host);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
diff --git a/ext/sndio/sndiosink.h b/ext/sndio/sndiosink.h
deleted file mode 100644
index 25bb8799b..000000000
--- a/ext/sndio/sndiosink.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) <2008> Jacob Meuser <jakemsr@sdf.lonestar.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-
-#ifndef __GST_SNDIOSINK_H__
-#define __GST_SNDIOSINK_H__
-
-#include <sndio.h>
-
-#include <gst/gst.h>
-#include <gst/audio/gstaudiosink.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_SNDIOSINK \
- (gst_sndiosink_get_type())
-#define GST_SNDIOSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SNDIOSINK,GstSndioSink))
-#define GST_SNDIOSINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SNDIOSINK,GstSndioSinkClass))
-#define GST_IS_SNDIOSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SNDIOSINK))
-#define GST_IS_SNDIOSINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SNDIOSINK))
-
-typedef struct _GstSndioSink GstSndioSink;
-typedef struct _GstSndioSinkClass GstSndioSinkClass;
-
-struct _GstSndioSink {
- GstAudioSink sink;
-
- struct sio_hdl *hdl;
- gchar *host;
-
- /* bytes per frame */
- int bpf;
-
- /* frames counts */
- volatile long long realpos;
- volatile long long playpos;
- volatile guint latency;
-
- GstCaps *cur_caps;
-};
-
-struct _GstSndioSinkClass {
- GstAudioSinkClass parent_class;
-};
-
-GType gst_sndiosink_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_SNDIOSINK_H__ */
diff --git a/ext/sndio/sndiosrc.c b/ext/sndio/sndiosrc.c
deleted file mode 100644
index 5721f42d1..000000000
--- a/ext/sndio/sndiosrc.c
+++ /dev/null
@@ -1,524 +0,0 @@
-/*
- * Copyright (C) <2008> Jacob Meuser <jakemsr@sdf.lonestar.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/**
- * SECTION:element-sndiosrc
- * @see_also: #GstAutoAudioSrc
- *
- * <refsect2>
- * <para>
- * This element retrieves samples from a sound card using sndio.
- * </para>
- * <para>
- * Simple example pipeline that records an Ogg/Vorbis file via sndio:
- * <programlisting>
- * gst-launch-1.0 -v sndiosrc ! audioconvert ! vorbisenc ! oggmux ! filesink location=foo.ogg
- * </programlisting>
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "sndiosrc.h"
-#include <unistd.h>
-#include <errno.h>
-
-#include <gst/gst-i18n-plugin.h>
-
-GST_DEBUG_CATEGORY_EXTERN (gst_sndio_debug);
-#define GST_CAT_DEFAULT gst_sndio_debug
-
-enum
-{
- PROP_0,
- PROP_HOST
-};
-
-static GstStaticPadTemplate sndio_src_factory = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) { 1234, 4321 }, "
- "signed = (boolean) { TRUE, FALSE }, "
- "width = (int) { 8, 16, 24, 32 }, "
- "depth = (int) { 8, 16, 24, 32 }, "
- "rate = (int) [ 8000, 192000 ], " "channels = (int) [ 1, 16 ] ")
- );
-
-static void gst_sndiosrc_finalize (GObject * object);
-
-static GstCaps *gst_sndiosrc_getcaps (GstBaseSrc * bsrc);
-
-static gboolean gst_sndiosrc_open (GstAudioSrc * asrc);
-static gboolean gst_sndiosrc_close (GstAudioSrc * asrc);
-static gboolean gst_sndiosrc_prepare (GstAudioSrc * asrc,
- GstRingBufferSpec * spec);
-static gboolean gst_sndiosrc_unprepare (GstAudioSrc * asrc);
-static guint gst_sndiosrc_read (GstAudioSrc * asrc, gpointer data,
- guint length);
-static guint gst_sndiosrc_delay (GstAudioSrc * asrc);
-static void gst_sndiosrc_reset (GstAudioSrc * asrc);
-
-static void gst_sndiosrc_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_sndiosrc_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void gst_sndiosrc_cb (void *addr, int delta);
-
-GST_BOILERPLATE (GstSndioSrc, gst_sndiosrc, GstAudioSrc, GST_TYPE_AUDIO_SRC);
-
-static void
-gst_sndiosrc_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_static_metadata (element_class,
- "Sndio audio source",
- "Source/Audio",
- "Records audio through sndio", "Jacob Meuser <jakemsr@sdf.lonestar.org>");
-
- gst_element_class_add_static_pad_template (element_class, &sndio_src_factory);
-}
-
-static void
-gst_sndiosrc_class_init (GstSndioSrcClass * klass)
-{
- GObjectClass *gobject_class;
- GstBaseSrcClass *gstbasesrc_class;
- GstBaseAudioSrcClass *gstbaseaudiosrc_class;
- GstAudioSrcClass *gstaudiosrc_class;
-
- gobject_class = (GObjectClass *) klass;
- gstbasesrc_class = (GstBaseSrcClass *) klass;
- gstbaseaudiosrc_class = (GstBaseAudioSrcClass *) klass;
- gstaudiosrc_class = (GstAudioSrcClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->finalize = gst_sndiosrc_finalize;
-
- gstbasesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_sndiosrc_getcaps);
-
- gstaudiosrc_class->open = GST_DEBUG_FUNCPTR (gst_sndiosrc_open);
- gstaudiosrc_class->close = GST_DEBUG_FUNCPTR (gst_sndiosrc_close);
- gstaudiosrc_class->prepare = GST_DEBUG_FUNCPTR (gst_sndiosrc_prepare);
- gstaudiosrc_class->unprepare = GST_DEBUG_FUNCPTR (gst_sndiosrc_unprepare);
- gstaudiosrc_class->read = GST_DEBUG_FUNCPTR (gst_sndiosrc_read);
- gstaudiosrc_class->delay = GST_DEBUG_FUNCPTR (gst_sndiosrc_delay);
- gstaudiosrc_class->reset = GST_DEBUG_FUNCPTR (gst_sndiosrc_reset);
-
- gobject_class->set_property = gst_sndiosrc_set_property;
- gobject_class->get_property = gst_sndiosrc_get_property;
-
- /* default value is filled in the _init method */
- g_object_class_install_property (gobject_class, PROP_HOST,
- g_param_spec_string ("host", "Host",
- "Device or socket sndio will access", NULL, G_PARAM_READWRITE));
-}
-
-static void
-gst_sndiosrc_init (GstSndioSrc * sndiosrc, GstSndioSrcClass * klass)
-{
- sndiosrc->hdl = NULL;
- sndiosrc->host = g_strdup (g_getenv ("AUDIODEVICE"));
-}
-
-static void
-gst_sndiosrc_finalize (GObject * object)
-{
- GstSndioSrc *sndiosrc = GST_SNDIOSRC (object);
-
- gst_caps_replace (&sndiosrc->cur_caps, NULL);
- g_free (sndiosrc->host);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static GstCaps *
-gst_sndiosrc_getcaps (GstBaseSrc * bsrc)
-{
- GstSndioSrc *sndiosrc;
-
- sndiosrc = GST_SNDIOSRC (bsrc);
-
- /* no hdl, we're done with the template caps */
- if (sndiosrc->cur_caps == NULL) {
- GST_LOG_OBJECT (sndiosrc, "getcaps called, returning template caps");
- return NULL;
- }
-
- GST_LOG_OBJECT (sndiosrc, "returning %" GST_PTR_FORMAT, sndiosrc->cur_caps);
-
- return gst_caps_ref (sndiosrc->cur_caps);
-}
-
-static gboolean
-gst_sndiosrc_open (GstAudioSrc * asrc)
-{
- GstPadTemplate *pad_template;
- GstSndioSrc *sndiosrc;
- struct sio_par par;
- struct sio_cap cap;
- GArray *rates, *chans;
- GValue rates_v = { 0 };
- GValue chans_v = { 0 };
- GValue value = { 0 };
- struct sio_enc enc;
- struct sio_conf conf;
- int confs[SIO_NCONF];
- int rate, chan;
- int i, j, k;
- int nconfs;
-
- sndiosrc = GST_SNDIOSRC (asrc);
-
- GST_DEBUG_OBJECT (sndiosrc, "open");
-
- /* connect */
- sndiosrc->hdl = sio_open (sndiosrc->host, SIO_REC, 0);
-
- if (sndiosrc->hdl == NULL)
- goto couldnt_connect;
-
- /* Use sndio defaults as the only encodings, but get the supported
- * sample rates and number of channels.
- */
-
- if (!sio_getpar (sndiosrc->hdl, &par))
- goto no_server_info;
-
- if (!sio_getcap (sndiosrc->hdl, &cap))
- goto no_server_info;
-
- rates = g_array_new (FALSE, FALSE, sizeof (int));
- chans = g_array_new (FALSE, FALSE, sizeof (int));
-
- /* find confs that have the default encoding */
- nconfs = 0;
- for (i = 0; i < cap.nconf; i++) {
- for (j = 0; j < SIO_NENC; j++) {
- if (cap.confs[i].enc & (1 << j)) {
- enc = cap.enc[j];
- if (enc.bits == par.bits && enc.sig == par.sig && enc.le == par.le) {
- confs[nconfs] = i;
- nconfs++;
- break;
- }
- }
- }
- }
-
- /* find the rates and channels of the confs that have the default encoding */
- for (i = 0; i < nconfs; i++) {
- conf = cap.confs[confs[i]];
- /* rates */
- for (j = 0; j < SIO_NRATE; j++) {
- if (conf.rate & (1 << j)) {
- rate = cap.rate[j];
- for (k = 0; k < rates->len && rate; k++) {
- if (rate == g_array_index (rates, int, k))
- rate = 0;
- }
- /* add in ascending order */
- if (rate) {
- for (k = 0; k < rates->len; k++) {
- if (rate < g_array_index (rates, int, k))
- {
- g_array_insert_val (rates, k, rate);
- break;
- }
- }
- if (k == rates->len)
- g_array_append_val (rates, rate);
- }
- }
- }
- /* channels */
- for (j = 0; j < SIO_NCHAN; j++) {
- if (conf.rchan & (1 << j)) {
- chan = cap.rchan[j];
- for (k = 0; k < chans->len && chan; k++) {
- if (chan == g_array_index (chans, int, k))
- chan = 0;
- }
- /* add in ascending order */
- if (chan) {
- for (k = 0; k < chans->len; k++) {
- if (chan < g_array_index (chans, int, k))
- {
- g_array_insert_val (chans, k, chan);
- break;
- }
- }
- if (k == chans->len)
- g_array_append_val (chans, chan);
- }
- }
- }
- }
- /* not sure how this can happen, but it might */
- if (cap.nconf == 0) {
- g_array_append_val (rates, par.rate);
- g_array_append_val (chans, par.rchan);
- }
-
- g_value_init (&rates_v, GST_TYPE_LIST);
- g_value_init (&chans_v, GST_TYPE_LIST);
- g_value_init (&value, G_TYPE_INT);
-
- for (i = 0; i < rates->len; i++) {
- g_value_set_int (&value, g_array_index (rates, int, i));
- gst_value_list_append_value (&rates_v, &value);
- }
- for (i = 0; i < chans->len; i++) {
- g_value_set_int (&value, g_array_index (chans, int, i));
- gst_value_list_append_value (&chans_v, &value);
- }
-
- g_array_free (rates, TRUE);
- g_array_free (chans, TRUE);
-
- pad_template = gst_static_pad_template_get (&sndio_src_factory);
- sndiosrc->cur_caps = gst_caps_copy (gst_pad_template_get_caps (pad_template));
- gst_object_unref (pad_template);
-
- for (i = 0; i < sndiosrc->cur_caps->structs->len; i++) {
- GstStructure *s;
-
- s = gst_caps_get_structure (sndiosrc->cur_caps, i);
- gst_structure_set (s, "endianness", G_TYPE_INT, par.le ? 1234 : 4321, NULL);
- gst_structure_set (s, "signed", G_TYPE_BOOLEAN, par.sig ? TRUE : FALSE,
- NULL);
- gst_structure_set (s, "width", G_TYPE_INT, par.bits, NULL);
- // gst_structure_set (s, "depth", G_TYPE_INT, par.bps * 8, NULL); /* XXX */
- gst_structure_set_value (s, "rate", &rates_v);
- gst_structure_set_value (s, "channels", &chans_v);
- }
-
- return TRUE;
-
- /* ERRORS */
-couldnt_connect:
- {
- GST_ELEMENT_ERROR (sndiosrc, RESOURCE, OPEN_READ,
- (_("Could not establish connection to sndio")),
- ("can't open connection to sndio"));
- return FALSE;
- }
-no_server_info:
- {
- GST_ELEMENT_ERROR (sndiosrc, RESOURCE, OPEN_READ,
- (_("Failed to query sndio capabilities")),
- ("couldn't get sndio info!"));
- return FALSE;
- }
-}
-
-static gboolean
-gst_sndiosrc_close (GstAudioSrc * asrc)
-{
- GstSndioSrc *sndiosrc = GST_SNDIOSRC (asrc);
-
- GST_DEBUG_OBJECT (sndiosrc, "close");
-
- gst_caps_replace (&sndiosrc->cur_caps, NULL);
- sio_close (sndiosrc->hdl);
- sndiosrc->hdl = NULL;
-
- return TRUE;
-}
-
-static void
-gst_sndiosrc_cb (void *addr, int delta)
-{
- GstSndioSrc *sndiosrc = GST_SNDIOSRC ((GstAudioSrc *) addr);
-
- sndiosrc->realpos += delta;
-
- if (sndiosrc->readpos >= sndiosrc->realpos)
- sndiosrc->latency = 0;
- else
- sndiosrc->latency = sndiosrc->realpos - sndiosrc->readpos;
-}
-
-static gboolean
-gst_sndiosrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
-{
- GstSndioSrc *sndiosrc = GST_SNDIOSRC (asrc);
- struct sio_par par;
- int spec_bpf;
-
- GST_DEBUG_OBJECT (sndiosrc, "prepare");
-
- sndiosrc->readpos = sndiosrc->realpos = sndiosrc->latency = 0;
-
- sio_initpar (&par);
- par.sig = spec->sign;
- par.le = !spec->bigend;
- par.bits = spec->width;
- // par.bps = spec->depth / 8; /* XXX */
- par.rate = spec->rate;
- par.rchan = spec->channels;
-
- spec_bpf = ((spec->width / 8) * spec->channels);
-
- par.round = spec->segsize / spec_bpf;
- par.appbufsz = (spec->segsize * spec->segtotal) / spec_bpf;
-
- if (!sio_setpar (sndiosrc->hdl, &par))
- goto cannot_configure;
-
- sio_getpar (sndiosrc->hdl, &par);
-
- spec->sign = par.sig;
- spec->bigend = !par.le;
- spec->width = par.bits;
- // spec->depth = par.bps * 8; /* XXX */
- spec->rate = par.rate;
- spec->channels = par.rchan;
-
- sndiosrc->bpf = par.bps * par.rchan;
-
- spec->segsize = par.round * par.rchan * par.bps;
- spec->segtotal = par.bufsz / par.round;
-
- /* FIXME: this is wrong for signed ints (and the
- * audioringbuffers should do it for us anyway) */
- spec->silence_sample[0] = 0;
- spec->silence_sample[1] = 0;
- spec->silence_sample[2] = 0;
- spec->silence_sample[3] = 0;
-
- sio_onmove (sndiosrc->hdl, gst_sndiosrc_cb, sndiosrc);
-
- if (!sio_start (sndiosrc->hdl))
- goto cannot_start;
-
- GST_INFO_OBJECT (sndiosrc, "successfully opened connection to sndio");
-
- return TRUE;
-
- /* ERRORS */
-cannot_configure:
- {
- GST_ELEMENT_ERROR (sndiosrc, RESOURCE, OPEN_READ,
- (_("Could not configure sndio")), ("can't configure sndio"));
- return FALSE;
- }
-cannot_start:
- {
- GST_ELEMENT_ERROR (sndiosrc, RESOURCE, OPEN_READ,
- (_("Could not start sndio")), ("can't start sndio"));
- return FALSE;
- }
-}
-
-static gboolean
-gst_sndiosrc_unprepare (GstAudioSrc * asrc)
-{
- GstSndioSrc *sndiosrc = GST_SNDIOSRC (asrc);
-
- if (sndiosrc->hdl == NULL)
- return TRUE;
-
- sio_stop (sndiosrc->hdl);
-
- return TRUE;
-}
-
-static guint
-gst_sndiosrc_read (GstAudioSrc * asrc, gpointer data, guint length)
-{
- GstSndioSrc *sndiosrc = GST_SNDIOSRC (asrc);
- guint done;
-
- done = sio_read (sndiosrc->hdl, data, length);
-
- if (done == 0)
- goto read_error;
-
- sndiosrc->readpos += (done / sndiosrc->bpf);
-
- data = (char *) data + done;
-
- return done;
-
- /* ERRORS */
-read_error:
- {
- GST_ELEMENT_ERROR (sndiosrc, RESOURCE, READ,
- ("Failed to read data from sndio"), GST_ERROR_SYSTEM);
- return 0;
- }
-}
-
-static guint
-gst_sndiosrc_delay (GstAudioSrc * asrc)
-{
- GstSndioSrc *sndiosrc = GST_SNDIOSRC (asrc);
-
- if (sndiosrc->latency == (guint) - 1) {
- GST_WARNING_OBJECT (asrc, "couldn't get latency");
- return 0;
- }
-
- GST_DEBUG_OBJECT (asrc, "got latency: %u", sndiosrc->latency);
-
- return sndiosrc->latency;
-}
-
-static void
-gst_sndiosrc_reset (GstAudioSrc * asrc)
-{
- /* no way to flush the buffers with sndio ? */
-
- GST_DEBUG_OBJECT (asrc, "reset called");
-}
-
-static void
-gst_sndiosrc_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstSndioSrc *sndiosrc = GST_SNDIOSRC (object);
-
- switch (prop_id) {
- case PROP_HOST:
- g_free (sndiosrc->host);
- sndiosrc->host = g_value_dup_string (value);
- break;
- default:
- break;
- }
-}
-
-static void
-gst_sndiosrc_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstSndioSrc *sndiosrc = GST_SNDIOSRC (object);
-
- switch (prop_id) {
- case PROP_HOST:
- g_value_set_string (value, sndiosrc->host);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
diff --git a/ext/sndio/sndiosrc.h b/ext/sndio/sndiosrc.h
deleted file mode 100644
index 48e7a2606..000000000
--- a/ext/sndio/sndiosrc.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) <2008> Jacob Meuser <jakemsr@sdf.lonestar.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-
-#ifndef __GST_SNDIOSRC_H__
-#define __GST_SNDIOSRC_H__
-
-#include <sndio.h>
-
-#include <gst/gst.h>
-#include <gst/audio/gstaudiosrc.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_SNDIOSRC \
- (gst_sndiosrc_get_type())
-#define GST_SNDIOSRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SNDIOSRC,GstSndioSrc))
-#define GST_SNDIOSRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SNDIOSRC,GstSndioSrcClass))
-#define GST_IS_SNDIOSRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SNDIOSRC))
-#define GST_IS_SNDIOSRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SNDIOSRC))
-
-typedef struct _GstSndioSrc GstSndioSrc;
-typedef struct _GstSndioSrcClass GstSndioSrcClass;
-
-struct _GstSndioSrc {
- GstAudioSrc src;
-
- struct sio_hdl *hdl;
- gchar *host;
-
- /* bytes per frame */
- int bpf;
-
- /* frames counts */
- volatile long long realpos;
- volatile long long readpos;
- volatile guint latency;
-
- GstCaps *cur_caps;
-};
-
-struct _GstSndioSrcClass {
- GstAudioSrcClass parent_class;
-};
-
-GType gst_sndiosrc_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_SNDIOSRC_H__ */
diff --git a/ext/timidity/gsttimidity.c b/ext/timidity/gsttimidity.c
deleted file mode 100644
index 0b3f3769a..000000000
--- a/ext/timidity/gsttimidity.c
+++ /dev/null
@@ -1,821 +0,0 @@
-/*
- * gsttimdity - timidity plugin for gstreamer
- *
- * Copyright 2007 Wouter Paesen <wouter@blue-gate.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/**
- * SECTION:element-timidity
- * @see_also: wildmidi
- *
- * This element renders midi-files as audio streams using
- * <ulink url="http://timidity.sourceforge.net/">Timidity</ulink>.
- *
- * <refsect2>
- * <title>Example pipeline</title>
- * |[
- * gst-launch filesrc location=song.mid ! timidity ! alsasink
- * ]| This example pipeline will parse the midi and render to raw audio which is
- * played via alsa.
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <gst/gst.h>
-#include <string.h>
-
-#include "gsttimidity.h"
-
-#ifndef TIMIDITY_CFG
-#define TIMIDITY_CFG "/etc/timidity.cfg"
-#endif
-
-GST_DEBUG_CATEGORY_STATIC (gst_timidity_debug);
-#define GST_CAT_DEFAULT gst_timidity_debug
-
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-enum
-{
- ARG_0,
- /* FILL ME */
-};
-
-static gboolean gst_timidity_src_event (GstPad * pad, GstEvent * event);
-static GstStateChangeReturn gst_timidity_change_state (GstElement * element,
- GstStateChange transition);
-static gboolean gst_timidity_activate (GstPad * pad);
-static gboolean gst_timidity_activatepull (GstPad * pad, gboolean active);
-static void gst_timidity_loop (GstPad * sinkpad);
-static gboolean gst_timidity_src_query (GstPad * pad, GstQuery * query);
-static gboolean gst_timidity_set_song_options (GstTimidity * timidity,
- MidSongOptions * options);
-
-static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/midi; audio/riff-midi")
- );
-
-static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-int, "
- "rate = (int) 44100, "
- "channels = (int) 2, "
- "endianness = (int) LITTLE_ENDIAN, "
- "width = (int) 16, " "depth = (int) 16, " "signed = (boolean) true"));
-
-GST_BOILERPLATE (GstTimidity, gst_timidity, GstElement, GST_TYPE_ELEMENT);
-
-static void
-gst_timidity_base_init (gpointer gclass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
- gst_element_class_add_static_pad_template (element_class, &src_factory);
- gst_element_class_add_static_pad_template (element_class, &sink_factory);
- gst_element_class_set_static_metadata (element_class, "Timidity",
- "Codec/Decoder/Audio",
- "Midi Synthesizer Element", "Wouter Paesen <wouter@blue-gate.be>");
-}
-
-/* initialize the plugin's class */
-static void
-gst_timidity_class_init (GstTimidityClass * klass)
-{
- GstElementClass *gstelement_class;
-
- gstelement_class = (GstElementClass *) klass;
- gstelement_class->change_state = gst_timidity_change_state;
-}
-
-/* initialize the new element
- * instantiate pads and add them to element
- * set functions
- * initialize structure
- */
-static void
-gst_timidity_init (GstTimidity * filter, GstTimidityClass * g_class)
-{
- GstElementClass *klass = GST_ELEMENT_GET_CLASS (filter);
-
- /* initialise timidity library */
- if (mid_init ((char *) TIMIDITY_CFG) == 0) {
- filter->initialized = TRUE;
- } else {
- GST_WARNING ("can't initialize timidity with config: " TIMIDITY_CFG);
- }
-
- filter->sinkpad =
- gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
- "sink"), "sink");
-
- gst_pad_set_activatepull_function (filter->sinkpad,
- gst_timidity_activatepull);
- gst_pad_set_activate_function (filter->sinkpad, gst_timidity_activate);
- gst_pad_set_setcaps_function (filter->sinkpad, gst_pad_set_caps);
- gst_pad_use_fixed_caps (filter->sinkpad);
- gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
-
- filter->srcpad =
- gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
- "src"), "src");
-
- gst_pad_set_query_function (filter->srcpad, gst_timidity_src_query);
- gst_pad_set_event_function (filter->srcpad, gst_timidity_src_event);
- gst_pad_use_fixed_caps (filter->srcpad);
- gst_pad_set_setcaps_function (filter->srcpad, gst_pad_set_caps);
-
- gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
-
- filter->song_options->buffer_size = 2048;
- filter->song_options->rate = 44100;
- filter->song_options->format = MID_AUDIO_S16LSB;
- filter->song_options->channels = 2;
-
- gst_timidity_set_song_options (filter, filter->song_options);
-
- gst_segment_init (filter->o_segment, GST_FORMAT_DEFAULT);
-}
-
-static gboolean
-gst_timidity_set_song_options (GstTimidity * timidity, MidSongOptions * options)
-{
- gint64 bps;
-
- switch (options->format) {
- case MID_AUDIO_U8:
- case MID_AUDIO_S8:
- bps = 1;
- break;
- case MID_AUDIO_U16LSB:
- case MID_AUDIO_S16LSB:
- case MID_AUDIO_U16MSB:
- case MID_AUDIO_S16MSB:
- bps = 2;
- break;
- default:
- return FALSE;
- }
-
- bps *= options->channels;
-
- if (options != timidity->song_options)
- memcpy (timidity->song_options, options, sizeof (MidSongOptions));
-
- timidity->bytes_per_frame = bps;
- timidity->time_per_frame = GST_SECOND / (GstClockTime) options->rate;
-
- return TRUE;
-}
-
-static gboolean
-gst_timidity_src_convert (GstTimidity * timidity,
- GstFormat src_format, gint64 src_value,
- GstFormat * dest_format, gint64 * dest_value)
-{
- gboolean res = TRUE;
- gint64 frames;
-
- if (src_format == *dest_format) {
- *dest_value = src_value;
- goto done;
- }
-
- switch (src_format) {
- case GST_FORMAT_TIME:
- frames = src_value / timidity->time_per_frame;
- break;
- case GST_FORMAT_BYTES:
- frames = src_value / (timidity->bytes_per_frame);
- break;
- case GST_FORMAT_DEFAULT:
- frames = src_value;
- break;
- default:
- res = FALSE;
- goto done;
- }
-
- switch (*dest_format) {
- case GST_FORMAT_TIME:
- *dest_value = frames * timidity->time_per_frame;
- break;
- case GST_FORMAT_BYTES:
- *dest_value = frames * timidity->bytes_per_frame;
- break;
- case GST_FORMAT_DEFAULT:
- *dest_value = frames;
- break;
- default:
- res = FALSE;
- break;
- }
-
-done:
- return res;
-}
-
-static gboolean
-gst_timidity_src_query (GstPad * pad, GstQuery * query)
-{
- gboolean res = TRUE;
- GstTimidity *timidity = GST_TIMIDITY (gst_pad_get_parent (pad));
- GstFormat src_format, dst_format;
- gint64 src_value, dst_value;
-
- if (!timidity->song) {
- gst_object_unref (timidity);
- return FALSE;
- }
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_DURATION:
- gst_query_set_duration (query, GST_FORMAT_TIME,
- GST_MSECOND * (gint64) mid_song_get_total_time (timidity->song));
- break;
- case GST_QUERY_POSITION:
- gst_query_set_position (query, GST_FORMAT_TIME,
- timidity->o_segment->last_stop * timidity->time_per_frame);
- break;
- case GST_QUERY_CONVERT:
- gst_query_parse_convert (query, &src_format, &src_value,
- &dst_format, NULL);
-
- res =
- gst_timidity_src_convert (timidity, src_format, src_value,
- &dst_format, &dst_value);
- if (res)
- gst_query_set_convert (query, src_format, src_value, dst_format,
- dst_value);
-
- break;
- case GST_QUERY_FORMATS:
- gst_query_set_formats (query, 3,
- GST_FORMAT_TIME, GST_FORMAT_BYTES, GST_FORMAT_DEFAULT);
- break;
- case GST_QUERY_SEGMENT:{
- GstFormat format;
- gint64 start, stop;
-
- format = timidity->o_segment->format;
-
- start =
- gst_segment_to_stream_time (timidity->o_segment, format,
- timidity->o_segment->start);
- if ((stop = timidity->o_segment->stop) == -1)
- stop = timidity->o_segment->duration;
- else
- stop = gst_segment_to_stream_time (timidity->o_segment, format, stop);
-
- gst_query_set_segment (query, timidity->o_segment->rate, format, start,
- stop);
- res = TRUE;
- break;
- }
- case GST_QUERY_SEEKING:
- gst_query_set_seeking (query, timidity->o_segment->format,
- TRUE, 0, timidity->o_len);
- break;
- default:
- res = FALSE;
- break;
- }
-
- gst_object_unref (timidity);
- return res;
-}
-
-static gboolean
-gst_timidity_get_upstream_size (GstTimidity * timidity, gint64 * size)
-{
- GstFormat format = GST_FORMAT_BYTES;
- gboolean res = FALSE;
- GstPad *peer = gst_pad_get_peer (timidity->sinkpad);
-
- if (peer != NULL)
- res = gst_pad_query_duration (peer, &format, size) && *size >= 0;
-
- gst_object_unref (peer);
- return res;
-}
-
-static GstSegment *
-gst_timidity_get_segment (GstTimidity * timidity, GstFormat format,
- gboolean update)
-{
- gint64 start = 0, stop = 0, time = 0;
-
- GstSegment *segment = gst_segment_new ();
-
- gst_timidity_src_convert (timidity,
- timidity->o_segment->format, timidity->o_segment->start, &format, &start);
-
- if (timidity->o_segment->stop == GST_CLOCK_TIME_NONE) {
- stop = GST_CLOCK_TIME_NONE;
- } else {
- gst_timidity_src_convert (timidity,
- timidity->o_segment->format, timidity->o_segment->stop, &format, &stop);
- }
-
- gst_timidity_src_convert (timidity,
- timidity->o_segment->format, timidity->o_segment->time, &format, &time);
-
- gst_segment_set_newsegment_full (segment, update,
- timidity->o_segment->rate, timidity->o_segment->applied_rate,
- format, start, stop, time);
-
- segment->last_stop = time;
-
- return segment;
-}
-
-static GstEvent *
-gst_timidity_get_new_segment_event (GstTimidity * timidity, GstFormat format,
- gboolean update)
-{
- GstSegment *segment;
- GstEvent *event;
-
- segment = gst_timidity_get_segment (timidity, format, update);
-
- event = gst_event_new_new_segment_full (update,
- segment->rate, segment->applied_rate, segment->format,
- segment->start, segment->stop, segment->time);
-
- gst_segment_free (segment);
-
- return event;
-}
-
-static gboolean
-gst_timidity_src_event (GstPad * pad, GstEvent * event)
-{
- gboolean res = FALSE;
- GstTimidity *timidity = GST_TIMIDITY (gst_pad_get_parent (pad));
-
- GST_DEBUG_OBJECT (pad, "%s event received", GST_EVENT_TYPE_NAME (event));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_SEEK:
- {
- gdouble rate;
- GstFormat src_format, dst_format;
- GstSeekFlags flags;
- GstSeekType start_type, stop_type;
- gint64 orig_start, start = 0, stop = 0;
- gboolean flush, update;
-
- if (!timidity->song)
- break;
-
- gst_event_parse_seek (event, &rate, &src_format, &flags,
- &start_type, &orig_start, &stop_type, &stop);
-
- dst_format = GST_FORMAT_DEFAULT;
-
- gst_timidity_src_convert (timidity, src_format, orig_start,
- &dst_format, &start);
- gst_timidity_src_convert (timidity, src_format, stop, &dst_format, &stop);
-
- flush = ((flags & GST_SEEK_FLAG_FLUSH) == GST_SEEK_FLAG_FLUSH);
-
- if (flush) {
- GST_DEBUG ("performing flush");
- gst_pad_push_event (timidity->srcpad, gst_event_new_flush_start ());
- } else {
- gst_pad_stop_task (timidity->sinkpad);
- }
-
- GST_PAD_STREAM_LOCK (timidity->sinkpad);
-
- if (flush) {
- gst_pad_push_event (timidity->srcpad, gst_event_new_flush_stop ());
- }
-
- gst_segment_set_seek (timidity->o_segment, rate, dst_format, flags,
- start_type, start, stop_type, stop, &update);
-
- if (flags & GST_SEEK_FLAG_SEGMENT) {
- GST_DEBUG_OBJECT (timidity, "received segment seek %d, %d",
- (gint) start_type, (gint) stop_type);
- } else {
- GST_DEBUG_OBJECT (timidity, "received normal seek %d",
- (gint) start_type);
- update = FALSE;
- }
-
- gst_pad_push_event (timidity->srcpad,
- gst_timidity_get_new_segment_event (timidity, GST_FORMAT_TIME,
- update));
-
- timidity->o_seek = TRUE;
-
- gst_pad_start_task (timidity->sinkpad,
- (GstTaskFunction) gst_timidity_loop, timidity->sinkpad, NULL);
-
- GST_PAD_STREAM_UNLOCK (timidity->sinkpad);
- GST_DEBUG ("seek done");
- }
- res = TRUE;
- break;
- default:
- break;
- }
-
- g_object_unref (timidity);
- return res;
-}
-
-static gboolean
-gst_timidity_activate (GstPad * sinkpad)
-{
- if (gst_pad_check_pull_range (sinkpad))
- return gst_pad_activate_pull (sinkpad, TRUE);
-
- return FALSE;
-}
-
-static gboolean
-gst_timidity_activatepull (GstPad * pad, gboolean active)
-{
- if (active) {
- return gst_pad_start_task (pad, (GstTaskFunction) gst_timidity_loop, pad,
- NULL);
- } else {
- return gst_pad_stop_task (pad);
- }
-}
-
-static GstBuffer *
-gst_timidity_allocate_buffer (GstTimidity * timidity, gint64 samples)
-{
- return gst_buffer_new_and_alloc (samples * timidity->bytes_per_frame);
-}
-
-static GstBuffer *
-gst_timidity_clip_buffer (GstTimidity * timidity, GstBuffer * buffer)
-{
- gint64 new_start, new_stop;
- gint64 offset, length;
- GstBuffer *out;
-
- return buffer;
-
- if (!gst_segment_clip (timidity->o_segment, GST_FORMAT_DEFAULT,
- GST_BUFFER_OFFSET (buffer), GST_BUFFER_OFFSET_END (buffer),
- &new_start, &new_stop)) {
- gst_buffer_unref (buffer);
- return NULL;
- }
-
- if (GST_BUFFER_OFFSET (buffer) == new_start &&
- GST_BUFFER_OFFSET_END (buffer) == new_stop)
- return buffer;
-
- offset = new_start - GST_BUFFER_OFFSET (buffer);
- length = new_stop - new_start;
-
- out = gst_buffer_create_sub (buffer, offset * timidity->bytes_per_frame,
- length * timidity->bytes_per_frame);
-
- GST_BUFFER_OFFSET (out) = new_start;
- GST_BUFFER_OFFSET_END (out) = new_stop;
- GST_BUFFER_TIMESTAMP (out) = new_start * timidity->time_per_frame;
- GST_BUFFER_DURATION (out) = (new_stop - new_start) * timidity->time_per_frame;
-
- gst_buffer_unref (buffer);
-
- return out;
-}
-
-/* generate audio data and advance internal timers */
-static GstBuffer *
-gst_timidity_fill_buffer (GstTimidity * timidity, GstBuffer * buffer)
-{
- size_t bytes_read;
- gint64 samples;
-
- bytes_read = mid_song_read_wave (timidity->song, GST_BUFFER_DATA (buffer),
- GST_BUFFER_SIZE (buffer));
-
- if (bytes_read == 0) {
- gst_buffer_unref (buffer);
- return NULL;
- }
-
- GST_BUFFER_OFFSET (buffer) =
- timidity->o_segment->last_stop * timidity->bytes_per_frame;
- GST_BUFFER_TIMESTAMP (buffer) =
- timidity->o_segment->last_stop * timidity->time_per_frame;
-
- if (bytes_read < GST_BUFFER_SIZE (buffer)) {
- GstBuffer *old = buffer;
-
- buffer = gst_buffer_create_sub (buffer, 0, bytes_read);
- gst_buffer_unref (old);
- }
-
- samples = GST_BUFFER_SIZE (buffer) / timidity->bytes_per_frame;
-
- timidity->o_segment->last_stop += samples;
-
- GST_BUFFER_OFFSET_END (buffer) =
- timidity->o_segment->last_stop * timidity->bytes_per_frame;
- GST_BUFFER_DURATION (buffer) = samples * timidity->time_per_frame;
-
- GST_DEBUG_OBJECT (timidity,
- "generated buffer %" GST_TIME_FORMAT "-%" GST_TIME_FORMAT
- " (%" G_GINT64_FORMAT " samples)",
- GST_TIME_ARGS ((guint64) GST_BUFFER_TIMESTAMP (buffer)),
- GST_TIME_ARGS (((guint64) (GST_BUFFER_TIMESTAMP (buffer) +
- GST_BUFFER_DURATION (buffer)))), samples);
-
- return buffer;
-}
-
-static GstBuffer *
-gst_timidity_get_buffer (GstTimidity * timidity)
-{
- GstBuffer *out;
-
- out =
- gst_timidity_fill_buffer (timidity,
- gst_timidity_allocate_buffer (timidity, 256));
-
- if (!out)
- return NULL;
-
- return gst_timidity_clip_buffer (timidity, out);
-}
-
-static void
-gst_timidity_loop (GstPad * sinkpad)
-{
- GstTimidity *timidity = GST_TIMIDITY (GST_PAD_PARENT (sinkpad));
- GstBuffer *out;
- GstFlowReturn ret;
-
- if (timidity->mididata_size == 0) {
- if (!gst_timidity_get_upstream_size (timidity, &timidity->mididata_size)) {
- GST_ELEMENT_ERROR (timidity, STREAM, DECODE, (NULL),
- ("Unable to get song length"));
- goto paused;
- }
-
- g_free (timidity->mididata);
-
- timidity->mididata = g_malloc (timidity->mididata_size);
- timidity->mididata_offset = 0;
- return;
- }
-
- if (timidity->mididata_offset < timidity->mididata_size) {
- GstBuffer *buffer = NULL;
- gint64 size;
-
- GST_DEBUG_OBJECT (timidity, "loading song");
-
- ret =
- gst_pad_pull_range (timidity->sinkpad, timidity->mididata_offset,
- -1, &buffer);
- if (ret != GST_FLOW_OK) {
- GST_ELEMENT_ERROR (timidity, STREAM, DECODE, (NULL),
- ("Unable to load song"));
- goto paused;
- }
-
- size = timidity->mididata_size - timidity->mididata_offset;
- if (GST_BUFFER_SIZE (buffer) < size)
- size = GST_BUFFER_SIZE (buffer);
-
- memmove (timidity->mididata + timidity->mididata_offset,
- GST_BUFFER_DATA (buffer), size);
- gst_buffer_unref (buffer);
-
- timidity->mididata_offset += size;
- GST_DEBUG_OBJECT (timidity, "Song loaded");
- return;
- }
-
- if (!timidity->song) {
- MidIStream *stream;
- GstTagList *tags = NULL;
- gchar *text;
-
- GST_DEBUG_OBJECT (timidity, "Parsing song");
-
-#if defined(LIBTIMIDITY_VERSION) && LIBTIMIDITY_VERSION < 0x000200L
- stream =
- mid_istream_open_mem (timidity->mididata, timidity->mididata_size, 0);
-#else
- stream = mid_istream_open_mem (timidity->mididata, timidity->mididata_size);
-#endif
-
- timidity->song = mid_song_load (stream, timidity->song_options);
- mid_istream_close (stream);
-
- if (!timidity->song) {
- GST_ELEMENT_ERROR (timidity, STREAM, DECODE, (NULL),
- ("Unable to parse midi"));
- goto paused;
- }
-
- mid_song_start (timidity->song);
- timidity->o_len = (GST_MSECOND *
- (GstClockTime) mid_song_get_total_time (timidity->song)) /
- timidity->time_per_frame;
- gst_segment_set_newsegment (timidity->o_segment, FALSE, 1.0,
- GST_FORMAT_DEFAULT, 0, GST_CLOCK_TIME_NONE, 0);
-
-
- gst_pad_push_event (timidity->srcpad,
- gst_timidity_get_new_segment_event (timidity, GST_FORMAT_TIME, FALSE));
-
- /* extract tags */
- text = mid_song_get_meta (timidity->song, MID_SONG_TEXT);
- if (text) {
- tags = gst_tag_list_new ();
- gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_TITLE, text, NULL);
-
- //g_free (text);
- }
-
- text = mid_song_get_meta (timidity->song, MID_SONG_COPYRIGHT);
- if (text) {
- if (tags == NULL)
- tags = gst_tag_list_new ();
- gst_tag_list_add (tags, GST_TAG_MERGE_APPEND,
- GST_TAG_COPYRIGHT, text, NULL);
-
- //g_free (text);
- }
-
- if (tags) {
- gst_element_found_tags (GST_ELEMENT (timidity), tags);
- }
-
- GST_DEBUG_OBJECT (timidity, "Parsing song done");
- return;
- }
-
- if (timidity->o_segment_changed) {
- GstSegment *segment = gst_timidity_get_segment (timidity, GST_FORMAT_TIME,
- !timidity->o_new_segment);
-
- GST_LOG_OBJECT (timidity,
- "sending newsegment from %" GST_TIME_FORMAT "-%" GST_TIME_FORMAT
- ", pos=%" GST_TIME_FORMAT, GST_TIME_ARGS ((guint64) segment->start),
- GST_TIME_ARGS ((guint64) segment->stop),
- GST_TIME_ARGS ((guint64) segment->time));
-
- if (timidity->o_segment->flags & GST_SEEK_FLAG_SEGMENT) {
- gst_element_post_message (GST_ELEMENT (timidity),
- gst_message_new_segment_start (GST_OBJECT (timidity),
- segment->format, segment->start));
- }
-
- gst_segment_free (segment);
- timidity->o_segment_changed = FALSE;
- return;
- }
-
- if (timidity->o_seek) {
- /* perform a seek internally */
- timidity->o_segment->last_stop = timidity->o_segment->time;
- mid_song_seek (timidity->song,
- (timidity->o_segment->last_stop * timidity->time_per_frame) /
- GST_MSECOND);
- }
-
- out = gst_timidity_get_buffer (timidity);
- if (!out) {
- GST_LOG_OBJECT (timidity, "Song ended, generating eos");
- gst_pad_push_event (timidity->srcpad, gst_event_new_eos ());
- timidity->o_seek = FALSE;
- goto paused;
- }
-
- if (timidity->o_seek) {
- GST_BUFFER_FLAG_SET (out, GST_BUFFER_FLAG_DISCONT);
- timidity->o_seek = FALSE;
- }
-
- gst_buffer_set_caps (out, timidity->out_caps);
- ret = gst_pad_push (timidity->srcpad, out);
-
- if (ret == GST_FLOW_UNEXPECTED)
- goto eos;
- else if (ret < GST_FLOW_UNEXPECTED || ret == GST_FLOW_NOT_LINKED)
- goto error;
-
- return;
-
-paused:
- {
- GST_DEBUG_OBJECT (timidity, "pausing task");
- gst_pad_pause_task (timidity->sinkpad);
- return;
- }
-eos:
- {
- gst_pad_push_event (timidity->srcpad, gst_event_new_eos ());
- goto paused;
- }
-error:
- {
- GST_ELEMENT_FLOW_ERROR (timidity, ret);
- gst_pad_push_event (timidity->srcpad, gst_event_new_eos ());
- goto paused;
- }
-}
-
-static GstStateChangeReturn
-gst_timidity_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
- GstTimidity *timidity = GST_TIMIDITY (element);
-
- if (!timidity->initialized) {
- GST_WARNING ("Timidity renderer is not initialized");
- return GST_STATE_CHANGE_FAILURE;
- }
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- timidity->out_caps =
- gst_caps_copy (gst_pad_get_pad_template_caps (timidity->srcpad));
- timidity->mididata = NULL;
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- timidity->mididata_size = 0;
- 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:
- if (timidity->song)
- mid_song_free (timidity->song);
- timidity->song = NULL;
- timidity->mididata_size = 0;
- if (timidity->mididata) {
- g_free (timidity->mididata);
- timidity->mididata = NULL;
- }
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- gst_caps_unref (timidity->out_caps);
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (gst_timidity_debug, "timidity",
- 0, "Timidity plugin");
-
- return gst_element_register (plugin, "timidity",
- GST_RANK_PRIMARY, GST_TYPE_TIMIDITY);
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- timidity,
- "Timidity Plugin",
- plugin_init, VERSION, "GPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/ext/timidity/gsttimidity.h b/ext/timidity/gsttimidity.h
deleted file mode 100644
index 4e9350b73..000000000
--- a/ext/timidity/gsttimidity.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * gsttimdity - timidity plugin for gstreamer
- *
- * Copyright 2007 Wouter Paesen <wouter@blue-gate.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * Wrapper element for libtimidity. This element works in pull
- * based mode because that's essentially how libtimidity works.
- * We create a libtimidity stream that operates on the srcpad.
- * The sinkpad is in pull mode.
- */
-
-#ifndef __GST_TIMIDITY_H__
-#define __GST_TIMIDITY_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstadapter.h>
-#include <timidity.h>
-
-G_BEGIN_DECLS
-#define GST_TYPE_TIMIDITY \
- (gst_timidity_get_type())
-#define GST_TIMIDITY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TIMIDITY,GstTimidity))
-#define GST_TIMIDITY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TIMIDITY,GstTimidityClass))
-#define GST_IS_TIMIDITY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TIMIDITY))
-#define GST_IS_TIMIDITY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TIMIDITY))
-typedef struct _GstTimidity GstTimidity;
-typedef struct _GstTimidityClass GstTimidityClass;
-
-struct _GstTimidity
-{
- GstElement element;
-
- GstPad *sinkpad, *srcpad;
-
- gboolean initialized;
-
- /* input stream properties */
- gint64 mididata_size, mididata_offset;
- gchar *mididata;
- gboolean mididata_filled;
-
- MidSong *song;
-
- /* output data */
- gboolean o_new_segment, o_segment_changed, o_seek;
- GstSegment o_segment[1];
- gint64 o_len;
-
- /* format of the stream */
- MidSongOptions song_options[1];
- gint64 bytes_per_frame;
- GstClockTime time_per_frame;
-
- GstCaps *out_caps;
-};
-
-struct _GstTimidityClass
-{
- GstElementClass parent_class;
-};
-
-GType gst_timidity_get_type (void);
-
-G_END_DECLS
-#endif /* __GST_TIMIDITY_H__ */
diff --git a/ext/timidity/Makefile.am b/ext/wildmidi/Makefile.am
index 9ec7bbd83..7dfdc883f 100644
--- a/ext/timidity/Makefile.am
+++ b/ext/wildmidi/Makefile.am
@@ -1,20 +1,6 @@
# plugindir is set in configure
plugin_LTLIBRARIES =
-if USE_TIMIDITY
-plugin_LTLIBRARIES += libgsttimidity.la
-
-# sources used to compile this plug-in
-libgsttimidity_la_SOURCES = gsttimidity.c
-
-# flags used to compile this plugin
-# add other _CFLAGS and _LIBS as needed
-libgsttimidity_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(TIMIDITY_CFLAGS)
-libgsttimidity_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(TIMIDITY_LIBS)
-libgsttimidity_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgsttimidity_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-endif
-
if USE_WILDMIDI
plugin_LTLIBRARIES += libgstwildmidi.la
@@ -29,5 +15,5 @@ libgstwildmidi_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstwildmidi_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
endif
-noinst_HEADERS = gsttimidity.h gstwildmidi.h
+noinst_HEADERS = gstwildmidi.h
diff --git a/ext/timidity/README b/ext/wildmidi/README
index f883cd002..f883cd002 100644
--- a/ext/timidity/README
+++ b/ext/wildmidi/README
diff --git a/ext/timidity/gstwildmidi.c b/ext/wildmidi/gstwildmidi.c
index 7f380d6da..7f380d6da 100644
--- a/ext/timidity/gstwildmidi.c
+++ b/ext/wildmidi/gstwildmidi.c
diff --git a/ext/timidity/gstwildmidi.h b/ext/wildmidi/gstwildmidi.h
index 54a915b30..54a915b30 100644
--- a/ext/timidity/gstwildmidi.h
+++ b/ext/wildmidi/gstwildmidi.h
diff --git a/ext/xvid/Makefile.am b/ext/xvid/Makefile.am
deleted file mode 100644
index 016f3736a..000000000
--- a/ext/xvid/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-plugin_LTLIBRARIES = libgstxvid.la
-
-libgstxvid_la_SOURCES = gstxvidenc.c gstxviddec.c gstxvid.c
-libgstxvid_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(XVID_CFLAGS)
-libgstxvid_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(XVID_LIBS)
-libgstxvid_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstxvid_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-noinst_HEADERS = gstxvidenc.h gstxviddec.h gstxvid.h
diff --git a/ext/xvid/gstxvid.c b/ext/xvid/gstxvid.c
deleted file mode 100644
index 9d0d150cc..000000000
--- a/ext/xvid/gstxvid.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/* GStreamer xvid encoder/decoder plugin
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <xvid.h>
-
-#include <gst/video/video.h>
-#include "gstxviddec.h"
-#include "gstxvidenc.h"
-
-gboolean
-gst_xvid_init (void)
-{
- xvid_gbl_init_t xinit;
- gint ret;
- static gboolean is_init = FALSE;
-
- /* only init once */
- if (is_init == TRUE) {
- return TRUE;
- }
-
- /* set up xvid initially (function pointers, CPU flags) */
- gst_xvid_init_struct (xinit);
-
- if ((ret = xvid_global (NULL, XVID_GBL_INIT, &xinit, NULL)) < 0) {
- g_warning ("Failed to initialize XviD: %s (%d)", gst_xvid_error (ret), ret);
- return FALSE;
- }
-
- GST_LOG ("Initted XviD version %d.%d.%d (API %d.%d)",
- XVID_VERSION_MAJOR (XVID_VERSION),
- XVID_VERSION_MINOR (XVID_VERSION),
- XVID_VERSION_PATCH (XVID_VERSION),
- XVID_API_MAJOR (XVID_API), XVID_API_MINOR (XVID_API));
-
- is_init = TRUE;
- return TRUE;
-}
-
-const gchar *
-gst_xvid_error (int errorcode)
-{
- const gchar *error;
-
- switch (errorcode) {
- case XVID_ERR_FAIL:
- error = "Operation failed";
- break;
- case 0:
- error = "No error";
- break;
- case XVID_ERR_MEMORY:
- error = "Memory allocation error";
- break;
- case XVID_ERR_FORMAT:
- error = "File format not supported";
- break;
- case XVID_ERR_VERSION:
- error = "Structure version not supported";
- break;
- default:
- error = "Unknown error";
- break;
- }
-
- return error;
-}
-
-gint
-gst_xvid_structure_to_csp (GstStructure * structure)
-{
- const gchar *mime = gst_structure_get_name (structure);
- gint xvid_cs = -1;
-
- if (!strcmp (mime, "video/x-raw-yuv")) {
- guint32 fourcc;
-
- gst_structure_get_fourcc (structure, "format", &fourcc);
- switch (fourcc) {
- case GST_MAKE_FOURCC ('I', '4', '2', '0'):
- xvid_cs = XVID_CSP_I420;
- break;
- case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
- xvid_cs = XVID_CSP_YUY2;
- break;
- case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
- xvid_cs = XVID_CSP_YV12;
- break;
- case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
- xvid_cs = XVID_CSP_UYVY;
- break;
- case GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'):
- xvid_cs = XVID_CSP_YVYU;
- break;
- }
- } else {
- gint depth, bpp, r_mask;
-
- gst_structure_get_int (structure, "depth", &depth);
- gst_structure_get_int (structure, "bpp", &bpp);
- gst_structure_get_int (structure, "red_mask", &r_mask);
-
- switch (depth) {
- case 15:
- xvid_cs = XVID_CSP_RGB555;
- break;
- case 16:
- xvid_cs = XVID_CSP_RGB565;
- break;
- case 24:
- if (bpp == 24) {
- xvid_cs = XVID_CSP_BGR;
- } else {
- switch (r_mask) {
- case 0xff000000:
- xvid_cs = XVID_CSP_RGBA;
- break;
-#ifdef XVID_CSP_ARGB
- case 0x00ff0000:
- xvid_cs = XVID_CSP_ARGB;
- break;
-#endif
- case 0x0000ff00:
- xvid_cs = XVID_CSP_BGRA;
- break;
- case 0x000000ff:
- xvid_cs = XVID_CSP_ABGR;
- break;
- }
- }
- break;
- default:
- break;
- }
-
- }
-
- return xvid_cs;
-}
-
-GstCaps *
-gst_xvid_csp_to_caps (gint csp, gint w, gint h)
-{
- GstStructure *structure = NULL;
-
- switch (csp) {
- case XVID_CSP_RGB555:
- case XVID_CSP_RGB565:
- case XVID_CSP_BGR:
- case XVID_CSP_ABGR:
- case XVID_CSP_BGRA:
-#ifdef XVID_CSP_ARGB
- case XVID_CSP_ARGB:
-#endif
- case XVID_CSP_RGBA:{
- gint r_mask = 0, b_mask = 0, g_mask = 0,
- endianness = 0, bpp = 0, depth = 0;
-
- switch (csp) {
- case XVID_CSP_RGB555:
- r_mask = GST_VIDEO_COMP1_MASK_15_INT;
- g_mask = GST_VIDEO_COMP2_MASK_15_INT;
- b_mask = GST_VIDEO_COMP3_MASK_15_INT;
- endianness = G_BYTE_ORDER;
- depth = 15;
- bpp = 16;
- break;
- case XVID_CSP_RGB565:
- r_mask = GST_VIDEO_COMP1_MASK_16_INT;
- g_mask = GST_VIDEO_COMP2_MASK_16_INT;
- b_mask = GST_VIDEO_COMP3_MASK_16_INT;
- endianness = G_BYTE_ORDER;
- depth = 16;
- bpp = 16;
- break;
- case XVID_CSP_BGR:
- r_mask = 0x0000ff;
- g_mask = 0x00ff00;
- b_mask = 0xff0000;
- endianness = G_BIG_ENDIAN;
- depth = 24;
- bpp = 24;
- break;
- case XVID_CSP_ABGR:
- r_mask = 0x000000ff;
- g_mask = 0x0000ff00;
- b_mask = 0x00ff0000;
- endianness = G_BIG_ENDIAN;
- depth = 24;
- bpp = 32;
- break;
- case XVID_CSP_BGRA:
- r_mask = 0x0000ff00;
- g_mask = 0x00ff0000;
- b_mask = 0xff000000;
- endianness = G_BIG_ENDIAN;
- depth = 24;
- bpp = 32;
- break;
-#ifdef XVID_CSP_ARGB
- case XVID_CSP_ARGB:
- r_mask = 0x00ff0000;
- g_mask = 0x0000ff00;
- b_mask = 0x000000ff;
- endianness = G_BIG_ENDIAN;
- depth = 24;
- bpp = 32;
- break;
-#endif
- case XVID_CSP_RGBA:
- r_mask = 0xff000000;
- g_mask = 0x00ff0000;
- b_mask = 0x0000ff00;
- endianness = G_BIG_ENDIAN;
- depth = 24;
- bpp = 32;
- break;
- }
-
- structure = gst_structure_new ("video/x-raw-rgb",
- "width", G_TYPE_INT, w,
- "height", G_TYPE_INT, h,
- "depth", G_TYPE_INT, depth,
- "bpp", G_TYPE_INT, bpp,
- "endianness", G_TYPE_INT, endianness,
- "red_mask", G_TYPE_INT, r_mask,
- "green_mask", G_TYPE_INT, g_mask,
- "blue_mask", G_TYPE_INT, b_mask, NULL);
- break;
- }
-
- case XVID_CSP_YUY2:
- case XVID_CSP_YVYU:
- case XVID_CSP_UYVY:
- case XVID_CSP_I420:
- case XVID_CSP_YV12:{
- guint32 fourcc = 0;
-
- switch (csp) {
- case XVID_CSP_YUY2:
- fourcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2');
- break;
- case XVID_CSP_YVYU:
- fourcc = GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U');
- break;
- case XVID_CSP_UYVY:
- fourcc = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y');
- break;
- case XVID_CSP_I420:
- fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0');
- break;
- case XVID_CSP_YV12:
- fourcc = GST_MAKE_FOURCC ('Y', 'V', '1', '2');
- break;
- }
-
- structure = gst_structure_new ("video/x-raw-yuv",
- "width", G_TYPE_INT, w,
- "height", G_TYPE_INT, h, "format", GST_TYPE_FOURCC, fourcc, NULL);
- break;
- }
- }
-
- return gst_caps_new_full (structure, NULL);
-}
-
-
-gint
-gst_xvid_image_get_size (gint csp, gint width, gint height)
-{
- xvid_image_t dummy_im;
-
- return gst_xvid_image_fill (&dummy_im, NULL, csp, width, height);
-}
-
-gint
-gst_xvid_image_fill (xvid_image_t * im, void *ptr, gint csp,
- gint width, gint height)
-{
- gint stride, h2, size = 0;
-
- im->csp = csp;
-
- switch (csp) {
- case XVID_CSP_I420:
- case XVID_CSP_YV12:
- /* planar */
- /* luma */
- stride = GST_ROUND_UP_4 (width);
- h2 = GST_ROUND_UP_2 (height);
- im->stride[0] = stride;
- im->plane[0] = ptr;
- /* chroma */
- im->plane[1] = ((guint8 *) im->plane[0]) + (stride * h2);
- size += stride * height;
- stride = GST_ROUND_UP_8 (width) / 2;
- h2 = GST_ROUND_UP_2 (height) / 2;
- im->stride[1] = stride;
-
- im->plane[2] = ((guint8 *) im->plane[1]) + (stride * h2);
- im->stride[2] = stride;
- size += 2 * (stride * h2);
- break;
- case XVID_CSP_RGB555:
- case XVID_CSP_RGB565:
- case XVID_CSP_YUY2:
- case XVID_CSP_UYVY:
- case XVID_CSP_YVYU:
- /* packed */
- stride = GST_ROUND_UP_4 (width * 2);
- im->plane[0] = ptr;
- im->stride[0] = stride;
- size = stride * height;
- break;
- case XVID_CSP_BGR:
- stride = GST_ROUND_UP_4 (width * 3);
- im->plane[0] = ptr;
- im->stride[0] = stride;
- size = stride * height * 2;
- break;
- case XVID_CSP_ABGR:
- case XVID_CSP_BGRA:
- case XVID_CSP_RGBA:
-#ifdef XVID_CSP_ARGB
- case XVID_CSP_ARGB:
-#endif
- stride = width * 4;
- im->plane[0] = ptr;
- im->stride[0] = stride;
- size = stride * height;
- break;
- }
-
- return size;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- return (gst_element_register (plugin, "xvidenc",
- GST_RANK_SECONDARY, GST_TYPE_XVIDENC) &&
- gst_element_register (plugin, "xviddec",
- GST_RANK_NONE, GST_TYPE_XVIDDEC));
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- xvid,
- "XviD plugin library", plugin_init, VERSION, "GPL", GST_PACKAGE_NAME,
- GST_PACKAGE_ORIGIN)
diff --git a/ext/xvid/gstxvid.h b/ext/xvid/gstxvid.h
deleted file mode 100644
index fd08ba90e..000000000
--- a/ext/xvid/gstxvid.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* GStreamer xvid encoder/decoder plugin
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_XVID_H__
-#define __GST_XVID_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define gst_xvid_init_struct(s) \
- do { \
- memset (&s, 0, sizeof(s)); \
- s.version = XVID_VERSION; \
- } while (0);
-
-#define RGB_24_32_STATIC_CAPS(bpp, r_mask,g_mask,b_mask) \
- "video/x-raw-rgb, " \
- "width = (int) [ 0, MAX ], " \
- "height = (int) [ 0, MAX], " \
- "framerate = (fraction) [ 0, MAX], " \
- "depth = (int) 24, " \
- "bpp = (int) " G_STRINGIFY (bpp) ", " \
- "endianness = (int) BIG_ENDIAN, " \
- "red_mask = (int) " G_STRINGIFY (r_mask) ", " \
- "green_mask = (int) " G_STRINGIFY (g_mask) ", " \
- "blue_mask = (int) " G_STRINGIFY (b_mask)
-
-extern const gchar *gst_xvid_error (int errorcode);
-extern gboolean gst_xvid_init (void);
-
-extern gint gst_xvid_structure_to_csp (GstStructure *structure);
-extern GstCaps * gst_xvid_csp_to_caps (gint csp, gint w, gint h);
-extern gint gst_xvid_image_get_size (gint csp,
- gint width, gint height);
-extern gint gst_xvid_image_fill (xvid_image_t * im, void * ptr, gint csp,
- gint width, gint height);
-
-G_END_DECLS
-
-#endif /* __GST_XVID_H__ */
diff --git a/ext/xvid/gstxviddec.c b/ext/xvid/gstxviddec.c
deleted file mode 100644
index b49cf2fad..000000000
--- a/ext/xvid/gstxviddec.c
+++ /dev/null
@@ -1,673 +0,0 @@
-/* GStreamer xvid decoder plugin
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- * (C) 2006 Mark Nauwelaerts <manauw@skynet.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <xvid.h>
-
-#include <gst/video/video.h>
-#include "gstxviddec.h"
-
-static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-xvid, "
- "width = (int) [ 0, MAX ], "
- "height = (int) [ 0, MAX ], " "framerate = (fraction) [ 0/1, MAX ]; "
- "video/mpeg, "
- "mpegversion = (int) 4, "
- "systemstream = (boolean) FALSE, "
- "width = (int) [ 0, MAX ], "
- "height = (int) [ 0, MAX ], " "framerate = (fraction) [ 0/1, MAX ]")
- );
-
-static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YUY2, YV12, YVYU, UYVY }")
- "; " RGB_24_32_STATIC_CAPS (32, 0x00ff0000, 0x0000ff00,
- 0x000000ff) "; " RGB_24_32_STATIC_CAPS (32, 0xff000000, 0x00ff0000,
- 0x0000ff00) "; " RGB_24_32_STATIC_CAPS (32, 0x0000ff00, 0x00ff0000,
- 0xff000000) "; " RGB_24_32_STATIC_CAPS (32, 0x000000ff, 0x0000ff00,
- 0x00ff0000) "; " RGB_24_32_STATIC_CAPS (24, 0x0000ff, 0x00ff00,
- 0xff0000) "; " GST_VIDEO_CAPS_RGB_15 "; " GST_VIDEO_CAPS_RGB_16)
- );
-
-GST_DEBUG_CATEGORY_STATIC (xviddec_debug);
-#define GST_CAT_DEFAULT xviddec_debug
-
-static void gst_xviddec_base_init (GstXvidDecClass * klass);
-static void gst_xviddec_class_init (GstXvidDecClass * klass);
-static void gst_xviddec_init (GstXvidDec * dec);
-static void gst_xviddec_reset (GstXvidDec * dec);
-static gboolean gst_xviddec_handle_sink_event (GstPad * pad, GstEvent * event);
-static GstFlowReturn gst_xviddec_chain (GstPad * pad, GstBuffer * buf);
-static gboolean gst_xviddec_setcaps (GstPad * pad, GstCaps * caps);
-static void gst_xviddec_flush_buffers (GstXvidDec * dec, gboolean send);
-static GstStateChangeReturn gst_xviddec_change_state (GstElement * element,
- GstStateChange transition);
-
-
-static GstElementClass *parent_class = NULL;
-
-GType
-gst_xviddec_get_type (void)
-{
- static GType xviddec_type = 0;
-
- if (!xviddec_type) {
- static const GTypeInfo xviddec_info = {
- sizeof (GstXvidDecClass),
- (GBaseInitFunc) gst_xviddec_base_init,
- NULL,
- (GClassInitFunc) gst_xviddec_class_init,
- NULL,
- NULL,
- sizeof (GstXvidDec),
- 0,
- (GInstanceInitFunc) gst_xviddec_init,
- };
-
- xviddec_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstXvidDec", &xviddec_info, 0);
- }
- return xviddec_type;
-}
-
-static void
-gst_xviddec_base_init (GstXvidDecClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_static_pad_template (element_class, &sink_template);
- gst_element_class_add_static_pad_template (element_class, &src_template);
-
- gst_element_class_set_static_metadata (element_class, "XviD video decoder",
- "Codec/Decoder/Video",
- "XviD decoder based on xvidcore",
- "Ronald Bultje <rbultje@ronald.bitfreak.net>");
-}
-
-static void
-gst_xviddec_class_init (GstXvidDecClass * klass)
-{
- GstElementClass *gstelement_class = (GstElementClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- GST_DEBUG_CATEGORY_INIT (xviddec_debug, "xviddec", 0, "XviD decoder");
-
- gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_xviddec_change_state);
-}
-
-
-static void
-gst_xviddec_init (GstXvidDec * dec)
-{
- /* create the sink pad */
- dec->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
- gst_pad_set_chain_function (dec->sinkpad,
- GST_DEBUG_FUNCPTR (gst_xviddec_chain));
- gst_pad_set_setcaps_function (dec->sinkpad,
- GST_DEBUG_FUNCPTR (gst_xviddec_setcaps));
- gst_pad_set_event_function (dec->sinkpad,
- GST_DEBUG_FUNCPTR (gst_xviddec_handle_sink_event));
- gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad);
-
- /* create the src pad */
- dec->srcpad = gst_pad_new_from_static_template (&src_template, "src");
- gst_pad_use_fixed_caps (dec->srcpad);
- gst_element_add_pad (GST_ELEMENT (dec), dec->srcpad);
-
- gst_xviddec_reset (dec);
-}
-
-
-static void
-gst_xviddec_reset (GstXvidDec * dec)
-{
- /* size, etc. */
- dec->width = dec->height = dec->csp = -1;
- dec->fps_n = dec->par_n = -1;
- dec->fps_d = dec->par_d = 1;
- dec->next_ts = dec->next_dur = GST_CLOCK_TIME_NONE;
- dec->outbuf_size = 0;
-
- /* set xvid handle to NULL */
- dec->handle = NULL;
-
- /* no delayed timestamp to start with */
- dec->have_ts = FALSE;
-
- /* need keyframe to get going */
- dec->waiting_for_key = TRUE;
-}
-
-
-static void
-gst_xviddec_unset (GstXvidDec * dec)
-{
- /* release XviD decoder */
- xvid_decore (dec->handle, XVID_DEC_DESTROY, NULL, NULL);
- dec->handle = NULL;
-}
-
-
-static gboolean
-gst_xviddec_handle_sink_event (GstPad * pad, GstEvent * event)
-{
- GstXvidDec *dec = GST_XVIDDEC (GST_PAD_PARENT (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_EOS:
- gst_xviddec_flush_buffers (dec, TRUE);
- break;
- case GST_EVENT_FLUSH_STOP:
- gst_xviddec_flush_buffers (dec, FALSE);
- break;
- case GST_EVENT_NEWSEGMENT:
- /* don't really mind about the actual segment info,
- * but we do need to recover from this possible jump */
- /* FIXME, NEWSEGMENT is not a discontinuity. A decoder
- * should clip the output to the segment boundaries.
- * Also the rate field of the segment can be used to
- * optimize the decoding, like skipping B frames when
- * playing at double speed.
- * The DISCONT flag on buffers should be used to detect
- * discontinuities.
- */
- dec->waiting_for_key = TRUE;
- break;
- default:
- break;
- }
-
- return gst_pad_push_event (dec->srcpad, event);
-}
-
-
-static gboolean
-gst_xviddec_setup (GstXvidDec * dec)
-{
- xvid_dec_create_t xdec;
- gint ret;
-
- /* initialise parameters, see xvid documentation */
- gst_xvid_init_struct (xdec);
- /* let the decoder handle this, don't trust the container */
- xdec.width = 0;
- xdec.height = 0;
- xdec.handle = NULL;
-
- GST_DEBUG_OBJECT (dec, "Initializing xvid decoder with parameters "
- "%dx%d@%d", dec->width, dec->height, dec->csp);
-
- if ((ret = xvid_decore (NULL, XVID_DEC_CREATE, &xdec, NULL)) < 0) {
- GST_WARNING_OBJECT (dec, "Initializing xvid decoder failed: %s (%d)",
- gst_xvid_error (ret), ret);
- return FALSE;
- }
-
- dec->handle = xdec.handle;
-
- return TRUE;
-}
-
-
-static void
-gst_xviddec_add_par (GstStructure * structure,
- gint mux_par_n, gint mux_par_d, gint dec_par_n, gint dec_par_d)
-{
- /* muxer wins if decoder has nothing interesting to offer */
- if (dec_par_n == dec_par_d) {
- gst_structure_set (structure, "pixel-aspect-ratio", GST_TYPE_FRACTION,
- mux_par_n, mux_par_d, NULL);
- } else {
- gst_structure_set (structure, "pixel-aspect-ratio", GST_TYPE_FRACTION,
- dec_par_n, dec_par_d, NULL);
- }
-}
-
-
-/* based on the decoder info, if provided, and xviddec info,
- construct a caps and send on to src pad */
-static gboolean
-gst_xviddec_negotiate (GstXvidDec * dec, xvid_dec_stats_t * xstats)
-{
- gboolean ret;
- gint par_width, par_height;
- GstCaps *caps;
-
- /* note: setcaps call with no xstats info,
- so definitely need to negotiate then */
- if (xstats && (xstats->type != XVID_TYPE_VOL
- || (xstats->type == XVID_TYPE_VOL
- && dec->width == xstats->data.vol.width
- && dec->height == xstats->data.vol.height)))
- return TRUE;
-
- switch (xstats ? xstats->data.vol.par : XVID_PAR_11_VGA) {
- case XVID_PAR_11_VGA:
- par_width = par_height = 1;
- break;
- case XVID_PAR_43_PAL:
- case XVID_PAR_43_NTSC:
- par_width = 4;
- par_height = 3;
- break;
- case XVID_PAR_169_PAL:
- case XVID_PAR_169_NTSC:
- par_width = 16;
- par_height = 9;
- break;
- case XVID_PAR_EXT:
- default:
- par_width = xstats->data.vol.par_width;
- par_height = xstats->data.vol.par_height;
- }
-
- caps = gst_xvid_csp_to_caps (dec->csp, dec->width, dec->height);
-
- /* can only provide framerate if we received one */
- if (dec->fps_n != -1) {
- gst_structure_set (gst_caps_get_structure (caps, 0), "framerate",
- GST_TYPE_FRACTION, dec->fps_n, dec->fps_d, NULL);
- }
-
- gst_xviddec_add_par (gst_caps_get_structure (caps, 0),
- dec->par_n, dec->par_d, par_width, par_height);
-
- GST_LOG ("setting caps on source pad: %" GST_PTR_FORMAT, caps);
- ret = gst_pad_set_caps (dec->srcpad, caps);
- gst_caps_unref (caps);
-
- return ret;
-}
-
-static GstFlowReturn
-gst_xviddec_chain (GstPad * pad, GstBuffer * buf)
-{
- GstXvidDec *dec;
- GstBuffer *outbuf = NULL;
- xvid_dec_frame_t xframe;
- xvid_dec_stats_t xstats;
- gint ret;
- guint8 *data, *dupe = NULL;
- guint size;
- GstFlowReturn fret;
-
- dec = GST_XVIDDEC (GST_OBJECT_PARENT (pad));
-
- if (!dec->handle)
- goto not_negotiated;
-
- fret = GST_FLOW_OK;
-
- GST_LOG_OBJECT (dec, "Received buffer of time %" GST_TIME_FORMAT
- " duration %" GST_TIME_FORMAT ", size %d",
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
- GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), GST_BUFFER_SIZE (buf));
-
- if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DISCONT)) {
- /* FIXME: should we do anything here, like flush the decoder? */
- }
-
- data = GST_BUFFER_DATA (buf);
- size = GST_BUFFER_SIZE (buf);
-
- /* xvidcore overreads the input buffer, we need to alloc some extra padding
- * to make things work reliably */
-#define EXTRA_PADDING 16
- if (EXTRA_PADDING > 0) {
- dupe = g_malloc (size + EXTRA_PADDING);
- memcpy (dupe, data, size);
- memset (dupe + size, 0, EXTRA_PADDING);
- data = dupe;
- }
-
- do { /* loop needed because xvidcore may return vol information */
- /* decode and so ... */
- gst_xvid_init_struct (xframe);
- xframe.general = XVID_LOWDELAY;
- xframe.bitstream = (void *) data;
- xframe.length = size;
-
- gst_xvid_init_struct (xstats);
-
- if (outbuf == NULL) {
- fret = gst_pad_alloc_buffer (dec->srcpad, GST_BUFFER_OFFSET_NONE,
- dec->outbuf_size, GST_PAD_CAPS (dec->srcpad), &outbuf);
- if (fret != GST_FLOW_OK)
- goto done;
- }
-
- gst_xvid_image_fill (&xframe.output, GST_BUFFER_DATA (outbuf),
- dec->csp, dec->width, dec->height);
-
- ret = xvid_decore (dec->handle, XVID_DEC_DECODE, &xframe, &xstats);
- if (ret < 0)
- goto decode_error;
-
- GST_LOG_OBJECT (dec, "xvid produced output, type %d, consumed %d",
- xstats.type, ret);
-
- if (xstats.type == XVID_TYPE_VOL)
- gst_xviddec_negotiate (dec, &xstats);
-
- data += ret;
- size -= ret;
- } while (xstats.type <= 0 && size > 0);
-
- /* 1 byte is frequently left over */
- if (size > 1) {
- GST_WARNING_OBJECT (dec, "decoder did not consume all input");
- }
-
- /* FIXME, reflow the multiple return exit points */
- if (xstats.type > 0) { /* some real output was produced */
- if (G_UNLIKELY (dec->waiting_for_key)) {
- if (xstats.type != XVID_TYPE_IVOP)
- goto dropping;
-
- dec->waiting_for_key = FALSE;
- }
- /* bframes can cause a delay in frames being returned
- non keyframe timestamps can permute a bit between
- encode and display order, but should match for keyframes */
- if (dec->have_ts) {
- GST_BUFFER_TIMESTAMP (outbuf) = dec->next_ts;
- GST_BUFFER_DURATION (outbuf) = dec->next_dur;
- dec->next_ts = GST_BUFFER_TIMESTAMP (buf);
- dec->next_dur = GST_BUFFER_DURATION (buf);
- } else {
- GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
- GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf);
- }
- gst_buffer_set_caps (outbuf, GST_PAD_CAPS (dec->srcpad));
- GST_LOG_OBJECT (dec, "pushing buffer with pts %" GST_TIME_FORMAT
- " duration %" GST_TIME_FORMAT,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
- GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)));
- fret = gst_pad_push (dec->srcpad, outbuf);
-
- } else { /* no real output yet, delay in frames being returned */
- if (G_UNLIKELY (dec->have_ts)) {
- GST_WARNING_OBJECT (dec,
- "xvid decoder produced no output, but timestamp %" GST_TIME_FORMAT
- " already queued", GST_TIME_ARGS (dec->next_ts));
- } else {
- dec->have_ts = TRUE;
- dec->next_ts = GST_BUFFER_TIMESTAMP (buf);
- dec->next_dur = GST_BUFFER_DURATION (buf);
- }
- gst_buffer_unref (outbuf);
- }
-
-done:
- g_free (dupe);
- gst_buffer_unref (buf);
-
- return fret;
-
- /* ERRORS */
-not_negotiated:
- {
- GST_ELEMENT_ERROR (dec, CORE, NEGOTIATION, (NULL),
- ("format wasn't negotiated before chain function"));
- fret = GST_FLOW_NOT_NEGOTIATED;
- goto done;
- }
-decode_error:
- {
- /* FIXME: shouldn't error out fatally/properly after N decoding errors? */
- GST_ELEMENT_WARNING (dec, STREAM, DECODE, (NULL),
- ("Error decoding xvid frame: %s (%d)", gst_xvid_error (ret), ret));
- if (outbuf)
- gst_buffer_unref (outbuf);
- goto done;
- }
-dropping:
- {
- GST_WARNING_OBJECT (dec, "Dropping non-keyframe (seek/init)");
- if (outbuf)
- gst_buffer_unref (outbuf);
- goto done;
- }
-}
-
-
-/* flush xvid encoder buffers caused by bframe usage;
- not well tested */
-static void
-gst_xviddec_flush_buffers (GstXvidDec * dec, gboolean send)
-{
-#if 0
- gint ret;
- GstBuffer *outbuf = NULL;
- xvid_dec_frame_t xframe;
- xvid_dec_stats_t xstats;
-#endif
-
- GST_DEBUG_OBJECT (dec, "flushing buffers with send %d, have_ts %d",
- send, dec->have_ts);
-
- /* no need to flush if there is no delayed time-stamp */
- if (!dec->have_ts)
- return;
-
- /* flushing must reset the timestamp keeping */
- dec->have_ts = FALSE;
-
- /* also no need to flush if no handle */
- if (!dec->handle)
- return;
-
- /* unlike encoder, decoder does not seem to like flushing, disable for now */
-#if 0
- gst_xvid_init_struct (xframe);
- gst_xvid_init_struct (xstats);
-
- /* init a fake frame to force flushing */
- xframe.bitstream = NULL;
- xframe.length = -1;
-
- ret = gst_xviddec_decode (dec, xframe, &outbuf, &xstats);
- GST_DEBUG_OBJECT (dec, "received frame when flushing, type %d, size %d",
- xstats.type, ret);
-
- if (ret > 0 && send) {
- /* we have some valid return frame, give it the delayed timestamp and send */
- GST_BUFFER_TIMESTAMP (outbuf) = dec->next_ts;
- GST_BUFFER_DURATION (outbuf) = dec->next_dur;
-
- gst_buffer_set_caps (outbuf, GST_PAD_CAPS (dec->srcpad));
- gst_pad_push (dec->srcpad, outbuf);
- return;
- }
-
- if (outbuf)
- gst_buffer_unref (outbuf);
-#else
- return;
-#endif
-}
-
-#if 0
-static GstCaps *
-gst_xviddec_src_getcaps (GstPad * pad)
-{
- GstXvidDec *dec = GST_XVIDDEC (GST_PAD_PARENT (pad));
- GstCaps *caps;
- gint csp[] = {
- XVID_CSP_I420,
- XVID_CSP_YV12,
- XVID_CSP_YUY2,
- XVID_CSP_UYVY,
- XVID_CSP_YVYU,
- XVID_CSP_BGRA,
- XVID_CSP_ABGR,
- XVID_CSP_RGBA,
-#ifdef XVID_CSP_ARGB
- XVID_CSP_ARGB,
-#endif
- XVID_CSP_BGR,
- XVID_CSP_RGB555,
- XVID_CSP_RGB565,
- 0
- }, i;
-
- if (!GST_PAD_CAPS (dec->sinkpad)) {
- GstPadTemplate *templ = gst_static_pad_template_get (&src_template);
-
- return gst_caps_copy (gst_pad_template_get_caps (templ));
- }
-
- caps = gst_caps_new_empty ();
- for (i = 0; csp[i] != 0; i++) {
- GstCaps *one = gst_xvid_csp_to_caps (csp[i], dec->width,
- dec->height, dec->fps, dec->par);
-
- gst_caps_append (caps, one);
- }
-
- return caps;
-}
-#endif
-
-static gboolean
-gst_xviddec_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstXvidDec *dec = GST_XVIDDEC (GST_PAD_PARENT (pad));
- GstStructure *structure;
- GstCaps *allowed_caps;
- const GValue *val;
-
- GST_LOG_OBJECT (dec, "caps %" GST_PTR_FORMAT, caps);
-
- /* if there's something old around, remove it */
- if (dec->handle) {
- gst_xviddec_unset (dec);
- }
-
- structure = gst_caps_get_structure (caps, 0);
- gst_structure_get_int (structure, "width", &dec->width);
- gst_structure_get_int (structure, "height", &dec->height);
-
- /* perhaps some fps info */
- val = gst_structure_get_value (structure, "framerate");
- if ((val != NULL) && GST_VALUE_HOLDS_FRACTION (val)) {
- dec->fps_n = gst_value_get_fraction_numerator (val);
- dec->fps_d = gst_value_get_fraction_denominator (val);
- } else {
- dec->fps_n = -1;
- dec->fps_d = 1;
- }
-
- /* perhaps some par info */
- val = gst_structure_get_value (structure, "pixel-aspect-ratio");
- if (val != NULL && GST_VALUE_HOLDS_FRACTION (val)) {
- dec->par_n = gst_value_get_fraction_numerator (val);
- dec->par_d = gst_value_get_fraction_denominator (val);
- } else {
- dec->par_n = 1;
- dec->par_d = 1;
- }
-
- /* we try to find the preferred/accept csp */
- allowed_caps = gst_pad_get_allowed_caps (dec->srcpad);
- if (!allowed_caps) {
- GST_DEBUG_OBJECT (dec, "... but no peer, using template caps");
- /* need to copy because get_allowed_caps returns a ref,
- and get_pad_template_caps doesn't */
- allowed_caps = gst_caps_copy (gst_pad_get_pad_template_caps (dec->srcpad));
- }
- GST_LOG_OBJECT (dec, "allowed source caps %" GST_PTR_FORMAT, allowed_caps);
-
- /* pick the first one ... */
- structure = gst_caps_get_structure (allowed_caps, 0);
- val = gst_structure_get_value (structure, "format");
- if (val != NULL && G_VALUE_TYPE (val) == GST_TYPE_LIST) {
- GValue temp = { 0, };
- gst_value_init_and_copy (&temp, gst_value_list_get_value (val, 0));
- gst_structure_set_value (structure, "format", &temp);
- g_value_unset (&temp);
- }
-
- /* ... and use its info to get the csp */
- dec->csp = gst_xvid_structure_to_csp (structure);
- if (dec->csp == -1) {
- GST_WARNING_OBJECT (dec, "failed to decide on colorspace, using I420");
- dec->csp = XVID_CSP_I420;
- }
-
- dec->outbuf_size =
- gst_xvid_image_get_size (dec->csp, dec->width, dec->height);
-
- GST_LOG_OBJECT (dec, "csp=%d, outbuf_size=%d", dec->csp, dec->outbuf_size);
-
- gst_caps_unref (allowed_caps);
-
- /* now set up xvid ... */
- if (!gst_xviddec_setup (dec)) {
- GST_ELEMENT_ERROR (GST_ELEMENT (dec), LIBRARY, INIT, (NULL), (NULL));
- return FALSE;
- }
-
- return gst_xviddec_negotiate (dec, NULL);
-}
-
-static GstStateChangeReturn
-gst_xviddec_change_state (GstElement * element, GstStateChange transition)
-{
- GstXvidDec *dec = GST_XVIDDEC (element);
- GstStateChangeReturn ret;
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- if (!gst_xvid_init ())
- return GST_STATE_CHANGE_FAILURE;
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- if (ret == GST_STATE_CHANGE_FAILURE)
- goto done;
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- gst_xviddec_flush_buffers (dec, FALSE);
- if (dec->handle) {
- gst_xviddec_unset (dec);
- }
- gst_xviddec_reset (dec);
- break;
- default:
- break;
- }
-
-done:
- return ret;
-}
diff --git a/ext/xvid/gstxviddec.h b/ext/xvid/gstxviddec.h
deleted file mode 100644
index ac3f0ebb8..000000000
--- a/ext/xvid/gstxviddec.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* GStreamer xvid decoder plugin
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_XVIDDEC_H__
-#define __GST_XVIDDEC_H__
-
-#include <gst/gst.h>
-#include "gstxvid.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_XVIDDEC \
- (gst_xviddec_get_type())
-#define GST_XVIDDEC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_XVIDDEC, GstXvidDec))
-#define GST_XVIDDEC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_XVIDDEC, GstXvidDecClass))
-#define GST_IS_XVIDDEC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_XVIDDEC))
-#define GST_IS_XVIDDEC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_XVIDDEC))
-
-typedef struct _GstXvidDec GstXvidDec;
-typedef struct _GstXvidDecClass GstXvidDecClass;
-
-struct _GstXvidDec {
- GstElement element;
-
- /* pads */
- GstPad *sinkpad, *srcpad;
-
- /* xvid handle */
- void *handle;
-
- /* video (output) settings */
- gint csp;
- gint width, height;
- gint fps_n, fps_d, par_n, par_d;
- gint outbuf_size;
-
- /* whether in need for keyframe */
- gboolean waiting_for_key;
-
- /* retain some info on delayed frame */
- gboolean have_ts;
- GstClockTime next_ts, next_dur;
-};
-
-struct _GstXvidDecClass {
- GstElementClass parent_class;
-};
-
-GType gst_xviddec_get_type(void);
-
-G_END_DECLS
-
-#endif /* __GST_XVIDDEC_H__ */
diff --git a/ext/xvid/gstxvidenc.c b/ext/xvid/gstxvidenc.c
deleted file mode 100644
index edf89b7db..000000000
--- a/ext/xvid/gstxvidenc.c
+++ /dev/null
@@ -1,1403 +0,0 @@
-/* GStreamer xvid encoder plugin
- * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
- * (C) 2006 Mark Nauwelaerts <manauw@skynet.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/* based on:
- * - the original xvidenc (by Ronald Bultje)
- * - transcode/mplayer's xvid encoder (by Edouard Gomez)
- *
- * TODO some documentation (e.g. on properties)
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include <xvid.h>
-
-#include <gst/video/video.h>
-#include "gstxvidenc.h"
-
-static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YUY2, YV12, YVYU, UYVY }")
- "; " RGB_24_32_STATIC_CAPS (32, 0x00ff0000, 0x0000ff00,
- 0x000000ff) "; " RGB_24_32_STATIC_CAPS (32, 0xff000000, 0x00ff0000,
- 0x0000ff00) "; " RGB_24_32_STATIC_CAPS (32, 0x0000ff00, 0x00ff0000,
- 0xff000000) "; " RGB_24_32_STATIC_CAPS (32, 0x000000ff, 0x0000ff00,
- 0x00ff0000) "; " RGB_24_32_STATIC_CAPS (24, 0x0000ff, 0x00ff00,
- 0xff0000) "; " GST_VIDEO_CAPS_RGB_15 "; " GST_VIDEO_CAPS_RGB_16)
- );
-
-static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/mpeg, "
- "mpegversion = (int) 4, "
- "systemstream = (boolean) FALSE, "
- "width = (int) [ 0, MAX ], "
- "height = (int) [ 0, MAX ], "
- "framerate = (fraction) [ 0/1, MAX ], "
- "profile = (string) simple, "
- "level = (string) { 0, 1, 2, 3, 4a, 5, 6 };"
- "video/mpeg, "
- "mpegversion = (int) 4, "
- "systemstream = (boolean) FALSE, "
- "width = (int) [ 0, MAX ], "
- "height = (int) [ 0, MAX ], "
- "framerate = (fraction) [ 0/1, MAX ], "
- "profile = (string) advanced-real-time-simple, "
- "level = (string) { 1, 2, 3, 4 };"
- "video/mpeg, "
- "mpegversion = (int) 4, "
- "systemstream = (boolean) FALSE, "
- "width = (int) [ 0, MAX ], "
- "height = (int) [ 0, MAX ], "
- "framerate = (fraction) [ 0/1, MAX ], "
- "profile = (string) advanced-simple, "
- "level = (string) { 0, 1, 2, 3, 4 };"
- "video/mpeg, "
- "mpegversion = (int) 4, "
- "systemstream = (boolean) FALSE, "
- "width = (int) [ 0, MAX ], " "height = (int) [ 0, MAX ]; "
- "video/x-xvid, "
- "width = (int) [ 0, MAX ], "
- "height = (int) [ 0, MAX ], " "framerate = (fraction) [ 0/1, MAX ];")
- );
-
-
-/* XvidEnc properties */
-
-/* maximum property-id */
-static int xvidenc_prop_count;
-
-/* quark used for named pointer on param specs */
-static GQuark xvidenc_pspec_quark;
-
-GST_DEBUG_CATEGORY_STATIC (xvidenc_debug);
-#define GST_CAT_DEFAULT xvidenc_debug
-
-static void gst_xvidenc_base_init (GstXvidEncClass * klass);
-static void gst_xvidenc_class_init (GstXvidEncClass * klass);
-static void gst_xvidenc_init (GstXvidEnc * xvidenc);
-static void gst_xvidenc_finalize (GObject * object);
-static GstFlowReturn gst_xvidenc_chain (GstPad * pad, GstBuffer * data);
-static gboolean gst_xvidenc_setcaps (GstPad * pad, GstCaps * vscapslist);
-static GstCaps *gst_xvidenc_getcaps (GstPad * pad);
-static void gst_xvidenc_flush_buffers (GstXvidEnc * xvidenc, gboolean send);
-static gboolean gst_xvidenc_handle_sink_event (GstPad * pad, GstEvent * event);
-
-/* properties */
-static void gst_xvidenc_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_xvidenc_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-static GstStateChangeReturn gst_xvidenc_change_state (GstElement * element,
- GstStateChange transition);
-
-static GstElementClass *parent_class = NULL;
-
-#define GST_TYPE_XVIDENC_PROFILE (gst_xvidenc_profile_get_type ())
-static GType
-gst_xvidenc_profile_get_type (void)
-{
- static GType xvidenc_profile_type = 0;
-
- if (!xvidenc_profile_type) {
- static const GEnumValue xvidenc_profiles[] = {
- {0, "UNP", "Unrestricted profile"},
- {XVID_PROFILE_S_L0, "S_L0", "Simple profile, L0"},
- {XVID_PROFILE_S_L1, "S_L1", "Simple profile, L1"},
- {XVID_PROFILE_S_L2, "S_L2", "Simple profile, L2"},
- {XVID_PROFILE_S_L3, "S_L3", "Simple profile, L3"},
- {XVID_PROFILE_S_L4a, "S_L4a", "Simple profile, L4a"},
- {XVID_PROFILE_S_L5, "S_L5", "Simple profile, L5"},
- {XVID_PROFILE_S_L6, "S_L6", "Simple profile, L6"},
- {XVID_PROFILE_ARTS_L1, "ARTS_L1",
- "Advanced real-time simple profile, L1"},
- {XVID_PROFILE_ARTS_L2, "ARTS_L2",
- "Advanced real-time simple profile, L2"},
- {XVID_PROFILE_ARTS_L3, "ARTS_L3",
- "Advanced real-time simple profile, L3"},
- {XVID_PROFILE_ARTS_L4, "ARTS_L4",
- "Advanced real-time simple profile, L4"},
- {XVID_PROFILE_AS_L0, "AS_L0", "Advanced simple profile, L0"},
- {XVID_PROFILE_AS_L1, "AS_L1", "Advanced simple profile, L1"},
- {XVID_PROFILE_AS_L2, "AS_L2", "Advanced simple profile, L2"},
- {XVID_PROFILE_AS_L3, "AS_L3", "Advanced simple profile, L3"},
- {XVID_PROFILE_AS_L4, "AS_L4", "Advanced simple profile, L4"},
- {0, NULL, NULL},
- };
-
- xvidenc_profile_type =
- g_enum_register_static ("GstXvidEncProfiles", xvidenc_profiles);
- }
-
- return xvidenc_profile_type;
-}
-
-#define GST_TYPE_XVIDENC_QUANT_TYPE (gst_xvidenc_quant_type_get_type ())
-static GType
-gst_xvidenc_quant_type_get_type (void)
-{
- static GType xvidenc_quant_type_type = 0;
-
- if (!xvidenc_quant_type_type) {
- static const GEnumValue xvidenc_quant_types[] = {
- {0, "H263 quantization", "h263"},
- {XVID_VOL_MPEGQUANT, "MPEG quantization", "mpeg"},
- {0, NULL, NULL},
- };
-
- xvidenc_quant_type_type =
- g_enum_register_static ("GstXvidEncQuantTypes", xvidenc_quant_types);
- }
-
- return xvidenc_quant_type_type;
-}
-
-
-enum
-{
- XVIDENC_CBR,
- XVIDENC_VBR_PASS1,
- XVIDENC_VBR_PASS2,
- XVIDENC_QUANT
-};
-
-#define GST_TYPE_XVIDENC_PASS (gst_xvidenc_pass_get_type ())
-static GType
-gst_xvidenc_pass_get_type (void)
-{
- static GType xvidenc_pass_type = 0;
-
- if (!xvidenc_pass_type) {
- static const GEnumValue xvidenc_passes[] = {
- {XVIDENC_CBR, "Constant Bitrate Encoding", "cbr"},
- {XVIDENC_QUANT, "Constant Quantizer", "quant"},
- {XVIDENC_VBR_PASS1, "VBR Encoding - Pass 1", "pass1"},
- {XVIDENC_VBR_PASS2, "VBR Encoding - Pass 2", "pass2"},
- {0, NULL, NULL},
- };
-
- xvidenc_pass_type =
- g_enum_register_static ("GstXvidEncPasses", xvidenc_passes);
- }
-
- return xvidenc_pass_type;
-}
-
-
-GType
-gst_xvidenc_get_type (void)
-{
- static GType xvidenc_type = 0;
-
- if (!xvidenc_type) {
- static const GTypeInfo xvidenc_info = {
- sizeof (GstXvidEncClass),
- (GBaseInitFunc) gst_xvidenc_base_init,
- NULL,
- (GClassInitFunc) gst_xvidenc_class_init,
- NULL,
- NULL,
- sizeof (GstXvidEnc),
- 0,
- (GInstanceInitFunc) gst_xvidenc_init,
- };
- const GInterfaceInfo preset_interface_info = {
- NULL, /* interface_init */
- NULL, /* interface_finalize */
- NULL /* interface_data */
- };
-
- xvidenc_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstXvidEnc", &xvidenc_info, 0);
-
- g_type_add_interface_static (xvidenc_type, GST_TYPE_PRESET,
- &preset_interface_info);
- }
- return xvidenc_type;
-}
-
-static void
-gst_xvidenc_base_init (GstXvidEncClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_static_pad_template (element_class, &sink_template);
- gst_element_class_add_static_pad_template (element_class, &src_template);
- gst_element_class_set_static_metadata (element_class, "XviD video encoder",
- "Codec/Encoder/Video",
- "XviD encoder based on xvidcore",
- "Ronald Bultje <rbultje@ronald.bitfreak.net>");
-}
-
-/* add property pspec to klass using the counter count,
- * and place info based on struct_type and member as a named pointer
- * specified by quark */
-#define gst_xvidenc_add_pspec_full(klass, pspec, count, quark, \
- struct_type, member) \
-G_STMT_START { \
- guint _offset = G_STRUCT_OFFSET (struct_type, member); \
- g_param_spec_set_qdata (pspec, quark, \
- GUINT_TO_POINTER (_offset)); \
- g_object_class_install_property (klass, ++count, pspec); \
-} G_STMT_END
-
-#define gst_xvidenc_add_pspec(klass, pspec, member) \
- gst_xvidenc_add_pspec_full (klass, pspec, xvidenc_prop_count, \
- xvidenc_pspec_quark, GstXvidEnc, member)
-
-/* using the above system, property maintenance is centralized here
- * (_get_property, _set_property and setting of default value in _init)
- * follow automatically, it only remains to actually use it in the code
- * (which may include free-ing in finalize) */
-
-static void
-gst_xvidenc_class_init (GstXvidEncClass * klass)
-{
- GstElementClass *gstelement_class;
- GObjectClass *gobject_class;
- GParamSpec *pspec;
-
- gobject_class = G_OBJECT_CLASS (klass);
- gstelement_class = GST_ELEMENT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- GST_DEBUG_CATEGORY_INIT (xvidenc_debug, "xvidenc", 0, "XviD encoder");
-
- gobject_class->finalize = gst_xvidenc_finalize;
-
- gobject_class->set_property = gst_xvidenc_set_property;
- gobject_class->get_property = gst_xvidenc_get_property;
-
- /* prop handling */
- xvidenc_prop_count = 0;
- xvidenc_pspec_quark = g_quark_from_static_string ("xvid-enc-param-spec-data");
-
- pspec = g_param_spec_enum ("profile", "Profile",
- "XviD/MPEG-4 encoding profile",
- GST_TYPE_XVIDENC_PROFILE, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, profile);
-
- pspec = g_param_spec_enum ("quant-type", "Quantizer Type",
- "Quantizer type", GST_TYPE_XVIDENC_QUANT_TYPE, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, quant_type);
-
- pspec = g_param_spec_enum ("pass", "Encoding pass/type",
- "Encoding pass/type",
- GST_TYPE_XVIDENC_PASS, XVIDENC_CBR,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, pass);
-
- pspec = g_param_spec_int ("bitrate", "Bitrate",
- "[CBR|PASS2] Target video bitrate (bps)",
- 0, G_MAXINT, 1800000, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, bitrate);
-
- pspec = g_param_spec_int ("quantizer", "Quantizer",
- "[QUANT] Quantizer to apply for constant quantizer mode",
- 2, 31, 2, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, quant);
-
- pspec = g_param_spec_string ("statsfile", "Statistics Filename",
- "[PASS1|PASS2] Filename to store data for 2-pass encoding",
- "xvid-stats.log", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, filename);
-
- pspec = g_param_spec_int ("max-key-interval", "Max. Key Interval",
- "Maximum number of frames between two keyframes (< 0 is in sec)",
- -100, G_MAXINT, -10, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, max_key_interval);
-
- pspec = g_param_spec_boolean ("closed-gop", "Closed GOP",
- "Closed GOP", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, closed_gop);
-
- pspec = g_param_spec_int ("motion", "ME Quality",
- "Quality of Motion Estimation", 0, 6, 6,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, motion);
-
- pspec = g_param_spec_boolean ("me-chroma", "ME Chroma",
- "Enable use of Chroma planes for Motion Estimation",
- TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, me_chroma);
-
- pspec = g_param_spec_int ("me-vhq", "ME DCT/Frequency",
- "Extent in which to use DCT to minimize encoding length",
- 0, 4, 1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, me_vhq);
-
- pspec = g_param_spec_boolean ("me-quarterpel", "ME Quarterpel",
- "Use quarter pixel precision for motion vector search",
- FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, me_quarterpel);
-
- pspec = g_param_spec_boolean ("lumimasking", "Lumimasking",
- "Enable lumimasking - apply more compression to dark or bright areas",
- FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, lumimasking);
-
- pspec = g_param_spec_int ("max-bframes", "Max B-Frames",
- "Maximum B-frames in a row", 0, G_MAXINT, 1,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, max_bframes);
-
- pspec = g_param_spec_int ("bquant-ratio", "B-quantizer ratio",
- "Ratio in B-frame quantizer computation", 0, 200, 150,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, bquant_ratio);
-
- pspec = g_param_spec_int ("bquant-offset", "B-quantizer offset",
- "Offset in B-frame quantizer computation",
- 0, 200, 100, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, bquant_offset);
-
- pspec = g_param_spec_int ("bframe-threshold", "B-Frame Threshold",
- "Higher threshold yields more chance that B-frame is used",
- -255, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, bframe_threshold);
-
- pspec = g_param_spec_boolean ("gmc", "Global Motion Compensation",
- "Allow generation of Sprite Frames for Pan/Zoom/Rotating images",
- FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, gmc);
-
- pspec = g_param_spec_boolean ("trellis", "Trellis Quantization",
- "Enable Trellis Quantization", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, trellis);
-
- pspec = g_param_spec_boolean ("interlaced", "Interlaced Material",
- "Enable for interlaced video material", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, interlaced);
-
- pspec = g_param_spec_boolean ("cartoon", "Cartoon Material",
- "Adjust thresholds for flat looking cartoons", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, cartoon);
-
- pspec = g_param_spec_boolean ("greyscale", "Disable Chroma",
- "Do not write chroma data in encoded video", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, greyscale);
-
- pspec = g_param_spec_boolean ("hqacpred", "High quality AC prediction",
- "Enable high quality AC prediction", TRUE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, hqacpred);
-
- pspec = g_param_spec_int ("max-iquant", "Max Quant I-Frames",
- "Upper bound for I-frame quantization", 0, 31, 31,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, max_iquant);
-
- pspec = g_param_spec_int ("min-iquant", "Min Quant I-Frames",
- "Lower bound for I-frame quantization", 0, 31, 2,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, min_iquant);
-
- pspec = g_param_spec_int ("max-pquant", "Max Quant P-Frames",
- "Upper bound for P-frame quantization", 0, 31, 31,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, max_pquant);
-
- pspec = g_param_spec_int ("min-pquant", "Min Quant P-Frames",
- "Lower bound for P-frame quantization", 0, 31, 2,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, min_pquant);
-
- pspec = g_param_spec_int ("max-bquant", "Max Quant B-Frames",
- "Upper bound for B-frame quantization", 0, 31, 31,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, max_bquant);
-
- pspec = g_param_spec_int ("min-bquant", "Min Quant B-Frames",
- "Lower bound for B-frame quantization", 0, 31, 2,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, min_bquant);
-
- pspec = g_param_spec_int ("reaction-delay-factor", "Reaction Delay Factor",
- "[CBR] Reaction delay factor", -1, 100, -1,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, reaction_delay_factor);
-
- pspec = g_param_spec_int ("averaging-period", "Averaging Period",
- "[CBR] Number of frames for which XviD averages bitrate",
- -1, 100, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, averaging_period);
-
- pspec = g_param_spec_int ("buffer", "Buffer Size",
- "[CBR] Size of the video buffers", -1, G_MAXINT, -1,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, buffer);
-
- pspec = g_param_spec_int ("keyframe-boost", "Keyframe boost",
- "[PASS2] Bitrate boost for keyframes", 0, 100, 0,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, keyframe_boost);
-
- pspec = g_param_spec_int ("curve-compression-high", "Curve Compression High",
- "[PASS2] Shrink factor for upper part of bitrate curve",
- 0, 100, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, curve_compression_high);
-
- pspec = g_param_spec_int ("curve-compression-low", "Curve Compression Low",
- "[PASS2] Growing factor for lower part of bitrate curve",
- 0, 100, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, curve_compression_low);
-
- pspec = g_param_spec_int ("flow-control-strength", "Flow Control Strength",
- "[PASS2] Overflow control strength per frame",
- -1, 100, 5, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, overflow_control_strength);
-
- pspec =
- g_param_spec_int ("max-overflow-improvement", "Max Overflow Improvement",
- "[PASS2] Amount in % that flow control can increase frame size compared to ideal curve",
- -1, 100, 5, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, max_overflow_improvement);
-
- pspec =
- g_param_spec_int ("max-overflow-degradation", "Max Overflow Degradation",
- "[PASS2] Amount in % that flow control can decrease frame size compared to ideal curve",
- -1, 100, 5, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, max_overflow_degradation);
-
- pspec = g_param_spec_int ("keyframe-reduction", "Keyframe Reduction",
- "[PASS2] Keyframe size reduction in % of those within threshold",
- -1, 100, 20, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, kfreduction);
-
- pspec = g_param_spec_int ("keyframe-threshold", "Keyframe Threshold",
- "[PASS2] Distance between keyframes not to be subject to reduction",
- -1, 100, 1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, kfthreshold);
-
- pspec =
- g_param_spec_int ("container-frame-overhead", "Container Frame Overhead",
- "[PASS2] Average container overhead per frame", -1, 100, -1,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- gst_xvidenc_add_pspec (gobject_class, pspec, container_frame_overhead);
-
- gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_xvidenc_change_state);
-}
-
-
-static void
-gst_xvidenc_init (GstXvidEnc * xvidenc)
-{
- GParamSpec **pspecs;
- guint i, num_props;
-
- /* create the sink pad */
- xvidenc->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
- gst_element_add_pad (GST_ELEMENT (xvidenc), xvidenc->sinkpad);
-
- gst_pad_set_chain_function (xvidenc->sinkpad,
- GST_DEBUG_FUNCPTR (gst_xvidenc_chain));
- gst_pad_set_setcaps_function (xvidenc->sinkpad,
- GST_DEBUG_FUNCPTR (gst_xvidenc_setcaps));
- gst_pad_set_getcaps_function (xvidenc->sinkpad,
- GST_DEBUG_FUNCPTR (gst_xvidenc_getcaps));
- gst_pad_set_event_function (xvidenc->sinkpad,
- GST_DEBUG_FUNCPTR (gst_xvidenc_handle_sink_event));
-
- /* create the src pad */
- xvidenc->srcpad = gst_pad_new_from_static_template (&src_template, "src");
- gst_element_add_pad (GST_ELEMENT (xvidenc), xvidenc->srcpad);
- gst_pad_use_fixed_caps (xvidenc->srcpad);
-
- /* init properties. */
- xvidenc->width = xvidenc->height = xvidenc->csp = -1;
- xvidenc->par_width = xvidenc->par_height = 1;
-
- /* set defaults for user properties */
- pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (xvidenc),
- &num_props);
-
- for (i = 0; i < num_props; ++i) {
- GValue val = { 0, };
- GParamSpec *pspec = pspecs[i];
-
- /* only touch those that are really ours; i.e. should have some qdata */
- if (!g_param_spec_get_qdata (pspec, xvidenc_pspec_quark))
- continue;
- g_value_init (&val, G_PARAM_SPEC_VALUE_TYPE (pspec));
- g_param_value_set_default (pspec, &val);
- g_object_set_property (G_OBJECT (xvidenc), g_param_spec_get_name (pspec),
- &val);
- g_value_unset (&val);
- }
-
- g_free (pspecs);
-
- /* set xvid handle to NULL */
- xvidenc->handle = NULL;
-
- /* get a queue to keep time info if frames get delayed */
- xvidenc->delay = NULL;
-
- /* cache some xvid data so need not rebuild for each frame */
- xvidenc->xframe_cache = NULL;
-}
-
-
-static void
-gst_xvidenc_finalize (GObject * object)
-{
-
- GstXvidEnc *xvidenc = GST_XVIDENC (object);
-
- g_free (xvidenc->filename);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static gboolean
-gst_xvidenc_handle_sink_event (GstPad * pad, GstEvent * event)
-{
- GstXvidEnc *xvidenc = GST_XVIDENC (GST_PAD_PARENT (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_EOS:
- gst_xvidenc_flush_buffers (xvidenc, TRUE);
- break;
- /* no flushing if flush received,
- buffers in encoder are considered (in the) past */
- default:
- break;
- }
-
- return gst_pad_push_event (xvidenc->srcpad, event);
-}
-
-static gboolean
-gst_xvidenc_setup (GstXvidEnc * xvidenc)
-{
- xvid_enc_create_t xenc;
- xvid_enc_plugin_t xplugin[2];
- gint ret;
- GstCaps *allowed_caps;
- gint profile = -1;
-
- /* Negotiate profile/level with downstream */
- allowed_caps = gst_pad_get_allowed_caps (xvidenc->srcpad);
- if (allowed_caps && !gst_caps_is_empty (allowed_caps)) {
- const gchar *profile_str, *level_str;
-
- allowed_caps = gst_caps_make_writable (allowed_caps);
- gst_caps_truncate (allowed_caps);
-
- profile_str =
- gst_structure_get_string (gst_caps_get_structure (allowed_caps, 0),
- "profile");
- level_str =
- gst_structure_get_string (gst_caps_get_structure (allowed_caps, 0),
- "level");
- if (profile_str) {
- if (g_str_equal (profile_str, "simple")) {
- if (!level_str) {
- profile = XVID_PROFILE_S_L0;
- } else if (g_str_equal (level_str, "0")) {
- profile = XVID_PROFILE_S_L0;
- } else if (g_str_equal (level_str, "1")) {
- profile = XVID_PROFILE_S_L1;
- } else if (g_str_equal (level_str, "2")) {
- profile = XVID_PROFILE_S_L2;
- } else if (g_str_equal (level_str, "3")) {
- profile = XVID_PROFILE_S_L3;
- } else if (g_str_equal (level_str, "4a")) {
- profile = XVID_PROFILE_S_L4a;
- } else if (g_str_equal (level_str, "5")) {
- profile = XVID_PROFILE_S_L5;
- } else if (g_str_equal (level_str, "6")) {
- profile = XVID_PROFILE_S_L6;
- } else {
- GST_ERROR_OBJECT (xvidenc,
- "Invalid profile/level combination (%s %s)", profile_str,
- level_str);
- }
- } else if (g_str_equal (profile_str, "advanced-real-time-simple")) {
- if (!level_str) {
- profile = XVID_PROFILE_ARTS_L1;
- } else if (g_str_equal (level_str, "1")) {
- profile = XVID_PROFILE_ARTS_L1;
- } else if (g_str_equal (level_str, "2")) {
- profile = XVID_PROFILE_ARTS_L2;
- } else if (g_str_equal (level_str, "3")) {
- profile = XVID_PROFILE_ARTS_L3;
- } else if (g_str_equal (level_str, "4")) {
- profile = XVID_PROFILE_ARTS_L4;
- } else {
- GST_ERROR_OBJECT (xvidenc,
- "Invalid profile/level combination (%s %s)", profile_str,
- level_str);
- }
- } else if (g_str_equal (profile_str, "advanced-simple")) {
- if (!level_str) {
- profile = XVID_PROFILE_AS_L0;
- } else if (g_str_equal (level_str, "0")) {
- profile = XVID_PROFILE_AS_L0;
- } else if (g_str_equal (level_str, "1")) {
- profile = XVID_PROFILE_AS_L1;
- } else if (g_str_equal (level_str, "2")) {
- profile = XVID_PROFILE_AS_L2;
- } else if (g_str_equal (level_str, "3")) {
- profile = XVID_PROFILE_AS_L3;
- } else if (g_str_equal (level_str, "4")) {
- profile = XVID_PROFILE_AS_L4;
- } else {
- GST_ERROR_OBJECT (xvidenc,
- "Invalid profile/level combination (%s %s)", profile_str,
- level_str);
- }
- } else {
- GST_ERROR_OBJECT (xvidenc, "Invalid profile (%s)", profile_str);
- }
- }
- }
- if (allowed_caps)
- gst_caps_unref (allowed_caps);
-
- if (profile != -1) {
- xvidenc->profile = profile;
- g_object_notify (G_OBJECT (xvidenc), "profile");
- }
-
- /* see xvid.h for the meaning of all this. */
- gst_xvid_init_struct (xenc);
-
- xenc.profile = xvidenc->used_profile = xvidenc->profile;
- xenc.width = xvidenc->width;
- xenc.height = xvidenc->height;
- xenc.max_bframes = xvidenc->max_bframes;
- xenc.global = XVID_GLOBAL_PACKED
- | (xvidenc->closed_gop ? XVID_GLOBAL_CLOSED_GOP : 0);
-
- xenc.bquant_ratio = xvidenc->bquant_ratio;
- xenc.bquant_offset = xvidenc->bquant_offset;
-
- xenc.fbase = xvidenc->fbase;
- xenc.fincr = xvidenc->fincr;
- xenc.max_key_interval = (xvidenc->max_key_interval < 0) ?
- (-xvidenc->max_key_interval * xenc.fbase /
- xenc.fincr) : xvidenc->max_key_interval;
- xenc.handle = NULL;
-
- /* quantizer ranges */
- xenc.min_quant[0] = xvidenc->min_iquant;
- xenc.min_quant[1] = xvidenc->min_pquant;
- xenc.min_quant[2] = xvidenc->min_bquant;
- xenc.max_quant[0] = xvidenc->max_iquant;
- xenc.max_quant[1] = xvidenc->max_pquant;
- xenc.max_quant[2] = xvidenc->max_bquant;
-
- /* cbr, vbr or constant quantizer */
- xenc.num_plugins = 1;
- xenc.plugins = xplugin;
- switch (xvidenc->pass) {
- case XVIDENC_CBR:
- case XVIDENC_QUANT:
- {
- xvid_plugin_single_t xsingle;
- xvid_enc_zone_t xzone;
-
- gst_xvid_init_struct (xsingle);
-
- xenc.plugins[0].func = xvid_plugin_single;
- xenc.plugins[0].param = &xsingle;
-
- xsingle.bitrate = xvidenc->bitrate;
- xsingle.reaction_delay_factor = MAX (0, xvidenc->reaction_delay_factor);
- xsingle.averaging_period = MAX (0, xvidenc->averaging_period);
- xsingle.buffer = MAX (0, xvidenc->buffer);
-
- if (xvidenc->pass == XVIDENC_CBR)
- break;
-
- /* set up a const quantizer zone */
- xzone.mode = XVID_ZONE_QUANT;
- xzone.frame = 0;
- xzone.increment = xvidenc->quant;
- xzone.base = 1;
- xenc.zones = &xzone;
- xenc.num_zones++;
-
- break;
- }
- case XVIDENC_VBR_PASS1:
- {
- xvid_plugin_2pass1_t xpass;
-
- gst_xvid_init_struct (xpass);
-
- xenc.plugins[0].func = xvid_plugin_2pass1;
- xenc.plugins[0].param = &xpass;
-
- xpass.filename = xvidenc->filename;
- break;
- }
- case XVIDENC_VBR_PASS2:
- {
- xvid_plugin_2pass2_t xpass;
-
- gst_xvid_init_struct (xpass);
-
- xenc.plugins[0].func = xvid_plugin_2pass2;
- xenc.plugins[0].param = &xpass;
-
- xpass.bitrate = xvidenc->bitrate;
- xpass.filename = xvidenc->filename;
- xpass.keyframe_boost = xvidenc->keyframe_boost;
- xpass.curve_compression_high = xvidenc->curve_compression_high;
- xpass.curve_compression_low = xvidenc->curve_compression_low;
- xpass.overflow_control_strength =
- MAX (0, xvidenc->overflow_control_strength);
- xpass.max_overflow_improvement =
- MAX (0, xvidenc->max_overflow_improvement);
- xpass.max_overflow_degradation =
- MAX (0, xvidenc->max_overflow_degradation);
- xpass.kfreduction = MAX (0, xvidenc->kfreduction);
- xpass.kfthreshold = MAX (0, xvidenc->kfthreshold);
- xpass.container_frame_overhead =
- MAX (0, xvidenc->container_frame_overhead);
- break;
- }
- }
-
- if (xvidenc->lumimasking) {
- xenc.plugins[1].func = xvid_plugin_lumimasking;
- xenc.plugins[1].param = NULL;
- xenc.num_plugins++;
- }
-
- if ((ret = xvid_encore (NULL, XVID_ENC_CREATE, &xenc, NULL)) < 0) {
- GST_DEBUG_OBJECT (xvidenc, "Error setting up xvid encoder: %s (%d)",
- gst_xvid_error (ret), ret);
- return FALSE;
- }
-
- xvidenc->handle = xenc.handle;
-
- return TRUE;
-}
-
-static gboolean
-gst_xvidenc_setcaps (GstPad * pad, GstCaps * vscaps)
-{
- GstXvidEnc *xvidenc;
- GstStructure *structure;
- gint w, h;
- const GValue *fps, *par;
- gint xvid_cs = -1;
-
- xvidenc = GST_XVIDENC (GST_PAD_PARENT (pad));
-
- /* if there's something old around, remove it */
- if (xvidenc->handle) {
- gst_xvidenc_flush_buffers (xvidenc, TRUE);
- xvid_encore (xvidenc->handle, XVID_ENC_DESTROY, NULL, NULL);
- xvidenc->handle = NULL;
- }
-
- structure = gst_caps_get_structure (vscaps, 0);
-
- if (!gst_structure_get_int (structure, "width", &w) ||
- !gst_structure_get_int (structure, "height", &h)) {
- return FALSE;
- }
-
- fps = gst_structure_get_value (structure, "framerate");
- if (fps == NULL || !GST_VALUE_HOLDS_FRACTION (fps)) {
- GST_WARNING_OBJECT (pad, "no framerate specified, or not a GstFraction");
- return FALSE;
- }
-
- /* optional par info */
- par = gst_structure_get_value (structure, "pixel-aspect-ratio");
-
- xvid_cs = gst_xvid_structure_to_csp (structure);
- if (xvid_cs == -1) {
- gchar *sstr;
-
- sstr = gst_structure_to_string (structure);
- GST_DEBUG_OBJECT (xvidenc, "Did not find xvid colourspace for caps %s",
- sstr);
- g_free (sstr);
- return FALSE;
- }
-
- xvidenc->csp = xvid_cs;
- xvidenc->width = w;
- xvidenc->height = h;
- xvidenc->fbase = gst_value_get_fraction_numerator (fps);
- xvidenc->fincr = gst_value_get_fraction_denominator (fps);
- if ((par != NULL) && GST_VALUE_HOLDS_FRACTION (par)) {
- xvidenc->par_width = gst_value_get_fraction_numerator (par);
- xvidenc->par_height = gst_value_get_fraction_denominator (par);
- } else {
- xvidenc->par_width = 1;
- xvidenc->par_height = 1;
- }
-
- /* wipe xframe cache given possible change caps properties */
- g_free (xvidenc->xframe_cache);
- xvidenc->xframe_cache = NULL;
-
- if (gst_xvidenc_setup (xvidenc)) {
- gboolean ret = FALSE;
- GstCaps *new_caps = NULL, *allowed_caps;
-
- /* please downstream with preferred caps */
- allowed_caps = gst_pad_get_allowed_caps (xvidenc->srcpad);
- GST_DEBUG_OBJECT (xvidenc, "allowed caps: %" GST_PTR_FORMAT, allowed_caps);
-
- if (allowed_caps && !gst_caps_is_empty (allowed_caps)) {
- new_caps = gst_caps_copy_nth (allowed_caps, 0);
- } else {
- new_caps = gst_caps_new_simple ("video/x-xvid", NULL);
- }
- if (allowed_caps)
- gst_caps_unref (allowed_caps);
-
- gst_caps_set_simple (new_caps,
- "width", G_TYPE_INT, w, "height", G_TYPE_INT, h,
- "framerate", GST_TYPE_FRACTION, xvidenc->fbase, xvidenc->fincr,
- "pixel-aspect-ratio", GST_TYPE_FRACTION,
- xvidenc->par_width, xvidenc->par_height, NULL);
- /* just to be sure */
- gst_pad_fixate_caps (xvidenc->srcpad, new_caps);
-
- if (xvidenc->used_profile != 0) {
- switch (xvidenc->used_profile) {
- case XVID_PROFILE_S_L0:
- gst_caps_set_simple (new_caps, "profile", G_TYPE_STRING, "simple",
- "level", G_TYPE_STRING, "0", NULL);
- break;
- case XVID_PROFILE_S_L1:
- gst_caps_set_simple (new_caps, "profile", G_TYPE_STRING, "simple",
- "level", G_TYPE_STRING, "1", NULL);
- break;
- case XVID_PROFILE_S_L2:
- gst_caps_set_simple (new_caps, "profile", G_TYPE_STRING, "simple",
- "level", G_TYPE_STRING, "2", NULL);
- break;
- case XVID_PROFILE_S_L3:
- gst_caps_set_simple (new_caps, "profile", G_TYPE_STRING, "simple",
- "level", G_TYPE_STRING, "3", NULL);
- break;
- case XVID_PROFILE_S_L4a:
- gst_caps_set_simple (new_caps, "profile", G_TYPE_STRING, "simple",
- "level", G_TYPE_STRING, "4a", NULL);
- break;
- case XVID_PROFILE_S_L5:
- gst_caps_set_simple (new_caps, "profile", G_TYPE_STRING, "simple",
- "level", G_TYPE_STRING, "5", NULL);
- break;
- case XVID_PROFILE_S_L6:
- gst_caps_set_simple (new_caps, "profile", G_TYPE_STRING, "simple",
- "level", G_TYPE_STRING, "6", NULL);
- break;
- case XVID_PROFILE_ARTS_L1:
- gst_caps_set_simple (new_caps, "profile", G_TYPE_STRING,
- "advanced-real-time-simple", "level", G_TYPE_STRING, "1", NULL);
- break;
- case XVID_PROFILE_ARTS_L2:
- gst_caps_set_simple (new_caps, "profile", G_TYPE_STRING,
- "advanced-real-time-simple", "level", G_TYPE_STRING, "2", NULL);
- break;
- case XVID_PROFILE_ARTS_L3:
- gst_caps_set_simple (new_caps, "profile", G_TYPE_STRING,
- "advanced-real-time-simple", "level", G_TYPE_STRING, "3", NULL);
- break;
- case XVID_PROFILE_ARTS_L4:
- gst_caps_set_simple (new_caps, "profile", G_TYPE_STRING,
- "advanced-real-time-simple", "level", G_TYPE_STRING, "4", NULL);
- break;
- case XVID_PROFILE_AS_L0:
- gst_caps_set_simple (new_caps, "profile", G_TYPE_STRING,
- "advanced-simple", "level", G_TYPE_STRING, "0", NULL);
- break;
- case XVID_PROFILE_AS_L1:
- gst_caps_set_simple (new_caps, "profile", G_TYPE_STRING,
- "advanced-simple", "level", G_TYPE_STRING, "1", NULL);
- break;
- case XVID_PROFILE_AS_L2:
- gst_caps_set_simple (new_caps, "profile", G_TYPE_STRING,
- "advanced-simple", "level", G_TYPE_STRING, "2", NULL);
- break;
- case XVID_PROFILE_AS_L3:
- gst_caps_set_simple (new_caps, "profile", G_TYPE_STRING,
- "advanced-simple", "level", G_TYPE_STRING, "3", NULL);
- break;
- case XVID_PROFILE_AS_L4:
- gst_caps_set_simple (new_caps, "profile", G_TYPE_STRING,
- "advanced-simple", "level", G_TYPE_STRING, "4", NULL);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
- }
-
- /* src pad should accept anyway */
- ret = gst_pad_set_caps (xvidenc->srcpad, new_caps);
- gst_caps_unref (new_caps);
-
- if (!ret && xvidenc->handle) {
- xvid_encore (xvidenc->handle, XVID_ENC_DESTROY, NULL, NULL);
- xvidenc->handle = NULL;
- }
- return ret;
-
- } else /* setup did not work out */
- return FALSE;
-}
-
-static GstCaps *
-gst_xvidenc_getcaps (GstPad * pad)
-{
- GstXvidEnc *xvidenc;
- GstPad *peer;
- GstCaps *caps;
-
- /* If we already have caps return them */
- if (GST_PAD_CAPS (pad))
- return gst_caps_ref (GST_PAD_CAPS (pad));
-
- xvidenc = GST_XVIDENC (gst_pad_get_parent (pad));
- if (!xvidenc)
- return gst_caps_new_empty ();
-
- peer = gst_pad_get_peer (xvidenc->srcpad);
- if (peer) {
- const GstCaps *templcaps;
- GstCaps *peercaps;
- guint i, n;
-
- peercaps = gst_pad_get_caps (peer);
-
- /* Translate peercaps to YUV */
- peercaps = gst_caps_make_writable (peercaps);
- n = gst_caps_get_size (peercaps);
- for (i = 0; i < n; i++) {
- GstStructure *s = gst_caps_get_structure (peercaps, i);
-
- gst_structure_set_name (s, "video/x-raw-yuv");
- gst_structure_remove_field (s, "mpegversion");
- gst_structure_remove_field (s, "systemstream");
- }
-
- templcaps = gst_pad_get_pad_template_caps (pad);
-
- caps = gst_caps_intersect (peercaps, templcaps);
- gst_caps_unref (peercaps);
- gst_object_unref (peer);
- peer = NULL;
- } else {
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
- }
-
- gst_object_unref (xvidenc);
-
- return caps;
-}
-
-/* encodes frame according to info in xframe;
- - buf is input buffer, can be NULL if dummy
- - buf is disposed of prior to exit
- - resulting buffer is returned, NULL if no encoder output or error
-*/
-static inline GstBuffer *
-gst_xvidenc_encode (GstXvidEnc * xvidenc, GstBuffer * buf,
- xvid_enc_frame_t xframe)
-{
- GstBuffer *outbuf;
- gint ret;
-
- /* compressed frame should fit in the rough size of an uncompressed one */
- outbuf = gst_buffer_new_and_alloc (gst_xvid_image_get_size (xvidenc->csp,
- xvidenc->width, xvidenc->height));
-
- xframe.bitstream = (void *) GST_BUFFER_DATA (outbuf);
- xframe.length = GST_BUFFER_SIZE (outbuf);
-
- /* now provide input image data where-abouts, if needed */
- if (buf)
- gst_xvid_image_fill (&xframe.input, GST_BUFFER_DATA (buf), xvidenc->csp,
- xvidenc->width, xvidenc->height);
-
- GST_DEBUG_OBJECT (xvidenc, "encoding frame into buffer of size %d",
- GST_BUFFER_SIZE (outbuf));
- ret = xvid_encore (xvidenc->handle, XVID_ENC_ENCODE, &xframe, NULL);
-
- if (ret < 0) {
- /* things can be nasty if we are trying to flush, so don't signal error then */
- if (buf) {
- GST_ELEMENT_WARNING (xvidenc, LIBRARY, ENCODE, (NULL),
- ("Error encoding xvid frame: %s (%d)", gst_xvid_error (ret), ret));
- gst_buffer_unref (buf);
- }
- gst_buffer_unref (outbuf);
- return NULL;
- } else if (ret > 0) { /* make sub-buffer */
- GstBuffer *sub;
-
- GST_DEBUG_OBJECT (xvidenc, "xvid produced output of size %d", ret);
- sub = gst_buffer_create_sub (outbuf, 0, ret);
-
- /* parent no longer needed, will go away with child buffer */
- gst_buffer_unref (outbuf);
- outbuf = sub;
- } else { /* encoder did not yet produce something */
- GST_DEBUG_OBJECT (xvidenc, "xvid produced no output");
- gst_buffer_unref (outbuf);
- g_queue_push_tail (xvidenc->delay, buf);
- return NULL;
- }
-
- /* finish decoration and return */
- if (!(xframe.out_flags & XVID_KEYFRAME))
- GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
- gst_buffer_set_caps (outbuf, GST_PAD_CAPS (xvidenc->srcpad));
-
- /* now we need the right buf to take timestamps from;
- note that timestamps from a display order input buffer can end up with
- another encode order output buffer, but other than this permutation,
- the overall time progress is tracked,
- and keyframes should have the correct stamp */
- if (!g_queue_is_empty (xvidenc->delay)) {
- if (buf)
- g_queue_push_tail (xvidenc->delay, buf);
- buf = g_queue_pop_head (xvidenc->delay);
- }
- if (buf) {
- GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
- GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf);
- gst_buffer_unref (buf);
- }
-
- return outbuf;
-}
-
-static GstFlowReturn
-gst_xvidenc_chain (GstPad * pad, GstBuffer * buf)
-{
- GstXvidEnc *xvidenc = GST_XVIDENC (GST_PAD_PARENT (pad));
- GstBuffer *outbuf;
- xvid_enc_frame_t xframe;
-
- const gint motion_presets[] = {
- 0, 0, 0, 0,
- XVID_ME_HALFPELREFINE16,
- XVID_ME_HALFPELREFINE16 | XVID_ME_ADVANCEDDIAMOND16,
- XVID_ME_HALFPELREFINE16 | XVID_ME_EXTSEARCH16
- | XVID_ME_HALFPELREFINE8 | XVID_ME_USESQUARES16
- };
-
- if (!xvidenc->handle) {
- GST_ELEMENT_ERROR (xvidenc, CORE, NEGOTIATION, (NULL),
- ("format wasn't negotiated before chain function"));
- gst_buffer_unref (buf);
- return GST_FLOW_NOT_NEGOTIATED;
- }
-
- GST_DEBUG_OBJECT (xvidenc,
- "Received buffer of time %" GST_TIME_FORMAT ", size %d",
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)), GST_BUFFER_SIZE (buf));
-
- if (xvidenc->xframe_cache)
- memcpy (&xframe, xvidenc->xframe_cache, sizeof (xframe));
- else { /* need to build some inital xframe to be cached */
- /* encode and so ... */
- gst_xvid_init_struct (xframe);
-
- if (xvidenc->par_width == xvidenc->par_height)
- xframe.par = XVID_PAR_11_VGA;
- else {
- xframe.par = XVID_PAR_EXT;
- xframe.par_width = xvidenc->par_width;
- xframe.par_height = xvidenc->par_height;
- }
-
- /* handle options */
- xframe.vol_flags |= xvidenc->quant_type;
- xframe.vop_flags = XVID_VOP_HALFPEL;
- xframe.motion = motion_presets[xvidenc->motion];
-
- if (xvidenc->me_chroma) {
- xframe.motion |= XVID_ME_CHROMA_PVOP;
- xframe.motion |= XVID_ME_CHROMA_BVOP;
- }
-
- if (xvidenc->me_vhq >= 1) {
- xframe.vop_flags |= XVID_VOP_MODEDECISION_RD;
- }
- if (xvidenc->me_vhq >= 2) {
- xframe.motion |= XVID_ME_HALFPELREFINE16_RD;
- xframe.motion |= XVID_ME_QUARTERPELREFINE16_RD;
- }
- if (xvidenc->me_vhq >= 3) {
- xframe.motion |= XVID_ME_HALFPELREFINE8_RD;
- xframe.motion |= XVID_ME_QUARTERPELREFINE8_RD;
- xframe.motion |= XVID_ME_CHECKPREDICTION_RD;
- }
- if (xvidenc->me_vhq >= 4) {
- xframe.motion |= XVID_ME_EXTSEARCH_RD;
- }
-
- /* no motion estimation, then only intra */
- if (xvidenc->motion == 0) {
- xframe.type = XVID_TYPE_IVOP;
- } else {
- xframe.type = XVID_TYPE_AUTO;
- }
-
- if (xvidenc->motion > 4) {
- xframe.vop_flags |= XVID_VOP_INTER4V;
- }
-
- if (xvidenc->me_quarterpel) {
- xframe.vol_flags |= XVID_VOL_QUARTERPEL;
- xframe.motion |= XVID_ME_QUARTERPELREFINE16;
- xframe.motion |= XVID_ME_QUARTERPELREFINE8;
- }
-
- if (xvidenc->gmc) {
- xframe.vol_flags |= XVID_VOL_GMC;
- xframe.motion |= XVID_ME_GME_REFINE;
- }
-
- if (xvidenc->interlaced) {
- xframe.vol_flags |= XVID_VOL_INTERLACING;
- }
-
- if (xvidenc->trellis) {
- xframe.vop_flags |= XVID_VOP_TRELLISQUANT;
- }
-
- if (xvidenc->hqacpred) {
- xframe.vop_flags |= XVID_VOP_HQACPRED;
- }
-
- if (xvidenc->greyscale) {
- xframe.vop_flags |= XVID_VOP_GREYSCALE;
- }
-
- if (xvidenc->cartoon) {
- xframe.vop_flags |= XVID_VOP_CARTOON;
- xframe.motion |= XVID_ME_DETECT_STATIC_MOTION;
- }
-
- xframe.bframe_threshold = xvidenc->bframe_threshold;
- xframe.input.csp = xvidenc->csp;
-
- /* save in cache */
- xvidenc->xframe_cache = g_memdup (&xframe, sizeof (xframe));
- }
-
- outbuf = gst_xvidenc_encode (xvidenc, buf, xframe);
-
- if (!outbuf) /* error or no data yet */
- return GST_FLOW_OK;
-
- /* go out, multiply! */
- return gst_pad_push (xvidenc->srcpad, outbuf);
-}
-
-/* flush xvid encoder buffers caused by bframe usage */
-static void
-gst_xvidenc_flush_buffers (GstXvidEnc * xvidenc, gboolean send)
-{
- GstBuffer *outbuf;
- xvid_enc_frame_t xframe;
-
- /* no need to flush if no handle */
- if (!xvidenc->handle)
- return;
-
- gst_xvid_init_struct (xframe);
-
- /* init a fake frame to force flushing */
- xframe.input.csp = XVID_CSP_NULL;
- xframe.input.plane[0] = NULL;
- xframe.input.plane[1] = NULL;
- xframe.input.plane[2] = NULL;
- xframe.input.stride[0] = 0;
- xframe.input.stride[1] = 0;
- xframe.input.stride[2] = 0;
- xframe.quant = 0;
-
- GST_DEBUG ("flushing buffers with sending %d", send);
-
- while (!g_queue_is_empty (xvidenc->delay)) {
- outbuf = gst_xvidenc_encode (xvidenc, NULL, xframe);
-
- if (outbuf) {
- if (send)
- gst_pad_push (xvidenc->srcpad, outbuf);
- else
- gst_buffer_unref (outbuf);
- } else /* hm, there should have been something in there */
- break;
- }
-
- /* our queue should be empty anyway if we did not have to break out ... */
- while (!g_queue_is_empty (xvidenc->delay))
- gst_buffer_unref (g_queue_pop_head (xvidenc->delay));
-}
-
-static void
-gst_xvidenc_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec)
-{
- GstXvidEnc *xvidenc;
- guint offset;
-
- xvidenc = GST_XVIDENC (object);
-
- if (prop_id > xvidenc_prop_count) {
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- return;
- }
-
- /* our param specs should have such qdata */
- offset =
- GPOINTER_TO_UINT (g_param_spec_get_qdata (pspec, xvidenc_pspec_quark));
-
- if (offset == 0)
- return;
-
- switch (G_PARAM_SPEC_VALUE_TYPE (pspec)) {
- case G_TYPE_BOOLEAN:
- G_STRUCT_MEMBER (gboolean, xvidenc, offset) = g_value_get_boolean (value);
- break;
- case G_TYPE_INT:
- G_STRUCT_MEMBER (gint, xvidenc, offset) = g_value_get_int (value);
- break;
- case G_TYPE_STRING:
- g_free (G_STRUCT_MEMBER (gchar *, xvidenc, offset));
- G_STRUCT_MEMBER (gchar *, xvidenc, offset) = g_value_dup_string (value);
- break;
- default: /* must be enum, given the check above */
- if (G_IS_PARAM_SPEC_ENUM (pspec)) {
- G_STRUCT_MEMBER (gint, xvidenc, offset) = g_value_get_enum (value);
- } else {
- G_STRUCT_MEMBER (guint, xvidenc, offset) = g_value_get_flags (value);
- }
- break;
- }
-}
-
-static void
-gst_xvidenc_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec)
-{
- GstXvidEnc *xvidenc;
- guint offset;
-
- xvidenc = GST_XVIDENC (object);
-
- if (prop_id > xvidenc_prop_count) {
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- return;
- }
-
- /* our param specs should have such qdata */
- offset =
- GPOINTER_TO_UINT (g_param_spec_get_qdata (pspec, xvidenc_pspec_quark));
-
- if (offset == 0)
- return;
-
- switch (G_PARAM_SPEC_VALUE_TYPE (pspec)) {
- case G_TYPE_BOOLEAN:
- g_value_set_boolean (value, G_STRUCT_MEMBER (gboolean, xvidenc, offset));
- break;
- case G_TYPE_INT:
- g_value_set_int (value, G_STRUCT_MEMBER (gint, xvidenc, offset));
- break;
- case G_TYPE_STRING:
- g_value_take_string (value,
- g_strdup (G_STRUCT_MEMBER (gchar *, xvidenc, offset)));
- break;
- default: /* must be enum, given the check above */
- if (G_IS_PARAM_SPEC_ENUM (pspec)) {
- g_value_set_enum (value, G_STRUCT_MEMBER (gint, xvidenc, offset));
- } else if (G_IS_PARAM_SPEC_FLAGS (pspec)) {
- g_value_set_flags (value, G_STRUCT_MEMBER (guint, xvidenc, offset));
- } else { /* oops, bit lazy we don't cover this case yet */
- g_critical ("%s does not yet support type %s", GST_FUNCTION,
- g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
- }
- break;
- }
-}
-
-static GstStateChangeReturn
-gst_xvidenc_change_state (GstElement * element, GstStateChange transition)
-{
- GstXvidEnc *xvidenc = GST_XVIDENC (element);
- GstStateChangeReturn ret;
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- if (!gst_xvid_init ())
- return GST_STATE_CHANGE_FAILURE;
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- xvidenc->delay = g_queue_new ();
- break;
- default:
- break;
- }
-
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- if (ret == GST_STATE_CHANGE_FAILURE)
- goto done;
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- if (xvidenc->handle) {
- gst_xvidenc_flush_buffers (xvidenc, FALSE);
- xvid_encore (xvidenc->handle, XVID_ENC_DESTROY, NULL, NULL);
- xvidenc->handle = NULL;
- }
- g_queue_free (xvidenc->delay);
- xvidenc->delay = NULL;
- g_free (xvidenc->xframe_cache);
- xvidenc->xframe_cache = NULL;
- break;
- default:
- break;
- }
-
-done:
- return ret;
-}
diff --git a/ext/xvid/gstxvidenc.h b/ext/xvid/gstxvidenc.h
deleted file mode 100644
index ff77aa26c..000000000
--- a/ext/xvid/gstxvidenc.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/* GStreamer xvid encoder plugin
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_XVIDENC_H__
-#define __GST_XVIDENC_H__
-
-#include <gst/gst.h>
-#include "gstxvid.h"
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_XVIDENC \
- (gst_xvidenc_get_type())
-#define GST_XVIDENC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_XVIDENC, GstXvidEnc))
-#define GST_XVIDENC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_XVIDENC, GstXvidEncClass))
-#define GST_IS_XVIDENC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_XVIDENC))
-#define GST_IS_XVIDENC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_XVIDENC))
-
-typedef struct _GstXvidEnc GstXvidEnc;
-typedef struct _GstXvidEncClass GstXvidEncClass;
-
-struct _GstXvidEnc {
- GstElement element;
-
- /* pads */
- GstPad *sinkpad, *srcpad;
-
- /* xvid handle */
- void *handle;
-
- /* cache in place */
- xvid_enc_frame_t *xframe_cache;
-
- /* caps information */
- gint csp;
- gint width, height;
- gint fbase;
- gint fincr;
- gint par_width;
- gint par_height;
-
- /* delayed buffers if bframe usage */
- GQueue *delay;
-
- /* encoding profile */
- gint profile;
- gint used_profile;
-
- /* quantizer type; h263, MPEG */
- gint quant_type;
-
- /* encoding type; cbr, vbr, quant */
- gint pass;
-
- /* quality of encoded image */
- gint bitrate;
- gint quant;
-
- /* gop */
- gint max_key_interval;
- gboolean closed_gop;
-
- /* motion estimation */
- gint motion;
- gboolean me_chroma;
- gint me_vhq;
- gboolean me_quarterpel;
-
- /* lumimasking */
- gboolean lumimasking;
-
- /* b-frames */
- gint max_bframes;
- gint bquant_ratio;
- gint bquant_offset;
- gint bframe_threshold;
-
- /* misc */
- gboolean gmc;
- gboolean trellis;
- gboolean interlaced;
- gboolean cartoon;
- gboolean greyscale;
- gboolean hqacpred;
-
- /* quantizer ranges */
- gint max_iquant, min_iquant;
- gint max_pquant, min_pquant;
- gint max_bquant, min_bquant;
-
- /* cbr (single pass) encoding */
- gint reaction_delay_factor;
- gint averaging_period;
- gint buffer;
-
- /* vbr (2pass) encoding */
- gchar *filename;
- gint keyframe_boost;
- gint curve_compression_high;
- gint curve_compression_low;
- gint overflow_control_strength;
- gint max_overflow_improvement;
- gint max_overflow_degradation;
- gint kfreduction;
- gint kfthreshold;
- gint container_frame_overhead;
-};
-
-struct _GstXvidEncClass {
- GstElementClass parent_class;
-};
-
-GType gst_xvidenc_get_type(void);
-
-G_END_DECLS
-
-#endif /* __GST_XVIDENC_H__ */
diff --git a/gst/audiobuffer/Makefile.am b/gst/audiobuffer/Makefile.am
deleted file mode 100644
index 5bdf8d2b6..000000000
--- a/gst/audiobuffer/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-plugin_LTLIBRARIES = libgstaudiobuffer.la
-
-libgstaudiobuffer_la_SOURCES = gstaudioringbuffer.c
-libgstaudiobuffer_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) \
- $(GST_CFLAGS)
-libgstaudiobuffer_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) \
- -lgstaudio-$(GST_API_VERSION)
-
-libgstaudiobuffer_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstaudiobuffer_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
diff --git a/gst/audiobuffer/gstaudioringbuffer.c b/gst/audiobuffer/gstaudioringbuffer.c
deleted file mode 100644
index 9c43402df..000000000
--- a/gst/audiobuffer/gstaudioringbuffer.c
+++ /dev/null
@@ -1,1178 +0,0 @@
-/* GStreamer
- * Copyright (C) 2008 Wim Taymans <wim.taymans@gmail.com>
- *
- * gstaudioringbuffer.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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/**
- * SECTION:element-audioringbuffer
- * @short_description: Asynchronous audio ringbuffer.
- *
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-#include <glib/gstdio.h>
-
-#include <gst/gst.h>
-#include <gst/gst-i18n-plugin.h>
-
-#include <gst/audio/gstringbuffer.h>
-
-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);
-
-GST_DEBUG_CATEGORY_STATIC (audioringbuffer_debug);
-#define GST_CAT_DEFAULT (audioringbuffer_debug)
-
-enum
-{
- LAST_SIGNAL
-};
-
-#define DEFAULT_BUFFER_TIME ((200 * GST_MSECOND) / GST_USECOND)
-#define DEFAULT_SEGMENT_TIME ((10 * GST_MSECOND) / GST_USECOND)
-
-
-enum
-{
- PROP_0,
- PROP_BUFFER_TIME,
- PROP_SEGMENT_TIME
-};
-
-#define GST_TYPE_AUDIO_RINGBUFFER \
- (gst_audio_ringbuffer_get_type())
-#define GST_AUDIO_RINGBUFFER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_RINGBUFFER,GstAudioRingbuffer))
-#define GST_AUDIO_RINGBUFFER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_RINGBUFFER,GstAudioRingbufferClass))
-#define GST_IS_AUDIO_RINGBUFFER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_RINGBUFFER))
-#define GST_IS_AUDIO_RINGBUFFER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_RINGBUFFER))
-#define GST_AUDIO_RINGBUFFER_CAST(obj) \
- ((GstAudioRingbuffer *)(obj))
-
-static GType gst_audio_ringbuffer_get_type (void);
-
-typedef struct _GstAudioRingbuffer GstAudioRingbuffer;
-typedef struct _GstAudioRingbufferClass GstAudioRingbufferClass;
-
-typedef struct _GstIntRingBuffer GstIntRingBuffer;
-typedef struct _GstIntRingBufferClass GstIntRingBufferClass;
-
-struct _GstAudioRingbuffer
-{
- GstElement element;
-
- /*< private > */
- GstPad *sinkpad;
- GstPad *srcpad;
-
- gboolean pushing;
- gboolean pulling;
-
- /* segments to keep track of timestamps */
- GstSegment sink_segment;
- GstSegment src_segment;
-
- /* flowreturn when srcpad is paused */
- gboolean is_eos;
- gboolean flushing;
- gboolean waiting;
-
- GCond *cond;
-
- GstRingBuffer *buffer;
-
- GstClockTime buffer_time;
- GstClockTime segment_time;
-
- guint64 next_sample;
- guint64 last_align;
-};
-
-struct _GstAudioRingbufferClass
-{
- GstElementClass parent_class;
-};
-
-
-#define GST_TYPE_INT_RING_BUFFER (gst_int_ring_buffer_get_type())
-#define GST_INT_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_INT_RING_BUFFER,GstIntRingBuffer))
-#define GST_INT_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_INT_RING_BUFFER,GstIntRingBufferClass))
-#define GST_INT_RING_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_INT_RING_BUFFER, GstIntRingBufferClass))
-#define GST_INT_RING_BUFFER_CAST(obj) ((GstIntRingBuffer *)obj)
-#define GST_IS_INT_RING_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_INT_RING_BUFFER))
-#define GST_IS_INT_RING_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_INT_RING_BUFFER))
-
-
-struct _GstIntRingBuffer
-{
- GstRingBuffer object;
-};
-
-struct _GstIntRingBufferClass
-{
- GstRingBufferClass parent_class;
-};
-
-GST_BOILERPLATE (GstIntRingBuffer, gst_int_ring_buffer, GstRingBuffer,
- GST_TYPE_RING_BUFFER);
-
-static gboolean
-gst_int_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
-{
- spec->seglatency = spec->segtotal;
-
- 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;
-}
-
-static gboolean
-gst_int_ring_buffer_release (GstRingBuffer * buf)
-{
- gst_buffer_unref (buf->data);
- buf->data = NULL;
-
- return TRUE;
-}
-
-static gboolean
-gst_int_ring_buffer_start (GstRingBuffer * buf)
-{
- GstAudioRingbuffer *ringbuffer;
-
- ringbuffer = GST_AUDIO_RINGBUFFER (GST_OBJECT_PARENT (buf));
-
- GST_OBJECT_LOCK (ringbuffer);
- if (G_UNLIKELY (ringbuffer->waiting)) {
- ringbuffer->waiting = FALSE;
- GST_DEBUG_OBJECT (ringbuffer, "start, sending signal");
- g_cond_broadcast (ringbuffer->cond);
- }
- GST_OBJECT_UNLOCK (ringbuffer);
-
- return TRUE;
-}
-
-
-static void
-gst_int_ring_buffer_base_init (gpointer klass)
-{
-}
-
-static void
-gst_int_ring_buffer_class_init (GstIntRingBufferClass * klass)
-{
- GstRingBufferClass *gstringbuffer_class;
-
- gstringbuffer_class = (GstRingBufferClass *) klass;
-
- gstringbuffer_class->acquire =
- GST_DEBUG_FUNCPTR (gst_int_ring_buffer_acquire);
- gstringbuffer_class->release =
- GST_DEBUG_FUNCPTR (gst_int_ring_buffer_release);
- gstringbuffer_class->start = GST_DEBUG_FUNCPTR (gst_int_ring_buffer_start);
-}
-
-static void
-gst_int_ring_buffer_init (GstIntRingBuffer * buff,
- GstIntRingBufferClass * g_class)
-{
-}
-
-static GstRingBuffer *
-gst_int_ring_buffer_new (void)
-{
- GstRingBuffer *res;
-
- res = g_object_new (GST_TYPE_INT_RING_BUFFER, NULL);
-
- return res;
-}
-
-/* can't use boilerplate as we need to register with Queue2 to avoid conflicts
- * with ringbuffer in core elements */
-static void gst_audio_ringbuffer_class_init (GstAudioRingbufferClass * klass);
-static void gst_audio_ringbuffer_init (GstAudioRingbuffer * ringbuffer,
- GstAudioRingbufferClass * g_class);
-static GstElementClass *elem_parent_class;
-
-static GType
-gst_audio_ringbuffer_get_type (void)
-{
- static GType gst_audio_ringbuffer_type = 0;
-
- if (!gst_audio_ringbuffer_type) {
- static const GTypeInfo gst_audio_ringbuffer_info = {
- sizeof (GstAudioRingbufferClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_audio_ringbuffer_class_init,
- NULL,
- NULL,
- sizeof (GstAudioRingbuffer),
- 0,
- (GInstanceInitFunc) gst_audio_ringbuffer_init,
- NULL
- };
-
- gst_audio_ringbuffer_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstAudioRingbuffer",
- &gst_audio_ringbuffer_info, 0);
- }
- return gst_audio_ringbuffer_type;
-}
-
-static void gst_audio_ringbuffer_finalize (GObject * object);
-
-static void gst_audio_ringbuffer_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_audio_ringbuffer_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-static GstFlowReturn gst_audio_ringbuffer_chain (GstPad * pad,
- GstBuffer * buffer);
-static GstFlowReturn gst_audio_ringbuffer_bufferalloc (GstPad * pad,
- guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
-
-static gboolean gst_audio_ringbuffer_handle_sink_event (GstPad * pad,
- GstEvent * event);
-
-static gboolean gst_audio_ringbuffer_handle_src_event (GstPad * pad,
- GstEvent * event);
-static gboolean gst_audio_ringbuffer_handle_src_query (GstPad * pad,
- GstQuery * query);
-
-static GstCaps *gst_audio_ringbuffer_getcaps (GstPad * pad);
-static gboolean gst_audio_ringbuffer_setcaps (GstPad * pad, GstCaps * caps);
-
-static GstFlowReturn gst_audio_ringbuffer_get_range (GstPad * pad,
- guint64 offset, guint length, GstBuffer ** buffer);
-static gboolean gst_audio_ringbuffer_src_checkgetrange_function (GstPad * pad);
-
-static gboolean gst_audio_ringbuffer_src_activate_pull (GstPad * pad,
- gboolean active);
-static gboolean gst_audio_ringbuffer_src_activate_push (GstPad * pad,
- gboolean active);
-static gboolean gst_audio_ringbuffer_sink_activate_push (GstPad * pad,
- gboolean active);
-
-static GstStateChangeReturn gst_audio_ringbuffer_change_state (GstElement *
- element, GstStateChange transition);
-
-/* static guint gst_audio_ringbuffer_signals[LAST_SIGNAL] = { 0 }; */
-
-static void
-gst_audio_ringbuffer_class_init (GstAudioRingbufferClass * klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
-
- elem_parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->set_property =
- GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_set_property);
- gobject_class->get_property =
- GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_get_property);
-
- g_object_class_install_property (gobject_class, PROP_BUFFER_TIME,
- g_param_spec_int64 ("buffer-time", "Buffer Time",
- "Size of audio buffer in nanoseconds", 1,
- G_MAXINT64, DEFAULT_BUFFER_TIME,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_SEGMENT_TIME,
- g_param_spec_int64 ("segment-time", "Segment Time",
- "Audio segment duration in nanoseconds", 1,
- G_MAXINT64, DEFAULT_SEGMENT_TIME,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gst_element_class_add_static_pad_template (gstelement_class, &srctemplate);
- gst_element_class_add_static_pad_template (gstelement_class, &sinktemplate);
-
- gst_element_class_set_static_metadata (gstelement_class, "AudioRingbuffer",
- "Generic",
- "Asynchronous Audio ringbuffer", "Wim Taymans <wim.taymans@gmail.com>");
-
- /* set several parent class virtual functions */
- gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_finalize);
-
- gstelement_class->change_state =
- GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_change_state);
-}
-
-static void
-gst_audio_ringbuffer_init (GstAudioRingbuffer * ringbuffer,
- GstAudioRingbufferClass * g_class)
-{
- ringbuffer->sinkpad =
- gst_pad_new_from_static_template (&sinktemplate, "sink");
-
- gst_pad_set_chain_function (ringbuffer->sinkpad,
- GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_chain));
- gst_pad_set_activatepush_function (ringbuffer->sinkpad,
- GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_sink_activate_push));
- gst_pad_set_event_function (ringbuffer->sinkpad,
- GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_handle_sink_event));
- gst_pad_set_getcaps_function (ringbuffer->sinkpad,
- GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_getcaps));
- gst_pad_set_setcaps_function (ringbuffer->sinkpad,
- GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_setcaps));
- gst_pad_set_bufferalloc_function (ringbuffer->sinkpad,
- GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_bufferalloc));
- gst_element_add_pad (GST_ELEMENT (ringbuffer), ringbuffer->sinkpad);
-
- ringbuffer->srcpad = gst_pad_new_from_static_template (&srctemplate, "src");
-
- gst_pad_set_activatepull_function (ringbuffer->srcpad,
- GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_src_activate_pull));
- gst_pad_set_activatepush_function (ringbuffer->srcpad,
- GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_src_activate_push));
- gst_pad_set_getrange_function (ringbuffer->srcpad,
- GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_get_range));
- gst_pad_set_checkgetrange_function (ringbuffer->srcpad,
- GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_src_checkgetrange_function));
- gst_pad_set_getcaps_function (ringbuffer->srcpad,
- GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_getcaps));
- gst_pad_set_event_function (ringbuffer->srcpad,
- GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_handle_src_event));
- gst_pad_set_query_function (ringbuffer->srcpad,
- GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_handle_src_query));
- gst_element_add_pad (GST_ELEMENT (ringbuffer), ringbuffer->srcpad);
-
- gst_segment_init (&ringbuffer->sink_segment, GST_FORMAT_TIME);
-
- ringbuffer->cond = g_cond_new ();
-
- ringbuffer->is_eos = FALSE;
-
- ringbuffer->buffer_time = DEFAULT_BUFFER_TIME;
- ringbuffer->segment_time = DEFAULT_SEGMENT_TIME;
-
- GST_DEBUG_OBJECT (ringbuffer,
- "initialized ringbuffer's not_empty & not_full conditions");
-}
-
-/* called only once, as opposed to dispose */
-static void
-gst_audio_ringbuffer_finalize (GObject * object)
-{
- GstAudioRingbuffer *ringbuffer = GST_AUDIO_RINGBUFFER (object);
-
- GST_DEBUG_OBJECT (ringbuffer, "finalizing ringbuffer");
-
- g_cond_free (ringbuffer->cond);
-
- G_OBJECT_CLASS (elem_parent_class)->finalize (object);
-}
-
-static GstCaps *
-gst_audio_ringbuffer_getcaps (GstPad * pad)
-{
- GstAudioRingbuffer *ringbuffer;
- GstPad *otherpad;
- GstCaps *result;
-
- ringbuffer = GST_AUDIO_RINGBUFFER (GST_PAD_PARENT (pad));
-
- otherpad =
- (pad == ringbuffer->srcpad ? ringbuffer->sinkpad : ringbuffer->srcpad);
- result = gst_pad_peer_get_caps (otherpad);
- if (result == NULL)
- result = gst_caps_new_any ();
-
- return result;
-}
-
-static gboolean
-gst_audio_ringbuffer_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstAudioRingbuffer *ringbuffer;
- GstRingBufferSpec *spec;
-
- ringbuffer = GST_AUDIO_RINGBUFFER (GST_PAD_PARENT (pad));
-
- if (!ringbuffer->buffer)
- return FALSE;
-
- spec = &ringbuffer->buffer->spec;
-
- GST_DEBUG_OBJECT (ringbuffer, "release old ringbuffer");
-
- /* release old ringbuffer */
- gst_ring_buffer_activate (ringbuffer->buffer, FALSE);
- gst_ring_buffer_release (ringbuffer->buffer);
-
- GST_DEBUG_OBJECT (ringbuffer, "parse caps");
-
- spec->buffer_time = ringbuffer->buffer_time;
- spec->latency_time = ringbuffer->segment_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 (ringbuffer, "acquire ringbuffer");
- if (!gst_ring_buffer_acquire (ringbuffer->buffer, spec))
- goto acquire_error;
-
- GST_DEBUG_OBJECT (ringbuffer, "activate ringbuffer");
- gst_ring_buffer_activate (ringbuffer->buffer, 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 (ringbuffer, "could not parse caps");
- GST_ELEMENT_ERROR (ringbuffer, STREAM, FORMAT,
- (NULL), ("cannot parse audio format."));
- return FALSE;
- }
-acquire_error:
- {
- GST_DEBUG_OBJECT (ringbuffer, "could not acquire ringbuffer");
- return FALSE;
- }
-}
-
-static GstFlowReturn
-gst_audio_ringbuffer_bufferalloc (GstPad * pad, guint64 offset, guint size,
- GstCaps * caps, GstBuffer ** buf)
-{
- GstAudioRingbuffer *ringbuffer;
- GstFlowReturn result;
-
- ringbuffer = GST_AUDIO_RINGBUFFER (GST_PAD_PARENT (pad));
-
- /* Forward to src pad, without setting caps on the src pad */
- result = gst_pad_alloc_buffer (ringbuffer->srcpad, offset, size, caps, buf);
-
- return result;
-}
-
-static gboolean
-gst_audio_ringbuffer_handle_sink_event (GstPad * pad, GstEvent * event)
-{
- GstAudioRingbuffer *ringbuffer;
- gboolean forward;
-
- ringbuffer = GST_AUDIO_RINGBUFFER (GST_OBJECT_PARENT (pad));
-
- forward = ringbuffer->pushing || ringbuffer->pulling;
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_FLUSH_START:
- {
- GST_LOG_OBJECT (ringbuffer, "received flush start event");
- break;
- }
- case GST_EVENT_FLUSH_STOP:
- {
- ringbuffer->is_eos = FALSE;
- GST_LOG_OBJECT (ringbuffer, "received flush stop event");
- break;
- }
- case GST_EVENT_NEWSEGMENT:
- {
- gboolean update;
- gdouble rate, arate;
- GstFormat format;
- gint64 start, stop, time;
-
- gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
- &start, &stop, &time);
-
- gst_segment_set_newsegment_full (&ringbuffer->sink_segment, update, rate,
- arate, format, start, stop, time);
- break;
- }
- case GST_EVENT_EOS:
- ringbuffer->is_eos = TRUE;
- break;
- default:
- break;
- }
- if (forward) {
- gst_pad_push_event (ringbuffer->srcpad, event);
- } else {
- if (event)
- gst_event_unref (event);
- }
- return TRUE;
-}
-
-#define DIFF_TOLERANCE 2
-
-static GstFlowReturn
-gst_audio_ringbuffer_render (GstAudioRingbuffer * ringbuffer, GstBuffer * buf)
-{
- GstRingBuffer *rbuf;
- gint bps, accum;
- guint size;
- guint samples, written, out_samples;
- gint64 diff, align, ctime, cstop;
- guint8 *data;
- guint64 in_offset;
- GstClockTime time, stop, render_start, render_stop, sample_offset;
- gboolean align_next;
-
- rbuf = ringbuffer->buffer;
-
- /* can't do anything when we don't have the device */
- if (G_UNLIKELY (!gst_ring_buffer_is_acquired (rbuf)))
- goto wrong_state;
-
- bps = rbuf->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 (ringbuffer,
- "time %" GST_TIME_FORMAT ", offset %llu, start %" GST_TIME_FORMAT
- ", samples %u", GST_TIME_ARGS (time), in_offset,
- GST_TIME_ARGS (ringbuffer->sink_segment.start), samples);
-
- data = GST_BUFFER_DATA (buf);
-
- stop = time + gst_util_uint64_scale_int (samples, GST_SECOND,
- rbuf->spec.rate);
-
- if (!gst_segment_clip (&ringbuffer->sink_segment, 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, rbuf->spec.rate, GST_SECOND);
- GST_DEBUG_OBJECT (ringbuffer, "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, rbuf->spec.rate, GST_SECOND);
- GST_DEBUG_OBJECT (ringbuffer, "clipping stop to %" GST_TIME_FORMAT " %"
- G_GUINT64_FORMAT " samples", GST_TIME_ARGS (cstop), diff);
- samples -= diff;
- stop = cstop;
- }
-
- /* bring buffer start and stop times to running time */
- render_start =
- gst_segment_to_running_time (&ringbuffer->sink_segment, GST_FORMAT_TIME,
- time);
- render_stop =
- gst_segment_to_running_time (&ringbuffer->sink_segment, GST_FORMAT_TIME,
- stop);
-
- GST_DEBUG_OBJECT (ringbuffer,
- "running: start %" GST_TIME_FORMAT " - stop %" GST_TIME_FORMAT,
- GST_TIME_ARGS (render_start), GST_TIME_ARGS (render_stop));
-
- /* and bring the time to the rate corrected offset in the buffer */
- render_start = gst_util_uint64_scale_int (render_start,
- rbuf->spec.rate, GST_SECOND);
- render_stop = gst_util_uint64_scale_int (render_stop,
- rbuf->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 (ringbuffer->sink_segment.rate >= 0.0) {
- sample_offset = render_start;
- if (ringbuffer->sink_segment.rate == 1.0)
- render_stop = sample_offset + samples;
- } else {
- sample_offset = render_stop;
- if (ringbuffer->sink_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 (ringbuffer, "resync after discont");
- goto no_align;
- }
-
- /* resync when we don't know what to align the sample with */
- if (G_UNLIKELY (ringbuffer->next_sample == -1)) {
- GST_DEBUG_OBJECT (ringbuffer,
- "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 >= ringbuffer->next_sample)
- diff = sample_offset - ringbuffer->next_sample;
- else
- diff = ringbuffer->next_sample - sample_offset;
-
- /* 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. We always resync if we got a discont anyway and
- * non-discont should be aligned by definition. */
- if (G_LIKELY (diff < rbuf->spec.rate / DIFF_TOLERANCE)) {
- /* calc align with previous sample */
- align = ringbuffer->next_sample - sample_offset;
- GST_DEBUG_OBJECT (ringbuffer,
- "align with prev sample, ABS (%" G_GINT64_FORMAT ") < %d", align,
- rbuf->spec.rate / DIFF_TOLERANCE);
- } else {
- /* bring sample diff to seconds for error message */
- diff = gst_util_uint64_scale_int (diff, GST_SECOND, rbuf->spec.rate);
- /* timestamps drifted apart from previous samples too much, we need to
- * resync. We log this as an element warning. */
- GST_ELEMENT_WARNING (ringbuffer, CORE, CLOCK,
- ("Compensating for audio synchronisation problems"),
- ("Unexpected discontinuity in audio timestamps of more "
- "than half a second (%" GST_TIME_FORMAT "), resyncing",
- GST_TIME_ARGS (diff)));
- align = 0;
- }
- ringbuffer->last_align = align;
-
- /* apply alignment */
- render_start += align;
- render_stop += align;
-
-no_align:
- /* number of target samples is difference between start and stop */
- out_samples = render_stop - render_start;
-
- /* we render the first or last sample first, depending on the rate */
- if (ringbuffer->sink_segment.rate >= 0.0)
- sample_offset = render_start;
- else
- sample_offset = render_stop;
-
- GST_DEBUG_OBJECT (ringbuffer, "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 (rbuf, &sample_offset, data, samples,
- out_samples, &accum);
-
- GST_DEBUG_OBJECT (ringbuffer, "wrote %u of %u", written, samples);
- /* if we wrote all, we're done */
- if (written == samples)
- break;
-
- GST_OBJECT_LOCK (ringbuffer);
- if (ringbuffer->flushing)
- goto flushing;
- GST_OBJECT_UNLOCK (ringbuffer);
-
- /* if we got interrupted, we cannot assume that the next sample should
- * be aligned to this one */
- align_next = FALSE;
-
- samples -= written;
- data += written * bps;
- } while (TRUE);
-
- if (align_next)
- ringbuffer->next_sample = sample_offset;
- else
- ringbuffer->next_sample = -1;
-
- GST_DEBUG_OBJECT (ringbuffer, "next sample expected at %" G_GUINT64_FORMAT,
- ringbuffer->next_sample);
-
- if (GST_CLOCK_TIME_IS_VALID (stop) && stop >= ringbuffer->sink_segment.stop) {
- GST_DEBUG_OBJECT (ringbuffer,
- "start playback because we are at the end of segment");
- gst_ring_buffer_start (rbuf);
- }
-
- return GST_FLOW_OK;
-
- /* SPECIAL cases */
-out_of_segment:
- {
- GST_DEBUG_OBJECT (ringbuffer,
- "dropping sample out of segment time %" GST_TIME_FORMAT ", start %"
- GST_TIME_FORMAT, GST_TIME_ARGS (time),
- GST_TIME_ARGS (ringbuffer->sink_segment.start));
- return GST_FLOW_OK;
- }
- /* ERRORS */
-wrong_state:
- {
- GST_DEBUG_OBJECT (ringbuffer, "ringbuffer not negotiated");
- GST_ELEMENT_ERROR (ringbuffer, STREAM, FORMAT, (NULL),
- ("ringbuffer not negotiated."));
- return GST_FLOW_NOT_NEGOTIATED;
- }
-wrong_size:
- {
- GST_DEBUG_OBJECT (ringbuffer, "wrong size");
- GST_ELEMENT_ERROR (ringbuffer, STREAM, WRONG_TYPE,
- (NULL), ("ringbuffer received buffer of wrong size."));
- return GST_FLOW_ERROR;
- }
-flushing:
- {
- GST_DEBUG_OBJECT (ringbuffer, "ringbuffer is flushing");
- GST_OBJECT_UNLOCK (ringbuffer);
- return GST_FLOW_FLUSHING;
- }
-}
-
-static GstFlowReturn
-gst_audio_ringbuffer_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstFlowReturn res;
- GstAudioRingbuffer *ringbuffer;
-
- ringbuffer = GST_AUDIO_RINGBUFFER (GST_OBJECT_PARENT (pad));
-
- if (ringbuffer->pushing) {
- GST_DEBUG_OBJECT (ringbuffer, "proxy pushing buffer");
- res = gst_pad_push (ringbuffer->srcpad, buffer);
- } else {
- GST_DEBUG_OBJECT (ringbuffer, "render buffer in ringbuffer");
- res = gst_audio_ringbuffer_render (ringbuffer, buffer);
- }
-
- return res;
-}
-
-static gboolean
-gst_audio_ringbuffer_handle_src_event (GstPad * pad, GstEvent * event)
-{
- gboolean res = TRUE;
- GstAudioRingbuffer *ringbuffer = GST_AUDIO_RINGBUFFER (GST_PAD_PARENT (pad));
-
- /* just forward upstream */
- res = gst_pad_push_event (ringbuffer->sinkpad, event);
-
- return res;
-}
-
-static gboolean
-gst_audio_ringbuffer_handle_src_query (GstPad * pad, GstQuery * query)
-{
- GstAudioRingbuffer *ringbuffer;
-
- ringbuffer = GST_AUDIO_RINGBUFFER (GST_PAD_PARENT (pad));
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_POSITION:
- break;
- case GST_QUERY_DURATION:
- break;
- case GST_QUERY_BUFFERING:
- break;
- default:
- break;
- }
-
- return TRUE;
-}
-
-static GstFlowReturn
-gst_audio_ringbuffer_get_range (GstPad * pad, guint64 offset, guint length,
- GstBuffer ** buffer)
-{
- GstAudioRingbuffer *ringbuffer;
- GstRingBuffer *rbuf;
- GstFlowReturn ret;
-
- ringbuffer = GST_AUDIO_RINGBUFFER_CAST (gst_pad_get_parent (pad));
-
- rbuf = ringbuffer->buffer;
-
- if (ringbuffer->pulling) {
- GST_DEBUG_OBJECT (ringbuffer, "proxy pulling range");
- ret = gst_pad_pull_range (ringbuffer->sinkpad, offset, length, buffer);
- } else {
- guint8 *data;
- guint len;
- guint64 sample;
- gint bps, segsize, segtotal, sps;
- gint sampleslen, segdone;
- gint readseg, sampleoff;
- guint8 *dest;
-
- GST_DEBUG_OBJECT (ringbuffer,
- "pulling data at %" G_GUINT64_FORMAT ", length %u", offset, length);
-
- if (offset != ringbuffer->src_segment.last_stop) {
- GST_DEBUG_OBJECT (ringbuffer, "expected offset %" G_GINT64_FORMAT,
- ringbuffer->src_segment.last_stop);
- }
-
- /* first wait till we have something in the ringbuffer and it
- * is running */
- GST_OBJECT_LOCK (ringbuffer);
- if (ringbuffer->flushing)
- goto flushing;
-
- while (ringbuffer->waiting) {
- GST_DEBUG_OBJECT (ringbuffer, "waiting for unlock");
- g_cond_wait (ringbuffer->cond, GST_OBJECT_GET_LOCK (ringbuffer));
- GST_DEBUG_OBJECT (ringbuffer, "unlocked");
-
- if (ringbuffer->flushing)
- goto flushing;
- }
- GST_OBJECT_UNLOCK (ringbuffer);
-
- bps = rbuf->spec.bytes_per_sample;
-
- if (G_UNLIKELY (length % bps) != 0)
- goto wrong_size;
-
- segsize = rbuf->spec.segsize;
- segtotal = rbuf->spec.segtotal;
- sps = rbuf->samples_per_seg;
- dest = GST_BUFFER_DATA (rbuf->data);
-
- sample = offset / bps;
- len = length / bps;
-
- *buffer = gst_buffer_new_and_alloc (length);
- data = GST_BUFFER_DATA (*buffer);
-
- while (len) {
- gint diff;
-
- /* figure out the segment and the offset inside the segment where
- * the sample should be read from. */
- readseg = sample / sps;
- sampleoff = (sample % sps);
-
- segdone = g_atomic_int_get (&rbuf->segdone) - rbuf->segbase;
-
- diff = readseg - segdone;
-
- /* we can read now */
- readseg = readseg % segtotal;
- sampleslen = MIN (sps - sampleoff, len);
-
- GST_DEBUG_OBJECT (ringbuffer,
- "read @%p seg %d, off %d, sampleslen %d, diff %d",
- dest + readseg * segsize, readseg, sampleoff, sampleslen, diff);
-
- memcpy (data, dest + (readseg * segsize) + (sampleoff * bps),
- (sampleslen * bps));
-
- if (diff > 0)
- gst_ring_buffer_advance (rbuf, diff);
-
- len -= sampleslen;
- sample += sampleslen;
- data += sampleslen * bps;
- }
-
- ringbuffer->src_segment.last_stop += length;
-
- ret = GST_FLOW_OK;
- }
-
- gst_object_unref (ringbuffer);
-
- return ret;
-
- /* ERRORS */
-flushing:
- {
- GST_DEBUG_OBJECT (ringbuffer, "we are flushing");
- GST_OBJECT_UNLOCK (ringbuffer);
- gst_object_unref (ringbuffer);
- return GST_FLOW_FLUSHING;
- }
-wrong_size:
- {
- GST_DEBUG_OBJECT (ringbuffer, "wrong size");
- GST_ELEMENT_ERROR (ringbuffer, STREAM, WRONG_TYPE,
- (NULL), ("asked to pull buffer of wrong size."));
- return GST_FLOW_ERROR;
- }
-}
-
-static gboolean
-gst_audio_ringbuffer_src_checkgetrange_function (GstPad * pad)
-{
- gboolean ret;
-
- /* we can always operate in pull mode */
- ret = TRUE;
-
- return ret;
-}
-
-/* sink currently only operates in push mode */
-static gboolean
-gst_audio_ringbuffer_sink_activate_push (GstPad * pad, gboolean active)
-{
- gboolean result = TRUE;
- GstAudioRingbuffer *ringbuffer;
-
- ringbuffer = GST_AUDIO_RINGBUFFER (gst_pad_get_parent (pad));
-
- if (active) {
- GST_DEBUG_OBJECT (ringbuffer, "activating push mode");
- ringbuffer->is_eos = FALSE;
- ringbuffer->pulling = FALSE;
- } else {
- /* unblock chain function */
- GST_DEBUG_OBJECT (ringbuffer, "deactivating push mode");
- ringbuffer->pulling = FALSE;
- }
-
- gst_object_unref (ringbuffer);
-
- return result;
-}
-
-/* src operating in push mode, we will proxy the push from upstream, basically
- * acting as a passthrough element. */
-static gboolean
-gst_audio_ringbuffer_src_activate_push (GstPad * pad, gboolean active)
-{
- gboolean result = FALSE;
- GstAudioRingbuffer *ringbuffer;
-
- ringbuffer = GST_AUDIO_RINGBUFFER (gst_pad_get_parent (pad));
-
- if (active) {
- GST_DEBUG_OBJECT (ringbuffer, "activating push mode");
- ringbuffer->is_eos = FALSE;
- ringbuffer->pushing = TRUE;
- ringbuffer->pulling = FALSE;
- result = TRUE;
- } else {
- GST_DEBUG_OBJECT (ringbuffer, "deactivating push mode");
- ringbuffer->pushing = FALSE;
- ringbuffer->pulling = FALSE;
- result = TRUE;
- }
-
- gst_object_unref (ringbuffer);
-
- return result;
-}
-
-/* pull mode, downstream will call our getrange function */
-static gboolean
-gst_audio_ringbuffer_src_activate_pull (GstPad * pad, gboolean active)
-{
- gboolean result;
- GstAudioRingbuffer *ringbuffer;
-
- ringbuffer = GST_AUDIO_RINGBUFFER (gst_pad_get_parent (pad));
-
- if (active) {
- GST_DEBUG_OBJECT (ringbuffer, "activating pull mode");
-
- /* try to activate upstream in pull mode as well. If it fails, no problems,
- * we'll be activated in push mode. Remember that we are pulling-through */
- ringbuffer->pulling = gst_pad_activate_pull (ringbuffer->sinkpad, active);
-
- ringbuffer->is_eos = FALSE;
- ringbuffer->waiting = TRUE;
- ringbuffer->flushing = FALSE;
- gst_segment_init (&ringbuffer->src_segment, GST_FORMAT_BYTES);
- result = TRUE;
- } else {
- GST_DEBUG_OBJECT (ringbuffer, "deactivating pull mode");
-
- if (ringbuffer->pulling)
- gst_pad_activate_pull (ringbuffer->sinkpad, active);
-
- ringbuffer->pulling = FALSE;
- ringbuffer->waiting = FALSE;
- ringbuffer->flushing = TRUE;
- result = TRUE;
- }
- gst_object_unref (ringbuffer);
-
- return result;
-}
-
-static GstStateChangeReturn
-gst_audio_ringbuffer_change_state (GstElement * element,
- GstStateChange transition)
-{
- GstAudioRingbuffer *ringbuffer;
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
-
- ringbuffer = GST_AUDIO_RINGBUFFER (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- if (ringbuffer->buffer == NULL) {
- ringbuffer->buffer = gst_int_ring_buffer_new ();
- gst_object_set_parent (GST_OBJECT (ringbuffer->buffer),
- GST_OBJECT (ringbuffer));
- gst_ring_buffer_open_device (ringbuffer->buffer);
- }
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- ringbuffer->next_sample = -1;
- ringbuffer->last_align = -1;
- gst_ring_buffer_set_flushing (ringbuffer->buffer, FALSE);
- gst_ring_buffer_may_start (ringbuffer->buffer, TRUE);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- GST_OBJECT_LOCK (ringbuffer);
- ringbuffer->flushing = TRUE;
- ringbuffer->waiting = FALSE;
- g_cond_broadcast (ringbuffer->cond);
- GST_OBJECT_UNLOCK (ringbuffer);
-
- gst_ring_buffer_set_flushing (ringbuffer->buffer, TRUE);
- gst_ring_buffer_may_start (ringbuffer->buffer, FALSE);
- break;
- default:
- break;
- }
-
- ret =
- GST_ELEMENT_CLASS (elem_parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- gst_ring_buffer_activate (ringbuffer->buffer, FALSE);
- gst_ring_buffer_release (ringbuffer->buffer);
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- if (ringbuffer->buffer != NULL) {
- gst_ring_buffer_close_device (ringbuffer->buffer);
- gst_object_unparent (GST_OBJECT (ringbuffer->buffer));
- ringbuffer->buffer = NULL;
- }
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-static void
-gst_audio_ringbuffer_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec)
-{
- GstAudioRingbuffer *ringbuffer;
-
- ringbuffer = GST_AUDIO_RINGBUFFER (object);
-
- switch (prop_id) {
- case PROP_BUFFER_TIME:
- ringbuffer->buffer_time = g_value_get_int64 (value);
- break;
- case PROP_SEGMENT_TIME:
- ringbuffer->segment_time = g_value_get_int64 (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_audio_ringbuffer_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec)
-{
- GstAudioRingbuffer *ringbuffer;
-
- ringbuffer = GST_AUDIO_RINGBUFFER (object);
-
- switch (prop_id) {
- case PROP_BUFFER_TIME:
- g_value_set_int64 (value, ringbuffer->buffer_time);
- break;
- case PROP_SEGMENT_TIME:
- g_value_set_int64 (value, ringbuffer->segment_time);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (audioringbuffer_debug, "audioringbuffer", 0,
- "Audio ringbuffer 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, "audioringbuffer", GST_RANK_NONE,
- GST_TYPE_AUDIO_RINGBUFFER);
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- audioringbuffer,
- "An audio ringbuffer", plugin_init, VERSION, GST_LICENSE,
- GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/audiobuffer/meson.build b/gst/audiobuffer/meson.build
deleted file mode 100644
index 0edbbde82..000000000
--- a/gst/audiobuffer/meson.build
+++ /dev/null
@@ -1,12 +0,0 @@
-audiobuffer_sources = [
- 'gstaudioringbuffer.c',
-]
-
-gstaudiobuffer = library('gstaudiobuffer',
- audiobuffer_sources,
- c_args : gst_plugins_bad_args,
- include_directories : [configinc, libsinc],
- dependencies : [gstbase_dep, gstaudio_dep],
- install : true,
- install_dir : plugins_install_dir,
-)
diff --git a/gst/cdxaparse/Makefile.am b/gst/cdxaparse/Makefile.am
deleted file mode 100644
index 0a69ec714..000000000
--- a/gst/cdxaparse/Makefile.am
+++ /dev/null
@@ -1,24 +0,0 @@
-plugin_LTLIBRARIES = libgstcdxaparse.la
-
-libgstcdxaparse_la_SOURCES = \
- gstcdxaparse.c \
- gstvcdparse.c
-
-
-noinst_HEADERS = \
- gstcdxaparse.h \
- gstvcdparse.h
-
-libgstcdxaparse_la_CFLAGS = \
- $(GST_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(GST_PLUGINS_BASE_CFLAGS)
-
-libgstcdxaparse_la_LIBADD = \
- $(GST_LIBS) \
- $(GST_BASE_LIBS) \
- $(GST_PLUGINS_BASE_LIBS) \
- -lgstriff-@GST_API_VERSION@
-
-libgstcdxaparse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstcdxaparse_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
diff --git a/gst/cdxaparse/gstcdxaparse.c b/gst/cdxaparse/gstcdxaparse.c
deleted file mode 100644
index 4334362e0..000000000
--- a/gst/cdxaparse/gstcdxaparse.c
+++ /dev/null
@@ -1,585 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * <2002> Wim Taymans <wim.taymans@chello.be>
- * <2006> Tim-Philipp Müller <tim centricular net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
-#include <string.h>
-
-#include "gstcdxaparse.h"
-#include "gstvcdparse.h"
-
-#include <gst/riff/riff-ids.h>
-#include <gst/riff/riff-read.h>
-
-GST_DEBUG_CATEGORY (vcdparse_debug);
-
-GST_DEBUG_CATEGORY_STATIC (cdxaparse_debug);
-#define GST_CAT_DEFAULT cdxaparse_debug
-
-static gboolean gst_cdxa_parse_sink_activate (GstPad * sinkpad);
-static void gst_cdxa_parse_loop (GstPad * sinkpad);
-static gboolean gst_cdxa_parse_sink_activate_pull (GstPad * sinkpad,
- gboolean active);
-static GstStateChangeReturn gst_cdxa_parse_change_state (GstElement * element,
- GstStateChange transition);
-static gboolean gst_cdxa_parse_src_event (GstPad * srcpad, GstEvent * event);
-static gboolean gst_cdxa_parse_src_query (GstPad * srcpad, GstQuery * query);
-
-static GstStaticPadTemplate sink_template_factory =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-cdxa")
- );
-
-static GstStaticPadTemplate src_template_factory =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/mpeg, " "systemstream = (boolean) TRUE")
- );
-
-GST_BOILERPLATE (GstCDXAParse, gst_cdxa_parse, GstElement, GST_TYPE_ELEMENT);
-
-static void
-gst_cdxa_parse_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_static_metadata (element_class, "(S)VCD parser",
- "Codec/Parser",
- "Parse a .dat file from (S)VCD into raw MPEG-1",
- "Wim Taymans <wim.taymans@tvd.be>");
-
- /* register src pads */
- gst_element_class_add_static_pad_template (element_class,
- &sink_template_factory);
- gst_element_class_add_static_pad_template (element_class,
- &src_template_factory);
-}
-
-static void
-gst_cdxa_parse_class_init (GstCDXAParseClass * klass)
-{
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
-
- gstelement_class->change_state =
- GST_DEBUG_FUNCPTR (gst_cdxa_parse_change_state);
-}
-
-static void
-gst_cdxa_parse_init (GstCDXAParse * cdxaparse, GstCDXAParseClass * klass)
-{
- GstCaps *caps;
-
- cdxaparse->sinkpad =
- gst_pad_new_from_static_template (&sink_template_factory, "sink");
- gst_pad_set_activate_function (cdxaparse->sinkpad,
- GST_DEBUG_FUNCPTR (gst_cdxa_parse_sink_activate));
- gst_pad_set_activatepull_function (cdxaparse->sinkpad,
- GST_DEBUG_FUNCPTR (gst_cdxa_parse_sink_activate_pull));
-
- gst_element_add_pad (GST_ELEMENT (cdxaparse), cdxaparse->sinkpad);
-
- cdxaparse->srcpad =
- gst_pad_new_from_static_template (&src_template_factory, "src");
-
- gst_pad_set_event_function (cdxaparse->srcpad,
- GST_DEBUG_FUNCPTR (gst_cdxa_parse_src_event));
- gst_pad_set_query_function (cdxaparse->srcpad,
- GST_DEBUG_FUNCPTR (gst_cdxa_parse_src_query));
-
- caps = gst_caps_new_simple ("video/mpeg",
- "systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
- gst_pad_use_fixed_caps (cdxaparse->srcpad);
- gst_pad_set_caps (cdxaparse->srcpad, caps);
- gst_caps_unref (caps);
- gst_element_add_pad (GST_ELEMENT (cdxaparse), cdxaparse->srcpad);
-
-
- cdxaparse->state = GST_CDXA_PARSE_START;
- cdxaparse->offset = 0;
- cdxaparse->datasize = 0;
- cdxaparse->datastart = -1;
-}
-
-#define HAVE_FOURCC(data,fourcc) (GST_READ_UINT32_LE((data))==(fourcc))
-
-static gboolean
-gst_cdxa_parse_stream_init (GstCDXAParse * cdxa)
-{
- GstFlowReturn flow_ret;
- GstBuffer *buf = NULL;
- guint8 *data;
-
- flow_ret = gst_pad_pull_range (cdxa->sinkpad, cdxa->offset, 12, &buf);
- if (flow_ret != GST_FLOW_OK)
- return flow_ret;
-
- if (GST_BUFFER_SIZE (buf) < 12)
- goto wrong_type;
-
- data = GST_BUFFER_DATA (buf);
- if (!HAVE_FOURCC (data, GST_RIFF_TAG_RIFF)) {
- GST_ERROR_OBJECT (cdxa, "Not a RIFF file");
- goto wrong_type;
- }
-
- if (!HAVE_FOURCC (data + 8, GST_RIFF_RIFF_CDXA)) {
- GST_ERROR_OBJECT (cdxa, "RIFF file does not have CDXA content");
- goto wrong_type;
- }
-
- cdxa->offset += 12;
- gst_buffer_unref (buf);
-
- return TRUE;
-
-wrong_type:
-
- GST_ELEMENT_ERROR (cdxa, STREAM, WRONG_TYPE, (NULL), (NULL));
- gst_buffer_unref (buf);
- return FALSE;
-}
-
-static gboolean
-gst_cdxa_parse_sink_activate (GstPad * sinkpad)
-{
- GstCDXAParse *cdxa = GST_CDXA_PARSE (GST_PAD_PARENT (sinkpad));
-
- if (!gst_pad_check_pull_range (sinkpad) ||
- !gst_pad_activate_pull (sinkpad, TRUE)) {
- GST_DEBUG_OBJECT (cdxa, "No pull mode");
- return FALSE;
- }
-
- /* If we can activate pull_range upstream, then read the header
- * and see if it's really a RIFF CDXA file. */
- GST_DEBUG_OBJECT (cdxa, "Activated pull mode. Reading RIFF header");
- if (!gst_cdxa_parse_stream_init (cdxa))
- return FALSE;
-
- return TRUE;
-}
-
-static gboolean
-gst_cdxa_parse_sink_activate_pull (GstPad * sinkpad, gboolean active)
-{
- if (active) {
- /* if we have a scheduler we can start the task */
- gst_pad_start_task (sinkpad, (GstTaskFunction) gst_cdxa_parse_loop,
- sinkpad, NULL);
- } else {
- gst_pad_stop_task (sinkpad);
- }
-
- return TRUE;
-}
-
-/*
- * A sector is 2352 bytes long and is composed of:
- *
- * ! sync ! header ! subheader ! data ... ! edc !
- * ! 12 bytes ! 4 bytes ! 8 bytes ! 2324 bytes ! 4 bytes !
- * !-------------------------------------------------------!
- *
- * We strip the data out of it and send it to the srcpad.
- *
- * sync : 00 FF FF FF FF FF FF FF FF FF FF 00
- * header : hour minute second mode
- * sub-header : track channel sub_mode coding repeat (4 bytes)
- * edc : checksum
- */
-
-/* FIXME: use define from gstcdxastrip.h */
-#define GST_CDXA_SECTOR_SIZE 2352
-#define GST_CDXA_DATA_SIZE 2324
-#define GST_CDXA_HEADER_SIZE 24
-
-/* FIXME: use version from gstcdxastrip.c */
-static GstBuffer *
-gst_cdxa_parse_strip (GstBuffer * buf)
-{
- GstBuffer *sub;
-
- g_assert (GST_BUFFER_SIZE (buf) >= GST_CDXA_SECTOR_SIZE);
-
- /* Skip CDXA headers, only keep data.
- * FIXME: check sync, resync, ... */
- sub = gst_buffer_create_sub (buf, GST_CDXA_HEADER_SIZE, GST_CDXA_DATA_SIZE);
- gst_buffer_unref (buf);
-
- return sub;
-}
-
-/* -1 = no sync (discard buffer),
- * otherwise offset indicates syncpoint in buffer.
- */
-
-static gint
-gst_cdxa_parse_sync (GstBuffer * buf)
-{
- const guint8 sync_marker[12] = { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00
- };
- guint8 *data;
- guint size;
-
- size = GST_BUFFER_SIZE (buf);
- data = GST_BUFFER_DATA (buf);
-
- while (size >= 12) {
- if (memcmp (data, sync_marker, 12) == 0) {
- return (gint) (data - GST_BUFFER_DATA (buf));
- }
- --size;
- ++data;
- }
- return -1;
-}
-
-static void
-gst_cdxa_parse_loop (GstPad * sinkpad)
-{
- GstFlowReturn flow_ret;
- GstCDXAParse *cdxa;
- GstBuffer *buf = NULL;
- gint sync_offset = -1;
-
- cdxa = GST_CDXA_PARSE (GST_PAD_PARENT (sinkpad));
-
- if (cdxa->datasize <= 0) {
- GstFormat format = GST_FORMAT_BYTES;
- GstPad *peer;
-
- if ((peer = gst_pad_get_peer (sinkpad))) {
- if (!gst_pad_query_duration (peer, &format, &cdxa->datasize)) {
- GST_DEBUG_OBJECT (cdxa, "Failed to query upstream size!");
- gst_object_unref (peer);
- goto pause;
- }
- gst_object_unref (peer);
- }
- GST_DEBUG_OBJECT (cdxa, "Upstream size: %" G_GINT64_FORMAT, cdxa->datasize);
- }
-
- do {
- guint req;
-
- req = 8 + GST_CDXA_SECTOR_SIZE; /* riff chunk header = 8 bytes */
-
- buf = NULL;
- flow_ret = gst_pad_pull_range (cdxa->sinkpad, cdxa->offset, req, &buf);
-
- if (flow_ret != GST_FLOW_OK) {
- GST_DEBUG_OBJECT (cdxa, "Pull flow: %s", gst_flow_get_name (flow_ret));
- goto pause;
- }
-
- if (GST_BUFFER_SIZE (buf) < req) {
- GST_DEBUG_OBJECT (cdxa, "Short read, only got %u/%u bytes",
- GST_BUFFER_SIZE (buf), req);
- goto eos;
- }
-
- sync_offset = gst_cdxa_parse_sync (buf);
- gst_buffer_unref (buf);
- buf = NULL;
-
- if (sync_offset >= 0)
- break;
-
- cdxa->offset += req;
- cdxa->bytes_skipped += req;
- } while (1);
-
- cdxa->offset += sync_offset;
- cdxa->bytes_skipped += sync_offset;
-
- /* first sync frame? */
- if (cdxa->datastart < 0) {
- GST_LOG_OBJECT (cdxa, "datastart=0x%" G_GINT64_MODIFIER "x", cdxa->offset);
- cdxa->datastart = cdxa->offset;
- cdxa->bytes_skipped = 0;
- cdxa->bytes_sent = 0;
- }
-
- GST_DEBUG_OBJECT (cdxa, "pulling buffer at offset 0x%" G_GINT64_MODIFIER "x",
- cdxa->offset);
-
- buf = NULL;
- flow_ret = gst_pad_pull_range (cdxa->sinkpad, cdxa->offset,
- GST_CDXA_SECTOR_SIZE, &buf);
-
- if (flow_ret != GST_FLOW_OK) {
- GST_DEBUG_OBJECT (cdxa, "Flow: %s", gst_flow_get_name (flow_ret));
- goto pause;
- }
-
- if (GST_BUFFER_SIZE (buf) < GST_CDXA_SECTOR_SIZE) {
- GST_DEBUG_OBJECT (cdxa, "Short read, only got %u/%u bytes",
- GST_BUFFER_SIZE (buf), GST_CDXA_SECTOR_SIZE);
- goto eos;
- }
-
- buf = gst_cdxa_parse_strip (buf);
-
- GST_DEBUG_OBJECT (cdxa, "pushing buffer %p", buf);
- gst_buffer_set_caps (buf, GST_PAD_CAPS (cdxa->srcpad));
-
- cdxa->offset += GST_BUFFER_SIZE (buf);
- cdxa->bytes_sent += GST_BUFFER_SIZE (buf);
-
- flow_ret = gst_pad_push (cdxa->srcpad, buf);
- if (flow_ret != GST_FLOW_OK) {
- GST_DEBUG_OBJECT (cdxa, "Push flow: %s", gst_flow_get_name (flow_ret));
- goto pause;
- }
-
- return;
-
-eos:
- {
- GST_DEBUG_OBJECT (cdxa, "Sending EOS");
- if (buf)
- gst_buffer_unref (buf);
- buf = NULL;
- gst_pad_push_event (cdxa->srcpad, gst_event_new_eos ());
- /* fallthrough */
- }
-pause:
- {
- GST_DEBUG_OBJECT (cdxa, "Pausing");
- gst_pad_pause_task (cdxa->sinkpad);
- return;
- }
-}
-
-static gint64
-gst_cdxa_parse_convert_src_to_sink_offset (GstCDXAParse * cdxa, gint64 src)
-{
- gint64 sink;
-
- sink = src + cdxa->datastart;
- sink = gst_util_uint64_scale (sink, GST_CDXA_SECTOR_SIZE, GST_CDXA_DATA_SIZE);
-
- /* FIXME: take into account skipped bytes */
-
- GST_DEBUG_OBJECT (cdxa, "src offset=%" G_GINT64_FORMAT ", sink offset=%"
- G_GINT64_FORMAT, src, sink);
-
- return sink;
-}
-
-static gint64
-gst_cdxa_parse_convert_sink_to_src_offset (GstCDXAParse * cdxa, gint64 sink)
-{
- gint64 src;
-
- src = sink - cdxa->datastart;
- src = gst_util_uint64_scale (src, GST_CDXA_DATA_SIZE, GST_CDXA_SECTOR_SIZE);
-
- /* FIXME: take into account skipped bytes */
-
- GST_DEBUG_OBJECT (cdxa, "sink offset=%" G_GINT64_FORMAT ", src offset=%"
- G_GINT64_FORMAT, sink, src);
-
- return src;
-}
-
-static gboolean
-gst_cdxa_parse_do_seek (GstCDXAParse * cdxa, GstEvent * event)
-{
- GstSeekFlags flags;
- GstSeekType start_type;
- GstFormat format;
- gint64 start, off, upstream_size;
-
- gst_event_parse_seek (event, NULL, &format, &flags, &start_type, &start,
- NULL, NULL);
-
- if (format != GST_FORMAT_BYTES) {
- GST_DEBUG_OBJECT (cdxa, "Can only handle seek in BYTES format");
- return FALSE;
- }
-
- if (start_type != GST_SEEK_TYPE_SET) {
- GST_DEBUG_OBJECT (cdxa, "Can only handle seek from start (SEEK_TYPE_SET)");
- return FALSE;
- }
-
- GST_OBJECT_LOCK (cdxa);
- off = gst_cdxa_parse_convert_src_to_sink_offset (cdxa, start);
- upstream_size = cdxa->datasize;
- GST_OBJECT_UNLOCK (cdxa);
-
- if (off >= upstream_size) {
- GST_DEBUG_OBJECT (cdxa, "Invalid target offset %" G_GINT64_FORMAT ", file "
- "is only %" G_GINT64_FORMAT " bytes in size", off, upstream_size);
- return FALSE;
- }
-
- /* unlock upstream pull_range */
- gst_pad_push_event (cdxa->sinkpad, gst_event_new_flush_start ());
-
- /* make sure our loop function exits */
- gst_pad_push_event (cdxa->srcpad, gst_event_new_flush_start ());
-
- /* wait for streaming to finish */
- GST_PAD_STREAM_LOCK (cdxa->sinkpad);
-
- /* prepare for streaming again */
- gst_pad_push_event (cdxa->sinkpad, gst_event_new_flush_stop ());
- gst_pad_push_event (cdxa->srcpad, gst_event_new_flush_stop ());
-
- gst_pad_push_event (cdxa->srcpad,
- gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_BYTES,
- start, GST_CLOCK_TIME_NONE, 0));
-
- GST_OBJECT_LOCK (cdxa);
- cdxa->offset = off;
- GST_OBJECT_UNLOCK (cdxa);
-
- /* and restart */
- gst_pad_start_task (cdxa->sinkpad,
- (GstTaskFunction) gst_cdxa_parse_loop, cdxa->sinkpad, NULL);
-
- GST_PAD_STREAM_UNLOCK (cdxa->sinkpad);
- return TRUE;
-}
-
-static gboolean
-gst_cdxa_parse_src_event (GstPad * srcpad, GstEvent * event)
-{
- GstCDXAParse *cdxa = GST_CDXA_PARSE (gst_pad_get_parent (srcpad));
- gboolean res = FALSE;
-
- GST_DEBUG_OBJECT (cdxa, "Handling %s event", GST_EVENT_TYPE_NAME (event));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_SEEK:
- res = gst_cdxa_parse_do_seek (cdxa, event);
- break;
- default:
- res = gst_pad_event_default (srcpad, event);
- break;
- }
-
- gst_object_unref (cdxa);
- return res;
-}
-
-static gboolean
-gst_cdxa_parse_src_query (GstPad * srcpad, GstQuery * query)
-{
- GstCDXAParse *cdxa = GST_CDXA_PARSE (gst_pad_get_parent (srcpad));
- gboolean res = FALSE;
-
- GST_DEBUG_OBJECT (cdxa, "Handling %s query",
- gst_query_type_get_name (GST_QUERY_TYPE (query)));
-
- res = gst_pad_query_default (srcpad, query);
-
- if (res) {
- GstFormat format;
- gint64 val;
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_DURATION:
- gst_query_parse_duration (query, &format, &val);
- if (format == GST_FORMAT_BYTES) {
- val = gst_cdxa_parse_convert_sink_to_src_offset (cdxa, val);
- gst_query_set_duration (query, format, val);
- }
- break;
- case GST_QUERY_POSITION:
- gst_query_parse_position (query, &format, &val);
- if (format == GST_FORMAT_BYTES) {
- val = gst_cdxa_parse_convert_sink_to_src_offset (cdxa, val);
- gst_query_set_position (query, format, val);
- }
- break;
- default:
- break;
- }
- }
-
- gst_object_unref (cdxa);
- return res;
-}
-
-static GstStateChangeReturn
-gst_cdxa_parse_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
- GstCDXAParse *cdxa = GST_CDXA_PARSE (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- cdxa->state = GST_CDXA_PARSE_START;
- break;
- default:
- break;
- }
-
- if (GST_ELEMENT_CLASS (parent_class)->change_state)
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- cdxa->state = GST_CDXA_PARSE_START;
- cdxa->datasize = 0;
- cdxa->datastart = -1;
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (cdxaparse_debug, "cdxaparse", 0, "CDXA Parser");
- GST_DEBUG_CATEGORY_INIT (vcdparse_debug, "vcdparse", 0, "VCD Parser");
-
- if (!gst_element_register (plugin, "cdxaparse", GST_RANK_PRIMARY,
- GST_TYPE_CDXA_PARSE))
- return FALSE;
- if (!gst_element_register (plugin, "vcdparse", GST_RANK_PRIMARY,
- GST_TYPE_VCD_PARSE))
- return FALSE;
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- cdxaparse,
- "Parse a .dat file (VCD) into raw mpeg1",
- plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/cdxaparse/gstcdxaparse.h b/gst/cdxaparse/gstcdxaparse.h
deleted file mode 100644
index c54d445c9..000000000
--- a/gst/cdxaparse/gstcdxaparse.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * <2002> Wim Tayans <wim.taymans@chello.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_CDXA_PARSE_H__
-#define __GST_CDXA_PARSE_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_CDXA_PARSE \
- (gst_cdxa_parse_get_type())
-#define GST_CDXA_PARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CDXA_PARSE,GstCDXAParse))
-#define GST_CDXA_PARSE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CDXA_PARSE,GstCDXAParseClass))
-#define GST_IS_CDXA_PARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CDXA_PARSE))
-#define GST_IS_CDXA_PARSE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CDXA_PARSE))
-
-typedef enum {
- GST_CDXA_PARSE_START,
- GST_CDXA_PARSE_FMT,
- GST_CDXA_PARSE_OTHER,
- GST_CDXA_PARSE_DATA,
-} GstCDXAParseState;
-
-typedef struct _GstCDXAParse GstCDXAParse;
-typedef struct _GstCDXAParseClass GstCDXAParseClass;
-
-struct _GstCDXAParse {
- GstElement element;
-
- /* pads */
- GstPad *sinkpad;
- GstPad *srcpad;
-
- /* CDXA decoding state */
- GstCDXAParseState state;
-
- gint64 offset; /* current byte offset in file */
- gint64 datasize; /* upstream size in bytes */
- gint64 datastart; /* byte offset of first frame sync */
- gint64 bytes_skipped;
- gint64 bytes_sent;
-};
-
-struct _GstCDXAParseClass {
- GstElementClass parent_class;
-};
-
-GType gst_cdxa_parse_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_CDXA_PARSE_H__ */
-
diff --git a/gst/cdxaparse/gstvcdparse.c b/gst/cdxaparse/gstvcdparse.c
deleted file mode 100644
index 424e83951..000000000
--- a/gst/cdxaparse/gstvcdparse.c
+++ /dev/null
@@ -1,409 +0,0 @@
-/* GStreamer CDXA sync strippper / VCD parser
- * Copyright (C) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include "gstvcdparse.h"
-
-GST_DEBUG_CATEGORY_EXTERN (vcdparse_debug);
-#define GST_CAT_DEFAULT vcdparse_debug
-
-static gboolean gst_vcd_parse_sink_event (GstPad * pad, GstEvent * event);
-static gboolean gst_vcd_parse_src_event (GstPad * pad, GstEvent * event);
-static gboolean gst_vcd_parse_src_query (GstPad * pad, GstQuery * query);
-static GstFlowReturn gst_vcd_parse_chain (GstPad * pad, GstBuffer * buf);
-static GstStateChangeReturn gst_vcd_parse_change_state (GstElement * element,
- GstStateChange transition);
-
-static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-vcd")
- );
-
-static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/mpeg, systemstream = (boolean) TRUE")
- );
-
-GST_BOILERPLATE (GstVcdParse, gst_vcd_parse, GstElement, GST_TYPE_ELEMENT);
-
-static void
-gst_vcd_parse_base_init (gpointer klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_static_pad_template (element_class, &sink_factory);
- gst_element_class_add_static_pad_template (element_class, &src_factory);
-
- gst_element_class_set_static_metadata (element_class, "(S)VCD stream parser",
- "Codec/Parser", "Strip (S)VCD stream from its sync headers",
- "Tim-Philipp Müller <tim centricular net>, "
- "Ronald Bultje <rbultje@ronald.bitfreak.net>");
-}
-
-static void
-gst_vcd_parse_class_init (GstVcdParseClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- element_class->change_state = GST_DEBUG_FUNCPTR (gst_vcd_parse_change_state);
-}
-
-static void
-gst_vcd_parse_init (GstVcdParse * vcd, GstVcdParseClass * klass)
-{
- vcd->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink");
- gst_pad_set_chain_function (vcd->sinkpad,
- GST_DEBUG_FUNCPTR (gst_vcd_parse_chain));
- gst_pad_set_event_function (vcd->sinkpad,
- GST_DEBUG_FUNCPTR (gst_vcd_parse_sink_event));
- gst_element_add_pad (GST_ELEMENT (vcd), vcd->sinkpad);
-
- vcd->srcpad = gst_pad_new_from_static_template (&src_factory, "src");
- gst_pad_set_event_function (vcd->srcpad,
- GST_DEBUG_FUNCPTR (gst_vcd_parse_src_event));
- gst_pad_set_query_function (vcd->srcpad,
- GST_DEBUG_FUNCPTR (gst_vcd_parse_src_query));
- gst_pad_use_fixed_caps (vcd->srcpad);
- gst_pad_set_caps (vcd->srcpad,
- gst_static_pad_template_get_caps (&src_factory));
- gst_element_add_pad (GST_ELEMENT (vcd), vcd->srcpad);
-}
-
-/* These conversion functions assume there's no junk between sectors */
-
-static gint64
-gst_vcd_parse_get_out_offset (gint64 in_offset)
-{
- gint64 out_offset, chunknum, rest;
-
- if (in_offset == -1)
- return -1;
-
- if (G_UNLIKELY (in_offset < -1)) {
- GST_WARNING ("unexpected/invalid in_offset %" G_GINT64_FORMAT, in_offset);
- return in_offset;
- }
-
- chunknum = in_offset / GST_CDXA_SECTOR_SIZE;
- rest = in_offset % GST_CDXA_SECTOR_SIZE;
-
- out_offset = chunknum * GST_CDXA_DATA_SIZE;
- if (rest > GST_CDXA_HEADER_SIZE) {
- if (rest >= GST_CDXA_HEADER_SIZE + GST_CDXA_DATA_SIZE)
- out_offset += GST_CDXA_DATA_SIZE;
- else
- out_offset += rest - GST_CDXA_HEADER_SIZE;
- }
-
- GST_LOG ("transformed in_offset %" G_GINT64_FORMAT " to out_offset %"
- G_GINT64_FORMAT, in_offset, out_offset);
-
- return out_offset;
-}
-
-static gint64
-gst_vcd_parse_get_in_offset (gint64 out_offset)
-{
- gint64 in_offset, chunknum, rest;
-
- if (out_offset == -1)
- return -1;
-
- if (G_UNLIKELY (out_offset < -1)) {
- GST_WARNING ("unexpected/invalid out_offset %" G_GINT64_FORMAT, out_offset);
- return out_offset;
- }
-
- chunknum = out_offset / GST_CDXA_DATA_SIZE;
- rest = out_offset % GST_CDXA_DATA_SIZE;
-
- in_offset = chunknum * GST_CDXA_SECTOR_SIZE;
- if (rest > 0)
- in_offset += GST_CDXA_HEADER_SIZE + rest;
-
- GST_LOG ("transformed out_offset %" G_GINT64_FORMAT " to in_offset %"
- G_GINT64_FORMAT, out_offset, in_offset);
-
- return in_offset;
-}
-
-static gboolean
-gst_vcd_parse_src_query (GstPad * pad, GstQuery * query)
-{
- GstVcdParse *vcd = GST_VCD_PARSE (gst_pad_get_parent (pad));
- gboolean res = FALSE;
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_DURATION:{
- GstFormat format;
- gint64 dur;
-
- /* first try upstream */
- if (!gst_pad_query_default (pad, query))
- break;
-
- /* we can only handle BYTES */
- gst_query_parse_duration (query, &format, &dur);
- if (format != GST_FORMAT_BYTES)
- break;
-
- gst_query_set_duration (query, GST_FORMAT_BYTES,
- gst_vcd_parse_get_out_offset (dur));
-
- res = TRUE;
- break;
- }
- case GST_QUERY_POSITION:{
- GstFormat format;
- gint64 pos;
-
- /* first try upstream */
- if (!gst_pad_query_default (pad, query))
- break;
-
- /* we can only handle BYTES */
- gst_query_parse_position (query, &format, &pos);
- if (format != GST_FORMAT_BYTES)
- break;
-
- gst_query_set_position (query, GST_FORMAT_BYTES,
- gst_vcd_parse_get_out_offset (pos));
-
- res = TRUE;
- break;
- }
- default:
- res = gst_pad_query_default (pad, query);
- break;
- }
-
- gst_object_unref (vcd);
- return res;
-}
-
-static gboolean
-gst_vcd_parse_sink_event (GstPad * pad, GstEvent * event)
-{
- GstVcdParse *vcd = GST_VCD_PARSE (gst_pad_get_parent (pad));
- gboolean res;
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NEWSEGMENT:{
- GstFormat format;
- gboolean update;
- gdouble rate, applied_rate;
- gint64 start, stop, position;
-
- gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
- &format, &start, &stop, &position);
-
- if (format == GST_FORMAT_BYTES) {
- gst_event_unref (event);
- event = gst_event_new_new_segment_full (update, rate, applied_rate,
- GST_FORMAT_BYTES, gst_vcd_parse_get_out_offset (start),
- gst_vcd_parse_get_out_offset (stop), position);
- } else {
- GST_WARNING_OBJECT (vcd, "newsegment event in non-byte format");
- }
- res = gst_pad_event_default (pad, event);
- break;
- }
- case GST_EVENT_FLUSH_START:
- gst_adapter_clear (vcd->adapter);
- /* fall through */
- default:
- res = gst_pad_event_default (pad, event);
- break;
- }
-
- gst_object_unref (vcd);
- return res;
-}
-
-static gboolean
-gst_vcd_parse_src_event (GstPad * pad, GstEvent * event)
-{
- GstVcdParse *vcd = GST_VCD_PARSE (gst_pad_get_parent (pad));
- gboolean res;
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_SEEK:{
- GstSeekType start_type, stop_type;
- GstSeekFlags flags;
- GstFormat format;
- gdouble rate;
- gint64 start, stop;
-
- gst_event_parse_seek (event, &rate, &format, &flags, &start_type,
- &start, &stop_type, &stop);
-
- if (format == GST_FORMAT_BYTES) {
- gst_event_unref (event);
- if (start_type != GST_SEEK_TYPE_NONE)
- start = gst_vcd_parse_get_in_offset (start);
- if (stop_type != GST_SEEK_TYPE_NONE)
- stop = gst_vcd_parse_get_in_offset (stop);
- event = gst_event_new_seek (rate, GST_FORMAT_BYTES, flags, start_type,
- start, stop_type, stop);
- } else {
- GST_WARNING_OBJECT (vcd, "seek event in non-byte format");
- }
- res = gst_pad_event_default (pad, event);
- break;
- }
- default:
- res = gst_pad_event_default (pad, event);
- break;
- }
-
- gst_object_unref (vcd);
- return res;
-}
-
-/* -1 = no sync (discard buffer),
- * otherwise offset indicates sync point in buffer */
-static gint
-gst_vcd_parse_sync (const guint8 * data, guint size)
-{
- const guint8 sync_marker[12] = { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00
- };
- guint off = 0;
-
- while (size >= 12) {
- if (memcmp (data, sync_marker, 12) == 0)
- return off;
-
- --size;
- ++data;
- ++off;
- }
- return -1;
-}
-
-static GstFlowReturn
-gst_vcd_parse_chain (GstPad * pad, GstBuffer * buf)
-{
- GstVcdParse *vcd = GST_VCD_PARSE (GST_PAD_PARENT (pad));
- GstFlowReturn flow = GST_FLOW_OK;
-
- gst_adapter_push (vcd->adapter, buf);
- buf = NULL;
-
- while (gst_adapter_available (vcd->adapter) >= GST_CDXA_SECTOR_SIZE) {
- const guint8 *data;
- guint8 header[4 + 8];
- gint sync_offset;
-
- /* find sync (we could peek any size though really) */
- data = gst_adapter_peek (vcd->adapter, GST_CDXA_SECTOR_SIZE);
- sync_offset = gst_vcd_parse_sync (data, GST_CDXA_SECTOR_SIZE);
- GST_LOG_OBJECT (vcd, "sync offset = %d", sync_offset);
-
- if (sync_offset < 0) {
- gst_adapter_flush (vcd->adapter, GST_CDXA_SECTOR_SIZE - 12);
- continue; /* try again */
- }
-
- gst_adapter_flush (vcd->adapter, sync_offset);
-
- if (gst_adapter_available (vcd->adapter) < GST_CDXA_SECTOR_SIZE) {
- GST_LOG_OBJECT (vcd, "not enough data in adapter, waiting for more");
- break;
- }
-
- GST_LOG_OBJECT (vcd, "have full sector");
-
- /* have one sector: a sector is 2352 bytes long and is composed of:
- *
- * +-------------------------------------------------------+
- * ! sync ! header ! subheader ! data ... ! edc !
- * ! 12 bytes ! 4 bytes ! 8 bytes ! 2324 bytes ! 4 bytes !
- * +-------------------------------------------------------+
- *
- * We strip the data out of it and send it to the srcpad.
- *
- * sync : 00 FF FF FF FF FF FF FF FF FF FF 00
- * header : hour minute second mode
- * sub-header : track channel sub_mode coding repeat (4 bytes)
- * edc : checksum
- */
-
- /* Skip CDXA header and edc footer, only keep data in the middle */
- gst_adapter_copy (vcd->adapter, header, 12, sizeof (header));
- gst_adapter_flush (vcd->adapter, GST_CDXA_HEADER_SIZE);
- buf = gst_adapter_take_buffer (vcd->adapter, GST_CDXA_DATA_SIZE);
- gst_adapter_flush (vcd->adapter, 4);
-
- /* we could probably do something clever to keep track of buffer offsets */
- buf = gst_buffer_make_metadata_writable (buf);
- GST_BUFFER_OFFSET (buf) = GST_BUFFER_OFFSET_NONE;
- GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE;
- gst_buffer_set_caps (buf, GST_PAD_CAPS (vcd->srcpad));
-
- flow = gst_pad_push (vcd->srcpad, buf);
- buf = NULL;
-
- if (G_UNLIKELY (flow != GST_FLOW_OK)) {
- GST_DEBUG_OBJECT (vcd, "flow: %s", gst_flow_get_name (flow));
- break;
- }
- }
-
- return flow;
-}
-
-static GstStateChangeReturn
-gst_vcd_parse_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn res = GST_STATE_CHANGE_SUCCESS;
- GstVcdParse *vcd = GST_VCD_PARSE (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- vcd->adapter = gst_adapter_new ();
- break;
- default:
- break;
- }
-
- res = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- case GST_STATE_CHANGE_READY_TO_NULL:
- if (vcd->adapter) {
- g_object_unref (vcd->adapter);
- vcd->adapter = NULL;
- }
- break;
- default:
- break;
- }
-
- return res;
-}
diff --git a/gst/cdxaparse/gstvcdparse.h b/gst/cdxaparse/gstvcdparse.h
deleted file mode 100644
index e47d8826b..000000000
--- a/gst/cdxaparse/gstvcdparse.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* GStreamer CDXA sync strippper / VCD parser
- * Copyright (C) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
- * 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_VCD_PARSE_H__
-#define __GST_VCD_PARSE_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstadapter.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_VCD_PARSE \
- (gst_vcd_parse_get_type())
-#define GST_VCD_PARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VCD_PARSE,GstVcdParse))
-#define GST_VCD_PARSE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VCD_PARSE,GstVcdParseClass))
-#define GST_IS_VCD_PARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VCD_PARSE))
-#define GST_IS_VCD_PARSE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VCD_PARSE))
-
-#define GST_CDXA_SECTOR_SIZE 2352
-#define GST_CDXA_DATA_SIZE 2324
-#define GST_CDXA_HEADER_SIZE 24
-
-typedef struct _GstVcdParse GstVcdParse;
-typedef struct _GstVcdParseClass GstVcdParseClass;
-
-struct _GstVcdParse {
- GstElement element;
-
- GstPad *sinkpad;
- GstPad *srcpad;
- GstAdapter *adapter;
-};
-
-struct _GstVcdParseClass {
- GstElementClass element_class;
-};
-
-GType gst_vcd_parse_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_VCD_PARSE_H__ */
-
diff --git a/gst/cdxaparse/meson.build b/gst/cdxaparse/meson.build
deleted file mode 100644
index 34ef664f0..000000000
--- a/gst/cdxaparse/meson.build
+++ /dev/null
@@ -1,13 +0,0 @@
-cdxaparse_sources = [
- 'gstcdxaparse.c',
- 'gstvcdparse.c',
-]
-
-gstcdxaparse = library('gstcdxaparse',
- cdxaparse_sources,
- c_args : gst_plugins_bad_args,
- include_directories : [configinc],
- dependencies : [gstbase_dep, gstriff_dep],
- install : true,
- install_dir : plugins_install_dir,
-)
diff --git a/gst/dccp/Makefile.am b/gst/dccp/Makefile.am
deleted file mode 100644
index 31b66132c..000000000
--- a/gst/dccp/Makefile.am
+++ /dev/null
@@ -1,25 +0,0 @@
-# plugindir is set in configure
-
-plugin_LTLIBRARIES = libgstdccp.la
-
-# sources used to compile this plug-in
-libgstdccp_la_SOURCES = gstdccpplugin.c \
- gstdccp.c \
- gstdccpserversink.c \
- gstdccpserversrc.c \
- gstdccpclientsink.c \
- gstdccpclientsrc.c
-
-# flags used to compile this plugin
-libgstdccp_la_CFLAGS = $(GST_CFLAGS)
-libgstdccp_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(DCCP_LIBS) $(WINSOCK2_LIBS)
-libgstdccp_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstdccp_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-# headers we need but don't want installed
-noinst_HEADERS = gstdccp.h \
- gstdccpserversink.h \
- gstdccpserversrc.h \
- gstdccpclientsink.h \
- gstdccpclientsrc.h \
- gstdccp_common.h
diff --git a/gst/dccp/gstdccp.c b/gst/dccp/gstdccp.c
deleted file mode 100644
index 9b834cf1b..000000000
--- a/gst/dccp/gstdccp.c
+++ /dev/null
@@ -1,560 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstdccp.h"
-
-#ifdef HAVE_FIONREAD_IN_SYS_FILIO
-#include <sys/filio.h>
-#endif
-
-/*
- * Resolves host to IP address
- * @param element - the element
- * @return a gchar pointer containing the ip address or NULL if it
- * couldn't resolve the host to a IP adress
- */
-gchar *
-gst_dccp_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 */
-#ifndef G_OS_WIN32
- if (inet_aton (host, &addr)) {
-#else
- if ((addr.S_un.S_addr = inet_addr (host)) != INADDR_NONE) {
-#endif
- ip = g_strdup (host);
- GST_DEBUG_OBJECT (element, "resolved to IP %s", ip);
- return ip;
- }
-
- /* perform a name lookup */
- if (!(hostinfo = gethostbyname (host))) {
- GST_ELEMENT_ERROR (element, RESOURCE, NOT_FOUND, (NULL),
- ("Could not find IP address for host \"%s\".", host));
- return NULL;
- }
-
- if (hostinfo->h_addrtype != AF_INET) {
- GST_ELEMENT_ERROR (element, RESOURCE, NOT_FOUND, (NULL),
- ("host \"%s\" is not an IP host", host));
- return NULL;
- }
-
- 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));
-
- return ip;
-}
-
-/*
- * Read a buffer from the given socket
- *
- * @param this - the element that has the socket that will be read
- * @param socket - the socket fd that will be read
- * @param buf - the buffer with the data read from the socket
- * @return GST_FLOW_OK if the read operation was successful
- * or GST_FLOW_ERROR indicating a connection close or an error.
- * Handle it with EOS.
- */
-GstFlowReturn
-gst_dccp_read_buffer (GstElement * this, int socket, GstBuffer ** buf)
-{
- fd_set testfds;
- int maxfdp1;
- gssize bytes_read;
-#ifndef G_OS_WIN32
- int readsize;
- struct msghdr mh;
- struct iovec iov;
-#else
- unsigned long readsize;
-#endif
-
- *buf = NULL;
-
- /* do a blocking select on the socket */
- FD_ZERO (&testfds);
- FD_SET (socket, &testfds);
- maxfdp1 = socket + 1;
-
- /* no action (0) is also an error in our case */
- if (select (maxfdp1, &testfds, NULL, NULL, 0) <= 0) {
- GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL),
- ("select failed: %s", g_strerror (errno)));
- return GST_FLOW_ERROR;
- }
-
- /* ask how much is available for reading on the socket */
-#ifndef G_OS_WIN32
- if (ioctl (socket, FIONREAD, &readsize) < 0) {
- GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL),
- ("read FIONREAD value failed: %s", g_strerror (errno)));
-#else
- if (ioctlsocket (socket, FIONREAD, &readsize) == SOCKET_ERROR) {
- GST_ELEMENT_ERROR (this, RESOURCE, READ, (NULL),
- ("read FIONREAD value failed: %s", g_strerror (WSAGetLastError ())));
-#endif
- return GST_FLOW_ERROR;
- }
-
- if (readsize == 0) {
- GST_DEBUG_OBJECT (this, "Got EOS on socket stream");
- return GST_FLOW_UNEXPECTED;
- }
-
- *buf = gst_buffer_new_and_alloc ((int) readsize);
-#ifndef G_OS_WIN32
- memset (&mh, 0, sizeof (mh));
- mh.msg_name = NULL;
- mh.msg_namelen = 0;
- iov.iov_base = (char *) GST_BUFFER_DATA (*buf);
- iov.iov_len = readsize;
- mh.msg_iov = &iov;
- mh.msg_iovlen = 1;
-
- bytes_read = recvmsg (socket, &mh, 0);
-#else
- bytes_read =
- recvfrom (socket, (char *) GST_BUFFER_DATA (*buf), (int) readsize, 0,
- NULL, 0);
-#endif
-
- if (bytes_read != readsize) {
- GST_DEBUG_OBJECT (this, "Error while reading data");
- return GST_FLOW_ERROR;
- }
-
- GST_LOG_OBJECT (this, "bytes read %" G_GSSIZE_FORMAT, bytes_read);
- GST_LOG_OBJECT (this, "returning buffer of size %d", GST_BUFFER_SIZE (*buf));
-
- return GST_FLOW_OK;
-}
-
-/* Create a new DCCP socket
- *
- * @param element - the element
- * @return the socket file descriptor
- */
-gint
-gst_dccp_create_new_socket (GstElement * element)
-{
- int sock_fd;
- if ((sock_fd = socket (AF_INET, SOCK_DCCP, IPPROTO_DCCP)) < 0) {
- GST_ELEMENT_ERROR (element, RESOURCE, OPEN_READ, (NULL), GST_ERROR_SYSTEM);
- }
-
- return sock_fd;
-}
-
-/* Connect to a server
- * @param element - the element
- * @param server_sin - a struct with a server address and port
- * @param sock_fd - the socket to connect
- * @return TRUE in case of successful connection, FALSE otherwise
- */
-gboolean
-gst_dccp_connect_to_server (GstElement * element, struct sockaddr_in server_sin,
- int sock_fd)
-{
-#ifdef G_OS_WIN32
- int errorCode;
-#endif
- GST_DEBUG_OBJECT (element, "connecting to server");
-
- if (connect (sock_fd, (struct sockaddr *) &server_sin, sizeof (server_sin))) {
-#ifdef G_OS_WIN32
- errorCode = WSAGetLastError ();
- switch (errorCode) {
- case WSAECONNREFUSED:
- GST_ELEMENT_ERROR (element, RESOURCE, OPEN_WRITE,
- ("Connection to %s:%d refused.", inet_ntoa (server_sin.sin_addr),
- ntohs (server_sin.sin_port)), (NULL));
- return FALSE;
- break;
- default:
- GST_ELEMENT_ERROR (element, RESOURCE, OPEN_READ, (NULL),
- ("Connect to %s:%d failed: %s", inet_ntoa (server_sin.sin_addr),
- ntohs (server_sin.sin_port), g_strerror (errorCode)));
- return FALSE;
- break;
- }
-#else
- switch (errno) {
- case ECONNREFUSED:
- GST_ELEMENT_ERROR (element, RESOURCE, OPEN_WRITE,
- ("Connection to %s:%d refused.", inet_ntoa (server_sin.sin_addr),
- ntohs (server_sin.sin_port)), (NULL));
- return FALSE;
- break;
- default:
- GST_ELEMENT_ERROR (element, RESOURCE, OPEN_READ, (NULL),
- ("Connect to %s:%d failed: %s", inet_ntoa (server_sin.sin_addr),
- ntohs (server_sin.sin_port), g_strerror (errno)));
- return FALSE;
- break;
- }
-#endif
- }
- return TRUE;
-}
-
-/* FIXME support only one client */
-/*
- * Accept connection on the server socket.
- *
- * @param element - the element
- * @param server_sock_fd - the server socket file descriptor
- * @return the socket of the client connected to the server.
- */
-gint
-gst_dccp_server_wait_connections (GstElement * element, int server_sock_fd)
-{
- /* new client */
- int client_sock_fd;
- struct sockaddr_in client_address;
- socklen_t client_address_len;
-
- memset (&client_address, 0, sizeof (client_address));
- client_address_len = 0;
-
- if ((client_sock_fd =
- accept (server_sock_fd, (struct sockaddr *) &client_address,
- &client_address_len)) == -1) {
- GST_ELEMENT_ERROR (element, RESOURCE, OPEN_WRITE, (NULL),
- ("Could not accept client on server socket %d: %s (%d)",
- server_sock_fd, g_strerror (errno), errno));
- return -1;
- }
-
- GST_DEBUG_OBJECT (element, "Added new client ip %s with fd %d.",
- inet_ntoa (client_address.sin_addr), client_sock_fd);
-
- return client_sock_fd;
-}
-
-/*
- * Bind a server address.
- *
- * @param element - the element
- * @param server_sock_fd - the server socket fd
- * @param server_sin - the address and the port to bind the server on
- * @return true in success, false otherwise.
- */
-gboolean
-gst_dccp_bind_server_socket (GstElement * element, int server_sock_fd,
- struct sockaddr_in server_sin)
-{
- int ret;
-
- GST_DEBUG_OBJECT (element, "Binding server socket to address.");
-
- ret = bind (server_sock_fd, (struct sockaddr *) &server_sin,
- sizeof (server_sin));
- if (ret) {
- switch (errno) {
- default:
- GST_ELEMENT_ERROR (element, RESOURCE, OPEN_READ, (NULL),
- ("Bind on port %d failed: %s", ntohs (server_sin.sin_port),
- g_strerror (errno)));
- return FALSE;
- break;
- }
- }
- return TRUE;
-}
-
-/*
- * Listen on server socket.
- *
- * @param element - the element
- * @param server_sock_fd - the server socket fd
- * @return true in success, false otherwise.
- */
-gboolean
-gst_dccp_listen_server_socket (GstElement * element, int server_sock_fd)
-{
-
- GST_DEBUG_OBJECT (element, "Listening on server socket %d with queue of %d",
- server_sock_fd, DCCP_BACKLOG);
-
- if (listen (server_sock_fd, DCCP_BACKLOG) == -1) {
- GST_ELEMENT_ERROR (element, RESOURCE, OPEN_READ, (NULL),
- ("Could not listen on server socket: %s", g_strerror (errno)));
- return FALSE;
- }
-
- GST_DEBUG_OBJECT (element,
- "Listened on server socket %d, returning from connection setup",
- server_sock_fd);
-
- return TRUE;
-}
-
-/* Write buffer to given socket incrementally.
- *
- * @param element - the element
- * @param socket - the socket
- * @param buf - the buffer that will be written
- * @param size - the number of bytes of the buffer
- * @param packet_size - the MTU
- * @return the number of bytes written.
- */
-static GstFlowReturn
-gst_dccp_socket_write (GstElement * element, int socket, const void *buf,
- size_t size, int packet_size)
-{
- size_t bytes_written = 0;
- ssize_t wrote = 0;
-
-#ifndef G_OS_WIN32
- struct iovec iov;
- struct msghdr mh;
-
- memset (&mh, 0, sizeof (mh));
-
- while (bytes_written < size) {
- do {
- mh.msg_name = NULL;
- mh.msg_namelen = 0;
- iov.iov_base = (char *) buf + bytes_written;
- iov.iov_len = MIN (packet_size, size - bytes_written);
- mh.msg_iov = &iov;
- mh.msg_iovlen = 1;
-
- wrote = sendmsg (socket, &mh, 0);
- } while (wrote == -1 && errno == EAGAIN);
-#else
- int errorCode = 0;
- while (bytes_written < size) {
- do {
- wrote = sendto (socket, (char *) buf + bytes_written,
- MIN (packet_size, size - bytes_written), 0, NULL, 0);
- errorCode = WSAGetLastError ();
- } while (wrote == SOCKET_ERROR && errorCode == EAGAIN);
-#endif
-
- /* give up on error */
- if (wrote >= 0)
- bytes_written += wrote;
- else
- break;
- }
-
- if (wrote < 0)
- GST_WARNING ("Error while writing.");
- else
- GST_LOG_OBJECT (element, "Wrote %" G_GSIZE_FORMAT " bytes succesfully.",
- bytes_written);
-
- if (bytes_written != size) {
- GST_ELEMENT_ERROR (element, RESOURCE, WRITE,
- ("Error while sending data to socket %d.", socket),
- ("Only %" G_GSIZE_FORMAT " of %" G_GSIZE_FORMAT " bytes written: %s",
- bytes_written, size, g_strerror (errno)));
- return GST_FLOW_ERROR;
- }
-
- return GST_FLOW_OK;
-}
-
-/* Write buffer to given socket.
- *
- * @param this - the element
- * @param buf - the buffer that will be written
- * @param client_sock_fd - the client socket
- * @param packet_size - the MTU
- * @return GST_FLOW_OK if the send operation was successful, GST_FLOW_ERROR otherwise.
- */
-GstFlowReturn
-gst_dccp_send_buffer (GstElement * this, GstBuffer * buffer, int client_sock_fd,
- int packet_size)
-{
-// size_t wrote;
- gint size = 0;
- guint8 *data;
-
- size = GST_BUFFER_SIZE (buffer);
- data = GST_BUFFER_DATA (buffer);
-
- GST_LOG_OBJECT (this, "writing %d bytes", size);
-
- if (packet_size < 0) {
- return GST_FLOW_ERROR;
- }
-
- return gst_dccp_socket_write (this, client_sock_fd, data, size, packet_size);
-}
-
-/*
- * Make address reusable.
- * @param element - the element
- * @param sock_fd - the socket
- * @return TRUE if the operation was successful, FALSE otherwise.
- */
-gboolean
-gst_dccp_make_address_reusable (GstElement * element, int sock_fd)
-{
- int ret = 1;
- /* make address reusable */
- if (setsockopt (sock_fd, SOL_SOCKET, SO_REUSEADDR,
- (void *) &ret, sizeof (ret)) < 0) {
- GST_ELEMENT_ERROR (element, RESOURCE, SETTINGS, (NULL),
- ("Could not setsockopt: %s", g_strerror (errno)));
- return FALSE;
- }
- return TRUE;
-}
-
-/*
- * Set DCCP congestion control.
- * @param element - the element
- * @param sock_fd - the socket
- * @param ccid - the ccid number
- * @return TRUE if the operation was successful, FALSE otherwise.
- */
-gboolean
-gst_dccp_set_ccid (GstElement * element, int sock_fd, uint8_t ccid)
-{
- uint8_t ccids[4]; /* for getting the available CCIDs, should be large enough */
- socklen_t len = sizeof (ccids);
- int i, ret;
- gboolean ccid_supported = FALSE;
-
- /*
- * Determine which CCIDs are available on the host
- */
-#ifndef G_OS_WIN32
- ret = getsockopt (sock_fd, SOL_DCCP, DCCP_SOCKOPT_AVAILABLE_CCIDS, &ccids,
- &len);
-#else
- ret =
- getsockopt (sock_fd, SOL_DCCP, DCCP_SOCKOPT_AVAILABLE_CCIDS,
- (char *) &ccids, &len);
-#endif
- if (ret < 0) {
- GST_ERROR_OBJECT (element, "Can not determine available CCIDs");
- return FALSE;
- }
-
- for (i = 0; i < sizeof (ccids); i++) {
- if (ccid == ccids[i]) {
- ccid_supported = TRUE;
- }
- }
-
- if (!ccid_supported) {
- GST_ERROR_OBJECT (element, "CCID specified is not supported");
- return FALSE;
- }
-#ifndef G_OS_WIN32
- if (setsockopt (sock_fd, SOL_DCCP, DCCP_SOCKOPT_CCID, &ccid,
-#else
- if (setsockopt (sock_fd, SOL_DCCP, DCCP_SOCKOPT_CCID, (char *) &ccid,
-#endif
- sizeof (ccid)) < 0) {
- GST_ERROR_OBJECT (element, "Can not set CCID");
- return FALSE;
- }
-
- return TRUE;
-}
-
-#if 0
-/*
- * Get the current ccid of TX or RX half-connection. tx_or_rx parameter must be
- * DCCP_SOCKOPT_TX_CCID or DCCP_SOCKOPT_RX_CCID.
- * @return ccid or -1 on error or tx_or_rx not the correct option
- */
-static uint8_t
-gst_dccp_get_ccid (GstElement * element, int sock_fd, int tx_or_rx)
-{
- uint8_t ccid;
- socklen_t ccidlen;
- int ret;
-
- switch (tx_or_rx) {
- case DCCP_SOCKOPT_TX_CCID:
- case DCCP_SOCKOPT_RX_CCID:
- break;
- default:
- return -1;
- }
-
- ccidlen = sizeof (ccid);
-#ifndef G_OS_WIN32
- ret = getsockopt (sock_fd, SOL_DCCP, tx_or_rx, &ccid, &ccidlen);
-#else
- ret = getsockopt (sock_fd, SOL_DCCP, tx_or_rx, (char *) &ccid, &ccidlen);
-#endif
- if (ret < 0) {
- GST_ERROR_OBJECT (element, "Can not determine available CCIDs");
- return -1;
- }
- return ccid;
-}
-#endif
-
-/*
- * Get the socket MTU.
- * @param element - the element
- * @param sock - the socket
- * @return the MTU if the operation was successful, -1 otherwise.
- */
-gint
-gst_dccp_get_max_packet_size (GstElement * element, int sock)
-{
- int size;
- socklen_t sizelen = sizeof (size);
-#ifndef G_OS_WIN32
- if (getsockopt (sock, SOL_DCCP, DCCP_SOCKOPT_GET_CUR_MPS,
- &size, &sizelen) < 0) {
-#else
- if (getsockopt (sock, SOL_DCCP, DCCP_SOCKOPT_GET_CUR_MPS,
- (char *) &size, &sizelen) < 0) {
-#endif
- GST_ELEMENT_ERROR (element, RESOURCE, SETTINGS, (NULL),
- ("Could not get current MTU %d: %s", errno, g_strerror (errno)));
- return -1;
- }
- GST_DEBUG_OBJECT (element, "MTU: %d", size);
- return size;
-}
-
-void
-gst_dccp_socket_close (GstElement * element, int *socket)
-{
- if (*socket >= 0) {
- GST_DEBUG_OBJECT (element, "closing socket");
- close (*socket);
- *socket = -1;
- }
-}
diff --git a/gst/dccp/gstdccp.h b/gst/dccp/gstdccp.h
deleted file mode 100644
index 3f13227a0..000000000
--- a/gst/dccp/gstdccp.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_DCCP_H__
-#define __GST_DCCP_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstadapter.h>
-#include "gstdccp_common.h"
-
-/* DCCP socket general options */
-#define DCCP_BACKLOG 5
-#ifndef SOCK_DCCP
- #define SOCK_DCCP 6
-#endif
-
-#ifndef IPPROTO_DCCP
- #define IPPROTO_DCCP 33
-#endif
-
-#ifndef SOL_DCCP
- #define SOL_DCCP 269
-#endif
-
-/* dccp socket specific options */
-#define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */
-#define DCCP_SOCKOPT_SERVICE 2
-#define DCCP_SOCKOPT_CHANGE_L 3
-#define DCCP_SOCKOPT_CHANGE_R 4
-#define DCCP_SOCKOPT_GET_CUR_MPS 5
-#define DCCP_SOCKOPT_SERVER_TIMEWAIT 6
-#define DCCP_SOCKOPT_SEND_CSCOV 10
-#define DCCP_SOCKOPT_RECV_CSCOV 11
-#define DCCP_SOCKOPT_AVAILABLE_CCIDS 12
-#define DCCP_SOCKOPT_CCID 13
-#define DCCP_SOCKOPT_TX_CCID 14
-#define DCCP_SOCKOPT_RX_CCID 15
-#define DCCP_SOCKOPT_CCID_RX_INFO 128
-#define DCCP_SOCKOPT_CCID_TX_INFO 192
-
-/* Default parameters for the gst dccp element property */
-#define DCCP_DEFAULT_PORT 5001
-#define DCCP_DEFAULT_SOCK_FD -1
-#define DCCP_DEFAULT_CLIENT_SOCK_FD -1
-#define DCCP_DEFAULT_CLOSED TRUE
-#define DCCP_DEFAULT_WAIT_CONNECTIONS FALSE
-#define DCCP_DEFAULT_HOST "127.0.0.1"
-#define DCCP_DEFAULT_CCID 2
-
-#define DCCP_DELTA 100
-
-gchar *gst_dccp_host_to_ip (GstElement * element, const gchar * host);
-
-GstFlowReturn gst_dccp_read_buffer (GstElement * this, int socket,
- GstBuffer ** buf);
-
-gint gst_dccp_create_new_socket (GstElement * element);
-gboolean gst_dccp_connect_to_server (GstElement * element,
- struct sockaddr_in server_sin,
- int sock_fd);
-
-gint gst_dccp_server_wait_connections (GstElement * element, int server_sock_fd);
-
-gboolean gst_dccp_bind_server_socket (GstElement * element, int server_sock_fd,
- struct sockaddr_in server_sin);
-
-gboolean gst_dccp_listen_server_socket (GstElement * element, int server_sock_fd);
-gboolean gst_dccp_set_ccid (GstElement * element, int sock_fd, uint8_t ccid);
-
-gint gst_dccp_get_max_packet_size(GstElement * element, int sock);
-
-GstFlowReturn gst_dccp_send_buffer (GstElement * element, GstBuffer * buffer,
- int client_sock_fd, int packet_size);
-
-gboolean gst_dccp_make_address_reusable (GstElement * element, int sock_fd);
-void gst_dccp_socket_close (GstElement * element, int * socket);
-
-#endif /* __GST_DCCP_H__ */
diff --git a/gst/dccp/gstdccp_common.h b/gst/dccp/gstdccp_common.h
deleted file mode 100644
index c88f8efd8..000000000
--- a/gst/dccp/gstdccp_common.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_DCCP_NET_H__
-#define __GST_DCCP_NET_H__
-
-#ifndef G_OS_WIN32
-# include <netdb.h>
-# include <sys/socket.h>
-# include <netinet/in.h> /* sockaddr_in */
-# include <arpa/inet.h>
-# include <sys/ioctl.h>
-#else
-/* 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>
-#ifndef socklen_t
-#define socklen_t int
-#endif
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <string.h>
-
-#endif /* __GST_DCCP_NET_H__ */
diff --git a/gst/dccp/gstdccpclientsink.c b/gst/dccp/gstdccpclientsink.c
deleted file mode 100644
index 058db2bee..000000000
--- a/gst/dccp/gstdccpclientsink.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/**
- * SECTION:element-dccpclientsink
- * @see_also: dccpserversrc, dccpclientsrc, dccpserversink
- *
- * This element connect to a DCCP server and send data to it.
- * <ulink url="http://www.linuxfoundation.org/en/Net:DCCP">DCCP</ulink> (Datagram
- * Congestion Control Protocol) is a Transport Layer protocol like
- * TCP and UDP.
- *
- * <refsect2>
- * <title>Example pipeline</title>
- * <para>
- * |[
- * gst-launch -v filesrc location=music.mp3 ! mp3parse ! dccpclientsink host=localhost port=9011 ccid=2
- * ]| Client
- * |[
- * gst-launch -v dccpserversrc port=9011 ccid=2 ! decodebin ! alsasink
- * ]| Server
- *
- * This example pipeline will send a MP3 stream to the server using DCCP.
- * The server will decode the MP3 and play it.
- * Run the server pipeline first than the client pipeline.
- * </para>
- * </refsect2>
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstdccpclientsink.h"
-#include "gstdccp.h"
-
-/* signals */
-enum
-{
- SIGNAL_CONNECTED,
- LAST_SIGNAL
-};
-
-/* properties */
-enum
-{
- PROP_0,
- PROP_PORT,
- PROP_HOST,
- PROP_SOCK_FD,
- PROP_CCID,
- PROP_CLOSE_FD
-};
-
-static gboolean gst_dccp_client_sink_stop (GstBaseSink * bsink);
-static gboolean gst_dccp_client_sink_start (GstBaseSink * bsink);
-static GstFlowReturn gst_dccp_client_sink_render (GstBaseSink * bsink,
- GstBuffer * buf);
-static void gst_dccp_client_sink_finalize (GObject * gobject);
-
-GST_DEBUG_CATEGORY_STATIC (dccpclientsink_debug);
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-GST_BOILERPLATE (GstDCCPClientSink, gst_dccp_client_sink, GstBaseSink,
- GST_TYPE_BASE_SINK);
-
-static guint gst_dccp_client_sink_signals[LAST_SIGNAL] = { 0 };
-
-/*
- * Write buffer to client socket.
- *
- * @return GST_FLOW_OK if the send operation was successful, GST_FLOW_ERROR otherwise.
- */
-static GstFlowReturn
-gst_dccp_client_sink_render (GstBaseSink * bsink, GstBuffer * buf)
-{
- GstDCCPClientSink *sink = GST_DCCP_CLIENT_SINK (bsink);
-
- return gst_dccp_send_buffer (GST_ELEMENT (sink), buf, sink->sock_fd,
- sink->pksize);
-}
-
-/*
- * Set the value of a property for the client sink.
- */
-static void
-gst_dccp_client_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstDCCPClientSink *sink = GST_DCCP_CLIENT_SINK (object);
-
- switch (prop_id) {
- case PROP_PORT:
- sink->port = g_value_get_int (value);
- break;
- case PROP_SOCK_FD:
- sink->sock_fd = g_value_get_int (value);
- break;
- case PROP_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 PROP_CLOSE_FD:
- sink->closed = g_value_get_boolean (value);
- break;
- case PROP_CCID:
- sink->ccid = g_value_get_int (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/*
- * Get a given property value for the client sink.
- */
-static void
-gst_dccp_client_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstDCCPClientSink *sink = GST_DCCP_CLIENT_SINK (object);
-
- switch (prop_id) {
- case PROP_PORT:
- g_value_set_int (value, sink->port);
- break;
- case PROP_SOCK_FD:
- g_value_set_int (value, sink->sock_fd);
- break;
- case PROP_HOST:
- g_value_set_string (value, sink->host);
- break;
- case PROP_CLOSE_FD:
- g_value_set_boolean (value, sink->closed);
- break;
- case PROP_CCID:
- g_value_set_int (value, sink->ccid);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_dccp_client_sink_finalize (GObject * gobject)
-{
- GstDCCPClientSink *this = GST_DCCP_CLIENT_SINK (gobject);
-
- g_free (this->host);
-
- G_OBJECT_CLASS (parent_class)->finalize (gobject);
-}
-
-/*
- * Starts the element. If the sockfd property was not the default, this method
- * will create a new socket and connect to the server.
- *
- * @param bsink - the element
- * @return TRUE if the send operation was successful, FALSE otherwise.
- */
-static gboolean
-gst_dccp_client_sink_start (GstBaseSink * bsink)
-{
- GstDCCPClientSink *sink = GST_DCCP_CLIENT_SINK (bsink);
-
- if (sink->sock_fd == DCCP_DEFAULT_SOCK_FD) {
- gchar *ip = NULL;
-
- /* look up name if we need to */
- if (!(ip = gst_dccp_host_to_ip (GST_ELEMENT (sink), sink->host))) {
- GST_ERROR_OBJECT (sink, "cannot resolve hostname");
- gst_dccp_client_sink_stop (GST_BASE_SINK (sink));
- return FALSE;
- }
-
- /* name the server socket */
- memset (&sink->server_sin, 0, sizeof (sink->server_sin));
- sink->server_sin.sin_family = AF_INET; /* network socket */
- sink->server_sin.sin_port = htons (sink->port); /* on port */
- sink->server_sin.sin_addr.s_addr = inet_addr (ip); /* on host ip */
- g_free (ip);
-
- /* create socket */
- if ((sink->sock_fd = gst_dccp_create_new_socket (GST_ELEMENT (sink))) < 0) {
- return FALSE;
- }
-
- if (!gst_dccp_set_ccid (GST_ELEMENT (sink), sink->sock_fd, sink->ccid)) {
- gst_dccp_client_sink_stop (GST_BASE_SINK (sink));
- return FALSE;
- }
-
- if (!gst_dccp_connect_to_server (GST_ELEMENT (sink), sink->server_sin,
- sink->sock_fd)) {
- gst_dccp_client_sink_stop (GST_BASE_SINK (sink));
- return FALSE;
- }
-
- /* the socket is connected */
- g_signal_emit (sink, gst_dccp_client_sink_signals[SIGNAL_CONNECTED], 0,
- sink->sock_fd);
- }
-
- sink->pksize =
- gst_dccp_get_max_packet_size (GST_ELEMENT (sink), sink->sock_fd);
-
- return TRUE;
-}
-
-static void
-gst_dccp_client_sink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_static_pad_template (element_class, &sinktemplate);
-
- gst_element_class_set_static_metadata (element_class, "DCCP client sink",
- "Sink/Network",
- "Send data as a client over the network via DCCP",
- "E-Phone Team at Federal University of Campina Grande <leandroal@gmail.com>");
-}
-
-static void
-gst_dccp_client_sink_init (GstDCCPClientSink * this,
- GstDCCPClientSinkClass * g_class)
-{
- this->port = DCCP_DEFAULT_PORT;
- this->host = g_strdup (DCCP_DEFAULT_HOST);
- this->sock_fd = DCCP_DEFAULT_SOCK_FD;
- this->closed = DCCP_DEFAULT_CLOSED;
- this->ccid = DCCP_DEFAULT_CCID;
-}
-
-static gboolean
-gst_dccp_client_sink_stop (GstBaseSink * bsink)
-{
- GstDCCPClientSink *sink;
-
- sink = GST_DCCP_CLIENT_SINK (bsink);
-
- if (sink->sock_fd != DCCP_DEFAULT_SOCK_FD && sink->closed) {
- gst_dccp_socket_close (GST_ELEMENT (sink), &(sink->sock_fd));
- }
-
- return TRUE;
-}
-
-/*
- * Define the gst class, callbacks, etc.
- */
-static void
-gst_dccp_client_sink_class_init (GstDCCPClientSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstBaseSinkClass *gstbasesink_class;
-
- gobject_class = (GObjectClass *) klass;
- gstbasesink_class = (GstBaseSinkClass *) klass;
-
- gobject_class->set_property = gst_dccp_client_sink_set_property;
- gobject_class->get_property = gst_dccp_client_sink_get_property;
- gobject_class->finalize = gst_dccp_client_sink_finalize;
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PORT,
- g_param_spec_int ("port", "Port",
- "The port to send the packets to", 0, G_MAXUINT16,
- DCCP_DEFAULT_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_HOST,
- g_param_spec_string ("host", "Host",
- "The host IP address to send packets to", DCCP_DEFAULT_HOST,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_SOCK_FD,
- g_param_spec_int ("sockfd", "Socket fd",
- "The socket file descriptor", -1, G_MAXINT,
- DCCP_DEFAULT_SOCK_FD, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_CLOSE_FD,
- g_param_spec_boolean ("close-socket", "Close",
- "Close socket at end of stream",
- DCCP_DEFAULT_CLOSED, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_CCID,
- g_param_spec_int ("ccid", "CCID",
- "The Congestion Control IDentified to be used", 2, G_MAXINT,
- DCCP_DEFAULT_CCID, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /* signals */
- /**
- * GstDccpClientSink::connected:
- * @sink: the gstdccpclientsink element that emitted this signal
- * @fd: the connected socket file descriptor
- *
- * Sign that the element has connected, return the fd of the socket.
- */
- gst_dccp_client_sink_signals[SIGNAL_CONNECTED] =
- g_signal_new ("connected", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GstDCCPClientSinkClass, connected), NULL, NULL,
- gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
-
- gstbasesink_class->start = gst_dccp_client_sink_start;
- gstbasesink_class->stop = gst_dccp_client_sink_stop;
- gstbasesink_class->render = gst_dccp_client_sink_render;
-
- GST_DEBUG_CATEGORY_INIT (dccpclientsink_debug, "dccpclientsink", 0,
- "DCCP Client Sink");
-}
diff --git a/gst/dccp/gstdccpclientsink.h b/gst/dccp/gstdccpclientsink.h
deleted file mode 100644
index 93cbaa7d9..000000000
--- a/gst/dccp/gstdccpclientsink.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_DCCP_CLIENT_SINK_H__
-#define __GST_DCCP_CLIENT_SINK_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstbasesink.h>
-#include <gst/base/gstadapter.h>
-
-G_BEGIN_DECLS
-
-#include "gstdccp_common.h"
-
-#define GST_TYPE_DCCP_CLIENT_SINK \
- (gst_dccp_client_sink_get_type())
-#define GST_DCCP_CLIENT_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DCCP_CLIENT_SINK,GstDCCPClientSink))
-#define GST_DCCP_CLIENT_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DCCP_CLIENT_SINK,GstDCCPClientSinkClass))
-#define GST_IS_DCCP_CLIENT_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DCCP_CLIENT_SINK))
-#define GST_IS_DCCP_CLIENT_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DCCP_CLIENT_SINK))
-
-typedef struct _GstDCCPClientSink GstDCCPClientSink;
-typedef struct _GstDCCPClientSinkClass GstDCCPClientSinkClass;
-
-
-/**
- * GstDCCPClientSink:
- *
- * dccpclientsink object structure.
- */
-struct _GstDCCPClientSink
-{
- GstBaseSink element;
-
- /* server information */
- int port;
- gchar *host;
- struct sockaddr_in server_sin;
-
- /* socket */
- int sock_fd;
- gboolean closed;
-
- int pksize;
-
- GstCaps *caps;
- uint8_t ccid;
-};
-
-struct _GstDCCPClientSinkClass
-{
- GstBaseSinkClass parent_class;
-
- /* signals */
- void (*connected) (GstElement *sink, gint fd);
-};
-
-GType gst_dccp_client_sink_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_DCCP_CLIENT_SRC_H__ */
diff --git a/gst/dccp/gstdccpclientsrc.c b/gst/dccp/gstdccpclientsrc.c
deleted file mode 100644
index 21ac8e2fb..000000000
--- a/gst/dccp/gstdccpclientsrc.c
+++ /dev/null
@@ -1,405 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/**
- * SECTION:element-dccpclientsrc
- * @see_also: dccpclientsink, dccpserversink, dccpserversrc
- *
- * This element connect to a DCCP server and send data to it.
- * <ulink url="http://www.linuxfoundation.org/en/Net:DCCP">DCCP</ulink> (Datagram
- * Congestion Control Protocol) is a Transport Layer protocol like
- * TCP and UDP.
- *
- * <refsect2>
- * <title>Example pipeline</title>
- * <para>
- * |[
- * gst-launch -v dccpclientsrc host=localhost port=9011 ccid=2 ! decodebin ! alsasink
- * ]| Client
- * |[
- * gst-launch -v filesrc location=music.mp3 ! mp3parse ! dccpserversink port=9011 ccid=2
- * ]| Server
- *
- * This example pipeline will send a MP3 stream to the client using DCCP.
- * The client will decode the MP3 and play it. Run the server pipeline
- * first than the client pipeline. If you want, you can run more than one dccpclientsrc
- * to connect to the same server (see wait-connections property at dccpserversink).
- * </para>
- * </refsect2>
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstdccpclientsrc.h"
-#include "gstdccp.h"
-#include <fcntl.h>
-#ifdef HAVE_FIONREAD_IN_SYS_FILIO
-#include <sys/filio.h>
-#endif
-
-#define DCCP_DEFAULT_CAPS NULL
-
-/* signals */
-enum
-{
- SIGNAL_CONNECTED,
- LAST_SIGNAL
-};
-
-/* properties */
-enum
-{
- PROP_0,
- PROP_PORT,
- PROP_HOST,
- PROP_SOCK_FD,
- PROP_CLOSED,
- PROP_CCID,
- PROP_CAPS
-};
-
-static gboolean gst_dccp_client_src_stop (GstBaseSrc * bsrc);
-
-GST_DEBUG_CATEGORY_STATIC (dccpclientsrc_debug);
-
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-GST_BOILERPLATE (GstDCCPClientSrc, gst_dccp_client_src, GstPushSrc,
- GST_TYPE_PUSH_SRC);
-
-static guint gst_dccp_client_src_signals[LAST_SIGNAL] = { 0 };
-
-/*
- * Read a buffer from the client socket
- *
- * @return GST_FLOW_OK if the send operation was successful, GST_FLOW_ERROR otherwise.
- */
-static GstFlowReturn
-gst_dccp_client_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
-{
- GstDCCPClientSrc *src;
- GstFlowReturn ret = GST_FLOW_OK;
-
- src = GST_DCCP_CLIENT_SRC (psrc);
-
- GST_LOG_OBJECT (src, "reading a buffer");
- ret = gst_dccp_read_buffer (GST_ELEMENT (src), src->sock_fd, outbuf);
-
- 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));
-
- if (!gst_caps_is_equal (src->caps, GST_CAPS_ANY)) {
- gst_buffer_set_caps (*outbuf, src->caps);
- }
- }
-
- return ret;
-}
-
-/*
- * Set the value of a property for the client src.
- */
-static void
-gst_dccp_client_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstDCCPClientSrc *src = GST_DCCP_CLIENT_SRC (object);
-
- switch (prop_id) {
- case PROP_PORT:
- src->port = g_value_get_int (value);
- break;
- case PROP_HOST:
- if (!g_value_get_string (value)) {
- g_warning ("host property cannot be NULL");
- break;
- }
- g_free (src->host);
- src->host = g_strdup (g_value_get_string (value));
- break;
- case PROP_SOCK_FD:
- src->sock_fd = g_value_get_int (value);
- break;
- case PROP_CLOSED:
- src->closed = g_value_get_boolean (value);
- break;
- case PROP_CCID:
- src->ccid = g_value_get_int (value);
- break;
- case PROP_CAPS:
- {
- const GstCaps *new_caps_val = gst_value_get_caps (value);
- GstCaps *new_caps;
- GstCaps *old_caps;
-
- if (new_caps_val == NULL) {
- new_caps = gst_caps_new_any ();
- } else {
- new_caps = gst_caps_copy (new_caps_val);
- }
-
- old_caps = src->caps;
- src->caps = new_caps;
- if (old_caps)
- gst_caps_unref (old_caps);
- gst_pad_set_caps (GST_BASE_SRC (src)->srcpad, new_caps);
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/*
- * Get a given property value for the client src.
- */
-static void
-gst_dccp_client_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstDCCPClientSrc *src = GST_DCCP_CLIENT_SRC (object);
-
- switch (prop_id) {
- case PROP_PORT:
- g_value_set_int (value, src->port);
- break;
- case PROP_HOST:
- g_value_set_string (value, src->host);
- break;
- case PROP_SOCK_FD:
- g_value_set_int (value, src->sock_fd);
- break;
- case PROP_CLOSED:
- g_value_set_boolean (value, src->closed);
- break;
- case PROP_CCID:
- g_value_set_int (value, src->ccid);
- break;
- case PROP_CAPS:
- gst_value_set_caps (value, src->caps);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/*
- * Starts the element. If the sockfd property was not the default, this method
- * will create a new socket and connect to the server.
- *
- * @param bsrc - the element
- * @return TRUE if the send operation was successful, FALSE otherwise.
- */
-static gboolean
-gst_dccp_client_src_start (GstBaseSrc * bsrc)
-{
- GstDCCPClientSrc *src = GST_DCCP_CLIENT_SRC (bsrc);
-
- if (src->sock_fd == DCCP_DEFAULT_SOCK_FD) {
- gchar *ip = NULL;
-
- /* look up name if we need to */
- if (!(ip = gst_dccp_host_to_ip (GST_ELEMENT (src), src->host))) {
- GST_ERROR_OBJECT (src, "cannot resolve hostname");
- gst_dccp_client_src_stop (GST_BASE_SRC (src));
- return FALSE;
- }
-
- /* name the server 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->port); /* on port */
- src->server_sin.sin_addr.s_addr = inet_addr (ip); /* on host ip */
- g_free (ip);
-
- /* create socket */
- if ((src->sock_fd = gst_dccp_create_new_socket (GST_ELEMENT (src))) < 0) {
- return FALSE;
- }
-
- if (!gst_dccp_set_ccid (GST_ELEMENT (src), src->sock_fd, src->ccid)) {
- gst_dccp_client_src_stop (GST_BASE_SRC (src));
- return FALSE;
- }
-
- if (!gst_dccp_connect_to_server (GST_ELEMENT (src), src->server_sin,
- src->sock_fd)) {
- gst_dccp_client_src_stop (GST_BASE_SRC (src));
- return FALSE;
- }
-
- /* the socket is connected */
- g_signal_emit (src, gst_dccp_client_src_signals[SIGNAL_CONNECTED], 0,
- src->sock_fd);
- }
-
- return TRUE;
-}
-
-static void
-gst_dccp_client_src_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_static_pad_template (element_class, &srctemplate);
-
- gst_element_class_set_static_metadata (element_class, "DCCP client source",
- "Source/Network",
- "Receive data as a client over the network via DCCP",
- "E-Phone Team at Federal University of Campina Grande <leandroal@gmail.com>");
-}
-
-static void
-gst_dccp_client_src_init (GstDCCPClientSrc * this,
- GstDCCPClientSrcClass * g_class)
-{
- this->port = DCCP_DEFAULT_PORT;
- this->host = g_strdup (DCCP_DEFAULT_HOST);
- this->sock_fd = DCCP_DEFAULT_SOCK_FD;
- this->closed = DCCP_DEFAULT_CLOSED;
- this->ccid = DCCP_DEFAULT_CCID;
- this->caps = NULL;
-
- gst_base_src_set_format (GST_BASE_SRC (this), GST_FORMAT_TIME);
-
- /* Checking if the version of the gstreamer is bigger that 0.10.15 */
-#if ((GST_VERSION_MAJOR > 0) || \
- (GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR > 10) || \
- (GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR == 10 && GST_VERSION_MICRO >= 15))
- gst_base_src_set_do_timestamp (GST_BASE_SRC (this), TRUE);
-#endif
-
- /* FIXME is this correct? */
- gst_base_src_set_live (GST_BASE_SRC (this), TRUE);
-}
-
-static void
-gst_dccp_client_src_finalize (GObject * gobject)
-{
- GstDCCPClientSrc *this = GST_DCCP_CLIENT_SRC (gobject);
-
- if (this->caps) {
- gst_caps_unref (this->caps);
- this->caps = NULL;
- }
-
- g_free (this->host);
-
- G_OBJECT_CLASS (parent_class)->finalize (gobject);
-}
-
-static gboolean
-gst_dccp_client_src_stop (GstBaseSrc * bsrc)
-{
- GstDCCPClientSrc *src;
-
- src = GST_DCCP_CLIENT_SRC (bsrc);
-
- if (src->sock_fd != DCCP_DEFAULT_SOCK_FD && src->closed) {
- gst_dccp_socket_close (GST_ELEMENT (src), &(src->sock_fd));
- }
-
- return TRUE;
-}
-
-/*
- * Define the gst class, callbacks, etc.
- */
-static void
-gst_dccp_client_src_class_init (GstDCCPClientSrcClass * 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_dccp_client_src_set_property;
- gobject_class->get_property = gst_dccp_client_src_get_property;
-
- gobject_class->finalize = gst_dccp_client_src_finalize;
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PORT,
- g_param_spec_int ("port", "Port",
- "The port to receive packets from", 0, G_MAXUINT16,
- DCCP_DEFAULT_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_HOST,
- g_param_spec_string ("host", "Host",
- "The host IP address to receive packets from", DCCP_DEFAULT_HOST,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_SOCK_FD,
- g_param_spec_int ("sockfd", "Socket fd",
- "The socket file descriptor", -1, G_MAXINT, DCCP_DEFAULT_SOCK_FD,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_CLOSED,
- g_param_spec_boolean ("close-socket", "Close socket",
- "Close socket at the end of stream", DCCP_DEFAULT_CLOSED,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_CAPS,
- g_param_spec_boxed ("caps", "Caps",
- "The caps of the source pad", GST_TYPE_CAPS,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_CCID,
- g_param_spec_int ("ccid", "CCID",
- "The Congestion Control IDentified to be used", 2, G_MAXINT,
- DCCP_DEFAULT_CCID, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /* signals */
- /**
- * GstDccpClientSrc::connected:
- * @src: the gstdccpclientsrc element that emitted this signal
- * @fd: the connected socket file descriptor
- *
- * Reports that the element has connected, giving the fd of the socket
- */
- gst_dccp_client_src_signals[SIGNAL_CONNECTED] =
- g_signal_new ("connected", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GstDCCPClientSrcClass, connected), NULL, NULL,
- gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
-
- gstbasesrc_class->start = gst_dccp_client_src_start;
- gstbasesrc_class->stop = gst_dccp_client_src_stop;
-
- gstpush_src_class->create = gst_dccp_client_src_create;
-
- GST_DEBUG_CATEGORY_INIT (dccpclientsrc_debug, "dccpclientsrc", 0,
- "DCCP Client Source");
-}
diff --git a/gst/dccp/gstdccpclientsrc.h b/gst/dccp/gstdccpclientsrc.h
deleted file mode 100644
index 340405a88..000000000
--- a/gst/dccp/gstdccpclientsrc.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_DCCP_CLIENT_SRC_H__
-#define __GST_DCCP_CLIENT_SRC_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstpushsrc.h>
-#include <gst/base/gstbasesrc.h>
-
-G_BEGIN_DECLS
-
-#include "gstdccp_common.h"
-
-#define GST_TYPE_DCCP_CLIENT_SRC \
- (gst_dccp_client_src_get_type())
-#define GST_DCCP_CLIENT_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DCCP_CLIENT_SRC,GstDCCPClientSrc))
-#define GST_DCCP_CLIENT_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DCCP_CLIENT_SRC,GstDCCPClientSrcClass))
-#define GST_IS_DCCP_CLIENT_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DCCP_CLIENT_SRC))
-#define GST_IS_DCCP_CLIENT_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DCCP_CLIENT_SRC))
-
-typedef struct _GstDCCPClientSrc GstDCCPClientSrc;
-typedef struct _GstDCCPClientSrcClass GstDCCPClientSrcClass;
-
-struct _GstDCCPClientSrc {
- GstPushSrc element;
-
- /* server information */
- int port;
- gchar *host;
- struct sockaddr_in server_sin;
-
- /* socket */
- int sock_fd;
- gboolean closed;
-
- GstCaps *caps;
- uint8_t ccid;
-};
-
-struct _GstDCCPClientSrcClass {
- GstPushSrcClass parent_class;
-
- /* signals */
- void (*connected) (GstElement *src, gint fd);
-};
-
-GType gst_dccp_client_src_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_DCCP_CLIENT_SRC_H__ */
diff --git a/gst/dccp/gstdccpplugin.c b/gst/dccp/gstdccpplugin.c
deleted file mode 100644
index d3e13fa0f..000000000
--- a/gst/dccp/gstdccpplugin.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstdccpclientsrc.h"
-#include "gstdccpserversink.h"
-#include "gstdccpclientsink.h"
-#include "gstdccpserversrc.h"
-
-GST_DEBUG_CATEGORY (dccp_debug);
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- if (!gst_element_register (plugin, "dccpclientsrc", GST_RANK_NONE,
- GST_TYPE_DCCP_CLIENT_SRC))
- return FALSE;
-
- if (!gst_element_register (plugin, "dccpserversink", GST_RANK_NONE,
- GST_TYPE_DCCP_SERVER_SINK))
- return FALSE;
-
- if (!gst_element_register (plugin, "dccpclientsink", GST_RANK_NONE,
- GST_TYPE_DCCP_CLIENT_SINK))
- return FALSE;
-
- if (!gst_element_register (plugin, "dccpserversrc", GST_RANK_NONE,
- GST_TYPE_DCCP_SERVER_SRC))
- return FALSE;
-
- GST_DEBUG_CATEGORY_INIT (dccp_debug, "dccp", 0, "DCCP calls");
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- dccp,
- "transfer data over the network via DCCP.",
- plugin_init, VERSION, GST_LICENSE, "DCCP",
- "http://garage.maemo.org/projects/ephone")
diff --git a/gst/dccp/gstdccpserversink.c b/gst/dccp/gstdccpserversink.c
deleted file mode 100644
index 7623523f9..000000000
--- a/gst/dccp/gstdccpserversink.c
+++ /dev/null
@@ -1,465 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/**
- * SECTION:element-dccpserversink
- * @see_also: dccpclientsink, dccpclientsrc, dccpserversrc
- *
- * This element wait for connections from clients and send data to them.
- * <ulink url="http://www.linuxfoundation.org/en/Net:DCCP">DCCP</ulink> (Datagram
- * Congestion Control Protocol) is a Transport Layer protocol like
- * TCP and UDP.
- *
- * <refsect2>
- * <title>Example pipeline</title>
- * <para>
- * |[
- * gst-launch -v dccpclientsrc host=localhost port=9011 ccid=2 ! decodebin ! alsasink
- * ]| Client
- * |[
- * gst-launch -v filesrc location=music.mp3 ! mp3parse ! dccpserversink port=9011 ccid=2
- * ]| Server
- *
- * This example pipeline will send a MP3 stream to the client using DCCP.
- * The client will decode the MP3 and play it. Run the server pipeline
- * first than the client pipeline. If you want, you can run more than one dccpclientsrc
- * to connect to the same server (see wait-connections property at dccpserversink).
- * </para>
- * </refsect2>
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstdccpserversink.h"
-#include "gstdccp.h"
-#include <fcntl.h>
-
-/* signals */
-enum
-{
- SIGNAL_CONNECTED,
- LAST_SIGNAL
-};
-
-/* properties */
-enum
-{
- PROP_0,
- PROP_PORT,
- PROP_CLIENT_SOCK_FD,
- PROP_CCID,
- PROP_CLOSED,
- PROP_WAIT_CONNECTIONS
-};
-
-static pthread_t accept_thread_id;
-
-static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
-static gboolean gst_dccp_server_sink_stop (GstBaseSink * bsink);
-
-GST_DEBUG_CATEGORY_STATIC (dccpserversink_debug);
-
-static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-GST_BOILERPLATE (GstDCCPServerSink, gst_dccp_server_sink, GstBaseSink,
- GST_TYPE_BASE_SINK);
-
-static guint gst_dccp_server_sink_signals[LAST_SIGNAL] = { 0 };
-
-/*
- * Create a new client with the socket and the MTU
- *
- * @param element - the gstdccpserversink instance
- * @param socket - the client socket
- * @return the client
- */
-static Client *
-gst_dccp_server_create_client (GstElement * element, int socket)
-{
- Client *client = (Client *) g_malloc (sizeof (Client));
- client->socket = socket;
- client->pksize = gst_dccp_get_max_packet_size (element, client->socket);
- client->flow_status = GST_FLOW_OK;
-
- GST_DEBUG_OBJECT (element, "Creating a new client with fd %d and MTU %d.",
- client->socket, client->pksize);
-
- /* the socket is connected */
- g_signal_emit (element, gst_dccp_server_sink_signals[SIGNAL_CONNECTED], 0,
- socket);
-
- return client;
-}
-
-/*
- * Wait connections of new clients
- *
- * @param arg - the gstdccpserversink instance
- */
-static void *
-gst_dccp_server_accept_new_clients (void *arg)
-{
- GstDCCPServerSink *sink = (GstDCCPServerSink *) arg;
- int newsockfd;
- Client *client;
-
- while (1) {
- newsockfd =
- gst_dccp_server_wait_connections (GST_ELEMENT (sink), sink->sock_fd);
-
- client = gst_dccp_server_create_client (GST_ELEMENT (sink), newsockfd);
-
- pthread_mutex_lock (&lock);
- sink->clients = g_list_append (sink->clients, client);
- pthread_mutex_unlock (&lock);
- }
-
- return NULL;
-}
-
-/*
- * Send the buffer to a client
- *
- * @param arg - the client
- */
-static void *
-gst_dccp_server_send_buffer (void *arg)
-{
- Client *client = (Client *) arg;
- GstDCCPServerSink *sink = client->server;
- GstBuffer *buf = client->buf;
- int client_sock_fd = client->socket;
- int pksize = client->pksize;
-
- if (gst_dccp_send_buffer (GST_ELEMENT (sink), buf, client_sock_fd,
- pksize) == GST_FLOW_ERROR) {
- client->flow_status = GST_FLOW_ERROR;
- }
- return NULL;
-}
-
-/* Remove clients with problems to send.
- *
- * @param arg - the gstdccpserversink instance
- */
-static void *
-gst_dccp_server_delete_dead_clients (void *arg)
-{
- GstDCCPServerSink *sink = (GstDCCPServerSink *) arg;
- GList *tmp = NULL;
- GList *l;
-
- pthread_mutex_lock (&lock);
- for (l = sink->clients; l != NULL; l = l->next) {
- Client *client = (Client *) l->data;
-
- if (client->flow_status == GST_FLOW_OK) {
- tmp = g_list_append (tmp, client);
- } else {
- close (client->socket);
- g_free (client);
- }
- }
- g_list_free (sink->clients);
- sink->clients = tmp;
- pthread_mutex_unlock (&lock);
- return 0;
-}
-
-static void
-gst_dccp_server_sink_init (GstDCCPServerSink * this,
- GstDCCPServerSinkClass * g_class)
-{
- this->port = DCCP_DEFAULT_PORT;
- this->sock_fd = DCCP_DEFAULT_SOCK_FD;
- this->client_sock_fd = DCCP_DEFAULT_CLIENT_SOCK_FD;
- this->closed = DCCP_DEFAULT_CLOSED;
- this->ccid = DCCP_DEFAULT_CCID;
- this->wait_connections = DCCP_DEFAULT_WAIT_CONNECTIONS;
- this->clients = NULL;
-}
-
-/*
- * Starts the element. If the sockfd property was not the default, this method
- * will wait for a client connection. If wait-connections property is true, it
- * creates a thread to wait for new client connections.
- *
- * @param bsink - the element
- * @return TRUE if the send operation was successful, FALSE otherwise.
- */
-static gboolean
-gst_dccp_server_sink_start (GstBaseSink * bsink)
-{
- GstDCCPServerSink *sink = GST_DCCP_SERVER_SINK (bsink);
- Client *client;
-
- if ((sink->sock_fd = gst_dccp_create_new_socket (GST_ELEMENT (sink))) < 0) {
- return FALSE;
- }
-
- if (!gst_dccp_make_address_reusable (GST_ELEMENT (sink), sink->sock_fd)) {
- return FALSE;
- }
-
- /* name the server socket */
- memset (&sink->server_sin, 0, sizeof (sink->server_sin));
- sink->server_sin.sin_family = AF_INET; /* network socket */
- sink->server_sin.sin_port = htons (sink->port); /* on port */
- sink->server_sin.sin_addr.s_addr = htonl (INADDR_ANY); /* for hosts */
-
- if (!gst_dccp_bind_server_socket (GST_ELEMENT (sink), sink->sock_fd,
- sink->server_sin)) {
- return FALSE;
- }
-
- if (!gst_dccp_set_ccid (GST_ELEMENT (sink), sink->sock_fd, sink->ccid)) {
- return FALSE;
- }
-
- if (!gst_dccp_listen_server_socket (GST_ELEMENT (sink), sink->sock_fd)) {
- return FALSE;
- }
-
-
- if (sink->client_sock_fd == DCCP_DEFAULT_CLIENT_SOCK_FD) {
- sink->client_sock_fd =
- gst_dccp_server_wait_connections (GST_ELEMENT (sink), sink->sock_fd);
- }
-
- if (sink->client_sock_fd == -1) {
- return FALSE;
- }
-
- client =
- gst_dccp_server_create_client (GST_ELEMENT (sink), sink->client_sock_fd);
- sink->clients = g_list_append (sink->clients, client);
-
- pthread_mutex_init (&lock, NULL);
-
- if (sink->wait_connections == TRUE) {
- pthread_create (&accept_thread_id, NULL, gst_dccp_server_accept_new_clients,
- sink);
- pthread_detach (accept_thread_id);
- }
-
- return TRUE;
-}
-
-static GstFlowReturn
-gst_dccp_server_sink_render (GstBaseSink * bsink, GstBuffer * buf)
-{
- GstDCCPServerSink *sink = GST_DCCP_SERVER_SINK (bsink);
-
- pthread_t thread_id;
- GList *l;
-
- pthread_mutex_lock (&lock);
-
- for (l = sink->clients; l != NULL; l = l->next) {
- Client *client = (Client *) l->data;
-
- client->buf = buf;
- client->server = sink;
-
- /* FIXME: are we really creating a new thread here for every single buffer
- * and every single client? */
- if (client->flow_status == GST_FLOW_OK) {
- pthread_create (&thread_id, NULL, gst_dccp_server_send_buffer,
- (void *) client);
- pthread_detach (thread_id);
- } else {
- /* FIXME: what's the point of doing this in a separate thread if it
- * keeps he global lock anyway while going through all the clients and
- * waiting for close() to finish? */
- pthread_create (&thread_id, NULL, gst_dccp_server_delete_dead_clients,
- (void *) sink);
- pthread_detach (thread_id);
- }
- }
-
- pthread_mutex_unlock (&lock);
- return GST_FLOW_OK;
-}
-
-static gboolean
-gst_dccp_server_sink_stop (GstBaseSink * bsink)
-{
- GstDCCPServerSink *sink;
- GList *l;
-
- sink = GST_DCCP_SERVER_SINK (bsink);
-
- if (sink->wait_connections == TRUE) {
- pthread_cancel (accept_thread_id);
- }
-
- gst_dccp_socket_close (GST_ELEMENT (sink), &(sink->sock_fd));
-
- pthread_mutex_lock (&lock);
- for (l = sink->clients; l != NULL; l = l->next) {
- Client *client = (Client *) l->data;
-
- if (client->socket != DCCP_DEFAULT_CLIENT_SOCK_FD && sink->closed == TRUE) {
- gst_dccp_socket_close (GST_ELEMENT (sink), &(client->socket));
- }
- g_free (client);
- }
- pthread_mutex_unlock (&lock);
-
- return TRUE;
-}
-
-static void
-gst_dccp_server_sink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_static_pad_template (element_class, &sinktemplate);
-
- gst_element_class_set_static_metadata (element_class, "DCCP server sink",
- "Sink/Network",
- "Send data as a server over the network via DCCP",
- "E-Phone Team at Federal University of Campina Grande <leandroal@gmail.com>");
-}
-
-/*
- * Set the value of a property for the server sink.
- */
-static void
-gst_dccp_server_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstDCCPServerSink *sink = GST_DCCP_SERVER_SINK (object);
-
- switch (prop_id) {
- case PROP_PORT:
- sink->port = g_value_get_int (value);
- break;
- case PROP_CLIENT_SOCK_FD:
- sink->client_sock_fd = g_value_get_int (value);
- break;
- case PROP_CLOSED:
- sink->closed = g_value_get_boolean (value);
- break;
- case PROP_WAIT_CONNECTIONS:
- sink->wait_connections = g_value_get_boolean (value);
- break;
- case PROP_CCID:
- sink->ccid = g_value_get_int (value);
- break;
- default:
- break;
- }
-}
-
-static void
-gst_dccp_server_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstDCCPServerSink *sink = GST_DCCP_SERVER_SINK (object);
-
- switch (prop_id) {
- case PROP_PORT:
- g_value_set_int (value, sink->port);
- break;
- case PROP_CLIENT_SOCK_FD:
- g_value_set_int (value, sink->client_sock_fd);
- break;
- case PROP_CLOSED:
- g_value_set_boolean (value, sink->closed);
- break;
- case PROP_WAIT_CONNECTIONS:
- g_value_set_boolean (value, sink->wait_connections);
- break;
- case PROP_CCID:
- g_value_set_int (value, sink->ccid);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-static void
-gst_dccp_server_sink_class_init (GstDCCPServerSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstBaseSinkClass *gstbasesink_class;
-
- gobject_class = (GObjectClass *) klass;
- gstbasesink_class = (GstBaseSinkClass *) klass;
-
- gobject_class->set_property = gst_dccp_server_sink_set_property;
- gobject_class->get_property = gst_dccp_server_sink_get_property;
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PORT,
- g_param_spec_int ("port", "Port",
- "The port to listen to", 0, G_MAXUINT16,
- DCCP_DEFAULT_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_CLIENT_SOCK_FD,
- g_param_spec_int ("sockfd", "Socket fd",
- "The client socket file descriptor", -1, G_MAXINT,
- DCCP_DEFAULT_CLIENT_SOCK_FD,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_CLOSED,
- g_param_spec_boolean ("close-socket", "Close",
- "Close the client sockets at end of stream",
- DCCP_DEFAULT_CLOSED, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_CCID,
- g_param_spec_int ("ccid", "CCID",
- "The Congestion Control IDentified to be used", 2, G_MAXINT,
- DCCP_DEFAULT_CCID, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_WAIT_CONNECTIONS,
- g_param_spec_boolean ("wait-connections", "Wait connections",
- "Wait for many client connections",
- DCCP_DEFAULT_WAIT_CONNECTIONS,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
-
- /* signals */
- /**
- * GstDccpServerSink::connected:
- * @sink: the gstdccpserversink element that emitted this signal
- * @fd: the connected socket file descriptor
- *
- * Reports that the element has connected, giving the fd of the socket
- */
- gst_dccp_server_sink_signals[SIGNAL_CONNECTED] =
- g_signal_new ("connected", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GstDCCPServerSinkClass, connected), NULL, NULL,
- gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
-
- gstbasesink_class->start = gst_dccp_server_sink_start;
- gstbasesink_class->stop = gst_dccp_server_sink_stop;
- gstbasesink_class->render = gst_dccp_server_sink_render;
-
- GST_DEBUG_CATEGORY_INIT (dccpserversink_debug, "dccpserversink", 0,
- "DCCP Server Sink");
-}
diff --git a/gst/dccp/gstdccpserversink.h b/gst/dccp/gstdccpserversink.h
deleted file mode 100644
index ea2bf81f4..000000000
--- a/gst/dccp/gstdccpserversink.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_DCCP_SERVER_SINK_H__
-#define __GST_DCCP_SERVER_SINK_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstbasesink.h>
-#include <gst/base/gstadapter.h>
-
-G_BEGIN_DECLS
-
-
-#include "gstdccp_common.h"
-#include <pthread.h>
-
-#define GST_TYPE_DCCP_SERVER_SINK \
- (gst_dccp_server_sink_get_type())
-#define GST_DCCP_SERVER_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DCCP_SERVER_SINK,GstDCCPServerSink))
-#define GST_DCCP_SERVER_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DCCP_SERVER_SINK,GstDCCPServerSinkClass))
-#define GST_IS_DCCP_SERVER_SINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DCCP_SERVER_SINK))
-#define GST_IS_DCCP_SERVER_SINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DCCP_SERVER_SINK))
-
-typedef struct _GstDCCPServerSink GstDCCPServerSink;
-typedef struct _GstDCCPServerSinkClass GstDCCPServerSinkClass;
-
-typedef struct _Client Client;
-
-struct _Client
-{
- GstDCCPServerSink *server;
- GstBuffer * buf;
- int socket;
- int pksize;
- GstFlowReturn flow_status;
-};
-
-struct _GstDCCPServerSink
-{
- GstBaseSink element;
-
- /* server information */
- int port;
- struct sockaddr_in server_sin;
-
- /* socket */
- int sock_fd;
-
- /* multiple clients */
- GList *clients;
-
- /* properties */
- int client_sock_fd;
- uint8_t ccid;
- gboolean wait_connections;
- gboolean closed;
-};
-
-struct _GstDCCPServerSinkClass
-{
- GstBaseSinkClass parent_class;
-
- /* signals */
- void (*connected) (GstElement *sink, gint fd);
-};
-
-GType gst_dccp_server_sink_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_DCCP_SERVER_SINK_H__ */
diff --git a/gst/dccp/gstdccpserversrc.c b/gst/dccp/gstdccpserversrc.c
deleted file mode 100644
index 357a8d131..000000000
--- a/gst/dccp/gstdccpserversrc.c
+++ /dev/null
@@ -1,390 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/**
- * SECTION:element-dccpserversrc
- * @see_also: dccpclientsink, dccpclientsrc, dccpserversink
- *
- * This element wait for connection from a client and receive data.
- * <ulink url="http://www.linuxfoundation.org/en/Net:DCCP">DCCP</ulink> (Datagram
- * Congestion Control Protocol) is a Transport Layer protocol like
- * TCP and UDP.
- *
- * <refsect2>
- * <title>Example pipeline</title>
- * <para>
- * |[
- * gst-launch -v filesrc location=music.mp3 ! mp3parse ! dccpclientsink host=localhost port=9011 ccid=2
- * ]| Client
- * |[
- * gst-launch -v dccpserversrc port=9011 ccid=2 ! decodebin ! alsasink
- * ]| Server
- *
- * This example pipeline will send a MP3 stream to the server using DCCP.
- * The server will decode the MP3 and play it.
- * Run the server pipeline first than the client pipeline.
- * </para>
- * </refsect2>
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstdccpserversrc.h"
-#include "gstdccp.h"
-#include <fcntl.h>
-
-#define DCCP_DEFAULT_CAPS NULL
-
-/* signals */
-enum
-{
- SIGNAL_CONNECTED,
- LAST_SIGNAL
-};
-
-/* properties */
-enum
-{
- PROP_0,
- PROP_PORT,
- PROP_CLIENT_SOCK_FD,
- PROP_CLOSED,
- PROP_CCID,
- PROP_CAPS
-};
-
-static gboolean gst_dccp_server_src_stop (GstBaseSrc * bsrc);
-
-GST_DEBUG_CATEGORY_STATIC (dccpserversrc_debug);
-
-static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-GST_BOILERPLATE (GstDCCPServerSrc, gst_dccp_server_src, GstPushSrc,
- GST_TYPE_PUSH_SRC);
-
-static guint gst_dccp_server_src_signals[LAST_SIGNAL] = { 0 };
-
-/*
- * Read a buffer from the server socket
- *
- * @return GST_FLOW_OK if the send operation was successful, GST_FLOW_ERROR otherwise.
- */
-static GstFlowReturn
-gst_dccp_server_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
-{
- GstDCCPServerSrc *src;
- GstFlowReturn ret = GST_FLOW_OK;
-
- src = GST_DCCP_SERVER_SRC (psrc);
-
- GST_LOG_OBJECT (src, "reading a buffer");
-
- ret = gst_dccp_read_buffer (GST_ELEMENT (src), src->client_sock_fd, outbuf);
-
- 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));
-
- if (!gst_caps_is_equal (src->caps, GST_CAPS_ANY)) {
- gst_buffer_set_caps (*outbuf, src->caps);
- }
- }
-
- return ret;
-}
-
-/*
- * Set the value of a property for the server src.
- */
-static void
-gst_dccp_server_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstDCCPServerSrc *src = GST_DCCP_SERVER_SRC (object);
-
- switch (prop_id) {
- case PROP_PORT:
- src->port = g_value_get_int (value);
- break;
- case PROP_CLIENT_SOCK_FD:
- src->client_sock_fd = g_value_get_int (value);
- break;
- case PROP_CLOSED:
- src->closed = g_value_get_boolean (value);
- break;
- case PROP_CCID:
- src->ccid = g_value_get_int (value);
- break;
- case PROP_CAPS:
- {
- const GstCaps *new_caps_val = gst_value_get_caps (value);
- GstCaps *new_caps;
- GstCaps *old_caps;
-
- if (new_caps_val == NULL) {
- new_caps = gst_caps_new_any ();
- } else {
- new_caps = gst_caps_copy (new_caps_val);
- }
-
- old_caps = src->caps;
- src->caps = new_caps;
- if (old_caps) {
- gst_caps_unref (old_caps);
- }
- gst_pad_set_caps (GST_BASE_SRC (src)->srcpad, new_caps);
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/*
- * Get a given property value for the server src.
- */
-static void
-gst_dccp_server_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstDCCPServerSrc *src = GST_DCCP_SERVER_SRC (object);
-
- switch (prop_id) {
- case PROP_PORT:
- g_value_set_int (value, src->port);
- break;
- case PROP_CLIENT_SOCK_FD:
- g_value_set_int (value, src->client_sock_fd);
- break;
- case PROP_CLOSED:
- g_value_set_boolean (value, src->closed);
- break;
- case PROP_CAPS:
- gst_value_set_caps (value, src->caps);
- break;
- case PROP_CCID:
- g_value_set_int (value, src->ccid);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/*
- * Starts the element. If the sockfd property was not the default, this method
- * will create a new server socket and wait for a client connection.
- *
- * @param bsrc - the element
- * @return TRUE if the send operation was successful, FALSE otherwise.
- */
-static gboolean
-gst_dccp_server_src_start (GstBaseSrc * bsrc)
-{
- GstDCCPServerSrc *src = GST_DCCP_SERVER_SRC (bsrc);
-
- if (src->client_sock_fd == DCCP_DEFAULT_CLIENT_SOCK_FD) {
- /* create socket */
- if ((src->sock_fd = gst_dccp_create_new_socket (GST_ELEMENT (src))) < 0) {
- return FALSE;
- }
-
- if (!gst_dccp_make_address_reusable (GST_ELEMENT (src), src->sock_fd)) {
- return FALSE;
- }
-
- /* name the server 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->port); /* on port */
- src->server_sin.sin_addr.s_addr = htonl (INADDR_ANY); /* for hosts */
-
-
- if (!gst_dccp_bind_server_socket (GST_ELEMENT (src), src->sock_fd,
- src->server_sin)) {
- return FALSE;
- }
-
- if (!gst_dccp_set_ccid (GST_ELEMENT (src), src->sock_fd, src->ccid)) {
- return FALSE;
- }
-
- if (!gst_dccp_listen_server_socket (GST_ELEMENT (src), src->sock_fd)) {
- return FALSE;
- }
-
- src->client_sock_fd = gst_dccp_server_wait_connections (GST_ELEMENT (src),
- src->sock_fd);
- if (src->client_sock_fd == -1) {
- return FALSE;
- }
-
- /* the socket is connected */
- g_signal_emit (src, gst_dccp_server_src_signals[SIGNAL_CONNECTED], 0,
- src->client_sock_fd);
- }
-
- return TRUE;
-}
-
-
-static void
-gst_dccp_server_src_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_static_pad_template (element_class, &srctemplate);
-
- gst_element_class_set_static_metadata (element_class, "DCCP server source",
- "Source/Network",
- "Receive data as a server over the network via DCCP",
- "E-Phone Team at Federal University of Campina Grande <leandroal@gmail.com>");
-}
-
-
-static void
-gst_dccp_server_src_init (GstDCCPServerSrc * this,
- GstDCCPServerSrcClass * g_class)
-{
- this->port = DCCP_DEFAULT_PORT;
- this->sock_fd = DCCP_DEFAULT_SOCK_FD;
- this->client_sock_fd = DCCP_DEFAULT_CLIENT_SOCK_FD;
- this->closed = DCCP_DEFAULT_CLOSED;
- this->ccid = DCCP_DEFAULT_CCID;
- this->caps = DCCP_DEFAULT_CAPS;
-
- gst_base_src_set_format (GST_BASE_SRC (this), GST_FORMAT_TIME);
-
- /* Checking if the version of the gstreamer is bigger that 0.10.15 */
-#if ((GST_VERSION_MAJOR > 0) || \
- (GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR > 10) || \
- (GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR == 10 && GST_VERSION_MICRO >= 15))
- gst_base_src_set_do_timestamp (GST_BASE_SRC (this), TRUE);
-#endif
-
- /* FIXME is this correct? */
- gst_base_src_set_live (GST_BASE_SRC (this), TRUE);
-}
-
-
-static void
-gst_dccp_server_src_finalize (GObject * gobject)
-{
- GstDCCPServerSrc *this = GST_DCCP_SERVER_SRC (gobject);
-
- if (this->caps) {
- gst_caps_unref (this->caps);
- this->caps = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->finalize (gobject);
-}
-
-
-static gboolean
-gst_dccp_server_src_stop (GstBaseSrc * bsrc)
-{
- GstDCCPServerSrc *src;
-
- src = GST_DCCP_SERVER_SRC (bsrc);
-
- gst_dccp_socket_close (GST_ELEMENT (src), &(src->sock_fd));
- if (src->client_sock_fd != DCCP_DEFAULT_CLIENT_SOCK_FD && src->closed == TRUE) {
- gst_dccp_socket_close (GST_ELEMENT (src), &(src->client_sock_fd));
- }
-
- return TRUE;
-}
-
-static void
-gst_dccp_server_src_class_init (GstDCCPServerSrcClass * 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_dccp_server_src_set_property;
- gobject_class->get_property = gst_dccp_server_src_get_property;
-
- gobject_class->finalize = gst_dccp_server_src_finalize;
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PORT,
- g_param_spec_int ("port", "Port",
- "The port to listen to", 0, G_MAXUINT16,
- DCCP_DEFAULT_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_CLIENT_SOCK_FD,
- g_param_spec_int ("sockfd", "Socket fd",
- "The client socket file descriptor", -1, G_MAXINT,
- DCCP_DEFAULT_CLIENT_SOCK_FD,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_CLOSED,
- g_param_spec_boolean ("close-socket", "Close socket",
- "Close client socket at the end of stream", DCCP_DEFAULT_CLOSED,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_CCID,
- g_param_spec_int ("ccid", "CCID",
- "The Congestion Control IDentified to be used", 2, G_MAXINT,
- DCCP_DEFAULT_CCID, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_CAPS,
- g_param_spec_boxed ("caps", "Caps",
- "The caps of the source pad", GST_TYPE_CAPS,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- /* signals */
- /**
- * GstDccpServerSrc::connected:
- * @src: the gstdccpserversrc element that emitted this signal
- * @fd: the connected socket file descriptor
- *
- * Reports that the element has connected, giving the fd of the socket
- */
- gst_dccp_server_src_signals[SIGNAL_CONNECTED] =
- g_signal_new ("connected", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GstDCCPServerSrcClass, connected), NULL, NULL,
- gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
-
- gstbasesrc_class->start = gst_dccp_server_src_start;
- gstbasesrc_class->stop = gst_dccp_server_src_stop;
-
- gstpush_src_class->create = gst_dccp_server_src_create;
-
- GST_DEBUG_CATEGORY_INIT (dccpserversrc_debug, "dccpserversrc", 0,
- "DCCP Server Source");
-}
diff --git a/gst/dccp/gstdccpserversrc.h b/gst/dccp/gstdccpserversrc.h
deleted file mode 100644
index d6a561553..000000000
--- a/gst/dccp/gstdccpserversrc.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_DCCP_SERVER_SRC_H__
-#define __GST_DCCP_SERVER_SRC_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstpushsrc.h>
-#include <gst/base/gstbasesrc.h>
-
-G_BEGIN_DECLS
-
-#include "gstdccp_common.h"
-
-#define GST_TYPE_DCCP_SERVER_SRC \
- (gst_dccp_server_src_get_type())
-#define GST_DCCP_SERVER_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DCCP_SERVER_SRC,GstDCCPServerSrc))
-#define GST_DCCP_SERVER_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DCCP_SERVER_SRC,GstDCCPServerSrcClass))
-#define GST_IS_DCCP_SERVER_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DCCP_SERVER_SRC))
-#define GST_IS_DCCP_SERVER_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DCCP_SERVER_SRC))
-
-typedef struct _GstDCCPServerSrc GstDCCPServerSrc;
-typedef struct _GstDCCPServerSrcClass GstDCCPServerSrcClass;
-
-struct _GstDCCPServerSrc
-{
- GstPushSrc element;
-
- /* server information */
- int port;
- struct sockaddr_in server_sin;
-
- /* socket */
- int sock_fd;
- gboolean closed;
-
- GstCaps *caps;
- uint8_t ccid;
-
- /* single client */
- int client_sock_fd;
-};
-
-struct _GstDCCPServerSrcClass
-{
- GstPushSrcClass parent_class;
-
- /* signals */
- void (*connected) (GstElement *src, gint fd);
-};
-
-GType gst_dccp_server_src_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_DCCP_SERVER_SRC_H__ */
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/gst/dccp/meson.build b/gst/dccp/meson.build
deleted file mode 100644
index 6682f6b05..000000000
--- a/gst/dccp/meson.build
+++ /dev/null
@@ -1,17 +0,0 @@
-dccp_sources = [
- 'gstdccpplugin.c',
- 'gstdccp.c',
- 'gstdccpserversink.c',
- 'gstdccpserversrc.c',
- 'gstdccpclientsink.c',
- 'gstdccpclientsrc.c',
-]
-
-gstdccp = library('gstdccp',
- dccp_sources,
- c_args : gst_plugins_bad_args,
- include_directories : [configinc, libsinc],
- dependencies : [gstbase_dep] + winsock2,
- install : true,
- install_dir : plugins_install_dir,
-)
diff --git a/gst/faceoverlay/Makefile.am b/gst/faceoverlay/Makefile.am
deleted file mode 100644
index 31a438216..000000000
--- a/gst/faceoverlay/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-plugin_LTLIBRARIES = libgstfaceoverlay.la
-
-# sources used to compile this plug-in
-libgstfaceoverlay_la_SOURCES = gstfaceoverlay.c
-
-# compiler and linker flags used to compile this plugin, set in configure.ac
-libgstfaceoverlay_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-libgstfaceoverlay_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-@GST_API_VERSION@ $(GST_LIBS)
-libgstfaceoverlay_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstfaceoverlay_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-# headers we need but don't want installed
-noinst_HEADERS = gstfaceoverlay.h
diff --git a/gst/faceoverlay/gstfaceoverlay.c b/gst/faceoverlay/gstfaceoverlay.c
deleted file mode 100644
index 19006f378..000000000
--- a/gst/faceoverlay/gstfaceoverlay.c
+++ /dev/null
@@ -1,452 +0,0 @@
-/* GStreamer faceoverlay plugin
- * Copyright (C) 2011 Laura Lucas Alday <lauralucas@gmail.com>
- *
- * 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.
- *
- * Alternatively, the contents of this file may be used under the
- * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
- * which case the following provisions apply instead of the ones
- * mentioned above:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/**
- * SECTION:element-faceoverlay
- *
- * Overlays a SVG image over a detected face in a video stream.
- * x, y, w, and h properties are optional, and change the image position and
- * size relative to the detected face position and size.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch autovideosrc ! videoconvert ! faceoverlay location=/path/to/gnome-video-effects/pixmaps/bow.svg x=-5 y=-15 w=0.3 h=0.1 ! videoconvert ! autovideosink
- * ]|
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <gst/gst.h>
-#include <gst/video/video.h>
-#include <string.h>
-
-#include "gstfaceoverlay.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_face_overlay_debug);
-#define GST_CAT_DEFAULT gst_face_overlay_debug
-
-enum
-{
- PROP_0,
- PROP_LOCATION,
- PROP_X,
- PROP_Y,
- PROP_W,
- PROP_H
-};
-
-static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-rgb; video/x-raw-yuv")
- );
-
-static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-rgb; video/x-raw-yuv")
- );
-
-GST_BOILERPLATE (GstFaceOverlay, gst_face_overlay, GstBin, GST_TYPE_BIN);
-
-static void gst_face_overlay_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_face_overlay_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void gst_face_overlay_message_handler (GstBin * bin,
- GstMessage * message);
-static GstStateChangeReturn gst_face_overlay_change_state (GstElement * element,
- GstStateChange transition);
-static gboolean gst_face_overlay_create_children (GstFaceOverlay * filter);
-
-static gboolean
-gst_face_overlay_create_children (GstFaceOverlay * filter)
-{
- GstElement *csp, *face_detect, *overlay;
- GstPad *pad;
-
- csp = gst_element_factory_make ("videoconvert", NULL);
- face_detect = gst_element_factory_make ("facedetect", NULL);
- overlay = gst_element_factory_make ("rsvgoverlay", NULL);
-
- /* FIXME: post missing-plugin messages on NULL->READY if needed */
- if (csp == NULL || face_detect == NULL || overlay == NULL)
- goto missing_element;
-
- g_object_set (face_detect, "display", FALSE, NULL);
-
- gst_bin_add_many (GST_BIN (filter), face_detect, csp, overlay, NULL);
- filter->svg_overlay = overlay;
-
- if (!gst_element_link_many (face_detect, csp, overlay, NULL))
- GST_ERROR_OBJECT (filter, "couldn't link elements");
-
- pad = gst_element_get_static_pad (face_detect, "sink");
- if (!gst_ghost_pad_set_target (GST_GHOST_PAD (filter->sinkpad), pad))
- GST_ERROR_OBJECT (filter->sinkpad, "couldn't set sinkpad target");
- gst_object_unref (pad);
-
- pad = gst_element_get_static_pad (overlay, "src");
- if (!gst_ghost_pad_set_target (GST_GHOST_PAD (filter->srcpad), pad))
- GST_ERROR_OBJECT (filter->srcpad, "couldn't set srcpad target");
- gst_object_unref (pad);
-
- return TRUE;
-
-/* ERRORS */
-missing_element:
- {
- /* clean up */
- if (csp == NULL)
- GST_ERROR_OBJECT (filter, "videoconvert element not found");
- else
- gst_object_unref (csp);
-
- if (face_detect == NULL)
- GST_ERROR_OBJECT (filter, "facedetect element not found (opencv plugin)");
- else
- gst_object_unref (face_detect);
-
- if (overlay == NULL)
- GST_ERROR_OBJECT (filter, "rsvgoverlay element not found (rsvg plugin)");
- else
- gst_object_unref (overlay);
-
- return FALSE;
- }
-}
-
-static GstStateChangeReturn
-gst_face_overlay_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
- GstFaceOverlay *filter = GST_FACEOVERLAY (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- if (filter->svg_overlay == NULL) {
- GST_ELEMENT_ERROR (filter, CORE, MISSING_PLUGIN, (NULL),
- ("Some required plugins are missing, probably either the opencv "
- "facedetect element or rsvgoverlay"));
- return GST_STATE_CHANGE_FAILURE;
- }
- filter->update_svg = TRUE;
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- default:
- break;
- }
-
- return ret;
-}
-
-static void
-gst_face_overlay_handle_faces (GstFaceOverlay * filter, const GstStructure * s)
-{
- guint x, y, width, height;
- gint svg_x, svg_y, svg_width, svg_height;
- const GstStructure *face;
- const GValue *faces_list, *face_val;
- gchar *new_location = NULL;
- gint face_count;
-
-#if 0
- /* optionally draw the image once every two messages for better performance */
- filter->process_message = !filter->process_message;
- if (!filter->process_message)
- return;
-#endif
-
- faces_list = gst_structure_get_value (s, "faces");
- face_count = gst_value_list_get_size (faces_list);
- GST_LOG_OBJECT (filter, "face count: %d", face_count);
-
- if (face_count == 0) {
- GST_DEBUG_OBJECT (filter, "no face, clearing overlay");
- g_object_set (filter->svg_overlay, "location", NULL, NULL);
- GST_OBJECT_LOCK (filter);
- filter->update_svg = TRUE;
- GST_OBJECT_UNLOCK (filter);
- return;
- }
-
- /* The last face in the list seems to be the right one, objects mistakenly
- * detected as faces for a couple of frames seem to be in the list
- * beginning. TODO: needs confirmation. */
- face_val = gst_value_list_get_value (faces_list, face_count - 1);
- face = gst_value_get_structure (face_val);
- gst_structure_get_uint (face, "x", &x);
- gst_structure_get_uint (face, "y", &y);
- gst_structure_get_uint (face, "width", &width);
- gst_structure_get_uint (face, "height", &height);
-
- /* Apply x and y offsets relative to face position and size.
- * Set image width and height as a fraction of face width and height.
- * Cast to int since face position and size will never be bigger than
- * G_MAX_INT and we may have negative values as svg_x or svg_y */
-
- GST_OBJECT_LOCK (filter);
-
- svg_x = (gint) x + (gint) (filter->x * width);
- svg_y = (gint) y + (gint) (filter->y * height);
-
- svg_width = (gint) (filter->w * width);
- svg_height = (gint) (filter->h * height);
-
- if (filter->update_svg) {
- new_location = g_strdup (filter->location);
- filter->update_svg = FALSE;
- }
- GST_OBJECT_UNLOCK (filter);
-
- if (new_location != NULL) {
- GST_DEBUG_OBJECT (filter, "set rsvgoverlay location=%s", new_location);
- g_object_set (filter->svg_overlay, "location", new_location, NULL);
- g_free (new_location);
- }
-
- GST_LOG_OBJECT (filter, "overlay dimensions: %d x %d @ %d,%d",
- svg_width, svg_height, svg_x, svg_y);
-
- g_object_set (filter->svg_overlay,
- "x", svg_x, "y", svg_y, "width", svg_width, "height", svg_height, NULL);
-}
-
-static void
-gst_face_overlay_message_handler (GstBin * bin, GstMessage * message)
-{
- if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT) {
- const GstStructure *s = gst_message_get_structure (message);
-
- if (gst_structure_has_name (s, "facedetect")) {
- gst_face_overlay_handle_faces (GST_FACEOVERLAY (bin), s);
- }
- }
-
- GST_BIN_CLASS (parent_class)->handle_message (bin, message);
-}
-
-static void
-gst_face_overlay_base_init (gpointer gclass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
- gst_element_class_set_static_metadata (element_class,
- "faceoverlay",
- "Filter/Editor/Video",
- "Overlays SVG graphics over a detected face in a video stream",
- "Laura Lucas Alday <lauralucas@gmail.com>");
-
- gst_element_class_add_static_pad_template (element_class, &src_factory);
- gst_element_class_add_static_pad_template (element_class, &sink_factory);
-}
-
-static void
-gst_face_overlay_class_init (GstFaceOverlayClass * klass)
-{
- GObjectClass *gobject_class;
- GstBinClass *gstbin_class;
- GstElementClass *gstelement_class;
-
- gobject_class = G_OBJECT_CLASS (klass);
- gstbin_class = GST_BIN_CLASS (klass);
- gstelement_class = GST_ELEMENT_CLASS (klass);
-
- gobject_class->set_property = gst_face_overlay_set_property;
- gobject_class->get_property = gst_face_overlay_get_property;
-
- g_object_class_install_property (gobject_class, PROP_LOCATION,
- g_param_spec_string ("location", "Location",
- "Location of SVG file to use for face overlay",
- "", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_X,
- g_param_spec_float ("x", "face x offset",
- "Specify image x relative to detected face x.", -G_MAXFLOAT,
- G_MAXFLOAT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_Y,
- g_param_spec_float ("y", "face y offset",
- "Specify image y relative to detected face y.", -G_MAXFLOAT,
- G_MAXFLOAT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_W,
- g_param_spec_float ("w", "face width percent",
- "Specify image width relative to face width.", 0, G_MAXFLOAT, 1,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_H,
- g_param_spec_float ("h", "face height percent",
- "Specify image height relative to face height.", 0, G_MAXFLOAT, 1,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstbin_class->handle_message =
- GST_DEBUG_FUNCPTR (gst_face_overlay_message_handler);
- gstelement_class->change_state =
- GST_DEBUG_FUNCPTR (gst_face_overlay_change_state);
-}
-
-static void
-gst_face_overlay_init (GstFaceOverlay * filter, GstFaceOverlayClass * gclass)
-{
- GstPadTemplate *tmpl;
-
- filter->x = 0;
- filter->y = 0;
- filter->w = 1;
- filter->h = 1;
- filter->svg_overlay = NULL;
- filter->location = NULL;
- filter->process_message = TRUE;
-
- tmpl = gst_static_pad_template_get (&sink_factory);
- filter->sinkpad = gst_ghost_pad_new_no_target_from_template ("sink", tmpl);
- gst_object_unref (tmpl);
- gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
-
- tmpl = gst_static_pad_template_get (&src_factory);
- filter->srcpad = gst_ghost_pad_new_no_target_from_template ("src", tmpl);
- gst_object_unref (tmpl);
- gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
-
- gst_face_overlay_create_children (filter);
-}
-
-static void
-gst_face_overlay_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstFaceOverlay *filter = GST_FACEOVERLAY (object);
-
- switch (prop_id) {
- case PROP_LOCATION:
- GST_OBJECT_LOCK (filter);
- g_free (filter->location);
- filter->location = g_value_dup_string (value);
- filter->update_svg = TRUE;
- GST_OBJECT_UNLOCK (filter);
- break;
- case PROP_X:
- GST_OBJECT_LOCK (filter);
- filter->x = g_value_get_float (value);
- GST_OBJECT_UNLOCK (filter);
- break;
- case PROP_Y:
- GST_OBJECT_LOCK (filter);
- filter->y = g_value_get_float (value);
- GST_OBJECT_UNLOCK (filter);
- break;
- case PROP_W:
- GST_OBJECT_LOCK (filter);
- filter->w = g_value_get_float (value);
- GST_OBJECT_UNLOCK (filter);
- break;
- case PROP_H:
- GST_OBJECT_LOCK (filter);
- filter->h = g_value_get_float (value);
- GST_OBJECT_UNLOCK (filter);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_face_overlay_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstFaceOverlay *filter = GST_FACEOVERLAY (object);
-
- switch (prop_id) {
- case PROP_LOCATION:
- GST_OBJECT_LOCK (filter);
- g_value_set_string (value, filter->location);
- GST_OBJECT_UNLOCK (filter);
- break;
- case PROP_X:
- GST_OBJECT_LOCK (filter);
- g_value_set_float (value, filter->x);
- GST_OBJECT_UNLOCK (filter);
- break;
- case PROP_Y:
- GST_OBJECT_LOCK (filter);
- g_value_set_float (value, filter->y);
- GST_OBJECT_UNLOCK (filter);
- break;
- case PROP_W:
- GST_OBJECT_LOCK (filter);
- g_value_set_float (value, filter->w);
- GST_OBJECT_UNLOCK (filter);
- break;
- case PROP_H:
- GST_OBJECT_LOCK (filter);
- g_value_set_float (value, filter->h);
- GST_OBJECT_UNLOCK (filter);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static gboolean
-faceoverlay_init (GstPlugin * faceoverlay)
-{
- GST_DEBUG_CATEGORY_INIT (gst_face_overlay_debug, "faceoverlay",
- 0, "SVG Face Overlay");
-
- return gst_element_register (faceoverlay, "faceoverlay", GST_RANK_NONE,
- GST_TYPE_FACEOVERLAY);
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- faceoverlay,
- "SVG Face Overlay",
- faceoverlay_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/faceoverlay/gstfaceoverlay.h b/gst/faceoverlay/gstfaceoverlay.h
deleted file mode 100644
index 810e28adc..000000000
--- a/gst/faceoverlay/gstfaceoverlay.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* GStreamer faceoverlay plugin
- * Copyright (C) 2011 Laura Lucas Alday <lauralucas@gmail.com>
- *
- * 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.
- *
- * Alternatively, the contents of this file may be used under the
- * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
- * which case the following provisions apply instead of the ones
- * mentioned above:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_FACEOVERLAY_H__
-#define __GST_FACEOVERLAY_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_FACEOVERLAY \
- (gst_face_overlay_get_type())
-#define GST_FACEOVERLAY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FACEOVERLAY,GstFaceOverlay))
-#define GST_FACEOVERLAY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FACEOVERLAY,GstFaceOverlayClass))
-#define GST_IS_FACEOVERLAY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FACEOVERLAY))
-#define GST_IS_FACEOVERLAY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FACEOVERLAY))
-
-typedef struct _GstFaceOverlay GstFaceOverlay;
-typedef struct _GstFaceOverlayClass GstFaceOverlayClass;
-
-struct _GstFaceOverlay
-{
- GstBin parent;
-
- GstPad *sinkpad, *srcpad;
-
- GstElement *face_detect;
- GstElement *colorspace;
- GstElement *svg_overlay;
-
- gboolean process_message;
-
- gboolean update_svg;
-
- gchar *location;
- gfloat x;
- gfloat y;
- gfloat w;
- gfloat h;
-};
-
-struct _GstFaceOverlayClass
-{
- GstBinClass parent_class;
-};
-
-GType gst_face_overlay_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_FACEOVERLAY_H__ */
diff --git a/gst/faceoverlay/meson.build b/gst/faceoverlay/meson.build
deleted file mode 100644
index 65aa7295d..000000000
--- a/gst/faceoverlay/meson.build
+++ /dev/null
@@ -1,12 +0,0 @@
-fover_sources = [
- 'gstfaceoverlay.c',
-]
-
-gstfaceoverlay = library('gstfaceoverlay',
- fover_sources,
- c_args : gst_plugins_bad_args,
- include_directories : [configinc],
- dependencies : [gstbase_dep, gstvideo_dep],
- install : true,
- install_dir : plugins_install_dir,
-)
diff --git a/gst/games/Makefile.am b/gst/games/Makefile.am
deleted file mode 100644
index d85c89d37..000000000
--- a/gst/games/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-
-plugin_LTLIBRARIES = libgstpuzzle.la
-
-libgstpuzzle_la_SOURCES = \
- gstvideoimage.c \
- gstpuzzle.c
-
-libgstpuzzle_la_CFLAGS = $(GST_CFLAGS) $(LIBOIL_CFLAGS) -I$(top_srcdir)/gst/videofilter
-libgstpuzzle_la_LIBADD =
-libgstpuzzle_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(LIBOIL_LIBS)
-libgstpuzzle_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-noinst_HEADERS = gstvideoimage.h
diff --git a/gst/games/gstpuzzle.c b/gst/games/gstpuzzle.c
deleted file mode 100644
index 992838072..000000000
--- a/gst/games/gstpuzzle.c
+++ /dev/null
@@ -1,576 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * <2003> David Schleef <ds@schleef.org>
- * <2004> Benjamin Otte <otte@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gstvideofilter.h>
-#include "gstvideoimage.h"
-#include <string.h>
-
-#define GST_TYPE_PUZZLE \
- (gst_puzzle_get_type())
-#define GST_PUZZLE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PUZZLE,GstPuzzle))
-#define GST_PUZZLE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PUZZLE,GstPuzzleClass))
-#define GST_IS_PUZZLE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PUZZLE))
-#define GST_IS_PUZZLE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PUZZLE))
-
-typedef struct _GstPuzzle GstPuzzle;
-typedef struct _GstPuzzleClass GstPuzzleClass;
-
-struct _GstPuzzle
-{
- GstVideofilter videofilter;
-
- const GstVideoFormat *format;
- /* properties */
- guint rows;
- guint columns;
- guint tiles;
- /* state */
- guint *permutation;
- guint position;
- gboolean solved;
-};
-
-struct _GstPuzzleClass
-{
- GstVideofilterClass parent_class;
-};
-
-
-/* GstPuzzle signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-enum
-{
- PROP_0,
- PROP_COLUMNS,
- PROP_ROWS
- /* FILL ME */
-};
-
-static void gst_puzzle_base_init (gpointer g_class);
-static void gst_puzzle_class_init (gpointer g_class, gpointer class_data);
-static void gst_puzzle_init (GTypeInstance * instance, gpointer g_class);
-static void gst_puzzle_finalize (GObject * object);
-
-static void gst_puzzle_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_puzzle_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static void gst_puzzle_setup (GstVideofilter * videofilter);
-static void draw_puzzle (GstVideofilter * videofilter, void *destp, void *srcp);
-
-static GstVideofilterClass *parent_class;
-
-GType
-gst_puzzle_get_type (void)
-{
- static GType puzzle_type = 0;
-
- if (!puzzle_type) {
- static const GTypeInfo puzzle_info = {
- sizeof (GstPuzzleClass),
- gst_puzzle_base_init,
- NULL,
- gst_puzzle_class_init,
- NULL,
- NULL,
- sizeof (GstPuzzle),
- 0,
- gst_puzzle_init,
- };
-
- puzzle_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
- "GstPuzzle", &puzzle_info, 0);
- }
- return puzzle_type;
-}
-
-static void
-gst_puzzle_base_init (gpointer g_class)
-{
-
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- GstVideofilterClass *videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
- int i;
- GstVideofilterFormat *f;
-
- gst_element_class_set_static_metadata (element_class, "A simple puzzle",
- "Filter/Effect/Video/Games",
- "A simple puzzle, use arrow keys and space to restart/solve",
- "Benjamin Otte <otte@gnome.org>");
-
- for (i = 0; i < gst_video_format_count; i++) {
- f = g_new0 (GstVideofilterFormat, 1);
- f->fourcc = gst_video_format_list[i].fourcc;
- f->bpp = gst_video_format_list[i].bitspp;
- f->filter_func = draw_puzzle;
- if (gst_video_format_list[i].ext_caps) {
- f->depth = gst_video_format_list[i].depth;
- f->endianness =
- gst_video_format_list[i].bitspp < 24 ? G_BYTE_ORDER : G_BIG_ENDIAN;
- f->red_mask = gst_video_format_list[i].red_mask;
- f->green_mask = gst_video_format_list[i].green_mask;
- f->blue_mask = gst_video_format_list[i].blue_mask;
- }
- gst_videofilter_class_add_format (videofilter_class, f);
- }
-
- gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
-}
-
-static void
-gst_puzzle_class_init (gpointer g_class, gpointer class_data)
-{
- GObjectClass *gobject_class;
- GstVideofilterClass *videofilter_class;
-
- gobject_class = G_OBJECT_CLASS (g_class);
- videofilter_class = GST_VIDEOFILTER_CLASS (g_class);
-
- parent_class = g_type_class_peek_parent (g_class);
-
- gobject_class->set_property = gst_puzzle_set_property;
- gobject_class->get_property = gst_puzzle_get_property;
- gobject_class->finalize = gst_puzzle_finalize;
-
- g_object_class_install_property (gobject_class, PROP_ROWS,
- g_param_spec_uint ("rows", "rows", "number of rows in puzzle",
- 1, G_MAXUINT, 4,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_COLUMNS,
- g_param_spec_uint ("columns", "columns", "number of columns in puzzle",
- 1, G_MAXUINT, 4,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
-
- videofilter_class->setup = gst_puzzle_setup;
-}
-
-static void
-gst_puzzle_finalize (GObject * object)
-{
- GstPuzzle *puzzle;
-
- puzzle = GST_PUZZLE (object);
- g_free (puzzle->permutation);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void G_GNUC_UNUSED
-gst_puzzle_solve (GstPuzzle * puzzle)
-{
- guint i;
-
- for (i = 0; i < puzzle->tiles; i++) {
- puzzle->permutation[i] = i;
- }
- puzzle->position = puzzle->tiles - 1;
- puzzle->solved = TRUE;
-}
-
-static gboolean
-gst_puzzle_is_solved (GstPuzzle * puzzle)
-{
- guint i;
-
- if (puzzle->position != puzzle->tiles - 1)
- return FALSE;
-
- for (i = 0; i < puzzle->tiles; i++) {
- if (puzzle->permutation[i] != i)
- return FALSE;
- }
-
- return TRUE;
-}
-
-#if 0
-static void
-gst_puzzle_show (GstPuzzle * puzzle)
-{
- guint i;
-
- for (i = 0; i < puzzle->tiles; i++) {
- g_print ("%d ", puzzle->permutation[i]);
- }
- g_print ("\n");
-}
-#endif
-
-static void
-gst_puzzle_swap (GstPuzzle * puzzle, guint next)
-{
- guint tmp;
-
- g_assert (next < puzzle->tiles);
- tmp = puzzle->permutation[puzzle->position];
- puzzle->permutation[puzzle->position] = puzzle->permutation[next];
- puzzle->permutation[next] = tmp;
- puzzle->position = next;
-}
-
-typedef enum
-{
- DIR_UP,
- DIR_DOWN,
- DIR_LEFT,
- DIR_RIGHT
-} GstPuzzleDirection;
-
-static void
-gst_puzzle_move (GstPuzzle * puzzle, GstPuzzleDirection dir)
-{
- guint next = puzzle->tiles;
-
- switch (dir) {
- case DIR_UP:
- if (puzzle->position >= puzzle->columns)
- next = puzzle->position - puzzle->columns;
- break;
- case DIR_DOWN:
- if (puzzle->tiles - puzzle->position > puzzle->columns)
- next = puzzle->position + puzzle->columns;
- break;
- case DIR_LEFT:
- if ((puzzle->position % puzzle->columns) > 0)
- next = puzzle->position - 1;
- break;
- case DIR_RIGHT:
- if ((puzzle->position % puzzle->columns) < puzzle->columns - 1)
- next = puzzle->position + 1;
- break;
- default:
- g_assert_not_reached ();
- }
-
- if (next < puzzle->tiles) {
- /* the move was valid */
- gst_puzzle_swap (puzzle, next);
- }
-}
-
-static void
-gst_puzzle_shuffle (GstPuzzle * puzzle)
-{
- guint i;
-
- do {
- for (i = 0; i < 100 * puzzle->tiles; i++) {
- gst_puzzle_move (puzzle, g_random_int_range (0, 4));
- }
- } while (gst_puzzle_is_solved (puzzle));
- puzzle->solved = FALSE;
-}
-
-/* The nav event handler handles nav events, but still forwards them, so you
- * should be able to even use puzzle while navigating a dvd menu. We return
- * TRUE of course even when noone downstream handles the event.
- */
-static gboolean
-nav_event_handler (GstPad * pad, GstEvent * event)
-{
- GstPuzzle *puzzle;
- GstVideofilter *filter;
- const gchar *type;
- gboolean result = FALSE;
- gdouble x, y;
- gint xpos = 0, ypos = 0;
-
- puzzle = GST_PUZZLE (gst_pad_get_parent (pad));
- filter = GST_VIDEOFILTER (puzzle);
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NAVIGATION:
- /* translate the event */
- if (gst_structure_get_double (event->event_data.structure.structure,
- "pointer_x", &x) &&
- gst_structure_get_double (event->event_data.structure.structure,
- "pointer_y", &y)) {
- gint width, height;
-
- width = gst_videofilter_get_input_width (filter);
- height = gst_videofilter_get_input_height (filter);
- width = (width / puzzle->columns) & ~3;
- height = (height / puzzle->rows) & ~3;
- xpos = (int) x / width;
- ypos = (int) y / height;
- if (xpos >= 0 && xpos < puzzle->columns && ypos >= 0
- && ypos < puzzle->rows) {
- GstEvent *copy;
- guint lookup;
-
- lookup = puzzle->permutation[ypos * puzzle->columns + xpos];
- GST_DEBUG_OBJECT (puzzle, "translated %dx%d (%gx%g) to %dx%d (%gx%g)",
- xpos, ypos, x, y,
- lookup % puzzle->columns, lookup / puzzle->columns,
- x + ((gint) (lookup % puzzle->columns) - xpos) * width,
- y + ((gint) (lookup / puzzle->columns) - ypos) * height);
- x += ((gint) (lookup % puzzle->columns) - xpos) * width;
- y += ((gint) (lookup / puzzle->columns) - ypos) * height;
- copy = gst_event_copy (event);
- gst_structure_set (copy->event_data.structure.structure,
- "pointer_x", G_TYPE_DOUBLE, x,
- "pointer_y", G_TYPE_DOUBLE, y, NULL);
- gst_event_unref (event);
- event = copy;
- }
- }
- /* handle the event. NOTE: it has already been translated! */
- type = gst_structure_get_string (event->event_data.structure.structure,
- "event");
- if (g_str_equal (type, "key-press")) {
- const gchar *key =
- gst_structure_get_string (event->event_data.structure.structure,
- "key");
-
- if (g_str_equal (key, "space")) {
- if (gst_puzzle_is_solved (puzzle)) {
- gst_puzzle_shuffle (puzzle);
- } else {
- gst_puzzle_solve (puzzle);
- }
- } else {
- if (puzzle->solved)
- break;
- if (g_str_equal (key, "Left")) {
- gst_puzzle_move (puzzle, DIR_LEFT);
- } else if (g_str_equal (key, "Right")) {
- gst_puzzle_move (puzzle, DIR_RIGHT);
- } else if (g_str_equal (key, "Up")) {
- gst_puzzle_move (puzzle, DIR_UP);
- } else if (g_str_equal (key, "Down")) {
- gst_puzzle_move (puzzle, DIR_DOWN);
- }
- }
- puzzle->solved = gst_puzzle_is_solved (puzzle);
- } else if (g_str_equal (type, "mouse-button-press")) {
- gint button;
-
- if (gst_structure_get_int (event->event_data.structure.structure,
- "button", &button)) {
- if (button == 1) {
- if (xpos >= 0 && xpos < puzzle->columns && ypos >= 0
- && ypos < puzzle->rows && !puzzle->solved) {
- gst_puzzle_swap (puzzle, ypos * puzzle->columns + xpos);
- puzzle->solved = gst_puzzle_is_solved (puzzle);
- }
- } else if (button == 2) {
- if (puzzle->solved) {
- gst_puzzle_shuffle (puzzle);
- } else {
- gst_puzzle_solve (puzzle);
- }
- puzzle->solved = gst_puzzle_is_solved (puzzle);
- }
- }
- }
- /* FIXME: only return TRUE for events we handle? */
- result = TRUE;
- break;
- default:
- break;
- }
- return gst_pad_event_default (pad, event) || result;
-}
-
-static void
-gst_puzzle_create (GstPuzzle * puzzle)
-{
- guint i;
-
- puzzle->tiles = puzzle->rows * puzzle->columns;
- g_assert (puzzle->tiles);
- g_free (puzzle->permutation);
-
- puzzle->permutation = g_new (guint, puzzle->tiles);
- for (i = 0; i < puzzle->tiles; i++) {
- puzzle->permutation[i] = i;
- }
- puzzle->position = puzzle->tiles - 1;
- /* shuffle a bit */
- gst_puzzle_shuffle (puzzle);
-}
-
-static void
-gst_puzzle_init (GTypeInstance * instance, gpointer g_class)
-{
- GstVideofilter *videofilter;
- GstPuzzle *puzzle;
-
- videofilter = GST_VIDEOFILTER (instance);
- puzzle = GST_PUZZLE (instance);
- /* FIXME: this is evil */
- gst_pad_set_event_function (videofilter->srcpad, nav_event_handler);
-
- /* set this so we don't crash when initializing */
- puzzle->rows = 1;
- puzzle->columns = 1;
-}
-
-static void
-gst_puzzle_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstPuzzle *src;
-
- g_return_if_fail (GST_IS_PUZZLE (object));
- src = GST_PUZZLE (object);
-
- GST_DEBUG ("gst_puzzle_set_property");
- switch (prop_id) {
- case PROP_COLUMNS:
- src->columns = g_value_get_uint (value);
- gst_puzzle_create (src);
- break;
- case PROP_ROWS:
- src->rows = g_value_get_uint (value);
- gst_puzzle_create (src);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_puzzle_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstPuzzle *src;
-
- g_return_if_fail (GST_IS_PUZZLE (object));
- src = GST_PUZZLE (object);
-
- switch (prop_id) {
- case PROP_COLUMNS:
- g_value_set_uint (value, src->columns);
- break;
- case PROP_ROWS:
- g_value_set_uint (value, src->rows);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_puzzle_setup (GstVideofilter * videofilter)
-{
- GstPuzzle *puzzle;
-
- g_return_if_fail (GST_IS_PUZZLE (videofilter));
- puzzle = GST_PUZZLE (videofilter);
-
- puzzle->format = NULL;
-}
-
-static void
-draw_puzzle (GstVideofilter * videofilter, void *destp, void *srcp)
-{
- GstPuzzle *puzzle;
- int width, height;
- guint i;
- GstVideoImage dest, src;
-
- puzzle = GST_PUZZLE (videofilter);
- if (!puzzle->format) {
- puzzle->format =
- gst_video_format_find_by_structure (gst_caps_get_structure
- (gst_pad_get_negotiated_caps (videofilter->sinkpad), 0));
- }
- width = gst_videofilter_get_input_width (videofilter);
- height = gst_videofilter_get_input_height (videofilter);
- gst_video_image_setup (&dest, puzzle->format, destp, width, height);
- gst_video_image_setup (&src, puzzle->format, srcp, width, height);
- /* use multiples of 4 here to get around drawing problems with YUV colorspaces */
- width = (width / puzzle->columns) & ~3;
- height = (height / puzzle->rows) & ~3;
- if (width == 0 || height == 0) {
- gst_video_image_copy_area (&dest, 0, 0, &src, 0, 0,
- gst_videofilter_get_input_width (videofilter),
- gst_videofilter_get_input_height (videofilter));
- return;
- }
- if (width * puzzle->columns != gst_videofilter_get_input_width (videofilter)) {
- guint w =
- gst_videofilter_get_input_width (videofilter) - width * puzzle->columns;
-
- gst_video_image_copy_area (&dest, width * puzzle->columns, 0, &src,
- width * puzzle->columns, 0, w,
- gst_videofilter_get_input_height (videofilter));
- }
- if (height * puzzle->rows != gst_videofilter_get_input_height (videofilter)) {
- guint h =
- gst_videofilter_get_input_height (videofilter) - height * puzzle->rows;
-
- gst_video_image_copy_area (&dest, 0, height * puzzle->rows, &src, 0,
- height * puzzle->rows, gst_videofilter_get_input_width (videofilter),
- h);
- }
-
- for (i = 0; i < puzzle->tiles; i++) {
- if (!puzzle->solved && i == puzzle->position) {
- gst_video_image_draw_rectangle (&dest, width * (i % puzzle->columns),
- height * (i / puzzle->columns), width, height,
- &GST_VIDEO_COLOR_WHITE, TRUE);
- } else {
- gst_video_image_copy_area (&dest, width * (i % puzzle->columns),
- height * (i / puzzle->columns), &src,
- width * (puzzle->permutation[i] % puzzle->columns),
- height * (puzzle->permutation[i] / puzzle->columns), width, height);
- }
- }
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-#ifdef HAVE_LIBOIL
- oil_init ();
-#endif
-
- if (!gst_library_load ("gstvideofilter"))
- return FALSE;
-
- return gst_element_register (plugin, "puzzle", GST_RANK_NONE,
- GST_TYPE_PUZZLE);
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- games,
- "a collection of games to showcase features",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/games/gstvideoimage.c b/gst/games/gstvideoimage.c
deleted file mode 100644
index c32953b37..000000000
--- a/gst/games/gstvideoimage.c
+++ /dev/null
@@ -1,946 +0,0 @@
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- * <2004> Benjamin Otte <otte@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstvideoimage.h"
-#ifdef HAVE_LIBOIL
-#include <liboil/liboil.h>
-#endif
-
-#include <string.h>
-
-const GstVideoColor GST_VIDEO_COLOR_WHITE = { 255, 128, 128, 255, 255, 255 };
-const GstVideoColor GST_VIDEO_COLOR_YELLOW = { 226, 0, 155, 255, 255, 0 };
-const GstVideoColor GST_VIDEO_COLOR_CYAN = { 179, 170, 0, 0, 255, 255 };
-const GstVideoColor GST_VIDEO_COLOR_GREEN = { 150, 46, 21, 0, 255, 0 };
-const GstVideoColor GST_VIDEO_COLOR_MAGENTA = { 105, 212, 235, 255, 0, 255 };
-const GstVideoColor GST_VIDEO_COLOR_RED = { 76, 85, 255, 255, 0, 0 };
-const GstVideoColor GST_VIDEO_COLOR_BLUE = { 29, 255, 107, 0, 0, 255 };
-const GstVideoColor GST_VIDEO_COLOR_BLACK = { 16, 128, 128, 0, 0, 0 };
-const GstVideoColor GST_VIDEO_COLOR_NEG_I = { 16, 198, 21, 0, 0, 128 };
-const GstVideoColor GST_VIDEO_COLOR_POS_Q = { 16, 235, 198, 0, 128, 255 };
-const GstVideoColor GST_VIDEO_COLOR_SUPER_BLACK = { 0, 128, 128, 0, 0, 0 };
-const GstVideoColor GST_VIDEO_COLOR_DARK_GREY = { 32, 128, 128, 32, 32, 32 };
-
-const GstVideoFormat *
-gst_video_format_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-yuv") == 0) {
- char *s;
- int fourcc;
- guint32 format;
-
- ret = gst_structure_get_fourcc (structure, "format", &format);
- if (!ret)
- return NULL;
- for (i = 0; i < gst_video_format_count; i++) {
- s = gst_video_format_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 == format) {
- return gst_video_format_list + i;
- }
- }
- } else if (strcmp (media_type, "video/x-raw-rgb") == 0) {
- int red_mask;
- int green_mask;
- int blue_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);
-
- for (i = 0; i < gst_video_format_count; i++) {
- if (strcmp (gst_video_format_list[i].fourcc, "RGB ") == 0 &&
- gst_video_format_list[i].red_mask == red_mask &&
- gst_video_format_list[i].green_mask == green_mask &&
- gst_video_format_list[i].blue_mask == blue_mask &&
- gst_video_format_list[i].depth == depth &&
- gst_video_format_list[i].bitspp == bpp) {
- return gst_video_format_list + i;
-
- }
- }
- return NULL;
- }
-
- g_critical ("format not found for media type %s", media_type);
-
- return NULL;
-}
-
-const GstVideoFormat *
-gst_video_format_find_by_fourcc (int find_fourcc)
-{
- int i;
-
- for (i = 0; i < gst_video_format_count; i++) {
- char *s;
- int fourcc;
-
- s = gst_video_format_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 (!gst_video_format_list[i].ext_caps) {
- return gst_video_format_list + i;
- }
-
- return gst_video_format_list + i;
- }
- }
- return NULL;
-}
-
-const GstVideoFormat *
-gst_video_format_find_by_name (const char *name)
-{
- int i;
-
- for (i = 0; i < gst_video_format_count; i++) {
- if (strcmp (name, gst_video_format_list[i].name) == 0) {
- return gst_video_format_list + i;
- }
- }
- return NULL;
-}
-
-
-GstStructure *
-gst_video_format_get_structure (const GstVideoFormat * format)
-{
- unsigned int fourcc;
-
- g_return_val_if_fail (format, NULL);
-
- fourcc =
- GST_MAKE_FOURCC (format->fourcc[0], format->fourcc[1], format->fourcc[2],
- format->fourcc[3]);
-
- if (format->ext_caps) {
- int endianness;
-
- if (format->bitspp == 16) {
- endianness = G_BYTE_ORDER;
- } else {
- endianness = G_BIG_ENDIAN;
- }
- return 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);
- } else {
- return gst_structure_new ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, fourcc, NULL);
- }
-}
-
-/* returns the size in bytes for one video frame of the given dimensions
- * given the fourcc in GstVideotestsrc */
-guint
-gst_video_format_get_size (const GstVideoFormat * format, guint w, guint h)
-{
- GstVideoImage p = { 0 };
-
- g_return_val_if_fail (format != NULL, 0);
- g_return_val_if_fail (w > 0, 0);
- g_return_val_if_fail (h > 0, 0);
-
- gst_video_image_setup (&p, format, NULL, w, h);
-
- return (unsigned long) p.endptr;
-}
-
-void
-gst_video_image_setup (GstVideoImage * image, const GstVideoFormat * format,
- guint8 * data, guint w, guint h)
-{
- g_return_if_fail (image != NULL);
- g_return_if_fail (format != NULL);
- g_return_if_fail (w > 0);
- g_return_if_fail (h > 0);
-
- image->width = w;
- image->height = h;
- image->format = format;
- format->paint_setup (image, data);
-}
-
-void
-gst_video_image_paint_hline (GstVideoImage * image, gint x, gint y, gint w,
- const GstVideoColor * c)
-{
- g_return_if_fail (image != NULL);
- g_return_if_fail (c != NULL);
- g_return_if_fail (w > 0);
-
- /* check coords */
- if (y < 0 || y >= image->height)
- return;
- if (x < 0) {
- if (x + w < 0)
- return;
- w += x;
- x = 0;
- }
- if (x >= image->width)
- return;
- if (x + w > image->width) {
- w = image->width - x;
- }
- image->format->paint_hline (image, x, y, w, c);
-}
-
-void
-gst_video_image_draw_rectangle (GstVideoImage * image, gint x, gint y,
- gint w, gint h, const GstVideoColor * c, gboolean filled)
-{
- gint i;
-
- g_return_if_fail (image != NULL);
- g_return_if_fail (c != NULL);
- g_return_if_fail (w > 0);
- g_return_if_fail (h > 0);
-
- /* check coords */
- if (x < 0) {
- if (x + w < 0)
- return;
- w += x;
- x = 0;
- }
- if (x >= image->width)
- return;
- if (x + w > image->width) {
- w = image->width - x;
- }
- if (y < 0) {
- if (y + h < 0)
- return;
- h += y;
- y = 0;
- }
- if (y >= image->height)
- return;
- if (y + h > image->height) {
- y = image->height - y;
- }
-
- if (filled) {
- for (i = 0; i < h; i++) {
- image->format->paint_hline (image, x, y + i, w, c);
- }
- } else {
- h--;
- image->format->paint_hline (image, x, y, w, c);
- for (i = 1; i < h; i++) {
- image->format->paint_hline (image, x, y + i, 1, c);
- image->format->paint_hline (image, x + w - 1, y + i, 1, c);
- }
- image->format->paint_hline (image, x, y + h, w, c);
- }
-}
-
-void
-gst_video_image_copy_hline (GstVideoImage * dest, gint xdest, gint ydest,
- GstVideoImage * src, gint xsrc, gint ysrc, gint w)
-{
- g_return_if_fail (dest != NULL);
- g_return_if_fail (src != NULL);
- g_return_if_fail (dest->format == src->format);
- g_return_if_fail (w > 0);
-
- /* check width coords */
- if (xdest >= dest->width)
- return;
- if (xsrc >= src->width)
- return;
- if (xdest < 0) {
- xsrc -= xdest;
- w += xdest;
- xdest = 0;
- }
- if (xsrc < 0) {
- xdest -= xsrc;
- w += xsrc;
- xsrc = 0;
- }
- if (w <= 0)
- return;
- if (xdest + w > dest->width)
- w = dest->width - xdest;
- if (xsrc + w > src->width)
- w = src->width - xsrc;
- /* check height coords */
- if (ysrc >= src->height || ysrc < 0)
- return;
- if (ydest >= dest->height || ydest < 0)
- return;
-
- dest->format->copy_hline (dest, xdest, ydest, src, xsrc, ysrc, w);
-}
-
-void
-gst_video_image_copy_area (GstVideoImage * dest, gint xdest, gint ydest,
- GstVideoImage * src, gint xsrc, gint ysrc, gint w, gint h)
-{
- gint i;
-
- g_return_if_fail (dest != NULL);
- g_return_if_fail (src != NULL);
- g_return_if_fail (dest->format == src->format);
- g_return_if_fail (w > 0);
- g_return_if_fail (h > 0);
-
- /* check width coords */
- if (xdest >= dest->width)
- return;
- if (xsrc >= src->width)
- return;
- if (xdest < 0) {
- xsrc -= xdest;
- w += xdest;
- xdest = 0;
- }
- if (xsrc < 0) {
- xdest -= xsrc;
- w += xsrc;
- xsrc = 0;
- }
- if (w <= 0)
- return;
- if (xdest + w > dest->width)
- w = dest->width - xdest;
- if (xsrc + w > src->width)
- w = src->width - xsrc;
- /* check height coords */
- if (ydest >= dest->height)
- return;
- if (ysrc >= src->height)
- return;
- if (ydest < 0) {
- ysrc -= ydest;
- h += ydest;
- ydest = 0;
- }
- if (ysrc < 0) {
- ydest -= ysrc;
- h += ysrc;
- ysrc = 0;
- }
- if (h <= 0)
- return;
- if (ydest + h > dest->height)
- h = dest->height - ydest;
- if (ysrc + h > src->height)
- h = src->height - ysrc;
-
- for (i = 0; i < h; i++) {
- dest->format->copy_hline (dest, xdest, ydest + i, src, xsrc, ysrc + i, w);
- }
-}
-
-
-#define ROUND_UP_2(x) (((x)+1)&~1)
-#define ROUND_UP_4(x) (((x)+3)&~3)
-#define ROUND_UP_8(x) (((x)+7)&~7)
-
-static void
-paint_setup_I420 (GstVideoImage * p, char *dest)
-{
- p->yp = dest;
- p->ystride = ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * ROUND_UP_2 (p->height);
- p->ustride = ROUND_UP_8 (p->width) / 2;
- p->vp = p->up + p->ustride * ROUND_UP_2 (p->height) / 2;
- p->vstride = ROUND_UP_8 (p->ystride) / 2;
- p->endptr = p->vp + p->vstride * ROUND_UP_2 (p->height) / 2;
-}
-
-static void
-paint_hline_I420 (GstVideoImage * p, int x, int y, int w,
- const GstVideoColor * c)
-{
- int x1 = x / 2;
- int x2 = (x + w) / 2;
- int offset = y * p->ystride;
- int offset1 = (y / 2) * p->ustride;
-
- memset (p->yp + offset + x, c->Y, w);
- memset (p->up + offset1 + x1, c->U, x2 - x1);
- memset (p->vp + offset1 + x1, c->V, x2 - x1);
-}
-
-static void
-copy_hline_I420 (GstVideoImage * dest, int xdest, int ydest,
- GstVideoImage * src, int xsrc, int ysrc, int w)
-{
- int destoffset = ydest * dest->ystride;
- int destoffset1 = (ydest / 2) * dest->ustride;
- int srcoffset = ysrc * src->ystride;
- int srcoffset1 = (ysrc / 2) * src->ustride;
-
- memcpy (dest->yp + destoffset + xdest, src->yp + srcoffset + xsrc, w);
- memcpy (dest->up + destoffset1 + xdest / 2, src->up + srcoffset1 + xsrc / 2,
- w / 2);
- memcpy (dest->vp + destoffset1 + xdest / 2, src->vp + srcoffset1 + xsrc / 2,
- w / 2);
-}
-
-static void
-paint_setup_YV12 (GstVideoImage * p, char *dest)
-{
- p->yp = dest;
- p->ystride = ROUND_UP_4 (p->width);
- p->vp = p->yp + p->ystride * ROUND_UP_2 (p->height);
- p->vstride = ROUND_UP_8 (p->ystride) / 2;
- p->up = p->vp + p->vstride * ROUND_UP_2 (p->height) / 2;
- p->ustride = ROUND_UP_8 (p->ystride) / 2;
- p->endptr = p->up + p->ustride * ROUND_UP_2 (p->height) / 2;
-}
-
-static void
-paint_setup_YUY2 (GstVideoImage * p, char *dest)
-{
- p->yp = dest;
- p->up = dest + 1;
- p->vp = dest + 3;
- p->ystride = ROUND_UP_2 (p->width) * 2;
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_UYVY (GstVideoImage * p, char *dest)
-{
- p->yp = dest + 1;
- p->up = dest;
- p->vp = dest + 2;
- p->ystride = ROUND_UP_2 (p->width) * 2;
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_YVYU (GstVideoImage * p, char *dest)
-{
- p->yp = dest;
- p->up = dest + 3;
- p->vp = dest + 1;
- p->ystride = ROUND_UP_2 (p->width * 2);
- p->endptr = dest + p->ystride * p->height;
-}
-
-#ifndef HAVE_LIBOIL
-void
-oil_splat_u8 (guint8 * dest, int dstr, guint8 val, int n)
-{
- int i;
-
- for (i = 0; i < n; i++) {
- *dest = val;
- dest += dstr;
- }
-}
-#endif
-
-static void
-paint_hline_YUY2 (GstVideoImage * p, int x, int y, int w,
- const GstVideoColor * c)
-{
- int x1 = x / 2;
- int x2 = (x + w) / 2;
- int offset = y * p->ystride;
-
- oil_splat_u8 (p->yp + offset + x * 2, 2, c->Y, w);
- oil_splat_u8 (p->up + offset + x1 * 4, 4, c->U, x2 - x1);
- oil_splat_u8 (p->vp + offset + x1 * 4, 4, c->V, x2 - x1);
-}
-
-static void
-copy_hline_YUY2 (GstVideoImage * dest, int xdest, int ydest,
- GstVideoImage * src, int xsrc, int ysrc, int w)
-{
- int destoffset = ydest * dest->ystride;
- int srcoffset = ysrc * src->ystride;
-
- memcpy (dest->yp + destoffset + xdest * 2, src->yp + srcoffset + xsrc * 2,
- w * 2);
-}
-
-static void
-paint_setup_IYU2 (GstVideoImage * p, char *dest)
-{
- /* untested */
- p->yp = dest + 1;
- p->up = dest + 0;
- p->vp = dest + 2;
- p->ystride = ROUND_UP_4 (p->width * 3);
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_hline_IYU2 (GstVideoImage * p, int x, int y, int w,
- const GstVideoColor * c)
-{
- int offset;
-
- offset = y * p->ystride;
- oil_splat_u8 (p->yp + offset + x * 3, 3, c->Y, w);
- oil_splat_u8 (p->up + offset + x * 3, 3, c->U, w);
- oil_splat_u8 (p->vp + offset + x * 3, 3, c->V, w);
-}
-
-static void
-copy_hline_IYU2 (GstVideoImage * dest, int xdest, int ydest,
- GstVideoImage * src, int xsrc, int ysrc, int w)
-{
- int destoffset = ydest * dest->ystride;
- int srcoffset = ydest * src->ystride;
-
- memcpy (dest->yp + destoffset + xdest * 3, src->yp + srcoffset + xsrc * 3,
- w * 3);
-}
-
-static void
-paint_setup_Y41B (GstVideoImage * p, char *dest)
-{
- p->yp = dest;
- p->ystride = ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * p->height;
- p->ustride = ROUND_UP_8 (p->width) / 4;
- p->vp = p->up + p->ustride * p->height;
- p->vstride = ROUND_UP_8 (p->width) / 4;
- p->endptr = p->vp + p->vstride * p->height;
-}
-
-static void
-paint_hline_Y41B (GstVideoImage * p, int x, int y, int w,
- const GstVideoColor * c)
-{
- int x1 = x / 4;
- int x2 = (x + w) / 4;
- int offset = y * p->ystride;
- int offset1 = y * p->ustride;
-
- memset (p->yp + offset + x, c->Y, w);
- memset (p->up + offset1 + x1, c->U, x2 - x1);
- memset (p->vp + offset1 + x1, c->V, x2 - x1);
-}
-
-static void
-copy_hline_Y41B (GstVideoImage * dest, int xdest, int ydest,
- GstVideoImage * src, int xsrc, int ysrc, int w)
-{
- int destoffset = ydest * dest->ystride;
- int destoffset1 = ydest * dest->ustride;
- int srcoffset = ysrc * src->ystride;
- int srcoffset1 = ysrc * src->ustride;
-
- memcpy (dest->yp + destoffset + xdest, src->yp + srcoffset + xsrc, w);
- memcpy (dest->up + destoffset1 + xdest / 4, src->up + srcoffset1 + xsrc / 4,
- w / 4);
- memcpy (dest->vp + destoffset1 + xdest / 4, src->vp + srcoffset1 + xsrc / 4,
- w / 4);
-}
-
-static void
-paint_setup_Y42B (GstVideoImage * p, char *dest)
-{
- p->yp = dest;
- p->ystride = ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * p->height;
- p->ustride = ROUND_UP_8 (p->width) / 2;
- p->vp = p->up + p->ustride * p->height;
- p->vstride = ROUND_UP_8 (p->width) / 2;
- p->endptr = p->vp + p->vstride * p->height;
-}
-
-static void
-paint_hline_Y42B (GstVideoImage * p, int x, int y, int w,
- const GstVideoColor * c)
-{
- int x1 = x / 2;
- int x2 = (x + w) / 2;
- int offset = y * p->ystride;
- int offset1 = y * p->ustride;
-
- memset (p->yp + offset + x, c->Y, w);
- memset (p->up + offset1 + x1, c->U, x2 - x1);
- memset (p->vp + offset1 + x1, c->V, x2 - x1);
-}
-
-static void
-copy_hline_Y42B (GstVideoImage * dest, int xdest, int ydest,
- GstVideoImage * src, int xsrc, int ysrc, int w)
-{
- int destoffset = ydest * dest->ystride;
- int destoffset1 = ydest * dest->ustride;
- int srcoffset = ysrc * src->ystride;
- int srcoffset1 = ysrc * src->ustride;
-
- memcpy (dest->yp + destoffset + xdest, src->yp + srcoffset + xsrc, w);
- memcpy (dest->up + destoffset1 + xdest / 2, src->up + srcoffset1 + xsrc / 2,
- w / 2);
- memcpy (dest->vp + destoffset1 + xdest / 2, src->vp + srcoffset1 + xsrc / 2,
- w / 2);
-}
-
-static void
-paint_setup_Y800 (GstVideoImage * p, char *dest)
-{
- /* untested */
- p->yp = dest;
- p->ystride = ROUND_UP_4 (p->width);
- p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_hline_Y800 (GstVideoImage * p, int x, int y, int w,
- const GstVideoColor * c)
-{
- int offset = y * p->ystride;
-
- memset (p->yp + offset + x, c->Y, w);
-}
-
-static void
-copy_hline_Y800 (GstVideoImage * dest, int xdest, int ydest,
- GstVideoImage * src, int xsrc, int ysrc, int w)
-{
- int destoffset = ydest * dest->ystride;
- int srcoffset = ysrc * src->ystride;
-
- memcpy (dest->yp + destoffset + xdest, src->yp + srcoffset + xsrc, w);
-}
-
-static void
-paint_setup_YVU9 (GstVideoImage * p, char *dest)
-{
- int h = ROUND_UP_4 (p->height);
-
- p->yp = dest;
- p->ystride = ROUND_UP_4 (p->width);
- p->vp = p->yp + p->ystride * ROUND_UP_4 (p->height);
- p->vstride = ROUND_UP_4 (p->ystride / 4);
- p->up = p->vp + p->vstride * ROUND_UP_4 (h / 4);
- p->ustride = ROUND_UP_4 (p->ystride / 4);
- p->endptr = p->up + p->ustride * ROUND_UP_4 (h / 4);
-}
-
-static void
-paint_setup_YUV9 (GstVideoImage * p, char *dest)
-{
- /* untested */
- int h = ROUND_UP_4 (p->height);
-
- p->yp = dest;
- p->ystride = ROUND_UP_4 (p->width);
- p->up = p->yp + p->ystride * h;
- p->ustride = ROUND_UP_4 (p->ystride / 4);
- p->vp = p->up + p->ustride * ROUND_UP_4 (h / 4);
- p->vstride = ROUND_UP_4 (p->ystride / 4);
- p->endptr = p->vp + p->vstride * ROUND_UP_4 (h / 4);
-}
-
-static void
-paint_hline_YUV9 (GstVideoImage * p, int x, int y, int w,
- const GstVideoColor * c)
-{
- int x1 = x / 4;
- int x2 = (x + w) / 4;
- int offset = y * p->ystride;
- int offset1 = (y / 4) * p->ustride;
-
- memset (p->yp + offset + x, c->Y, w);
- memset (p->up + offset1 + x1, c->U, x2 - x1);
- memset (p->vp + offset1 + x1, c->V, x2 - x1);
-}
-
-static void
-copy_hline_YUV9 (GstVideoImage * dest, int xdest, int ydest,
- GstVideoImage * src, int xsrc, int ysrc, int w)
-{
- int destoffset = ydest * dest->ystride;
- int destoffset1 = ydest * dest->ustride;
- int srcoffset = ysrc * src->ystride;
- int srcoffset1 = ysrc * src->ustride;
-
- memcpy (dest->yp + destoffset + xdest, src->yp + srcoffset + xsrc, w);
- memcpy (dest->up + destoffset1 + xdest / 4, src->up + srcoffset1 + xsrc / 4,
- w / 4);
- memcpy (dest->vp + destoffset1 + xdest / 4, src->vp + srcoffset1 + xsrc / 4,
- w / 4);
-}
-
-static void
-paint_setup_xRGB8888 (GstVideoImage * p, 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 (GstVideoImage * p, 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 (GstVideoImage * p, 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 (GstVideoImage * p, 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 (GstVideoImage * p, char *dest)
-{
- p->yp = dest + 0;
- p->up = dest + 1;
- p->vp = dest + 2;
- p->ystride = ROUND_UP_4 (p->width * 3);
- p->endptr = p->dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_BGR888 (GstVideoImage * p, char *dest)
-{
- p->yp = dest + 2;
- p->up = dest + 1;
- p->vp = dest + 0;
- p->ystride = ROUND_UP_4 (p->width * 3);
- p->endptr = p->dest + p->ystride * p->height;
-}
-
-static void
-paint_hline_str4 (GstVideoImage * p, int x, int y, int w,
- const GstVideoColor * c)
-{
- int offset = y * p->ystride;
-
- oil_splat_u8 (p->yp + offset + x * 4, 4, c->R, w);
- oil_splat_u8 (p->up + offset + x * 4, 4, c->G, w);
- oil_splat_u8 (p->vp + offset + x * 4, 4, c->B, w);
-}
-
-static void
-copy_hline_str4 (GstVideoImage * dest, int xdest, int ydest,
- GstVideoImage * src, int xsrc, int ysrc, int w)
-{
- int destoffset = ydest * dest->ystride;
- int srcoffset = ysrc * src->ystride;
-
- memcpy (dest->yp + destoffset + xdest * 4, src->yp + srcoffset + xsrc * 4,
- w * 4);
-}
-
-static void
-paint_hline_str3 (GstVideoImage * p, int x, int y, int w,
- const GstVideoColor * c)
-{
- int offset = y * p->ystride;
-
- oil_splat_u8 (p->yp + offset + x * 3, 3, c->R, w);
- oil_splat_u8 (p->up + offset + x * 3, 3, c->G, w);
- oil_splat_u8 (p->vp + offset + x * 3, 3, c->B, w);
-}
-
-static void
-copy_hline_str3 (GstVideoImage * dest, int xdest, int ydest,
- GstVideoImage * src, int xsrc, int ysrc, int w)
-{
- int destoffset = ydest * dest->ystride;
- int srcoffset = ysrc * src->ystride;
-
- memcpy (dest->yp + destoffset + xdest * 3, src->yp + srcoffset + xsrc * 3,
- w * 3);
-}
-
-static void
-paint_setup_RGB565 (GstVideoImage * p, char *dest)
-{
- p->yp = dest;
- p->ystride = ROUND_UP_4 (p->width * 2);
- p->endptr = p->dest + p->ystride * p->height;
-}
-
-static void
-paint_hline_RGB565 (GstVideoImage * p, int x, int y, int w,
- const GstVideoColor * c)
-{
- int offset = y * p->ystride;
- unsigned int a, b;
-
- a = (c->R & 0xf8) | (c->G >> 5);
- b = ((c->G << 3) & 0xe0) | (c->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
-copy_hline_str2 (GstVideoImage * dest, int xdest, int ydest,
- GstVideoImage * src, int xsrc, int ysrc, int w)
-{
- int destoffset = ydest * dest->ystride;
- int srcoffset = ysrc * src->ystride;
-
- memcpy (dest->yp + destoffset + xdest * 2, src->yp + srcoffset + xsrc * 2,
- w * 2);
-}
-
-static void
-paint_setup_xRGB1555 (GstVideoImage * p, char *dest)
-{
- p->yp = dest;
- p->ystride = ROUND_UP_4 (p->width * 2);
- p->endptr = p->dest + p->ystride * p->height;
-}
-
-static void
-paint_hline_xRGB1555 (GstVideoImage * p, int x, int y, int w,
- const GstVideoColor * c)
-{
- int offset = y * p->ystride;
- unsigned int a, b;
-
- a = ((c->R >> 1) & 0x7c) | (c->G >> 6);
- b = ((c->G << 2) & 0xe0) | (c->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
-}
-
-const GstVideoFormat gst_video_format_list[] = {
-/* packed */
- {"YUY2", "YUY2", 16, paint_setup_YUY2, paint_hline_YUY2, copy_hline_YUY2},
- {"UYVY", "UYVY", 16, paint_setup_UYVY, paint_hline_YUY2, copy_hline_YUY2},
- {"Y422", "Y422", 16, paint_setup_UYVY, paint_hline_YUY2, copy_hline_YUY2},
- {"UYNV", "UYNV", 16, paint_setup_UYVY, paint_hline_YUY2, copy_hline_YUY2}, /* FIXME: UYNV? */
- {"YVYU", "YVYU", 16, paint_setup_YVYU, paint_hline_YUY2, copy_hline_YUY2},
-
- /* interlaced */
- /*{ "IUYV", "IUY2", 16, paint_setup_YVYU, paint_hline_YUY2 }, */
-
- /* inverted */
- /*{ "cyuv", "cyuv", 16, paint_setup_YVYU, paint_hline_YUY2 }, */
-
- /*{ "Y41P", "Y41P", 12, paint_setup_YVYU, paint_hline_YUY2 }, */
-
- /* interlaced */
- /*{ "IY41", "IY41", 12, paint_setup_YVYU, paint_hline_YUY2 }, */
-
- /*{ "Y211", "Y211", 8, paint_setup_YVYU, paint_hline_YUY2 }, */
-
- /*{ "Y41T", "Y41T", 12, paint_setup_YVYU, paint_hline_YUY2 }, */
- /*{ "Y42P", "Y42P", 16, paint_setup_YVYU, paint_hline_YUY2 }, */
- /*{ "CLJR", "CLJR", 8, paint_setup_YVYU, paint_hline_YUY2 }, */
- /*{ "IYU1", "IYU1", 12, paint_setup_YVYU, paint_hline_YUY2 }, */
- {"IYU2", "IYU2", 24, paint_setup_IYU2, paint_hline_IYU2, copy_hline_IYU2},
-
-/* planar */
- /* YVU9 */
- {"YVU9", "YVU9", 9, paint_setup_YVU9, paint_hline_YUV9, copy_hline_YUV9},
- /* YUV9 */
- {"YUV9", "YUV9", 9, paint_setup_YUV9, paint_hline_YUV9, copy_hline_YUV9},
- /* IF09 */
- /* YV12 */
- {"YV12", "YV12", 12, paint_setup_YV12, paint_hline_I420, copy_hline_I420},
- /* I420 */
- {"I420", "I420", 12, paint_setup_I420, paint_hline_I420, copy_hline_I420},
- /* NV12 */
- /* NV21 */
- /* CLPL */
- /* Y41B */
- {"Y41B", "Y41B", 12, paint_setup_Y41B, paint_hline_Y41B, copy_hline_Y41B},
- /* Y42B */
- {"Y42B", "Y42B", 16, paint_setup_Y42B, paint_hline_Y42B, copy_hline_Y42B},
- /* Y800 grayscale */
- {"Y800", "Y800", 8, paint_setup_Y800, paint_hline_Y800, copy_hline_Y800},
-
- {"RGB ", "xRGB8888", 32, paint_setup_xRGB8888, paint_hline_str4,
- copy_hline_str4,
- 1, 24, 0x00ff0000, 0x0000ff00, 0x000000ff},
- {"RGB ", "xBGR8888", 32, paint_setup_xBGR8888, paint_hline_str4,
- copy_hline_str4,
- 1, 24, 0x000000ff, 0x0000ff00, 0x00ff0000},
- {"RGB ", "RGBx8888", 32, paint_setup_RGBx8888, paint_hline_str4,
- copy_hline_str4,
- 1, 24, 0xff000000, 0x00ff0000, 0x0000ff00},
- {"RGB ", "BGRx8888", 32, paint_setup_BGRx8888, paint_hline_str4,
- copy_hline_str4,
- 1, 24, 0x0000ff00, 0x00ff0000, 0xff000000},
- {"RGB ", "RGB888", 24, paint_setup_RGB888, paint_hline_str3, copy_hline_str3,
- 1, 24, 0x00ff0000, 0x0000ff00, 0x000000ff},
- {"RGB ", "BGR888", 24, paint_setup_BGR888, paint_hline_str3, copy_hline_str3,
- 1, 24, 0x000000ff, 0x0000ff00, 0x00ff0000},
- {"RGB ", "RGB565", 16, paint_setup_RGB565, paint_hline_RGB565,
- copy_hline_str2,
- 1, 16, 0x0000f800, 0x000007e0, 0x0000001f},
- {"RGB ", "xRGB1555", 16, paint_setup_xRGB1555, paint_hline_xRGB1555,
- copy_hline_str2,
- 1, 15, 0x00007c00, 0x000003e0, 0x0000001f},
-};
-const guint gst_video_format_count = G_N_ELEMENTS (gst_video_format_list);
diff --git a/gst/games/gstvideoimage.h b/gst/games/gstvideoimage.h
deleted file mode 100644
index 2181e024d..000000000
--- a/gst/games/gstvideoimage.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* GStreamer
- * Copyright (C) <2003> David A. Schleef <ds@schleef.org>
- * <2004> Benjamin Otte <otte@gnome.org
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <gst/gst.h>
-
-#ifndef __GST_VIDEO_IMAGE_H__
-#define __GST_VIDEO_IMAGE_H__
-
-G_BEGIN_DECLS
-
-
-typedef struct _GstVideoColor GstVideoColor;
-typedef struct _GstVideoImage GstVideoImage;
-typedef struct _GstVideoFormat GstVideoFormat;
-
-struct _GstVideoColor {
- int Y, U, V;
- int R, G, B;
-};
-extern const GstVideoColor GST_VIDEO_COLOR_WHITE;
-extern const GstVideoColor GST_VIDEO_COLOR_YELLOW;
-extern const GstVideoColor GST_VIDEO_COLOR_CYAN;
-extern const GstVideoColor GST_VIDEO_COLOR_GREEN;
-extern const GstVideoColor GST_VIDEO_COLOR_MAGENTA;
-extern const GstVideoColor GST_VIDEO_COLOR_RED;
-extern const GstVideoColor GST_VIDEO_COLOR_BLUE;
-extern const GstVideoColor GST_VIDEO_COLOR_BLACK;
-extern const GstVideoColor GST_VIDEO_COLOR_NEG_I;
-extern const GstVideoColor GST_VIDEO_COLOR_POS_Q;
-extern const GstVideoColor GST_VIDEO_COLOR_SUPER_BLACK;
-extern const GstVideoColor GST_VIDEO_COLOR_DARK_GREY;
-
-
-struct _GstVideoImage
-{
- guint8 * dest; /* pointer to first byte of video data */
- guint8 * yp, *up, *vp; /* pointers to first byte of each component
- * for both packed/planar YUV and RGB */
- guint8 * endptr; /* pointer to byte beyond last video data */
- guint ystride;
- guint ustride;
- guint vstride;
- guint width;
- guint height;
- const GstVideoFormat * format;
-};
-
-struct _GstVideoFormat
-{
- char * fourcc;
- char * name;
- int bitspp;
- void (* paint_setup) (GstVideoImage * p, char *dest);
- void (* paint_hline) (GstVideoImage * p, int x, int y, int w, const GstVideoColor *c);
- void (* copy_hline) (GstVideoImage * dest, int destx, int desty,
- GstVideoImage * src, int srcx, int srcy, int w);
- int ext_caps;
- int depth;
- guint red_mask;
- guint green_mask;
- guint blue_mask;
-};
-
-const GstVideoFormat * gst_video_format_find_by_fourcc (int find_fourcc);
-const GstVideoFormat * gst_video_format_find_by_name (const char *name);
-const GstVideoFormat * gst_video_format_find_by_structure (const GstStructure *structure);
-GstStructure * gst_video_format_get_structure (const GstVideoFormat *format);
-guint gst_video_format_get_size (const GstVideoFormat *format,
- guint w, guint h);
-
-extern const GstVideoFormat gst_video_format_list[];
-extern const guint gst_video_format_count;
-
-void gst_video_image_setup (GstVideoImage *image,
- const GstVideoFormat *format,
- guint8 *data, guint w, guint h);
-
-/* drawing operations */
-void gst_video_image_draw_hline (GstVideoImage *image,
- gint x, gint y, gint w,
- const GstVideoColor *c);
-void gst_video_image_draw_rectangle (GstVideoImage *image,
- gint x, gint y, gint w, gint h,
- const GstVideoColor *c, gboolean filled);
-void gst_video_image_copy_hline (GstVideoImage *dest,
- gint xdest, gint ydest,
- GstVideoImage *src,
- gint xsrc, gint ysrc, gint w);
-void gst_video_image_copy_area (GstVideoImage *dest,
- gint xdest, gint ydest,
- GstVideoImage *src,
- gint xsrc, gint ysrc,
- gint w, gint h);
-
-G_END_DECLS
-
-#endif /* __GST_VIDEO_IMAGE_H__ */
diff --git a/gst/games/meson.build b/gst/games/meson.build
deleted file mode 100644
index e3509278e..000000000
--- a/gst/games/meson.build
+++ /dev/null
@@ -1,13 +0,0 @@
-games_sources = [
- 'gstvideoimage.c',
- 'gstpuzzle.c',
-]
-
-gstpuzzle = library('gstpuzzle',
- games_sources,
- c_args : gst_plugins_bad_args,
- include_directories : [configinc],
- dependencies : [gstbase_dep],
- install : true,
- install_dir : plugins_install_dir,
-)
diff --git a/gst/hdvparse/Makefile.am b/gst/hdvparse/Makefile.am
deleted file mode 100644
index ea9368aa6..000000000
--- a/gst/hdvparse/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-plugin_LTLIBRARIES = libgsthdvparse.la
-
-libgsthdvparse_la_SOURCES = \
- gsthdvparse.c
-
-noinst_HEADERS = \
- gsthdvparse.h
-
-libgsthdvparse_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS)
-libgsthdvparse_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(LIBM)
-libgsthdvparse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgsthdvparse_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
diff --git a/gst/hdvparse/gsthdvparse.c b/gst/hdvparse/gsthdvparse.c
deleted file mode 100644
index b899e95b8..000000000
--- a/gst/hdvparse/gsthdvparse.c
+++ /dev/null
@@ -1,888 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2009 Edward Hervey <bilboed@bilboed.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/**
- * SECTION:element-HDVParse
- *
- * <refsect2>
- * <title>Example launch line</title>
- * <para>
- * <programlisting>
- * gst-launch -v -m filesrc ! mpegtsdemux ! hdvparse ! fakesink silent=TRUE
- * </programlisting>
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <math.h>
-
-#include <gst/gst.h>
-#include <gst/base/gstbasetransform.h>
-
-#include "gsthdvparse.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_hdvparse_debug);
-#define GST_CAT_DEFAULT gst_hdvparse_debug
-
-/* Filter signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-enum
-{
- PROP_0,
-};
-
-
-
-#define CLOCK_BASE 9LL
-#define CLOCK_FREQ (CLOCK_BASE * 10000)
-
-#define MPEGTIME_TO_GSTTIME(time) (gst_util_uint64_scale ((time), \
- GST_MSECOND/10, CLOCK_BASE))
-#define GSTTIME_TO_MPEGTIME(time) (gst_util_uint64_scale ((time), \
- CLOCK_BASE, GST_MSECOND/10))
-
-/* If set to 1, then extra validation will be applied to check
- * for complete spec compliance wherever applicable. */
-#define VALIDATE 0
-
-/* Binary-coded decimal reading macro */
-#define BCD(c) ( ((((c) >> 4) & 0x0f) * 10) + ((c) & 0x0f) )
-/* Same as before, but with a mask */
-#define BCD_M(c, mask) (BCD ((c) & (mask)))
-
-/* the capabilities of the inputs and outputs.
- *
- * describe the real formats here.
- */
-static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("hdv/aux-v;hdv/aux-a")
- );
-
-static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS
- ("hdv/aux-v,parsed=(boolean)True;hdv/aux-a,parsed=(boolean)True")
- );
-
-/* debug category for fltering log messages
- *
- * exchange the string 'Template HDVParse' with your description
- */
-#define DEBUG_INIT(bla) \
- GST_DEBUG_CATEGORY_INIT (gst_hdvparse_debug, "hdvparse", 0, "HDV private stream parser");
-
-GST_BOILERPLATE_FULL (GstHDVParse, gst_hdvparse, GstBaseTransform,
- GST_TYPE_BASE_TRANSFORM, DEBUG_INIT);
-
-static GstFlowReturn gst_hdvparse_transform_ip (GstBaseTransform * base,
- GstBuffer * outbuf);
-static GstCaps *gst_hdvparse_transform_caps (GstBaseTransform * trans,
- GstPadDirection dir, GstCaps * incaps);
-
-/* GObject vmethod implementations */
-
-static void
-gst_hdvparse_base_init (gpointer klass)
-{
-
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_static_pad_template (element_class, &src_template);
- gst_element_class_add_static_pad_template (element_class, &sink_template);
- gst_element_class_set_static_metadata (element_class, "HDVParser",
- "Data/Parser",
- "HDV private stream Parser", "Edward Hervey <bilboed@bilboed.com>");
-}
-
-/* initialize the HDVParse's class */
-static void
-gst_hdvparse_class_init (GstHDVParseClass * klass)
-{
- GST_BASE_TRANSFORM_CLASS (klass)->transform_ip =
- GST_DEBUG_FUNCPTR (gst_hdvparse_transform_ip);
- GST_BASE_TRANSFORM_CLASS (klass)->transform_caps =
- GST_DEBUG_FUNCPTR (gst_hdvparse_transform_caps);
-}
-
-/* initialize the new element
- * initialize instance structure
- */
-static void
-gst_hdvparse_init (GstHDVParse * filter, GstHDVParseClass * klass)
-{
- GstBaseTransform *transform = GST_BASE_TRANSFORM (filter);
-
- gst_base_transform_set_in_place (transform, TRUE);
- gst_base_transform_set_passthrough (transform, TRUE);
-}
-
-static GstCaps *
-gst_hdvparse_transform_caps (GstBaseTransform * trans, GstPadDirection dir,
- GstCaps * incaps)
-{
- GstCaps *res = NULL;
- GstStructure *st = gst_caps_get_structure (incaps, 0);
-
- GST_WARNING_OBJECT (trans, "dir:%d, incaps:%" GST_PTR_FORMAT, dir, incaps);
-
- if (dir == GST_PAD_SINK) {
- res = gst_caps_new_simple (gst_structure_get_name (st),
- "parsed", G_TYPE_BOOLEAN, TRUE, NULL);
- } else {
- res = gst_caps_new_simple (gst_structure_get_name (st), NULL);
- }
-
- return res;
-}
-
-
-static inline const gchar *
-sfr_to_framerate (guint8 sfr)
-{
- switch (sfr) {
- case 4:
- return "30000/1001";
- case 3:
- return "25/1";
- case 1:
- return "24000/1001";
- default:
- return "RESERVED";
- }
-}
-
-static GstFlowReturn
-parse_dv_multi_pack (GstHDVParse * filter, guint8 * data, guint64 size,
- GstStructure * st)
-{
- guint64 offs = 1;
-
- while (size / 5) {
- GST_LOG ("DV pack 0x%x", data[offs]);
- switch (data[offs]) {
- case 0x70:{
- guint8 irispos, ae, agc, wbmode, whitebal, focusmode, focuspos;
-
- irispos = data[offs + 1] & 0x3f;
- ae = data[offs + 2] >> 4;
- agc = data[offs + 2] & 0xf;
- wbmode = data[offs + 3] >> 5;
- whitebal = data[offs + 3] & 0x1f;
- focusmode = data[offs + 4] >> 7;
- focuspos = data[offs + 4] & 0x7f;
-
- GST_LOG (" Consumer Camera 1");
-
- GST_LOG (" Iris position %d (0x%x)", irispos, irispos);
- /* Iris position = 2 ^ (IP/8) (for 0 < IP < 0x3C) */
- if (irispos < 0x3c) {
- GST_LOG (" IRIS F%0.2f", powf (2.0, (((float) irispos) / 8.0)));
- gst_structure_set (st, "aperture-fnumber", G_TYPE_FLOAT,
- powf (2.0, (((float) irispos) / 8.0)), NULL);
- } else if (irispos == 0x3d) {
- GST_LOG (" IRIS < 1.0");
- } else if (irispos == 0x3e) {
- GST_LOG (" IRIS closed");
- }
-
- /* AE Mode:
- * 0 : Full automatic
- * 1 : Gain Priority mode
- * 2 : Shutter Priority mode
- * 3 : Iris priority mode
- * 4 : Manual
- * ..: Reserved
- * F : No information */
- GST_LOG (" AE Mode: %d (0x%x)", ae, ae);
-
- GST_LOG (" AGC: %d (0x%x)", agc, agc);
- if (agc < 0xd) {
- /* This is what the spec says.. but I'm not seeing the same on my camera :( */
- GST_LOG (" Gain:%02.2fdB", (agc * 3.0) - 3.0);
- gst_structure_set (st, "gain", G_TYPE_FLOAT, (agc * 3.0) - 3.0, NULL);
- }
- /* White balance mode
- * 0 : Automatic
- * 1 : hold
- * 2 : one push
- * 3 : pre-set
- * 7 : no-information */
- if (wbmode != 7)
- GST_LOG (" White balance mode : %d (0x%x)", wbmode, wbmode);
- /* White balance
- * 0 : Candle
- * 1 : Incandescent lamp
- * 2 : low color temperature fluorescent lamp
- * 3 : high color temperature fluorescent lamp
- * 4 : sunlight
- * 5 : cloudy weather
- * F : No information
- */
- if (whitebal != 0xf)
- GST_LOG (" White balance : %d (0x%x)", whitebal, whitebal);
- if (focuspos != 0x7f) {
- GST_LOG (" Focus mode : %s", focusmode ? "MANUAL" : "AUTOMATIC");
- GST_LOG (" Focus position: %d (0x%x)", focuspos, focuspos);
- }
- }
- break;
- case 0x71:{
- guint8 v_pan, h_pan, focal_length, e_zoom;
- gboolean is, zen;
-
- v_pan = data[offs + 1] & 0x3f;
- is = data[offs + 2] >> 7;
- h_pan = data[offs + 2] & 0x7f;
- focal_length = data[offs + 3];
- zen = data[offs + 4] >> 7;
- e_zoom = data[offs + 4] & 0x7f;
-
- GST_LOG (" Consumer Camera 2");
- if (v_pan != 0x3f)
- GST_LOG (" Vertical Panning : %d (0x%d)", v_pan, v_pan);
- if (h_pan != 0x7f)
- GST_LOG (" Horizontal Panning : %d (0x%d)", h_pan, h_pan);
- GST_LOG (" Stabilizer : %s", is ? "OFF" : "ON");
- if (focal_length != 0xff)
- GST_LOG (" Focal Length : %f mm",
- (focal_length & 0x7f) * pow (10, focal_length & 0x80));
- if (zen == 0)
- GST_LOG (" Electric Zoom %02dd.%03d", e_zoom >> 5, e_zoom & 0x1f);
- }
- break;
- case 0x7f:{
- guint16 speed;
- guint16 speedint;
-
- GST_LOG (" Shutter");
- if (data[offs + 1] != 0xff)
- GST_LOG (" Shutter Speed (1) : %d, 0x%x",
- data[offs + 1], data[offs + 1]);
- if (data[offs + 2] != 0xff)
- GST_LOG (" Shutter Speed (1) : %d, 0x%x",
- data[offs + 2], data[offs + 2]);
-
- speed = data[offs + 3] | (data[offs + 4] & 0x7f) << 8;
-
- /* The shutter speed is 1/(CSS * horizontal scanning period) */
- /* FIXME : 34000 is a value interpolated by observations */
- speedint = (int) (34000.0 / (float) speed);
- /* Only the highest two decimal digits are valid */
- if (speedint > 100)
- speedint = speedint / 10 * 10;
-
- GST_LOG (" Shutter speed : 1/%d", speedint);
- gst_structure_set (st, "shutter-speed", GST_TYPE_FRACTION,
- 1, speedint, NULL);
- }
- break;
- default:
- GST_MEMDUMP ("Unknown pack", data + offs, 5);
- break;
- }
- size -= 5;
- offs += 5;
- }
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-parse_video_frame (GstHDVParse * filter, guint8 * data, guint64 size,
- GstStructure * st)
-{
- guint32 etn, bitrate;
- guint8 nbframes, data_h, hdr_size, sfr, sdm;
- guint8 aspect, framerate, profile, level, format, chroma;
- guint8 gop_n, gop_m, cgms, recst, abst;
- guint16 vbv_delay, width, height, vbv_buffer;
- guint64 dts;
- gboolean pf, tf, rf;
-
- GST_LOG_OBJECT (filter, "Video Frame Pack");
-
- /* Byte | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
- * ---------------------------------
- * 0 | Size (0x39) |
- * ---------------------------------
- * 1 | |
- * 2 | ETN |
- * 3 | |
- * ---------------------------------
- */
-
- if (data[0] != 0x39) {
- GST_WARNING ("Invalid size for Video frame");
- return GST_FLOW_ERROR;
- }
- etn = data[3] << 16 | data[2] << 8 | data[1];
-
- GST_LOG_OBJECT (filter, " ETN : %" G_GUINT32_FORMAT, etn);
-
- /* Pack-V Information
- * ---------------------------------
- * 4 | Number of Video Frames |
- * ---------------------------------
- * 5 | 0 | 0 | 0 | 0 | DATA-H |
- * ---------------------------------
- * 6 | VBV |
- * 7 | DELAY |
- * ---------------------------------
- * 8 | HEADER SIZE |
- * ---------------------------------
- * 9 | |
- * 10 | DTS |
- * 11 | |
- * 12 | |
- * ----------------------------- |
- * 13 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
- * ---------------------------------
- * 14 |PF |TF |RF | 0 | SFR |
- * ---------------------------------
- */
-
- nbframes = data[4];
-
- if (VALIDATE && (data[5] >> 4))
- return GST_FLOW_ERROR;
- data_h = data[5] & 0xf;
-
- vbv_delay = data[6] | data[7] << 8;
-
- hdr_size = data[8];
-
- dts = data[9] | data[10] << 8 | data[11] << 16 | data[12] << 24;
- dts |= (guint64) (data[13] & 0x1) << 32;
- if (G_UNLIKELY (VALIDATE && (data[13] & 0xfe))) {
- return GST_FLOW_ERROR;
- }
-
- pf = data[14] & 0x80;
- tf = data[14] & 0x40;
- rf = data[14] & 0x20;
- if (G_UNLIKELY (VALIDATE && (data[14] & 0x10)))
- return GST_FLOW_ERROR;
-
- sfr = data[14] & 0x07;
-
- GST_LOG_OBJECT (filter, " Pack-V Information");
- GST_LOG_OBJECT (filter, " Number of Video Frames : %d", nbframes);
- GST_LOG_OBJECT (filter, " Leading PES-V picture type %s (0x%x)",
- (data_h == 0x1) ? "I-picture" : "other", data_h);
- GST_LOG_OBJECT (filter, " VBV Delay of first frame: %" G_GUINT32_FORMAT,
- vbv_delay);
- GST_LOG_OBJECT (filter, " Header Size:%d", hdr_size);
- GST_LOG_OBJECT (filter, " DTS: %" GST_TIME_FORMAT " (%" G_GUINT64_FORMAT ")",
- GST_TIME_ARGS (MPEGTIME_TO_GSTTIME (dts)), dts);
- GST_LOG_OBJECT (filter, " Video source : %s %s %s (0x%x 0x%x 0x%x)",
- pf ? "Progressive" : "Interlaced",
- tf ? "TFF" : "", rf ? "RFF" : "", pf, tf, rf);
- GST_LOG_OBJECT (filter, " Source Frame Rate : %s (0x%x)",
- sfr_to_framerate (sfr), sfr);
-
- gst_structure_set (st, "DTS", G_TYPE_UINT64, MPEGTIME_TO_GSTTIME (dts),
- "interlaced", G_TYPE_BOOLEAN, !pf, NULL);
-
- /* Search Data Mode
- * ---------------------------------
- * 15 | Search Data Mode |
- * ---------------------------------
- */
- sdm = data[15];
- GST_LOG_OBJECT (filter, " Search Data Mode : 0x%x", sdm);
- GST_LOG_OBJECT (filter, " %s %s %s",
- sdm & 0x2 ? "8x-Base" : "",
- sdm & 0x4 ? "8x-Helper" : "", sdm & 0x10 ? "24x" : "");
-
- /* Video Mode
- * ---------------------------------
- * 16 | Horizontal size |
- * ----------------- |
- * 17 | 0 | 0 | 0 | 0 | |
- * ---------------------------------
- * 18 | Vertical size |
- * ----------------- |
- * 19 | 0 | 0 | 0 | 0 | |
- * ---------------------------------
- * 20 | Aspect ratio | Frame Rate |
- * ---------------------------------
- * 21 | |
- * 22 | bitrate |
- * ------------------------- |
- * 23 | 0 | 0 | 0 | 0 | 0 | 0 | |
- * ---------------------------------
- * 24 | VBV Buffer size |
- * ------------------------- |
- * 25 | 0 | 0 | 0 | 0 | 0 | 0 | |
- * ---------------------------------
- * 26 | 0 | Profile | Level |
- * ---------------------------------
- * 27 | 0 | Format |Chroma | 0 | 0 |
- * ---------------------------------
- * 28 | GOP N | GOP M |
- * ---------------------------------
- */
- width = data[16] | (data[17] & 0xf) << 8;
- height = data[18] | (data[19] & 0xf) << 8;
- if (VALIDATE && ((data[17] & 0xf0) || data[19] & 0xf0))
- return GST_FLOW_ERROR;
- aspect = data[20] >> 4;
- framerate = data[20] & 0xf;
- bitrate = data[21] | data[22] << 8 | (data[23] & 0x3) << 16;
- if (VALIDATE && (data[23] & 0xfc))
- return GST_FLOW_ERROR;
- vbv_buffer = data[24] | (data[25] & 0x3) << 8;
- if (VALIDATE && (data[25] & 0xfc))
- return GST_FLOW_ERROR;
- profile = (data[26] >> 4) & 0x7;
- level = data[26] & 0xf;
- format = (data[27] >> 4) & 0x7;
- chroma = (data[27] >> 2) & 0x3;
- gop_n = data[28] >> 3;
- gop_m = data[28] & 0x7;
-
- GST_LOG_OBJECT (filter, " Video Mode");
- GST_LOG_OBJECT (filter, " width:%d, height:%d", width, height);
- GST_LOG_OBJECT (filter, " Aspect Ratio : %s (0x%x)",
- (aspect == 0x3) ? "16/9" : "RESERVED", aspect);
- GST_LOG_OBJECT (filter, " Framerate: %s (0x%x)",
- sfr_to_framerate (framerate), framerate);
- GST_LOG_OBJECT (filter, " Bitrate: %d bit/s", bitrate * 400);
- GST_LOG_OBJECT (filter, " VBV buffer Size : %d bits",
- vbv_buffer * 16 * 1024);
- GST_LOG_OBJECT (filter, " MPEG Profile : %s (0x%x)",
- (profile == 0x4) ? "Main" : "RESERVED", profile);
- GST_LOG_OBJECT (filter, " MPEG Level : %s (0x%x)",
- (level == 0x6) ? "High-1440" : "RESERVED", level);
- GST_LOG_OBJECT (filter, " Video format : %s (0x%x)",
- (format == 0) ? "Component" : "Reserved", format);
- GST_LOG_OBJECT (filter, " Chroma : %s (0x%x)",
- (chroma == 0x1) ? "4:2:0" : "RESERVED", chroma);
- GST_LOG_OBJECT (filter, " GOP N/M : %d / %d", gop_n, gop_m);
-
- /* data availability
- * ---------------------------------
- * 29 | 0 | 0 | 0 | 0 | 0 |PE2|PE1|PE0|
- * ---------------------------------
- * PE0 : HD2 TTC is valid
- * PE1 : REC DATE is valid
- * PE2 : REC TIME is valid
- */
- if (data[29] & 0x1) {
- guint8 fr, sec, min, hr;
- gboolean bf, df;
- gchar *ttcs;
-
- /* HD2 TTC
- * ---------------------------------
- * 30 |BF |DF |Tens Fr|Units of Frames|
- * ---------------------------------
- * 31 | 1 |Tens second|Units of Second|
- * ---------------------------------
- * 32 | 1 |Tens minute|Units of Minute|
- * ---------------------------------
- * 33 | 1 | 1 |Tens Hr|Units of Hours |
- * ---------------------------------
- */
- bf = data[30] >> 7;
- df = (data[30] >> 6) & 0x1;
- fr = BCD (data[30] & 0x3f);
- sec = BCD (data[31] & 0x7f);
- min = BCD (data[32] & 0x7f);
- hr = BCD (data[33] & 0x3f);
- GST_LOG_OBJECT (filter, " HD2 Title Time Code");
- GST_LOG_OBJECT (filter, " BF:%d, Drop Frame:%d", bf, df);
- ttcs = g_strdup_printf ("%02d:%02d:%02d.%02d", hr, min, sec, fr);
- GST_LOG_OBJECT (filter, " Timecode %s", ttcs);
- /* FIXME : Use framerate information from above to convert to GstClockTime */
- gst_structure_set (st, "title-time-code", G_TYPE_STRING, ttcs, NULL);
- g_free (ttcs);
-
- }
-
- if (data[29] & 0x2) {
- gboolean ds, tm;
- guint8 tz, day, dow, month, year;
- GDate *date;
-
- /* REC DATE
- * ---------------------------------
- * 34 |DS |TM |Tens TZ|Units of TimeZn|
- * ---------------------------------
- * 35 | 1 | 1 |Tens dy| Units of Days |
- * ---------------------------------
- * 36 | Week |TMN|Units of Months|
- * ---------------------------------
- * 37 | Tens of Years |Units of Years |
- * ---------------------------------
- */
- ds = data[34] >> 7;
- tm = (data[34] >> 6) & 0x1;
- tz = BCD (data[34] & 0x3f);
- day = BCD (data[35] & 0x3f);
- dow = data[36] >> 5;
- month = BCD (data[36] & 0x1f);
- year = BCD (data[37]);
-
- GST_LOG_OBJECT (filter, " REC DATE");
- GST_LOG_OBJECT (filter, " ds:%d, tm:%d", ds, tm);
- GST_LOG_OBJECT (filter, " Timezone: %d", tz);
- GST_LOG_OBJECT (filter, " Date: %d %02d/%02d/%04d", dow, day, month, year);
- date = g_date_new_dmy (day, month, year);
- gst_structure_set (st, "date", GST_TYPE_DATE, date,
- "timezone", G_TYPE_INT, tz,
- "daylight-saving", G_TYPE_BOOLEAN, ds, NULL);
- g_date_free (date);
- }
-
- if (data[29] & 0x4) {
- guint8 fr, sec, min, hr;
- gchar *times;
-
- /* REC TIME
- * ---------------------------------
- * 38 | 1 | 1 |Tens Fr|Units of Frames|
- * ---------------------------------
- * 39 | 1 |Tens second|Units of Second|
- * ---------------------------------
- * 40 | 1 |Tens minute|Units of Minute|
- * ---------------------------------
- * 41 | 1 | 1 |Tens Hr|Units of Hours |
- * ---------------------------------
- */
- fr = BCD (data[38] & 0x3f);
- sec = BCD (data[39] & 0x7f);
- min = BCD (data[40] & 0x7f);
- hr = BCD (data[41] & 0x3f);
- times = g_strdup_printf ("%02d:%02d:%02d", hr, min, sec);
- GST_LOG_OBJECT (filter, " REC TIME %02d:%02d:%02d.%02d", hr, min, sec, fr);
- gst_structure_set (st, "time", G_TYPE_STRING, times, NULL);
- g_free (times);
- }
-
- /* MISC
- * ---------------------------------
- * 42 | CGMS |REC|ABS| 0 | 0 | 0 | 0 |
- * ---------------------------------
- */
- cgms = data[42] >> 6;
- recst = (data[42] >> 5) & 0x1;
- abst = (data[42] >> 4) & 0x1;
-
- GST_LOG_OBJECT (filter, " CGMS:0x%x", cgms);
- GST_LOG_OBJECT (filter, " Recording Start Point : %s",
- (recst == 0) ? "PRESENT" : "ABSENT");
- GST_LOG_OBJECT (filter, " ABST : %s",
- (abst == 0) ? "DISCONTINUITY" : "NO DISCONTINUITY");
-
- gst_structure_set (st, "recording-start-point", G_TYPE_BOOLEAN, !recst, NULL);
-
- /* Extended DV Pack #1
- * 43 - 47
- */
- GST_LOG_OBJECT (filter, " Extended DV Pack #1 : 0x%x", data[43]);
-
- /* Extended DV Pack #1
- * 48 - 52
- */
- GST_LOG_OBJECT (filter, " Extended DV Pack #2 : 0x%x", data[48]);
-
- /* Extended DV Pack #1
- * 53 - 57
- */
- GST_LOG_OBJECT (filter, " Extended DV Pack #3 : 0x%x", data[53]);
-
- return GST_FLOW_OK;
-
-}
-
-static GstFlowReturn
-parse_audio_frame (GstHDVParse * filter, guint8 * data, guint64 size,
- GstStructure * st)
-{
- guint32 etn;
- guint8 nbmute, nbaau;
- guint64 pts;
- guint16 audio_comp;
- guint8 bitrate, fs, compress, channel;
- guint8 option, cgms;
- gboolean acly, recst;
-
- GST_LOG_OBJECT (filter, "Audio Frame Pack");
-
- /* Byte | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
- * ---------------------------------
- * 0 | Size (0x0f) |
- * ---------------------------------
- * 1 | |
- * 2 | ETN |
- * 3 | |
- * ---------------------------------
- * 4 |Nb Audio Mute | Number of AAU |
- * ---------------------------------
- */
-
- if (data[0] != 0x0f) {
- GST_WARNING ("Invalid size for audio frame");
- return GST_FLOW_ERROR;
- }
- etn = data[3] << 16 | data[2] << 8 | data[1];
-
- GST_LOG_OBJECT (filter, " ETN : %" G_GUINT32_FORMAT, etn);
-
- /* Pack-A Information
- * ---------------------------------
- * 4 |Nb Audio Mute | Number of AAU |
- * ---------------------------------
- * 5 | |
- * 6 | PTS |
- * 7 | |
- * 8 | |
- * ----------------------------- |
- * 9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
- * ---------------------------------
- * 10 | Audio |
- * 11 | Compensation |
- * ---------------------------------
- */
-
- /* Number of Audio Mute Frames */
- nbmute = data[4] >> 4;
- /* Number of AAU */
- nbaau = data[4] & 0x0f;
- /* PTS of the first AAU immediatly following */
- pts = (data[5] | data[6] << 8 | data[7] << 16 | data[8] << 24);
- pts |= (guint64) (data[9] & 0x1) << 32;
- if (G_UNLIKELY (VALIDATE && (data[9] & 0xfe))) {
- return GST_FLOW_ERROR;
- }
-
- /* Amount of compensation */
- audio_comp = data[10] | data[11] << 8;
-
- GST_LOG_OBJECT (filter, " Pack-A Information");
- GST_LOG_OBJECT (filter, " Nb Audio Mute Frames : %d", nbmute);
- GST_LOG_OBJECT (filter, " Nb AAU : %d", nbaau);
- GST_LOG_OBJECT (filter,
- " PTS : %" GST_TIME_FORMAT " (%" G_GUINT64_FORMAT ")",
- GST_TIME_ARGS (MPEGTIME_TO_GSTTIME (pts)), pts);
- GST_LOG_OBJECT (filter, " Audio Compensation : %" G_GUINT32_FORMAT,
- audio_comp);
-
- /* Audio Mode
- * ---------------------------------
- * 12 | Bitrate Index | 0 |Samplerate |
- * ---------------------------------
- * 13 | Compression | Channels |
- * ---------------------------------
- * 14 | X | Anciliary Option |
- * ---------------------------------
- *
- * X : Anciliary data present
- */
-
- bitrate = data[12] >> 4;
- fs = data[12] & 0x7;
- if (G_UNLIKELY (VALIDATE && (data[12] & 0x08)))
- return GST_FLOW_ERROR;
-
- compress = data[13] >> 4;
- channel = data[13] & 0xf;
- acly = data[14] & 0x80;
- option = data[14] & 0x7f;
-
- GST_LOG_OBJECT (filter, " Audio Mode");
- GST_LOG_OBJECT (filter, " Bitrate : %s (0x%x)",
- (bitrate == 0xe) ? "384kbps" : "RESERVED", bitrate);
- GST_LOG_OBJECT (filter, " Samplerate : %s (0x%x)",
- (fs == 0x1) ? "48 kHz" : "RESERVED", fs);
- GST_LOG_OBJECT (filter, " Compression : %s (0x%x)",
- (compress == 0x2) ? "MPEG-1 Layer II" : "RESERVED", compress);
- GST_LOG_OBJECT (filter, " Channels : %s (0x%x)",
- (channel == 0) ? "Stereo" : "RESERVED", channel);
- GST_LOG_OBJECT (filter, " Anciliary data %s %s (0x%x)",
- acly ? "PRESENT" : "ABSENT",
- (option == 0xc) ? "IEC 13818-3" : "ABSENT/RESERVED", option);
- /*
- * ---------------------------------
- * 15 | CGMS | R | 0 | 0 | 0 | 0 | 0 |
- * ---------------------------------
- *
- * R : Recording Start Point
- */
-
- cgms = data[15] & 0xc0;
- recst = data[15] & 0x20;
-
- GST_LOG_OBJECT (filter, " Misc");
- GST_LOG_OBJECT (filter, " CGMS : 0x%x", cgms);
- GST_LOG_OBJECT (filter, " Recording Start Point %s",
- (recst) ? "ABSENT" : "PRESENT");
-
- gst_structure_set (st, "PTS", G_TYPE_UINT64, MPEGTIME_TO_GSTTIME (pts),
- "recording-start-point", G_TYPE_BOOLEAN, !recst, NULL);
-
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_hdvparse_parse (GstHDVParse * filter, GstBuffer * buf)
-{
- GstFlowReturn res = GST_FLOW_OK;
- guint8 *data = GST_BUFFER_DATA (buf);
- guint64 offs = 0;
- guint64 insize = GST_BUFFER_SIZE (buf);
- GstStructure *st;
-
- /* Byte | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
- * ---------------------------------
- * 0 | 0 | KEYWORD |
- * (1) | LENGTH |
- * ....
- *
- * KEYWORD :
- * 0x00 - 0x3F : Constant length (5 bytes)
- * 0x40 - 0x7F : Variable length (LENGTH + 1)
- *
- * LENGTH : if present, size of fields 1-N
- *
- * Known keyword values:
- * 0x00-0x07 : AUX-V
- * 0x08-0x3E : RESERVED
- * 0x3F : AUX-N NO-INFO
- * 0x40-0x43 : AUX-A
- * 0x44-0x47 : AUX-V
- * 0x48-0x4F : AUX-N
- * 0x50-0x53 : AUX-SYS
- * 0x54-0x7E : RESERVED
- * 0x7F : AUX-N NULL PACK
- */
-
- st = gst_structure_empty_new ("hdv-aux");
-
- while (res == GST_FLOW_OK && (offs < insize)) {
- guint8 kw = data[offs] & 0x7f;
- guint8 size;
-
- /* Variable size packs */
- if (kw >= 0x40) {
- size = data[offs + 1];
- } else
- size = 4;
-
- /* Size validation */
- GST_DEBUG ("kw:0x%x, insize:%" G_GUINT64_FORMAT ", offs:%" G_GUINT64_FORMAT
- ", size:%d", kw, insize, offs, size);
- if (insize < offs + size) {
- res = GST_FLOW_ERROR;
- goto beach;
- }
-
- switch (kw) {
- case 0x01:
- GST_LOG ("BINARY GROUP");
- offs += size + 1;
- break;
- case 0x07:
- GST_LOG ("ETN pack");
- break;
- case 0x40:
- GST_LOG ("Audio frame pack");
- res = parse_audio_frame (filter, data + offs + 1, size, st);
- offs += size + 2;
- break;
- case 0x3f:
- GST_LOG ("NO INFO pack");
- offs += size + 1;
- break;
- case 0x44:
- GST_LOG ("Video frame pack");
- res = parse_video_frame (filter, data + offs + 1, size, st);
- offs += size + 2;
- break;
- case 0x48:
- case 0x49:
- case 0x4A:
- case 0x4B:
- GST_LOG ("DV multi-pack");
- res = parse_dv_multi_pack (filter, data + offs + 1, size, st);
- offs += size + 2;
- break;
- default:
- GST_WARNING_OBJECT (filter, "Unknown AUX pack data of type 0x%x", kw);
- res = GST_FLOW_ERROR;
- }
- }
-
-beach:
- if (gst_structure_n_fields (st)) {
- GstMessage *msg;
- /* Emit the element message */
- msg = gst_message_new_element (GST_OBJECT (filter), st);
- gst_element_post_message (GST_ELEMENT (filter), msg);
- } else
- gst_structure_free (st);
-
- return res;
-
-}
-
-/* GstBaseTransform vmethod implementations */
-
-static GstFlowReturn
-gst_hdvparse_transform_ip (GstBaseTransform * base, GstBuffer * outbuf)
-{
- GstHDVParse *filter = GST_HDVPARSE (base);
-
- return gst_hdvparse_parse (filter, outbuf);
-}
-
-
-/* entry point to initialize the plug-in
- * initialize the plug-in itself
- * register the element factories and other features
- */
-static gboolean
-HDVParse_init (GstPlugin * HDVParse)
-{
- return gst_element_register (HDVParse, "hdvparse", GST_RANK_NONE,
- GST_TYPE_HDVPARSE);
-}
-
-/* gstreamer looks for this structure to register HDVParses
- *
- * exchange the string 'Template HDVParse' with you HDVParse description
- */
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- hdvparse,
- "HDV private stream parser",
- HDVParse_init, VERSION, "LGPL", "GStreamer", "http://gstreamer.net/")
diff --git a/gst/hdvparse/gsthdvparse.h b/gst/hdvparse/gsthdvparse.h
deleted file mode 100644
index dbdfdddde..000000000
--- a/gst/hdvparse/gsthdvparse.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2009 Edward Hervey <bilboed@bilboed.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_HDVPARSE_H__
-#define __GST_HDVPARSE_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstbasetransform.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_HDVPARSE \
- (gst_hdvparse_get_type())
-#define GST_HDVPARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_HDVPARSE,GstHDVParse))
-#define GST_HDVPARSE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_HDVPARSE,GstHDVParseClass))
-#define GST_IS_HDVPARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_HDVPARSE))
-#define GST_IS_HDVPARSE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_HDVPARSE))
-
-typedef struct _GstHDVParse GstHDVParse;
-typedef struct _GstHDVParseClass GstHDVParseClass;
-
-struct _GstHDVParse {
- GstBaseTransform element;
-
-};
-
-struct _GstHDVParseClass {
- GstBaseTransformClass parent_class;
-};
-
-GType gst_hdvparse_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_HDVPARSE_H__ */
diff --git a/gst/hdvparse/meson.build b/gst/hdvparse/meson.build
deleted file mode 100644
index 4ffa3665d..000000000
--- a/gst/hdvparse/meson.build
+++ /dev/null
@@ -1,12 +0,0 @@
-hdv_sources = [
- 'gsthdvparse.c'
-]
-
-gsthdvparse = library('gsthdvparse',
- hdv_sources,
- c_args : gst_plugins_bad_args,
- include_directories : [configinc],
- dependencies : [gstbase_dep, libm],
- install : true,
- install_dir : plugins_install_dir,
-)
diff --git a/gst/meson.build b/gst/meson.build
index 6bb2e4bee..17aa3d36c 100644
--- a/gst/meson.build
+++ b/gst/meson.build
@@ -3,8 +3,6 @@ subdir('adpcmdec')
subdir('adpcmenc')
subdir('aiff')
subdir('asfmux')
-# not ported to 1.0
-#subdir('audiobuffer')
subdir('audiobuffersplit')
subdir('audiofxbad')
subdir('audiomixer')
@@ -12,28 +10,18 @@ subdir('audiovisualizers')
subdir('autoconvert')
subdir('bayer')
subdir('camerabin2')
-# did not work
-#subdir('cdxaparse')
subdir('coloreffects')
subdir('compositor')
-#did not work
-#subdir('dccp')
subdir('debugutils')
subdir('dvbsuboverlay')
subdir('dvdspu')
-# did not work
-#subdir('faceoverlay')
subdir('festival')
subdir('fieldanalysis')
subdir('freeverb')
subdir('frei0r')
-# did not work
-#subdir('games')
subdir('gaudieffects')
subdir('gdp')
subdir('geometrictransform')
-#did not work
-#subdir('hdvparse')
subdir('id3tag')
subdir('inter')
subdir('interlace')
@@ -43,30 +31,16 @@ subdir('jp2kdecimator')
subdir('jpegformat')
subdir('librfb')
subdir('midi')
-#did not work
-#subdir('mixmatrix')
subdir('mpegdemux')
subdir('mpegpsmux')
subdir('mpegtsdemux')
subdir('mpegtsmux')
-#did not work
-#subdir('mve')
subdir('mxf')
-#did not work
-#subdir('nuvdemux')
subdir('onvif')
-#did not work
-#subdir('overlay')
-#did not work
-#subdir('patchdetect')
subdir('pcapparse')
subdir('pnm')
subdir('rawparse')
subdir('removesilence')
-#did not work
-#subdir('rtjpeg')
-#did not work
-#subdir('sdi')
subdir('sdp')
subdir('segmentclip')
subdir('siren')
@@ -75,10 +49,6 @@ subdir('smooth')
subdir('speed')
subdir('stereo')
subdir('subenc')
-#did not work
-#subdir('tta')
-#did not work
-#subdir('vbidec')
subdir('videofilters')
subdir('videoframe_audiolevel')
subdir('videoparsers')
diff --git a/gst/mixmatrix/Makefile.am b/gst/mixmatrix/Makefile.am
deleted file mode 100644
index cae71f86d..000000000
--- a/gst/mixmatrix/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-
-plugin_LTLIBRARIES = libgstmixmatrix.la
-
-libgstmixmatrix_la_SOURCES = mixmatrix.c
-libgstmixmatrix_la_CFLAGS = $(GST_CFLAGS)
-libgstmixmatrix_la_LIBADD =
-libgstmixmatrix_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstmixmatrix_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
diff --git a/gst/mixmatrix/meson.build b/gst/mixmatrix/meson.build
deleted file mode 100644
index 35c2f8688..000000000
--- a/gst/mixmatrix/meson.build
+++ /dev/null
@@ -1,12 +0,0 @@
-mixmat_sources = [
- 'mixmatrix.c',
-]
-
-gstmixmatrix = library('gstmixmatrix',
- mixmat_sources,
- c_args : gst_plugins_bad_args,
- include_directories : [configinc],
- dependencies : [gstbase_dep],
- install : true,
- install_dir : plugins_install_dir,
-)
diff --git a/gst/mixmatrix/mixmatrix.c b/gst/mixmatrix/mixmatrix.c
deleted file mode 100644
index 5f5f2a4d5..000000000
--- a/gst/mixmatrix/mixmatrix.c
+++ /dev/null
@@ -1,530 +0,0 @@
-/* GStreamer
- * Copyright (C) 2002 Wim Taymans <wtay@chello.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/bytestream/bytestream.h>
-#include <gst/audio/audio.h>
-#include <string.h>
-
-#define GST_TYPE_MIXMATRIX \
- (gst_mixmatrix_get_type())
-#define GST_MIXMATRIX(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MIXMATRIX,GstMixMatrix))
-#define GST_MIXMATRIX_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MIXMATRIX,GstMixMatrix))
-#define GST_IS_MIXMATRIX(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MIXMATRIX))
-#define GST_IS_MIXMATRIX_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MIXMATRIX))
-
-typedef struct _GstMixMatrix GstMixMatrix;
-typedef struct _GstMixMatrixClass GstMixMatrixClass;
-
-struct _GstMixMatrix
-{
- GstElement element;
-
- GstCaps *caps;
- gint samplerate;
-
- gint grpsize;
- gint outsize;
-
- GstPad **sinkpads;
- GstByteStream **sinkbs;
- gint sinkpadalloc;
-
- GstPad **srcpads;
- gint srcpadalloc;
-
- gfloat **matrix;
-};
-
-struct _GstMixMatrixClass
-{
- GstElementClass parent_class;
-
- void (*resize) (GstMixMatrix * mix);
-};
-
-enum
-{
- /* FILL ME */
- RESIZE_SIGNAL,
- LAST_SIGNAL
-};
-
-enum
-{
- PROP_0,
- PROP_SINKPADS,
- PROP_SRCPADS,
- PROP_MATRIXPTR
-};
-
-static GstStaticPadTemplate mixmatrix_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink_%u",
- GST_PAD_SINK,
- GST_PAD_REQUEST,
- GST_STATIC_CAPS (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS)
- );
-
-static GstStaticPadTemplate mixmatrix_src_template =
-GST_STATIC_PAD_TEMPLATE ("src_%u",
- GST_PAD_SRC,
- GST_PAD_REQUEST,
- GST_STATIC_CAPS (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS)
- );
-
-static void gst_mixmatrix_class_init (GstMixMatrixClass * klass);
-static void gst_mixmatrix_base_init (GstMixMatrixClass * klass);
-static void gst_mixmatrix_init (GstMixMatrix * element);
-
-static void gst_mixmatrix_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_mixmatrix_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static GstPad *gst_mixmatrix_request_new_pad (GstElement * element,
- GstPadTemplate * temp, const gchar * name);
-
-static GstPadLinkReturn gst_mixmatrix_connect (GstPad * pad,
- const GstCaps * caps);
-
-static void gst_mixmatrix_loop (GstElement * element);
-
-static guint gst_mixmatrix_signals[LAST_SIGNAL] = { 0 };
-
-static GstElementClass *parent_class = NULL;
-
-GType
-gst_mixmatrix_get_type (void)
-{
- static GType mixmatrix_type = 0;
-
- if (!mixmatrix_type) {
- static const GTypeInfo mixmatrix_info = {
- sizeof (GstMixMatrixClass),
- (GBaseInitFunc) gst_mixmatrix_base_init,
- NULL,
- (GClassInitFunc) gst_mixmatrix_class_init,
- NULL,
- NULL,
- sizeof (GstMixMatrix),
- 0,
- (GInstanceInitFunc) gst_mixmatrix_init,
- };
-
- mixmatrix_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstMixMatrix",
- &mixmatrix_info, 0);
- }
- return mixmatrix_type;
-}
-
-static void
-gst_mixmatrix_base_init (GstMixMatrixClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_static_pad_template (element_class,
- &mixmatrix_sink_template);
- gst_element_class_add_static_pad_template (element_class,
- &mixmatrix_src_template);
- gst_element_class_set_static_metadata (element_class, "Mixing Matrix",
- "Filter/Editor/Audio", "Mix N audio channels together into M channels",
- "Erik Walthinsen <omega@temple-baptist.com>");
-}
-
-static void
-gst_mixmatrix_class_init (GstMixMatrixClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gst_mixmatrix_signals[RESIZE_SIGNAL] =
- g_signal_new ("resize",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstMixMatrixClass, resize),
- NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SINKPADS,
- g_param_spec_int ("sinkpads", "Sink Pads",
- "Number of sink pads in matrix", 0, G_MAXINT, 8,
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SRCPADS,
- g_param_spec_int ("srcpads", "Src Pads", "Number of src pads in matrix",
- 0, G_MAXINT, 8, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_MATRIXPTR,
- g_param_spec_pointer ("matrixptr", "Matrix Pointer",
- "Pointer to gfloat mix matrix",
- G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- gobject_class->set_property = gst_mixmatrix_set_property;
- gobject_class->get_property = gst_mixmatrix_get_property;
- gstelement_class->request_new_pad = gst_mixmatrix_request_new_pad;
-}
-
-static gfloat **
-mixmatrix_alloc_matrix (int x, int y)
-{
- gfloat **matrix;
- int i;
-
- GST_DEBUG ("mixmatrix: allocating a %dx%d matrix of floats\n", x, y);
- matrix = g_new (gfloat *, x);
- GST_DEBUG ("mixmatrix: %p: ", matrix);
- for (i = 0; i < x; i++) {
- matrix[i] = g_new (gfloat, y);
- GST_DEBUG ("%p, ", matrix[i]);
- }
- GST_DEBUG ("\n");
- return matrix;
-}
-
-static void
-mixmatrix_free_matrix (gfloat ** matrix, int x)
-{
- int i;
-
- for (i = 0; i < x; i++)
- g_free (matrix[i]);
- g_free (matrix);
-}
-
-static void
-gst_mixmatrix_init (GstMixMatrix * mix)
-{
- mix->grpsize = 8;
- mix->outsize = 1024;
-
- /* start with zero pads */
- mix->sinkpadalloc = mix->grpsize;
- mix->srcpadalloc = mix->grpsize;
-
- /* allocate the pads */
- mix->sinkpads = g_new0 (GstPad *, mix->sinkpadalloc);
- mix->sinkbs = g_new0 (GstByteStream *, mix->sinkpadalloc);
-
- mix->srcpads = g_new0 (GstPad *, mix->srcpadalloc);
-
- /* allocate a similarly sized matrix */
- mix->matrix = mixmatrix_alloc_matrix (mix->sinkpadalloc, mix->srcpadalloc);
-
- /* set the loop function that does all the work */
- gst_element_set_loop_function (GST_ELEMENT (mix), gst_mixmatrix_loop);
-}
-
-#define ROUND_UP(val,bound) ((((val)/bound)+1)*bound)
-
-static void **
-grow_ptrlist (void **origlist, int origsize, int newsize)
-{
- void **newlist = g_new (void *, newsize);
- memcpy (newlist, origlist, sizeof (void *) * origsize);
- g_free (origlist);
- return newlist;
-}
-
-void
-mixmatrix_resize (GstMixMatrix * mix, int sinkpads, int srcpads)
-{
- int sinkresize = (sinkpads != mix->sinkpadalloc);
- int srcresize = (srcpads != mix->srcpadalloc);
-
- gfloat **newmatrix;
- int i;
-
- GST_DEBUG ("mixmatrix: resizing matrix!!!!\n");
-
- /* check the sinkpads list */
- if (sinkresize) {
- mix->sinkpads =
- (GstPad **) grow_ptrlist ((void **) mix->sinkpads, mix->sinkpadalloc,
- sinkpads);
- mix->sinkbs =
- (GstByteStream **) grow_ptrlist ((void **) mix->sinkbs,
- mix->sinkpadalloc, sinkpads);
- }
- /* check the srcpads list */
- if (srcresize) {
- mix->srcpads =
- (GstPad **) grow_ptrlist ((void **) mix->srcpads, mix->srcpadalloc,
- srcpads);
- }
- /* now resize the matrix if either has changed */
- if (sinkresize || srcresize) {
- /* allocate the new matrix */
- newmatrix = mixmatrix_alloc_matrix (sinkpads, srcpads);
- /* if only the srcpad count changed (y axis), we can just copy */
- if (!sinkresize) {
- memcpy (newmatrix, mix->matrix, sizeof (gfloat *) * sinkpads);
- /* otherwise we have to copy line by line */
- } else {
- for (i = 0; i < mix->srcpadalloc; i++)
- memcpy (newmatrix[i], mix->matrix[i],
- sizeof (gfloat) * mix->srcpadalloc);
- }
-
- /* would signal here! */
-
- /* free old matrix and replace it */
- mixmatrix_free_matrix (mix->matrix, mix->sinkpadalloc);
- mix->matrix = newmatrix;
- }
-
- mix->sinkpadalloc = sinkpads;
- mix->srcpadalloc = srcpads;
-}
-
-#if 0
-static gboolean
-gst_mixmatrix_set_all_caps (GstMixMatrix * mix)
-{
- int i;
-
- /* sink pads */
- for (i = 0; i < mix->sinkpadalloc; i++) {
- if (mix->sinkpads[i]) {
- if (GST_PAD_CAPS (mix->sinkpads[i]) == NULL)
- if (gst_pad_try_set_caps (mix->sinkpads[i], mix->caps) <= 0)
- return FALSE;
- }
- }
-
- /* src pads */
- for (i = 0; i < mix->srcpadalloc; i++) {
- if (mix->srcpads[i]) {
- if (GST_PAD_CAPS (mix->srcpads[i]) == NULL)
- if (gst_pad_try_set_caps (mix->srcpads[i], mix->caps) <= 0)
- return FALSE;
- }
- }
-
- return TRUE;
-}
-#endif
-
-static GstPadLinkReturn
-gst_mixmatrix_connect (GstPad * pad, const GstCaps * caps)
-{
- GstMixMatrix *mix = GST_MIXMATRIX (GST_PAD_PARENT (pad));
- gint i;
-
- for (i = 0; i < mix->srcpadalloc; i++) {
- if (mix->srcpads[i]) {
- if (GST_PAD_CAPS (mix->srcpads[i]) == NULL) {
- if (gst_pad_try_set_caps (mix->srcpads[i], caps) <= 0) {
- return GST_PAD_LINK_REFUSED;
- }
- }
- }
- }
-
- mix->caps = gst_caps_copy (caps);
-
- return GST_PAD_LINK_OK;
-}
-
-static GstPad *
-gst_mixmatrix_request_new_pad (GstElement * element, GstPadTemplate * templ,
- const gchar * name)
-{
- GstMixMatrix *mix;
- gint padnum;
- GstPad *pad = NULL;
-
- g_return_val_if_fail (element != NULL, NULL);
- g_return_val_if_fail (GST_IS_MIXMATRIX (element), NULL);
-
- mix = GST_MIXMATRIX (element);
-
- /* figure out if it's a sink pad */
- if (sscanf (name, "sink_%u", &padnum)) {
- /* check to see if it already exists */
- if (padnum < mix->sinkpadalloc && mix->sinkpads[padnum])
- return mix->sinkpads[padnum];
-
- /* determine if it's bigger than the current size */
- if (padnum >= mix->sinkpadalloc)
- mixmatrix_resize (mix, ROUND_UP (padnum, mix->grpsize),
- mix->sinkpadalloc);
-
- pad = gst_pad_new_from_static_template (&mixmatrix_sink_template, name);
- GST_PAD_ELEMENT_PRIVATE (pad) = GINT_TO_POINTER (padnum);
- gst_element_add_pad (GST_ELEMENT (mix), pad);
-/* g_signal_connect(G_OBJECT(pad), "unlink", G_CALLBACK(sink_unlinked), mix); */
- gst_pad_set_link_function (pad, gst_mixmatrix_connect);
-
- /* create a bytestream for it */
- mix->sinkbs[padnum] = gst_bytestream_new (pad);
-
- /* store away the pad and account for it */
- mix->sinkpads[padnum] = pad;
- }
- /* or it's a src pad */
- else if (sscanf (name, "src_%u", &padnum)) {
- /* check to see if it already exists */
- if (padnum < mix->srcpadalloc && mix->srcpads[padnum])
- return mix->srcpads[padnum];
-
- /* determine if it's bigger than the current size */
- if (padnum >= mix->srcpadalloc)
- mixmatrix_resize (mix, ROUND_UP (padnum, mix->grpsize), mix->srcpadalloc);
-
- pad = gst_pad_new_from_static_template (&mixmatrix_src_template, name);
- GST_PAD_ELEMENT_PRIVATE (pad) = GINT_TO_POINTER (padnum);
- gst_element_add_pad (GST_ELEMENT (mix), pad);
-/* g_signal_connect(G_OBJECT(pad), "unlink", G_CALLBACK(sink_unlinked), mix); */
- /* gst_pad_set_link_function (pad, gst_mixmatrix_connect); */
-
- /* store away the pad and account for it */
- mix->srcpads[padnum] = pad;
- }
-
- return pad;
-}
-
-static void
-gst_mixmatrix_loop (GstElement * element)
-{
- GstMixMatrix *mix = GST_MIXMATRIX (element);
- int i, j, k;
- GstBuffer **inbufs;
- gfloat **infloats;
- GstBuffer **outbufs;
- gfloat **outfloats;
- int bytesize = sizeof (gfloat) * mix->outsize;
- gfloat gain;
-
- /* create the output buffers */
- outbufs = g_new (GstBuffer *, mix->srcpadalloc);
- outfloats = g_new (gfloat *, mix->srcpadalloc);
- for (i = 0; i < mix->srcpadalloc; i++) {
- if (mix->srcpads[i] != NULL) {
- outbufs[i] = gst_buffer_new_and_alloc (bytesize);
- outfloats[i] = (gfloat *) GST_BUFFER_DATA (outbufs[i]);
- memset (outfloats[i], 0, bytesize);
- }
- }
-
- /* go through all the input buffers and pull them */
- inbufs = g_new (GstBuffer *, mix->sinkpadalloc);
- infloats = g_new (gfloat *, mix->sinkpadalloc);
- for (i = 0; i < mix->sinkpadalloc; i++) {
- if (mix->sinkpads[i] != NULL) {
- gst_bytestream_read (mix->sinkbs[i], &inbufs[i], bytesize);
- infloats[i] = (gfloat *) GST_BUFFER_DATA (inbufs[i]);
- /* loop through each src pad */
- for (j = 0; j < mix->srcpadalloc; j++) {
- if (mix->srcpads[j] != NULL) {
-/*
-{
- int z;
- fprintf(stderr,"matrix is %p: ",mix->matrix);
- for (z=0;z<mix->sinkpadalloc;z++)
- fprintf(stderr,"%p, ",mix->matrix[i]);
- fprintf(stderr,"\n");
-}
-fprintf(stderr,"attempting to get gain for %dx%d\n",i,j);
-*/
- gain = mix->matrix[i][j];
-/* fprintf(stderr,"%d->%d=%0.2f ",i,j,gain); */
- for (k = 0; k < mix->outsize; k++) {
- outfloats[j][k] += infloats[i][k] * gain;
- }
- }
- }
- }
- }
-/* fprintf(stderr,"\n"); */
-
- for (i = 0; i < mix->srcpadalloc; i++) {
- if (mix->srcpads[i] != NULL) {
- gst_pad_push (mix->srcpads[i], GST_DATA (outbufs[i]));
- }
- }
-}
-
-static void
-gst_mixmatrix_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstMixMatrix *mix;
-
- g_return_if_fail (GST_IS_MIXMATRIX (object));
- mix = GST_MIXMATRIX (object);
-
- switch (prop_id) {
- default:
- break;
- }
-}
-
-static void
-gst_mixmatrix_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstMixMatrix *mix;
-
- g_return_if_fail (GST_IS_MIXMATRIX (object));
- mix = GST_MIXMATRIX (object);
-
- switch (prop_id) {
- case PROP_SINKPADS:
- g_value_set_int (value, mix->sinkpadalloc);
- break;
- case PROP_SRCPADS:
- g_value_set_int (value, mix->srcpadalloc);
- break;
- case PROP_MATRIXPTR:
- g_value_set_pointer (value, mix->matrix);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- if (!gst_library_load ("gstbytestream"))
- return FALSE;
-
- return gst_element_register (plugin, "mixmatrix",
- GST_RANK_NONE, GST_TYPE_MIXMATRIX);
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- mixmatrix,
- "An audio mixer matrix",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/mve/Makefile.am b/gst/mve/Makefile.am
deleted file mode 100644
index 3ba6d2a4d..000000000
--- a/gst/mve/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-plugin_LTLIBRARIES = libgstmve.la
-
-libgstmve_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
-libgstmve_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(LIBM)
-libgstmve_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstmve_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-libgstmve_la_SOURCES = \
- gstmve.c \
- gstmvemux.c \
- gstmvedemux.c \
- mveaudiodec.c \
- mvevideodec8.c \
- mvevideodec16.c \
- mveaudioenc.c \
- mvevideoenc8.c \
- mvevideoenc16.c
-
-noinst_HEADERS = gstmvedemux.h gstmvemux.h mve.h
-
-EXTRA_DIST = TODO
diff --git a/gst/mve/TODO b/gst/mve/TODO
deleted file mode 100644
index 4384f3e94..000000000
--- a/gst/mve/TODO
+++ /dev/null
@@ -1,5 +0,0 @@
-MVE TODO:
- - seeking support
- - split out decoders from demuxer into separate elements
- - split out encoders from muxer into separate elements
-
diff --git a/gst/mve/gstmve.c b/gst/mve/gstmve.c
deleted file mode 100644
index 2b4cb7272..000000000
--- a/gst/mve/gstmve.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* GStreamer plugin for Interplay MVE movie files
- *
- * Copyright (C) 2006 Jens Granseuer <jensgr@gmx.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * For more information about the Interplay MVE format, visit:
- * http://www.pcisys.net/~melanson/codecs/interplay-mve.txt
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "gstmvedemux.h"
-#include "gstmvemux.h"
-
-static gboolean
-mve_plugin_init (GstPlugin * plugin)
-{
-
- return gst_element_register (plugin, "mvedemux", GST_RANK_PRIMARY,
- GST_TYPE_MVE_DEMUX)
- && gst_element_register (plugin, "mvemux", GST_RANK_PRIMARY,
- GST_TYPE_MVE_MUX);
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- mve,
- "Interplay MVE movie format manipulation",
- mve_plugin_init,
- VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
diff --git a/gst/mve/gstmvedemux.c b/gst/mve/gstmvedemux.c
deleted file mode 100644
index fced0564a..000000000
--- a/gst/mve/gstmvedemux.c
+++ /dev/null
@@ -1,1153 +0,0 @@
-/* GStreamer demultiplexer plugin for Interplay MVE movie files
- *
- * Copyright (C) 2006-2008 Jens Granseuer <jensgr@gmx.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * For more information about the Interplay MVE format, visit:
- * http://www.pcisys.net/~melanson/codecs/interplay-mve.txt
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include "gstmvedemux.h"
-#include "mve.h"
-
-GST_DEBUG_CATEGORY_STATIC (mvedemux_debug);
-#define GST_CAT_DEFAULT mvedemux_debug
-
-enum MveDemuxState
-{
- MVEDEMUX_STATE_INITIAL, /* initial state, header not read */
- MVEDEMUX_STATE_NEXT_CHUNK, /* parsing chunk/segment header */
- MVEDEMUX_STATE_MOVIE, /* reading the stream */
- MVEDEMUX_STATE_SKIP /* skipping chunk */
-};
-
-static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-mve")
- );
-
-static GstStaticPadTemplate vidsrc_template = GST_STATIC_PAD_TEMPLATE ("video",
- GST_PAD_SRC,
- GST_PAD_SOMETIMES,
- GST_STATIC_CAPS ("video/x-raw-rgb, "
- "width = (int) [ 1, MAX ], "
- "height = (int) [ 1, MAX ], "
- "framerate = (fraction) [ 0, MAX ], "
- "bpp = (int) 16, "
- "depth = (int) 15, "
- "endianness = (int) BYTE_ORDER, "
- "red_mask = (int) 31744, "
- "green_mask = (int) 992, "
- "blue_mask = (int) 31; "
- "video/x-raw-rgb, "
- "width = (int) [ 1, MAX ], "
- "height = (int) [ 1, MAX ], "
- "framerate = (fraction) [ 0, MAX ], "
- "bpp = (int) 8, " "depth = (int) 8, " "endianness = (int) BYTE_ORDER")
- );
-
-static GstStaticPadTemplate audsrc_template = GST_STATIC_PAD_TEMPLATE ("audio",
- GST_PAD_SRC,
- GST_PAD_SOMETIMES,
- GST_STATIC_CAPS ("audio/x-raw-int, "
- "width = (int) 8, "
- "rate = (int) [ 1, MAX ], "
- "channels = (int) [ 1, 2 ], "
- "depth = (int) 8, "
- "signed = (boolean) false; "
- "audio/x-raw-int, "
- "width = (int) 16, "
- "rate = (int) [ 1, MAX ], "
- "channels = (int) [ 1, 2 ], "
- "depth = (int) 16, "
- "signed = (boolean) true, "
- "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }")
- );
-
-#define MVE_DEFAULT_AUDIO_STREAM 0x01
-
-static void gst_mve_demux_class_init (GstMveDemuxClass * klass);
-static void gst_mve_demux_base_init (GstMveDemuxClass * klass);
-static void gst_mve_demux_init (GstMveDemux * mve);
-
-#define GST_MVE_SEGMENT_SIZE(data) (GST_READ_UINT16_LE (data))
-#define GST_MVE_SEGMENT_TYPE(data) (GST_READ_UINT8 (data + 2))
-#define GST_MVE_SEGMENT_VERSION(data) (GST_READ_UINT8 (data + 3))
-
-static GstElementClass *parent_class = NULL;
-
-static void
-gst_mve_demux_reset (GstMveDemux * mve)
-{
- gst_adapter_clear (mve->adapter);
-
- if (mve->video_stream != NULL) {
- if (mve->video_stream->pad)
- gst_element_remove_pad (GST_ELEMENT (mve), mve->video_stream->pad);
- if (mve->video_stream->caps)
- gst_caps_unref (mve->video_stream->caps);
- if (mve->video_stream->palette)
- gst_buffer_unref (mve->video_stream->palette);
- g_free (mve->video_stream->code_map);
- if (mve->video_stream->buffer)
- gst_buffer_unref (mve->video_stream->buffer);
- g_free (mve->video_stream);
- mve->video_stream = NULL;
- }
-
- if (mve->audio_stream != NULL) {
- if (mve->audio_stream->pad)
- gst_element_remove_pad (GST_ELEMENT (mve), mve->audio_stream->pad);
- if (mve->audio_stream->caps)
- gst_caps_unref (mve->audio_stream->caps);
- if (mve->audio_stream->buffer)
- gst_buffer_unref (mve->audio_stream->buffer);
- g_free (mve->audio_stream);
- mve->audio_stream = NULL;
- }
-
- mve->state = MVEDEMUX_STATE_INITIAL;
- mve->needed_bytes = MVE_PREAMBLE_SIZE;
- mve->frame_duration = GST_CLOCK_TIME_NONE;
-
- mve->chunk_size = 0;
- mve->chunk_offset = 0;
-}
-
-static const GstQueryType *
-gst_mve_demux_get_src_query_types (GstPad * pad)
-{
- static const GstQueryType src_types[] = {
- GST_QUERY_POSITION,
- GST_QUERY_SEEKING,
- 0
- };
-
- return src_types;
-}
-
-static gboolean
-gst_mve_demux_handle_src_query (GstPad * pad, GstQuery * query)
-{
- gboolean res = FALSE;
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_POSITION:{
- GstFormat format;
-
- gst_query_parse_position (query, &format, NULL);
-
- /* we only support TIME */
- if (format == GST_FORMAT_TIME) {
- GstMveDemuxStream *s = gst_pad_get_element_private (pad);
-
- if (s != NULL) {
- GST_OBJECT_LOCK (s);
- gst_query_set_position (query, GST_FORMAT_TIME, s->last_ts);
- GST_OBJECT_UNLOCK (s);
- res = TRUE;
- }
- }
- 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, FALSE, 0, -1);
- res = TRUE;
- }
- break;
- }
- case GST_QUERY_DURATION:{
- /* FIXME: really should implement/estimate this somehow */
- res = FALSE;
- break;
- }
- default:
- res = gst_pad_query_default (pad, query);
- break;
- }
-
- return res;
-}
-
-static gboolean
-gst_mve_demux_handle_src_event (GstPad * pad, GstEvent * event)
-{
- gboolean res;
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_SEEK:
- GST_DEBUG ("seeking not supported");
- res = FALSE;
- break;
- default:
- res = gst_pad_event_default (pad, event);
- break;
- }
-
- return res;
-}
-
-
-static GstStateChangeReturn
-gst_mve_demux_change_state (GstElement * element, GstStateChange transition)
-{
- GstMveDemux *mve = GST_MVE_DEMUX (element);
-
- if (GST_ELEMENT_CLASS (parent_class)->change_state) {
- GstStateChangeReturn ret;
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- if (ret != GST_STATE_CHANGE_SUCCESS)
- return ret;
- }
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- gst_mve_demux_reset (mve);
- break;
- default:
- break;
- }
-
- return GST_STATE_CHANGE_SUCCESS;
-}
-
-static gboolean
-gst_mve_add_stream (GstMveDemux * mve, GstMveDemuxStream * stream,
- GstTagList * list)
-{
- GstPadTemplate *templ;
- gboolean ret = FALSE;
-
- if (stream->pad == NULL) {
- if (stream == mve->video_stream) {
- templ = gst_static_pad_template_get (&vidsrc_template);
- stream->pad = gst_pad_new_from_template (templ, "video");
- } else {
- templ = gst_static_pad_template_get (&audsrc_template);
- stream->pad = gst_pad_new_from_template (templ, "audio");
- }
- gst_object_unref (templ);
-
- gst_pad_set_query_type_function (stream->pad,
- GST_DEBUG_FUNCPTR (gst_mve_demux_get_src_query_types));
- gst_pad_set_query_function (stream->pad,
- GST_DEBUG_FUNCPTR (gst_mve_demux_handle_src_query));
- gst_pad_set_event_function (stream->pad,
- GST_DEBUG_FUNCPTR (gst_mve_demux_handle_src_event));
- gst_pad_set_element_private (stream->pad, stream);
-
- GST_DEBUG_OBJECT (mve, "adding pad %s", GST_PAD_NAME (stream->pad));
- gst_pad_set_active (stream->pad, TRUE);
- gst_element_add_pad (GST_ELEMENT (mve), stream->pad);
- ret = TRUE;
- }
-
- GST_DEBUG_OBJECT (mve, "setting caps %" GST_PTR_FORMAT, stream->caps);
- gst_pad_set_caps (stream->pad, stream->caps);
-
- if (list)
- gst_element_found_tags_for_pad (GST_ELEMENT (mve), stream->pad, list);
-
- return ret;
-}
-
-static GstFlowReturn
-gst_mve_stream_error (GstMveDemux * mve, guint16 req, guint16 avail)
-{
- GST_ELEMENT_ERROR (mve, STREAM, DECODE, (NULL),
- ("wanted to read %d bytes from stream, %d available", req, avail));
- return GST_FLOW_ERROR;
-}
-
-static GstFlowReturn
-gst_mve_buffer_alloc_for_pad (GstMveDemuxStream * stream,
- guint32 size, GstBuffer ** buffer)
-{
- *buffer = gst_buffer_new_and_alloc (size);
- gst_buffer_set_caps (*buffer, stream->caps);
- GST_BUFFER_TIMESTAMP (*buffer) = stream->last_ts;
- GST_BUFFER_OFFSET (*buffer) = stream->offset;
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_mve_video_init (GstMveDemux * mve, const guint8 * data)
-{
- GST_DEBUG_OBJECT (mve, "init video");
-
- if (mve->video_stream == NULL) {
- GstMveDemuxStream *stream = g_new0 (GstMveDemuxStream, 1);
-
- stream->buffer = NULL;
- stream->back_buf1 = NULL;
- stream->back_buf2 = NULL;
- stream->offset = 0;
- stream->width = 0;
- stream->height = 0;
- stream->code_map = NULL;
- stream->code_map_avail = FALSE;
- stream->palette = NULL;
- stream->caps = NULL;
- stream->last_ts = GST_CLOCK_TIME_NONE;
- stream->last_flow = GST_FLOW_OK;
- mve->video_stream = stream;
- }
-
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_mve_video_create_buffer (GstMveDemux * mve, guint8 version,
- const guint8 * data, guint16 len)
-{
- GstBuffer *buf;
- guint16 w, h, n, true_color, bpp;
- guint required, size;
-
- GST_DEBUG_OBJECT (mve, "create video buffer");
-
- if (mve->video_stream == NULL) {
- GST_ELEMENT_ERROR (mve, STREAM, DECODE, (NULL),
- ("trying to create video buffer for uninitialized stream"));
- return GST_FLOW_ERROR;
- }
-
- /* need 4 to 8 more bytes */
- required = (version > 1) ? 8 : (version * 2);
- if (len < required)
- return gst_mve_stream_error (mve, required, len);
-
- w = GST_READ_UINT16_LE (data) << 3;
- h = GST_READ_UINT16_LE (data + 2) << 3;
-
- if (version > 0)
- n = GST_READ_UINT16_LE (data + 4);
- else
- n = 1;
-
- if (version > 1)
- true_color = GST_READ_UINT16_LE (data + 6);
- else
- true_color = 0;
-
- bpp = (true_color ? 2 : 1);
- size = w * h * bpp;
-
- if (mve->video_stream->buffer != NULL) {
- GST_DEBUG_OBJECT (mve, "video buffer already created");
-
- if (GST_BUFFER_SIZE (mve->video_stream->buffer) == size * 2)
- return GST_FLOW_OK;
-
- GST_DEBUG_OBJECT (mve, "video buffer size has changed");
- gst_buffer_unref (mve->video_stream->buffer);
- }
-
- GST_DEBUG_OBJECT (mve,
- "allocating video buffer, w:%u, h:%u, n:%u, true_color:%u", w, h, n,
- true_color);
-
- /* we need a buffer to keep the last 2 frames, since those may be
- needed for decoding the next one */
- buf = gst_buffer_new_and_alloc (size * 2);
-
- mve->video_stream->bpp = bpp;
- mve->video_stream->width = w;
- mve->video_stream->height = h;
- mve->video_stream->buffer = buf;
- mve->video_stream->back_buf1 = GST_BUFFER_DATA (buf);
- mve->video_stream->back_buf2 = mve->video_stream->back_buf1 + size;
- mve->video_stream->max_block_offset = (h - 7) * w - 8;
- memset (mve->video_stream->back_buf1, 0, size * 2);
-
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_mve_video_palette (GstMveDemux * mve, const guint8 * data, guint16 len)
-{
- GstBuffer *buf;
- guint16 start, count;
- const guint8 *pal;
- guint32 *pal_ptr;
- gint i;
-
- GST_DEBUG_OBJECT (mve, "video palette");
-
- if (mve->video_stream == NULL) {
- GST_ELEMENT_ERROR (mve, STREAM, DECODE, (NULL),
- ("found palette before video stream was initialized"));
- return GST_FLOW_ERROR;
- }
-
- /* need 4 more bytes now, more later */
- if (len < 4)
- return gst_mve_stream_error (mve, 4, len);
-
- len -= 4;
-
- start = GST_READ_UINT16_LE (data);
- count = GST_READ_UINT16_LE (data + 2);
- GST_DEBUG_OBJECT (mve, "found palette start:%u, count:%u", start, count);
-
- /* need more bytes */
- if (len < count * 3)
- return gst_mve_stream_error (mve, count * 3, len);
-
- /* make sure we don't exceed the buffer */
- if (start + count > MVE_PALETTE_COUNT) {
- GST_ELEMENT_ERROR (mve, STREAM, DECODE, (NULL),
- ("palette too large for buffer"));
- return GST_FLOW_ERROR;
- }
-
- if (mve->video_stream->palette != NULL) {
- /* older buffers floating around might still use the old
- palette, so make sure we can update it */
- buf = gst_buffer_make_writable (mve->video_stream->palette);
- } else {
- buf = gst_buffer_new_and_alloc (MVE_PALETTE_COUNT * 4);
- memset (GST_BUFFER_DATA (buf), 0, GST_BUFFER_SIZE (buf));
- }
-
- mve->video_stream->palette = buf;
-
- pal = data + 4;
- pal_ptr = ((guint32 *) GST_BUFFER_DATA (buf)) + start;
- for (i = 0; i < count; ++i) {
- /* convert from 6-bit VGA to 8-bit palette */
- guint8 r, g, b;
-
- r = (*pal) << 2;
- ++pal;
- g = (*pal) << 2;
- ++pal;
- b = (*pal) << 2;
- ++pal;
- *pal_ptr = (r << 16) | (g << 8) | (b);
- ++pal_ptr;
- }
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_mve_video_palette_compressed (GstMveDemux * mve, const guint8 * data,
- guint16 len)
-{
- guint8 mask;
- gint i, j;
- guint32 *col;
-
- GST_DEBUG_OBJECT (mve, "compressed video palette");
-
- if (mve->video_stream == NULL) {
- GST_ELEMENT_ERROR (mve, STREAM, DECODE, (NULL),
- ("found palette before video stream was initialized"));
- return GST_FLOW_ERROR;
- }
-
- if (mve->video_stream->palette == NULL) {
- GST_ELEMENT_ERROR (mve, STREAM, DECODE, (NULL),
- ("no palette available for modification"));
- return GST_FLOW_ERROR;
- }
-
- /* need at least 32 more bytes */
- if (len < 32)
- return gst_mve_stream_error (mve, 32, len);
-
- len -= 32;
-
- for (i = 0; i < 32; ++i) {
- mask = GST_READ_UINT8 (data);
- ++data;
-
- if (mask != 0) {
- for (j = 0; j < 8; ++j) {
- if (mask & (1 << j)) {
- guint8 r, g, b;
-
- /* need 3 more bytes */
- if (len < 3)
- return gst_mve_stream_error (mve, 3, len);
-
- len -= 3;
-
- r = (*data) << 2;
- ++data;
- g = (*data) << 2;
- ++data;
- b = (*data) << 2;
- ++data;
- col =
- ((guint32 *) GST_BUFFER_DATA (mve->video_stream->palette)) +
- i * 8 + j;
- *col = (r << 16) | (g << 8) | (b);
- }
- }
- }
- }
-
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_mve_video_code_map (GstMveDemux * mve, const guint8 * data, guint16 len)
-{
- gint min;
-
- if (mve->video_stream == NULL || mve->video_stream->code_map == NULL) {
- GST_WARNING_OBJECT (mve, "video stream not initialized");
- return GST_FLOW_ERROR;
- }
-
- GST_DEBUG_OBJECT (mve, "found code map, size:%u", len);
-
- /* decoding is done in 8x8 blocks using 4-bit opcodes */
- min = (mve->video_stream->width * mve->video_stream->height) / (8 * 8 * 2);
-
- if (len < min)
- return gst_mve_stream_error (mve, min, len);
-
- memcpy (mve->video_stream->code_map, data, min);
- mve->video_stream->code_map_avail = TRUE;
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_mve_video_data (GstMveDemux * mve, const guint8 * data, guint16 len,
- GstBuffer ** output)
-{
- GstFlowReturn ret = GST_FLOW_OK;
- gint16 cur_frame, last_frame;
- gint16 x_offset, y_offset;
- gint16 x_size, y_size;
- guint16 flags;
- gint dec;
- GstBuffer *buf = NULL;
- GstMveDemuxStream *s = mve->video_stream;
-
- GST_LOG_OBJECT (mve, "video data");
-
- if (s == NULL) {
- GST_ELEMENT_ERROR (mve, STREAM, DECODE, (NULL),
- ("trying to decode video data before stream was initialized"));
- return GST_FLOW_ERROR;
- }
-
- if (GST_CLOCK_TIME_IS_VALID (mve->frame_duration)) {
- if (GST_CLOCK_TIME_IS_VALID (s->last_ts))
- s->last_ts += mve->frame_duration;
- else
- s->last_ts = 0;
- }
-
- if (!s->code_map_avail) {
- GST_ELEMENT_ERROR (mve, STREAM, DECODE, (NULL),
- ("no code map available for decoding"));
- return GST_FLOW_ERROR;
- }
-
- /* need at least 14 more bytes */
- if (len < 14)
- return gst_mve_stream_error (mve, 14, len);
-
- len -= 14;
-
- cur_frame = GST_READ_UINT16_LE (data);
- last_frame = GST_READ_UINT16_LE (data + 2);
- x_offset = GST_READ_UINT16_LE (data + 4);
- y_offset = GST_READ_UINT16_LE (data + 6);
- x_size = GST_READ_UINT16_LE (data + 8);
- y_size = GST_READ_UINT16_LE (data + 10);
- flags = GST_READ_UINT16_LE (data + 12);
- data += 14;
-
- GST_DEBUG_OBJECT (mve,
- "video data hot:%d, cold:%d, xoff:%d, yoff:%d, w:%d, h:%d, flags:%x",
- cur_frame, last_frame, x_offset, y_offset, x_size, y_size, flags);
-
- if (flags & MVE_VIDEO_DELTA_FRAME) {
- guint8 *temp = s->back_buf1;
-
- s->back_buf1 = s->back_buf2;
- s->back_buf2 = temp;
- }
-
- ret = gst_mve_buffer_alloc_for_pad (s, s->width * s->height * s->bpp, &buf);
- if (ret != GST_FLOW_OK)
- return ret;
-
- if (s->bpp == 2) {
- dec = ipvideo_decode_frame16 (s, data, len);
- } else {
- if (s->palette == NULL) {
- GST_ELEMENT_ERROR (mve, STREAM, DECODE, (NULL), ("no palette available"));
- goto error;
- }
-
- dec = ipvideo_decode_frame8 (s, data, len);
- }
- if (dec != 0)
- goto error;
-
- memcpy (GST_BUFFER_DATA (buf), s->back_buf1, GST_BUFFER_SIZE (buf));
- GST_BUFFER_DURATION (buf) = mve->frame_duration;
- GST_BUFFER_OFFSET_END (buf) = ++s->offset;
-
- if (s->bpp == 1) {
- GstCaps *caps;
-
- /* set the palette on the outgoing buffer */
- caps = gst_caps_copy (s->caps);
- gst_caps_set_simple (caps,
- "palette_data", GST_TYPE_BUFFER, s->palette, NULL);
- gst_buffer_set_caps (buf, caps);
- gst_caps_unref (caps);
- }
-
- *output = buf;
- return GST_FLOW_OK;
-
-error:
- gst_buffer_unref (buf);
- return GST_FLOW_ERROR;
-}
-
-static GstFlowReturn
-gst_mve_audio_init (GstMveDemux * mve, guint8 version, const guint8 * data,
- guint16 len)
-{
- GstMveDemuxStream *stream;
- guint16 flags;
- guint32 requested_buffer;
- GstTagList *list;
- gchar *name;
-
- GST_DEBUG_OBJECT (mve, "init audio");
-
- /* need 8 more bytes */
- if (len < 8)
- return gst_mve_stream_error (mve, 8, len);
-
- if (mve->audio_stream == NULL) {
- stream = g_new0 (GstMveDemuxStream, 1);
- stream->offset = 0;
- stream->last_ts = 0;
- stream->last_flow = GST_FLOW_OK;
- mve->audio_stream = stream;
- } else {
- stream = mve->audio_stream;
- gst_caps_unref (stream->caps);
- }
-
- flags = GST_READ_UINT16_LE (data + 2);
- stream->sample_rate = GST_READ_UINT16_LE (data + 4);
- requested_buffer = GST_READ_UINT32_LE (data + 6);
-
- /* bit 0: 0 = mono, 1 = stereo */
- stream->n_channels = (flags & MVE_AUDIO_STEREO) + 1;
- /* bit 1: 0 = 8 bit, 1 = 16 bit */
- stream->sample_size = (((flags & MVE_AUDIO_16BIT) >> 1) + 1) * 8;
- /* bit 2: 0 = uncompressed, 1 = compressed */
- stream->compression = ((version > 0) && (flags & MVE_AUDIO_COMPRESSED)) ?
- TRUE : FALSE;
-
- GST_DEBUG_OBJECT (mve, "audio init, sample_rate:%d, channels:%d, "
- "bits_per_sample:%d, compression:%d, buffer:%u",
- stream->sample_rate, stream->n_channels,
- stream->sample_size, stream->compression, requested_buffer);
-
- stream->caps = gst_caps_from_string ("audio/x-raw-int");
- if (stream->caps == NULL)
- return GST_FLOW_ERROR;
-
- gst_caps_set_simple (stream->caps,
- "signed", G_TYPE_BOOLEAN, (stream->sample_size == 8) ? FALSE : TRUE,
- "depth", G_TYPE_INT, stream->sample_size,
- "width", G_TYPE_INT, stream->sample_size,
- "channels", G_TYPE_INT, stream->n_channels,
- "rate", G_TYPE_INT, stream->sample_rate, NULL);
- if (stream->sample_size > 8) {
- /* for uncompressed audio we can simply copy the incoming buffer
- which is always in little endian format */
- gst_caps_set_simple (stream->caps, "endianness", G_TYPE_INT,
- (stream->compression ? G_BYTE_ORDER : G_LITTLE_ENDIAN), NULL);
- } else if (stream->compression) {
- GST_WARNING_OBJECT (mve,
- "compression is only supported for 16-bit samples");
- stream->compression = FALSE;
- }
-
- list = gst_tag_list_new ();
- name = g_strdup_printf ("Raw %d-bit PCM audio", stream->sample_size);
- gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
- GST_TAG_AUDIO_CODEC, name, NULL);
- g_free (name);
-
- if (gst_mve_add_stream (mve, stream, list))
- return gst_pad_push_event (mve->audio_stream->pad,
- gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME,
- 0, GST_CLOCK_TIME_NONE, 0)) ? GST_FLOW_OK : GST_FLOW_ERROR;
- else
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_mve_audio_data (GstMveDemux * mve, guint8 type, const guint8 * data,
- guint16 len, GstBuffer ** output)
-{
- GstFlowReturn ret;
- GstMveDemuxStream *s = mve->audio_stream;
- GstBuffer *buf = NULL;
- guint16 stream_mask;
- guint16 size;
-
- GST_LOG_OBJECT (mve, "audio data");
-
- if (s == NULL) {
- GST_ELEMENT_ERROR (mve, STREAM, DECODE, (NULL),
- ("trying to queue samples with no audio stream"));
- return GST_FLOW_ERROR;
- }
-
- /* need at least 6 more bytes */
- if (len < 6)
- return gst_mve_stream_error (mve, 6, len);
-
- len -= 6;
-
- stream_mask = GST_READ_UINT16_LE (data + 2);
- size = GST_READ_UINT16_LE (data + 4);
- data += 6;
-
- if (stream_mask & MVE_DEFAULT_AUDIO_STREAM) {
- guint16 n_samples = size / s->n_channels / (s->sample_size / 8);
- GstClockTime duration = (GST_SECOND / s->sample_rate) * n_samples;
-
- if (type == MVE_OC_AUDIO_DATA) {
- guint16 required = (s->compression ? size / 2 + s->n_channels : size);
-
- if (len < required)
- return gst_mve_stream_error (mve, required, len);
-
- ret = gst_mve_buffer_alloc_for_pad (s, size, &buf);
-
- if (ret != GST_FLOW_OK)
- return ret;
-
- if (s->compression)
- ipaudio_uncompress ((gint16 *) GST_BUFFER_DATA (buf), size,
- data, s->n_channels);
- else
- memcpy (GST_BUFFER_DATA (buf), data, size);
-
- GST_DEBUG_OBJECT (mve, "created audio buffer, size:%u, stream_mask:%x",
- size, stream_mask);
- } else {
- /* silence - create a minimal buffer with no sound */
- size = s->n_channels * (s->sample_size / 8);
- ret = gst_mve_buffer_alloc_for_pad (s, size, &buf);
- memset (GST_BUFFER_DATA (buf), 0, size);
- }
-
- GST_BUFFER_DURATION (buf) = duration;
- GST_BUFFER_OFFSET_END (buf) = s->offset + n_samples;
- *output = buf;
-
- s->offset += n_samples;
- s->last_ts += duration;
- } else {
- /* alternate audio streams not supported.
- are there any movies which use them? */
- if (type == MVE_OC_AUDIO_DATA)
- GST_WARNING_OBJECT (mve, "found non-empty alternate audio stream");
- }
-
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_mve_timer_create (GstMveDemux * mve, const guint8 * data, guint16 len,
- GstBuffer ** buf)
-{
- guint32 t_rate;
- guint16 t_subdiv;
- GstMveDemuxStream *s;
- GstTagList *list;
- gint rate_nom, rate_den;
-
- g_return_val_if_fail (mve->video_stream != NULL, GST_FLOW_ERROR);
-
- /* need 6 more bytes */
- if (len < 6)
- return gst_mve_stream_error (mve, 6, len);
-
- t_rate = GST_READ_UINT32_LE (data);
- t_subdiv = GST_READ_UINT16_LE (data + 4);
-
- GST_DEBUG_OBJECT (mve, "found timer:%ux%u", t_rate, t_subdiv);
- mve->frame_duration = t_rate * t_subdiv * GST_USECOND;
-
- /* now really start rolling... */
- s = mve->video_stream;
-
- if ((s->buffer == NULL) || (s->width == 0) || (s->height == 0)) {
- GST_ELEMENT_ERROR (mve, STREAM, DECODE, (NULL),
- ("missing or invalid create-video-buffer segment (%dx%d)",
- s->width, s->height));
- return GST_FLOW_ERROR;
- }
-
- if (s->pad != NULL) {
- if (s->caps != NULL) {
- gst_caps_unref (s->caps);
- s->caps = NULL;
- }
- if (s->code_map != NULL) {
- g_free (s->code_map);
- s->code_map = NULL;
- }
- list = NULL;
- } else {
- list = gst_tag_list_new ();
- gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
- GST_TAG_VIDEO_CODEC, "Raw RGB video", NULL);
- }
-
- s->caps = gst_caps_from_string ("video/x-raw-rgb");
- if (s->caps == NULL)
- return GST_FLOW_ERROR;
-
- rate_nom = GST_SECOND / GST_USECOND;
- rate_den = mve->frame_duration / GST_USECOND;
-
- gst_caps_set_simple (s->caps,
- "bpp", G_TYPE_INT, s->bpp * 8,
- "depth", G_TYPE_INT, (s->bpp == 1) ? 8 : 15,
- "width", G_TYPE_INT, s->width,
- "height", G_TYPE_INT, s->height,
- "framerate", GST_TYPE_FRACTION, rate_nom, rate_den,
- "endianness", G_TYPE_INT, G_BYTE_ORDER, NULL);
- if (s->bpp > 1) {
- gst_caps_set_simple (s->caps, "red_mask", G_TYPE_INT, 0x7C00, /* 31744 */
- "green_mask", G_TYPE_INT, 0x03E0, /* 992 */
- "blue_mask", G_TYPE_INT, 0x001F, /* 31 */
- NULL);
- }
-
- s->code_map = g_malloc ((s->width * s->height) / (8 * 8 * 2));
-
- if (gst_mve_add_stream (mve, s, list))
- return gst_pad_push_event (s->pad,
- gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME,
- 0, GST_CLOCK_TIME_NONE, 0)) ? GST_FLOW_OK : GST_FLOW_ERROR;
- else
- return GST_FLOW_OK;
-}
-
-static void
-gst_mve_end_chunk (GstMveDemux * mve)
-{
- GST_LOG_OBJECT (mve, "end of chunk");
-
- if (mve->video_stream != NULL)
- mve->video_stream->code_map_avail = FALSE;
-}
-
-/* parse segment */
-static GstFlowReturn
-gst_mve_parse_segment (GstMveDemux * mve, GstMveDemuxStream ** stream,
- GstBuffer ** send)
-{
- GstFlowReturn ret = GST_FLOW_OK;
- const guint8 *buffer, *data;
- guint8 type, version;
- guint16 len;
-
- buffer = gst_adapter_peek (mve->adapter, mve->needed_bytes);
-
- type = GST_MVE_SEGMENT_TYPE (buffer);
-
- /* check whether to handle the segment */
- if (type < 32) {
- version = GST_MVE_SEGMENT_VERSION (buffer);
- len = GST_MVE_SEGMENT_SIZE (buffer);
- data = buffer + 4;
-
- switch (type) {
-
- case MVE_OC_END_OF_CHUNK:
- gst_mve_end_chunk (mve);
- break;
- case MVE_OC_CREATE_TIMER:
- ret = gst_mve_timer_create (mve, data, len, send);
- *stream = mve->audio_stream;
- break;
- case MVE_OC_AUDIO_BUFFERS:
- ret = gst_mve_audio_init (mve, version, data, len);
- break;
- case MVE_OC_VIDEO_BUFFERS:
- ret = gst_mve_video_create_buffer (mve, version, data, len);
- break;
- case MVE_OC_AUDIO_DATA:
- case MVE_OC_AUDIO_SILENCE:
- ret = gst_mve_audio_data (mve, type, data, len, send);
- *stream = mve->audio_stream;
- break;
- case MVE_OC_VIDEO_MODE:
- ret = gst_mve_video_init (mve, data);
- break;
- case MVE_OC_PALETTE:
- ret = gst_mve_video_palette (mve, data, len);
- break;
- case MVE_OC_PALETTE_COMPRESSED:
- ret = gst_mve_video_palette_compressed (mve, data, len);
- break;
- case MVE_OC_CODE_MAP:
- ret = gst_mve_video_code_map (mve, data, len);
- break;
- case MVE_OC_VIDEO_DATA:
- ret = gst_mve_video_data (mve, data, len, send);
- *stream = mve->video_stream;
- break;
-
- case MVE_OC_END_OF_STREAM:
- case MVE_OC_PLAY_AUDIO:
- case MVE_OC_PLAY_VIDEO:
- /* these are chunks we don't need to handle */
- GST_LOG_OBJECT (mve, "ignored segment type:0x%02x, version:0x%02x",
- type, version);
- break;
- case 0x13: /* ??? */
- case 0x14: /* ??? */
- case 0x15: /* ??? */
- /* these are chunks we know exist but we don't care about */
- GST_DEBUG_OBJECT (mve,
- "known but unhandled segment type:0x%02x, version:0x%02x", type,
- version);
- break;
- default:
- GST_WARNING_OBJECT (mve,
- "unhandled segment type:0x%02x, version:0x%02x", type, version);
- break;
- }
- }
-
- gst_adapter_flush (mve->adapter, mve->needed_bytes);
- return ret;
-}
-
-static GstFlowReturn
-gst_mve_demux_chain (GstPad * sinkpad, GstBuffer * inbuf)
-{
- GstMveDemux *mve = GST_MVE_DEMUX (GST_PAD_PARENT (sinkpad));
- GstFlowReturn ret = GST_FLOW_OK;
-
- gst_adapter_push (mve->adapter, inbuf);
-
- GST_DEBUG_OBJECT (mve, "queuing buffer, needed:%d, available:%u",
- mve->needed_bytes, gst_adapter_available (mve->adapter));
-
- while ((gst_adapter_available (mve->adapter) >= mve->needed_bytes) &&
- (ret == GST_FLOW_OK)) {
- GstMveDemuxStream *stream = NULL;
- GstBuffer *outbuf = NULL;
-
- switch (mve->state) {
- case MVEDEMUX_STATE_INITIAL:
- gst_adapter_flush (mve->adapter, mve->needed_bytes);
-
- mve->chunk_offset += mve->needed_bytes;
- mve->needed_bytes = 4;
- mve->state = MVEDEMUX_STATE_NEXT_CHUNK;
- break;
-
- case MVEDEMUX_STATE_NEXT_CHUNK:{
- const guint8 *data;
- guint16 size;
-
- data = gst_adapter_peek (mve->adapter, mve->needed_bytes);
- size = GST_MVE_SEGMENT_SIZE (data);
-
- if (mve->chunk_offset >= mve->chunk_size) {
- /* new chunk, flush buffer and proceed with next segment */
- guint16 chunk_type = GST_READ_UINT16_LE (data + 2);
-
- gst_adapter_flush (mve->adapter, mve->needed_bytes);
- mve->chunk_size = size;
- mve->chunk_offset = 0;
-
- if (chunk_type > MVE_CHUNK_END) {
- GST_WARNING_OBJECT (mve,
- "skipping unknown chunk type 0x%02x of size:%u", chunk_type,
- size);
- mve->needed_bytes += size;
- mve->state = MVEDEMUX_STATE_SKIP;
- } else {
- GST_DEBUG_OBJECT (mve, "found new chunk type 0x%02x of size:%u",
- chunk_type, size);
- }
- } else if (mve->chunk_offset <= mve->chunk_size) {
- /* new segment */
- GST_DEBUG_OBJECT (mve, "found segment type 0x%02x of size:%u",
- GST_MVE_SEGMENT_TYPE (data), size);
-
- mve->needed_bytes += size;
- mve->state = MVEDEMUX_STATE_MOVIE;
- }
- }
- break;
-
- case MVEDEMUX_STATE_MOVIE:
- ret = gst_mve_parse_segment (mve, &stream, &outbuf);
-
- if ((ret == GST_FLOW_OK) && (outbuf != NULL)) {
- /* send buffer */
- GST_DEBUG_OBJECT (mve,
- "pushing buffer with time %" GST_TIME_FORMAT
- " (%u bytes) on pad %s",
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
- GST_BUFFER_SIZE (outbuf), GST_PAD_NAME (stream->pad));
-
- ret = gst_pad_push (stream->pad, outbuf);
- stream->last_flow = ret;
- }
-
- if (ret == GST_FLOW_NOT_LINKED) {
- if (mve->audio_stream
- && mve->audio_stream->last_flow != GST_FLOW_NOT_LINKED)
- ret = GST_FLOW_OK;
- if (mve->video_stream
- && mve->video_stream->last_flow != GST_FLOW_NOT_LINKED)
- ret = GST_FLOW_OK;
- }
-
- /* update current offset */
- mve->chunk_offset += mve->needed_bytes;
-
- mve->state = MVEDEMUX_STATE_NEXT_CHUNK;
- mve->needed_bytes = 4;
- break;
-
- case MVEDEMUX_STATE_SKIP:
- mve->chunk_offset += mve->needed_bytes;
- gst_adapter_flush (mve->adapter, mve->needed_bytes);
- mve->state = MVEDEMUX_STATE_NEXT_CHUNK;
- mve->needed_bytes = 4;
- break;
-
- default:
- GST_ERROR_OBJECT (mve, "invalid state: %d", mve->state);
- break;
- }
- }
-
- return ret;
-}
-
-static void
-gst_mve_demux_dispose (GObject * obj)
-{
- GstMveDemux *mve = GST_MVE_DEMUX (obj);
-
- if (mve->adapter) {
- g_object_unref (mve->adapter);
- mve->adapter = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->dispose (obj);
-}
-
-static void
-gst_mve_demux_base_init (GstMveDemuxClass * klass)
-{
-
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_static_pad_template (element_class, &sink_template);
- gst_element_class_add_static_pad_template (element_class, &vidsrc_template);
- gst_element_class_add_static_pad_template (element_class, &audsrc_template);
-
- gst_element_class_set_static_metadata (element_class, "MVE Demuxer",
- "Codec/Demuxer",
- "Demultiplex an Interplay movie (MVE) stream into audio and video",
- "Jens Granseuer <jensgr@gmx.net>");
-}
-
-static void
-gst_mve_demux_class_init (GstMveDemuxClass * klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_mve_demux_dispose);
-
- element_class->change_state = GST_DEBUG_FUNCPTR (gst_mve_demux_change_state);
-}
-
-static void
-gst_mve_demux_init (GstMveDemux * mve)
-{
- mve->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
- gst_pad_set_chain_function (mve->sinkpad,
- GST_DEBUG_FUNCPTR (gst_mve_demux_chain));
- gst_element_add_pad (GST_ELEMENT (mve), mve->sinkpad);
-
- mve->adapter = gst_adapter_new ();
- gst_mve_demux_reset (mve);
-}
-
-GType
-gst_mve_demux_get_type (void)
-{
- static GType plugin_type = 0;
-
- if (!plugin_type) {
- const GTypeInfo plugin_info = {
- sizeof (GstMveDemuxClass),
- (GBaseInitFunc) gst_mve_demux_base_init,
- NULL,
- (GClassInitFunc) gst_mve_demux_class_init,
- NULL,
- NULL,
- sizeof (GstMveDemux),
- 0,
- (GInstanceInitFunc) gst_mve_demux_init,
- };
-
- GST_DEBUG_CATEGORY_INIT (mvedemux_debug, "mvedemux",
- 0, "Interplay MVE movie demuxer");
-
- plugin_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstMveDemux", &plugin_info, 0);
- }
- return plugin_type;
-}
diff --git a/gst/mve/gstmvedemux.h b/gst/mve/gstmvedemux.h
deleted file mode 100644
index efc848d4e..000000000
--- a/gst/mve/gstmvedemux.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * GStreamer demultiplexer plugin for Interplay MVE movie files
- *
- * Copyright (C) 2006 Jens Granseuer <jensgr@gmx.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_MVE_DEMUX_H__
-#define __GST_MVE_DEMUX_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstadapter.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_MVE_DEMUX \
- (gst_mve_demux_get_type())
-#define GST_MVE_DEMUX(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MVE_DEMUX,GstMveDemux))
-#define GST_MVE_DEMUX_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MVE_DEMUX,GstMveDemuxClass))
-#define GST_IS_MVE_DEMUX(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MVE_DEMUX))
-#define GST_IS_MVE_DEMUX_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MVE_DEMUX))
-
-typedef struct _GstMveDemux GstMveDemux;
-typedef struct _GstMveDemuxClass GstMveDemuxClass;
-typedef struct _GstMveDemuxStream GstMveDemuxStream;
-
-struct _GstMveDemux
-{
- GstElement element;
-
- GstPad *sinkpad;
-
- GstMveDemuxStream *video_stream;
- GstMveDemuxStream *audio_stream;
-
- gint state;
-
- /* time per frame (1/framerate) */
- GstClockTime frame_duration;
-
- /* push based variables */
- guint16 needed_bytes;
- GstAdapter *adapter;
-
- /* size of current chunk */
- guint32 chunk_size;
- /* offset in current chunk */
- guint32 chunk_offset;
-};
-
-struct _GstMveDemuxClass
-{
- GstElementClass parent_class;
-};
-
-struct _GstMveDemuxStream {
- /* shared properties */
- GstCaps *caps;
- GstPad *pad;
- GstClockTime last_ts;
- gint64 offset;
-
- GstFlowReturn last_flow;
-
- /* video properties */
- guint16 width;
- guint16 height;
- guint8 bpp; /* bytes per pixel */
- guint8 *code_map;
- gboolean code_map_avail;
- guint8 *back_buf1;
- guint8 *back_buf2;
- guint32 max_block_offset;
- GstBuffer *palette;
- GstBuffer *buffer;
-
- /* audio properties */
- guint16 sample_rate;
- guint16 n_channels;
- guint16 sample_size;
- gboolean compression;
-};
-
-GType gst_mve_demux_get_type (void);
-
-int ipvideo_decode_frame8 (const GstMveDemuxStream * s,
- const unsigned char *data, unsigned short len);
-int ipvideo_decode_frame16 (const GstMveDemuxStream * s,
- const unsigned char *data, unsigned short len);
-
-void ipaudio_uncompress (short *buffer,
- unsigned short buf_len, const unsigned char *data, unsigned char channels);
-
-G_END_DECLS
-
-#endif /* __GST_MVE_DEMUX_H__ */
diff --git a/gst/mve/gstmvemux.c b/gst/mve/gstmvemux.c
deleted file mode 100644
index b123d2d08..000000000
--- a/gst/mve/gstmvemux.c
+++ /dev/null
@@ -1,1486 +0,0 @@
-/* Interplay MVE multiplexer plugin for GStreamer
- * Copyright (C) 2006 Jens Granseuer <jensgr@gmx.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/*
-gst-launch-1.0 filesrc location=movie.mve ! mvedemux name=d !
- video/x-raw-rgb ! mvemux quick=true name=m !
- filesink location=test.mve d. ! audio/x-raw-int ! m.
-*/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <gst/gst.h>
-#include <gst/glib-compat-private.h>
-#include "gstmvemux.h"
-#include "mve.h"
-
-GST_DEBUG_CATEGORY_STATIC (mvemux_debug);
-#define GST_CAT_DEFAULT mvemux_debug
-
-static const char mve_preamble[] = MVE_PREAMBLE;
-
-enum
-{
- PROP_0,
- PROP_AUDIO_COMPRESSION,
- PROP_VIDEO_QUICK_ENCODING,
- PROP_VIDEO_SCREEN_WIDTH,
- PROP_VIDEO_SCREEN_HEIGHT
-};
-
-#define MVE_MUX_DEFAULT_COMPRESSION FALSE
-#define MVE_MUX_DEFAULT_SCREEN_WIDTH 640
-#define MVE_MUX_DEFAULT_SCREEN_HEIGHT 480
-
-enum MveMuxState
-{
- MVE_MUX_STATE_INITIAL, /* initial state */
- MVE_MUX_STATE_CONNECTED, /* linked, caps set, header not written */
- MVE_MUX_STATE_PREBUFFER, /* prebuffering audio data */
- MVE_MUX_STATE_MOVIE, /* writing the movie */
- MVE_MUX_STATE_EOS
-};
-
-static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-mve")
- );
-
-static GstStaticPadTemplate video_sink_factory =
- GST_STATIC_PAD_TEMPLATE ("video",
- GST_PAD_SINK,
- GST_PAD_REQUEST,
- GST_STATIC_CAPS ("video/x-raw-rgb, "
- "width = (int) [ 24, 1600 ], "
- "height = (int) [ 24, 1200 ], "
- "framerate = (fraction) [ 1, MAX ], "
- "bpp = (int) 16, "
- "depth = (int) 15, "
- "endianness = (int) BYTE_ORDER, "
- "red_mask = (int) 31744, "
- "green_mask = (int) 992, "
- "blue_mask = (int) 31; "
- "video/x-raw-rgb, "
- "bpp = (int) 8, "
- "depth = (int) 8, "
- "width = (int) [ 24, 1600 ], "
- "height = (int) [ 24, 1200 ], "
- "framerate = (fraction) [ 1, MAX ], " "endianness = (int) BYTE_ORDER"));
-
-static GstStaticPadTemplate audio_sink_factory =
- GST_STATIC_PAD_TEMPLATE ("audio",
- GST_PAD_SINK,
- GST_PAD_REQUEST,
- GST_STATIC_CAPS ("audio/x-raw-int, "
- "width = (int) 8, "
- "rate = (int) [ 1, MAX ], "
- "channels = (int) [ 1, 2 ], "
- "depth = (int) 8, "
- "signed = (boolean) false; "
- "audio/x-raw-int, "
- "width = (int) 16, "
- "rate = (int) [ 1, MAX ], "
- "channels = (int) [ 1, 2 ], "
- "depth = (int) 16, "
- "signed = (boolean) true, " "endianness = (int) BYTE_ORDER"));
-
-static void gst_mve_mux_base_init (GstMveMuxClass * klass);
-static void gst_mve_mux_class_init (GstMveMuxClass * klass);
-static void gst_mve_mux_init (GstMveMux * mvemux);
-
-static GstElementClass *parent_class = NULL;
-
-static void
-gst_mve_mux_reset (GstMveMux * mvemux)
-{
- mvemux->state = MVE_MUX_STATE_INITIAL;
- mvemux->stream_time = 0;
- mvemux->stream_offset = 0;
- mvemux->timer = 0;
-
- mvemux->frame_duration = GST_CLOCK_TIME_NONE;
- mvemux->width = 0;
- mvemux->height = 0;
- mvemux->screen_width = MVE_MUX_DEFAULT_SCREEN_WIDTH;
- mvemux->screen_height = MVE_MUX_DEFAULT_SCREEN_HEIGHT;
- mvemux->bpp = 0;
- mvemux->video_frames = 0;
- mvemux->pal_changed = FALSE;
- mvemux->pal_first_color = 0;
- mvemux->pal_colors = MVE_PALETTE_COUNT;
- mvemux->quick_encoding = TRUE;
-
- mvemux->bps = 0;
- mvemux->rate = 0;
- mvemux->channels = 0;
- mvemux->compression = MVE_MUX_DEFAULT_COMPRESSION;
- mvemux->next_ts = 0;
- mvemux->max_ts = 0;
- mvemux->spf = 0;
- mvemux->lead_frames = 0;
- mvemux->audio_frames = 0;
-
- mvemux->chunk_has_palette = FALSE;
- mvemux->chunk_has_audio = FALSE;
-
- mvemux->audio_pad_eos = TRUE;
- mvemux->video_pad_eos = TRUE;
-
- g_free (mvemux->chunk_code_map);
- mvemux->chunk_code_map = NULL;
-
- if (mvemux->chunk_video != NULL) {
- g_byte_array_free (mvemux->chunk_video, TRUE);
- mvemux->chunk_video = NULL;
- }
-
- if (mvemux->chunk_audio != NULL) {
- g_byte_array_free (mvemux->chunk_audio, TRUE);
- mvemux->chunk_audio = NULL;
- }
-
- if (mvemux->last_frame != NULL) {
- gst_buffer_unref (mvemux->last_frame);
- mvemux->last_frame = NULL;
- }
-
- if (mvemux->second_last_frame != NULL) {
- gst_buffer_unref (mvemux->second_last_frame);
- mvemux->second_last_frame = NULL;
- }
-
- if (mvemux->audio_buffer != NULL) {
- g_queue_foreach (mvemux->audio_buffer, (GFunc) gst_mini_object_unref, NULL);
- g_queue_free (mvemux->audio_buffer);
- }
- mvemux->audio_buffer = g_queue_new ();
-
- if (mvemux->video_buffer != NULL) {
- g_queue_foreach (mvemux->video_buffer, (GFunc) gst_mini_object_unref, NULL);
- g_queue_free (mvemux->video_buffer);
- }
- mvemux->video_buffer = g_queue_new ();
-}
-
-static void
-gst_mve_mux_pad_link (GstPad * pad, GstPad * peer, gpointer data)
-{
- GstMveMux *mvemux = GST_MVE_MUX (data);
-
- if (pad == mvemux->audiosink) {
- mvemux->audio_pad_connected = TRUE;
- } else if (pad == mvemux->videosink) {
- mvemux->video_pad_connected = TRUE;
- } else {
- g_assert_not_reached ();
- }
-
- GST_DEBUG_OBJECT (mvemux, "pad '%s' connected", GST_PAD_NAME (pad));
-}
-
-static void
-gst_mve_mux_pad_unlink (GstPad * pad, GstPad * peer, gpointer data)
-{
- GstMveMux *mvemux = GST_MVE_MUX (data);
-
- if (pad == mvemux->audiosink) {
- mvemux->audio_pad_connected = FALSE;
- } else if (pad == mvemux->videosink) {
- mvemux->video_pad_connected = FALSE;
- } else {
- g_assert_not_reached ();
- }
-
- GST_DEBUG_OBJECT (mvemux, "pad '%s' unlinked", GST_PAD_NAME (pad));
-}
-
-static void
-gst_mve_mux_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec)
-{
- GstMveMux *mvemux;
-
- g_return_if_fail (GST_IS_MVE_MUX (object));
- mvemux = GST_MVE_MUX (object);
-
- switch (prop_id) {
- case PROP_AUDIO_COMPRESSION:
- g_value_set_boolean (value, mvemux->compression);
- break;
- case PROP_VIDEO_QUICK_ENCODING:
- g_value_set_boolean (value, mvemux->quick_encoding);
- break;
- case PROP_VIDEO_SCREEN_WIDTH:
- g_value_set_uint (value, mvemux->screen_width);
- break;
- case PROP_VIDEO_SCREEN_HEIGHT:
- g_value_set_uint (value, mvemux->screen_height);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_mve_mux_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec)
-{
- GstMveMux *mvemux;
-
- g_return_if_fail (GST_IS_MVE_MUX (object));
- mvemux = GST_MVE_MUX (object);
-
- switch (prop_id) {
- case PROP_AUDIO_COMPRESSION:
- mvemux->compression = g_value_get_boolean (value);
- break;
- case PROP_VIDEO_QUICK_ENCODING:
- mvemux->quick_encoding = g_value_get_boolean (value);
- break;
- case PROP_VIDEO_SCREEN_WIDTH:
- mvemux->screen_width = g_value_get_uint (value);
- break;
- case PROP_VIDEO_SCREEN_HEIGHT:
- mvemux->screen_height = g_value_get_uint (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstStateChangeReturn
-gst_mve_mux_change_state (GstElement * element, GstStateChange transition)
-{
- GstMveMux *mvemux;
-
- g_return_val_if_fail (GST_IS_MVE_MUX (element), GST_STATE_CHANGE_FAILURE);
-
- mvemux = GST_MVE_MUX (element);
-
- if (GST_ELEMENT_CLASS (parent_class)->change_state) {
- GstStateChangeReturn ret;
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- if (ret != GST_STATE_CHANGE_SUCCESS)
- return ret;
- }
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- gst_mve_mux_reset (mvemux);
- break;
- default:
- break;
- }
-
- return GST_STATE_CHANGE_SUCCESS;
-}
-
-static const GstBuffer *
-gst_mve_mux_palette_from_buffer (GstBuffer * buf)
-{
- const GstBuffer *palette = NULL;
- GstCaps *caps = GST_BUFFER_CAPS (buf);
-
- if (caps != NULL) {
- GstStructure *str = gst_caps_get_structure (caps, 0);
- const GValue *pal = gst_structure_get_value (str, "palette_data");
-
- if (pal != NULL) {
- palette = gst_value_get_buffer (pal);
- if (GST_BUFFER_SIZE (palette) < 256 * 4)
- palette = NULL;
- }
- }
- return palette;
-}
-
-static GstFlowReturn
-gst_mve_mux_palette_from_current_frame (GstMveMux * mvemux,
- const GstBuffer ** pal)
-{
- GstBuffer *buf = g_queue_peek_head (mvemux->video_buffer);
-
- /* get palette from buffer */
- *pal = gst_mve_mux_palette_from_buffer (buf);
- if (*pal == NULL) {
- GST_ERROR_OBJECT (mvemux, "video buffer has no palette data");
- return GST_FLOW_ERROR;
- }
- return GST_FLOW_OK;
-}
-
-static void
-gst_mve_mux_palette_analyze (GstMveMux * mvemux, const GstBuffer * pal,
- guint16 * first, guint16 * last)
-{
- gint i;
- guint32 *col1;
-
- col1 = (guint32 *) GST_BUFFER_DATA (pal);
-
- /* compare current palette against last frame */
- if (mvemux->last_frame == NULL) {
- /* ignore 0,0,0 entries but make sure we get
- at least one color */
- /* FIXME: is ignoring 0,0,0 safe? possibly depends on player impl */
- for (i = 0; i < MVE_PALETTE_COUNT; ++i) {
- if (col1[i] != 0) {
- *first = i;
- break;
- }
- }
- if (i == MVE_PALETTE_COUNT) {
- *first = *last = 0;
- } else {
- for (i = MVE_PALETTE_COUNT - 1; i >= 0; --i) {
- if (col1[i] != 0) {
- *last = i;
- break;
- }
- }
- }
- } else {
- const GstBuffer *last_pal;
- guint32 *col2;
-
- last_pal = gst_mve_mux_palette_from_buffer (mvemux->last_frame);
-
- g_return_if_fail (last_pal != NULL);
-
- col2 = (guint32 *) GST_BUFFER_DATA (last_pal);
-
- for (i = 0; i < MVE_PALETTE_COUNT; ++i) {
- if (col1[i] != col2[i]) {
- *first = i;
- break;
- }
- }
- for (i = MVE_PALETTE_COUNT - 1; i >= 0; --i) {
- if (col1[i] != col2[i]) {
- *last = i;
- break;
- }
- }
- }
-
- GST_DEBUG_OBJECT (mvemux, "palette first:%d, last:%d", *first, *last);
-}
-
-static gboolean
-gst_mve_mux_palette_changed (GstMveMux * mvemux, const GstBuffer * pal)
-{
- const GstBuffer *last_pal;
-
- g_return_val_if_fail (mvemux->last_frame != NULL, TRUE);
-
- last_pal = gst_mve_mux_palette_from_buffer (mvemux->last_frame);
- if (last_pal == NULL)
- return TRUE;
-
- return memcmp (GST_BUFFER_DATA (last_pal), GST_BUFFER_DATA (pal),
- MVE_PALETTE_COUNT * 4) != 0;
-}
-
-static GstFlowReturn
-gst_mve_mux_push_buffer (GstMveMux * mvemux, GstBuffer * buffer)
-{
- GST_BUFFER_OFFSET (buffer) = mvemux->stream_offset;
- mvemux->stream_offset += GST_BUFFER_SIZE (buffer);
- GST_BUFFER_OFFSET_END (buffer) = mvemux->stream_offset;
- return gst_pad_push (mvemux->source, buffer);
-}
-
-/* returns TRUE if audio segment is complete */
-static gboolean
-gst_mve_mux_audio_data (GstMveMux * mvemux)
-{
- gboolean complete = FALSE;
-
- while (!complete) {
- GstBuffer *buf;
- GstClockTime buftime;
- GstClockTime duration;
- GstClockTime t_needed;
- gint b_needed;
- gint len;
-
- buf = g_queue_peek_head (mvemux->audio_buffer);
- if (buf == NULL)
- return (mvemux->audio_pad_eos && mvemux->chunk_audio) ||
- (mvemux->stream_time + mvemux->frame_duration < mvemux->max_ts);
-
- buftime = GST_BUFFER_TIMESTAMP (buf);
- duration = GST_BUFFER_DURATION (buf);
-
- /* FIXME: adjust buffer timestamps using segment info */
-
- /* assume continuous buffers on invalid time stamps */
- if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (buftime)))
- buftime = mvemux->next_ts;
-
- if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (duration)))
- duration = gst_util_uint64_scale_int (mvemux->frame_duration,
- GST_BUFFER_SIZE (buf), mvemux->spf);
-
- if (mvemux->chunk_audio) {
- b_needed = mvemux->spf - mvemux->chunk_audio->len;
- t_needed = (gint) gst_util_uint64_scale_int (mvemux->frame_duration,
- b_needed, mvemux->spf);
- } else {
- b_needed = mvemux->spf;
- t_needed = mvemux->frame_duration;
- }
-
- if (buftime > mvemux->next_ts + t_needed) {
- /* future buffer - fill chunk with silence */
- GST_DEBUG_OBJECT (mvemux, "future buffer, inserting silence");
-
- /* if we already have a chunk started, fill it
- otherwise we'll simply insert a silence chunk */
- if (mvemux->chunk_audio) {
- len = mvemux->chunk_audio->len;
- g_byte_array_set_size (mvemux->chunk_audio, mvemux->spf);
- memset (mvemux->chunk_audio->data + len, 0, mvemux->spf - len);
- }
- mvemux->next_ts += t_needed;
- complete = TRUE;
- } else if (buftime + duration <= mvemux->next_ts) {
- /* past buffer - drop */
- GST_DEBUG_OBJECT (mvemux, "dropping past buffer");
- g_queue_pop_head (mvemux->audio_buffer);
- gst_buffer_unref (buf);
- } else {
- /* our data starts somewhere in this buffer */
- const guint8 *bufdata = GST_BUFFER_DATA (buf);
- gint b_available = GST_BUFFER_SIZE (buf);
- gint align = (mvemux->bps / 8) * mvemux->channels - 1;
- gint offset;
-
- if (mvemux->chunk_audio == NULL)
- mvemux->chunk_audio = g_byte_array_sized_new (mvemux->spf);
-
- if (buftime >= mvemux->next_ts) {
- /* insert silence as necessary */
- len = mvemux->chunk_audio->len;
- offset = (gint) gst_util_uint64_scale_int (mvemux->spf,
- buftime - mvemux->next_ts, mvemux->frame_duration);
- offset = (offset + align) & ~align;
-
- if (len < offset) {
- g_byte_array_set_size (mvemux->chunk_audio, offset);
- memset (mvemux->chunk_audio->data + len, 0, offset - len);
- b_needed -= offset - len;
- mvemux->next_ts += gst_util_uint64_scale_int (mvemux->frame_duration,
- offset - len, mvemux->spf);
- }
- offset = 0;
- } else {
- offset = (gint) gst_util_uint64_scale_int (mvemux->spf,
- mvemux->next_ts - buftime, mvemux->frame_duration);
- offset = (offset + align) & ~align;
- }
-
- g_assert (offset <= b_available);
-
- bufdata += offset;
- b_available -= offset;
- if (b_needed > b_available)
- b_needed = b_available;
-
- if (mvemux->bps == 8) {
- g_byte_array_append (mvemux->chunk_audio, bufdata, b_needed);
- } else {
- guint i;
- gint16 *sample = (gint16 *) bufdata;
- guint8 s[2];
-
- len = b_needed / 2;
- for (i = 0; i < len; ++i) {
- s[0] = (*sample) & 0x00FF;
- s[1] = ((*sample) & 0xFF00) >> 8;
- g_byte_array_append (mvemux->chunk_audio, s, 2);
- ++sample;
- }
- }
-
- mvemux->next_ts += gst_util_uint64_scale_int (mvemux->frame_duration,
- b_needed, mvemux->spf);
-
- if (b_available - b_needed == 0) {
- /* consumed buffer */
- GST_LOG_OBJECT (mvemux, "popping consumed buffer");
- g_queue_pop_head (mvemux->audio_buffer);
- gst_buffer_unref (buf);
- }
-
- complete = (mvemux->chunk_audio->len >= mvemux->spf);
- }
-
- if (mvemux->max_ts < mvemux->next_ts)
- mvemux->max_ts = mvemux->next_ts;
- }
-
- return complete;
-}
-
-static GstFlowReturn
-gst_mve_mux_start_movie (GstMveMux * mvemux)
-{
- GstFlowReturn res;
- GstBuffer *buf;
-
- GST_DEBUG_OBJECT (mvemux, "writing movie preamble");
-
- res = gst_pad_alloc_buffer (mvemux->source, 0,
- MVE_PREAMBLE_SIZE, GST_PAD_CAPS (mvemux->source), &buf);
-
- if (res != GST_FLOW_OK)
- return res;
-
- gst_pad_push_event (mvemux->source,
- gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_BYTES, 0, -1, 0));
-
- memcpy (GST_BUFFER_DATA (buf), mve_preamble, MVE_PREAMBLE_SIZE);
- return gst_mve_mux_push_buffer (mvemux, buf);
-}
-
-static GstFlowReturn
-gst_mve_mux_end_movie (GstMveMux * mvemux)
-{
- GstFlowReturn res;
- GstBuffer *buf;
- guint8 *bufdata;
-
- GST_DEBUG_OBJECT (mvemux, "writing movie shutdown chunk");
-
- res = gst_pad_alloc_buffer (mvemux->source, 0, 16,
- GST_PAD_CAPS (mvemux->source), &buf);
-
- if (res != GST_FLOW_OK)
- return res;
-
- bufdata = GST_BUFFER_DATA (buf);
-
- GST_WRITE_UINT16_LE (bufdata, 8); /* shutdown chunk */
- GST_WRITE_UINT16_LE (bufdata + 2, MVE_CHUNK_SHUTDOWN);
- GST_WRITE_UINT16_LE (bufdata + 4, 0); /* end movie segment */
- bufdata[6] = MVE_OC_END_OF_STREAM;
- bufdata[7] = 0;
- GST_WRITE_UINT16_LE (bufdata + 8, 0); /* end chunk segment */
- bufdata[10] = MVE_OC_END_OF_CHUNK;
- bufdata[11] = 0;
-
- GST_WRITE_UINT16_LE (bufdata + 12, 0); /* end movie chunk */
- GST_WRITE_UINT16_LE (bufdata + 14, MVE_CHUNK_END);
-
- return gst_mve_mux_push_buffer (mvemux, buf);
-}
-
-static GstFlowReturn
-gst_mve_mux_init_video_chunk (GstMveMux * mvemux, const GstBuffer * pal)
-{
- GstFlowReturn res;
- GstBuffer *buf;
- guint8 *bufdata;
- guint16 buf_size;
- guint16 first_col = 0, last_col = 0;
- guint pal_size = 0;
-
- GST_DEBUG_OBJECT (mvemux, "init-video chunk w:%d, h:%d, bpp:%d",
- mvemux->width, mvemux->height, mvemux->bpp);
-
- buf_size = 4; /* chunk header */
- buf_size += 4 + 6; /* init video mode segment */
- buf_size += 4 + 8; /* create video buffers segment */
-
- if (mvemux->bpp == 8) {
- g_return_val_if_fail (pal != NULL, GST_FLOW_ERROR);
-
- /* install palette segment */
- gst_mve_mux_palette_analyze (mvemux, pal, &first_col, &last_col);
- pal_size = (last_col - first_col + 1) * 3;
- buf_size += 4 + 4 + pal_size;
- }
-
- buf_size += 4 + 0; /* end chunk segment */
-
- res = gst_pad_alloc_buffer (mvemux->source, 0, buf_size,
- GST_PAD_CAPS (mvemux->source), &buf);
- if (res != GST_FLOW_OK)
- return res;
-
- bufdata = GST_BUFFER_DATA (buf);
-
- GST_WRITE_UINT16_LE (bufdata, buf_size - 4);
- GST_WRITE_UINT16_LE (bufdata + 2, MVE_CHUNK_INIT_VIDEO);
-
- GST_WRITE_UINT16_LE (bufdata + 4, 6);
- bufdata[6] = MVE_OC_VIDEO_MODE;
- bufdata[7] = 0;
- GST_WRITE_UINT16_LE (bufdata + 8, mvemux->screen_width); /* screen width */
- GST_WRITE_UINT16_LE (bufdata + 10, mvemux->screen_height); /* screen height */
- GST_WRITE_UINT16_LE (bufdata + 12, 0); /* ??? - flags */
-
- GST_WRITE_UINT16_LE (bufdata + 14, 8);
- bufdata[16] = MVE_OC_VIDEO_BUFFERS;
- bufdata[17] = 2;
- GST_WRITE_UINT16_LE (bufdata + 18, mvemux->width >> 3); /* buffer width */
- GST_WRITE_UINT16_LE (bufdata + 20, mvemux->height >> 3); /* buffer height */
- GST_WRITE_UINT16_LE (bufdata + 22, 1); /* buffer count */
- GST_WRITE_UINT16_LE (bufdata + 24, (mvemux->bpp >> 3) - 1); /* true color */
-
- bufdata += 26;
-
- if (mvemux->bpp == 8) {
- /* TODO: check whether we really need to update the entire palette (or at all) */
- gint i;
- guint32 *col;
-
- GST_DEBUG_OBJECT (mvemux, "installing palette");
-
- GST_WRITE_UINT16_LE (bufdata, 4 + pal_size);
- bufdata[2] = MVE_OC_PALETTE;
- bufdata[3] = 0;
- GST_WRITE_UINT16_LE (bufdata + 4, first_col); /* first color index */
- GST_WRITE_UINT16_LE (bufdata + 6, last_col - first_col + 1); /* number of colors */
-
- bufdata += 8;
- col = (guint32 *) GST_BUFFER_DATA (pal);
- for (i = first_col; i <= last_col; ++i) {
- /* convert from 8-bit palette to 6-bit VGA */
- guint32 rgb = col[i];
-
- (*bufdata) = ((rgb & 0x00FF0000) >> 16) >> 2;
- ++bufdata;
- (*bufdata) = ((rgb & 0x0000FF00) >> 8) >> 2;
- ++bufdata;
- (*bufdata) = (rgb & 0x000000FF) >> 2;
- ++bufdata;
- }
-
- mvemux->pal_changed = TRUE;
- mvemux->pal_first_color = first_col;
- mvemux->pal_colors = last_col - first_col + 1;
- }
-
- GST_WRITE_UINT16_LE (bufdata, 0);
- bufdata[2] = MVE_OC_END_OF_CHUNK;
- bufdata[3] = 0;
-
- return gst_mve_mux_push_buffer (mvemux, buf);
-}
-
-static GstFlowReturn
-gst_mve_mux_init_audio_chunk (GstMveMux * mvemux)
-{
- GstFlowReturn res;
- GstBuffer *buf;
- guint16 buf_size;
- guint8 *bufdata;
- guint16 flags = 0;
- gint align;
-
- GST_DEBUG_OBJECT (mvemux,
- "init-audio chunk rate:%d, chan:%d, bps:%d, comp:%d", mvemux->rate,
- mvemux->channels, mvemux->bps, mvemux->compression);
-
- if (G_UNLIKELY (mvemux->bps == 8 && mvemux->compression)) {
- GST_INFO_OBJECT (mvemux,
- "compression only supported for 16-bit samples, disabling");
- mvemux->compression = FALSE;
- }
-
- /* calculate sample data per frame */
- align = (mvemux->bps / 8) * mvemux->channels;
- mvemux->spf =
- (guint16) (gst_util_uint64_scale_int (align * mvemux->rate,
- mvemux->frame_duration, GST_SECOND) + align - 1) & ~(align - 1);
-
- /* prebuffer approx. 1 second of audio data */
- mvemux->lead_frames = align * mvemux->rate / mvemux->spf;
- GST_DEBUG_OBJECT (mvemux, "calculated spf:%d, lead frames:%d",
- mvemux->spf, mvemux->lead_frames);
-
- /* chunk header + init video mode segment + end chunk segment */
- buf_size = 4 + (4 + 10) + 4;
-
- res = gst_pad_alloc_buffer (mvemux->source, 0, buf_size,
- GST_PAD_CAPS (mvemux->source), &buf);
- if (res != GST_FLOW_OK)
- return res;
-
- bufdata = GST_BUFFER_DATA (buf);
-
- if (mvemux->channels == 2)
- flags |= MVE_AUDIO_STEREO;
- if (mvemux->bps == 16)
- flags |= MVE_AUDIO_16BIT;
- if (mvemux->compression)
- flags |= MVE_AUDIO_COMPRESSED;
-
- GST_WRITE_UINT16_LE (bufdata, buf_size - 4);
- GST_WRITE_UINT16_LE (bufdata + 2, MVE_CHUNK_INIT_AUDIO);
-
- GST_WRITE_UINT16_LE (bufdata + 4, 10);
- bufdata[6] = MVE_OC_AUDIO_BUFFERS;
- bufdata[7] = 1;
- GST_WRITE_UINT16_LE (bufdata + 8, 0); /* ??? */
- GST_WRITE_UINT16_LE (bufdata + 10, flags); /* flags */
- GST_WRITE_UINT16_LE (bufdata + 12, mvemux->rate); /* sample rate */
- GST_WRITE_UINT32_LE (bufdata + 14, /* minimum audio buffer size */
- mvemux->spf * mvemux->lead_frames);
-
- GST_WRITE_UINT16_LE (bufdata + 18, 0);
- bufdata[20] = MVE_OC_END_OF_CHUNK;
- bufdata[21] = 0;
-
- return gst_mve_mux_push_buffer (mvemux, buf);
-}
-
-static guint8 *
-gst_mve_mux_write_audio_segments (GstMveMux * mvemux, guint8 * data)
-{
- GByteArray *chunk = mvemux->chunk_audio;
- guint16 silent_mask;
-
- GST_LOG_OBJECT (mvemux, "writing audio data");
-
- /* audio data */
- if (chunk) {
- guint16 len = mvemux->compression ?
- chunk->len / 2 + mvemux->channels : chunk->len;
-
- silent_mask = 0xFFFE;
-
- GST_WRITE_UINT16_LE (data, 6 + len);
- data[2] = MVE_OC_AUDIO_DATA;
- data[3] = 0;
- GST_WRITE_UINT16_LE (data + 4, mvemux->audio_frames); /* frame number */
- GST_WRITE_UINT16_LE (data + 6, 0x0001); /* stream mask */
- GST_WRITE_UINT16_LE (data + 8, chunk->len); /* (uncompressed) data length */
- data += 10;
-
- if (mvemux->compression)
- mve_compress_audio (data, chunk->data, len, mvemux->channels);
- else
- memcpy (data, chunk->data, chunk->len);
- data += len;
-
- g_byte_array_free (chunk, TRUE);
- mvemux->chunk_audio = NULL;
- } else
- silent_mask = 0xFFFF;
-
- /* audio data (silent) */
- GST_WRITE_UINT16_LE (data, 6);
- data[2] = MVE_OC_AUDIO_SILENCE;
- data[3] = 0;
- GST_WRITE_UINT16_LE (data + 4, mvemux->audio_frames++); /* frame number */
- GST_WRITE_UINT16_LE (data + 6, silent_mask); /* stream mask */
- GST_WRITE_UINT16_LE (data + 8, mvemux->spf); /* (imaginary) data length */
- data += 10;
-
- return data;
-}
-
-static GstFlowReturn
-gst_mve_mux_prebuffer_audio_chunk (GstMveMux * mvemux)
-{
- GstFlowReturn ret;
- GstBuffer *chunk;
- guint16 size;
- guint8 *data;
-
- /* calculate chunk size */
- size = 4; /* chunk header */
-
- if (mvemux->chunk_audio) {
- size += 4 + 6 + /* audio data */
- (mvemux->compression ?
- mvemux->chunk_audio->len / 2 + mvemux->channels :
- mvemux->chunk_audio->len);
- }
- size += 4 + 6; /* audio data silent */
- size += 4; /* end chunk */
-
- ret = gst_pad_alloc_buffer (mvemux->source, 0, size,
- GST_PAD_CAPS (mvemux->source), &chunk);
- if (ret != GST_FLOW_OK)
- return ret;
-
- data = GST_BUFFER_DATA (chunk);
-
- /* assemble chunk */
- GST_WRITE_UINT16_LE (data, size - 4);
- GST_WRITE_UINT16_LE (data + 2, MVE_CHUNK_AUDIO_ONLY);
- data += 4;
-
- data = gst_mve_mux_write_audio_segments (mvemux, data);
-
- /* end chunk */
- GST_WRITE_UINT16_LE (data, 0);
- data[2] = MVE_OC_END_OF_CHUNK;
- data[3] = 0;
-
- if (mvemux->audio_frames >= mvemux->lead_frames)
- mvemux->state = MVE_MUX_STATE_MOVIE;
-
- mvemux->stream_time += mvemux->frame_duration;
-
- GST_DEBUG_OBJECT (mvemux, "pushing audio chunk");
-
- return gst_mve_mux_push_buffer (mvemux, chunk);
-}
-
-static GstFlowReturn
-gst_mve_mux_push_chunk (GstMveMux * mvemux)
-{
- GstFlowReturn ret;
- GstBuffer *chunk;
- GstBuffer *frame;
- guint32 size;
- guint16 cm_size = 0;
- guint8 *data;
-
- /* calculate chunk size */
- size = 4; /* chunk header */
-
- if (G_UNLIKELY (mvemux->timer == 0)) {
- /* we need to insert a timer segment */
- size += 4 + 6;
- }
-
- if (mvemux->audio_pad_connected) {
- if (mvemux->chunk_audio) {
- size += 4 + 6 + /* audio data */
- (mvemux->compression ?
- mvemux->chunk_audio->len / 2 + mvemux->channels :
- mvemux->chunk_audio->len);
- }
- size += 4 + 6; /* audio data silent */
- }
-
- size += 4 + 6; /* play video */
- size += 4; /* play audio; present even if no audio stream */
- size += 4; /* end chunk */
-
- /* we must encode video only after we have the audio side
- covered, since only then we can tell what size limit
- the video data must adhere to */
- frame = g_queue_pop_head (mvemux->video_buffer);
- if (frame != NULL) {
- cm_size = (((mvemux->width * mvemux->height) >> 6) + 1) >> 1;
- size += 4 + cm_size; /* code map */
- size += 4 + 14; /* video data header */
-
- /* make sure frame is writable since the encoder may want to modify it */
- frame = gst_buffer_make_writable (frame);
-
- if (mvemux->bpp == 8) {
- const GstBuffer *pal = gst_mve_mux_palette_from_buffer (frame);
-
- if (pal == NULL)
- ret = GST_FLOW_ERROR;
- else
- ret = mve_encode_frame8 (mvemux, frame,
- (guint32 *) GST_BUFFER_DATA (pal), G_MAXUINT16 - size);
- } else
- ret = mve_encode_frame16 (mvemux, frame, G_MAXUINT16 - size);
-
- if (mvemux->second_last_frame != NULL)
- gst_buffer_unref (mvemux->second_last_frame);
- mvemux->second_last_frame = mvemux->last_frame;
- mvemux->last_frame = frame;
-
- if (ret != GST_FLOW_OK)
- return ret;
-
- size += mvemux->chunk_video->len;
- }
-
- if (size > G_MAXUINT16) {
- GST_ELEMENT_ERROR (mvemux, STREAM, ENCODE, (NULL),
- ("encoding frame %d failed: maximum block size exceeded (%u)",
- mvemux->video_frames + 1, size));
- return GST_FLOW_ERROR;
- }
-
- ret = gst_pad_alloc_buffer (mvemux->source, 0, size,
- GST_PAD_CAPS (mvemux->source), &chunk);
- if (ret != GST_FLOW_OK)
- return ret;
-
- data = GST_BUFFER_DATA (chunk);
-
- /* assemble chunk */
- GST_WRITE_UINT16_LE (data, size - 4);
- GST_WRITE_UINT16_LE (data + 2, MVE_CHUNK_VIDEO);
- data += 4;
-
- if (G_UNLIKELY (mvemux->timer == 0)) {
- /* insert a timer segment */
- mvemux->timer = mvemux->frame_duration / GST_USECOND / 8;
-
- GST_WRITE_UINT16_LE (data, 6);
- data[2] = MVE_OC_CREATE_TIMER;
- data[3] = 0;
- GST_WRITE_UINT32_LE (data + 4, mvemux->timer); /* timer rate */
- GST_WRITE_UINT16_LE (data + 8, 8); /* timer subdivision */
- data += 10;
- }
-
- /* code map */
- if (mvemux->chunk_video) {
- GST_WRITE_UINT16_LE (data, cm_size);
- data[2] = MVE_OC_CODE_MAP;
- data[3] = 0;
- memcpy (data + 4, mvemux->chunk_code_map, cm_size);
- data += 4 + cm_size;
- }
-
- if (mvemux->audio_pad_connected)
- data = gst_mve_mux_write_audio_segments (mvemux, data);
-
- if (mvemux->chunk_video) {
- GST_LOG_OBJECT (mvemux, "writing video data");
-
- /* video data */
- GST_WRITE_UINT16_LE (data, 14 + mvemux->chunk_video->len);
- data[2] = MVE_OC_VIDEO_DATA;
- data[3] = 0;
- GST_WRITE_UINT16_LE (data + 6, mvemux->video_frames); /* previous frame */
- GST_WRITE_UINT16_LE (data + 4, ++mvemux->video_frames); /* current frame */
- GST_WRITE_UINT16_LE (data + 8, 0); /* x offset */
- GST_WRITE_UINT16_LE (data + 10, 0); /* y offset */
- GST_WRITE_UINT16_LE (data + 12, mvemux->width >> 3); /* buffer width */
- GST_WRITE_UINT16_LE (data + 14, mvemux->height >> 3); /* buffer height */
- GST_WRITE_UINT16_LE (data + 16, /* flags */
- (mvemux->video_frames == 1 ? 0 : MVE_VIDEO_DELTA_FRAME));
- memcpy (data + 18, mvemux->chunk_video->data, mvemux->chunk_video->len);
- data += 18 + mvemux->chunk_video->len;
-
- g_byte_array_free (mvemux->chunk_video, TRUE);
- mvemux->chunk_video = NULL;
- }
-
- /* play audio */
- GST_WRITE_UINT16_LE (data, 0);
- data[2] = MVE_OC_PLAY_AUDIO;
- data[3] = 0;
- data += 4;
-
- /* play video */
- GST_WRITE_UINT16_LE (data, 6);
- data[2] = MVE_OC_PLAY_VIDEO;
- data[3] = 1;
- /* this block is only set to non-zero on palette changes in 8-bit mode */
- if (mvemux->pal_changed) {
- GST_WRITE_UINT16_LE (data + 4, mvemux->pal_first_color); /* index of first color */
- GST_WRITE_UINT16_LE (data + 6, mvemux->pal_colors); /* number of colors */
- mvemux->pal_changed = FALSE;
- } else {
- GST_WRITE_UINT32_LE (data + 4, 0);
- }
- GST_WRITE_UINT16_LE (data + 8, 0); /* ??? */
- data += 10;
-
- /* end chunk */
- GST_WRITE_UINT16_LE (data, 0);
- data[2] = MVE_OC_END_OF_CHUNK;
- data[3] = 0;
-
- mvemux->chunk_has_palette = FALSE;
- mvemux->chunk_has_audio = FALSE;
- mvemux->stream_time += mvemux->frame_duration;
-
- GST_LOG_OBJECT (mvemux, "pushing video chunk");
-
- return gst_mve_mux_push_buffer (mvemux, chunk);
-}
-
-static GstFlowReturn
-gst_mve_mux_chain (GstPad * sinkpad, GstBuffer * inbuf)
-{
- GstMveMux *mvemux = GST_MVE_MUX (GST_PAD_PARENT (sinkpad));
- GstFlowReturn ret = GST_FLOW_OK;
- const GstBuffer *palette;
- gboolean audio_ok, video_ok;
-
- /* need to serialize the buffers */
- g_mutex_lock (mvemux->lock);
-
- if (G_LIKELY (inbuf != NULL)) { /* TODO: see _sink_event... */
- if (sinkpad == mvemux->audiosink)
- g_queue_push_tail (mvemux->audio_buffer, inbuf);
- else if (sinkpad == mvemux->videosink)
- g_queue_push_tail (mvemux->video_buffer, inbuf);
- else
- g_assert_not_reached ();
- }
-
- /* TODO: this is gross... */
- if (G_UNLIKELY (mvemux->state == MVE_MUX_STATE_INITIAL)) {
- GST_DEBUG_OBJECT (mvemux, "waiting for caps");
- goto done;
- }
-
- /* now actually try to mux something */
- if (G_UNLIKELY (mvemux->state == MVE_MUX_STATE_CONNECTED)) {
- palette = NULL;
-
- if (mvemux->bpp == 8) {
- /* we need to add palette info to the init chunk */
- if (g_queue_is_empty (mvemux->video_buffer))
- goto done; /* wait for more data */
-
- ret = gst_mve_mux_palette_from_current_frame (mvemux, &palette);
- if (ret != GST_FLOW_OK)
- goto done;
- }
-
- gst_mve_mux_start_movie (mvemux);
- gst_mve_mux_init_video_chunk (mvemux, palette);
- mvemux->chunk_has_palette = TRUE;
-
- if (mvemux->audio_pad_connected) {
- gst_mve_mux_init_audio_chunk (mvemux);
-
- mvemux->state = MVE_MUX_STATE_PREBUFFER;
- } else
- mvemux->state = MVE_MUX_STATE_MOVIE;
- }
-
- while ((mvemux->state == MVE_MUX_STATE_PREBUFFER) && (ret == GST_FLOW_OK) &&
- gst_mve_mux_audio_data (mvemux)) {
- ret = gst_mve_mux_prebuffer_audio_chunk (mvemux);
- }
-
- if (G_LIKELY (mvemux->state >= MVE_MUX_STATE_MOVIE)) {
- audio_ok = !mvemux->audio_pad_connected ||
- !g_queue_is_empty (mvemux->audio_buffer) ||
- (mvemux->audio_pad_eos && (mvemux->stream_time <= mvemux->max_ts));
- video_ok = !g_queue_is_empty (mvemux->video_buffer) ||
- (mvemux->video_pad_eos &&
- (!mvemux->audio_pad_eos || (mvemux->stream_time <= mvemux->max_ts)));
-
- while ((ret == GST_FLOW_OK) && audio_ok && video_ok) {
-
- if (!g_queue_is_empty (mvemux->video_buffer)) {
- if ((mvemux->bpp == 8) && !mvemux->chunk_has_palette) {
- ret = gst_mve_mux_palette_from_current_frame (mvemux, &palette);
- if (ret != GST_FLOW_OK)
- goto done;
-
- if (gst_mve_mux_palette_changed (mvemux, palette))
- gst_mve_mux_init_video_chunk (mvemux, palette);
- mvemux->chunk_has_palette = TRUE;
- }
- }
-
- /* audio data */
- if (mvemux->audio_pad_connected && !mvemux->chunk_has_audio &&
- gst_mve_mux_audio_data (mvemux))
- mvemux->chunk_has_audio = TRUE;
-
- if ((!g_queue_is_empty (mvemux->video_buffer) || mvemux->video_pad_eos) &&
- (mvemux->chunk_has_audio || !mvemux->audio_pad_connected
- || mvemux->audio_pad_eos)) {
- ret = gst_mve_mux_push_chunk (mvemux);
- }
-
- audio_ok = !mvemux->audio_pad_connected ||
- !g_queue_is_empty (mvemux->audio_buffer) ||
- (mvemux->audio_pad_eos && (mvemux->stream_time <= mvemux->max_ts));
- video_ok = !g_queue_is_empty (mvemux->video_buffer) ||
- (mvemux->video_pad_eos &&
- (!mvemux->audio_pad_eos || (mvemux->stream_time <= mvemux->max_ts)));
- }
- }
-
- if (G_UNLIKELY ((mvemux->state == MVE_MUX_STATE_EOS) && (ret == GST_FLOW_OK))) {
- ret = gst_mve_mux_end_movie (mvemux);
- gst_pad_push_event (mvemux->source, gst_event_new_eos ());
- }
-
-done:
- g_mutex_unlock (mvemux->lock);
- return ret;
-}
-
-static gboolean
-gst_mve_mux_sink_event (GstPad * pad, GstEvent * event)
-{
- gboolean res = TRUE;
- GstMveMux *mvemux = GST_MVE_MUX (GST_PAD_PARENT (pad));
-
- GST_DEBUG_OBJECT (mvemux, "got %s event for pad %s",
- GST_EVENT_TYPE_NAME (event), GST_PAD_NAME (pad));
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_EOS:
- if (pad == mvemux->audiosink) {
- mvemux->audio_pad_eos = TRUE;
-
- if (mvemux->state == MVE_MUX_STATE_PREBUFFER)
- mvemux->state = MVE_MUX_STATE_MOVIE;
- } else if (pad == mvemux->videosink)
- mvemux->video_pad_eos = TRUE;
-
- /* TODO: this is evil */
- if (mvemux->audio_pad_eos && mvemux->video_pad_eos) {
- mvemux->state = MVE_MUX_STATE_EOS;
- gst_mve_mux_chain (pad, NULL);
- }
- gst_event_unref (event);
- break;
- case GST_EVENT_NEWSEGMENT:
- if (pad == mvemux->audiosink) {
- GstFormat format;
- gint64 start;
- gboolean update;
-
- gst_event_parse_new_segment (event, &update, NULL, &format, &start,
- NULL, NULL);
- if ((format == GST_FORMAT_TIME) && update && (start > mvemux->max_ts))
- mvemux->max_ts = start;
- }
- gst_event_unref (event);
- break;
- default:
- res = gst_pad_event_default (pad, event);
- break;
- }
-
- return res;
-}
-
-static gboolean
-gst_mve_mux_vidsink_set_caps (GstPad * pad, GstCaps * vscaps)
-{
- GstMveMux *mvemux;
- GstStructure *structure;
- GstClockTime duration;
- const GValue *fps;
- gint w, h, bpp;
- gboolean ret;
-
- mvemux = GST_MVE_MUX (GST_PAD_PARENT (pad));
-
- GST_DEBUG_OBJECT (mvemux, "video set_caps triggered on %s",
- GST_PAD_NAME (pad));
-
- structure = gst_caps_get_structure (vscaps, 0);
-
- ret = gst_structure_get_int (structure, "width", &w);
- ret &= gst_structure_get_int (structure, "height", &h);
- ret &= gst_structure_get_int (structure, "bpp", &bpp);
- fps = gst_structure_get_value (structure, "framerate");
- ret &= (fps != NULL && GST_VALUE_HOLDS_FRACTION (fps));
-
- duration = gst_util_uint64_scale_int (GST_SECOND,
- gst_value_get_fraction_denominator (fps),
- gst_value_get_fraction_numerator (fps));
-
- if (!ret)
- return FALSE;
-
- /* don't allow changing width, height, bpp, or framerate */
- if (mvemux->state != MVE_MUX_STATE_INITIAL) {
- if (mvemux->width != w || mvemux->height != h ||
- mvemux->bpp != bpp || mvemux->frame_duration != duration) {
- GST_ERROR_OBJECT (mvemux, "caps renegotiation not allowed");
- return FALSE;
- }
- } else {
- if (w % 8 != 0 || h % 8 != 0) {
- GST_ERROR_OBJECT (mvemux, "width and height must be multiples of 8");
- return FALSE;
- }
-
- mvemux->width = w;
- mvemux->height = h;
- mvemux->bpp = bpp;
- mvemux->frame_duration = duration;
-
- if (mvemux->screen_width < w) {
- GST_INFO_OBJECT (mvemux, "setting suggested screen width to %d", w);
- mvemux->screen_width = w;
- }
- if (mvemux->screen_height < h) {
- GST_INFO_OBJECT (mvemux, "setting suggested screen height to %d", h);
- mvemux->screen_height = h;
- }
-
- g_free (mvemux->chunk_code_map);
- mvemux->chunk_code_map = g_malloc ((((w * h) >> 6) + 1) >> 1);
-
- /* audio caps already initialized? */
- if (mvemux->bps != 0 || !mvemux->audio_pad_connected)
- mvemux->state = MVE_MUX_STATE_CONNECTED;
- }
-
- return TRUE;
-}
-
-static gboolean
-gst_mve_mux_audsink_set_caps (GstPad * pad, GstCaps * ascaps)
-{
- GstMveMux *mvemux;
- GstStructure *structure;
- gboolean ret;
- gint val;
-
- mvemux = GST_MVE_MUX (GST_PAD_PARENT (pad));
-
- GST_DEBUG_OBJECT (mvemux, "audio set_caps triggered on %s",
- GST_PAD_NAME (pad));
-
- /* don't allow caps renegotiation for now */
- if (mvemux->state != MVE_MUX_STATE_INITIAL)
- return FALSE;
-
- structure = gst_caps_get_structure (ascaps, 0);
-
- ret = gst_structure_get_int (structure, "channels", &val);
- mvemux->channels = val;
- ret &= gst_structure_get_int (structure, "rate", &val);
- mvemux->rate = val;
- ret &= gst_structure_get_int (structure, "width", &val);
- mvemux->bps = val;
-
- /* video caps already initialized? */
- if (mvemux->bpp != 0)
- mvemux->state = MVE_MUX_STATE_CONNECTED;
-
- return ret;
-}
-
-static GstPad *
-gst_mve_mux_request_new_pad (GstElement * element,
- GstPadTemplate * templ, const gchar * req_name)
-{
- GstMveMux *mvemux = GST_MVE_MUX (element);
- GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
- GstPad *pad;
-
- g_return_val_if_fail (templ != NULL, NULL);
-
- if (templ->direction != GST_PAD_SINK) {
- GST_WARNING_OBJECT (mvemux, "request pad is not a SINK pad");
- return NULL;
- }
-
- if (templ == gst_element_class_get_pad_template (klass, "audio")) {
- if (mvemux->audiosink)
- return NULL;
-
- mvemux->audiosink = gst_pad_new_from_template (templ, "audio");
- gst_pad_set_setcaps_function (mvemux->audiosink,
- GST_DEBUG_FUNCPTR (gst_mve_mux_audsink_set_caps));
- mvemux->audio_pad_eos = FALSE;
- pad = mvemux->audiosink;
- } else if (templ == gst_element_class_get_pad_template (klass, "video")) {
- if (mvemux->videosink)
- return NULL;
-
- mvemux->videosink = gst_pad_new_from_template (templ, "video");
- gst_pad_set_setcaps_function (mvemux->videosink,
- GST_DEBUG_FUNCPTR (gst_mve_mux_vidsink_set_caps));
- mvemux->video_pad_eos = FALSE;
- pad = mvemux->videosink;
- } else {
- g_return_val_if_reached (NULL);
- }
-
- gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_mve_mux_chain));
- gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_mve_mux_sink_event));
-
- g_signal_connect (pad, "linked", G_CALLBACK (gst_mve_mux_pad_link), mvemux);
- g_signal_connect (pad, "unlinked", G_CALLBACK (gst_mve_mux_pad_unlink),
- mvemux);
-
- gst_element_add_pad (element, pad);
- return pad;
-}
-
-static void
-gst_mve_mux_release_pad (GstElement * element, GstPad * pad)
-{
- GstMveMux *mvemux = GST_MVE_MUX (element);
-
- gst_element_remove_pad (element, pad);
-
- if (pad == mvemux->audiosink) {
- mvemux->audiosink = NULL;
- mvemux->audio_pad_connected = FALSE;
- } else if (pad == mvemux->videosink) {
- mvemux->videosink = NULL;
- mvemux->video_pad_connected = FALSE;
- }
-}
-
-static void
-gst_mve_mux_base_init (GstMveMuxClass * klass)
-{
-
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_static_pad_template (element_class, &src_factory);
- gst_element_class_add_static_pad_template (element_class,
- &audio_sink_factory);
- gst_element_class_add_static_pad_template (element_class,
- &video_sink_factory);
-
- gst_element_class_set_static_metadata (element_class, "MVE Multiplexer",
- "Codec/Muxer",
- "Muxes audio and video into an MVE stream",
- "Jens Granseuer <jensgr@gmx.net>");
-}
-
-static void
-gst_mve_mux_finalize (GObject * object)
-{
- GstMveMux *mvemux = GST_MVE_MUX (object);
-
- if (mvemux->lock) {
- g_mutex_free (mvemux->lock);
- mvemux->lock = NULL;
- }
-
- if (mvemux->audio_buffer) {
- g_queue_free (mvemux->audio_buffer);
- mvemux->audio_buffer = NULL;
- }
-
- if (mvemux->video_buffer) {
- g_queue_free (mvemux->video_buffer);
- mvemux->video_buffer = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_mve_mux_class_init (GstMveMuxClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
-
- gobject_class = G_OBJECT_CLASS (klass);
- gstelement_class = GST_ELEMENT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->finalize = gst_mve_mux_finalize;
-
- gobject_class->get_property = gst_mve_mux_get_property;
- gobject_class->set_property = gst_mve_mux_set_property;
-
- g_object_class_install_property (gobject_class, PROP_AUDIO_COMPRESSION,
- g_param_spec_boolean ("compression", "Audio compression",
- "Whether to compress audio data", MVE_MUX_DEFAULT_COMPRESSION,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_VIDEO_QUICK_ENCODING,
- g_param_spec_boolean ("quick", "Quick encoding",
- "Whether to disable expensive encoding operations", TRUE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_VIDEO_SCREEN_WIDTH,
- g_param_spec_uint ("screen-width", "Screen width",
- "Suggested screen width", 320, 1600,
- MVE_MUX_DEFAULT_SCREEN_WIDTH,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, PROP_VIDEO_SCREEN_HEIGHT,
- g_param_spec_uint ("screen-height", "Screen height",
- "Suggested screen height", 200, 1200,
- MVE_MUX_DEFAULT_SCREEN_HEIGHT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gstelement_class->request_new_pad = gst_mve_mux_request_new_pad;
- gstelement_class->release_pad = gst_mve_mux_release_pad;
-
- gstelement_class->change_state = gst_mve_mux_change_state;
-}
-
-static void
-gst_mve_mux_init (GstMveMux * mvemux)
-{
- GstElementClass *klass = GST_ELEMENT_GET_CLASS (mvemux);
-
- mvemux->source =
- gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
- "src"), "src");
- gst_element_add_pad (GST_ELEMENT (mvemux), mvemux->source);
-
- mvemux->lock = g_mutex_new ();
-
- mvemux->audiosink = NULL;
- mvemux->videosink = NULL;
- mvemux->audio_pad_connected = FALSE;
- mvemux->video_pad_connected = FALSE;
-
- /* audio/video metadata initialisation */
- mvemux->last_frame = NULL;
- mvemux->second_last_frame = NULL;
- mvemux->chunk_code_map = NULL;
- mvemux->chunk_video = NULL;
- mvemux->chunk_audio = NULL;
- mvemux->audio_buffer = NULL;
- mvemux->video_buffer = NULL;
-
- gst_mve_mux_reset (mvemux);
-}
-
-GType
-gst_mve_mux_get_type (void)
-{
- static GType mvemux_type = 0;
-
- if (!mvemux_type) {
- static const GTypeInfo mvemux_info = {
- sizeof (GstMveMuxClass),
- (GBaseInitFunc) gst_mve_mux_base_init,
- NULL,
- (GClassInitFunc) gst_mve_mux_class_init,
- NULL,
- NULL,
- sizeof (GstMveMux),
- 0,
- (GInstanceInitFunc) gst_mve_mux_init,
- };
-
- GST_DEBUG_CATEGORY_INIT (mvemux_debug, "mvemux",
- 0, "Interplay MVE movie muxer");
-
- mvemux_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstMveMux", &mvemux_info, 0);
- }
- return mvemux_type;
-}
diff --git a/gst/mve/gstmvemux.h b/gst/mve/gstmvemux.h
deleted file mode 100644
index 45fcad1b0..000000000
--- a/gst/mve/gstmvemux.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Interplay MVE muxer plugin for GStreamer
- * Copyright (C) 2006 Jens Granseuer <jensgr@gmx.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_MVE_MUX_H__
-#define __GST_MVE_MUX_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_MVE_MUX \
- (gst_mve_mux_get_type())
-#define GST_MVE_MUX(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MVE_MUX,GstMveMux))
-#define GST_MVE_MUX_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MVE_MUX,GstMveMux))
-#define GST_IS_MVE_MUX(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MVE_MUX))
-#define GST_IS_MVE_MUX_CLASS(obj) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MVE_MUX))
-
-
-typedef struct _GstMveMux GstMveMux;
-typedef struct _GstMveMuxClass GstMveMuxClass;
-
-struct _GstMveMux {
- GstElement element;
- GMutex *lock;
-
- /* pads */
- GstPad *source;
- GstPad *videosink;
- GstPad *audiosink;
-
- gboolean audio_pad_connected;
- gboolean audio_pad_eos;
- gboolean video_pad_connected;
- gboolean video_pad_eos;
-
- guint64 stream_offset;
- /* audio stream time, really */
- GstClockTime stream_time;
- guint timer;
- gint state;
-
- /* ticks per frame */
- GstClockTime frame_duration;
-
- /* video stream properties */
- guint16 width, height;
- guint16 screen_width, screen_height;
- /* bits per pixel */
- guint8 bpp;
- /* previous frames */
- GstBuffer *last_frame;
- GstBuffer *second_last_frame;
- /* number of encoded frames */
- guint16 video_frames;
- /* palette handling */
- gboolean pal_changed;
- guint16 pal_first_color;
- guint16 pal_colors;
- /* whether to use expensive opcodes */
- gboolean quick_encoding;
-
- /* audio stream properties */
- /* bits per sample */
- guint8 bps;
- guint32 rate;
- guint8 channels;
- gboolean compression;
- /* current audio stream time */
- GstClockTime next_ts;
- /* maximum audio time we know about */
- GstClockTime max_ts;
- /* sample bytes per frame */
- guint16 spf;
- /* number of frames to use for audio lead-in */
- guint16 lead_frames;
- /* number of encoded frames */
- guint16 audio_frames;
-
- /* current chunk */
- guint8 *chunk_code_map;
- GByteArray *chunk_video;
- GByteArray *chunk_audio;
- gboolean chunk_has_palette;
- gboolean chunk_has_audio;
-
- /* buffers for incoming data */
- GQueue *audio_buffer;
- GQueue *video_buffer;
-};
-
-struct _GstMveMuxClass {
- GstElementClass parent_class;
-};
-
-GType gst_mve_mux_get_type (void);
-
-GstFlowReturn mve_encode_frame8 (GstMveMux * mve,
- GstBuffer * frame, const guint32 * palette, guint16 max_data);
-GstFlowReturn mve_encode_frame16 (GstMveMux * mve,
- GstBuffer * frame, guint16 max_data);
-gint mve_compress_audio (guint8 * dest,
- const guint8 * src, guint16 len, guint8 channels);
-
-G_END_DECLS
-
-#endif /* __GST_MVE_MUX_H__ */
diff --git a/gst/mve/meson.build b/gst/mve/meson.build
deleted file mode 100644
index ce389044e..000000000
--- a/gst/mve/meson.build
+++ /dev/null
@@ -1,20 +0,0 @@
-mve_sources = [
- 'gstmve.c',
- 'gstmvemux.c',
- 'gstmvedemux.c',
- 'mveaudiodec.c',
- 'mvevideodec8.c',
- 'mvevideodec16.c',
- 'mveaudioenc.c',
- 'mvevideoenc8.c',
- 'mvevideoenc16.c',
-]
-
-gstmve = library('gstmve',
- mve_sources,
- c_args : gst_plugins_bad_args,
- include_directories : [configinc, libsinc],
- dependencies : [gstbase_dep, libm],
- install : true,
- install_dir : plugins_install_dir,
-)
diff --git a/gst/mve/mve.h b/gst/mve/mve.h
deleted file mode 100644
index 68ba7b81b..000000000
--- a/gst/mve/mve.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Interplay MVE movie definitions
- *
- * Copyright (C) 2006 Jens Granseuer <jensgr@gmx.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __MVE_H__
-#define __MVE_H__
-
-#define MVE_PREAMBLE "Interplay MVE File\032\000\032\000\000\001\063\021"
-#define MVE_PREAMBLE_SIZE 26
-
-#define MVE_PALETTE_COUNT 256
-
-/* MVE chunk types */
-#define MVE_CHUNK_INIT_AUDIO 0x0000
-#define MVE_CHUNK_AUDIO_ONLY 0x0001
-#define MVE_CHUNK_INIT_VIDEO 0x0002
-#define MVE_CHUNK_VIDEO 0x0003
-#define MVE_CHUNK_SHUTDOWN 0x0004
-#define MVE_CHUNK_END 0x0005
-
-/* MVE segment opcodes */
-#define MVE_OC_END_OF_STREAM 0x00
-#define MVE_OC_END_OF_CHUNK 0x01
-#define MVE_OC_CREATE_TIMER 0x02
-#define MVE_OC_AUDIO_BUFFERS 0x03
-#define MVE_OC_PLAY_AUDIO 0x04
-#define MVE_OC_VIDEO_BUFFERS 0x05
-#define MVE_OC_PLAY_VIDEO 0x07
-#define MVE_OC_AUDIO_DATA 0x08
-#define MVE_OC_AUDIO_SILENCE 0x09
-#define MVE_OC_VIDEO_MODE 0x0A
-#define MVE_OC_PALETTE 0x0C
-#define MVE_OC_PALETTE_COMPRESSED 0x0D
-#define MVE_OC_CODE_MAP 0x0F
-#define MVE_OC_VIDEO_DATA 0x11
-
-/* audio flags */
-#define MVE_AUDIO_STEREO 0x0001
-#define MVE_AUDIO_16BIT 0x0002
-#define MVE_AUDIO_COMPRESSED 0x0004
-
-/* video flags */
-#define MVE_VIDEO_DELTA_FRAME 0x0001
-
-#endif /* __MVE_H__ */
diff --git a/gst/mve/mveaudiodec.c b/gst/mve/mveaudiodec.c
deleted file mode 100644
index 51d47b17e..000000000
--- a/gst/mve/mveaudiodec.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2003 The ffmpeg Project, Mike Melanson
- *
- * This library is free software; you can redistribute it 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Interplay compressed audio codec by Mike Melanson (melanson@pcisys.net)
- */
-
-#include "gstmvedemux.h"
-
-static const short delta_table[256] = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 47, 51, 56, 61,
- 66, 72, 79, 86, 94, 102, 112, 122, 133, 145, 158, 173, 189, 206, 225, 245,
- 267, 292, 318, 348, 379, 414, 452, 493, 538, 587, 640, 699, 763, 832, 908,
- 991,
- 1081, 1180, 1288, 1405, 1534, 1673, 1826, 1993, 2175, 2373, 2590, 2826, 3084,
- 3365, 3672, 4008,
- 4373, 4772, 5208, 5683, 6202, 6767, 7385, 8059, 8794, 9597, 10472, 11428,
- 12471, 13609, 14851, 16206,
- 17685, 19298, 21060, 22981, 25078, 27367, 29864, 32589, -29973, -26728,
- -23186, -19322, -15105, -10503, -5481, -1,
- 1, 1, 5481, 10503, 15105, 19322, 23186, 26728, 29973, -32589, -29864, -27367,
- -25078, -22981, -21060, -19298,
- -17685, -16206, -14851, -13609, -12471, -11428, -10472, -9597, -8794, -8059,
- -7385, -6767, -6202, -5683, -5208, -4772,
- -4373, -4008, -3672, -3365, -3084, -2826, -2590, -2373, -2175, -1993, -1826,
- -1673, -1534, -1405, -1288, -1180,
- -1081, -991, -908, -832, -763, -699, -640, -587, -538, -493, -452, -414, -379,
- -348, -318, -292,
- -267, -245, -225, -206, -189, -173, -158, -145, -133, -122, -112, -102, -94,
- -86, -79, -72,
- -66, -61, -56, -51, -47, -43, -42, -41, -40, -39, -38, -37, -36, -35, -34,
- -33,
- -32, -31, -30, -29, -28, -27, -26, -25, -24, -23, -22, -21, -20, -19, -18,
- -17,
- -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1
-};
-
-void
-ipaudio_uncompress (short *buffer, unsigned short buf_len,
- const unsigned char *data, unsigned char channels)
-{
- int i, out = 0;
- int predictor[2];
- int channel_number = 0;
-
- for (i = 0; i < channels; ++i) {
- predictor[i] = GST_READ_UINT16_LE (data);
- data += 2;
- if (predictor[i] & 0x8000)
- predictor[i] -= 0x10000;
- buffer[out++] = predictor[i];
- }
-
- /* we count in 16-bit ints, so adjust the buffer size */
- buf_len /= 2;
- while (out < buf_len) {
- predictor[channel_number] += delta_table[*data++];
- if (predictor[channel_number] < -32768)
- predictor[channel_number] = -32768;
- else if (predictor[channel_number] > 32767)
- predictor[channel_number] = 32767;
- buffer[out++] = predictor[channel_number];
-
- /* toggle channel */
- channel_number ^= channels - 1;
- }
-}
diff --git a/gst/mve/mveaudioenc.c b/gst/mve/mveaudioenc.c
deleted file mode 100644
index 1cff20a71..000000000
--- a/gst/mve/mveaudioenc.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Interplay MVE audio compressor
- * Copyright (C) 2003, 2004 Alexander Belyakov <abel@krasu.ru>
- * Copyright (C) 2006 Jens Granseuer <jensgr@gmx.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <math.h>
-#include <stdlib.h>
-
-#include "gstmvemux.h"
-
-static const gint32 dec_table[256] = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19,
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37,
- 38, 39, 40, 41, 42, 43, 47, 51, 56, 61,
- 66, 72, 79, 86, 94, 102, 112,
- 122, 133, 145, 158, 173, 189, 206, 225, 245,
- 267, 292, 318, 348, 379,
- 414, 452, 493, 538, 587, 640, 699, 763, 832, 908, 991,
- 1081, 1180, 1288,
- 1405, 1534, 1673, 1826, 1993, 2175, 2373, 2590, 2826, 3084, 3365, 3672,
- 4008,
- 4373, 4772, 5208, 5683, 6202, 6767, 7385, 8059, 8794, 9597, 10472,
- 11428, 12471, 13609, 14851, 16206,
- 17685, 19298, 21060, 22981, 25078,
- 27367, 29864, 32589, 35563, 38808, 42350, 46214, 50431, 55033, 60055,
- 65535,
- 1, -65535, -60055, -55033, -50431, -46214, -42350, -38808, -35563,
- -32589, -29864, -27367, -25078, -22981, -21060, -19298,
- -17685, -16206,
- -14851, -13609, -12471, -11428, -10472, -9597, -8794, -8059, -7385, -6767,
- -6202, -5683, -5208, -4772,
- -4373, -4008, -3672, -3365, -3084, -2826,
- -2590, -2373, -2175, -1993, -1826, -1673, -1534, -1405, -1288, -1180,
-
- -1081, -991, -908, -832, -763, -699, -640, -587, -538, -493, -452, -414,
- -379, -348, -318, -292,
- -267, -245, -225, -206, -189, -173, -158, -145,
- -133, -122, -112, -102, -94, -86, -79, -72,
- -66, -61, -56, -51, -47, -43,
- -42, -41, -40, -39, -38, -37, -36, -35, -34, -33,
- -32, -31, -30, -29,
- -28, -27, -26, -25, -24, -23, -22, -21, -20, -19, -18, -17,
- -16, -15,
- -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1
-};
-
-
-
-/* This value could be non-optimal. Without knowledge of the value
- distribution in the real signal, the actual optimum cannot be evaluated.
- Should be somewhere between 11.458 and 11.542. */
-static const gdouble DPCM_SCALE = 11.5131;
-
-static gint8
-mve_enc_delta (guint n)
-{
- if (n < 44)
- return n;
- return floor (DPCM_SCALE * log (n));
-}
-
-gint
-mve_compress_audio (guint8 * dest, const guint8 * src, guint16 len,
- guint8 channels)
-{
- gint16 prev[2], s;
- gint delta, real_res;
- gint cur_chan;
- guint8 v;
-
- for (cur_chan = 0; cur_chan < channels; ++cur_chan) {
- prev[cur_chan] = GST_READ_UINT16_LE (src);
- GST_WRITE_UINT16_LE (dest, prev[cur_chan]);
- src += 2;
- dest += 2;
- len -= 2;
- }
-
- cur_chan = 0;
- while (len > 0) {
- s = GST_READ_UINT16_LE (src);
- src += 2;
-
- delta = s - prev[cur_chan];
-
- if (delta >= 0)
-
- v = mve_enc_delta (delta);
-
- else
-
- v = 256 - mve_enc_delta (-delta);
-
-
- real_res = dec_table[v] + prev[cur_chan];
-
- if (real_res < -32768 || real_res > 32767) {
-
- /* correct overflow */
- /* GST_DEBUG ("co:%d + %d = %d -> new v:%d, dec_table:%d will be %d",
- prev[cur_chan], dec_table[v], real_res,
- v, dec_table[v], prev[cur_chan]+dec_table[v]); */
- if (s > 0) {
-
- if (real_res > 32767)
- --v;
-
- } else {
-
- if (real_res < -32768)
- ++v;
-
- }
-
- real_res = dec_table[v] + prev[cur_chan];
-
- }
-
- if (G_UNLIKELY (abs (real_res - s) > 32767)) {
- GST_ERROR ("sign loss left unfixed in audio stream, deviation:%d",
- real_res - s);
- return -1;
- }
-
-
- *dest++ = v;
-
- --len;
- /* use previous output instead of input. That way output will not go too far from input. */
- prev[cur_chan] += dec_table[v];
- cur_chan = channels - 1 - cur_chan;
-
- }
-
- return 0;
-}
diff --git a/gst/mve/mvevideodec16.c b/gst/mve/mvevideodec16.c
deleted file mode 100644
index e045a0b11..000000000
--- a/gst/mve/mvevideodec16.c
+++ /dev/null
@@ -1,849 +0,0 @@
-/*
- * Interplay MVE Video Decoder (16 bit)
- * Copyright (C) 2003 the ffmpeg project, Mike Melanson
- * (C) 2006 Jens Granseuer
- *
- * This library is free software; you can redistribute it 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * For more information about the Interplay MVE format, visit:
- * http://www.pcisys.net/~melanson/codecs/interplay-mve.txt
- */
-
-#include "gstmvedemux.h"
-#include <string.h>
-
-#define PIXEL(s) GST_READ_UINT16_LE (s)
-
-#define CHECK_STREAM(l, n) \
- do { \
- if (G_UNLIKELY (*(l) < (n))) { \
- GST_ERROR ("wanted to read %d bytes from stream, %d available", (n), *(l)); \
- return -1; \
- } \
- *(l) -= (n); \
- } while (0)
-
-/* copy an 8x8 block from the stream to the frame buffer */
-static int
-ipvideo_copy_block (const GstMveDemuxStream * s, unsigned short *frame,
- const unsigned short *src, int offset)
-{
- int i;
- int frame_offset;
-
- frame_offset = frame - (unsigned short *) s->back_buf1 + offset;
-
- if (G_UNLIKELY (frame_offset < 0)) {
- GST_ERROR ("frame offset < 0 (%d)", frame_offset);
- return -1;
- } else if (G_UNLIKELY (frame_offset > s->max_block_offset)) {
- GST_ERROR ("frame offset above limit (%d > %u)",
- frame_offset, s->max_block_offset);
- return -1;
- }
-
- for (i = 0; i < 8; ++i) {
- memcpy (frame, src, 16);
- frame += s->width;
- src += s->width;
- }
-
- return 0;
-}
-
-static int
-ipvideo_decode_0x2 (const GstMveDemuxStream * s, unsigned short *frame,
- const unsigned char **data, unsigned short *len)
-{
- unsigned char B;
- int x, y;
- int offset;
-
- /* copy block from 2 frames ago using a motion vector */
- CHECK_STREAM (len, 1);
- B = *(*data)++;
-
- if (B < 56) {
- x = 8 + (B % 7);
- y = B / 7;
- } else {
- x = -14 + ((B - 56) % 29);
- y = 8 + ((B - 56) / 29);
- }
- offset = y * s->width + x;
-
- return ipvideo_copy_block (s, frame, frame + offset, offset);
-}
-
-static int
-ipvideo_decode_0x3 (const GstMveDemuxStream * s, unsigned short *frame,
- const unsigned char **data, unsigned short *len)
-{
- unsigned char B;
- int x, y;
- int offset;
-
- /* copy 8x8 block from current frame from an up/left block */
- CHECK_STREAM (len, 1);
- B = *(*data)++;
-
- if (B < 56) {
- x = -(8 + (B % 7));
- y = -(B / 7);
- } else {
- x = -(-14 + ((B - 56) % 29));
- y = -(8 + ((B - 56) / 29));
- }
- offset = y * s->width + x;
-
- return ipvideo_copy_block (s, frame, frame + offset, offset);
-}
-
-static int
-ipvideo_decode_0x4 (const GstMveDemuxStream * s, unsigned short *frame,
- const unsigned char **data, unsigned short *len)
-{
- int x, y;
- unsigned char B;
- int offset;
-
- /* copy a block from the previous frame */
- CHECK_STREAM (len, 1);
- B = *(*data)++;
- x = -8 + (B & 0x0F);
- y = -8 + (B >> 4);
- offset = y * s->width + x;
-
- return ipvideo_copy_block (s, frame, frame +
- ((unsigned short *) s->back_buf2 - (unsigned short *) s->back_buf1) +
- offset, offset);
-}
-
-static int
-ipvideo_decode_0x5 (const GstMveDemuxStream * s, unsigned short *frame,
- const unsigned char **data, unsigned short *len)
-{
- signed char x, y;
- int offset;
-
- /* copy a block from the previous frame using an expanded range */
- CHECK_STREAM (len, 2);
- x = (signed char) *(*data)++;
- y = (signed char) *(*data)++;
- offset = y * s->width + x;
-
- return ipvideo_copy_block (s, frame, frame +
- ((unsigned short *) s->back_buf2 - (unsigned short *) s->back_buf1) +
- offset, offset);
-}
-
-static int
-ipvideo_decode_0x7 (const GstMveDemuxStream * s, unsigned short *frame,
- const unsigned char **data, unsigned short *len)
-{
- int x, y;
- unsigned short P0, P1;
- unsigned int flags;
- int bitmask;
-
- /* 2-color encoding */
- CHECK_STREAM (len, 4 + 2);
- P0 = PIXEL (*data);
- (*data) += 2;
- P1 = PIXEL (*data);
- (*data) += 2;
-
- if (!(P0 & 0x8000)) {
-
- /* need 8 more bytes from the stream */
- CHECK_STREAM (len, 8 - 2);
-
- for (y = 0; y < 8; ++y) {
- flags = *(*data)++;
- for (x = 0x01; x <= 0x80; x <<= 1) {
- if (flags & x)
- *frame++ = P1;
- else
- *frame++ = P0;
- }
- frame += s->width - 8;
- }
-
- } else {
- P0 &= ~0x8000;
-
- /* need 2 more bytes from the stream */
-
- flags = ((*data)[1] << 8) | (*data)[0];
- (*data) += 2;
- bitmask = 0x0001;
- for (y = 0; y < 8; y += 2) {
- for (x = 0; x < 8; x += 2, bitmask <<= 1) {
- if (flags & bitmask) {
- *(frame + x) = P1;
- *(frame + x + 1) = P1;
- *(frame + s->width + x) = P1;
- *(frame + s->width + x + 1) = P1;
- } else {
- *(frame + x) = P0;
- *(frame + x + 1) = P0;
- *(frame + s->width + x) = P0;
- *(frame + s->width + x + 1) = P0;
- }
- }
- frame += s->width * 2;
- }
- }
-
- return 0;
-}
-
-static int
-ipvideo_decode_0x8 (const GstMveDemuxStream * s, unsigned short *frame,
- const unsigned char **data, unsigned short *len)
-{
- int x, y;
- unsigned short P[8];
- unsigned char B[8];
- unsigned int flags = 0;
- unsigned int bitmask = 0;
- unsigned short P0 = 0, P1 = 0;
- int lower_half = 0;
-
- /* 2-color encoding for each 4x4 quadrant, or 2-color encoding on
- * either top and bottom or left and right halves */
- CHECK_STREAM (len, 6 + 10);
-
- P[0] = PIXEL (*data);
- (*data) += 2;
- P[1] = PIXEL (*data);
- (*data) += 2;
- B[0] = *(*data)++;
- B[1] = *(*data)++;
-
- if (!(P[0] & 0x8000)) {
-
- /* need 18 more bytes */
- CHECK_STREAM (len, 18 - 10);
-
- P[2] = PIXEL (*data);
- (*data) += 2;
- P[3] = PIXEL (*data);
- (*data) += 2;
- B[2] = *(*data)++;
- B[3] = *(*data)++;
- P[4] = PIXEL (*data);
- (*data) += 2;
- P[5] = PIXEL (*data);
- (*data) += 2;
- B[4] = *(*data)++;
- B[5] = *(*data)++;
- P[6] = PIXEL (*data);
- (*data) += 2;
- P[7] = PIXEL (*data);
- (*data) += 2;
- B[6] = *(*data)++;
- B[7] = *(*data)++;
-
- flags =
- ((B[0] & 0xF0) << 4) | ((B[4] & 0xF0) << 8) |
- ((B[0] & 0x0F)) | ((B[4] & 0x0F) << 4) |
- ((B[1] & 0xF0) << 20) | ((B[5] & 0xF0) << 24) |
- ((B[1] & 0x0F) << 16) | ((B[5] & 0x0F) << 20);
- bitmask = 0x00000001;
- lower_half = 0; /* still on top half */
-
- for (y = 0; y < 8; ++y) {
-
- /* time to reload flags? */
- if (y == 4) {
- flags =
- ((B[2] & 0xF0) << 4) | ((B[6] & 0xF0) << 8) |
- ((B[2] & 0x0F)) | ((B[6] & 0x0F) << 4) |
- ((B[3] & 0xF0) << 20) | ((B[7] & 0xF0) << 24) |
- ((B[3] & 0x0F) << 16) | ((B[7] & 0x0F) << 20);
- bitmask = 0x00000001;
- lower_half = 2;
- }
-
- /* get the pixel values ready for this quadrant */
- P0 = P[lower_half + 0];
- P1 = P[lower_half + 1];
-
- for (x = 0; x < 8; ++x, bitmask <<= 1) {
- if (x == 4) {
- P0 = P[lower_half + 4];
- P1 = P[lower_half + 5];
- }
-
- if (flags & bitmask)
- *frame++ = P1;
- else
- *frame++ = P0;
- }
- frame += s->width - 8;
- }
-
- } else {
- P[0] &= ~0x8000;
-
- /* need 10 more bytes */
- B[2] = *(*data)++;
- B[3] = *(*data)++;
- P[2] = PIXEL (*data);
- (*data) += 2;
- P[3] = PIXEL (*data);
- (*data) += 2;
- B[4] = *(*data)++;
- B[5] = *(*data)++;
- B[6] = *(*data)++;
- B[7] = *(*data)++;
-
- if (!(P[2] & 0x8000)) {
- /* vertical split; left & right halves are 2-color encoded */
-
- flags =
- ((B[0] & 0xF0) << 4) | ((B[4] & 0xF0) << 8) |
- ((B[0] & 0x0F)) | ((B[4] & 0x0F) << 4) |
- ((B[1] & 0xF0) << 20) | ((B[5] & 0xF0) << 24) |
- ((B[1] & 0x0F) << 16) | ((B[5] & 0x0F) << 20);
- bitmask = 0x00000001;
-
- for (y = 0; y < 8; ++y) {
-
- /* time to reload flags? */
- if (y == 4) {
- flags =
- ((B[2] & 0xF0) << 4) | ((B[6] & 0xF0) << 8) |
- ((B[2] & 0x0F)) | ((B[6] & 0x0F) << 4) |
- ((B[3] & 0xF0) << 20) | ((B[7] & 0xF0) << 24) |
- ((B[3] & 0x0F) << 16) | ((B[7] & 0x0F) << 20);
- bitmask = 0x00000001;
- }
-
- /* get the pixel values ready for this half */
- P0 = P[0];
- P1 = P[1];
-
- for (x = 0; x < 8; ++x, bitmask <<= 1) {
- if (x == 4) {
- P0 = P[2];
- P1 = P[3];
- }
-
- if (flags & bitmask)
- *frame++ = P1;
- else
- *frame++ = P0;
- }
- frame += s->width - 8;
- }
-
- } else {
- /* horizontal split; top & bottom halves are 2-color encoded */
-
- P0 = P[0];
- P1 = P[1];
-
- for (y = 0; y < 8; ++y) {
-
- flags = B[y];
- if (y == 4) {
- P0 = P[2] & ~0x8000;
- P1 = P[3];
- }
-
- for (bitmask = 0x01; bitmask <= 0x80; bitmask <<= 1) {
-
- if (flags & bitmask)
- *frame++ = P1;
- else
- *frame++ = P0;
- }
- frame += s->width - 8;
- }
- }
- }
-
- return 0;
-}
-
-static int
-ipvideo_decode_0x9 (const GstMveDemuxStream * s, unsigned short *frame,
- const unsigned char **data, unsigned short *len)
-{
- int x, y;
- unsigned short P[4];
- unsigned char B[4];
- unsigned int flags = 0;
- int shifter = 0;
- unsigned short pix;
-
- /* 4-color encoding */
- CHECK_STREAM (len, 8 + 4);
-
- P[0] = PIXEL (*data);
- (*data) += 2;
- P[1] = PIXEL (*data);
- (*data) += 2;
- P[2] = PIXEL (*data);
- (*data) += 2;
- P[3] = PIXEL (*data);
- (*data) += 2;
-
- if (!(P[0] & 0x8000) && !(P[2] & 0x8000)) {
-
- /* 1 of 4 colors for each pixel, need 16 more bytes */
- CHECK_STREAM (len, 16 - 4);
-
- for (y = 0; y < 8; ++y) {
- /* get the next set of 8 2-bit flags */
- flags = ((*data)[1] << 8) | (*data)[0];
- (*data) += 2;
- for (x = 0, shifter = 0; x < 8; ++x, shifter += 2) {
- *frame++ = P[(flags >> shifter) & 0x03];
- }
- frame += s->width - 8;
- }
-
- } else if (!(P[0] & 0x8000) && (P[2] & 0x8000)) {
- P[2] &= ~0x8000;
-
- /* 1 of 4 colors for each 2x2 block, need 4 more bytes */
-
- B[0] = *(*data)++;
- B[1] = *(*data)++;
- B[2] = *(*data)++;
- B[3] = *(*data)++;
- flags = (B[3] << 24) | (B[2] << 16) | (B[1] << 8) | B[0];
- shifter = 0;
-
- for (y = 0; y < 8; y += 2) {
- for (x = 0; x < 8; x += 2, shifter += 2) {
- pix = P[(flags >> shifter) & 0x03];
- *(frame + x) = pix;
- *(frame + x + 1) = pix;
- *(frame + s->width + x) = pix;
- *(frame + s->width + x + 1) = pix;
- }
- frame += s->width * 2;
- }
-
- } else if ((P[0] & 0x8000) && !(P[2] & 0x8000)) {
- P[0] &= ~0x8000;
-
- /* 1 of 4 colors for each 2x1 block, need 8 more bytes */
-
- CHECK_STREAM (len, 8 - 4);
- for (y = 0; y < 8; ++y) {
- /* time to reload flags? */
- if ((y == 0) || (y == 4)) {
- B[0] = *(*data)++;
- B[1] = *(*data)++;
- B[2] = *(*data)++;
- B[3] = *(*data)++;
- flags = (B[3] << 24) | (B[2] << 16) | (B[1] << 8) | B[0];
- shifter = 0;
- }
- for (x = 0; x < 8; x += 2, shifter += 2) {
- pix = P[(flags >> shifter) & 0x03];
- *(frame + x) = pix;
- *(frame + x + 1) = pix;
- }
- frame += s->width;
- }
-
- } else {
- P[0] &= ~0x8000;
- P[2] &= ~0x8000;
-
- /* 1 of 4 colors for each 1x2 block, need 8 more bytes */
- CHECK_STREAM (len, 8 - 4);
-
- for (y = 0; y < 8; y += 2) {
- /* time to reload flags? */
- if ((y == 0) || (y == 4)) {
- B[0] = *(*data)++;
- B[1] = *(*data)++;
- B[2] = *(*data)++;
- B[3] = *(*data)++;
- flags = (B[3] << 24) | (B[2] << 16) | (B[1] << 8) | B[0];
- shifter = 0;
- }
- for (x = 0; x < 8; ++x, shifter += 2) {
- pix = P[(flags >> shifter) & 0x03];
- *(frame + x) = pix;
- *(frame + s->width + x) = pix;
- }
- frame += s->width * 2;
- }
- }
-
- return 0;
-}
-
-static int
-ipvideo_decode_0xa (const GstMveDemuxStream * s, unsigned short *frame,
- const unsigned char **data, unsigned short *len)
-{
- int x, y;
- unsigned short P[16];
- unsigned char B[16];
- int flags = 0;
- int shifter = 0;
- int index;
- int split;
- int lower_half;
-
- /* 4-color encoding for each 4x4 quadrant, or 4-color encoding on
- * either top and bottom or left and right halves */
- CHECK_STREAM (len, 8 + 24);
-
- P[0] = PIXEL (*data);
- (*data) += 2;
- P[1] = PIXEL (*data);
- (*data) += 2;
- P[2] = PIXEL (*data);
- (*data) += 2;
- P[3] = PIXEL (*data);
- (*data) += 2;
-
- if (!(P[0] & 0x8000)) {
-
- /* 4-color encoding for each quadrant; need 40 more bytes */
- CHECK_STREAM (len, 40 - 24);
-
- B[0] = *(*data)++;
- B[1] = *(*data)++;
- B[2] = *(*data)++;
- B[3] = *(*data)++;
- for (y = 4; y < 16; y += 4) {
- for (x = y; x < y + 4; ++x) {
- P[x] = PIXEL (*data);
- (*data) += 2;
- }
- for (x = y; x < y + 4; ++x)
- B[x] = *(*data)++;
- }
-
- for (y = 0; y < 8; ++y) {
-
- lower_half = (y >= 4) ? 4 : 0;
- flags = (B[y + 8] << 8) | B[y];
-
- for (x = 0, shifter = 0; x < 8; ++x, shifter += 2) {
- split = (x >= 4) ? 8 : 0;
- index = split + lower_half + ((flags >> shifter) & 0x03);
- *frame++ = P[index];
- }
-
- frame += s->width - 8;
- }
-
- } else {
- P[0] &= ~0x8000;
-
- /* 4-color encoding for either left and right or top and bottom
- * halves; need 24 more bytes */
-
- memcpy (&B[0], *data, 8);
- (*data) += 8;
- P[4] = PIXEL (*data);
- (*data) += 2;
- P[5] = PIXEL (*data);
- (*data) += 2;
- P[6] = PIXEL (*data);
- (*data) += 2;
- P[7] = PIXEL (*data);
- (*data) += 2;
- memcpy (&B[8], *data, 8);
- (*data) += 8;
-
- if (!(P[4] & 0x8000)) {
-
- /* block is divided into left and right halves */
- for (y = 0; y < 8; ++y) {
-
- flags = (B[y + 8] << 8) | B[y];
- split = 0;
-
- for (x = 0, shifter = 0; x < 8; ++x, shifter += 2) {
- if (x == 4)
- split = 4;
- *frame++ = P[split + ((flags >> shifter) & 0x03)];
- }
-
- frame += s->width - 8;
- }
-
- } else {
- P[4] &= ~0x8000;
-
- /* block is divided into top and bottom halves */
- split = 0;
- for (y = 0; y < 8; ++y) {
-
- flags = (B[y * 2 + 1] << 8) | B[y * 2];
- if (y == 4)
- split = 4;
-
- for (x = 0, shifter = 0; x < 8; ++x, shifter += 2)
- *frame++ = P[split + ((flags >> shifter) & 0x03)];
-
- frame += s->width - 8;
- }
- }
- }
-
- return 0;
-}
-
-static int
-ipvideo_decode_0xb (const GstMveDemuxStream * s, unsigned short *frame,
- const unsigned char **data, unsigned short *len)
-{
- int x, y;
-
- /* 64-color encoding (each pixel in block is a different color) */
- CHECK_STREAM (len, 128);
-
- for (y = 0; y < 8; ++y) {
- for (x = 0; x < 8; ++x) {
- *frame++ = PIXEL (*data);
- (*data) += 2;
- }
- frame += s->width - 8;
- }
-
- return 0;
-}
-
-static int
-ipvideo_decode_0xc (const GstMveDemuxStream * s, unsigned short *frame,
- const unsigned char **data, unsigned short *len)
-{
- int x, y;
- unsigned short pix;
-
- /* 16-color block encoding: each 2x2 block is a different color */
- CHECK_STREAM (len, 32);
-
- for (y = 0; y < 8; y += 2) {
- for (x = 0; x < 8; x += 2) {
- pix = PIXEL (*data);
- (*data) += 2;
- *(frame + x) = pix;
- *(frame + x + 1) = pix;
- *(frame + s->width + x) = pix;
- *(frame + s->width + x + 1) = pix;
- }
- frame += s->width * 2;
- }
-
- return 0;
-}
-
-static int
-ipvideo_decode_0xd (const GstMveDemuxStream * s, unsigned short *frame,
- const unsigned char **data, unsigned short *len)
-{
- int x, y;
- unsigned short P[4];
- unsigned char index = 0;
-
- /* 4-color block encoding: each 4x4 block is a different color */
- CHECK_STREAM (len, 8);
-
- P[0] = PIXEL (*data);
- (*data) += 2;
- P[1] = PIXEL (*data);
- (*data) += 2;
- P[2] = PIXEL (*data);
- (*data) += 2;
- P[3] = PIXEL (*data);
- (*data) += 2;
-
- for (y = 0; y < 8; ++y) {
- if (y < 4)
- index = 0;
- else
- index = 2;
-
- for (x = 0; x < 8; ++x) {
- if (x == 4)
- ++index;
- *frame++ = P[index];
- }
- frame += s->width - 8;
- }
-
- return 0;
-}
-
-static int
-ipvideo_decode_0xe (const GstMveDemuxStream * s, unsigned short *frame,
- const unsigned char **data, unsigned short *len)
-{
- int x, y;
- unsigned short pix;
-
- /* 1-color encoding: the whole block is 1 solid color */
- CHECK_STREAM (len, 2);
-
- pix = PIXEL (*data);
- (*data) += 2;
-
- for (y = 0; y < 8; ++y) {
- for (x = 0; x < 8; ++x) {
- *frame++ = pix;
- }
- frame += s->width - 8;
- }
-
- return 0;
-}
-
-static int
-ipvideo_decode_0xf (const GstMveDemuxStream * s, unsigned short *frame,
- const unsigned char **data, unsigned short *len)
-{
- int x, y;
- unsigned short P[2];
-
- /* dithered encoding */
- CHECK_STREAM (len, 4);
-
- P[0] = PIXEL (*data);
- (*data) += 2;
- P[1] = PIXEL (*data);
- (*data) += 2;
-
- for (y = 0; y < 8; ++y) {
- for (x = 0; x < 4; ++x) {
- *frame++ = P[y & 1];
- *frame++ = P[(y & 1) ^ 1];
- }
- frame += s->width - 8;
- }
-
- return 0;
-}
-
-int
-ipvideo_decode_frame16 (const GstMveDemuxStream * s, const unsigned char *data,
- unsigned short len)
-{
- int rc = 0;
- int x, y, xx, yy;
- int index = 0;
- unsigned short offset;
- unsigned char opcode;
- unsigned short *frame;
- const unsigned char *data2;
- unsigned short len2;
-
- CHECK_STREAM (&len, 2);
-
- offset = (data[1] << 8) | data[0];
- data2 = data + offset;
- len2 = len - offset + 2;
- data += 2;
-
- frame = (unsigned short *) s->back_buf1;
-
- /* decoding is done in 8x8 blocks */
- xx = s->width >> 3;
- yy = s->height >> 3;
-
- for (y = 0; y < yy; ++y) {
- for (x = 0; x < xx; ++x) {
- /* decoding map contains 4 bits of information per 8x8 block */
- /* bottom nibble first, then top nibble */
- if (index & 1)
- opcode = s->code_map[index >> 1] >> 4;
- else
- opcode = s->code_map[index >> 1] & 0x0F;
- ++index;
-
- /* GST_DEBUG ("block @ (%3d, %3d): encoding 0x%X, data ptr @ %p",
- x, y, opcode, data); */
-
- switch (opcode) {
- case 0x0:
- /* copy a block from the previous frame */
- rc = ipvideo_copy_block (s, frame, frame +
- ((unsigned short *) s->back_buf2 -
- (unsigned short *) s->back_buf1), 0);
- break;
- case 0x1:
- /* copy block from 2 frames ago; since we switched the back
- * buffers we don't actually have to do anything here */
- break;
- case 0x2:
- rc = ipvideo_decode_0x2 (s, frame, &data2, &len2);
- break;
- case 0x3:
- rc = ipvideo_decode_0x3 (s, frame, &data2, &len2);
- break;
- case 0x4:
- rc = ipvideo_decode_0x4 (s, frame, &data2, &len2);
- break;
- case 0x5:
- rc = ipvideo_decode_0x5 (s, frame, &data, &len);
- break;
- case 0x6:
- /* mystery opcode? skip multiple blocks? */
- GST_WARNING ("encountered unsupported opcode 0x6");
- rc = -1;
- break;
- case 0x7:
- rc = ipvideo_decode_0x7 (s, frame, &data, &len);
- break;
- case 0x8:
- rc = ipvideo_decode_0x8 (s, frame, &data, &len);
- break;
- case 0x9:
- rc = ipvideo_decode_0x9 (s, frame, &data, &len);
- break;
- case 0xa:
- rc = ipvideo_decode_0xa (s, frame, &data, &len);
- break;
- case 0xb:
- rc = ipvideo_decode_0xb (s, frame, &data, &len);
- break;
- case 0xc:
- rc = ipvideo_decode_0xc (s, frame, &data, &len);
- break;
- case 0xd:
- rc = ipvideo_decode_0xd (s, frame, &data, &len);
- break;
- case 0xe:
- rc = ipvideo_decode_0xe (s, frame, &data, &len);
- break;
- case 0xf:
- rc = ipvideo_decode_0xf (s, frame, &data, &len);
- break;
- }
-
- if (rc != 0)
- return rc;
-
- frame += 8;
- }
- frame += 7 * s->width;
- }
-
- return 0;
-}
diff --git a/gst/mve/mvevideodec8.c b/gst/mve/mvevideodec8.c
deleted file mode 100644
index 687cf615b..000000000
--- a/gst/mve/mvevideodec8.c
+++ /dev/null
@@ -1,802 +0,0 @@
-/*
- * Interplay MVE Video Decoder (8 bit)
- * Copyright (C) 2003 the ffmpeg project, Mike Melanson
- * (C) 2006 Jens Granseuer
- *
- * This library is free software; you can redistribute it 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * For more information about the Interplay MVE format, visit:
- * http://www.pcisys.net/~melanson/codecs/interplay-mve.txt
- */
-
-#include "gstmvedemux.h"
-#include <string.h>
-
-#define CHECK_STREAM(l, n) \
- do { \
- if (G_UNLIKELY (*(l) < (n))) { \
- GST_ERROR ("wanted to read %d bytes from stream, %d available", (n), *(l)); \
- return -1; \
- } \
- *(l) -= (n); \
- } while (0)
-
-
-/* copy an 8x8 block from the stream to the frame buffer */
-static int
-ipvideo_copy_block (const GstMveDemuxStream * s, unsigned char *frame,
- const unsigned char *src, int offset)
-{
- int i;
- long frame_offset;
-
- frame_offset = frame - s->back_buf1 + offset;
-
- if (G_UNLIKELY (frame_offset < 0)) {
- GST_ERROR ("frame offset < 0 (%ld)", frame_offset);
- return -1;
- } else if (G_UNLIKELY (frame_offset > s->max_block_offset)) {
- GST_ERROR ("frame offset above limit (%ld > %u)",
- frame_offset, s->max_block_offset);
- return -1;
- }
-
- for (i = 0; i < 8; ++i) {
- memcpy (frame, src, 8);
- frame += s->width;
- src += s->width;
- }
-
- return 0;
-}
-
-static int
-ipvideo_decode_0x2 (const GstMveDemuxStream * s, unsigned char *frame,
- const unsigned char **data, unsigned short *len)
-{
- unsigned char B;
- int x, y;
- int offset;
-
- /* copy block from 2 frames ago using a motion vector */
- CHECK_STREAM (len, 1);
- B = *(*data)++;
-
- if (B < 56) {
- x = 8 + (B % 7);
- y = B / 7;
- } else {
- x = -14 + ((B - 56) % 29);
- y = 8 + ((B - 56) / 29);
- }
- offset = y * s->width + x;
-
- return ipvideo_copy_block (s, frame, frame + offset, offset);
-}
-
-static int
-ipvideo_decode_0x3 (const GstMveDemuxStream * s, unsigned char *frame,
- const unsigned char **data, unsigned short *len)
-{
- unsigned char B;
- int x, y;
- int offset;
-
- /* copy 8x8 block from current frame from an up/left block */
- CHECK_STREAM (len, 1);
- B = *(*data)++;
-
- if (B < 56) {
- x = -(8 + (B % 7));
- y = -(B / 7);
- } else {
- x = -(-14 + ((B - 56) % 29));
- y = -(8 + ((B - 56) / 29));
- }
- offset = y * s->width + x;
-
- return ipvideo_copy_block (s, frame, frame + offset, offset);
-}
-
-static int
-ipvideo_decode_0x4 (const GstMveDemuxStream * s, unsigned char *frame,
- const unsigned char **data, unsigned short *len)
-{
- unsigned char B;
- int x, y;
- int offset;
-
- /* copy a block from the previous frame */
- CHECK_STREAM (len, 1);
- B = *(*data)++;
- x = -8 + (B & 0x0F);
- y = -8 + (B >> 4);
- offset = y * s->width + x;
-
- return ipvideo_copy_block (s, frame,
- frame + (s->back_buf2 - s->back_buf1) + offset, offset);
-}
-
-static int
-ipvideo_decode_0x5 (const GstMveDemuxStream * s, unsigned char *frame,
- const unsigned char **data, unsigned short *len)
-{
- signed char x, y;
- int offset;
-
- /* copy a block from the previous frame using an expanded range */
- CHECK_STREAM (len, 2);
-
- x = (signed char) *(*data)++;
- y = (signed char) *(*data)++;
- offset = y * s->width + x;
-
- return ipvideo_copy_block (s, frame,
- frame + (s->back_buf2 - s->back_buf1) + offset, offset);
-}
-
-static int
-ipvideo_decode_0x7 (const GstMveDemuxStream * s, unsigned char *frame,
- const unsigned char **data, unsigned short *len)
-{
- int x, y;
- unsigned char P0, P1;
- unsigned int flags;
- int bitmask;
-
- /* 2-color encoding */
- CHECK_STREAM (len, 2 + 2);
-
- P0 = *(*data)++;
- P1 = *(*data)++;
-
- if (P0 <= P1) {
-
- /* need 8 more bytes from the stream */
- CHECK_STREAM (len, 8 - 2);
-
- for (y = 0; y < 8; ++y) {
- flags = *(*data)++;
- for (x = 0x01; x <= 0x80; x <<= 1) {
- if (flags & x)
- *frame++ = P1;
- else
- *frame++ = P0;
- }
- frame += s->width - 8;
- }
-
- } else {
-
- /* need 2 more bytes from the stream */
- flags = ((*data)[1] << 8) | (*data)[0];
- (*data) += 2;
- bitmask = 0x0001;
- for (y = 0; y < 8; y += 2) {
- for (x = 0; x < 8; x += 2, bitmask <<= 1) {
- if (flags & bitmask) {
- *(frame + x) = P1;
- *(frame + x + 1) = P1;
- *(frame + s->width + x) = P1;
- *(frame + s->width + x + 1) = P1;
- } else {
- *(frame + x) = P0;
- *(frame + x + 1) = P0;
- *(frame + s->width + x) = P0;
- *(frame + s->width + x + 1) = P0;
- }
- }
- frame += s->width * 2;
- }
- }
-
- return 0;
-}
-
-static int
-ipvideo_decode_0x8 (const GstMveDemuxStream * s, unsigned char *frame,
- const unsigned char **data, unsigned short *len)
-{
- int x, y;
- unsigned char P[8];
- unsigned char B[8];
- unsigned int flags = 0;
- unsigned int bitmask = 0;
- unsigned char P0 = 0, P1 = 0;
- int lower_half = 0;
-
- /* 2-color encoding for each 4x4 quadrant, or 2-color encoding on
- * either top and bottom or left and right halves */
- CHECK_STREAM (len, 4 + 8);
-
- P[0] = (*data)[0];
- P[1] = (*data)[1];
- B[0] = (*data)[2];
- B[1] = (*data)[3];
- (*data) += 4;
-
- if (P[0] <= P[1]) {
-
- /* need 12 more bytes */
- CHECK_STREAM (len, 12 - 8);
-
- P[2] = (*data)[0];
- P[3] = (*data)[1];
- B[2] = (*data)[2];
- B[3] = (*data)[3];
- P[4] = (*data)[4];
- P[5] = (*data)[5];
- B[4] = (*data)[6];
- B[5] = (*data)[7];
- P[6] = (*data)[8];
- P[7] = (*data)[9];
- B[6] = (*data)[10];
- B[7] = (*data)[11];
- (*data) += 12;
-
- flags =
- ((B[0] & 0xF0) << 4) | ((B[4] & 0xF0) << 8) |
- ((B[0] & 0x0F)) | ((B[4] & 0x0F) << 4) |
- ((B[1] & 0xF0) << 20) | ((B[5] & 0xF0) << 24) |
- ((B[1] & 0x0F) << 16) | ((B[5] & 0x0F) << 20);
- bitmask = 0x00000001;
- lower_half = 0; /* still on top half */
-
- for (y = 0; y < 8; ++y) {
-
- /* time to reload flags? */
- if (y == 4) {
- flags =
- ((B[2] & 0xF0) << 4) | ((B[6] & 0xF0) << 8) |
- ((B[2] & 0x0F)) | ((B[6] & 0x0F) << 4) |
- ((B[3] & 0xF0) << 20) | ((B[7] & 0xF0) << 24) |
- ((B[3] & 0x0F) << 16) | ((B[7] & 0x0F) << 20);
- bitmask = 0x00000001;
- lower_half = 2;
- }
-
- /* get the pixel values ready for this quadrant */
- P0 = P[lower_half + 0];
- P1 = P[lower_half + 1];
-
- for (x = 0; x < 8; ++x, bitmask <<= 1) {
- if (x == 4) {
- P0 = P[lower_half + 4];
- P1 = P[lower_half + 5];
- }
-
- if (flags & bitmask)
- *frame++ = P1;
- else
- *frame++ = P0;
- }
- frame += s->width - 8;
- }
-
- } else {
-
- /* need 8 more bytes */
- B[2] = (*data)[0];
- B[3] = (*data)[1];
- P[2] = (*data)[2];
- P[3] = (*data)[3];
- B[4] = (*data)[4];
- B[5] = (*data)[5];
- B[6] = (*data)[6];
- B[7] = (*data)[7];
- (*data) += 8;
-
- if (P[2] <= P[3]) {
-
- /* vertical split; left & right halves are 2-color encoded */
-
- flags =
- ((B[0] & 0xF0) << 4) | ((B[4] & 0xF0) << 8) |
- ((B[0] & 0x0F)) | ((B[4] & 0x0F) << 4) |
- ((B[1] & 0xF0) << 20) | ((B[5] & 0xF0) << 24) |
- ((B[1] & 0x0F) << 16) | ((B[5] & 0x0F) << 20);
- bitmask = 0x00000001;
-
- for (y = 0; y < 8; ++y) {
-
- /* time to reload flags? */
- if (y == 4) {
- flags =
- ((B[2] & 0xF0) << 4) | ((B[6] & 0xF0) << 8) |
- ((B[2] & 0x0F)) | ((B[6] & 0x0F) << 4) |
- ((B[3] & 0xF0) << 20) | ((B[7] & 0xF0) << 24) |
- ((B[3] & 0x0F) << 16) | ((B[7] & 0x0F) << 20);
- bitmask = 0x00000001;
- }
-
- /* get the pixel values ready for this half */
- P0 = P[0];
- P1 = P[1];
-
- for (x = 0; x < 8; ++x, bitmask <<= 1) {
- if (x == 4) {
- P0 = P[2];
- P1 = P[3];
- }
-
- if (flags & bitmask)
- *frame++ = P1;
- else
- *frame++ = P0;
- }
- frame += s->width - 8;
- }
-
- } else {
-
- /* horizontal split; top & bottom halves are 2-color encoded */
-
- P0 = P[0];
- P1 = P[1];
-
- for (y = 0; y < 8; ++y) {
-
- flags = B[y];
- if (y == 4) {
- P0 = P[2];
- P1 = P[3];
- }
-
- for (bitmask = 0x01; bitmask <= 0x80; bitmask <<= 1) {
-
- if (flags & bitmask)
- *frame++ = P1;
- else
- *frame++ = P0;
- }
- frame += s->width - 8;
- }
- }
- }
-
- return 0;
-}
-
-static int
-ipvideo_decode_0x9 (const GstMveDemuxStream * s, unsigned char *frame,
- const unsigned char **data, unsigned short *len)
-{
- int x, y;
- unsigned char P[4];
- unsigned char B[4];
- unsigned long flags = 0;
- int shifter = 0;
- unsigned char pix;
-
- /* 4-color encoding */
- CHECK_STREAM (len, 4 + 4);
-
- P[0] = (*data)[0];
- P[1] = (*data)[1];
- P[2] = (*data)[2];
- P[3] = (*data)[3];
- (*data) += 4;
-
- if ((P[0] <= P[1]) && (P[2] <= P[3])) {
-
- /* 1 of 4 colors for each pixel, need 16 more bytes */
- CHECK_STREAM (len, 16 - 4);
-
- for (y = 0; y < 8; ++y) {
- /* get the next set of 8 2-bit flags */
- flags = ((*data)[1] << 8) | (*data)[0];
- (*data) += 2;
- for (x = 0, shifter = 0; x < 8; ++x, shifter += 2) {
- *frame++ = P[(flags >> shifter) & 0x03];
- }
- frame += s->width - 8;
- }
-
- } else if ((P[0] <= P[1]) && (P[2] > P[3])) {
-
- /* 1 of 4 colors for each 2x2 block, need 4 more bytes */
- B[0] = (*data)[0];
- B[1] = (*data)[1];
- B[2] = (*data)[2];
- B[3] = (*data)[3];
- (*data) += 4;
- flags = (B[3] << 24) | (B[2] << 16) | (B[1] << 8) | B[0];
- shifter = 0;
-
- for (y = 0; y < 8; y += 2) {
- for (x = 0; x < 8; x += 2, shifter += 2) {
- pix = P[(flags >> shifter) & 0x03];
- *(frame + x) = pix;
- *(frame + x + 1) = pix;
- *(frame + s->width + x) = pix;
- *(frame + s->width + x + 1) = pix;
- }
- frame += s->width * 2;
- }
-
- } else if ((P[0] > P[1]) && (P[2] <= P[3])) {
-
- /* 1 of 4 colors for each 2x1 block, need 8 more bytes */
- CHECK_STREAM (len, 8 - 4);
-
- for (y = 0; y < 8; ++y) {
- /* time to reload flags? */
- if ((y == 0) || (y == 4)) {
- B[0] = (*data)[0];
- B[1] = (*data)[1];
- B[2] = (*data)[2];
- B[3] = (*data)[3];
- (*data) += 4;
- flags = (B[3] << 24) | (B[2] << 16) | (B[1] << 8) | B[0];
- shifter = 0;
- }
- for (x = 0; x < 8; x += 2, shifter += 2) {
- pix = P[(flags >> shifter) & 0x03];
- *(frame + x) = pix;
- *(frame + x + 1) = pix;
- }
- frame += s->width;
- }
-
- } else {
-
- /* 1 of 4 colors for each 1x2 block, need 8 more bytes */
- CHECK_STREAM (len, 8 - 4);
-
- for (y = 0; y < 8; y += 2) {
- /* time to reload flags? */
- if ((y == 0) || (y == 4)) {
- B[0] = (*data)[0];
- B[1] = (*data)[1];
- B[2] = (*data)[2];
- B[3] = (*data)[3];
- (*data) += 4;
- flags = (B[3] << 24) | (B[2] << 16) | (B[1] << 8) | B[0];
- shifter = 0;
- }
- for (x = 0; x < 8; ++x, shifter += 2) {
- pix = P[(flags >> shifter) & 0x03];
- *(frame + x) = pix;
- *(frame + s->width + x) = pix;
- }
- frame += s->width * 2;
- }
- }
-
- return 0;
-}
-
-static int
-ipvideo_decode_0xa (const GstMveDemuxStream * s, unsigned char *frame,
- const unsigned char **data, unsigned short *len)
-{
- int x, y;
- unsigned char P[16];
- unsigned char B[16];
- int flags = 0;
- int shifter = 0;
- int index;
- int split;
- int lower_half;
-
- /* 4-color encoding for each 4x4 quadrant, or 4-color encoding on
- * either top and bottom or left and right halves */
- CHECK_STREAM (len, 8 + 16);
-
- P[0] = (*data)[0];
- P[1] = (*data)[1];
- P[2] = (*data)[2];
- P[3] = (*data)[3];
- B[0] = (*data)[4];
- B[1] = (*data)[5];
- B[2] = (*data)[6];
- B[3] = (*data)[7];
- (*data) += 8;
-
- if (P[0] <= P[1]) {
-
- /* 4-color encoding for each quadrant; need 24 more bytes */
- CHECK_STREAM (len, 24 - 16);
-
- for (y = 4; y < 16; y += 4) {
- for (x = y; x < y + 4; ++x)
- P[x] = *(*data)++;
- for (x = y; x < y + 4; ++x)
- B[x] = *(*data)++;
- }
-
- for (y = 0; y < 8; ++y) {
-
- lower_half = (y >= 4) ? 4 : 0;
- flags = (B[y + 8] << 8) | B[y];
-
- for (x = 0, shifter = 0; x < 8; ++x, shifter += 2) {
- split = (x >= 4) ? 8 : 0;
- index = split + lower_half + ((flags >> shifter) & 0x03);
- *frame++ = P[index];
- }
-
- frame += s->width - 8;
- }
-
- } else {
-
- /* 4-color encoding for either left and right or top and bottom
- * halves; need 16 more bytes */
-
- B[4] = (*data)[0];
- B[5] = (*data)[1];
- B[6] = (*data)[2];
- B[7] = (*data)[3];
- P[4] = (*data)[4];
- P[5] = (*data)[5];
- P[6] = (*data)[6];
- P[7] = (*data)[7];
- (*data) += 8;
- memcpy (&B[8], *data, 8);
- (*data) += 8;
-
- if (P[4] <= P[5]) {
-
- /* block is divided into left and right halves */
- for (y = 0; y < 8; ++y) {
-
- flags = (B[y + 8] << 8) | B[y];
- split = 0;
-
- for (x = 0, shifter = 0; x < 8; ++x, shifter += 2) {
- if (x == 4)
- split = 4;
- *frame++ = P[split + ((flags >> shifter) & 0x03)];
- }
-
- frame += s->width - 8;
- }
-
- } else {
-
- /* block is divided into top and bottom halves */
- split = 0;
- for (y = 0; y < 8; ++y) {
-
- flags = (B[y * 2 + 1] << 8) | B[y * 2];
- if (y == 4)
- split = 4;
-
- for (x = 0, shifter = 0; x < 8; ++x, shifter += 2)
- *frame++ = P[split + ((flags >> shifter) & 0x03)];
-
- frame += s->width - 8;
- }
- }
- }
-
- return 0;
-}
-
-static int
-ipvideo_decode_0xb (const GstMveDemuxStream * s, unsigned char *frame,
- const unsigned char **data, unsigned short *len)
-{
- int y;
-
- /* 64-color encoding (each pixel in block is a different color) */
- CHECK_STREAM (len, 64);
-
- for (y = 0; y < 8; ++y) {
- memcpy (frame, *data, 8);
- frame += s->width;
- (*data) += 8;
- }
-
- return 0;
-}
-
-static int
-ipvideo_decode_0xc (const GstMveDemuxStream * s, unsigned char *frame,
- const unsigned char **data, unsigned short *len)
-{
- int x, y;
- unsigned char pix;
-
- /* 16-color block encoding: each 2x2 block is a different color */
- CHECK_STREAM (len, 16);
-
- for (y = 0; y < 8; y += 2) {
- for (x = 0; x < 8; x += 2) {
- pix = *(*data)++;
- *(frame + x) = pix;
- *(frame + x + 1) = pix;
- *(frame + s->width + x) = pix;
- *(frame + s->width + x + 1) = pix;
- }
- frame += s->width * 2;
- }
-
- return 0;
-}
-
-static int
-ipvideo_decode_0xd (const GstMveDemuxStream * s, unsigned char *frame,
- const unsigned char **data, unsigned short *len)
-{
- int x, y;
- unsigned char P[4];
- unsigned char index = 0;
-
- /* 4-color block encoding: each 4x4 block is a different color */
- CHECK_STREAM (len, 4);
-
- P[0] = (*data)[0];
- P[1] = (*data)[1];
- P[2] = (*data)[2];
- P[3] = (*data)[3];
- (*data) += 4;
-
- for (y = 0; y < 8; ++y) {
- if (y < 4)
- index = 0;
- else
- index = 2;
-
- for (x = 0; x < 8; ++x) {
- if (x == 4)
- ++index;
- *frame++ = P[index];
- }
- frame += s->width - 8;
- }
-
- return 0;
-}
-
-static int
-ipvideo_decode_0xe (const GstMveDemuxStream * s, unsigned char *frame,
- const unsigned char **data, unsigned short *len)
-{
- int y;
- unsigned char pix;
-
- /* 1-color encoding: the whole block is 1 solid color */
- CHECK_STREAM (len, 1);
- pix = *(*data)++;
-
- for (y = 0; y < 8; ++y) {
- memset (frame, pix, 8);
- frame += s->width;
- }
-
- return 0;
-}
-
-static int
-ipvideo_decode_0xf (const GstMveDemuxStream * s, unsigned char *frame,
- const unsigned char **data, unsigned short *len)
-{
- int x, y;
- unsigned char P[2];
-
- /* dithered encoding */
- CHECK_STREAM (len, 2);
-
- P[0] = *(*data)++;
- P[1] = *(*data)++;
-
- for (y = 0; y < 8; ++y) {
- for (x = 0; x < 4; ++x) {
- *frame++ = P[y & 1];
- *frame++ = P[(y & 1) ^ 1];
- }
- frame += s->width - 8;
- }
-
- return 0;
-}
-
-int
-ipvideo_decode_frame8 (const GstMveDemuxStream * s, const unsigned char *data,
- unsigned short len)
-{
- int rc = 0;
- int x, y, xx, yy;
- int index = 0;
- unsigned char opcode;
- unsigned char *frame;
-
- frame = s->back_buf1;
-
- /* decoding is done in 8x8 blocks */
- xx = s->width >> 3;
- yy = s->height >> 3;
-
- for (y = 0; y < yy; ++y) {
- for (x = 0; x < xx; ++x) {
- /* decoding map contains 4 bits of information per 8x8 block */
- /* bottom nibble first, then top nibble */
- if (index & 1)
- opcode = s->code_map[index >> 1] >> 4;
- else
- opcode = s->code_map[index >> 1] & 0x0F;
- ++index;
-
- /* GST_DEBUG ("block @ (%3d, %3d): encoding 0x%X, data ptr @ %p",
- x, y, opcode, data); */
-
- switch (opcode) {
- case 0x00:
- /* copy a block from the previous frame */
- rc = ipvideo_copy_block (s, frame,
- frame + (s->back_buf2 - s->back_buf1), 0);
- break;
- case 0x01:
- /* copy block from 2 frames ago; since we switched the back
- * buffers we don't actually have to do anything here */
- break;
- case 0x02:
- rc = ipvideo_decode_0x2 (s, frame, &data, &len);
- break;
- case 0x03:
- rc = ipvideo_decode_0x3 (s, frame, &data, &len);
- break;
- case 0x04:
- rc = ipvideo_decode_0x4 (s, frame, &data, &len);
- break;
- case 0x05:
- rc = ipvideo_decode_0x5 (s, frame, &data, &len);
- break;
- case 0x06:
- /* mystery opcode? skip multiple blocks? */
- GST_WARNING ("encountered unsupported opcode 0x6");
- rc = -1;
- break;
- case 0x07:
- rc = ipvideo_decode_0x7 (s, frame, &data, &len);
- break;
- case 0x08:
- rc = ipvideo_decode_0x8 (s, frame, &data, &len);
- break;
- case 0x09:
- rc = ipvideo_decode_0x9 (s, frame, &data, &len);
- break;
- case 0x0a:
- rc = ipvideo_decode_0xa (s, frame, &data, &len);
- break;
- case 0x0b:
- rc = ipvideo_decode_0xb (s, frame, &data, &len);
- break;
- case 0x0c:
- rc = ipvideo_decode_0xc (s, frame, &data, &len);
- break;
- case 0x0d:
- rc = ipvideo_decode_0xd (s, frame, &data, &len);
- break;
- case 0x0e:
- rc = ipvideo_decode_0xe (s, frame, &data, &len);
- break;
- case 0x0f:
- rc = ipvideo_decode_0xf (s, frame, &data, &len);
- break;
- }
-
- if (rc != 0)
- return rc;
-
- frame += 8;
- }
- frame += 7 * s->width;
- }
-
- return 0;
-}
diff --git a/gst/mve/mvevideoenc16.c b/gst/mve/mvevideoenc16.c
deleted file mode 100644
index 6afb33942..000000000
--- a/gst/mve/mvevideoenc16.c
+++ /dev/null
@@ -1,1652 +0,0 @@
-/*
- * Interplay MVE video encoder (16 bit)
- * Copyright (C) 2006 Jens Granseuer <jensgr@gmx.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include "gstmvemux.h"
-
-typedef struct _GstMveEncoderData GstMveEncoderData;
-typedef struct _GstMveEncoding GstMveEncoding;
-typedef struct _GstMveApprox GstMveApprox;
-typedef struct _GstMveQuant GstMveQuant;
-
-#define MVE_RMASK 0x7c00
-#define MVE_GMASK 0x03e0
-#define MVE_BMASK 0x001f
-#define MVE_RSHIFT 10
-#define MVE_GSHIFT 5
-#define MVE_BSHIFT 0
-
-#define MVE_RVAL(p) (((p) & MVE_RMASK) >> MVE_RSHIFT)
-#define MVE_GVAL(p) (((p) & MVE_GMASK) >> MVE_GSHIFT)
-#define MVE_BVAL(p) (((p) & MVE_BMASK) >> MVE_BSHIFT)
-#define MVE_COL(r,g,b) (((r) << MVE_RSHIFT) | ((g) << MVE_GSHIFT) | ((b) << MVE_BSHIFT))
-
-struct _GstMveEncoderData
-{
- GstMveMux *mve;
- /* current position in frame */
- guint16 x, y;
-
- /* commonly used quantization results
- (2 and 4 colors) for the current block */
- guint16 q2block[64];
- guint16 q2colors[2];
- guint32 q2error;
- gboolean q2available;
-
- guint16 q4block[64];
- guint16 q4colors[4];
- guint32 q4error;
- gboolean q4available;
-};
-
-struct _GstMveEncoding
-{
- guint8 opcode;
- guint8 size;
- guint32 (*approx) (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * res);
-};
-
-#define MVE_APPROX_MAX_ERROR G_MAXUINT32
-
-struct _GstMveApprox
-{
- guint32 error;
- guint8 type;
- guint8 data[128]; /* max 128 bytes encoded per block */
- guint16 block[64]; /* block in final image */
-};
-
-struct _GstMveQuant
-{
- guint16 col;
- guint16 r_total, g_total, b_total;
- guint8 r, g, b;
- guint8 hits, hits_last;
- guint32 max_error;
- guint16 max_miss;
-};
-
-#define mve_median(mve, src) mve_median_sub ((mve), (src), 8, 8, 0)
-#define mve_color_dist(c1, c2) \
- mve_color_dist_rgb (MVE_RVAL (c1), MVE_GVAL (c1), MVE_BVAL (c1), \
- MVE_RVAL (c2), MVE_GVAL (c2), MVE_BVAL (c2));
-
-/* comparison function for qsort() */
-static int
-mve_comp_solution (const void *a, const void *b)
-{
- const GArray *aa = *((GArray **) a);
- const GArray *bb = *((GArray **) b);
-
- if (aa->len <= 1)
- return G_MAXINT;
- else if (bb->len <= 1)
- return G_MININT;
- else
- return g_array_index (aa, GstMveApprox, aa->len - 2).error -
- g_array_index (bb, GstMveApprox, bb->len - 2).error;
-}
-
-static inline guint32
-mve_color_dist_rgb (guint8 r1, guint8 g1, guint8 b1,
- guint8 r2, guint8 g2, guint8 b2)
-{
- /* euclidean distance (minus sqrt) */
- gint dr = r1 - r2;
- gint dg = g1 - g2;
- gint db = b1 - b2;
-
- return dr * dr + dg * dg + db * db;
-}
-
-/* compute average color in a sub-block */
-static guint16
-mve_median_sub (const GstMveMux * mve, const guint16 * src, guint w, guint h,
- guint n)
-{
- guint x, y;
- const guint max = w * h, max2 = max >> 1;
- guint32 r_total = max2, g_total = max2, b_total = max2;
-
- src += ((n * w) % 8) + (((n * (8 - h)) / (12 - w)) * h * mve->width);
-
- for (y = 0; y < h; ++y) {
- for (x = 0; x < w; ++x) {
- r_total += MVE_RVAL (src[x]);
- g_total += MVE_GVAL (src[x]);
- b_total += MVE_BVAL (src[x]);
- }
- src += mve->width;
- }
-
- return MVE_COL (r_total / max, g_total / max, b_total / max);
-}
-
-static void
-mve_quant_init (const GstMveMux * mve, GstMveQuant * q, guint n_clusters,
- const guint16 * data, guint w, guint h)
-{
- guint i;
- guint x, y;
- guint16 cols[4];
- guint16 val[2];
-
- /* init first cluster with lowest (darkest), second with highest (lightest)
- color. if we need 4 clusters, fill in first and last color in the block
- and hope they make for a good distribution */
- cols[0] = cols[1] = cols[2] = data[0];
- cols[3] = data[(h - 1) * mve->width + w - 1];
-
- /* favour red over green and blue */
- val[0] = val[1] =
- (MVE_RVAL (data[0]) << 1) + MVE_GVAL (data[0]) + MVE_BVAL (data[0]);
-
- for (y = 0; y < h; ++y) {
- for (x = 0; x < w; ++x) {
- guint16 c = data[x];
-
- if ((c != cols[0]) && (c != cols[1])) {
- guint v = (MVE_RVAL (c) << 1) + MVE_GVAL (c) + MVE_BVAL (c);
-
- if (v < val[0]) {
- val[0] = v;
- cols[0] = c;
- } else if (v > val[1]) {
- val[1] = v;
- cols[1] = c;
- }
- }
- }
- data += mve->width;
- }
-
- for (i = 0; i < n_clusters; ++i) {
- q[i].col = cols[i];
- q[i].r = MVE_RVAL (cols[i]);
- q[i].g = MVE_GVAL (cols[i]);
- q[i].b = MVE_BVAL (cols[i]);
- q[i].r_total = q[i].g_total = q[i].b_total = 0;
- q[i].hits = q[i].hits_last = 0;
- q[i].max_error = 0;
- q[i].max_miss = 0;
- }
-}
-
-static gboolean
-mve_quant_update_clusters (GstMveQuant * q, guint n_clusters)
-{
- gboolean changed = FALSE;
- guint i;
-
- for (i = 0; i < n_clusters; ++i) {
- if (q[i].hits > 0) {
- guint16 means = MVE_COL ((q[i].r_total + q[i].hits / 2) / q[i].hits,
- (q[i].g_total + q[i].hits / 2) / q[i].hits,
- (q[i].b_total + q[i].hits / 2) / q[i].hits);
-
- if ((means != q[i].col) || (q[i].hits != q[i].hits_last))
- changed = TRUE;
-
- q[i].col = means;
- q[i].r_total = q[i].g_total = q[i].b_total = 0;
- } else {
- guint j;
- guint32 max_err = 0;
- GstMveQuant *worst = NULL;
-
- /* try to replace unused cluster with a better representative */
- for (j = 0; j < n_clusters; ++j) {
- if (q[j].max_error > max_err) {
- worst = &q[j];
- max_err = worst->max_error;
- }
- }
- if (worst) {
- q[i].col = worst->max_miss;
- worst->max_error = 0;
- changed = TRUE;
- }
- }
-
- q[i].r = MVE_RVAL (q[i].col);
- q[i].g = MVE_GVAL (q[i].col);
- q[i].b = MVE_BVAL (q[i].col);
- q[i].hits_last = q[i].hits;
- q[i].hits = 0;
- }
- for (i = 0; i < n_clusters; ++i) {
- q[i].max_error = 0;
- }
-
- return changed;
-}
-
-/* quantize a sub-block using a k-means algorithm */
-static guint32
-mve_quantize (const GstMveMux * mve, const guint16 * src,
- guint w, guint h, guint n, guint ncols, guint16 * scratch, guint16 * cols)
-{
- guint x, y, i;
- GstMveQuant q[4];
- const guint16 *data;
- guint16 *dest;
- guint32 error;
-
- g_assert (n <= 4 && ncols <= 4);
-
- src += ((n * w) % 8) + (((n * (8 - h)) / (12 - w)) * h * mve->width);
- scratch += ((n * w) % 8) + (((n * (8 - h)) / (12 - w)) * h * 8);
-
- mve_quant_init (mve, q, ncols, src, w, h);
-
- do {
- data = src;
- dest = scratch;
- error = 0;
-
- /* for each pixel find the closest cluster */
- for (y = 0; y < h; ++y) {
- for (x = 0; x < w; ++x) {
- guint16 c = data[x];
- guint8 r = MVE_RVAL (c), g = MVE_GVAL (c), b = MVE_BVAL (c);
- guint32 minerr = MVE_APPROX_MAX_ERROR, err;
- GstMveQuant *best = NULL;
-
- for (i = 0; i < ncols; ++i) {
- err = mve_color_dist_rgb (r, g, b, q[i].r, q[i].g, q[i].b);
-
- if (err < minerr) {
- minerr = err;
- best = &q[i];
- }
- }
-
- if (G_UNLIKELY (!best))
- continue;
-
- ++best->hits;
- best->r_total += r;
- best->g_total += g;
- best->b_total += b;
-
- if (minerr > best->max_error) {
- best->max_error = minerr;
- best->max_miss = c;
- }
-
- error += minerr;
- dest[x] = best->col;
- }
- data += mve->width;
- dest += 8;
- }
- } while (mve_quant_update_clusters (q, ncols));
-
- /* fill cols array with result colors */
- for (i = 0; i < ncols; ++i)
- cols[i] = q[i].col;
-
- return error;
-}
-
-static guint32
-mve_block_error (const GstMveMux * mve, const guint16 * b1, const guint16 * b2,
- guint32 threshold)
-{
- /* compute error between two blocks in a frame */
- guint32 e = 0;
- guint x, y;
-
- for (y = 0; y < 8; ++y) {
- for (x = 0; x < 8; ++x) {
- e += mve_color_dist (*b1, *b2);
-
- /* using a threshold to return early gives a huge performance bonus */
- if (e >= threshold)
- return MVE_APPROX_MAX_ERROR;
- ++b1;
- ++b2;
- }
-
- b1 += mve->width - 8;
- b2 += mve->width - 8;
- }
-
- return e;
-}
-
-static guint32
-mve_block_error_packed (const GstMveMux * mve, const guint16 * block,
- const guint16 * scratch)
-{
- /* compute error between a block in a frame and a (continuous) scratch pad */
- guint32 e = 0;
- guint x, y;
-
- for (y = 0; y < 8; ++y) {
- for (x = 0; x < 8; ++x) {
- e += mve_color_dist (block[x], scratch[x]);
- }
- block += mve->width;
- scratch += 8;
- }
-
- return e;
-}
-
-static void
-mve_store_block (const GstMveMux * mve, const guint16 * block,
- guint16 * scratch)
-{
- /* copy block from frame to a (continuous) scratch pad */
- guint y;
-
- for (y = 0; y < 8; ++y) {
- memcpy (scratch, block, 16);
- block += mve->width;
- scratch += 8;
- }
-}
-
-static void
-mve_restore_block (const GstMveMux * mve, guint16 * block,
- const guint16 * scratch)
-{
- /* copy block from scratch pad to frame */
- guint y;
-
- for (y = 0; y < 8; ++y) {
- memcpy (block, scratch, 16);
- block += mve->width;
- scratch += 8;
- }
-}
-
-
-static guint32
-mve_try_vector (GstMveEncoderData * enc, const guint16 * src,
- const guint16 * frame, gint pn, GstMveApprox * apx)
-{
- /* try to locate a similar 8x8 block in the given frame using a motion vector */
- guint i;
- gint dx, dy;
- gint fx, fy;
- guint32 err;
-
- apx->error = MVE_APPROX_MAX_ERROR;
-
- for (i = 0; i < 256; ++i) {
- if (i < 56) {
- dx = 8 + (i % 7);
- dy = i / 7;
- } else {
- dx = -14 + ((i - 56) % 29);
- dy = 8 + ((i - 56) / 29);
- }
-
- fx = enc->x + dx * pn;
- fy = enc->y + dy * pn;
-
- if ((fx >= 0) && (fy >= 0) && (fx + 8 <= enc->mve->width)
- && (fy + 8 <= enc->mve->height)) {
- err =
- mve_block_error (enc->mve, src, frame + fy * enc->mve->width + fx,
- apx->error);
- if (err < apx->error) {
- apx->data[0] = i;
- mve_store_block (enc->mve, frame + fy * enc->mve->width + fx,
- apx->block);
- apx->error = err;
- if (err == 0)
- return 0;
- }
- }
- }
-
- return apx->error;
-}
-
-static guint32
-mve_encode_0x0 (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* copy a block from the last frame (0 bytes) */
- if (enc->mve->last_frame == NULL)
- return MVE_APPROX_MAX_ERROR;
-
- mve_store_block (enc->mve,
- ((guint16 *) GST_BUFFER_DATA (enc->mve->last_frame)) +
- enc->y * enc->mve->width + enc->x, apx->block);
- apx->error = mve_block_error_packed (enc->mve, src, apx->block);
- return apx->error;
-}
-
-static guint32
-mve_encode_0x1 (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* copy a block from the second to last frame (0 bytes) */
- if (enc->mve->second_last_frame == NULL)
- return MVE_APPROX_MAX_ERROR;
-
- mve_store_block (enc->mve,
- ((guint16 *) GST_BUFFER_DATA (enc->mve->second_last_frame)) +
- enc->y * enc->mve->width + enc->x, apx->block);
- apx->error = mve_block_error_packed (enc->mve, src, apx->block);
- return apx->error;
-}
-
-static guint32
-mve_encode_0x2 (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* copy block from 2 frames ago using a motion vector (1 byte) */
- if (enc->mve->quick_encoding || enc->mve->second_last_frame == NULL)
- return MVE_APPROX_MAX_ERROR;
-
- apx->error = mve_try_vector (enc, src,
- (guint16 *) GST_BUFFER_DATA (enc->mve->second_last_frame), 1, apx);
- return apx->error;
-}
-
-static guint32
-mve_encode_0x3 (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* copy 8x8 block from current frame from an up/left block (1 byte) */
- if (enc->mve->quick_encoding)
- return MVE_APPROX_MAX_ERROR;
-
- apx->error = mve_try_vector (enc, src,
- src - enc->mve->width * enc->y - enc->x, -1, apx);
- return apx->error;
-}
-
-static guint32
-mve_encode_0x4 (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* copy a block from previous frame using a motion vector (-8/-8 to +7/+7) (1 byte) */
- const GstMveMux *mve = enc->mve;
- guint32 err;
- const guint16 *frame;
- gint x1, x2, xi, y1, y2, yi;
-
- if (mve->last_frame == NULL)
- return MVE_APPROX_MAX_ERROR;
-
- frame = (guint16 *) GST_BUFFER_DATA (mve->last_frame);
-
- x1 = enc->x - 8;
- x2 = enc->x + 7;
- if (x1 < 0)
- x1 = 0;
- else if (x2 + 8 > mve->width)
- x2 = mve->width - 8;
-
- y1 = enc->y - 8;
- y2 = enc->y + 7;
- if (y1 < 0)
- y1 = 0;
- else if (y2 + 8 > mve->height)
- y2 = mve->height - 8;
-
- apx->error = MVE_APPROX_MAX_ERROR;
-
- for (yi = y1; yi <= y2; ++yi) {
- guint yoff = yi * mve->width;
-
- for (xi = x1; xi <= x2; ++xi) {
- err = mve_block_error (mve, src, frame + yoff + xi, apx->error);
- if (err < apx->error) {
- apx->data[0] = ((xi - enc->x + 8) & 0xF) | ((yi - enc->y + 8) << 4);
- mve_store_block (mve, frame + yoff + xi, apx->block);
- apx->error = err;
- if (err == 0)
- return 0;
- }
- }
- }
-
- return apx->error;
-}
-
-static guint32
-mve_encode_0x5 (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* copy a block from previous frame using a motion vector
- (-128/-128 to +127/+127) (2 bytes) */
- const GstMveMux *mve = enc->mve;
- guint32 err;
- const guint16 *frame;
- gint x1, x2, xi, y1, y2, yi;
-
- if (mve->quick_encoding || mve->last_frame == NULL)
- return MVE_APPROX_MAX_ERROR;
-
- frame = (guint16 *) GST_BUFFER_DATA (mve->last_frame);
-
- x1 = enc->x - 128;
- x2 = enc->x + 127;
- if (x1 < 0)
- x1 = 0;
- if (x2 + 8 > mve->width)
- x2 = mve->width - 8;
-
- y1 = enc->y - 128;
- y2 = enc->y + 127;
- if (y1 < 0)
- y1 = 0;
- if (y2 + 8 > mve->height)
- y2 = mve->height - 8;
-
- apx->error = MVE_APPROX_MAX_ERROR;
-
- for (yi = y1; yi <= y2; ++yi) {
- gint yoff = yi * mve->width;
-
- for (xi = x1; xi <= x2; ++xi) {
- err = mve_block_error (mve, src, frame + yoff + xi, apx->error);
- if (err < apx->error) {
- apx->data[0] = xi - enc->x;
- apx->data[1] = yi - enc->y;
- mve_store_block (mve, frame + yoff + xi, apx->block);
- apx->error = err;
- if (err == 0)
- return 0;
- }
- }
- }
-
- return apx->error;
-}
-
-static guint32
-mve_encode_0x7a (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* 2-color encoding for 2x2 solid blocks (6 bytes) */
- guint16 p[2];
- guint16 mean;
- guint32 e1, e2;
- guint x, y;
- guint8 r[2], g[2], b[2], rb, gb, bb;
- guint16 *block = apx->block;
- guint16 mask = 0x0001;
- guint16 flags = 0;
-
- /* calculate mean colors for the entire block */
- if (!enc->q2available) {
- enc->q2error =
- mve_quantize (enc->mve, src, 8, 8, 0, 2, enc->q2block, enc->q2colors);
- enc->q2available = TRUE;
- }
-
- /* p[0] & 0x8000 */
- GST_WRITE_UINT16_LE (&apx->data[0], enc->q2colors[0] | 0x8000);
- GST_WRITE_UINT16_LE (&apx->data[2], enc->q2colors[1]);
-
- for (x = 0; x < 2; ++x) {
- r[x] = MVE_RVAL (enc->q2colors[x]);
- g[x] = MVE_GVAL (enc->q2colors[x]);
- b[x] = MVE_BVAL (enc->q2colors[x]);
- }
-
- /* calculate mean colors for each 2x2 block and map to global colors */
- for (y = 0; y < 4; ++y) {
- for (x = 0; x < 4; ++x, mask <<= 1) {
- p[0] = src[enc->mve->width];
- p[1] = src[enc->mve->width + 1];
-
- rb = (MVE_RVAL (src[0]) + MVE_RVAL (src[1]) + MVE_RVAL (p[0]) +
- MVE_RVAL (p[1]) + 2) / 4;
- gb = (MVE_GVAL (src[0]) + MVE_GVAL (src[1]) + MVE_GVAL (p[0]) +
- MVE_GVAL (p[1]) + 2) / 4;
- bb = (MVE_BVAL (src[0]) + MVE_BVAL (src[1]) + MVE_BVAL (p[0]) +
- MVE_BVAL (p[1]) + 2) / 4;
-
- e1 = mve_color_dist_rgb (rb, gb, bb, r[0], g[0], b[0]);
- e2 = mve_color_dist_rgb (rb, gb, bb, r[1], g[1], b[1]);
-
- if (e1 > e2) {
- mean = enc->q2colors[1];
- flags |= mask;
- } else {
- mean = enc->q2colors[0];
- }
-
- block[0] = block[1] = block[8] = block[9] = mean;
-
- src += 2;
- block += 2;
- }
- src += (enc->mve->width * 2) - 8;
- block += 8;
- }
-
- apx->data[4] = flags & 0x00FF;
- apx->data[5] = (flags & 0xFF00) >> 8;
-
- apx->error =
- mve_block_error_packed (enc->mve, src - enc->mve->width * 8, apx->block);
- return apx->error;
-}
-
-static guint32
-mve_encode_0x7b (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* generic 2-color encoding (12 bytes) */
- guint x, y;
- guint8 *data = apx->data;
- guint16 *block = apx->block;
-
- if (!enc->q2available) {
- enc->q2error =
- mve_quantize (enc->mve, src, 8, 8, 0, 2, enc->q2block, enc->q2colors);
- enc->q2available = TRUE;
- }
-
- memcpy (block, enc->q2block, 128);
-
- /* !(p[0] & 0x8000) */
- GST_WRITE_UINT16_LE (&data[0], enc->q2colors[0] & ~0x8000);
- GST_WRITE_UINT16_LE (&data[2], enc->q2colors[1]);
- data += 4;
-
- for (y = 0; y < 8; ++y) {
- guint8 flags = 0;
-
- for (x = 0x01; x <= 0x80; x <<= 1) {
- if (*block == enc->q2colors[1])
- flags |= x;
- ++block;
- }
- *data++ = flags;
- }
-
- apx->error = enc->q2error;
- return apx->error;
-}
-
-static guint32
-mve_encode_0x8a (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* 2-color encoding for top and bottom half (16 bytes) */
- guint16 cols[2];
- guint32 flags;
- guint i, x, y, shifter;
- guint16 *block = apx->block;
- guint8 *data = apx->data;
-
- apx->error = 0;
-
- for (i = 0; i < 2; ++i) {
- apx->error += mve_quantize (enc->mve, src, 8, 4, i, 2, apx->block, cols);
-
- flags = 0;
- shifter = 0;
-
- /* p0 & 0x8000 && p2 & 0x8000 */
- GST_WRITE_UINT16_LE (&data[0], cols[0] | 0x8000);
- GST_WRITE_UINT16_LE (&data[2], cols[1]);
-
- for (y = 0; y < 4; ++y) {
- for (x = 0; x < 8; ++x, ++shifter) {
- if (block[x] == cols[1])
- flags |= 1 << shifter;
- }
- block += 8;
- }
- data[4] = flags & 0x000000FF;
- data[5] = (flags & 0x0000FF00) >> 8;
- data[6] = (flags & 0x00FF0000) >> 16;
- data[7] = (flags & 0xFF000000) >> 24;
- data += 8;
- }
-
- return apx->error;
-}
-
-static guint32
-mve_encode_0x8b (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* 2-color encoding for left and right half (16 bytes) */
- guint16 cols[2];
- guint32 flags;
- guint i, x, y, shifter;
- guint16 *block = apx->block;
- guint8 *data = apx->data;
-
- apx->error = 0;
-
- for (i = 0; i < 2; ++i) {
- apx->error += mve_quantize (enc->mve, src, 4, 8, i, 2, apx->block, cols);
-
- flags = 0;
- shifter = 0;
-
- /* p0 & 0x8000 && !(p2 & 0x8000) */
- GST_WRITE_UINT16_LE (&data[0], (cols[0] & ~0x8000) | (0x8000 * (i ^ 1)));
- GST_WRITE_UINT16_LE (&data[2], cols[1]);
-
- for (y = 0; y < 8; ++y) {
- for (x = 0; x < 4; ++x, ++shifter) {
- if (block[x] == cols[1])
- flags |= 1 << shifter;
- }
- block += 8;
- }
-
- data[4] = flags & 0x000000FF;
- data[5] = (flags & 0x0000FF00) >> 8;
- data[6] = (flags & 0x00FF0000) >> 16;
- data[7] = (flags & 0xFF000000) >> 24;
- data += 8;
- block = apx->block + 4;
- }
-
- return apx->error;
-}
-
-static guint32
-mve_encode_0x8c (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* 2-color encoding for each 4x4 quadrant (24 bytes) */
- guint16 cols[2];
- guint16 flags;
- guint i, x, y, shifter;
- guint16 *block;
- guint8 *data = apx->data;
-
- apx->error = 0;
-
- for (i = 0; i < 4; ++i) {
- apx->error +=
- mve_quantize (enc->mve, src, 4, 4, ((i & 1) << 1) | ((i & 2) >> 1), 2,
- apx->block, cols);
-
- /* !(p0 & 0x8000) */
- GST_WRITE_UINT16_LE (&data[0], cols[0] & ~0x8000);
- GST_WRITE_UINT16_LE (&data[2], cols[1]);
-
- block = apx->block + ((i / 2) * 4) + ((i % 2) * 32);
- flags = 0;
- shifter = 0;
-
- for (y = 0; y < 4; ++y) {
- for (x = 0; x < 4; ++x, ++shifter) {
- if (block[x] == cols[1])
- flags |= 1 << shifter;
- }
- block += 8;
- }
-
- data[4] = flags & 0x00FF;
- data[5] = (flags & 0xFF00) >> 8;
- data += 6;
- }
-
- return apx->error;
-}
-
-static guint32
-mve_encode_0x9a (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* 4-color encoding for 2x2 solid blocks (12 bytes) */
- guint16 p[2];
- guint32 e, emin;
- guint i, x, y, mean = 0;
- guint8 r[4], g[4], b[4], rb, gb, bb;
- guint16 *block = apx->block;
- guint shifter = 0;
- guint32 flags = 0;
-
- /* calculate mean colors for the entire block */
- if (!enc->q4available) {
- enc->q4error =
- mve_quantize (enc->mve, src, 8, 8, 0, 4, enc->q4block, enc->q4colors);
- enc->q4available = TRUE;
- }
-
- /* !(p[0] & 0x8000) && p[2] & 0x8000 */
- GST_WRITE_UINT16_LE (&apx->data[0], enc->q4colors[0] & ~0x8000);
- GST_WRITE_UINT16_LE (&apx->data[2], enc->q4colors[1]);
- GST_WRITE_UINT16_LE (&apx->data[4], enc->q4colors[2] | 0x8000);
- GST_WRITE_UINT16_LE (&apx->data[6], enc->q4colors[3]);
-
- for (i = 0; i < 4; ++i) {
- r[i] = MVE_RVAL (enc->q4colors[i]);
- g[i] = MVE_GVAL (enc->q4colors[i]);
- b[i] = MVE_BVAL (enc->q4colors[i]);
- }
-
- /* calculate mean colors for each 2x2 block and map to global colors */
- for (y = 0; y < 4; ++y) {
- for (x = 0; x < 4; ++x, shifter += 2) {
- p[0] = src[enc->mve->width];
- p[1] = src[enc->mve->width + 1];
-
- rb = (MVE_RVAL (src[0]) + MVE_RVAL (src[1]) + MVE_RVAL (p[0]) +
- MVE_RVAL (p[1]) + 2) / 4;
- gb = (MVE_GVAL (src[0]) + MVE_GVAL (src[1]) + MVE_GVAL (p[0]) +
- MVE_GVAL (p[1]) + 2) / 4;
- bb = (MVE_BVAL (src[0]) + MVE_BVAL (src[1]) + MVE_BVAL (p[0]) +
- MVE_BVAL (p[1]) + 2) / 4;
-
- emin = MVE_APPROX_MAX_ERROR;
- for (i = 0; i < 4; ++i) {
- e = mve_color_dist_rgb (rb, gb, bb, r[i], g[i], b[i]);
- if (e < emin) {
- emin = e;
- mean = i;
- }
- }
-
- flags |= mean << shifter;
- block[0] = block[1] = block[8] = block[9] = enc->q4colors[mean];
-
- src += 2;
- block += 2;
- }
- src += (enc->mve->width * 2) - 8;
- block += 8;
- }
-
- apx->data[8] = flags & 0x000000FF;
- apx->data[9] = (flags & 0x0000FF00) >> 8;
- apx->data[10] = (flags & 0x00FF0000) >> 16;
- apx->data[11] = (flags & 0xFF000000) >> 24;
-
- apx->error =
- mve_block_error_packed (enc->mve, src - 8 * enc->mve->width, apx->block);
- return apx->error;
-}
-
-static guint32
-mve_encode_0x9b (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* 4-color encoding for 2x1 solid blocks (16 bytes) */
- guint32 e, emin;
- guint i, x, y, mean = 0;
- guint8 r[4], g[4], b[4], rb, gb, bb;
- guint8 *data = apx->data;
- guint16 *block = apx->block;
- guint shifter = 0;
- guint32 flags = 0;
-
- /* calculate mean colors for the entire block */
- if (!enc->q4available) {
- enc->q4error =
- mve_quantize (enc->mve, src, 8, 8, 0, 4, enc->q4block, enc->q4colors);
- enc->q4available = TRUE;
- }
-
- /* p[0] & 0x8000 && !(p[2] & 0x8000) */
- GST_WRITE_UINT16_LE (&data[0], enc->q4colors[0] | 0x8000);
- GST_WRITE_UINT16_LE (&data[2], enc->q4colors[1]);
- GST_WRITE_UINT16_LE (&data[4], enc->q4colors[2] & ~0x8000);
- GST_WRITE_UINT16_LE (&data[6], enc->q4colors[3]);
- data += 8;
-
- for (i = 0; i < 4; ++i) {
- r[i] = MVE_RVAL (enc->q4colors[i]);
- g[i] = MVE_GVAL (enc->q4colors[i]);
- b[i] = MVE_BVAL (enc->q4colors[i]);
- }
-
- /* calculate mean colors for each 2x1 block and map to global colors */
- for (y = 0; y < 8; ++y) {
- for (x = 0; x < 4; ++x, shifter += 2) {
- rb = (MVE_RVAL (src[0]) + MVE_RVAL (src[1]) + 1) / 2;
- gb = (MVE_GVAL (src[0]) + MVE_GVAL (src[1]) + 1) / 2;
- bb = (MVE_BVAL (src[0]) + MVE_BVAL (src[1]) + 1) / 2;
-
- emin = MVE_APPROX_MAX_ERROR;
- for (i = 0; i < 4; ++i) {
- e = mve_color_dist_rgb (rb, gb, bb, r[i], g[i], b[i]);
- if (e < emin) {
- emin = e;
- mean = i;
- }
- }
-
- flags |= mean << shifter;
- block[0] = block[1] = enc->q4colors[mean];
-
- src += 2;
- block += 2;
- }
-
- if ((y == 3) || (y == 7)) {
- data[0] = flags & 0x000000FF;
- data[1] = (flags & 0x0000FF00) >> 8;
- data[2] = (flags & 0x00FF0000) >> 16;
- data[3] = (flags & 0xFF000000) >> 24;
- data += 4;
-
- flags = 0;
- shifter = 0;
- }
-
- src += enc->mve->width - 8;
- }
-
- apx->error =
- mve_block_error_packed (enc->mve, src - 8 * enc->mve->width, apx->block);
- return apx->error;
-}
-
-static guint32
-mve_encode_0x9c (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* 4-color encoding for 1x2 solid blocks (16 bytes) */
- guint16 p2;
- guint32 e, emin;
- guint i, x, y, mean = 0;
- guint8 r[4], g[4], b[4], rb, gb, bb;
- guint8 *data = apx->data;
- guint16 *block = apx->block;
- guint shifter = 0;
- guint32 flags = 0;
-
- /* calculate mean colors for the entire block */
- if (!enc->q4available) {
- enc->q4error =
- mve_quantize (enc->mve, src, 8, 8, 0, 4, enc->q4block, enc->q4colors);
- enc->q4available = TRUE;
- }
-
- /* p[0] & 0x8000 && p[2] & 0x8000 */
- GST_WRITE_UINT16_LE (&data[0], enc->q4colors[0] | 0x8000);
- GST_WRITE_UINT16_LE (&data[2], enc->q4colors[1]);
- GST_WRITE_UINT16_LE (&data[4], enc->q4colors[2] | 0x8000);
- GST_WRITE_UINT16_LE (&data[6], enc->q4colors[3]);
- data += 8;
-
- for (i = 0; i < 4; ++i) {
- r[i] = MVE_RVAL (enc->q4colors[i]);
- g[i] = MVE_GVAL (enc->q4colors[i]);
- b[i] = MVE_BVAL (enc->q4colors[i]);
- }
-
- /* calculate mean colors for each 1x2 block and map to global colors */
- for (y = 0; y < 4; ++y) {
- for (x = 0; x < 8; ++x, shifter += 2) {
- p2 = src[enc->mve->width];
- rb = (MVE_RVAL (src[0]) + MVE_RVAL (p2) + 1) / 2;
- gb = (MVE_GVAL (src[0]) + MVE_GVAL (p2) + 1) / 2;
- bb = (MVE_BVAL (src[0]) + MVE_BVAL (p2) + 1) / 2;
-
- emin = MVE_APPROX_MAX_ERROR;
- for (i = 0; i < 4; ++i) {
- e = mve_color_dist_rgb (rb, gb, bb, r[i], g[i], b[i]);
- if (e < emin) {
- emin = e;
- mean = i;
- }
- }
-
- flags |= mean << shifter;
- block[0] = block[8] = enc->q4colors[mean];
-
- ++src;
- ++block;
- }
-
- if ((y == 1) || (y == 3)) {
- data[0] = flags & 0x000000FF;
- data[1] = (flags & 0x0000FF00) >> 8;
- data[2] = (flags & 0x00FF0000) >> 16;
- data[3] = (flags & 0xFF000000) >> 24;
- data += 4;
-
- flags = 0;
- shifter = 0;
- }
-
- src += (enc->mve->width * 2) - 8;
- block += 8;
- }
-
- apx->error =
- mve_block_error_packed (enc->mve, src - 8 * enc->mve->width, apx->block);
- return apx->error;
-}
-
-static guint32
-mve_encode_0x9d (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* generic 4-color encoding (24 bytes) */
- guint32 flags = 0;
- guint shifter = 0;
- guint i, x, y;
- guint8 *data = apx->data;
- guint16 *block = apx->block;
-
- if (!enc->q4available) {
- enc->q4error =
- mve_quantize (enc->mve, src, 8, 8, 0, 4, enc->q4block, enc->q4colors);
- enc->q4available = TRUE;
- }
-
- memcpy (block, enc->q4block, 128);
-
- /* !(p[0] & 0x8000) && !(p[2] & 0x8000) */
- GST_WRITE_UINT16_LE (&data[0], enc->q4colors[0] & ~0x8000);
- GST_WRITE_UINT16_LE (&data[2], enc->q4colors[1]);
- GST_WRITE_UINT16_LE (&data[4], enc->q4colors[2] & ~0x8000);
- GST_WRITE_UINT16_LE (&data[6], enc->q4colors[3]);
- data += 8;
-
- for (y = 0; y < 8; ++y) {
- for (x = 0; x < 8; ++x, shifter += 2) {
-
- for (i = 0; i < 3; ++i) {
- if (*block == enc->q4colors[i])
- break;
- }
-
- flags |= i << shifter;
- ++block;
- }
-
- data[0] = flags & 0x000000FF;
- data[1] = (flags & 0x0000FF00) >> 8;
- data += 2;
- shifter = 0;
- flags = 0;
- }
-
- apx->error = enc->q4error;
- return apx->error;
-}
-
-static guint32
-mve_encode_0xaa (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* 4-color encoding for top and bottom half (32 bytes) */
- guint16 cols[4];
- guint32 flags;
- guint i, j, x, y, shifter;
- guint16 *block = apx->block;
- guint8 *data = apx->data;
-
- apx->error = 0;
-
- for (i = 0; i < 2; ++i) {
- apx->error += mve_quantize (enc->mve, src, 8, 4, i, 4, apx->block, cols);
-
- flags = 0;
- shifter = 0;
-
- /* p0 & 0x8000 && p4 & 0x8000 */
- GST_WRITE_UINT16_LE (&data[0], cols[0] | 0x8000);
- GST_WRITE_UINT16_LE (&data[2], cols[1]);
- GST_WRITE_UINT16_LE (&data[4], cols[2]);
- GST_WRITE_UINT16_LE (&data[6], cols[3]);
- data += 8;
-
- for (y = 0; y < 4; ++y) {
- for (x = 0; x < 8; ++x, shifter += 2) {
- for (j = 0; j < 3; ++j) {
- if (block[x] == cols[j])
- break;
- }
- flags |= j << shifter;
- }
- block += 8;
-
- if ((y == 1) || (y == 3)) {
- data[0] = flags & 0x000000FF;
- data[1] = (flags & 0x0000FF00) >> 8;
- data[2] = (flags & 0x00FF0000) >> 16;
- data[3] = (flags & 0xFF000000) >> 24;
- data += 4;
- flags = 0;
- shifter = 0;
- }
- }
- }
-
- return apx->error;
-}
-
-static guint32
-mve_encode_0xab (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* 4-color encoding for left and right half (32 bytes) */
- guint16 cols[4];
- guint32 flags;
- guint i, j, x, y, shifter;
- guint16 *block = apx->block;
- guint8 *data = apx->data;
-
- apx->error = 0;
-
- for (i = 0; i < 2; ++i) {
- apx->error += mve_quantize (enc->mve, src, 4, 8, i, 4, apx->block, cols);
-
- flags = 0;
- shifter = 0;
-
- /* p0 & 0x8000 && !(p4 & 0x8000) */
- GST_WRITE_UINT16_LE (&data[0], (cols[0] & ~0x8000) | (0x8000 * (i ^ 1)));
- GST_WRITE_UINT16_LE (&data[2], cols[1]);
- GST_WRITE_UINT16_LE (&data[4], cols[2]);
- GST_WRITE_UINT16_LE (&data[6], cols[3]);
- data += 8;
-
- for (y = 0; y < 8; ++y) {
- for (x = 0; x < 4; ++x, shifter += 2) {
- for (j = 0; j < 3; ++j) {
- if (block[x] == cols[j])
- break;
- }
- flags |= j << shifter;
- }
- block += 8;
-
- if ((y == 3) || (y == 7)) {
- data[0] = flags & 0x000000FF;
- data[1] = (flags & 0x0000FF00) >> 8;
- data[2] = (flags & 0x00FF0000) >> 16;
- data[3] = (flags & 0xFF000000) >> 24;
- data += 4;
- flags = 0;
- shifter = 0;
- }
- }
- block = apx->block + 4;
- }
-
- return apx->error;
-}
-
-static guint32
-mve_encode_0xac (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* 4-color encoding for each 4x4 quadrant (48 bytes) */
- guint16 cols[4];
- guint32 flags;
- guint i, j, x, y, shifter;
- guint16 *block;
- guint8 *data = apx->data;
-
- apx->error = 0;
-
- for (i = 0; i < 4; ++i) {
- apx->error +=
- mve_quantize (enc->mve, src, 4, 4, ((i & 1) << 1) | ((i & 2) >> 1), 4,
- apx->block, cols);
-
- /* !(p0 & 0x8000) */
- GST_WRITE_UINT16_LE (&data[0], cols[0] & ~0x8000);
- GST_WRITE_UINT16_LE (&data[2], cols[1]);
- GST_WRITE_UINT16_LE (&data[4], cols[2]);
- GST_WRITE_UINT16_LE (&data[6], cols[3]);
-
- block = apx->block + ((i / 2) * 4) + ((i % 2) * 32);
- flags = 0;
- shifter = 0;
-
- for (y = 0; y < 4; ++y) {
- for (x = 0; x < 4; ++x, shifter += 2) {
- for (j = 0; j < 3; ++j) {
- if (block[x] == cols[j])
- break;
- }
- flags |= j << shifter;
- }
- block += 8;
- }
-
- data[8] = flags & 0x000000FF;
- data[9] = (flags & 0x0000FF00) >> 8;
- data[10] = (flags & 0x00FF0000) >> 16;
- data[11] = (flags & 0xFF000000) >> 24;
- data += 12;
- }
-
- return apx->error;
-}
-
-static guint32
-mve_encode_0xb (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* 64-color encoding (each pixel in block is a different color) (128 bytes) */
- guint i;
-
- apx->error = 0;
-
- mve_store_block (enc->mve, src, apx->block);
- for (i = 0; i < 64; ++i)
- GST_WRITE_UINT16_LE (&apx->data[i << 1], apx->block[i]);
-
- return 0;
-}
-
-static guint32
-mve_encode_0xc (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* 16-color block encoding: each 2x2 block is a different color (32 bytes) */
- guint i = 0, x, y;
- const guint w = enc->mve->width;
- guint16 r, g, b;
-
- /* calculate median color for each 2x2 block */
- for (y = 0; y < 4; ++y) {
- for (x = 0; x < 4; ++x) {
- r = MVE_RVAL (src[0]) + MVE_RVAL (src[1]) +
- MVE_RVAL (src[w]) + MVE_RVAL (src[w + 1]) + 2;
- g = MVE_GVAL (src[0]) + MVE_GVAL (src[1]) +
- MVE_GVAL (src[w]) + MVE_GVAL (src[w + 1]) + 2;
- b = MVE_BVAL (src[0]) + MVE_BVAL (src[1]) +
- MVE_BVAL (src[w]) + MVE_BVAL (src[w + 1]) + 2;
- apx->block[i] = apx->block[i + 1] = apx->block[i + 2] =
- apx->block[i + 3] = MVE_COL (r >> 2, g >> 2, b >> 2);
- GST_WRITE_UINT16_LE (&apx->data[i >> 1], apx->block[i]);
-
- i += 4;
- src += 2;
- }
- src += (w * 2) - 8;
- }
-
- apx->error = mve_block_error_packed (enc->mve, src - (8 * w), apx->block);
- return apx->error;
-}
-
-static guint32
-mve_encode_0xd (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* 4-color block encoding: each 4x4 block is a different color (8 bytes) */
- guint i, x, y;
- guint16 *block;
-
- /* calculate median color for each 4x4 block */
- for (i = 0; i < 4; ++i) {
- guint16 median =
- mve_median_sub (enc->mve, src, 4, 4, ((i & 1) << 1) | ((i & 2) >> 1));
-
- block = apx->block + ((i / 2) * 4) + ((i % 2) * 32);
- for (y = 0; y < 4; ++y) {
- for (x = 0; x < 4; ++x) {
- block[x] = median;
- }
- block += 8;
- }
-
- GST_WRITE_UINT16_LE (&apx->data[i << 1], median);
- }
-
- apx->error = mve_block_error_packed (enc->mve, src, apx->block);
- return apx->error;
-}
-
-static guint32
-mve_encode_0xe (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* 1-color encoding: the whole block is 1 solid color (2 bytes) */
- guint i;
- guint16 median = mve_median (enc->mve, src);
-
- for (i = 0; i < 64; ++i)
- apx->block[i] = median;
-
- apx->error = mve_block_error_packed (enc->mve, src, apx->block);
- GST_WRITE_UINT16_LE (apx->data, median);
-
- return apx->error;
-}
-
-static guint32
-mve_encode_0xf (GstMveEncoderData * enc, const guint16 * src,
- GstMveApprox * apx)
-{
- /* 2 colors dithered encoding (4 bytes) */
- guint i, x, y;
- guint32 r[2] = { 0 }, g[2] = {
- 0}, b[2] = {
- 0};
- guint16 col[2];
-
- /* find medians for both colors */
- for (y = 0; y < 8; ++y) {
- for (x = 0; x < 8; x += 2) {
- guint16 p = src[x];
-
- r[y & 1] += MVE_RVAL (p);
- g[y & 1] += MVE_GVAL (p);
- b[y & 1] += MVE_BVAL (p);
-
- p = src[x + 1];
- r[(y & 1) ^ 1] += MVE_RVAL (p);
- g[(y & 1) ^ 1] += MVE_GVAL (p);
- b[(y & 1) ^ 1] += MVE_BVAL (p);
- }
- src += enc->mve->width;
- }
- col[0] = MVE_COL ((r[0] + 16) / 32, (g[0] + 16) / 32, (b[0] + 16) / 32);
- col[1] = MVE_COL ((r[1] + 16) / 32, (g[1] + 16) / 32, (b[1] + 16) / 32);
-
- /* store block after encoding */
- for (i = 0, y = 0; y < 8; ++y) {
- for (x = 0; x < 4; ++x) {
- apx->block[i++] = col[y & 1];
- apx->block[i++] = col[(y & 1) ^ 1];
- }
- }
-
- GST_WRITE_UINT16_LE (&apx->data[0], col[0]);
- GST_WRITE_UINT16_LE (&apx->data[2], col[1]);
- apx->error = mve_block_error_packed (enc->mve,
- src - (8 * enc->mve->width), apx->block);
- return apx->error;
-}
-
-/* all available encodings in the preferred order,
- i.e. in ascending encoded size */
-static const GstMveEncoding mve_encodings[] = {
- {0x1, 0, mve_encode_0x1},
- {0x0, 0, mve_encode_0x0},
- {0x3, 1, mve_encode_0x3},
- {0x4, 1, mve_encode_0x4},
- {0x2, 1, mve_encode_0x2},
- {0xe, 2, mve_encode_0xe},
- {0x5, 2, mve_encode_0x5},
- {0xf, 4, mve_encode_0xf},
- {0x7, 6, mve_encode_0x7a},
- {0xd, 8, mve_encode_0xd},
- {0x7, 12, mve_encode_0x7b},
- {0x9, 12, mve_encode_0x9a},
- {0x9, 16, mve_encode_0x9b},
- {0x9, 16, mve_encode_0x9c},
- {0x8, 16, mve_encode_0x8a},
- {0x8, 16, mve_encode_0x8b},
- {0x8, 24, mve_encode_0x8c},
- {0x9, 24, mve_encode_0x9d},
- {0xc, 32, mve_encode_0xc},
- {0xa, 32, mve_encode_0xaa},
- {0xa, 32, mve_encode_0xab},
- {0xa, 48, mve_encode_0xac},
- {0xb, 128, mve_encode_0xb}
-};
-
-static gboolean
-mve_reorder_solution (GArray ** solution, guint16 n)
-{
- /* do a binary search to find the position to reinsert the modified element */
- /* the block we need to reconsider is always at position 0 */
- /* return TRUE if this block only has 1 encoding left and can be dropped */
- if (mve_comp_solution (&solution[0], &solution[1]) <= 0)
- return FALSE; /* already sorted */
-
- else if (solution[0]->len <= 1)
- /* drop this element from further calculations since we cannot improve here */
- return TRUE;
-
- else {
- /* we know the error value can only get worse, so we can actually start at 1 */
- guint lower = 1;
- guint upper = n - 1;
- gint cmp;
- guint idx = 0;
-
- while (upper > lower) {
- idx = lower + ((upper - lower) / 2);
-
- cmp = mve_comp_solution (&solution[0], &solution[idx]);
-
- if (cmp < 0) {
- upper = idx;
- } else if (cmp > 0) {
- lower = ++idx;
- } else {
- upper = lower = idx;
- }
- }
-
- if (idx > 0) {
- /* rearrange array members in new order */
- GArray *a = solution[0];
-
- memcpy (&solution[0], &solution[1], sizeof (GArray *) * idx);
- solution[idx] = a;
- }
- }
- return FALSE;
-}
-
-static guint32
-gst_mve_find_solution (GArray ** approx, guint16 n, guint32 size, guint16 max)
-{
- /* build an array of approximations we can shuffle around */
- GstMveApprox *sol_apx;
- GArray **solution = g_malloc (sizeof (GArray *) * n);
- GArray **current = solution;
-
- memcpy (solution, approx, sizeof (GArray *) * n);
-
- qsort (solution, n, sizeof (GArray *), mve_comp_solution);
-
- do {
- /* array is now sorted by error of the next to optimal approximation;
- drop optimal approximation for the best block */
-
- /* unable to reduce size further */
- if (current[0]->len <= 1)
- break;
-
- sol_apx = &g_array_index (current[0], GstMveApprox, current[0]->len - 1);
- size -= mve_encodings[sol_apx->type].size;
- g_array_remove_index_fast (current[0], current[0]->len - 1);
- sol_apx = &g_array_index (current[0], GstMveApprox, current[0]->len - 1);
- size += mve_encodings[sol_apx->type].size;
-
- if (mve_reorder_solution (current, n)) {
- ++current;
- --n;
- }
- } while (size > max);
-
- g_free (solution);
-
- return size;
-}
-
-GstFlowReturn
-mve_encode_frame16 (GstMveMux * mve, GstBuffer * frame, guint16 max_data)
-{
- guint16 *src;
- GstFlowReturn ret = GST_FLOW_ERROR;
- guint8 *cm = mve->chunk_code_map;
- GByteArray *pstream;
- GArray **approx;
- GstMveApprox apx;
- GstMveEncoderData enc;
- const guint16 blocks = (mve->width * mve->height) / 64;
- guint32 encoded_size = 2; /* two initial bytes for the offset */
- guint i = 0, x, y;
-
- src = (guint16 *) GST_BUFFER_DATA (frame);
-
- approx = g_malloc (sizeof (GArray *) * blocks);
-
- enc.mve = mve;
-
- for (enc.y = 0; enc.y < mve->height; enc.y += 8) {
- for (enc.x = 0; enc.x < mve->width; enc.x += 8) {
- guint32 err, last_err = MVE_APPROX_MAX_ERROR;
- guint type = 0;
- guint best = 0;
-
- enc.q2available = enc.q4available = FALSE;
- approx[i] = g_array_new (FALSE, FALSE, sizeof (GstMveApprox));
-
- do {
- err = mve_encodings[type].approx (&enc, src, &apx);
-
- if (err < last_err) {
- apx.type = best = type;
- g_array_append_val (approx[i], apx);
- last_err = err;
- }
-
- ++type;
- } while (last_err != 0);
-
- encoded_size += mve_encodings[best].size;
- ++i;
- src += 8;
- }
- src += 7 * mve->width;
- }
-
- /* find best solution with size constraints */
- GST_DEBUG_OBJECT (mve, "encoded frame %u in %u bytes (lossless)",
- mve->video_frames + 1, encoded_size);
-
-#if 0
- /* FIXME */
- src = (guint16 *) GST_BUFFER_DATA (frame);
- for (i = 0, y = 0; y < mve->height; y += 8) {
- for (x = 0; x < mve->width; x += 8, ++i) {
- GstMveApprox *sol =
- &g_array_index (approx[i], GstMveApprox, approx[i]->len - 1);
- guint opcode = mve_encodings[sol->type].opcode;
- guint j, k;
-
- if (sol->error > 0)
- GST_WARNING_OBJECT (mve, "error is %lu for %d/%d (0x%x)", sol->error, x,
- y, opcode);
-
- for (j = 0; j < 8; ++j) {
- guint16 *o = src + j * mve->width;
- guint16 *c = sol->block + j * 8;
-
- if (memcmp (o, c, 16)) {
- GST_WARNING_OBJECT (mve, "opcode 0x%x (type %d) at %d/%d, line %d:",
- opcode, sol->type, x, y, j + 1);
- for (k = 0; k < 8; ++k) {
- o = src + k * mve->width;
- c = sol->block + k * 8;
- GST_WARNING_OBJECT (mve,
- "%d should be: %4d %4d %4d %4d %4d %4d %4d %4d", k, o[0],
- o[1], o[2], o[3], o[4], o[5], o[6], o[7]);
- GST_WARNING_OBJECT (mve,
- "%d but is : %4d %4d %4d %4d %4d %4d %4d %4d", k, c[0],
- c[1], c[2], c[3], c[4], c[5], c[6], c[7]);
- }
- }
- }
- src += 8;
- }
- src += 7 * mve->width;
- }
-#endif
-
- if (encoded_size > max_data) {
- encoded_size =
- gst_mve_find_solution (approx, blocks, encoded_size, max_data);
- if (encoded_size > max_data) {
- GST_ERROR_OBJECT (mve, "unable to compress frame to less than %d bytes",
- encoded_size);
- for (i = 0; i < blocks; ++i)
- g_array_free (approx[i], TRUE);
-
- goto done;
- }
- GST_DEBUG_OBJECT (mve, "compressed frame %u to %u bytes (lossy)",
- mve->video_frames + 1, encoded_size);
- }
-
- mve->chunk_video = g_byte_array_sized_new (encoded_size);
- /* reserve two bytes for the offset pointer we'll fill in later */
- g_byte_array_set_size (mve->chunk_video, 2);
-
- pstream = g_byte_array_new ();
-
- /* encode */
- src = (guint16 *) GST_BUFFER_DATA (frame);
- for (i = 0, y = 0; y < mve->height; y += 8) {
- for (x = 0; x < mve->width; x += 8, ++i) {
- GstMveApprox *sol =
- &g_array_index (approx[i], GstMveApprox, approx[i]->len - 1);
- guint opcode = mve_encodings[sol->type].opcode;
- GByteArray *dest;
-
- if (opcode >= 0x2 && opcode <= 0x4)
- dest = pstream;
- else
- dest = mve->chunk_video;
-
- g_byte_array_append (dest, sol->data, mve_encodings[sol->type].size);
-
- if (i & 1) {
- *cm |= opcode << 4;
- ++cm;
- } else
- *cm = opcode;
-
- /* modify the frame to match the image we actually encoded */
- if (sol->error > 0)
- mve_restore_block (mve, src, sol->block);
-
- src += 8;
- g_array_free (approx[i], TRUE);
- }
- src += 7 * mve->width;
- }
-
- /* now update the offset */
- GST_WRITE_UINT16_LE (mve->chunk_video->data, mve->chunk_video->len);
- g_byte_array_append (mve->chunk_video, pstream->data, pstream->len);
- g_byte_array_free (pstream, TRUE);
-
- ret = GST_FLOW_OK;
-
-done:
- g_free (approx);
-
- return ret;
-}
diff --git a/gst/mve/mvevideoenc8.c b/gst/mve/mvevideoenc8.c
deleted file mode 100644
index bd06693aa..000000000
--- a/gst/mve/mvevideoenc8.c
+++ /dev/null
@@ -1,1733 +0,0 @@
-/*
- * Interplay MVE video encoder (8 bit)
- * Copyright (C) 2006 Jens Granseuer <jensgr@gmx.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "mve.h"
-#include "gstmvemux.h"
-
-typedef struct _GstMveEncoderData GstMveEncoderData;
-typedef struct _GstMveEncoding GstMveEncoding;
-typedef struct _GstMveApprox GstMveApprox;
-typedef struct _GstMveQuant GstMveQuant;
-
-#define MVE_RMASK 0x00ff0000
-#define MVE_GMASK 0x0000ff00
-#define MVE_BMASK 0x000000ff
-#define MVE_RSHIFT 16
-#define MVE_GSHIFT 8
-#define MVE_BSHIFT 0
-
-#define MVE_RVAL(p) (((p) & MVE_RMASK) >> MVE_RSHIFT)
-#define MVE_GVAL(p) (((p) & MVE_GMASK) >> MVE_GSHIFT)
-#define MVE_BVAL(p) (((p) & MVE_BMASK) >> MVE_BSHIFT)
-#define MVE_COL(r,g,b) (((r) << MVE_RSHIFT) | ((g) << MVE_GSHIFT) | ((b) << MVE_BSHIFT))
-
-struct _GstMveEncoderData
-{
- GstMveMux *mve;
- /* current position in frame */
- guint16 x, y;
-
- /* palette for current frame */
- const guint32 *palette;
-
- /* commonly used quantization results
- (2 and 4 colors) for the current block */
- guint8 q2block[64];
- guint8 q2colors[2];
- guint32 q2error;
- gboolean q2available;
-
- guint8 q4block[64];
- guint8 q4colors[4];
- guint32 q4error;
- gboolean q4available;
-};
-
-struct _GstMveEncoding
-{
- guint8 opcode;
- guint8 size;
- guint32 (*approx) (GstMveEncoderData * enc, const guint8 * src,
- GstMveApprox * res);
-};
-
-#define MVE_APPROX_MAX_ERROR G_MAXUINT32
-
-struct _GstMveApprox
-{
- guint32 error;
- guint8 type;
- guint8 data[64]; /* max 64 bytes encoded per block */
- guint8 block[64]; /* block in final image */
-};
-
-struct _GstMveQuant
-{
- guint32 col;
- guint16 r_total, g_total, b_total;
- guint8 r, g, b;
- guint8 hits, hits_last;
- guint32 max_error;
- guint32 max_miss;
-};
-
-#define mve_median(mve, src) mve_median_sub ((mve), (src), 8, 8, 0)
-#define mve_color_dist(c1, c2) \
- mve_color_dist_rgb (MVE_RVAL (c1), MVE_GVAL (c1), MVE_BVAL (c1), \
- MVE_RVAL (c2), MVE_GVAL (c2), MVE_BVAL (c2));
-#define mve_color_dist2(c, r, g, b) \
- mve_color_dist_rgb (MVE_RVAL (c), MVE_GVAL (c), MVE_BVAL (c), (r), (g), (b))
-
-
-/* comparison function for qsort() */
-static int
-mve_comp_solution (const void *a, const void *b)
-{
- const GArray *aa = *((GArray **) a);
- const GArray *bb = *((GArray **) b);
-
- if (aa->len <= 1)
- return G_MAXINT;
- else if (bb->len <= 1)
- return G_MININT;
- else
- return g_array_index (aa, GstMveApprox, aa->len - 2).error -
- g_array_index (bb, GstMveApprox, bb->len - 2).error;
-}
-
-static inline guint32
-mve_color_dist_rgb (guint8 r1, guint8 g1, guint8 b1,
- guint8 r2, guint8 g2, guint8 b2)
-{
- /* euclidean distance (minus sqrt) */
- gint dr = r1 - r2;
- gint dg = g1 - g2;
- gint db = b1 - b2;
-
- return dr * dr + dg * dg + db * db;
-}
-
-static guint8
-mve_find_pal_color (const guint32 * pal, guint32 col)
-{
- /* find the closest matching color in the palette */
- guint i;
- guint8 best = 0;
- const guint8 r = MVE_RVAL (col), g = MVE_GVAL (col), b = MVE_BVAL (col);
- guint32 ebest = MVE_APPROX_MAX_ERROR;
-
- for (i = 0; i < MVE_PALETTE_COUNT; ++i, ++pal) {
- guint32 e = mve_color_dist2 (*pal, r, g, b);
-
- if (e < ebest) {
- ebest = e;
- best = i;
-
- if (ebest == 0)
- break;
- }
- }
-
- return best;
-}
-
-static guint8
-mve_find_pal_color2 (const guint32 * pal, const guint8 * subset, guint32 col,
- guint size)
-{
- /* find the closest matching color in the partial indexed palette */
- guint i;
- guint8 best = 0;
- const guint8 r = MVE_RVAL (col), g = MVE_GVAL (col), b = MVE_BVAL (col);
- guint32 ebest = MVE_APPROX_MAX_ERROR;
-
- for (i = 0; i < size; ++i) {
- guint32 e = mve_color_dist2 (pal[subset[i]], r, g, b);
-
- if (e < ebest) {
- ebest = e;
- best = subset[i];
-
- if (ebest == 0)
- break;
- }
- }
-
- return best;
-}
-
-static void
-mve_map_to_palette (const GstMveEncoderData * enc, const guint8 * colors,
- const guint8 * data, guint8 * dest, guint w, guint h, guint ncols)
-{
- guint x, y;
-
- for (y = 0; y < h; ++y) {
- for (x = 0; x < w; ++x) {
- dest[x] =
- mve_find_pal_color2 (enc->palette, colors, enc->palette[data[x]],
- ncols);
- }
- data += enc->mve->width;
- dest += 8;
- }
-}
-
-/* compute average color in a sub-block */
-static guint8
-mve_median_sub (const GstMveEncoderData * enc, const guint8 * src, guint w,
- guint h, guint n)
-{
- guint x, y;
- const guint max = w * h, max2 = max >> 1;
- guint32 r_total = max2, g_total = max2, b_total = max2;
-
- src += ((n * w) % 8) + (((n * (8 - h)) / (12 - w)) * h * enc->mve->width);
-
- for (y = 0; y < h; ++y) {
- for (x = 0; x < w; ++x) {
- guint32 p = enc->palette[src[x]];
-
- r_total += MVE_RVAL (p);
- g_total += MVE_GVAL (p);
- b_total += MVE_BVAL (p);
- }
- src += enc->mve->width;
- }
-
- return mve_find_pal_color (enc->palette,
- MVE_COL (r_total / max, g_total / max, b_total / max));
-}
-
-static void
-mve_quant_init (const GstMveEncoderData * enc, GstMveQuant * q,
- guint n_clusters, const guint8 * data, guint w, guint h)
-{
- guint i;
- guint x, y;
- guint32 cols[4];
- guint16 val[2];
-
- /* init first cluster with lowest (darkest), second with highest (lightest)
- color. if we need 4 clusters, fill in first and last color in the block
- and hope they make for a good distribution */
- cols[0] = cols[1] = cols[2] = enc->palette[data[0]];
- cols[3] = enc->palette[data[(h - 1) * enc->mve->width + w - 1]];
-
- /* favour red over green and blue */
- val[0] = val[1] =
- (MVE_RVAL (cols[0]) << 1) + MVE_GVAL (cols[0]) + MVE_BVAL (cols[0]);
-
- for (y = 0; y < h; ++y) {
- for (x = 0; x < w; ++x) {
- guint32 c = enc->palette[data[x]];
-
- if ((c != cols[0]) && (c != cols[1])) {
- guint v = (MVE_RVAL (c) << 1) + MVE_GVAL (c) + MVE_BVAL (c);
-
- if (v < val[0]) {
- val[0] = v;
- cols[0] = c;
- } else if (v > val[1]) {
- val[1] = v;
- cols[1] = c;
- }
- }
- }
- data += enc->mve->width;
- }
-
- for (i = 0; i < n_clusters; ++i) {
- q[i].col = cols[i];
- q[i].r = MVE_RVAL (cols[i]);
- q[i].g = MVE_GVAL (cols[i]);
- q[i].b = MVE_BVAL (cols[i]);
- q[i].r_total = q[i].g_total = q[i].b_total = 0;
- q[i].hits = q[i].hits_last = 0;
- q[i].max_error = 0;
- q[i].max_miss = 0;
- }
-}
-
-static gboolean
-mve_quant_update_clusters (GstMveQuant * q, guint n_clusters)
-{
- gboolean changed = FALSE;
- guint i;
-
- for (i = 0; i < n_clusters; ++i) {
- if (q[i].hits > 0) {
- guint32 means = MVE_COL ((q[i].r_total + q[i].hits / 2) / q[i].hits,
- (q[i].g_total + q[i].hits / 2) / q[i].hits,
- (q[i].b_total + q[i].hits / 2) / q[i].hits);
-
- if ((means != q[i].col) || (q[i].hits != q[i].hits_last))
- changed = TRUE;
-
- q[i].col = means;
- q[i].r_total = q[i].g_total = q[i].b_total = 0;
- } else {
- guint j;
- guint32 max_err = 0;
- GstMveQuant *worst = NULL;
-
- /* try to replace unused cluster with a better representative */
- for (j = 0; j < n_clusters; ++j) {
- if (q[j].max_error > max_err) {
- worst = &q[j];
- max_err = worst->max_error;
- }
- }
- if (worst) {
- q[i].col = worst->max_miss;
- worst->max_error = 0;
- changed = TRUE;
- }
- }
-
- q[i].r = MVE_RVAL (q[i].col);
- q[i].g = MVE_GVAL (q[i].col);
- q[i].b = MVE_BVAL (q[i].col);
- q[i].hits_last = q[i].hits;
- q[i].hits = 0;
- }
- for (i = 0; i < n_clusters; ++i) {
- q[i].max_error = 0;
- }
-
- return changed;
-}
-
-/* quantize a sub-block using a k-means algorithm */
-static guint32
-mve_quantize (const GstMveEncoderData * enc, const guint8 * src,
- guint w, guint h, guint n, guint ncols, guint8 * dest, guint8 * cols)
-{
- guint x, y, i;
- GstMveQuant q[4];
- const guint8 *data;
- guint32 error;
-
- g_assert (n <= 4 && ncols <= 4);
-
- src += ((n * w) % 8) + (((n * (8 - h)) / (12 - w)) * h * enc->mve->width);
- dest += ((n * w) % 8) + (((n * (8 - h)) / (12 - w)) * h * 8);
-
- mve_quant_init (enc, q, ncols, src, w, h);
-
- do {
- data = src;
- error = 0;
-
- /* for each pixel find the closest cluster */
- for (y = 0; y < h; ++y) {
- for (x = 0; x < w; ++x) {
- guint32 c = enc->palette[data[x]];
- guint8 r = MVE_RVAL (c), g = MVE_GVAL (c), b = MVE_BVAL (c);
- guint32 minerr = MVE_APPROX_MAX_ERROR, err;
- GstMveQuant *best = NULL;
-
- for (i = 0; i < ncols; ++i) {
- err = mve_color_dist_rgb (r, g, b, q[i].r, q[i].g, q[i].b);
-
- if (err < minerr) {
- minerr = err;
- best = &q[i];
- }
- }
-
- ++best->hits;
- best->r_total += r;
- best->g_total += g;
- best->b_total += b;
-
- if (minerr > best->max_error) {
- best->max_error = minerr;
- best->max_miss = c;
- }
-
- error += minerr;
- }
- data += enc->mve->width;
- }
- } while (mve_quant_update_clusters (q, ncols));
-
- /* fill cols array with result colors */
- for (i = 0; i < ncols; ++i)
- cols[i] = mve_find_pal_color (enc->palette, q[i].col);
-
- /* make sure we have unique colors in slots 0/1 and 2/3 */
- if (cols[0] == cols[1])
- ++cols[1];
- if ((ncols > 2) && (cols[2] == cols[3]))
- ++cols[3];
-
- /* generate the resulting quantized block */
- mve_map_to_palette (enc, cols, src, dest, w, h, ncols);
-
- return error;
-}
-
-static guint32
-mve_block_error (const GstMveEncoderData * enc, const guint8 * b1,
- const guint8 * b2, guint32 threshold)
-{
- /* compute error between two blocks in a frame */
- guint32 e = 0;
- guint x, y;
-
- for (y = 0; y < 8; ++y) {
- for (x = 0; x < 8; ++x) {
- e += mve_color_dist (enc->palette[*b1], enc->palette[*b2]);
-
- /* using a threshold to return early gives a huge performance bonus */
- if (e >= threshold)
- return MVE_APPROX_MAX_ERROR;
- ++b1;
- ++b2;
- }
-
- b1 += enc->mve->width - 8;
- b2 += enc->mve->width - 8;
- }
-
- return e;
-}
-
-static guint32
-mve_block_error_packed (const GstMveEncoderData * enc, const guint8 * block,
- const guint8 * scratch)
-{
- /* compute error between a block in a frame and a (continuous) scratch pad */
- guint32 e = 0;
- guint x, y;
-
- for (y = 0; y < 8; ++y) {
- for (x = 0; x < 8; ++x) {
- guint32 c1 = enc->palette[block[x]], c2 = enc->palette[scratch[x]];
-
- e += mve_color_dist (c1, c2);
- }
- block += enc->mve->width;
- scratch += 8;
- }
-
- return e;
-}
-
-static void
-mve_store_block (const GstMveMux * mve, const guint8 * block, guint8 * scratch)
-{
- /* copy block from frame to a (continuous) scratch pad */
- guint y;
-
- for (y = 0; y < 8; ++y) {
- memcpy (scratch, block, 8);
- block += mve->width;
- scratch += 8;
- }
-}
-
-static void
-mve_restore_block (const GstMveMux * mve, guint8 * block,
- const guint8 * scratch)
-{
- /* copy block from scratch pad to frame */
- guint y;
-
- for (y = 0; y < 8; ++y) {
- memcpy (block, scratch, 8);
- block += mve->width;
- scratch += 8;
- }
-}
-
-
-static guint32
-mve_try_vector (GstMveEncoderData * enc, const guint8 * src,
- const guint8 * frame, gint pn, GstMveApprox * apx)
-{
- /* try to locate a similar 8x8 block in the given frame using a motion vector */
- guint i;
- gint dx, dy;
- gint fx, fy;
- guint32 err;
-
- apx->error = MVE_APPROX_MAX_ERROR;
-
- for (i = 0; i < 256; ++i) {
- if (i < 56) {
- dx = 8 + (i % 7);
- dy = i / 7;
- } else {
- dx = -14 + ((i - 56) % 29);
- dy = 8 + ((i - 56) / 29);
- }
-
- fx = enc->x + dx * pn;
- fy = enc->y + dy * pn;
-
- if ((fx >= 0) && (fy >= 0) && (fx + 8 <= enc->mve->width)
- && (fy + 8 <= enc->mve->height)) {
- err =
- mve_block_error (enc, src, frame + fy * enc->mve->width + fx,
- apx->error);
- if (err < apx->error) {
- apx->data[0] = i;
- mve_store_block (enc->mve, frame + fy * enc->mve->width + fx,
- apx->block);
- apx->error = err;
- if (err == 0)
- return 0;
- }
- }
- }
-
- return apx->error;
-}
-
-static guint32
-mve_encode_0x0 (GstMveEncoderData * enc, const guint8 * src, GstMveApprox * apx)
-{
- /* copy a block from the last frame (0 bytes) */
- if (enc->mve->last_frame == NULL)
- return MVE_APPROX_MAX_ERROR;
-
- mve_store_block (enc->mve,
- GST_BUFFER_DATA (enc->mve->last_frame) +
- enc->y * enc->mve->width + enc->x, apx->block);
- apx->error = mve_block_error_packed (enc, src, apx->block);
- return apx->error;
-}
-
-static guint32
-mve_encode_0x1 (GstMveEncoderData * enc, const guint8 * src, GstMveApprox * apx)
-{
- /* copy a block from the second to last frame (0 bytes) */
- if (enc->mve->second_last_frame == NULL)
- return MVE_APPROX_MAX_ERROR;
-
- mve_store_block (enc->mve,
- GST_BUFFER_DATA (enc->mve->second_last_frame) +
- enc->y * enc->mve->width + enc->x, apx->block);
- apx->error = mve_block_error_packed (enc, src, apx->block);
- return apx->error;
-}
-
-static guint32
-mve_encode_0x2 (GstMveEncoderData * enc, const guint8 * src, GstMveApprox * apx)
-{
- /* copy block from 2 frames ago using a motion vector (1 byte) */
- if (enc->mve->quick_encoding || enc->mve->second_last_frame == NULL)
- return MVE_APPROX_MAX_ERROR;
-
- apx->error = mve_try_vector (enc, src,
- GST_BUFFER_DATA (enc->mve->second_last_frame), 1, apx);
- return apx->error;
-}
-
-static guint32
-mve_encode_0x3 (GstMveEncoderData * enc, const guint8 * src, GstMveApprox * apx)
-{
- /* copy 8x8 block from current frame from an up/left block (1 byte) */
- if (enc->mve->quick_encoding)
- return MVE_APPROX_MAX_ERROR;
-
- apx->error = mve_try_vector (enc, src,
- src - enc->mve->width * enc->y - enc->x, -1, apx);
- return apx->error;
-}
-
-
-static guint32
-mve_encode_0x4 (GstMveEncoderData * enc, const guint8 * src, GstMveApprox * apx)
-{
- /* copy a block from previous frame using a motion vector (-8/-8 to +7/+7) (1 byte) */
- const GstMveMux *mve = enc->mve;
- guint32 err;
- const guint8 *frame;
- gint x1, x2, xi, y1, y2, yi;
-
- if (mve->last_frame == NULL)
- return MVE_APPROX_MAX_ERROR;
-
- frame = GST_BUFFER_DATA (mve->last_frame);
-
- x1 = enc->x - 8;
- x2 = enc->x + 7;
- if (x1 < 0)
- x1 = 0;
- else if (x2 + 8 > mve->width)
- x2 = mve->width - 8;
-
- y1 = enc->y - 8;
- y2 = enc->y + 7;
- if (y1 < 0)
- y1 = 0;
- else if (y2 + 8 > mve->height)
- y2 = mve->height - 8;
-
- apx->error = MVE_APPROX_MAX_ERROR;
-
- for (yi = y1; yi <= y2; ++yi) {
- guint yoff = yi * mve->width;
-
- for (xi = x1; xi <= x2; ++xi) {
- err = mve_block_error (enc, src, frame + yoff + xi, apx->error);
- if (err < apx->error) {
- apx->data[0] = ((xi - enc->x + 8) & 0xF) | ((yi - enc->y + 8) << 4);
- mve_store_block (mve, frame + yoff + xi, apx->block);
- apx->error = err;
- if (err == 0)
- return 0;
- }
- }
- }
-
- return apx->error;
-}
-
-static guint32
-mve_encode_0x5 (GstMveEncoderData * enc, const guint8 * src, GstMveApprox * apx)
-{
- /* copy a block from previous frame using a motion vector
- (-128/-128 to +127/+127) (2 bytes) */
- const GstMveMux *mve = enc->mve;
- guint32 err;
- const guint8 *frame;
- gint x1, x2, xi, y1, y2, yi;
-
- if (mve->quick_encoding || mve->last_frame == NULL)
- return MVE_APPROX_MAX_ERROR;
-
- frame = GST_BUFFER_DATA (mve->last_frame);
-
- x1 = enc->x - 128;
- x2 = enc->x + 127;
- if (x1 < 0)
- x1 = 0;
- if (x2 + 8 > mve->width)
- x2 = mve->width - 8;
-
- y1 = enc->y - 128;
- y2 = enc->y + 127;
- if (y1 < 0)
- y1 = 0;
- if (y2 + 8 > mve->height)
- y2 = mve->height - 8;
-
- apx->error = MVE_APPROX_MAX_ERROR;
-
- for (yi = y1; yi <= y2; ++yi) {
- gint yoff = yi * mve->width;
-
- for (xi = x1; xi <= x2; ++xi) {
- err = mve_block_error (enc, src, frame + yoff + xi, apx->error);
- if (err < apx->error) {
- apx->data[0] = xi - enc->x;
- apx->data[1] = yi - enc->y;
- mve_store_block (mve, frame + yoff + xi, apx->block);
- apx->error = err;
- if (err == 0)
- return 0;
- }
- }
- }
-
- return apx->error;
-}
-
-static guint32
-mve_encode_0x7a (GstMveEncoderData * enc, const guint8 * src,
- GstMveApprox * apx)
-{
- /* 2-color encoding for 2x2 solid blocks (4 bytes) */
- guint32 pix[4];
- guint8 mean;
- guint32 e1, e2;
- guint x, y;
- guint8 r[2], g[2], b[2], rb, gb, bb;
- guint8 *block = apx->block;
- guint16 mask = 0x0001;
- guint16 flags = 0;
-
- /* calculate mean colors for the entire block */
- if (!enc->q2available) {
- enc->q2error =
- mve_quantize (enc, src, 8, 8, 0, 2, enc->q2block, enc->q2colors);
- enc->q2available = TRUE;
- }
-
- /* p0 > p1 */
- apx->data[0] = MAX (enc->q2colors[0], enc->q2colors[1]);
- apx->data[1] = MIN (enc->q2colors[0], enc->q2colors[1]);
-
- for (x = 0; x < 2; ++x) {
- r[x] = MVE_RVAL (enc->palette[apx->data[x]]);
- g[x] = MVE_GVAL (enc->palette[apx->data[x]]);
- b[x] = MVE_BVAL (enc->palette[apx->data[x]]);
- }
-
- /* calculate mean colors for each 2x2 block and map to global colors */
- for (y = 0; y < 4; ++y) {
- for (x = 0; x < 4; ++x, mask <<= 1) {
- pix[0] = enc->palette[src[0]];
- pix[1] = enc->palette[src[1]];
- pix[2] = enc->palette[src[enc->mve->width]];
- pix[3] = enc->palette[src[enc->mve->width + 1]];
-
- rb = (MVE_RVAL (pix[0]) + MVE_RVAL (pix[1]) + MVE_RVAL (pix[2]) +
- MVE_RVAL (pix[3]) + 2) / 4;
- gb = (MVE_GVAL (pix[0]) + MVE_GVAL (pix[1]) + MVE_GVAL (pix[2]) +
- MVE_GVAL (pix[3]) + 2) / 4;
- bb = (MVE_BVAL (pix[0]) + MVE_BVAL (pix[1]) + MVE_BVAL (pix[2]) +
- MVE_BVAL (pix[3]) + 2) / 4;
-
- e1 = mve_color_dist_rgb (rb, gb, bb, r[0], g[0], b[0]);
- e2 = mve_color_dist_rgb (rb, gb, bb, r[1], g[1], b[1]);
-
- if (e1 > e2) {
- mean = apx->data[1];
- flags |= mask;
- } else {
- mean = apx->data[0];
- }
-
- block[0] = block[1] = block[8] = block[9] = mean;
-
- src += 2;
- block += 2;
- }
- src += (enc->mve->width * 2) - 8;
- block += 8;
- }
-
- apx->data[2] = flags & 0x00FF;
- apx->data[3] = (flags & 0xFF00) >> 8;
-
- apx->error =
- mve_block_error_packed (enc, src - enc->mve->width * 8, apx->block);
- return apx->error;
-}
-
-static guint32
-mve_encode_0x7b (GstMveEncoderData * enc, const guint8 * src,
- GstMveApprox * apx)
-{
- /* generic 2-color encoding (10 bytes) */
- guint x, y;
- guint8 *data = apx->data;
- guint8 *block = apx->block;
-
- if (!enc->q2available) {
- enc->q2error =
- mve_quantize (enc, src, 8, 8, 0, 2, enc->q2block, enc->q2colors);
- enc->q2available = TRUE;
- }
-
- memcpy (block, enc->q2block, 64);
-
- /* p0 <= p1 */
- data[0] = MIN (enc->q2colors[0], enc->q2colors[1]);
- data[1] = MAX (enc->q2colors[0], enc->q2colors[1]);
- data += 2;
-
- for (y = 0; y < 8; ++y) {
- guint8 flags = 0;
-
- for (x = 0x01; x <= 0x80; x <<= 1) {
- if (*block == apx->data[1])
- flags |= x;
- ++block;
- }
- *data++ = flags;
- }
-
- apx->error = enc->q2error;
- return apx->error;
-}
-
-static guint32
-mve_encode_0x8a (GstMveEncoderData * enc, const guint8 * src,
- GstMveApprox * apx)
-{
- /* 2-color encoding for top and bottom half (12 bytes) */
- guint8 cols[2];
- guint32 flags;
- guint i, x, y, shifter;
- guint8 *block = apx->block;
- guint8 *data = apx->data;
-
- apx->error = 0;
-
- for (i = 0; i < 2; ++i) {
- apx->error += mve_quantize (enc, src, 8, 4, i, 2, apx->block, cols);
-
- flags = 0;
- shifter = 0;
-
- /* p0 > p1 && p2 > p3 */
- data[0] = MAX (cols[0], cols[1]);
- data[1] = MIN (cols[0], cols[1]);
-
- for (y = 0; y < 4; ++y) {
- for (x = 0; x < 8; ++x, ++shifter) {
- if (block[x] == data[1])
- flags |= 1 << shifter;
- }
- block += 8;
- }
- data[2] = flags & 0x000000FF;
- data[3] = (flags & 0x0000FF00) >> 8;
- data[4] = (flags & 0x00FF0000) >> 16;
- data[5] = (flags & 0xFF000000) >> 24;
- data += 6;
- }
-
- return apx->error;
-}
-
-static guint32
-mve_encode_0x8b (GstMveEncoderData * enc, const guint8 * src,
- GstMveApprox * apx)
-{
- /* 2-color encoding for left and right half (12 bytes) */
- guint8 cols[2];
- guint32 flags;
- guint i, x, y, shifter;
- guint8 *block = apx->block;
- guint8 *data = apx->data;
-
- apx->error = 0;
-
- for (i = 0; i < 2; ++i) {
- apx->error += mve_quantize (enc, src, 4, 8, i, 2, apx->block, cols);
-
- flags = 0;
- shifter = 0;
-
- /* p0 > p1 && p2 <= p3 */
- data[i] = MAX (cols[0], cols[1]);
- data[i ^ 1] = MIN (cols[0], cols[1]);
-
- for (y = 0; y < 8; ++y) {
- for (x = 0; x < 4; ++x, ++shifter) {
- if (block[x] == data[1])
- flags |= 1 << shifter;
- }
- block += 8;
- }
-
- data[2] = flags & 0x000000FF;
- data[3] = (flags & 0x0000FF00) >> 8;
- data[4] = (flags & 0x00FF0000) >> 16;
- data[5] = (flags & 0xFF000000) >> 24;
- data += 6;
- block = apx->block + 4;
- }
-
- return apx->error;
-}
-
-static guint32
-mve_encode_0x8c (GstMveEncoderData * enc, const guint8 * src,
- GstMveApprox * apx)
-{
- /* 2-color encoding for each 4x4 quadrant (16 bytes) */
- guint8 cols[2];
- guint16 flags;
- guint i, x, y, shifter;
- guint8 *block;
- guint8 *data = apx->data;
-
- apx->error = 0;
-
- for (i = 0; i < 4; ++i) {
- apx->error +=
- mve_quantize (enc, src, 4, 4, ((i & 1) << 1) | ((i & 2) >> 1), 2,
- apx->block, cols);
-
- /* p0 < p1 */
- if (i == 0) {
- data[0] = MIN (cols[0], cols[1]);
- data[1] = MAX (cols[0], cols[1]);
- } else {
- data[0] = cols[0];
- data[1] = cols[1];
- }
-
- block = apx->block + ((i / 2) * 4) + ((i % 2) * 32);
- flags = 0;
- shifter = 0;
-
- for (y = 0; y < 4; ++y) {
- for (x = 0; x < 4; ++x, ++shifter) {
- if (block[x] == data[1])
- flags |= 1 << shifter;
- }
- block += 8;
- }
-
- data[2] = flags & 0x00FF;
- data[3] = (flags & 0xFF00) >> 8;
- data += 4;
- }
-
- return apx->error;
-}
-
-static guint32
-mve_encode_0x9a (GstMveEncoderData * enc, const guint8 * src,
- GstMveApprox * apx)
-{
- /* 4-color encoding for 2x2 solid blocks (8 bytes) */
- guint32 p[4];
- guint32 e, emin;
- guint i, x, y, mean = 0;
- guint8 r[4], g[4], b[4], rb, gb, bb;
- guint8 *block = apx->block;
- guint shifter = 0;
- guint32 flags = 0;
-
- /* calculate mean colors for the entire block */
- if (!enc->q4available) {
- enc->q4error =
- mve_quantize (enc, src, 8, 8, 0, 4, enc->q4block, enc->q4colors);
- enc->q4available = TRUE;
- }
-
- /* p0 <= p1 && p2 > p3 */
- apx->data[0] = MIN (enc->q4colors[0], enc->q4colors[1]);
- apx->data[1] = MAX (enc->q4colors[0], enc->q4colors[1]);
- apx->data[2] = MAX (enc->q4colors[2], enc->q4colors[3]);
- apx->data[3] = MIN (enc->q4colors[2], enc->q4colors[3]);
-
- for (i = 0; i < 4; ++i) {
- r[i] = MVE_RVAL (enc->palette[apx->data[i]]);
- g[i] = MVE_GVAL (enc->palette[apx->data[i]]);
- b[i] = MVE_BVAL (enc->palette[apx->data[i]]);
- }
-
- /* calculate mean colors for each 2x2 block and map to global colors */
- for (y = 0; y < 4; ++y) {
- for (x = 0; x < 4; ++x, shifter += 2) {
- p[0] = enc->palette[src[0]];
- p[1] = enc->palette[src[1]];
- p[2] = enc->palette[src[enc->mve->width]];
- p[3] = enc->palette[src[enc->mve->width + 1]];
-
- rb = (MVE_RVAL (p[0]) + MVE_RVAL (p[1]) + MVE_RVAL (p[2]) +
- MVE_RVAL (p[3]) + 2) / 4;
- gb = (MVE_GVAL (p[0]) + MVE_GVAL (p[1]) + MVE_GVAL (p[2]) +
- MVE_GVAL (p[3]) + 2) / 4;
- bb = (MVE_BVAL (p[0]) + MVE_BVAL (p[1]) + MVE_BVAL (p[2]) +
- MVE_BVAL (p[3]) + 2) / 4;
-
- emin = MVE_APPROX_MAX_ERROR;
- for (i = 0; i < 4; ++i) {
- e = mve_color_dist_rgb (rb, gb, bb, r[i], g[i], b[i]);
- if (e < emin) {
- emin = e;
- mean = i;
- }
- }
-
- flags |= mean << shifter;
- block[0] = block[1] = block[8] = block[9] = apx->data[mean];
-
- src += 2;
- block += 2;
- }
- src += (enc->mve->width * 2) - 8;
- block += 8;
- }
-
- apx->data[4] = flags & 0x000000FF;
- apx->data[5] = (flags & 0x0000FF00) >> 8;
- apx->data[6] = (flags & 0x00FF0000) >> 16;
- apx->data[7] = (flags & 0xFF000000) >> 24;
-
- apx->error =
- mve_block_error_packed (enc, src - 8 * enc->mve->width, apx->block);
- return apx->error;
-}
-
-static guint32
-mve_encode_0x9b (GstMveEncoderData * enc, const guint8 * src,
- GstMveApprox * apx)
-{
- /* 4-color encoding for 2x1 solid blocks (12 bytes) */
- guint32 p[2];
- guint32 e, emin;
- guint i, x, y, mean = 0;
- guint8 r[4], g[4], b[4], rb, gb, bb;
- guint8 *data = apx->data;
- guint8 *block = apx->block;
- guint shifter = 0;
- guint32 flags = 0;
-
- /* calculate mean colors for the entire block */
- if (!enc->q4available) {
- enc->q4error =
- mve_quantize (enc, src, 8, 8, 0, 4, enc->q4block, enc->q4colors);
- enc->q4available = TRUE;
- }
-
- /* p0 > p1 && p2 <= p3 */
- data[0] = MAX (enc->q4colors[0], enc->q4colors[1]);
- data[1] = MIN (enc->q4colors[0], enc->q4colors[1]);
- data[2] = MIN (enc->q4colors[2], enc->q4colors[3]);
- data[3] = MAX (enc->q4colors[2], enc->q4colors[3]);
-
- for (i = 0; i < 4; ++i) {
- r[i] = MVE_RVAL (enc->palette[data[i]]);
- g[i] = MVE_GVAL (enc->palette[data[i]]);
- b[i] = MVE_BVAL (enc->palette[data[i]]);
- }
- data += 4;
-
- /* calculate mean colors for each 2x1 block and map to global colors */
- for (y = 0; y < 8; ++y) {
- for (x = 0; x < 4; ++x, shifter += 2) {
- p[0] = enc->palette[src[0]];
- p[1] = enc->palette[src[1]];
- rb = (MVE_RVAL (p[0]) + MVE_RVAL (p[1]) + 1) / 2;
- gb = (MVE_GVAL (p[0]) + MVE_GVAL (p[1]) + 1) / 2;
- bb = (MVE_BVAL (p[0]) + MVE_BVAL (p[1]) + 1) / 2;
-
- emin = MVE_APPROX_MAX_ERROR;
- for (i = 0; i < 4; ++i) {
- e = mve_color_dist_rgb (rb, gb, bb, r[i], g[i], b[i]);
- if (e < emin) {
- emin = e;
- mean = i;
- }
- }
-
- flags |= mean << shifter;
- block[0] = block[1] = apx->data[mean];
-
- src += 2;
- block += 2;
- }
-
- if ((y == 3) || (y == 7)) {
- data[0] = flags & 0x000000FF;
- data[1] = (flags & 0x0000FF00) >> 8;
- data[2] = (flags & 0x00FF0000) >> 16;
- data[3] = (flags & 0xFF000000) >> 24;
- data += 4;
-
- flags = 0;
- shifter = 0;
- }
-
- src += enc->mve->width - 8;
- }
-
- apx->error =
- mve_block_error_packed (enc, src - 8 * enc->mve->width, apx->block);
- return apx->error;
-}
-
-static guint32
-mve_encode_0x9c (GstMveEncoderData * enc, const guint8 * src,
- GstMveApprox * apx)
-{
- /* 4-color encoding for 1x2 solid blocks (12 bytes) */
- guint32 p[2];
- guint32 e, emin;
- guint i, x, y, mean = 0;
- guint8 r[4], g[4], b[4], rb, gb, bb;
- guint8 *data = apx->data;
- guint8 *block = apx->block;
- guint shifter = 0;
- guint32 flags = 0;
-
- /* calculate mean colors for the entire block */
- if (!enc->q4available) {
- enc->q4error =
- mve_quantize (enc, src, 8, 8, 0, 4, enc->q4block, enc->q4colors);
- enc->q4available = TRUE;
- }
-
- /* p0 > p1 && p2 > p3 */
- data[0] = MAX (enc->q4colors[0], enc->q4colors[1]);
- data[1] = MIN (enc->q4colors[0], enc->q4colors[1]);
- data[2] = MAX (enc->q4colors[2], enc->q4colors[3]);
- data[3] = MIN (enc->q4colors[2], enc->q4colors[3]);
-
- for (i = 0; i < 4; ++i) {
- r[i] = MVE_RVAL (enc->palette[data[i]]);
- g[i] = MVE_GVAL (enc->palette[data[i]]);
- b[i] = MVE_BVAL (enc->palette[data[i]]);
- }
- data += 4;
-
- /* calculate mean colors for each 1x2 block and map to global colors */
- for (y = 0; y < 4; ++y) {
- for (x = 0; x < 8; ++x, shifter += 2) {
- p[0] = enc->palette[src[0]];
- p[1] = enc->palette[src[enc->mve->width]];
- rb = (MVE_RVAL (p[0]) + MVE_RVAL (p[1]) + 1) / 2;
- gb = (MVE_GVAL (p[0]) + MVE_GVAL (p[1]) + 1) / 2;
- bb = (MVE_BVAL (p[0]) + MVE_BVAL (p[1]) + 1) / 2;
-
- emin = MVE_APPROX_MAX_ERROR;
- for (i = 0; i < 4; ++i) {
- e = mve_color_dist_rgb (rb, gb, bb, r[i], g[i], b[i]);
- if (e < emin) {
- emin = e;
- mean = i;
- }
- }
-
- flags |= mean << shifter;
- block[0] = block[8] = apx->data[mean];
-
- ++src;
- ++block;
- }
-
- if ((y == 1) || (y == 3)) {
- data[0] = flags & 0x000000FF;
- data[1] = (flags & 0x0000FF00) >> 8;
- data[2] = (flags & 0x00FF0000) >> 16;
- data[3] = (flags & 0xFF000000) >> 24;
- data += 4;
-
- flags = 0;
- shifter = 0;
- }
-
- src += (enc->mve->width * 2) - 8;
- block += 8;
- }
-
- apx->error =
- mve_block_error_packed (enc, src - 8 * enc->mve->width, apx->block);
- return apx->error;
-}
-
-static guint32
-mve_encode_0x9d (GstMveEncoderData * enc, const guint8 * src,
- GstMveApprox * apx)
-{
- /* generic 4-color encoding (20 bytes) */
- guint32 flags = 0;
- guint shifter = 0;
- guint i, x, y;
- guint8 *data = apx->data;
- guint8 *block = apx->block;
-
- if (!enc->q4available) {
- enc->q4error =
- mve_quantize (enc, src, 8, 8, 0, 4, enc->q4block, enc->q4colors);
- enc->q4available = TRUE;
- }
-
- memcpy (block, enc->q4block, 64);
-
- /* p0 <= p1 && p2 <= p3 */
- data[0] = MIN (enc->q4colors[0], enc->q4colors[1]);
- data[1] = MAX (enc->q4colors[0], enc->q4colors[1]);
- data[2] = MIN (enc->q4colors[2], enc->q4colors[3]);
- data[3] = MAX (enc->q4colors[2], enc->q4colors[3]);
- data += 4;
-
- for (y = 0; y < 8; ++y) {
- for (x = 0; x < 8; ++x, shifter += 2) {
-
- for (i = 0; i < 3; ++i) {
- if (*block == apx->data[i])
- break;
- }
-
- flags |= i << shifter;
- ++block;
- }
-
- data[0] = flags & 0x000000FF;
- data[1] = (flags & 0x0000FF00) >> 8;
- data += 2;
- shifter = 0;
- flags = 0;
- }
-
- apx->error = enc->q4error;
- return apx->error;
-}
-
-static guint32
-mve_encode_0xaa (GstMveEncoderData * enc, const guint8 * src,
- GstMveApprox * apx)
-{
- /* 4-color encoding for top and bottom half (24 bytes) */
- guint8 cols[4];
- guint32 flags;
- guint i, j, x, y, shifter;
- guint8 *block = apx->block;
- guint8 *data = apx->data;
- const guint8 *p;
-
- apx->error = 0;
-
- for (i = 0; i < 2; ++i) {
- apx->error += mve_quantize (enc, src, 8, 4, i, 4, apx->block, cols);
-
- flags = 0;
- shifter = 0;
-
- /* p0 > p1 && p4 > p5 */
- data[0] = MAX (cols[0], cols[1]);
- data[1] = MIN (cols[0], cols[1]);
- data[2] = cols[2];
- data[3] = cols[3];
- p = data;
- data += 4;
-
- for (y = 0; y < 4; ++y) {
- for (x = 0; x < 8; ++x, shifter += 2) {
- for (j = 0; j < 3; ++j) {
- if (block[x] == p[j])
- break;
- }
- flags |= j << shifter;
- }
- block += 8;
-
- if ((y == 1) || (y == 3)) {
- data[0] = flags & 0x000000FF;
- data[1] = (flags & 0x0000FF00) >> 8;
- data[2] = (flags & 0x00FF0000) >> 16;
- data[3] = (flags & 0xFF000000) >> 24;
- data += 4;
- flags = 0;
- shifter = 0;
- }
- }
- }
-
- return apx->error;
-}
-
-static guint32
-mve_encode_0xab (GstMveEncoderData * enc, const guint8 * src,
- GstMveApprox * apx)
-{
- /* 4-color encoding for left and right half (24 bytes) */
- guint8 cols[4];
- guint32 flags;
- guint i, j, x, y, shifter;
- guint8 *block = apx->block;
- guint8 *data = apx->data;
- const guint8 *p;
-
- apx->error = 0;
-
- for (i = 0; i < 2; ++i) {
- apx->error += mve_quantize (enc, src, 4, 8, i, 4, apx->block, cols);
-
- flags = 0;
- shifter = 0;
-
- /* p0 > p1 && p4 <= p5 */
- data[i] = MAX (cols[0], cols[1]);
- data[i ^ 1] = MIN (cols[0], cols[1]);
- data[2] = cols[2];
- data[3] = cols[3];
- p = data;
- data += 4;
-
- for (y = 0; y < 8; ++y) {
- for (x = 0; x < 4; ++x, shifter += 2) {
- for (j = 0; j < 3; ++j) {
- if (block[x] == p[j])
- break;
- }
- flags |= j << shifter;
- }
- block += 8;
-
- if ((y == 3) || (y == 7)) {
- data[0] = flags & 0x000000FF;
- data[1] = (flags & 0x0000FF00) >> 8;
- data[2] = (flags & 0x00FF0000) >> 16;
- data[3] = (flags & 0xFF000000) >> 24;
- data += 4;
- flags = 0;
- shifter = 0;
- }
- }
- block = apx->block + 4;
- }
-
- return apx->error;
-}
-
-static guint32
-mve_encode_0xac (GstMveEncoderData * enc, const guint8 * src,
- GstMveApprox * apx)
-{
- /* 4-color encoding for each 4x4 quadrant (32 bytes) */
- guint8 cols[4];
- guint32 flags;
- guint i, j, x, y, shifter;
- guint8 *block;
- guint8 *data = apx->data;
-
- apx->error = 0;
-
- for (i = 0; i < 4; ++i) {
- apx->error +=
- mve_quantize (enc, src, 4, 4, ((i & 1) << 1) | ((i & 2) >> 1), 4,
- apx->block, cols);
-
- /* p0 <= p1 */
- data[0] = MIN (cols[0], cols[1]);
- data[1] = MAX (cols[0], cols[1]);
- data[2] = cols[2];
- data[3] = cols[3];
-
- block = apx->block + ((i / 2) * 4) + ((i % 2) * 32);
- flags = 0;
- shifter = 0;
-
- for (y = 0; y < 4; ++y) {
- for (x = 0; x < 4; ++x, shifter += 2) {
- for (j = 0; j < 3; ++j) {
- if (block[x] == data[j])
- break;
- }
- flags |= j << shifter;
- }
- block += 8;
- }
-
- data[4] = flags & 0x000000FF;
- data[5] = (flags & 0x0000FF00) >> 8;
- data[6] = (flags & 0x00FF0000) >> 16;
- data[7] = (flags & 0xFF000000) >> 24;
- data += 8;
- }
-
- return apx->error;
-}
-
-static guint32
-mve_encode_0xb (GstMveEncoderData * enc, const guint8 * src, GstMveApprox * apx)
-{
- /* 64-color encoding (each pixel in block is a different color) (64 bytes) */
- mve_store_block (enc->mve, src, apx->block);
- memcpy (apx->data, apx->block, 64);
- apx->error = 0;
-
- return 0;
-}
-
-static guint32
-mve_encode_0xc (GstMveEncoderData * enc, const guint8 * src, GstMveApprox * apx)
-{
- /* 16-color block encoding: each 2x2 block is a different color (16 bytes) */
- guint i = 0, x, y;
- const guint w = enc->mve->width;
- guint16 r, g, b;
-
- /* calculate median color for each 2x2 block */
- for (y = 0; y < 4; ++y) {
- for (x = 0; x < 4; ++x) {
- guint32 p = enc->palette[src[0]];
-
- r = MVE_RVAL (p) + 2;
- g = MVE_GVAL (p) + 2;
- b = MVE_BVAL (p) + 2;
-
- p = enc->palette[src[1]];
- r += MVE_RVAL (p);
- g += MVE_GVAL (p);
- b += MVE_BVAL (p);
-
- p = enc->palette[src[w]];
- r += MVE_RVAL (p);
- g += MVE_GVAL (p);
- b += MVE_BVAL (p);
-
- p = enc->palette[src[w + 1]];
- r += MVE_RVAL (p);
- g += MVE_GVAL (p);
- b += MVE_BVAL (p);
-
- apx->block[i] = apx->block[i + 1] = apx->block[i + 2] =
- apx->block[i + 3] = apx->data[i >> 2] =
- mve_find_pal_color (enc->palette, MVE_COL (r >> 2, g >> 2, b >> 2));
-
- i += 4;
- src += 2;
- }
- src += (w * 2) - 8;
- }
-
- apx->error = mve_block_error_packed (enc, src - (8 * w), apx->block);
- return apx->error;
-}
-
-static guint32
-mve_encode_0xd (GstMveEncoderData * enc, const guint8 * src, GstMveApprox * apx)
-{
- /* 4-color block encoding: each 4x4 block is a different color (4 bytes) */
- guint i, y;
-
- /* calculate median color for each 4x4 block */
- for (i = 0; i < 4; ++i) {
- guint8 median =
- mve_median_sub (enc, src, 4, 4, ((i & 1) << 1) | ((i & 2) >> 1));
- guint8 *block = apx->block + ((i / 2) * 4) + ((i % 2) * 32);
-
- for (y = 0; y < 4; ++y) {
- memset (block, median, 4);
- block += 8;
- }
-
- apx->data[i] = median;
- }
-
- apx->error = mve_block_error_packed (enc, src, apx->block);
- return apx->error;
-}
-
-static guint32
-mve_encode_0xe (GstMveEncoderData * enc, const guint8 * src, GstMveApprox * apx)
-{
- /* 1-color encoding: the whole block is 1 solid color (1 bytes) */
- guint8 median = mve_median (enc, src);
-
- memset (apx->block, median, 64);
-
- apx->data[0] = median;
- apx->error = mve_block_error_packed (enc, src, apx->block);
- return apx->error;
-}
-
-static guint32
-mve_encode_0xf (GstMveEncoderData * enc, const guint8 * src, GstMveApprox * apx)
-{
- /* 2 colors dithered encoding (2 bytes) */
- guint i, x, y;
- guint32 r[2] = { 0 }, g[2] = {
- 0}, b[2] = {
- 0};
- guint8 col[2];
-
- /* find medians for both colors */
- for (y = 0; y < 8; ++y) {
- for (x = 0; x < 8; x += 2) {
- guint16 p = src[x];
-
- r[y & 1] += MVE_RVAL (p);
- g[y & 1] += MVE_GVAL (p);
- b[y & 1] += MVE_BVAL (p);
-
- p = src[x + 1];
- r[(y & 1) ^ 1] += MVE_RVAL (p);
- g[(y & 1) ^ 1] += MVE_GVAL (p);
- b[(y & 1) ^ 1] += MVE_BVAL (p);
- }
- src += enc->mve->width;
- }
- col[0] = mve_find_pal_color (enc->palette,
- MVE_COL ((r[0] + 16) / 32, (g[0] + 16) / 32, (b[0] + 16) / 32));
- col[1] = mve_find_pal_color (enc->palette,
- MVE_COL ((r[1] + 16) / 32, (g[1] + 16) / 32, (b[1] + 16) / 32));
-
- /* store block after encoding */
- for (i = 0, y = 0; y < 8; ++y) {
- for (x = 0; x < 4; ++x) {
- apx->block[i++] = col[y & 1];
- apx->block[i++] = col[(y & 1) ^ 1];
- }
- }
-
- apx->data[0] = col[0];
- apx->data[1] = col[1];
- apx->error = mve_block_error_packed (enc,
- src - (8 * enc->mve->width), apx->block);
- return apx->error;
-}
-
-/* all available encodings in the preferred order,
- i.e. in ascending encoded size */
-static const GstMveEncoding mve_encodings[] = {
- {0x1, 0, mve_encode_0x1},
- {0x0, 0, mve_encode_0x0},
- {0xe, 1, mve_encode_0xe},
- {0x3, 1, mve_encode_0x3},
- {0x4, 1, mve_encode_0x4},
- {0x2, 1, mve_encode_0x2},
- {0xf, 2, mve_encode_0xf},
- {0x5, 2, mve_encode_0x5},
- {0xd, 4, mve_encode_0xd},
- {0x7, 4, mve_encode_0x7a},
- {0x9, 8, mve_encode_0x9a},
- {0x7, 10, mve_encode_0x7b},
- {0x8, 12, mve_encode_0x8a},
- {0x8, 12, mve_encode_0x8b},
- {0x9, 12, mve_encode_0x9b},
- {0x9, 12, mve_encode_0x9c},
- {0xc, 16, mve_encode_0xc},
- {0x8, 16, mve_encode_0x8c},
- {0x9, 20, mve_encode_0x9d},
- {0xa, 24, mve_encode_0xaa},
- {0xa, 24, mve_encode_0xab},
- {0xa, 32, mve_encode_0xac},
- {0xb, 64, mve_encode_0xb}
-};
-
-static gboolean
-mve_reorder_solution (GArray ** solution, guint16 n)
-{
- /* do a binary search to find the position to reinsert the modified element */
- /* the block we need to reconsider is always at position 0 */
- /* return TRUE if this block only has 1 encoding left and can be dropped */
- if (mve_comp_solution (&solution[0], &solution[1]) <= 0)
- return FALSE; /* already sorted */
-
- else if (solution[0]->len <= 1)
- /* drop this element from further calculations since we cannot improve here */
- return TRUE;
-
- else {
- /* we know the error value can only get worse, so we can actually start at 1 */
- guint lower = 1;
- guint upper = n - 1;
- gint cmp;
- guint idx = 0;
-
- while (upper > lower) {
- idx = lower + ((upper - lower) / 2);
-
- cmp = mve_comp_solution (&solution[0], &solution[idx]);
-
- if (cmp < 0) {
- upper = idx;
- } else if (cmp > 0) {
- lower = ++idx;
- } else {
- upper = lower = idx;
- }
- }
-
- if (idx > 0) {
- /* rearrange array members in new order */
- GArray *a = solution[0];
-
- memcpy (&solution[0], &solution[1], sizeof (GArray *) * idx);
- solution[idx] = a;
- }
- }
- return FALSE;
-}
-
-static guint32
-gst_mve_find_solution (GArray ** approx, guint16 n, guint32 size, guint16 max)
-{
- /* build an array of approximations we can shuffle around */
- GstMveApprox *sol_apx;
- GArray **solution = g_malloc (sizeof (GArray *) * n);
- GArray **current = solution;
-
- memcpy (solution, approx, sizeof (GArray *) * n);
-
- qsort (solution, n, sizeof (GArray *), mve_comp_solution);
-
- do {
- /* array is now sorted by error of the next to optimal approximation;
- drop optimal approximation for the best block */
-
- /* unable to reduce size further */
- if (current[0]->len <= 1)
- break;
-
- sol_apx = &g_array_index (current[0], GstMveApprox, current[0]->len - 1);
- size -= mve_encodings[sol_apx->type].size;
- g_array_remove_index_fast (current[0], current[0]->len - 1);
- sol_apx = &g_array_index (current[0], GstMveApprox, current[0]->len - 1);
- size += mve_encodings[sol_apx->type].size;
-
- if (mve_reorder_solution (current, n)) {
- ++current;
- --n;
- }
- } while (size > max);
-
- g_free (solution);
-
- return size;
-}
-
-GstFlowReturn
-mve_encode_frame8 (GstMveMux * mve, GstBuffer * frame, const guint32 * palette,
- guint16 max_data)
-{
- guint8 *src;
- GstFlowReturn ret = GST_FLOW_ERROR;
- guint8 *cm = mve->chunk_code_map;
- GArray **approx;
- GstMveApprox apx;
- GstMveEncoderData enc;
- const guint16 blocks = (mve->width * mve->height) / 64;
- guint32 encoded_size = 0;
- guint i = 0, x, y;
-
- src = GST_BUFFER_DATA (frame);
-
- approx = g_malloc (sizeof (GArray *) * blocks);
-
- enc.mve = mve;
- enc.palette = palette;
-
- for (enc.y = 0; enc.y < mve->height; enc.y += 8) {
- for (enc.x = 0; enc.x < mve->width; enc.x += 8) {
- guint32 err, last_err = MVE_APPROX_MAX_ERROR;
- guint type = 0;
- guint best = 0;
-
- enc.q2available = enc.q4available = FALSE;
- approx[i] = g_array_new (FALSE, FALSE, sizeof (GstMveApprox));
-
- do {
- err = mve_encodings[type].approx (&enc, src, &apx);
-
- if (err < last_err) {
- apx.type = best = type;
- g_array_append_val (approx[i], apx);
- last_err = err;
- }
-
- ++type;
- } while (last_err != 0);
-
- encoded_size += mve_encodings[best].size;
- ++i;
- src += 8;
- }
- src += 7 * mve->width;
- }
-
- /* find best solution with size constraints */
- GST_DEBUG_OBJECT (mve, "encoded frame %u in %u bytes (lossless)",
- mve->video_frames + 1, encoded_size);
-
-#if 0
- /* FIXME */
- src = GST_BUFFER_DATA (frame);
- for (i = 0, y = 0; y < mve->height; y += 8) {
- for (x = 0; x < mve->width; x += 8, ++i) {
- GstMveApprox *sol =
- &g_array_index (approx[i], GstMveApprox, approx[i]->len - 1);
- guint opcode = mve_encodings[sol->type].opcode;
- guint j, k;
-
- if (sol->error > 0)
- GST_WARNING_OBJECT (mve, "error is %lu for %d/%d (0x%x)", sol->error, x,
- y, opcode);
-
- for (j = 0; j < 8; ++j) {
- guint8 *o = src + j * mve->width;
- guint8 *c = sol->block + j * 8;
-
- if (memcmp (o, c, 8)) {
- GST_WARNING_OBJECT (mve, "opcode 0x%x (type %d) at %d/%d, line %d:",
- opcode, sol->type, x, y, j + 1);
- for (k = 0; k < 8; ++k) {
- o = src + k * mve->width;
- c = sol->block + k * 8;
- GST_WARNING_OBJECT (mve,
- "%d should be: %4d %4d %4d %4d %4d %4d %4d %4d", k, o[0],
- o[1], o[2], o[3], o[4], o[5], o[6], o[7]);
- GST_WARNING_OBJECT (mve,
- "%d but is : %4d %4d %4d %4d %4d %4d %4d %4d", k, c[0],
- c[1], c[2], c[3], c[4], c[5], c[6], c[7]);
- }
- }
- }
- src += 8;
- }
- src += 7 * mve->width;
- }
-#endif
-
- if (encoded_size > max_data) {
- encoded_size =
- gst_mve_find_solution (approx, blocks, encoded_size, max_data);
- if (encoded_size > max_data) {
- GST_ERROR_OBJECT (mve, "unable to compress frame to less than %d bytes",
- encoded_size);
- for (i = 0; i < blocks; ++i)
- g_array_free (approx[i], TRUE);
-
- goto done;
- }
- GST_DEBUG_OBJECT (mve, "compressed frame %u to %u bytes (lossy)",
- mve->video_frames + 1, encoded_size);
- }
-
- mve->chunk_video = g_byte_array_sized_new (encoded_size);
-
- /* encode */
- src = GST_BUFFER_DATA (frame);
- for (i = 0, y = 0; y < mve->height; y += 8) {
- for (x = 0; x < mve->width; x += 8, ++i) {
- GstMveApprox *sol =
- &g_array_index (approx[i], GstMveApprox, approx[i]->len - 1);
- guint opcode = mve_encodings[sol->type].opcode;
-
- g_byte_array_append (mve->chunk_video, sol->data,
- mve_encodings[sol->type].size);
-
- if (i & 1) {
- *cm |= opcode << 4;
- ++cm;
- } else
- *cm = opcode;
-
- /* modify the frame to match the image we actually encoded */
- if (sol->error > 0)
- mve_restore_block (mve, src, sol->block);
-
- src += 8;
- g_array_free (approx[i], TRUE);
- }
- src += 7 * mve->width;
- }
-
- ret = GST_FLOW_OK;
-
-done:
- g_free (approx);
-
- return ret;
-}
diff --git a/gst/nuvdemux/Makefile.am b/gst/nuvdemux/Makefile.am
deleted file mode 100644
index aecae51b4..000000000
--- a/gst/nuvdemux/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-
-plugin_LTLIBRARIES = libgstnuvdemux.la
-
-libgstnuvdemux_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_CFLAGS)
-libgstnuvdemux_la_LIBADD = $(GST_BASE_LIBS)
-libgstnuvdemux_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstnuvdemux_la_SOURCES = gstnuvdemux.c
-libgstnuvdemux_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-noinst_HEADERS = gstnuvdemux.h
diff --git a/gst/nuvdemux/gstnuvdemux.c b/gst/nuvdemux/gstnuvdemux.c
deleted file mode 100644
index 88968f0a1..000000000
--- a/gst/nuvdemux/gstnuvdemux.c
+++ /dev/null
@@ -1,940 +0,0 @@
-/* GStreamer NUV demuxer
- * Copyright (C) <2006> Renato Araujo Oliveira Filho <renato.filho@indt.org.br>
- * Rosfran Borges <rosfran.borges@indt.org.br>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-/* Element-Checklist-Version: 5 */
-
-/**
- * SECTION:element-nuvdemux
- * @see_also: mythtvsrc
- *
- * Demuxes MythTVs NuppelVideo .nuv file into raw or compressed audio and/or
- * video streams.
- *
- * This element currently only supports pull-based scheduling.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch-1.0 filesrc test.nuv ! nuvdemux name=demux demux.audio_00 ! decodebin ! audioconvert ! audioresample ! autoaudiosink demux.video_00 ! queue ! decodebin ! videoconvert ! videoscale ! autovideosink
- * ]| Play (parse and decode) an .nuv file and try to output it to
- * an automatically detected soundcard and videosink. If the NUV file contains
- * compressed audio or video data, this will only work if you have the
- * right decoder elements/plugins installed.
- * </refsect2>
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/gsterror.h>
-#include <gst/gstplugin.h>
-#include <string.h>
-
-#include "gst/gst-i18n-plugin.h"
-#include "gstnuvdemux.h"
-
-GST_DEBUG_CATEGORY_STATIC (nuvdemux_debug);
-#define GST_CAT_DEFAULT nuvdemux_debug
-
-
-#define GST_FLOW_ERROR_NO_DATA -101
-
-GST_DEBUG_CATEGORY_EXTERN (GST_CAT_EVENT);
-
-static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-nuv"));
-
-static GstStaticPadTemplate audio_src_template =
-GST_STATIC_PAD_TEMPLATE ("audio_src",
- GST_PAD_SRC,
- GST_PAD_SOMETIMES,
- GST_STATIC_CAPS_ANY);
-
-static GstStaticPadTemplate video_src_template =
-GST_STATIC_PAD_TEMPLATE ("video_src",
- GST_PAD_SRC,
- GST_PAD_SOMETIMES,
- GST_STATIC_CAPS_ANY);
-
-/* NUV Demux indexes init/dispose callers */
-static void gst_nuv_demux_finalize (GObject * object);
-static GstStateChangeReturn gst_nuv_demux_change_state (GstElement * element,
- GstStateChange transition);
-static void gst_nuv_demux_loop (GstPad * pad);
-static GstFlowReturn gst_nuv_demux_chain (GstPad * pad, GstBuffer * buf);
-static GstFlowReturn gst_nuv_demux_play (GstPad * pad);
-static gboolean gst_nuv_demux_sink_activate_pull (GstPad * sinkpad,
- gboolean active);
-static gboolean gst_nuv_demux_sink_activate (GstPad * sinkpad);
-static GstFlowReturn gst_nuv_demux_read_bytes (GstNuvDemux * nuv, guint64 size,
- gboolean move, GstBuffer ** buffer);
-static void gst_nuv_demux_reset (GstNuvDemux * nuv);
-static gboolean gst_nuv_demux_handle_sink_event (GstPad * sinkpad,
- GstEvent * event);
-static void gst_nuv_demux_destoy_src_pad (GstNuvDemux * nuv);
-static void gst_nuv_demux_send_eos (GstNuvDemux * nuv);
-
-/* GObject methods */
-GST_BOILERPLATE (GstNuvDemux, gst_nuv_demux, GstElement, GST_TYPE_ELEMENT);
-
-#if G_BYTE_ORDER == G_BIG_ENDIAN
-static inline gdouble
-_gdouble_swap_le_be (gdouble * d)
-{
- union
- {
- guint64 i;
- gdouble d;
- } u;
-
- u.d = *d;
- u.i = GUINT64_SWAP_LE_BE (u.i);
- return u.d;
-}
-
-#define READ_DOUBLE_FROM_LE(d) (_gdouble_swap_le_be((gdouble* ) d))
-#else /* G_BYTE_ORDER != G_BIG_ENDIAN */
-#define READ_DOUBLE_FROM_LE(d) *((gdouble* ) (d))
-#endif /* G_BYTE_ORDER != G_BIG_ENDIAN */
-
-
-static void
-gst_nuv_demux_base_init (gpointer klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_static_pad_template (element_class,
- &audio_src_template);
- gst_element_class_add_static_pad_template (element_class,
- &video_src_template);
- gst_element_class_add_static_pad_template (element_class, &sink_template);
- gst_element_class_set_static_metadata (element_class, "Nuv demuxer",
- "Codec/Demuxer",
- "Demultiplex a MythTV NuppleVideo .nuv file into audio and video",
- "Renato Araujo Oliveira Filho <renato.filho@indt.org.br>,"
- "Rosfran Borges <rosfran.borges@indt.org.br>");
-}
-
-static void
-gst_nuv_demux_class_init (GstNuvDemuxClass * klass)
-{
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
- GObjectClass *gobject_class = (GObjectClass *) klass;
-
- gobject_class->finalize = gst_nuv_demux_finalize;
-
- gstelement_class->change_state =
- GST_DEBUG_FUNCPTR (gst_nuv_demux_change_state);
-}
-
-static void
-gst_nuv_demux_init (GstNuvDemux * nuv, GstNuvDemuxClass * nuv_class)
-{
- nuv->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
-
- gst_pad_set_activate_function (nuv->sinkpad, gst_nuv_demux_sink_activate);
-
- gst_pad_set_activatepull_function (nuv->sinkpad,
- gst_nuv_demux_sink_activate_pull);
-
- gst_pad_set_chain_function (nuv->sinkpad,
- GST_DEBUG_FUNCPTR (gst_nuv_demux_chain));
-
- gst_pad_set_event_function (nuv->sinkpad, gst_nuv_demux_handle_sink_event);
-
- gst_element_add_pad (GST_ELEMENT (nuv), nuv->sinkpad);
-
- nuv->adapter = NULL;
- nuv->mpeg_buffer = NULL;
- nuv->h = NULL;
- nuv->eh = NULL;
- nuv->fh = NULL;
- gst_nuv_demux_reset (nuv);
-}
-
-static void
-gst_nuv_demux_finalize (GObject * object)
-{
- GstNuvDemux *nuv = GST_NUV_DEMUX (object);
-
- if (nuv->mpeg_buffer != NULL) {
- gst_buffer_unref (nuv->mpeg_buffer);
- }
-
- gst_nuv_demux_destoy_src_pad (nuv);
- gst_nuv_demux_reset (nuv);
- if (nuv->adapter != NULL) {
- g_object_unref (nuv->adapter);
- nuv->adapter = NULL;
- }
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/*****************************************************************************
- * Utils functions
- *****************************************************************************/
-
-static gboolean
-gst_nuv_demux_handle_sink_event (GstPad * sinkpad, GstEvent * event)
-{
- gboolean res = FALSE;
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NEWSEGMENT:
- res = TRUE;
- break;
- default:
- return gst_pad_event_default (sinkpad, event);
- break;
- }
-
- gst_event_unref (event);
- return res;
-}
-
-
-/* HeaderLoad:
- */
-static GstFlowReturn
-gst_nuv_demux_header_load (GstNuvDemux * nuv, nuv_header ** h_ret)
-{
- GstBuffer *buffer = NULL;
- GstFlowReturn res;
- nuv_header *h;
-
- res = gst_nuv_demux_read_bytes (nuv, 72, TRUE, &buffer);
- if (res != GST_FLOW_OK)
- return res;
-
- h = g_new0 (nuv_header, 1);
-
- memcpy (h->id, buffer->data, 12);
- memcpy (h->version, buffer->data + 12, 5);
- h->i_width = GST_READ_UINT32_LE (&buffer->data[20]);
- h->i_height = GST_READ_UINT32_LE (&buffer->data[24]);
- h->i_width_desired = GST_READ_UINT32_LE (&buffer->data[28]);
- h->i_height_desired = GST_READ_UINT32_LE (&buffer->data[32]);
- h->i_mode = buffer->data[36];
- h->d_aspect = READ_DOUBLE_FROM_LE (&buffer->data[40]);
- h->d_fps = READ_DOUBLE_FROM_LE (&buffer->data[48]);
- h->i_video_blocks = GST_READ_UINT32_LE (&buffer->data[56]);
- h->i_audio_blocks = GST_READ_UINT32_LE (&buffer->data[60]);
- h->i_text_blocks = GST_READ_UINT32_LE (&buffer->data[64]);
- h->i_keyframe_distance = GST_READ_UINT32_LE (&buffer->data[68]);
-
- GST_DEBUG_OBJECT (nuv,
- "nuv: h=%s v=%s %dx%d a=%f fps=%f v=%d a=%d t=%d kfd=%d", h->id,
- h->version, h->i_width, h->i_height, h->d_aspect, h->d_fps,
- h->i_video_blocks, h->i_audio_blocks, h->i_text_blocks,
- h->i_keyframe_distance);
-
- *h_ret = h;
- gst_buffer_unref (buffer);
- return res;
-}
-
-static GstFlowReturn
-gst_nuv_demux_stream_header_data (GstNuvDemux * nuv)
-{
- GstFlowReturn res = gst_nuv_demux_header_load (nuv, &nuv->h);
-
- if (res == GST_FLOW_OK)
- nuv->state = GST_NUV_DEMUX_EXTRA_DATA;
- return res;
-}
-
-/*
- * Read NUV file tag
- */
-static GstFlowReturn
-gst_nuv_demux_stream_file_header (GstNuvDemux * nuv)
-{
- GstFlowReturn res = GST_FLOW_OK;
- GstBuffer *file_header = NULL;
-
- res = gst_nuv_demux_read_bytes (nuv, 12, FALSE, &file_header);
- if (res != GST_FLOW_OK) {
- return res;
- } else {
- if (strncmp ((gchar *) file_header->data, "MythTVVideo", 11) ||
- strncmp ((gchar *) file_header->data, "NuppelVideo", 11)) {
- nuv->state = GST_NUV_DEMUX_HEADER_DATA;
- } else {
- GST_DEBUG_OBJECT (nuv, "error parsing file header");
- nuv->state = GST_NUV_DEMUX_INVALID_DATA;
- res = GST_FLOW_ERROR;
- }
- }
- if (file_header != NULL) {
- gst_buffer_unref (file_header);
- }
- return res;
-}
-
-/* FrameHeaderLoad:
- */
-static GstFlowReturn
-gst_nuv_demux_frame_header_load (GstNuvDemux * nuv, nuv_frame_header ** h_ret)
-{
- unsigned char *data;
- nuv_frame_header *h;
- GstBuffer *buf = NULL;
-
- GstFlowReturn res = gst_nuv_demux_read_bytes (nuv, 12, TRUE, &buf);
-
- if (res != GST_FLOW_OK) {
- if (buf != NULL) {
- gst_buffer_unref (buf);
- }
- return res;
- }
-
- h = g_new0 (nuv_frame_header, 1);
- data = buf->data;
-
- h->i_type = data[0];
- h->i_compression = data[1];
- h->i_keyframe = data[2];
- h->i_filters = data[3];
-
- h->i_timecode = GST_READ_UINT32_LE (&data[4]);
- h->i_length = GST_READ_UINT32_LE (&data[8]);
- GST_DEBUG_OBJECT (nuv, "frame hdr: t=%c c=%c k=%d f=0x%x timecode=%d l=%d",
- h->i_type,
- h->i_compression ? h->i_compression : ' ',
- h->i_keyframe ? h->i_keyframe : ' ',
- h->i_filters, h->i_timecode, h->i_length);
-
- *h_ret = h;
- gst_buffer_unref (buf);
- return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_nuv_demux_extended_header_load (GstNuvDemux * nuv,
- nuv_extended_header ** h_ret)
-{
- unsigned char *data;
- GstBuffer *buff = NULL;
- nuv_extended_header *h;
-
-
- GstFlowReturn res = gst_nuv_demux_read_bytes (nuv, 512, TRUE, &buff);
-
- if (res != GST_FLOW_OK) {
- if (buff != NULL) {
- gst_buffer_unref (buff);
- }
- return res;
- }
-
- h = g_new0 (nuv_extended_header, 1);
- data = buff->data;
- h->i_version = GST_READ_UINT32_LE (&data[0]);
- h->i_video_fcc = GST_MAKE_FOURCC (data[4], data[5], data[6], data[7]);
- h->i_audio_fcc = GST_MAKE_FOURCC (data[8], data[9], data[10], data[11]);
- h->i_audio_sample_rate = GST_READ_UINT32_LE (&data[12]);
- h->i_audio_bits_per_sample = GST_READ_UINT32_LE (&data[16]);
- h->i_audio_channels = GST_READ_UINT32_LE (&data[20]);
- h->i_audio_compression_ratio = GST_READ_UINT32_LE (&data[24]);
- h->i_audio_quality = GST_READ_UINT32_LE (&data[28]);
- h->i_rtjpeg_quality = GST_READ_UINT32_LE (&data[32]);
- h->i_rtjpeg_luma_filter = GST_READ_UINT32_LE (&data[36]);
- h->i_rtjpeg_chroma_filter = GST_READ_UINT32_LE (&data[40]);
- h->i_lavc_bitrate = GST_READ_UINT32_LE (&data[44]);
- h->i_lavc_qmin = GST_READ_UINT32_LE (&data[48]);
- h->i_lavc_qmin = GST_READ_UINT32_LE (&data[52]);
- h->i_lavc_maxqdiff = GST_READ_UINT32_LE (&data[56]);
- h->i_seekable_offset = GST_READ_UINT64_LE (&data[60]);
- h->i_keyframe_adjust_offset = GST_READ_UINT64_LE (&data[68]);
-
- GST_DEBUG_OBJECT (nuv,
- "ex hdr: v=%d vffc=%4.4s afcc=%4.4s %dHz %dbits ach=%d acr=%d aq=%d"
- "rtjpeg q=%d lf=%d lc=%d lavc br=%d qmin=%d qmax=%d maxqdiff=%d seekableoff=%"
- G_GINT64_FORMAT " keyfao=%" G_GINT64_FORMAT, h->i_version,
- (gchar *) & h->i_video_fcc, (gchar *) & h->i_audio_fcc,
- h->i_audio_sample_rate, h->i_audio_bits_per_sample, h->i_audio_channels,
- h->i_audio_compression_ratio, h->i_audio_quality, h->i_rtjpeg_quality,
- h->i_rtjpeg_luma_filter, h->i_rtjpeg_chroma_filter, h->i_lavc_bitrate,
- h->i_lavc_qmin, h->i_lavc_qmax, h->i_lavc_maxqdiff, h->i_seekable_offset,
- h->i_keyframe_adjust_offset);
-
- *h_ret = h;
- gst_buffer_unref (buff);
- return res;
-}
-
-static gboolean
-gst_nuv_demux_handle_src_event (GstPad * pad, GstEvent * event)
-{
- gst_event_unref (event);
- return FALSE;
-}
-
-
-static void
-gst_nuv_demux_create_pads (GstNuvDemux * nuv)
-{
- if (nuv->h->i_video_blocks != 0) {
- GstCaps *video_caps = NULL;
-
- nuv->src_video_pad =
- gst_pad_new_from_static_template (&video_src_template, "video_src");
-
- video_caps = gst_caps_new_simple ("video/x-divx",
- "divxversion", G_TYPE_INT, 4,
- "width", G_TYPE_INT, nuv->h->i_width,
- "height", G_TYPE_INT, nuv->h->i_height,
- "framerate", GST_TYPE_FRACTION, (gint) (nuv->h->d_fps * 1000.0f), 1000,
- "pixel-aspect-ratio", GST_TYPE_FRACTION,
- (gint) (nuv->h->d_aspect * 1000.0f), 1000, NULL);
-
- gst_pad_use_fixed_caps (nuv->src_video_pad);
- gst_pad_set_active (nuv->src_video_pad, TRUE);
- gst_pad_set_caps (nuv->src_video_pad, video_caps);
-
- gst_pad_set_event_function (nuv->src_video_pad,
- gst_nuv_demux_handle_src_event);
- gst_pad_set_active (nuv->src_video_pad, TRUE);
- gst_element_add_pad (GST_ELEMENT (nuv), nuv->src_video_pad);
-
- gst_caps_unref (video_caps);
- }
-
- if (nuv->h->i_audio_blocks != 0) {
- GstCaps *audio_caps = NULL;
-
- nuv->src_audio_pad =
- gst_pad_new_from_static_template (&audio_src_template, "audio_src");
-
- audio_caps = gst_caps_new_simple ("audio/mpeg",
- "rate", G_TYPE_INT, nuv->eh->i_audio_sample_rate,
- "format", GST_TYPE_FOURCC, nuv->eh->i_audio_fcc,
- "channels", G_TYPE_INT, nuv->eh->i_audio_channels,
- "mpegversion", G_TYPE_INT, nuv->eh->i_version, NULL);
-
- gst_pad_use_fixed_caps (nuv->src_audio_pad);
- gst_pad_set_active (nuv->src_audio_pad, TRUE);
- gst_pad_set_caps (nuv->src_audio_pad, audio_caps);
- gst_pad_set_active (nuv->src_audio_pad, TRUE);
- gst_element_add_pad (GST_ELEMENT (nuv), nuv->src_audio_pad);
-
- gst_pad_set_event_function (nuv->src_audio_pad,
- gst_nuv_demux_handle_src_event);
-
- gst_caps_unref (audio_caps);
- }
-
- gst_element_no_more_pads (GST_ELEMENT (nuv));
-}
-
-static GstFlowReturn
-gst_nuv_demux_read_head_frame (GstNuvDemux * nuv)
-{
- GstFlowReturn ret = GST_FLOW_OK;
-
- ret = gst_nuv_demux_frame_header_load (nuv, &nuv->fh);
- if (ret != GST_FLOW_OK)
- return ret;
-
- nuv->state = GST_NUV_DEMUX_MOVI;
- return ret;
-}
-
-static GstFlowReturn
-gst_nuv_demux_stream_data (GstNuvDemux * nuv)
-{
- GstFlowReturn ret = GST_FLOW_OK;
- GstBuffer *buf = NULL;
- nuv_frame_header *h = nuv->fh;
-
- if (h->i_type == 'R')
- goto done;
-
- if (h->i_length > 0) {
- ret = gst_nuv_demux_read_bytes (nuv, h->i_length, TRUE, &buf);
- if (ret != GST_FLOW_OK)
- return ret;
-
- if (h->i_timecode > 0)
- GST_BUFFER_TIMESTAMP (buf) = h->i_timecode * GST_MSECOND;
- }
-
-
- switch (h->i_type) {
- case 'V':
- {
- if (!buf)
- break;
-
- GST_BUFFER_OFFSET (buf) = nuv->video_offset;
- gst_buffer_set_caps (buf, GST_PAD_CAPS (nuv->src_video_pad));
- ret = gst_pad_push (nuv->src_video_pad, buf);
- nuv->video_offset++;
- break;
- }
- case 'A':
- {
- if (!buf)
- break;
-
- GST_BUFFER_OFFSET (buf) = nuv->audio_offset;
- gst_buffer_set_caps (buf, GST_PAD_CAPS (nuv->src_audio_pad));
- ret = gst_pad_push (nuv->src_audio_pad, buf);
- nuv->audio_offset++;
- break;
- }
- case 'S':
- {
- switch (h->i_compression) {
- case 'V':
- gst_pad_push_event (nuv->src_video_pad,
- gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1,
- h->i_timecode));
- break;
- case 'A':
- gst_pad_push_event (nuv->src_audio_pad,
- gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, 0, -1, 0));
- break;
- default:
- break;
- }
- }
- default:
- if (buf != NULL)
- gst_buffer_unref (buf);
-
- break;
- }
-
-done:
- nuv->state = GST_NUV_DEMUX_FRAME_HEADER;
- g_free (nuv->fh);
- nuv->fh = NULL;
- return ret;
-}
-
-static GstFlowReturn
-gst_nuv_demux_stream_mpeg_data (GstNuvDemux * nuv)
-{
- GstFlowReturn ret = GST_FLOW_OK;
-
- /* ffmpeg extra data */
- nuv->mpeg_buffer = NULL;
- ret =
- gst_nuv_demux_read_bytes (nuv, nuv->mpeg_data_size, TRUE,
- &nuv->mpeg_buffer);
- if (ret != GST_FLOW_OK) {
- return GST_FLOW_ERROR;
- }
- GST_BUFFER_SIZE (nuv->mpeg_buffer) = nuv->mpeg_data_size;
- nuv->state = GST_NUV_DEMUX_EXTEND_HEADER;
- return ret;
-}
-
-static GstFlowReturn
-gst_nuv_demux_stream_extra_data (GstNuvDemux * nuv)
-{
- GstFlowReturn ret = GST_FLOW_OK;
-
- /* Load 'D' */
- nuv_frame_header *h;
-
- ret = gst_nuv_demux_frame_header_load (nuv, &h);
- if (ret != GST_FLOW_OK)
- return ret;
-
- if (h->i_type != 'D') {
- g_free (h);
- return GST_FLOW_ERROR;
- }
-
- if (h->i_length > 0) {
- if (h->i_compression == 'F') {
- nuv->state = GST_NUV_DEMUX_MPEG_DATA;
- } else {
- g_free (h);
- return GST_FLOW_ERROR;
- }
- } else {
- nuv->state = GST_NUV_DEMUX_EXTEND_HEADER;
- }
-
- g_free (h);
- h = NULL;
- return ret;
-}
-
-static GstFlowReturn
-gst_nuv_demux_stream_extend_header_data (GstNuvDemux * nuv)
-{
- GstFlowReturn ret = GST_FLOW_OK;
-
- ret = gst_nuv_demux_extended_header_load (nuv, &nuv->eh);
- if (ret != GST_FLOW_OK)
- return ret;
-
- gst_nuv_demux_create_pads (nuv);
- nuv->state = GST_NUV_DEMUX_FRAME_HEADER;
- return ret;
-}
-
-static GstFlowReturn
-gst_nuv_demux_stream_extend_header (GstNuvDemux * nuv)
-{
- GstBuffer *buf = NULL;
- GstFlowReturn res = GST_FLOW_OK;
-
- res = gst_nuv_demux_read_bytes (nuv, 1, FALSE, &buf);
- if (res != GST_FLOW_OK) {
- if (buf != NULL) {
- gst_buffer_unref (buf);
- }
- return res;
- }
-
- if (buf->data[0] == 'X') {
- nuv_frame_header *h = NULL;
-
- gst_buffer_unref (buf);
- buf = NULL;
-
- res = gst_nuv_demux_frame_header_load (nuv, &h);
- if (res != GST_FLOW_OK)
- return res;
-
- if (h->i_length != 512) {
- g_free (h);
- return GST_FLOW_ERROR;
- }
- g_free (h);
- h = NULL;
- nuv->state = GST_NUV_DEMUX_EXTEND_HEADER_DATA;
- } else {
- nuv->state = GST_NUV_DEMUX_INVALID_DATA;
- GST_ELEMENT_ERROR (nuv, STREAM, DEMUX, (NULL),
- ("Unsupported extended header (0x%02x)", buf->data[0]));
- gst_buffer_unref (buf);
- return GST_FLOW_ERROR;
- }
- return res;
-}
-
-static GstFlowReturn
-gst_nuv_demux_play (GstPad * pad)
-{
- GstFlowReturn res = GST_FLOW_OK;
- GstNuvDemux *nuv = GST_NUV_DEMUX (GST_PAD_PARENT (pad));
-
- switch (nuv->state) {
- case GST_NUV_DEMUX_START:
- res = gst_nuv_demux_stream_file_header (nuv);
- if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
- goto pause;
- }
- if (nuv->state != GST_NUV_DEMUX_HEADER_DATA)
- break;
-
- case GST_NUV_DEMUX_HEADER_DATA:
- res = gst_nuv_demux_stream_header_data (nuv);
- if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
- goto pause;
- }
- if (nuv->state != GST_NUV_DEMUX_EXTRA_DATA)
- break;
-
- case GST_NUV_DEMUX_EXTRA_DATA:
- res = gst_nuv_demux_stream_extra_data (nuv);
- if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
- goto pause;
- }
- if (nuv->state != GST_NUV_DEMUX_MPEG_DATA)
- break;
-
- case GST_NUV_DEMUX_MPEG_DATA:
- res = gst_nuv_demux_stream_mpeg_data (nuv);
- if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
- goto pause;
- }
-
- if (nuv->state != GST_NUV_DEMUX_EXTEND_HEADER)
- break;
-
- case GST_NUV_DEMUX_EXTEND_HEADER:
- res = gst_nuv_demux_stream_extend_header (nuv);
- if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
- goto pause;
- }
- if (nuv->state != GST_NUV_DEMUX_EXTEND_HEADER_DATA)
- break;
-
- case GST_NUV_DEMUX_EXTEND_HEADER_DATA:
- res = gst_nuv_demux_stream_extend_header_data (nuv);
- if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
- goto pause;
- }
-
- if (nuv->state != GST_NUV_DEMUX_FRAME_HEADER)
- break;
-
- case GST_NUV_DEMUX_FRAME_HEADER:
- res = gst_nuv_demux_read_head_frame (nuv);
- if ((res != GST_FLOW_OK) && (res != GST_FLOW_ERROR_NO_DATA)) {
- goto pause;
- }
- if (nuv->state != GST_NUV_DEMUX_MOVI)
- break;
-
- case GST_NUV_DEMUX_MOVI:
- res = gst_nuv_demux_stream_data (nuv);
- if ((res != GST_FLOW_OK) && (res != GST_FLOW_CUSTOM_ERROR)) {
- goto pause;
- }
- break;
- case GST_NUV_DEMUX_INVALID_DATA:
- goto pause;
- default:
- g_assert_not_reached ();
- }
-
- GST_DEBUG_OBJECT (nuv, "state: %d res:%s", nuv->state,
- gst_flow_get_name (res));
-
- return GST_FLOW_OK;
-
-pause:
- GST_LOG_OBJECT (nuv, "pausing task, reason %s", gst_flow_get_name (res));
- gst_pad_pause_task (nuv->sinkpad);
- if (res == GST_FLOW_UNEXPECTED) {
- gst_nuv_demux_send_eos (nuv);
- } else if (res == GST_FLOW_NOT_LINKED || res < GST_FLOW_UNEXPECTED) {
- GST_ELEMENT_FLOW_ERROR (nuv, res);
-
- gst_nuv_demux_send_eos (nuv);
- }
- return res;
-}
-
-static void
-gst_nuv_demux_send_eos (GstNuvDemux * nuv)
-{
- gst_element_post_message (GST_ELEMENT (nuv),
- gst_message_new_segment_done (GST_OBJECT (nuv), GST_FORMAT_TIME, -1));
-
- if (nuv->src_video_pad)
- gst_pad_push_event (nuv->src_video_pad, gst_event_new_eos ());
- if (nuv->src_audio_pad)
- gst_pad_push_event (nuv->src_audio_pad, gst_event_new_eos ());
-}
-
-static GstFlowReturn
-gst_nuv_demux_read_bytes (GstNuvDemux * nuv, guint64 size, gboolean move,
- GstBuffer ** buffer)
-{
- GstFlowReturn ret = GST_FLOW_OK;
-
- if (size == 0) {
- *buffer = gst_buffer_new ();
- return ret;
- }
-
- if (nuv->mode == 0) {
- ret = gst_pad_pull_range (nuv->sinkpad, nuv->offset, size, buffer);
- if (ret == GST_FLOW_OK) {
- if (move) {
- nuv->offset += size;
- }
- /* got eos */
- } else if (ret == GST_FLOW_UNEXPECTED) {
- gst_nuv_demux_send_eos (nuv);
- return GST_FLOW_FLUSHING;
- }
- } else {
- if (gst_adapter_available (nuv->adapter) < size)
- return GST_FLOW_ERROR_NO_DATA;
-
- if (move) {
- *buffer = gst_adapter_take_buffer (nuv->adapter, size);
- } else {
- guint8 *data = NULL;
-
- data = (guint8 *) gst_adapter_peek (nuv->adapter, size);
- *buffer = gst_buffer_new ();
- gst_buffer_set_data (*buffer, data, size);
- }
- }
- return ret;
-}
-
-static gboolean
-gst_nuv_demux_sink_activate (GstPad * sinkpad)
-{
- gboolean res = TRUE;
- GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (sinkpad));
-
- if (gst_pad_check_pull_range (sinkpad)) {
- nuv->mode = 0;
- if (nuv->adapter != NULL) {
- g_object_unref (nuv->adapter);
- nuv->adapter = NULL;
- }
- res = gst_pad_activate_pull (sinkpad, TRUE);
- } else {
- nuv->mode = 1;
- if (!nuv->adapter) {
- nuv->adapter = gst_adapter_new ();
- }
- res = gst_pad_activate_push (sinkpad, TRUE);
- }
-
- g_object_unref (nuv);
- return res;
-}
-
-static gboolean
-gst_nuv_demux_sink_activate_pull (GstPad * sinkpad, gboolean active)
-{
- GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (sinkpad));
-
- if (active) {
- gst_pad_start_task (sinkpad, (GstTaskFunction) gst_nuv_demux_loop, sinkpad,
- NULL);
- } else {
- gst_pad_stop_task (sinkpad);
- }
- gst_object_unref (nuv);
-
- return TRUE;
-}
-
-static GstFlowReturn
-gst_nuv_demux_chain (GstPad * pad, GstBuffer * buf)
-{
- GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (pad));
-
- gst_adapter_push (nuv->adapter, buf);
-
- return gst_nuv_demux_play (pad);
-}
-
-static void
-gst_nuv_demux_loop (GstPad * pad)
-{
- gst_nuv_demux_play (pad);
-}
-
-static void
-gst_nuv_demux_reset (GstNuvDemux * nuv)
-{
- nuv->state = GST_NUV_DEMUX_START;
- nuv->mode = 0;
- nuv->offset = 0;
- nuv->video_offset = 0;
- nuv->audio_offset = 0;
-
- if (nuv->adapter != NULL)
- gst_adapter_clear (nuv->adapter);
-
- if (nuv->mpeg_buffer != NULL) {
- gst_buffer_unref (nuv->mpeg_buffer);
- nuv->mpeg_buffer = NULL;
- }
-
- g_free (nuv->h);
- nuv->h = NULL;
-
- g_free (nuv->eh);
- nuv->eh = NULL;
-
- g_free (nuv->fh);
- nuv->fh = NULL;
-}
-
-static void
-gst_nuv_demux_destoy_src_pad (GstNuvDemux * nuv)
-{
- if (nuv->src_video_pad) {
- gst_element_remove_pad (GST_ELEMENT (nuv), nuv->src_video_pad);
- nuv->src_video_pad = NULL;
- }
-
- if (nuv->src_audio_pad) {
- gst_element_remove_pad (GST_ELEMENT (nuv), nuv->src_audio_pad);
- nuv->src_audio_pad = NULL;
- }
-}
-
-static GstStateChangeReturn
-gst_nuv_demux_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret;
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- if (ret == GST_STATE_CHANGE_FAILURE)
- goto done;
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- gst_nuv_demux_destoy_src_pad (GST_NUV_DEMUX (element));
- gst_nuv_demux_reset (GST_NUV_DEMUX (element));
- break;
- default:
- break;
- }
-
-done:
- return ret;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (nuvdemux_debug, "nuvdemux",
- 0, "Demuxer for NUV streams");
-
-#ifdef ENABLE_NLS
- GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
- LOCALEDIR);
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
-#endif /* ENABLE_NLS */
-
- if (!gst_element_register (plugin, "nuvdemux", GST_RANK_SECONDARY,
- GST_TYPE_NUV_DEMUX)) {
- return FALSE;
- }
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- nuvdemux,
- "Demuxes MythTV NuppelVideo files",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/nuvdemux/gstnuvdemux.h b/gst/nuvdemux/gstnuvdemux.h
deleted file mode 100644
index f746a3187..000000000
--- a/gst/nuvdemux/gstnuvdemux.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/* GStreamer
- * Copyright (C) <2006> Renato Araujo Oliveira Filho <renato.filho@indt.org.br>
- * Rosfran Borges <rosfran.borges@indt.org.br>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_NUV_DEMUX_H__
-#define __GST_NUV_DEMUX_H__
-
-#include <gst/gst.h>
-
-#include <gst/base/gstadapter.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_NUV_DEMUX \
- (gst_nuv_demux_get_type ())
-#define GST_NUV_DEMUX(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_NUV_DEMUX, GstNuvDemux))
-#define GST_NUV_DEMUX_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_NUV_DEMUX, GstNuvDemuxClass))
-#define GST_IS_NUV_DEMUX(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NUV_DEMUX))
-#define GST_IS_NUV_DEMUX_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_NUV_DEMUX))
-
-
-/* */
-typedef struct
-{
- gchar id[12]; /* "NuppelVideo\0" or "MythTVVideo\0" */
- gchar version[5]; /* "x.xx\0" */
-
- gint i_width;
- gint i_height;
- gint i_width_desired;
- gint i_height_desired;
-
- gchar i_mode; /* P progressive, I interlaced */
-
- gdouble d_aspect; /* 1.0 squared pixel */
- gdouble d_fps;
-
- gint i_video_blocks; /* 0 no video, -1 unknown */
- gint i_audio_blocks;
- gint i_text_blocks;
-
- gint i_keyframe_distance;
-
-} nuv_header;
-
-typedef struct
-{
- gchar i_type; /* A: audio, V: video, S: sync; T: test
- R: Seekpoint (string:RTjjjjjjjj)
- D: Extra data for codec */
- gchar i_compression; /* V: 0 uncompressed
- 1 RTJpeg
- 2 RTJpeg+lzo
- N black frame
- L copy last
- A: 0 uncompressed (44100 1-bits, 2ch)
- 1 lzo
- 2 layer 2
- 3 layer 3
- F flac
- S shorten
- N null frame loudless
- L copy last
- S: B audio and vdeo sync point
- A audio sync info (timecode == effective
- dsp frequency*100)
- V next video sync (timecode == next video
- frame num)
- S audio,video,text correlation */
- gchar i_keyframe; /* 0 keyframe, else no no key frame */
- guint8 i_filters; /* 0x01: gauss 5 pixel (8,2,2,2,2)/16
- 0x02: gauss 5 pixel (8,1,1,1,1)/12
- 0x04: cartoon filter */
-
- gint i_timecode; /* ms */
-
- gint i_length; /* V,A,T: length of following data
- S: length of packet correl */
-} nuv_frame_header;
-
-/* FIXME Not sure of this one */
-typedef struct
-{
- gint i_version;
- guint32 i_video_fcc;
-
- guint32 i_audio_fcc;
- gint i_audio_sample_rate;
- gint i_audio_bits_per_sample;
- gint i_audio_channels;
- gint i_audio_compression_ratio;
- gint i_audio_quality;
- gint i_rtjpeg_quality;
- gint i_rtjpeg_luma_filter;
- gint i_rtjpeg_chroma_filter;
- gint i_lavc_bitrate;
- gint i_lavc_qmin;
- gint i_lavc_qmax;
- gint i_lavc_maxqdiff;
- gint64 i_seekable_offset;
- gint64 i_keyframe_adjust_offset;
-
-} nuv_extended_header;
-
-typedef enum {
- GST_NUV_DEMUX_START,
- GST_NUV_DEMUX_HEADER_DATA,
- GST_NUV_DEMUX_EXTRA_DATA,
- GST_NUV_DEMUX_MPEG_DATA,
- GST_NUV_DEMUX_EXTEND_HEADER,
- GST_NUV_DEMUX_EXTEND_HEADER_DATA,
- GST_NUV_DEMUX_FRAME_HEADER,
- GST_NUV_DEMUX_MOVI,
- GST_NUV_DEMUX_INVALID_DATA
-} GstNuvDemuxState;
-
-typedef struct _GstNuvDemux {
- GstElement parent;
-
- guint mode;
- GstAdapter *adapter;
- guint64 video_offset;
- guint64 audio_offset;
-
- /* pads */
- GstPad *sinkpad;
- GstPad *src_video_pad;
- GstPad *src_audio_pad;
- gboolean first_video;
- gboolean first_audio;
-
- /* NUV decoding state */
- GstNuvDemuxState state;
- guint64 offset;
-
- /* Mpeg ExtraData */
- guint64 mpeg_data_size;
- GstBuffer *mpeg_buffer;
-
- nuv_header *h;
- nuv_extended_header *eh;
- nuv_frame_header *fh;
-} GstNuvDemux;
-
-typedef struct _GstNuvDemuxClass {
- GstElementClass parent_class;
-} GstNuvDemuxClass;
-
-GType gst_nuv_demux_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_NUV_DEMUX_H__ */
diff --git a/gst/nuvdemux/meson.build b/gst/nuvdemux/meson.build
deleted file mode 100644
index c6d803df6..000000000
--- a/gst/nuvdemux/meson.build
+++ /dev/null
@@ -1,12 +0,0 @@
-nuvd_sources = [
- 'gstnuvdemux.c',
-]
-
-gstnuvdemux = library('gstnuvdemux',
- nuvd_sources,
- c_args : gst_plugins_bad_args,
- include_directories : [configinc, libsinc],
- dependencies : [gstbase_dep],
- install : true,
- install_dir : plugins_install_dir,
-)
diff --git a/gst/overlay/Makefile.am b/gst/overlay/Makefile.am
deleted file mode 100644
index 40230ef1d..000000000
--- a/gst/overlay/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-
-plugin_LTLIBRARIES = libgstoverlay.la
-
-libgstoverlay_la_SOURCES = gstoverlay.c
-
-noinst_HEADERS = gstoverlay.h
-
-libgstoverlay_la_CFLAGS = $(GST_CFLAGS)
-libgstoverlay_la_LIBADD =
-libgstoverlay_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstoverlay_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-EXTRA_DIST =
-
diff --git a/gst/overlay/gstoverlay.c b/gst/overlay/gstoverlay.c
deleted file mode 100644
index 20cf47abc..000000000
--- a/gst/overlay/gstoverlay.c
+++ /dev/null
@@ -1,357 +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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "gstoverlay.h"
-#include <gst/video/video.h>
-
-static GstStaticPadTemplate overlay_src_factory =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
- );
-
-static GstStaticPadTemplate overlay_sink1_factory =
-GST_STATIC_PAD_TEMPLATE ("sink1",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
- );
-
-static GstStaticPadTemplate overlay_sink2_factory =
-GST_STATIC_PAD_TEMPLATE ("sink2",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
- );
-
-static GstStaticPadTemplate overlay_sink3_factory =
-GST_STATIC_PAD_TEMPLATE ("sink3",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
- );
-
-/* OVERLAY signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-enum
-{
- PROP_0
-};
-
-
-static void gst_overlay_class_init (GstOverlayClass * klass);
-static void gst_overlay_base_init (GstOverlayClass * klass);
-static void gst_overlay_init (GstOverlay * overlay);
-
-static void gst_overlay_loop (GstElement * element);
-
-static void gst_overlay_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_overlay_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static GstElementClass *parent_class = NULL;
-
-/*static guint gst_overlay_signals[LAST_SIGNAL] = { 0 }; */
-
-static GType
-gst_overlay_get_type (void)
-{
- static GType overlay_type = 0;
-
- if (!overlay_type) {
- static const GTypeInfo overlay_info = {
- sizeof (GstOverlayClass),
- (GBaseInitFunc) gst_overlay_base_init,
- NULL,
- (GClassInitFunc) gst_overlay_class_init,
- NULL,
- NULL,
- sizeof (GstOverlay),
- 0,
- (GInstanceInitFunc) gst_overlay_init,
- };
-
- overlay_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstOverlay", &overlay_info,
- 0);
- }
- return overlay_type;
-}
-
-static void
-gst_overlay_base_init (GstOverlayClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_static_pad_template (element_class,
- &overlay_sink1_factory);
- gst_element_class_add_static_pad_template (element_class,
- &overlay_sink2_factory);
- gst_element_class_add_static_pad_template (element_class,
- &overlay_sink3_factory);
- gst_element_class_add_static_pad_template (element_class,
- &overlay_src_factory);
- gst_element_class_set_static_metadata (element_class, "Video overlay",
- "Filter/Editor/Video", "Overlay multiple video streams",
- "David Schleef <ds@schleef.org>");
-}
-
-static void
-gst_overlay_class_init (GstOverlayClass * 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->set_property = gst_overlay_set_property;
- gobject_class->get_property = gst_overlay_get_property;
-
-}
-
-#if 0
-static GstCaps *
-gst_overlay_getcaps (GstPad * pad)
-{
- GstCaps *caps;
- GstOverlay *overlay;
-
- overlay = GST_OVERLAY (gst_pad_get_parent (pad));
-
- if (overlay->width && overlay->height) {
- caps = GST_STATIC_CAPS ("overlay_sink2",
- "video/raw",
- "format", GST_TYPE_FOURCC (GST_MAKE_FOURCC ('I', '4', '2', '0')),
- "width", G_TYPE_INT (overlay->width),
- "height", G_TYPE_INT (overlay->height)
- );
- } else {
- caps = GST_STATIC_CAPS ("overlay_sink2",
- "video/raw",
- "format", GST_TYPE_FOURCC (GST_MAKE_FOURCC ('I', '4', '2', '0')),
- "width", G_TYPE_INT_RANGE (0, 4096),
- "height", G_TYPE_INT_RANGE (0, 4096)
- );
- }
-
- return caps;
-}
-#endif
-
-static gboolean
-gst_overlay_sinkconnect (GstPad * pad, const GstCaps * caps)
-{
- GstOverlay *overlay;
- GstStructure *structure;
-
- overlay = GST_OVERLAY (gst_pad_get_parent (pad));
-
- structure = gst_caps_get_structure (caps, 0);
-
- gst_structure_get_int (structure, "width", &overlay->width);
- gst_structure_get_int (structure, "height", &overlay->height);
- gst_structure_get_double (structure, "framerate", &overlay->framerate);
-
- /* forward to the next plugin */
- return gst_pad_try_set_caps (overlay->srcpad, caps);
-}
-
-static void
-gst_overlay_init (GstOverlay * overlay)
-{
- overlay->sinkpad1 =
- gst_pad_new_from_static_template (&overlay_sink1_factory, "sink1");
- gst_pad_set_link_function (overlay->sinkpad1, gst_overlay_sinkconnect);
- gst_element_add_pad (GST_ELEMENT (overlay), overlay->sinkpad1);
-
- overlay->sinkpad2 =
- gst_pad_new_from_static_template (&overlay_sink2_factory, "sink2");
- gst_pad_set_link_function (overlay->sinkpad2, gst_overlay_sinkconnect);
- gst_element_add_pad (GST_ELEMENT (overlay), overlay->sinkpad2);
-
- overlay->sinkpad3 =
- gst_pad_new_from_static_template (&overlay_sink3_factory, "sink3");
- gst_pad_set_link_function (overlay->sinkpad3, gst_overlay_sinkconnect);
- gst_element_add_pad (GST_ELEMENT (overlay), overlay->sinkpad3);
-
- overlay->srcpad =
- gst_pad_new_from_static_template (&overlay_src_factory, "src");
- gst_element_add_pad (GST_ELEMENT (overlay), overlay->srcpad);
-
- gst_element_set_loop_function (GST_ELEMENT (overlay), gst_overlay_loop);
-}
-
-static void
-gst_overlay_blend_i420 (guint8 * out, guint8 * in1, guint8 * in2, guint8 * in3,
- gint width, gint height)
-{
- int mask;
- int i, j;
- guint8 *in1u, *in1v, *in2u, *in2v, *outu, *outv;
- int lumsize;
- int chromsize;
- int width2 = width / 2;
- int height2 = height / 2;
-
- lumsize = width * height;
- chromsize = width2 * height2;
-
- in1u = in1 + lumsize;
- in1v = in1u + chromsize;
- in2u = in2 + lumsize;
- in2v = in2u + chromsize;
- outu = out + lumsize;
- outv = outu + chromsize;
-
- for (i = 0; i < height; i++) {
- for (j = 0; j < width; j++) {
- mask = in3[i * width + j];
- out[i * width + j] = ((in1[i * width + j] * mask) +
- (in2[i * width + j] * (255 - mask))) >> 8;
- }
- }
-
- for (i = 0; i < height / 2; i++) {
- for (j = 0; j < width / 2; j++) {
- mask =
- (in3[(i * 2) * width + (j * 2)] + in3[(i * 2 + 1) * width + (j * 2)] +
- in3[(i * 2) * width + (j * 2 + 1)] + in3[(i * 2 + 1) * width +
- (j * 2 + 1)]) / 4;
- outu[i * width2 + j] =
- ((in1u[i * width2 + j] * mask) + (in2u[i * width2 + j] * (255 -
- mask))) >> 8;
- outv[i * width2 + j] =
- ((in1v[i * width2 + j] * mask) + (in2v[i * width2 + j] * (255 -
- mask))) >> 8;
- }
- }
-}
-
-static void
-gst_overlay_loop (GstElement * element)
-{
- GstOverlay *overlay;
- GstBuffer *out;
- GstBuffer *in1 = NULL, *in2 = NULL, *in3 = NULL;
- int size;
-
- overlay = GST_OVERLAY (element);
-
- in1 = GST_BUFFER (gst_pad_pull (overlay->sinkpad1));
- if (GST_IS_EVENT (in1)) {
- gst_pad_push (overlay->srcpad, GST_DATA (in1));
- /* FIXME */
- return;
- }
- in2 = GST_BUFFER (gst_pad_pull (overlay->sinkpad2));
- if (GST_IS_EVENT (in2)) {
- gst_pad_push (overlay->srcpad, GST_DATA (in2));
- /* FIXME */
- return;
- }
- in3 = GST_BUFFER (gst_pad_pull (overlay->sinkpad3));
- if (GST_IS_EVENT (in3)) {
- gst_pad_push (overlay->srcpad, GST_DATA (in3));
- /* FIXME */
- return;
- }
-
- g_return_if_fail (in1 != NULL);
- g_return_if_fail (in2 != NULL);
- g_return_if_fail (in3 != NULL);
-
- size = (overlay->width * overlay->height * 3) / 2;
- g_return_if_fail (GST_BUFFER_SIZE (in1) != size);
- g_return_if_fail (GST_BUFFER_SIZE (in2) != size);
- g_return_if_fail (GST_BUFFER_SIZE (in3) != size);
-
- out = gst_buffer_new_and_alloc (size);
-
- gst_overlay_blend_i420 (GST_BUFFER_DATA (out),
- GST_BUFFER_DATA (in1),
- GST_BUFFER_DATA (in2),
- GST_BUFFER_DATA (in3), overlay->width, overlay->height);
-
- GST_BUFFER_TIMESTAMP (out) = GST_BUFFER_TIMESTAMP (in1);
- GST_BUFFER_DURATION (out) = GST_BUFFER_DURATION (in1);
-
- gst_buffer_unref (in1);
- gst_buffer_unref (in2);
- gst_buffer_unref (in3);
-
- gst_pad_push (overlay->srcpad, GST_DATA (out));
-}
-
-static void
-gst_overlay_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstOverlay *overlay;
-
- overlay = GST_OVERLAY (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_overlay_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstOverlay *overlay;
-
- overlay = GST_OVERLAY (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- return gst_element_register (plugin, "overlay",
- GST_RANK_NONE, GST_TYPE_OVERLAY);
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- overlay,
- "Overlay multiple video streams",
- plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/overlay/gstoverlay.h b/gst/overlay/gstoverlay.h
deleted file mode 100644
index de39db28a..000000000
--- a/gst/overlay/gstoverlay.h
+++ /dev/null
@@ -1,67 +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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifndef __GST_OVERLAY_H__
-#define __GST_OVERLAY_H__
-
-#include <gst/gst.h>
-
-#define GST_TYPE_OVERLAY \
- (gst_overlay_get_type())
-#define GST_OVERLAY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OVERLAY,GstOverlay))
-#define GST_OVERLAY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OVERLAY,GstOverlayClass))
-#define GST_IS_OVERLAY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OVERLAY))
-#define GST_IS_OVERLAY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OVERLAY))
-
-typedef struct _GstOverlay GstOverlay;
-typedef struct _GstOverlayClass GstOverlayClass;
-
-struct _GstOverlay {
- GstElement element;
-
- GstPad *srcpad;
- GstPad *sinkpad1;
- GstPad *sinkpad2;
- GstPad *sinkpad3;
-
- gint format;
- gint width;
- gint height;
-
- gint duration;
- gint position;
-
- gint type;
- gint fps;
- gint border;
- gint depth;
-
- gdouble framerate;
-};
-
-struct _GstOverlayClass {
- GstElementClass parent_class;
-};
-
-#endif /* __GST_OVERLAY_H__ */
diff --git a/gst/overlay/meson.build b/gst/overlay/meson.build
deleted file mode 100644
index 56854bcd5..000000000
--- a/gst/overlay/meson.build
+++ /dev/null
@@ -1,12 +0,0 @@
-overlay_sources = [
- 'gstoverlay.c',
-]
-
-gstoverlay = library('gstoverlay',
- overlay_sources,
- c_args : gst_plugins_bad_args,
- include_directories : [configinc],
- dependencies : [gst_dep],
- install : true,
- install_dir : plugins_install_dir,
-)
diff --git a/gst/patchdetect/Makefile.am b/gst/patchdetect/Makefile.am
deleted file mode 100644
index 5ddef3fe9..000000000
--- a/gst/patchdetect/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-plugin_LTLIBRARIES = libgstpatchdetect.la
-
-#ORC_SOURCE=gstpatchdetectorc
-#include $(top_srcdir)/common/orc.mak
-
-libgstpatchdetect_la_SOURCES = gstpatchdetect.c
-#nodist_libgstpatchdetect_la_SOURCES = $(ORC_NODIST_SOURCES)
-libgstpatchdetect_la_CFLAGS = \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_CFLAGS)
-libgstpatchdetect_la_LIBADD = \
- $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \
- $(GST_BASE_LIBS) \
- $(GST_LIBS) \
- $(LIBM)
-libgstpatchdetect_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstpatchdetect_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-noinst_HEADERS = gstpatchdetect.h
diff --git a/gst/patchdetect/gstpatchdetect.c b/gst/patchdetect/gstpatchdetect.c
deleted file mode 100644
index ff21fdab0..000000000
--- a/gst/patchdetect/gstpatchdetect.c
+++ /dev/null
@@ -1,1235 +0,0 @@
-/* GStreamer
- * Copyright (C) 2011 David Schleef <ds@entropywave.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
- * Boston, MA 02110-1335, USA.
- */
-/**
- * SECTION:element-gstpatchdetect
- *
- * The patchdetect element detects color patches from a color
- * calibration chart. Currently, the patches for the 24-square
- * Munsell ColorChecker are hard-coded into the element. When
- * a color chart is detected in the video stream, a message is
- * sent to the bus containing the detected color values of each
- * of the patches.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch -v dv1394src ! dvdemux ! dvdec ! patchdetect ! xvimagesink
- * ]|
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/base/gstbasetransform.h>
-#include <gst/video/video.h>
-#include <math.h>
-#include <string.h>
-#include "gstpatchdetect.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_patchdetect_debug_category);
-#define GST_CAT_DEFAULT gst_patchdetect_debug_category
-
-/* prototypes */
-
-
-static void gst_patchdetect_set_property (GObject * object,
- guint property_id, const GValue * value, GParamSpec * pspec);
-static void gst_patchdetect_get_property (GObject * object,
- guint property_id, GValue * value, GParamSpec * pspec);
-static void gst_patchdetect_dispose (GObject * object);
-static void gst_patchdetect_finalize (GObject * object);
-
-static gboolean
-gst_patchdetect_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
- guint * size);
-static gboolean
-gst_patchdetect_set_caps (GstBaseTransform * trans, GstCaps * incaps,
- GstCaps * outcaps);
-static gboolean gst_patchdetect_start (GstBaseTransform * trans);
-static gboolean gst_patchdetect_stop (GstBaseTransform * trans);
-static gboolean gst_patchdetect_event (GstBaseTransform * trans,
- GstEvent * event);
-static GstFlowReturn gst_patchdetect_transform_ip (GstBaseTransform * trans,
- GstBuffer * buf);
-static gboolean gst_patchdetect_src_event (GstBaseTransform * trans,
- GstEvent * event);
-
-enum
-{
- PROP_0
-};
-
-/* pad templates */
-
-static GstStaticPadTemplate gst_patchdetect_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
- );
-
-static GstStaticPadTemplate gst_patchdetect_src_template =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
- );
-
-
-/* class initialization */
-
-#define DEBUG_INIT(bla) \
- GST_DEBUG_CATEGORY_INIT (gst_patchdetect_debug_category, "patchdetect", 0, \
- "debug category for patchdetect element");
-
-GST_BOILERPLATE_FULL (GstPatchdetect, gst_patchdetect, GstBaseTransform,
- GST_TYPE_BASE_TRANSFORM, DEBUG_INIT);
-
-static void
-gst_patchdetect_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_static_pad_template (element_class,
- &gst_patchdetect_sink_template);
- gst_element_class_add_static_pad_template (element_class,
- &gst_patchdetect_src_template);
-
- gst_element_class_set_static_metadata (element_class, "Color Patch Detector",
- "Video/Analysis", "Detects color patches from a color calibration chart",
- "David Schleef <ds@entropywave.com>");
-}
-
-static void
-gst_patchdetect_class_init (GstPatchdetectClass * klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GstBaseTransformClass *base_transform_class =
- GST_BASE_TRANSFORM_CLASS (klass);
-
- gobject_class->set_property = gst_patchdetect_set_property;
- gobject_class->get_property = gst_patchdetect_get_property;
- gobject_class->dispose = gst_patchdetect_dispose;
- gobject_class->finalize = gst_patchdetect_finalize;
- base_transform_class->get_unit_size =
- GST_DEBUG_FUNCPTR (gst_patchdetect_get_unit_size);
- base_transform_class->set_caps = GST_DEBUG_FUNCPTR (gst_patchdetect_set_caps);
- base_transform_class->start = GST_DEBUG_FUNCPTR (gst_patchdetect_start);
- base_transform_class->stop = GST_DEBUG_FUNCPTR (gst_patchdetect_stop);
- base_transform_class->event = GST_DEBUG_FUNCPTR (gst_patchdetect_event);
- base_transform_class->transform_ip =
- GST_DEBUG_FUNCPTR (gst_patchdetect_transform_ip);
- base_transform_class->src_event =
- GST_DEBUG_FUNCPTR (gst_patchdetect_src_event);
-
-}
-
-static void
-gst_patchdetect_init (GstPatchdetect * patchdetect,
- GstPatchdetectClass * patchdetect_class)
-{
-}
-
-void
-gst_patchdetect_set_property (GObject * object, guint property_id,
- const GValue * value, GParamSpec * pspec)
-{
- g_return_if_fail (GST_IS_PATCHDETECT (object));
-
- switch (property_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-void
-gst_patchdetect_get_property (GObject * object, guint property_id,
- GValue * value, GParamSpec * pspec)
-{
- g_return_if_fail (GST_IS_PATCHDETECT (object));
-
- switch (property_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-void
-gst_patchdetect_dispose (GObject * object)
-{
- g_return_if_fail (GST_IS_PATCHDETECT (object));
-
- /* clean up as possible. may be called multiple times */
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-void
-gst_patchdetect_finalize (GObject * object)
-{
- g_return_if_fail (GST_IS_PATCHDETECT (object));
-
- /* clean up object here */
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-
-static gboolean
-gst_patchdetect_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
- guint * size)
-{
- int width, height;
- GstVideoFormat format;
- gboolean ret;
-
- ret = gst_video_format_parse_caps (caps, &format, &width, &height);
- *size = gst_video_format_get_size (format, width, height);
-
- return ret;
-}
-
-static gboolean
-gst_patchdetect_set_caps (GstBaseTransform * trans, GstCaps * incaps,
- GstCaps * outcaps)
-{
- GstPatchdetect *patchdetect = GST_PATCHDETECT (trans);
- int width, height;
- GstVideoFormat format;
- gboolean ret;
-
- ret = gst_video_format_parse_caps (incaps, &format, &width, &height);
- if (ret) {
- patchdetect->format = format;
- patchdetect->width = width;
- patchdetect->height = height;
- }
-
- return ret;
-}
-
-static gboolean
-gst_patchdetect_start (GstBaseTransform * trans)
-{
-
- return TRUE;
-}
-
-static gboolean
-gst_patchdetect_stop (GstBaseTransform * trans)
-{
-
- return TRUE;
-}
-
-static gboolean
-gst_patchdetect_event (GstBaseTransform * trans, GstEvent * event)
-{
-
- return TRUE;
-}
-
-typedef struct
-{
- guint8 *y;
- int ystride;
- guint8 *u;
- int ustride;
- guint8 *v;
- int vstride;
- int width;
- int height;
- int t;
-} Frame;
-
-typedef struct
-{
- int y, u, v;
- int diff_y, diff_u, diff_v;
- gboolean match;
- int patch_block;
- int color;
- int count;
- int sum_x;
- int sum_y;
-} Stats;
-
-typedef struct
-{
- int r, g, b;
- int y, u, v;
-} Color;
-
-typedef struct
-{
- int x, y;
- int patch1, patch2;
- gboolean valid;
-} Point;
-
-typedef struct
-{
- int xmin, xmax;
- int ymin, ymax;
- int val;
- int y, u, v;
- int count;
- int cen_x, cen_y;
- gboolean valid;
-} Patch;
-
-static const Color patch_colors[24] = {
- {115, 82, 68, 92, 119, 143},
- {194, 150, 130, 152, 115, 148},
- {98, 122, 157, 119, 146, 116},
- {87, 108, 67, 102, 112, 120},
- {133, 128, 177, 130, 149, 128},
- {103, 189, 170, 161, 128, 91},
- {214, 126, 44, 135, 83, 170},
- {80, 91, 166, 97, 162, 120},
- {193, 90, 99, 113, 122, 173},
- {94, 60, 108, 77, 146, 141},
- {157, 188, 64, 164, 77, 119},
- {224, 163, 46, 160, 70, 160},
- {56, 61, 150, 73, 168, 122},
- {70, 148, 73, 124, 103, 97},
- {175, 54, 60, 85, 118, 181},
- {231, 199, 31, 182, 51, 149},
- {187, 86, 149, 112, 146, 170},
- {8, 133, 161, 109, 153, 72},
- {243, 243, 243, 225, 128, 128},
- {200, 200, 200, 188, 128, 128},
- {160, 160, 160, 153, 128, 128},
- {122, 122, 122, 121, 128, 128},
- {85, 85, 85, 89, 128, 128},
- {52, 52, 52, 61, 128, 128}
-};
-
-static void
-get_block_stats (Frame * frame, int x, int y, Stats * stats)
-{
- int i, j;
- guint8 *data;
- int max;
- int min;
- int sum;
-
- max = 0;
- min = 255;
- sum = 0;
- for (j = 0; j < 8; j++) {
- data = frame->y + frame->ystride * (j + y) + x;
- for (i = 0; i < 8; i++) {
- max = MAX (max, data[i]);
- min = MIN (min, data[i]);
- sum += data[i];
- }
- }
- stats->y = sum / 64;
- stats->diff_y = MAX (max - stats->y, stats->y - min);
-
- max = 0;
- min = 255;
- sum = 0;
- for (j = 0; j < 4; j++) {
- data = frame->u + frame->ustride * (j + y / 2) + x / 2;
- for (i = 0; i < 4; i++) {
- max = MAX (max, data[i]);
- min = MIN (min, data[i]);
- sum += data[i];
- }
- }
- stats->u = sum / 16;
- stats->diff_u = MAX (max - stats->u, stats->u - min);
-
- max = 0;
- min = 255;
- sum = 0;
- for (j = 0; j < 4; j++) {
- data = frame->v + frame->vstride * (j + y / 2) + x / 2;
- for (i = 0; i < 4; i++) {
- max = MAX (max, data[i]);
- min = MIN (min, data[i]);
- sum += data[i];
- }
- }
- stats->v = sum / 16;
- stats->diff_v = MAX (max - stats->v, stats->v - min);
-
- stats->patch_block = -1;
- stats->match = FALSE;
-#define MATCH 15
- if (stats->diff_y < MATCH && stats->diff_u < MATCH && stats->diff_v < MATCH) {
- stats->match = TRUE;
- }
-}
-
-static void
-paint_block (Frame * frame, int x, int y, int value)
-{
- int i, j;
- guint8 *data;
-
- for (j = 0; j < 8; j++) {
- data = frame->y + frame->ystride * (j + y) + x;
- for (i = 0; i < 8; i++) {
- data[i] = value;
- }
- }
-
- for (j = 0; j < 4; j++) {
- data = frame->u + frame->ustride * (j + y / 2) + x / 2;
- for (i = 0; i < 4; i++) {
- data[i] = 128;
- }
- }
-
- for (j = 0; j < 4; j++) {
- data = frame->v + frame->vstride * (j + y / 2) + x / 2;
- for (i = 0; i < 4; i++) {
- data[i] = 128;
- }
- }
-}
-
-static gboolean
-patch_check (Frame * frame, guint8 * patchpix, int x, int y, int w, int h)
-{
- int i, j;
-
- for (j = y; j < y + h; j++) {
- for (i = x; i < x + w; i++) {
- if (patchpix[j * frame->width + i] != 0)
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-static void
-patch_start (Frame * frame, guint8 * patchpix, Patch * patch, int x, int y,
- int w, int h)
-{
- int i, j;
-
- for (j = y; j < y + h; j++) {
- for (i = x; i < x + w; i++) {
- patchpix[j * frame->width + i] = patch->val;
- }
- }
- patch->xmin = MAX (1, x - 1);
- patch->xmax = MIN (x + w + 1, frame->width - 1);
- patch->ymin = MAX (1, y - 1);
- patch->ymax = MIN (y + h + 1, frame->height - 1);
- patch->count = w * h;
-
-}
-
-static void
-patch_grow (Frame * frame, guint8 * patchpix, Patch * patch)
-{
- gboolean growmore = FALSE;
- guint8 *ydata, *udata, *vdata;
- int i, j;
- int count = 5;
-
-#define MAXDIFF 15
- do {
- for (j = patch->ymin; j < patch->ymax; j++) {
- ydata = frame->y + frame->ystride * j;
- udata = frame->u + frame->ustride * (j / 2);
- vdata = frame->v + frame->vstride * (j / 2);
- for (i = patch->xmin; i < patch->xmax; i++) {
- if (patchpix[j * frame->width + i] != 0)
- continue;
-
- if (patchpix[(j + 1) * frame->width + i] == patch->val ||
- patchpix[(j - 1) * frame->width + i] == patch->val ||
- patchpix[j * frame->width + i + 1] == patch->val ||
- patchpix[j * frame->width + i - 1] == patch->val) {
- int diff = ABS (ydata[i] - patch->y) +
- ABS (udata[i / 2] - patch->u) + ABS (vdata[i / 2] - patch->v);
-
- if (diff < MAXDIFF) {
- patchpix[j * frame->width + i] = patch->val;
- patch->xmin = MIN (patch->xmin, MAX (i - 1, 1));
- patch->xmax = MAX (patch->xmax, MIN (i + 2, frame->width - 1));
- patch->ymin = MIN (patch->ymin, MAX (j - 1, 1));
- patch->ymax = MAX (patch->ymax, MIN (j + 2, frame->height - 1));
- patch->count++;
- growmore = TRUE;
- }
- }
- }
- }
- for (j = patch->ymax - 1; j >= patch->ymin; j--) {
- ydata = frame->y + frame->ystride * j;
- udata = frame->u + frame->ustride * (j / 2);
- vdata = frame->v + frame->vstride * (j / 2);
- for (i = patch->xmax - 1; i >= patch->xmin; i--) {
- if (patchpix[j * frame->width + i] != 0)
- continue;
-
- if (patchpix[(j + 1) * frame->width + i] == patch->val ||
- patchpix[(j - 1) * frame->width + i] == patch->val ||
- patchpix[j * frame->width + i + 1] == patch->val ||
- patchpix[j * frame->width + i - 1] == patch->val) {
- int diff = ABS (ydata[i] - patch->y) +
- ABS (udata[i / 2] - patch->u) + ABS (vdata[i / 2] - patch->v);
-
- if (diff < MAXDIFF) {
- patchpix[j * frame->width + i] = patch->val;
- patch->xmin = MIN (patch->xmin, MAX (i - 1, 1));
- patch->xmax = MAX (patch->xmax, MIN (i + 2, frame->width - 1));
- patch->ymin = MIN (patch->ymin, MAX (j - 1, 1));
- patch->ymax = MAX (patch->ymax, MIN (j + 2, frame->height - 1));
- patch->count++;
- growmore = TRUE;
- }
- }
- }
- }
-
- count--;
- } while (growmore && count > 0);
-
-#if 0
- for (j = patch->ymin; j < patch->ymax; j++) {
- guint8 *data;
- data = frame->y + frame->ystride * j;
- for (i = patch->xmin; i < patch->xmax; i++) {
- if (patchpix[j * frame->width + i] != patch->val)
- continue;
- if ((i + j + frame->t) & 0x4) {
- data[i] = 16;
- }
- }
- }
-#endif
-
-}
-
-#if 0
-static void
-find_cluster (Point * points, int n_points, int *result_x, int *result_y)
-{
- int dist;
- int ave_x, ave_y;
- int i;
-
- for (dist = 50; dist >= 10; dist -= 5) {
- int sum_x, sum_y;
- int n_valid;
-
- sum_x = 0;
- sum_y = 0;
- n_valid = 0;
- for (i = 0; i < n_points; i++) {
- if (!points[i].valid)
- continue;
- sum_x += points[i].x;
- sum_y += points[i].y;
- n_valid++;
- }
- ave_x = sum_x / n_valid;
- ave_y = sum_y / n_valid;
-
- for (i = 0; i < n_points; i++) {
- int d;
- if (!points[i].valid)
- continue;
- d = (points[i].x - ave_x) * (points[i].x - ave_x);
- d += (points[i].y - ave_y) * (points[i].y - ave_y);
- if (d > dist * dist)
- points[i].valid = FALSE;
- }
- }
- *result_x = ave_x;
- *result_y = ave_y;
-}
-#endif
-
-typedef struct _Matrix Matrix;
-struct _Matrix
-{
- double m[4][4];
-};
-
-#if 0
-static void
-dump_4x4 (double a[4][4], double b[4][4])
-{
- int j;
- int i;
-
- for (j = 0; j < 4; j++) {
- g_print ("[ ");
- for (i = 0; i < 4; i++) {
- g_print ("%8.2g", a[i][j]);
- if (i != 4 - 1)
- g_print (", ");
- }
- g_print ("|");
- for (i = 0; i < 4; i++) {
- g_print ("%8.2g", b[i][j]);
- if (i != 4 - 1)
- g_print (", ");
- }
- g_print ("]\n");
- }
- g_print ("\n");
-
-}
-#endif
-
-static void
-invert_matrix (double m[10][10], int n)
-{
- int i, j, k;
- double tmp[10][10] = { {0} };
- double x;
-
- for (i = 0; i < n; i++) {
- tmp[i][i] = 1;
- }
-
- for (j = 0; j < n; j++) {
- for (k = 0; k < n; k++) {
- if (k == j)
- continue;
-
- x = m[j][k] / m[j][j];
- for (i = 0; i < n; i++) {
- m[i][k] -= x * m[i][j];
- tmp[i][k] -= x * tmp[i][j];
- }
- }
-
- x = m[j][j];
- for (i = 0; i < n; i++) {
- m[i][j] /= x;
- tmp[i][j] /= x;
- }
- }
-
- memcpy (m, tmp, sizeof (tmp));
-}
-
-static GstFlowReturn
-gst_patchdetect_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
-{
- GstPatchdetect *patchdetect = GST_PATCHDETECT (trans);
- Frame frame;
- Point *points;
- int i, j;
- int blocks_x, blocks_y;
- int n_points;
- int n_patches;
- Patch *patches;
- guint8 *patchpix;
- int vec1_x, vec1_y;
- int vec2_x, vec2_y;
- Color detected_colors[24];
- gboolean detected = FALSE;
-
- frame.y = GST_BUFFER_DATA (buf);
- frame.ystride = gst_video_format_get_row_stride (patchdetect->format,
- 0, patchdetect->width);
- frame.u =
- frame.y + gst_video_format_get_component_offset (patchdetect->format, 1,
- patchdetect->width, patchdetect->height);
- frame.ustride =
- gst_video_format_get_row_stride (patchdetect->format, 1,
- patchdetect->width);
- frame.v =
- frame.y + gst_video_format_get_component_offset (patchdetect->format, 2,
- patchdetect->width, patchdetect->height);
- frame.vstride =
- gst_video_format_get_row_stride (patchdetect->format, 2,
- patchdetect->width);
- frame.width = patchdetect->width;
- frame.height = patchdetect->height;
- frame.t = patchdetect->t;
- patchdetect->t++;
-
- blocks_y = (patchdetect->height & (~7)) / 8;
- blocks_x = (patchdetect->width & (~7)) / 8;
-
- patchpix = g_malloc0 (patchdetect->width * patchdetect->height);
- patches = g_malloc0 (sizeof (Patch) * 256);
-
- n_patches = 0;
- for (j = 0; j < blocks_y; j += 4) {
- for (i = 0; i < blocks_x; i += 4) {
- Stats block = { 0 };
-
- get_block_stats (&frame, i * 8, j * 8, &block);
-
- patches[n_patches].val = n_patches + 2;
- if (block.match) {
- if (patch_check (&frame, patchpix, i * 8, j * 8, 8, 8)) {
- patch_start (&frame, patchpix, patches + n_patches, i * 8, j * 8, 8,
- 8);
-
- patches[n_patches].y = block.y;
- patches[n_patches].u = block.u;
- patches[n_patches].v = block.v;
-
- patch_grow (&frame, patchpix, patches + n_patches);
- n_patches++;
- g_assert (n_patches < 256);
- }
- }
- }
- }
-
- {
- int n;
-
- for (n = 0; n < n_patches; n++) {
- Patch *patch = &patches[n];
- int xsum;
- int ysum;
-
- if (patch->count > 10000)
- continue;
- patch->valid = TRUE;
-
- xsum = 0;
- ysum = 0;
- for (j = patch->ymin; j < patch->ymax; j++) {
- for (i = patch->xmin; i < patch->xmax; i++) {
- if (patchpix[j * frame.width + i] != patch->val)
- continue;
- xsum += i;
- ysum += j;
- }
- }
-
- patch->cen_x = xsum / patch->count;
- patch->cen_y = ysum / patch->count;
- }
-
- }
-
- points = g_malloc0 (sizeof (Point) * 1000);
- n_points = 0;
-
- for (i = 0; i < n_patches; i++) {
- for (j = i + 1; j < n_patches; j++) {
- int dist_x, dist_y;
-
- if (i == j)
- continue;
-
- dist_x = patches[i].cen_x - patches[j].cen_x;
- dist_y = patches[i].cen_y - patches[j].cen_y;
-
- if (dist_x < 0) {
- dist_x = -dist_x;
- dist_y = -dist_y;
- }
- if (ABS (2 * dist_y) < dist_x && dist_x < 100) {
- points[n_points].x = dist_x;
- points[n_points].y = dist_y;
- points[n_points].valid = TRUE;
- points[n_points].patch1 = i;
- points[n_points].patch2 = j;
- n_points++;
- g_assert (n_points < 1000);
- }
- }
- }
-
- {
- int dist;
- int ave_x = 0, ave_y = 0;
- for (dist = 50; dist >= 10; dist -= 5) {
- int sum_x, sum_y;
- int n_valid;
-
- sum_x = 0;
- sum_y = 0;
- n_valid = 0;
- for (i = 0; i < n_points; i++) {
- if (!points[i].valid)
- continue;
- sum_x += points[i].x;
- sum_y += points[i].y;
- n_valid++;
- }
- if (n_valid == 0)
- continue;
- ave_x = sum_x / n_valid;
- ave_y = sum_y / n_valid;
-
- for (i = 0; i < n_points; i++) {
- int d;
- if (!points[i].valid)
- continue;
- d = (points[i].x - ave_x) * (points[i].x - ave_x);
- d += (points[i].y - ave_y) * (points[i].y - ave_y);
- if (d > dist * dist)
- points[i].valid = FALSE;
- }
- }
- vec1_x = ave_x;
- vec1_y = ave_y;
- }
-
- n_points = 0;
- for (i = 0; i < n_patches; i++) {
- for (j = i + 1; j < n_patches; j++) {
- int dist_x, dist_y;
-
- if (i == j)
- continue;
-
- dist_x = patches[i].cen_x - patches[j].cen_x;
- dist_y = patches[i].cen_y - patches[j].cen_y;
-
- if (dist_y < 0) {
- dist_x = -dist_x;
- dist_y = -dist_y;
- }
- if (ABS (2 * dist_x) < dist_y && dist_y < 100) {
- points[n_points].x = dist_x;
- points[n_points].y = dist_y;
- points[n_points].valid = TRUE;
- points[n_points].patch1 = i;
- points[n_points].patch2 = j;
- n_points++;
- g_assert (n_points < 1000);
- }
- }
- }
-
- {
- int dist;
- int ave_x = 0, ave_y = 0;
- for (dist = 50; dist >= 10; dist -= 5) {
- int sum_x, sum_y;
- int n_valid;
-
- sum_x = 0;
- sum_y = 0;
- n_valid = 0;
- for (i = 0; i < n_points; i++) {
- if (!points[i].valid)
- continue;
- sum_x += points[i].x;
- sum_y += points[i].y;
- n_valid++;
- }
- if (n_valid == 0)
- continue;
- ave_x = sum_x / n_valid;
- ave_y = sum_y / n_valid;
-
- for (i = 0; i < n_points; i++) {
- int d;
- if (!points[i].valid)
- continue;
- d = (points[i].x - ave_x) * (points[i].x - ave_x);
- d += (points[i].y - ave_y) * (points[i].y - ave_y);
- if (d > dist * dist)
- points[i].valid = FALSE;
- }
- }
- vec2_x = ave_x;
- vec2_y = ave_y;
- }
-
-#if 0
- for (i = 0; i < n_points; i++) {
- if (!points[i].valid)
- continue;
- paint_block (&frame, 4 * points[i].x, 240 + 4 * points[i].y, 16);
- }
-#endif
-#if 0
- paint_block (&frame, 360, 240, 16);
- paint_block (&frame, 360 + vec1_x, 240 + vec1_y, 16);
- paint_block (&frame, 360 + vec2_x, 240 + vec2_y, 16);
-#endif
-
- {
- double m00, m01, m10, m11;
- double det;
- double v1, v2;
- double ave_v1 = 0, ave_v2 = 0;
-
- det = vec1_x * vec2_y - vec1_y * vec2_x;
- m00 = vec2_y / det;
- m01 = -vec2_x / det;
- m10 = -vec1_y / det;
- m11 = vec1_x / det;
-
- for (i = 0; i < n_patches - 1; i++) {
- int count = 0;
- double sum_v1 = 0;
- double sum_v2 = 0;
-
- if (!patches[i].valid)
- continue;
-
- n_points = 0;
- for (j = i + 1; j < n_patches; j++) {
- int diff_x = patches[j].cen_x - patches[i].cen_x;
- int diff_y = patches[j].cen_y - patches[i].cen_y;
-
- if (!patches[j].valid)
- continue;
-
- v1 = diff_x * m00 + diff_y * m01;
- v2 = diff_x * m10 + diff_y * m11;
-
- if (v1 > -0.5 && v1 < 5.5 && v2 > -0.5 && v2 < 3.5 &&
- ABS (v1 - rint (v1)) < 0.1 && ABS (v2 - rint (v2)) < 0.1) {
- sum_v1 += v1 - rint (v1);
- sum_v2 += v2 - rint (v2);
- count++;
- }
- }
- ave_v1 = sum_v1 / count;
- ave_v2 = sum_v2 / count;
-
- if (count > 20) {
- int k;
- for (j = 0; j < 4; j++) {
- for (k = 0; k < 6; k++) {
- Stats block;
-
- int xx;
- int yy;
- xx = patches[i].cen_x + (ave_v1 + k) * vec1_x + (ave_v2 +
- j) * vec2_x;
- yy = patches[i].cen_y + (ave_v1 + k) * vec1_y + (ave_v2 +
- j) * vec2_y;
-
- get_block_stats (&frame, xx - 4, yy - 4, &block);
- //GST_ERROR("%d %d: %d %d %d", k, j, block.y, block.u, block.v);
-
- detected_colors[k + j * 6].y = block.y;
- detected_colors[k + j * 6].u = block.u;
- detected_colors[k + j * 6].v = block.v;
-
- paint_block (&frame, xx - 4, yy - 4, 16);
- }
- }
-
- detected = TRUE;
-
-#if 0
- for (j = i + 1; j < n_patches; j++) {
- int diff_x = patches[j].cen_x - patches[i].cen_x;
- int diff_y = patches[j].cen_y - patches[i].cen_y;
- int xx;
- int yy;
-
- if (!patches[j].valid)
- continue;
-
- v1 = diff_x * m00 + diff_y * m01;
- v2 = diff_x * m10 + diff_y * m11;
-
- if (v1 > -0.5 && v1 < 5.5 && v2 > -0.5 && v2 < 3.5 &&
- ABS (v1 - rint (v1)) < 0.1 && ABS (v2 - rint (v2)) < 0.1) {
- v1 = rint (v1);
- v2 = rint (v2);
- xx = patches[i].cen_x + (ave_v1 + v1) * vec1_x + (ave_v2 +
- v2) * vec2_x;
- yy = patches[i].cen_y + (ave_v1 + v1) * vec1_y + (ave_v2 +
- v2) * vec2_y;
-
- paint_block (&frame, patches[j].cen_x, patches[j].cen_y, 128);
- paint_block (&frame, xx, yy, 16);
- }
- }
- paint_block (&frame, patches[i].cen_x, patches[i].cen_y, 240);
-#endif
- break;
- }
- }
- }
-
-#define N 10
- if (detected) {
- int i, j, k;
- int n = N;
- double diff = 0;
- double matrix[10][10] = { {0} };
- double vy[10] = { 0 };
- double vu[10] = { 0 };
- double vv[10] = { 0 };
- double *by = patchdetect->by;
- double *bu = patchdetect->bu;
- double *bv = patchdetect->bv;
- double flip_diff = 0;
-
- for (i = 0; i < 24; i++) {
- diff += ABS (detected_colors[i].y - patch_colors[i].y);
- diff += ABS (detected_colors[i].u - patch_colors[i].u);
- diff += ABS (detected_colors[i].v - patch_colors[i].v);
-
- flip_diff += ABS (detected_colors[23 - i].y - patch_colors[i].y);
- flip_diff += ABS (detected_colors[23 - i].u - patch_colors[i].u);
- flip_diff += ABS (detected_colors[23 - i].v - patch_colors[i].v);
- }
- GST_ERROR ("uncorrected error %g (flipped %g)", diff / 24.0,
- flip_diff / 24.0);
- if (flip_diff < diff) {
- for (i = 0; i < 12; i++) {
- Color tmp;
- tmp = detected_colors[i];
- detected_colors[i] = detected_colors[23 - i];
- detected_colors[23 - i] = tmp;
- }
- }
-
- for (i = 0; i < 24; i++) {
- int dy = detected_colors[i].y - patch_colors[i].y;
- int du = detected_colors[i].u - patch_colors[i].u;
- int dv = detected_colors[i].v - patch_colors[i].v;
- int py = detected_colors[i].y - 128;
- int pu = detected_colors[i].u - 128;
- int pv = detected_colors[i].v - 128;
- int w = (i < 18) ? 1 : 2;
- double z[10];
-
- diff += ABS (dy) + ABS (du) + ABS (dv);
-
- z[0] = 1;
- z[1] = py;
- z[2] = pu;
- z[3] = pv;
- z[4] = py * py;
- z[5] = py * pu;
- z[6] = py * pv;
- z[7] = pu * pu;
- z[8] = pu * pv;
- z[9] = pv * pv;
-
- for (j = 0; j < n; j++) {
- for (k = 0; k < n; k++) {
- matrix[j][k] += w * z[j] * z[k];
- }
-
- vy[j] += w * dy * z[j];
- vu[j] += w * du * z[j];
- vv[j] += w * dv * z[j];
- }
- }
-
- invert_matrix (matrix, n);
-
- for (i = 0; i < n; i++) {
- by[i] = 0;
- bu[i] = 0;
- bv[i] = 0;
- for (j = 0; j < n; j++) {
- by[i] += matrix[i][j] * vy[j];
- bu[i] += matrix[i][j] * vu[j];
- bv[i] += matrix[i][j] * vv[j];
- }
- }
-
- //GST_ERROR("a %g %g %g b %g %g %g", ay, au, av, by, bu, bv);
-
- diff = 0;
- for (i = 0; i < 24; i++) {
- double cy, cu, cv;
- double z[10];
- int py = detected_colors[i].y - 128;
- int pu = detected_colors[i].u - 128;
- int pv = detected_colors[i].v - 128;
-
- z[0] = 1;
- z[1] = py;
- z[2] = pu;
- z[3] = pv;
- z[4] = py * py;
- z[5] = py * pu;
- z[6] = py * pv;
- z[7] = pu * pu;
- z[8] = pu * pv;
- z[9] = pv * pv;
-
- cy = 0;
- cu = 0;
- cv = 0;
- for (j = 0; j < n; j++) {
- cy += by[j] * z[j];
- cu += bu[j] * z[j];
- cv += bv[j] * z[j];
- }
-
- diff += fabs (patch_colors[i].y - (128 + py - cy));
- diff += fabs (patch_colors[i].u - (128 + pu - cu));
- diff += fabs (patch_colors[i].v - (128 + pv - cv));
- }
- GST_ERROR ("average error %g", diff / 24.0);
- patchdetect->valid = 3000;
- }
-
- if (patchdetect->valid > 0) {
- int n = N;
- guint8 *u1, *u2;
- guint8 *v1, *v2;
- double *by = patchdetect->by;
- double *bu = patchdetect->bu;
- double *bv = patchdetect->bv;
-
- patchdetect->valid--;
- u1 = g_malloc (frame.width);
- u2 = g_malloc (frame.width);
- v1 = g_malloc (frame.width);
- v2 = g_malloc (frame.width);
-
- for (j = 0; j < frame.height; j += 2) {
- for (i = 0; i < frame.width / 2; i++) {
- u1[2 * i + 0] = frame.u[(j / 2) * frame.ustride + i];
- u1[2 * i + 1] = u1[2 * i + 0];
- u2[2 * i + 0] = u1[2 * i + 0];
- u2[2 * i + 1] = u1[2 * i + 0];
- v1[2 * i + 0] = frame.v[(j / 2) * frame.vstride + i];
- v1[2 * i + 1] = v1[2 * i + 0];
- v2[2 * i + 0] = v1[2 * i + 0];
- v2[2 * i + 1] = v1[2 * i + 0];
- }
- for (i = 0; i < frame.width; i++) {
- int k;
- double z[10];
- double cy, cu, cv;
- int y, u, v;
- int py, pu, pv;
-
- y = frame.y[(j + 0) * frame.ystride + i];
- u = u1[i];
- v = v1[i];
-
- py = y - 128;
- pu = u - 128;
- pv = v - 128;
-
- z[0] = 1;
- z[1] = py;
- z[2] = pu;
- z[3] = pv;
- z[4] = py * py;
- z[5] = py * pu;
- z[6] = py * pv;
- z[7] = pu * pu;
- z[8] = pu * pv;
- z[9] = pv * pv;
-
- cy = 0;
- cu = 0;
- cv = 0;
- for (k = 0; k < n; k++) {
- cy += by[k] * z[k];
- cu += bu[k] * z[k];
- cv += bv[k] * z[k];
- }
-
- frame.y[(j + 0) * frame.ystride + i] = CLAMP (rint (y - cy), 0, 255);
- u1[i] = CLAMP (rint (u - cu), 0, 255);
- v1[i] = CLAMP (rint (v - cv), 0, 255);
-
- y = frame.y[(j + 1) * frame.ystride + i];
- u = u2[i];
- v = v2[i];
-
- py = y - 128;
- pu = u - 128;
- pv = v - 128;
-
- z[0] = 1;
- z[1] = py;
- z[2] = pu;
- z[3] = pv;
- z[4] = py * py;
- z[5] = py * pu;
- z[6] = py * pv;
- z[7] = pu * pu;
- z[8] = pu * pv;
- z[9] = pv * pv;
-
- cy = 0;
- cu = 0;
- cv = 0;
- for (k = 0; k < n; k++) {
- cy += by[k] * z[k];
- cu += bu[k] * z[k];
- cv += bv[k] * z[k];
- }
-
- frame.y[(j + 1) * frame.ystride + i] = CLAMP (rint (y - cy), 0, 255);
- u2[i] = CLAMP (rint (u - cu), 0, 255);
- v2[i] = CLAMP (rint (v - cv), 0, 255);
- }
- for (i = 0; i < frame.width / 2; i++) {
- frame.u[(j / 2) * frame.ustride + i] = (u1[2 * i + 0] +
- u1[2 * i + 1] + u2[2 * i + 0] + u2[2 * i + 1] + 2) >> 2;
- frame.v[(j / 2) * frame.vstride + i] = (v1[2 * i + 0] +
- v1[2 * i + 1] + v2[2 * i + 0] + v2[2 * i + 1] + 2) >> 2;
- }
- }
-
- g_free (u1);
- g_free (u2);
- g_free (v1);
- g_free (v2);
- }
-
- g_free (points);
- g_free (patches);
- g_free (patchpix);
-
- return GST_FLOW_OK;
-}
-
-static gboolean
-gst_patchdetect_src_event (GstBaseTransform * trans, GstEvent * event)
-{
-
- return TRUE;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-
- gst_element_register (plugin, "patchdetect", GST_RANK_NONE,
- gst_patchdetect_get_type ());
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- patchdetect,
- "patchdetect element",
- plugin_init, VERSION, "LGPL", PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/patchdetect/gstpatchdetect.h b/gst/patchdetect/gstpatchdetect.h
deleted file mode 100644
index 2ccbcf345..000000000
--- a/gst/patchdetect/gstpatchdetect.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* GStreamer
- * Copyright (C) 2011 David Schleef <ds@entropywave.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _GST_PATCHDETECT_H_
-#define _GST_PATCHDETECT_H_
-
-#include <gst/base/gstbasetransform.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_PATCHDETECT (gst_patchdetect_get_type())
-#define GST_PATCHDETECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PATCHDETECT,GstPatchdetect))
-#define GST_PATCHDETECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PATCHDETECT,GstPatchdetectClass))
-#define GST_IS_PATCHDETECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PATCHDETECT))
-#define GST_IS_PATCHDETECT_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PATCHDETECT))
-
-typedef struct _GstPatchdetect GstPatchdetect;
-typedef struct _GstPatchdetectClass GstPatchdetectClass;
-
-struct _GstPatchdetect
-{
- GstBaseTransform base_patchdetect;
-
- GstVideoFormat format;
- int width;
- int height;
-
- int t;
- int valid;
- double by[10], bu[10], bv[10];
-};
-
-struct _GstPatchdetectClass
-{
- GstBaseTransformClass base_patchdetect_class;
-};
-
-GType gst_patchdetect_get_type (void);
-
-G_END_DECLS
-
-#endif
diff --git a/gst/patchdetect/meson.build b/gst/patchdetect/meson.build
deleted file mode 100644
index 1ee773469..000000000
--- a/gst/patchdetect/meson.build
+++ /dev/null
@@ -1,12 +0,0 @@
-patch_sources = [
- 'gstpatchdetect.c',
-]
-
-gstpatchdetect = library('gstpatchdetect',
- patch_sources,
- c_args : gst_plugins_bad_args,
- include_directories : [configinc],
- dependencies : [gstbase_dep, gstvideo_dep, libm],
- install : true,
- install_dir : plugins_install_dir,
-)
diff --git a/gst/rtjpeg/.gitignore b/gst/rtjpeg/.gitignore
deleted file mode 100644
index 08f5ed37d..000000000
--- a/gst/rtjpeg/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-Makefile
-Makefile.in
-*.o
-*.lo
-*.la
-.deps
-.libs
diff --git a/gst/rtjpeg/Makefile.am b/gst/rtjpeg/Makefile.am
deleted file mode 100644
index d0fcdc38d..000000000
--- a/gst/rtjpeg/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-
-plugin_LTLIBRARIES = libgstrtjpeg.la
-
-libgstrtjpeg_la_SOURCES = gstrtjpeg.c gstrtjpegenc.c gstrtjpegdec.c RTjpeg.c
-libgstrtjpeg_la_CFLAGS = $(GST_CFLAGS)
-libgstrtjpeg_la_LIBADD =
-libgstrtjpeg_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstrtjpeg_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-noinst_HEADERS = gstrtjpegenc.h gstrtjpegdec.h RTjpeg.h
diff --git a/gst/rtjpeg/README b/gst/rtjpeg/README
deleted file mode 100644
index 34796867d..000000000
--- a/gst/rtjpeg/README
+++ /dev/null
@@ -1,12 +0,0 @@
-This plugin contains elements necessary for doing RTjpeg compression and
-decompression, as well as conversion from RGB to YUV and back, based
-entirely on functions supplied by RTjpeg.c.
-
-You can find RTjpeg at Justin Schoeman's site:
-http://www.ee.up.ac.za/~justin/bttv/
-
-The idea is to start out with the code elements reading and writing YUV420
-images, with external elements to do the conversion. Eventually (when
-typing is a bit more sane/globally used) the codec elements will
-automatically convert images to/from the proper format based on what their
-peer wants to be dealing with.
diff --git a/gst/rtjpeg/RTjpeg.c b/gst/rtjpeg/RTjpeg.c
deleted file mode 100644
index e3873542f..000000000
--- a/gst/rtjpeg/RTjpeg.c
+++ /dev/null
@@ -1,3448 +0,0 @@
-/*
- This program is free software; you can redristibute 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 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
- This file is a modified version of RTjpeg 0.1.2, (C) Justin Schoeman 1998
-
- (991101) Wim Taymans : added MMX dct and idct from intels site.
-*/
-
-
-/*
-
-Main Routines
-
-This file contains most of the initialisation and control functions
-
-(C) Justin Schoeman 1998
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-typedef unsigned char __u8;
-typedef signed char __s8;
-typedef unsigned short __u16;
-typedef signed short __s16;
-typedef unsigned long __u32;
-typedef signed long __s32;
-typedef unsigned long long __u64;
-
-/*#define MMX_TRACE */
-
-
-#ifdef HAVE_LIBMMX
-#include "mmx.h"
-#endif
-
-static const unsigned char RTjpeg_ZZ[64] = {
- 0,
- 8, 1,
- 2, 9, 16,
- 24, 17, 10, 3,
- 4, 11, 18, 25, 32,
- 40, 33, 26, 19, 12, 5,
- 6, 13, 20, 27, 34, 41, 48,
- 56, 49, 42, 35, 28, 21, 14, 7,
- 15, 22, 29, 36, 43, 50, 57,
- 58, 51, 44, 37, 30, 23,
- 31, 38, 45, 52, 59,
- 60, 53, 46, 39,
- 47, 54, 61,
- 62, 55,
- 63
-};
-
-static const __u64 RTjpeg_aan_tab[64] = {
- 4294967296ULL, 5957222912ULL, 5611718144ULL, 5050464768ULL, 4294967296ULL,
- 3374581504ULL, 2324432128ULL, 1184891264ULL,
- 5957222912ULL, 8263040512ULL, 7783580160ULL, 7005009920ULL, 5957222912ULL,
- 4680582144ULL, 3224107520ULL, 1643641088ULL,
- 5611718144ULL, 7783580160ULL, 7331904512ULL, 6598688768ULL, 5611718144ULL,
- 4408998912ULL, 3036936960ULL, 1548224000ULL,
- 5050464768ULL, 7005009920ULL, 6598688768ULL, 5938608128ULL, 5050464768ULL,
- 3968072960ULL, 2733115392ULL, 1393296000ULL,
- 4294967296ULL, 5957222912ULL, 5611718144ULL, 5050464768ULL, 4294967296ULL,
- 3374581504ULL, 2324432128ULL, 1184891264ULL,
- 3374581504ULL, 4680582144ULL, 4408998912ULL, 3968072960ULL, 3374581504ULL,
- 2651326208ULL, 1826357504ULL, 931136000ULL,
- 2324432128ULL, 3224107520ULL, 3036936960ULL, 2733115392ULL, 2324432128ULL,
- 1826357504ULL, 1258030336ULL, 641204288ULL,
- 1184891264ULL, 1643641088ULL, 1548224000ULL, 1393296000ULL, 1184891264ULL,
- 931136000ULL, 641204288ULL, 326894240ULL,
-};
-
-#ifndef HAVE_LIBMMX
-static __s32 RTjpeg_ws[64 + 31];
-#endif
-__u8 RTjpeg_alldata[2 * 64 + 4 * 64 + 4 * 64 + 4 * 64 + 4 * 64 + 32];
-
-__s16 *RTjpeg_block;
-__s32 *RTjpeg_lqt;
-__s32 *RTjpeg_cqt;
-__u32 *RTjpeg_liqt;
-__u32 *RTjpeg_ciqt;
-
-unsigned char RTjpeg_lb8;
-unsigned char RTjpeg_cb8;
-int RTjpeg_width, RTjpeg_height;
-int RTjpeg_Ywidth, RTjpeg_Cwidth;
-int RTjpeg_Ysize, RTjpeg_Csize;
-
-__s16 *RTjpeg_old = NULL;
-
-#ifdef HAVE_LIBMMX
-mmx_t RTjpeg_lmask;
-mmx_t RTjpeg_cmask;
-#else
-__u16 RTjpeg_lmask;
-__u16 RTjpeg_cmask;
-#endif
-int RTjpeg_mtest = 0;
-
-static const unsigned char RTjpeg_lum_quant_tbl[64] = {
- 16, 11, 10, 16, 24, 40, 51, 61,
- 12, 12, 14, 19, 26, 58, 60, 55,
- 14, 13, 16, 24, 40, 57, 69, 56,
- 14, 17, 22, 29, 51, 87, 80, 62,
- 18, 22, 37, 56, 68, 109, 103, 77,
- 24, 35, 55, 64, 81, 104, 113, 92,
- 49, 64, 78, 87, 103, 121, 120, 101,
- 72, 92, 95, 98, 112, 100, 103, 99
-};
-
-static const unsigned char RTjpeg_chrom_quant_tbl[64] = {
- 17, 18, 24, 47, 99, 99, 99, 99,
- 18, 21, 26, 66, 99, 99, 99, 99,
- 24, 26, 56, 99, 99, 99, 99, 99,
- 47, 66, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99
-};
-
-int
-RTjpeg_b2s (__s16 * data, __s8 * strm, __u8 bt8)
-{
- register int ci, co = 1, tmp;
- register __s16 ZZvalue;
-
- strm[0] =
- (__u8) (data[RTjpeg_ZZ[0]] > 254) ? 254 : ((data[RTjpeg_ZZ[0]] <
- 0) ? 0 : data[RTjpeg_ZZ[0]]);
-
- for (ci = 1; ci <= bt8; ci++) {
- ZZvalue = data[RTjpeg_ZZ[ci]];
-
- if (ZZvalue > 0) {
- strm[co++] = (__s8) (ZZvalue > 127) ? 127 : ZZvalue;
- } else {
- strm[co++] = (__s8) (ZZvalue < -128) ? -128 : ZZvalue;
- }
- }
-
- for (; ci < 64; ci++) {
- ZZvalue = data[RTjpeg_ZZ[ci]];
-
- if (ZZvalue > 0) {
- strm[co++] = (__s8) (ZZvalue > 63) ? 63 : ZZvalue;
- } else if (ZZvalue < 0) {
- strm[co++] = (__s8) (ZZvalue < -64) ? -64 : ZZvalue;
- } else { /* compress zeros */
-
- tmp = ci;
- do {
- ci++;
- }
- while ((ci < 64) && (data[RTjpeg_ZZ[ci]] == 0));
-
- strm[co++] = (__s8) (63 + (ci - tmp));
- ci--;
- }
- }
- return (int) co;
-}
-
-int
-RTjpeg_s2b (__s16 * data, __s8 * strm, __u8 bt8, __u32 * qtbl)
-{
- int ci = 1, co = 1, tmp;
- register int i;
-
- i = RTjpeg_ZZ[0];
- data[i] = ((__u8) strm[0]) * qtbl[i];
-
- for (co = 1; co <= bt8; co++) {
- i = RTjpeg_ZZ[co];
- data[i] = strm[ci++] * qtbl[i];
- }
-
- for (; co < 64; co++) {
- if (strm[ci] > 63) {
- tmp = co + strm[ci] - 63;
- for (; co < tmp; co++)
- data[RTjpeg_ZZ[co]] = 0;
- co--;
- } else {
- i = RTjpeg_ZZ[co];
- data[i] = strm[ci] * qtbl[i];
- }
- ci++;
- }
- return (int) ci;
-}
-
-#if defined(HAVE_LIBMMX)
-void
-RTjpeg_quant_init (void)
-{
- int i;
- __s16 *qtbl;
-
- qtbl = (__s16 *) RTjpeg_lqt;
- for (i = 0; i < 64; i++)
- qtbl[i] = (__s16) RTjpeg_lqt[i];
-
- qtbl = (__s16 *) RTjpeg_cqt;
- for (i = 0; i < 64; i++)
- qtbl[i] = (__s16) RTjpeg_cqt[i];
-}
-
-static mmx_t RTjpeg_ones = (mmx_t) (long long) 0x0001000100010001LL;
-static mmx_t RTjpeg_half = (mmx_t) (long long) 0x7fff7fff7fff7fffLL;
-
-void
-RTjpeg_quant (__s16 * block, __s32 * qtbl)
-{
- int i;
- mmx_t *bl, *ql;
-
- ql = (mmx_t *) qtbl;
- bl = (mmx_t *) block;
-
- movq_m2r (RTjpeg_ones, mm6);
- movq_m2r (RTjpeg_half, mm7);
-
- for (i = 16; i; i--) {
- movq_m2r (*(ql++), mm0); /* quant vals (4) */
- movq_m2r (*bl, mm2); /* block vals (4) */
- movq_r2r (mm0, mm1);
- movq_r2r (mm2, mm3);
-
- punpcklwd_r2r (mm6, mm0); /* 1 qb 1 qa */
- punpckhwd_r2r (mm6, mm1); /* 1 qd 1 qc */
-
- punpcklwd_r2r (mm7, mm2); /* 32767 bb 32767 ba */
- punpckhwd_r2r (mm7, mm3); /* 32767 bd 32767 bc */
-
- pmaddwd_r2r (mm2, mm0); /* 32767+bb*qb 32767+ba*qa */
- pmaddwd_r2r (mm3, mm1); /* 32767+bd*qd 32767+bc*qc */
-
- psrad_i2r (16, mm0);
- psrad_i2r (16, mm1);
-
- packssdw_r2r (mm1, mm0);
-
- movq_r2m (mm0, *(bl++));
-
- }
-}
-#else
-void
-RTjpeg_quant_init (void)
-{
-}
-
-void
-RTjpeg_quant (__s16 * block, __s32 * qtbl)
-{
- int i;
-
- for (i = 0; i < 64; i++)
- block[i] = (__s16) ((block[i] * qtbl[i] + 32767) >> 16);
-}
-#endif
-
-/*
- * Perform the forward DCT on one block of samples.
- */
-#ifdef HAVE_LIBMMX
-static mmx_t RTjpeg_C4 = (mmx_t) (long long) 0x2D412D412D412D41LL;
-static mmx_t RTjpeg_C6 = (mmx_t) (long long) 0x187E187E187E187ELL;
-static mmx_t RTjpeg_C2mC6 = (mmx_t) (long long) 0x22A322A322A322A3LL;
-static mmx_t RTjpeg_C2pC6 = (mmx_t) (long long) 0x539F539F539F539FLL;
-static mmx_t RTjpeg_zero = (mmx_t) (long long) 0x0000000000000000LL;
-
-#else
-
-#define FIX_0_382683433 ((__s32) 98) /* FIX(0.382683433) */
-#define FIX_0_541196100 ((__s32) 139) /* FIX(0.541196100) */
-#define FIX_0_707106781 ((__s32) 181) /* FIX(0.707106781) */
-#define FIX_1_306562965 ((__s32) 334) /* FIX(1.306562965) */
-
-#define DESCALE10(x) (__s16)( ((x)+128) >> 8)
-#define DESCALE20(x) (__s16)(((x)+32768) >> 16)
-#define D_MULTIPLY(var,const) ((__s32) ((var) * (const)))
-#endif
-
-void
-RTjpeg_dct_init (void)
-{
- int i;
-
- for (i = 0; i < 64; i++) {
- RTjpeg_lqt[i] = (((__u64) RTjpeg_lqt[i] << 32) / RTjpeg_aan_tab[i]);
- RTjpeg_cqt[i] = (((__u64) RTjpeg_cqt[i] << 32) / RTjpeg_aan_tab[i]);
- }
-}
-
-void
-RTjpeg_dctY (__u8 * idata, __s16 * odata, int rskip)
-{
-#ifndef HAVE_LIBMMX
- __s32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- __s32 tmp10, tmp11, tmp12, tmp13;
- __s32 z1, z2, z3, z4, z5, z11, z13;
- __u8 *idataptr;
- __s16 *odataptr;
- __s32 *wsptr;
- int ctr;
-
- idataptr = idata;
- wsptr = RTjpeg_ws;
- for (ctr = 7; ctr >= 0; ctr--) {
- tmp0 = idataptr[0] + idataptr[7];
- tmp7 = idataptr[0] - idataptr[7];
- tmp1 = idataptr[1] + idataptr[6];
- tmp6 = idataptr[1] - idataptr[6];
- tmp2 = idataptr[2] + idataptr[5];
- tmp5 = idataptr[2] - idataptr[5];
- tmp3 = idataptr[3] + idataptr[4];
- tmp4 = idataptr[3] - idataptr[4];
-
- tmp10 = (tmp0 + tmp3); /* phase 2 */
- tmp13 = tmp0 - tmp3;
- tmp11 = (tmp1 + tmp2);
- tmp12 = tmp1 - tmp2;
-
- wsptr[0] = (tmp10 + tmp11) << 8; /* phase 3 */
- wsptr[4] = (tmp10 - tmp11) << 8;
-
- z1 = D_MULTIPLY (tmp12 + tmp13, FIX_0_707106781); /* c4 */
- wsptr[2] = (tmp13 << 8) + z1; /* phase 5 */
- wsptr[6] = (tmp13 << 8) - z1;
-
- tmp10 = tmp4 + tmp5; /* phase 2 */
- tmp11 = tmp5 + tmp6;
- tmp12 = tmp6 + tmp7;
-
- z5 = D_MULTIPLY (tmp10 - tmp12, FIX_0_382683433); /* c6 */
- z2 = D_MULTIPLY (tmp10, FIX_0_541196100) + z5; /* c2-c6 */
- z4 = D_MULTIPLY (tmp12, FIX_1_306562965) + z5; /* c2+c6 */
- z3 = D_MULTIPLY (tmp11, FIX_0_707106781); /* c4 */
-
- z11 = (tmp7 << 8) + z3; /* phase 5 */
- z13 = (tmp7 << 8) - z3;
-
- wsptr[5] = z13 + z2; /* phase 6 */
- wsptr[3] = z13 - z2;
- wsptr[1] = z11 + z4;
- wsptr[7] = z11 - z4;
-
- idataptr += rskip << 3; /* advance pointer to next row */
- wsptr += 8;
- }
-
- wsptr = RTjpeg_ws;
- odataptr = odata;
- for (ctr = 7; ctr >= 0; ctr--) {
- tmp0 = wsptr[0] + wsptr[56];
- tmp7 = wsptr[0] - wsptr[56];
- tmp1 = wsptr[8] + wsptr[48];
- tmp6 = wsptr[8] - wsptr[48];
- tmp2 = wsptr[16] + wsptr[40];
- tmp5 = wsptr[16] - wsptr[40];
- tmp3 = wsptr[24] + wsptr[32];
- tmp4 = wsptr[24] - wsptr[32];
-
- tmp10 = tmp0 + tmp3; /* phase 2 */
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
-
- odataptr[0] = DESCALE10 (tmp10 + tmp11); /* phase 3 */
- odataptr[32] = DESCALE10 (tmp10 - tmp11);
-
- z1 = D_MULTIPLY (tmp12 + tmp13, FIX_0_707106781); /* c4 */
- odataptr[16] = DESCALE20 ((tmp13 << 8) + z1); /* phase 5 */
- odataptr[48] = DESCALE20 ((tmp13 << 8) - z1);
-
- tmp10 = tmp4 + tmp5; /* phase 2 */
- tmp11 = tmp5 + tmp6;
- tmp12 = tmp6 + tmp7;
-
- z5 = D_MULTIPLY (tmp10 - tmp12, FIX_0_382683433); /* c6 */
- z2 = D_MULTIPLY (tmp10, FIX_0_541196100) + z5; /* c2-c6 */
- z4 = D_MULTIPLY (tmp12, FIX_1_306562965) + z5; /* c2+c6 */
- z3 = D_MULTIPLY (tmp11, FIX_0_707106781); /* c4 */
-
- z11 = (tmp7 << 8) + z3; /* phase 5 */
- z13 = (tmp7 << 8) - z3;
-
- odataptr[40] = DESCALE20 (z13 + z2); /* phase 6 */
- odataptr[24] = DESCALE20 (z13 - z2);
- odataptr[8] = DESCALE20 (z11 + z4);
- odataptr[56] = DESCALE20 (z11 - z4);
-
- odataptr++; /* advance pointer to next column */
- wsptr++;
- }
-#else
- mmx_t tmp6, tmp7;
- register mmx_t *dataptr = (mmx_t *) odata;
- mmx_t *idata2 = (mmx_t *) idata;
-
- /* first copy the input 8 bit to the destination 16 bits */
-
- movq_m2r (RTjpeg_zero, mm2);
-
-
- movq_m2r (*idata2, mm0);
- movq_r2r (mm0, mm1);
-
- punpcklbw_r2r (mm2, mm0);
- movq_r2m (mm0, *(dataptr));
-
- punpckhbw_r2r (mm2, mm1);
- movq_r2m (mm1, *(dataptr + 1));
-
- idata2 += rskip;
-
- movq_m2r (*idata2, mm0);
- movq_r2r (mm0, mm1);
-
- punpcklbw_r2r (mm2, mm0);
- movq_r2m (mm0, *(dataptr + 2));
-
- punpckhbw_r2r (mm2, mm1);
- movq_r2m (mm1, *(dataptr + 3));
-
- idata2 += rskip;
-
- movq_m2r (*idata2, mm0);
- movq_r2r (mm0, mm1);
-
- punpcklbw_r2r (mm2, mm0);
- movq_r2m (mm0, *(dataptr + 4));
-
- punpckhbw_r2r (mm2, mm1);
- movq_r2m (mm1, *(dataptr + 5));
-
- idata2 += rskip;
-
- movq_m2r (*idata2, mm0);
- movq_r2r (mm0, mm1);
-
- punpcklbw_r2r (mm2, mm0);
- movq_r2m (mm0, *(dataptr + 6));
-
- punpckhbw_r2r (mm2, mm1);
- movq_r2m (mm1, *(dataptr + 7));
-
- idata2 += rskip;
-
- movq_m2r (*idata2, mm0);
- movq_r2r (mm0, mm1);
-
- punpcklbw_r2r (mm2, mm0);
- movq_r2m (mm0, *(dataptr + 8));
-
- punpckhbw_r2r (mm2, mm1);
- movq_r2m (mm1, *(dataptr + 9));
-
- idata2 += rskip;
-
- movq_m2r (*idata2, mm0);
- movq_r2r (mm0, mm1);
-
- punpcklbw_r2r (mm2, mm0);
- movq_r2m (mm0, *(dataptr + 10));
-
- punpckhbw_r2r (mm2, mm1);
- movq_r2m (mm1, *(dataptr + 11));
-
- idata2 += rskip;
-
- movq_m2r (*idata2, mm0);
- movq_r2r (mm0, mm1);
-
- punpcklbw_r2r (mm2, mm0);
- movq_r2m (mm0, *(dataptr + 12));
-
- punpckhbw_r2r (mm2, mm1);
- movq_r2m (mm1, *(dataptr + 13));
-
- idata2 += rskip;
-
- movq_m2r (*idata2, mm0);
- movq_r2r (mm0, mm1);
-
- punpcklbw_r2r (mm2, mm0);
- movq_r2m (mm0, *(dataptr + 14));
-
- punpckhbw_r2r (mm2, mm1);
- movq_r2m (mm1, *(dataptr + 15));
-
-/* Start Transpose to do calculations on rows */
-
- movq_m2r (*(dataptr + 9), mm7); /* m03:m02|m01:m00 - first line (line 4)and copy into m5 */
-
- movq_m2r (*(dataptr + 13), mm6); /* m23:m22|m21:m20 - third line (line 6)and copy into m2 */
- movq_r2r (mm7, mm5);
-
- punpcklwd_m2r (*(dataptr + 11), mm7); /* m11:m01|m10:m00 - interleave first and second lines */
- movq_r2r (mm6, mm2);
-
- punpcklwd_m2r (*(dataptr + 15), mm6); /* m31:m21|m30:m20 - interleave third and fourth lines */
- movq_r2r (mm7, mm1);
-
- movq_m2r (*(dataptr + 11), mm3); /* m13:m13|m11:m10 - second line */
- punpckldq_r2r (mm6, mm7); /* m30:m20|m10:m00 - interleave to produce result 1 */
-
- movq_m2r (*(dataptr + 15), mm0); /* m13:m13|m11:m10 - fourth line */
- punpckhdq_r2r (mm6, mm1); /* m31:m21|m11:m01 - interleave to produce result 2 */
-
- movq_r2m (mm7, *(dataptr + 9)); /* write result 1 */
- punpckhwd_r2r (mm3, mm5); /* m13:m03|m12:m02 - interleave first and second lines */
-
- movq_r2m (mm1, *(dataptr + 11)); /* write result 2 */
- punpckhwd_r2r (mm0, mm2); /* m33:m23|m32:m22 - interleave third and fourth lines */
-
- movq_r2r (mm5, mm1);
- punpckldq_r2r (mm2, mm5); /* m32:m22|m12:m02 - interleave to produce result 3 */
-
- movq_m2r (*(dataptr + 1), mm0); /* m03:m02|m01:m00 - first line, 4x4 */
- punpckhdq_r2r (mm2, mm1); /* m33:m23|m13:m03 - interleave to produce result 4 */
-
- movq_r2m (mm5, *(dataptr + 13)); /* write result 3 */
-
- /* last 4x4 done */
-
- movq_r2m (mm1, *(dataptr + 15)); /* write result 4, last 4x4 */
-
- movq_m2r (*(dataptr + 5), mm2); /* m23:m22|m21:m20 - third line */
- movq_r2r (mm0, mm6);
-
- punpcklwd_m2r (*(dataptr + 3), mm0); /* m11:m01|m10:m00 - interleave first and second lines */
- movq_r2r (mm2, mm7);
-
- punpcklwd_m2r (*(dataptr + 7), mm2); /* m31:m21|m30:m20 - interleave third and fourth lines */
- movq_r2r (mm0, mm4);
-
-
- movq_m2r (*(dataptr + 8), mm1); /* n03:n02|n01:n00 - first line */
- punpckldq_r2r (mm2, mm0); /* m30:m20|m10:m00 - interleave to produce first result */
-
- movq_m2r (*(dataptr + 12), mm3); /* n23:n22|n21:n20 - third line */
- punpckhdq_r2r (mm2, mm4); /* m31:m21|m11:m01 - interleave to produce second result */
-
- punpckhwd_m2r (*(dataptr + 3), mm6); /* m13:m03|m12:m02 - interleave first and second lines */
- movq_r2r (mm1, mm2); /* copy first line */
-
- punpckhwd_m2r (*(dataptr + 7), mm7); /* m33:m23|m32:m22 - interleave third and fourth lines */
- movq_r2r (mm6, mm5); /* copy first intermediate result */
-
- movq_r2m (mm0, *(dataptr + 8)); /* write result 1 */
- punpckhdq_r2r (mm7, mm5); /* m33:m23|m13:m03 - produce third result */
-
- punpcklwd_m2r (*(dataptr + 10), mm1); /* n11:n01|n10:n00 - interleave first and second lines */
- movq_r2r (mm3, mm0); /* copy third line */
-
- punpckhwd_m2r (*(dataptr + 10), mm2); /* n13:n03|n12:n02 - interleave first and second lines */
-
- movq_r2m (mm4, *(dataptr + 10)); /* write result 2 out */
- punpckldq_r2r (mm7, mm6); /* m32:m22|m12:m02 - produce fourth result */
-
- punpcklwd_m2r (*(dataptr + 14), mm3); /* n31:n21|n30:n20 - interleave third and fourth lines */
- movq_r2r (mm1, mm4);
-
- movq_r2m (mm6, *(dataptr + 12)); /* write result 3 out */
- punpckldq_r2r (mm3, mm1); /* n30:n20|n10:n00 - produce first result */
-
- punpckhwd_m2r (*(dataptr + 14), mm0); /* n33:n23|n32:n22 - interleave third and fourth lines */
- movq_r2r (mm2, mm6);
-
- movq_r2m (mm5, *(dataptr + 14)); /* write result 4 out */
- punpckhdq_r2r (mm3, mm4); /* n31:n21|n11:n01- produce second result */
-
- movq_r2m (mm1, *(dataptr + 1)); /* write result 5 out - (first result for other 4 x 4 block) */
- punpckldq_r2r (mm0, mm2); /* n32:n22|n12:n02- produce third result */
-
- movq_r2m (mm4, *(dataptr + 3)); /* write result 6 out */
- punpckhdq_r2r (mm0, mm6); /* n33:n23|n13:n03 - produce fourth result */
-
- movq_r2m (mm2, *(dataptr + 5)); /* write result 7 out */
-
- movq_m2r (*dataptr, mm0); /* m03:m02|m01:m00 - first line, first 4x4 */
-
- movq_r2m (mm6, *(dataptr + 7)); /* write result 8 out */
-
-
-/* Do first 4x4 quadrant, which is used in the beginning of the DCT: */
-
- movq_m2r (*(dataptr + 4), mm7); /* m23:m22|m21:m20 - third line */
- movq_r2r (mm0, mm2);
-
- punpcklwd_m2r (*(dataptr + 2), mm0); /* m11:m01|m10:m00 - interleave first and second lines */
- movq_r2r (mm7, mm4);
-
- punpcklwd_m2r (*(dataptr + 6), mm7); /* m31:m21|m30:m20 - interleave third and fourth lines */
- movq_r2r (mm0, mm1);
-
- movq_m2r (*(dataptr + 2), mm6); /* m13:m12|m11:m10 - second line */
- punpckldq_r2r (mm7, mm0); /* m30:m20|m10:m00 - interleave to produce result 1 */
-
- movq_m2r (*(dataptr + 6), mm5); /* m33:m32|m31:m30 - fourth line */
- punpckhdq_r2r (mm7, mm1); /* m31:m21|m11:m01 - interleave to produce result 2 */
-
- movq_r2r (mm0, mm7); /* write result 1 */
- punpckhwd_r2r (mm6, mm2); /* m13:m03|m12:m02 - interleave first and second lines */
-
- psubw_m2r (*(dataptr + 14), mm7); /* tmp07=x0-x7: Stage 1 */
- movq_r2r (mm1, mm6); /* write result 2 */
-
- paddw_m2r (*(dataptr + 14), mm0); /* tmp00=x0+x7: Stage 1 */
- punpckhwd_r2r (mm5, mm4); /* m33:m23|m32:m22 - interleave third and fourth lines */
-
- paddw_m2r (*(dataptr + 12), mm1); /* tmp01=x1+x6: Stage 1 */
- movq_r2r (mm2, mm3); /* copy first intermediate result */
-
- psubw_m2r (*(dataptr + 12), mm6); /* tmp06=x1-x6: Stage 1 */
- punpckldq_r2r (mm4, mm2); /* m32:m22|m12:m02 - interleave to produce result 3 */
-
- movq_r2m (mm7, tmp7);
- movq_r2r (mm2, mm5); /* write result 3 */
-
- movq_r2m (mm6, tmp6);
- punpckhdq_r2r (mm4, mm3); /* m33:m23|m13:m03 - interleave to produce result 4 */
-
- paddw_m2r (*(dataptr + 10), mm2); /* tmp02=x2+5: Stage 1 */
- movq_r2r (mm3, mm4); /* write result 4 */
-
-/************************************************************************************************
- End of Transpose
-************************************************************************************************/
-
-
- paddw_m2r (*(dataptr + 8), mm3); /* tmp03=x3+x4: stage 1 */
- movq_r2r (mm0, mm7);
-
- psubw_m2r (*(dataptr + 8), mm4); /* tmp04=x3-x4: stage 1 */
- movq_r2r (mm1, mm6);
-
- paddw_r2r (mm3, mm0); /* tmp10 = tmp00 + tmp03: even 2 */
- psubw_r2r (mm3, mm7); /* tmp13 = tmp00 - tmp03: even 2 */
-
- psubw_r2r (mm2, mm6); /* tmp12 = tmp01 - tmp02: even 2 */
- paddw_r2r (mm2, mm1); /* tmp11 = tmp01 + tmp02: even 2 */
-
- psubw_m2r (*(dataptr + 10), mm5); /* tmp05=x2-x5: stage 1 */
- paddw_r2r (mm7, mm6); /* tmp12 + tmp13 */
-
- /* stage 3 */
-
- movq_m2r (tmp6, mm2);
- movq_r2r (mm0, mm3);
-
- psllw_i2r (2, mm6); /* m8 * 2^2 */
- paddw_r2r (mm1, mm0);
-
- pmulhw_m2r (RTjpeg_C4, mm6); /* z1 */
- psubw_r2r (mm1, mm3);
-
- movq_r2m (mm0, *dataptr);
- movq_r2r (mm7, mm0);
-
- /* Odd part */
- movq_r2m (mm3, *(dataptr + 8));
- paddw_r2r (mm5, mm4); /* tmp10 */
-
- movq_m2r (tmp7, mm3);
- paddw_r2r (mm6, mm0); /* tmp32 */
-
- paddw_r2r (mm2, mm5); /* tmp11 */
- psubw_r2r (mm6, mm7); /* tmp33 */
-
- movq_r2m (mm0, *(dataptr + 4));
- paddw_r2r (mm3, mm2); /* tmp12 */
-
- /* stage 4 */
-
- movq_r2m (mm7, *(dataptr + 12));
- movq_r2r (mm4, mm1); /* copy of tmp10 */
-
- psubw_r2r (mm2, mm1); /* tmp10 - tmp12 */
- psllw_i2r (2, mm4); /* m8 * 2^2 */
-
- movq_m2r (RTjpeg_C2mC6, mm0);
- psllw_i2r (2, mm1);
-
- pmulhw_m2r (RTjpeg_C6, mm1); /* z5 */
- psllw_i2r (2, mm2);
-
- pmulhw_r2r (mm0, mm4); /* z5 */
-
- /* stage 5 */
-
- pmulhw_m2r (RTjpeg_C2pC6, mm2);
- psllw_i2r (2, mm5);
-
- pmulhw_m2r (RTjpeg_C4, mm5); /* z3 */
- movq_r2r (mm3, mm0); /* copy tmp7 */
-
- movq_m2r (*(dataptr + 1), mm7);
- paddw_r2r (mm1, mm4); /* z2 */
-
- paddw_r2r (mm1, mm2); /* z4 */
-
- paddw_r2r (mm5, mm0); /* z11 */
- psubw_r2r (mm5, mm3); /* z13 */
-
- /* stage 6 */
-
- movq_r2r (mm3, mm5); /* copy z13 */
- psubw_r2r (mm4, mm3); /* y3=z13 - z2 */
-
- paddw_r2r (mm4, mm5); /* y5=z13 + z2 */
- movq_r2r (mm0, mm6); /* copy z11 */
-
- movq_r2m (mm3, *(dataptr + 6)); /*save y3 */
- psubw_r2r (mm2, mm0); /* y7=z11 - z4 */
-
- movq_r2m (mm5, *(dataptr + 10)); /*save y5 */
- paddw_r2r (mm2, mm6); /* y1=z11 + z4 */
-
- movq_r2m (mm0, *(dataptr + 14)); /*save y7 */
-
- /************************************************
- * End of 1st 4 rows
- ************************************************/
-
- movq_m2r (*(dataptr + 3), mm1); /* load x1: stage 1 */
- movq_r2r (mm7, mm0); /* copy x0 */
-
- movq_r2m (mm6, *(dataptr + 2)); /*save y1 */
-
- movq_m2r (*(dataptr + 5), mm2); /* load x2: stage 1 */
- movq_r2r (mm1, mm6); /* copy x1 */
-
- paddw_m2r (*(dataptr + 15), mm0); /* tmp00 = x0 + x7 */
-
- movq_m2r (*(dataptr + 7), mm3); /* load x3 : stage 1 */
- movq_r2r (mm2, mm5); /* copy x2 */
-
- psubw_m2r (*(dataptr + 15), mm7); /* tmp07 = x0 - x7 */
- movq_r2r (mm3, mm4); /* copy x3 */
-
- paddw_m2r (*(dataptr + 13), mm1); /* tmp01 = x1 + x6 */
-
- movq_r2m (mm7, tmp7); /* save tmp07 */
- movq_r2r (mm0, mm7); /* copy tmp00 */
-
- psubw_m2r (*(dataptr + 13), mm6); /* tmp06 = x1 - x6 */
-
- /* stage 2, Even Part */
-
- paddw_m2r (*(dataptr + 9), mm3); /* tmp03 = x3 + x4 */
-
- movq_r2m (mm6, tmp6); /* save tmp07 */
- movq_r2r (mm1, mm6); /* copy tmp01 */
-
- paddw_m2r (*(dataptr + 11), mm2); /* tmp02 = x2 + x5 */
- paddw_r2r (mm3, mm0); /* tmp10 = tmp00 + tmp03 */
-
- psubw_r2r (mm3, mm7); /* tmp13 = tmp00 - tmp03 */
-
- psubw_m2r (*(dataptr + 9), mm4); /* tmp04 = x3 - x4 */
- psubw_r2r (mm2, mm6); /* tmp12 = tmp01 - tmp02 */
-
- paddw_r2r (mm2, mm1); /* tmp11 = tmp01 + tmp02 */
-
- psubw_m2r (*(dataptr + 11), mm5); /* tmp05 = x2 - x5 */
- paddw_r2r (mm7, mm6); /* tmp12 + tmp13 */
-
- /* stage 3, Even and stage 4 & 5 even */
-
- movq_m2r (tmp6, mm2); /* load tmp6 */
- movq_r2r (mm0, mm3); /* copy tmp10 */
-
- psllw_i2r (2, mm6); /* shift z1 */
- paddw_r2r (mm1, mm0); /* y0=tmp10 + tmp11 */
-
- pmulhw_m2r (RTjpeg_C4, mm6); /* z1 */
- psubw_r2r (mm1, mm3); /* y4=tmp10 - tmp11 */
-
- movq_r2m (mm0, *(dataptr + 1)); /*save y0 */
- movq_r2r (mm7, mm0); /* copy tmp13 */
-
- /* odd part */
-
- movq_r2m (mm3, *(dataptr + 9)); /*save y4 */
- paddw_r2r (mm5, mm4); /* tmp10 = tmp4 + tmp5 */
-
- movq_m2r (tmp7, mm3); /* load tmp7 */
- paddw_r2r (mm6, mm0); /* tmp32 = tmp13 + z1 */
-
- paddw_r2r (mm2, mm5); /* tmp11 = tmp5 + tmp6 */
- psubw_r2r (mm6, mm7); /* tmp33 = tmp13 - z1 */
-
- movq_r2m (mm0, *(dataptr + 5)); /*save y2 */
- paddw_r2r (mm3, mm2); /* tmp12 = tmp6 + tmp7 */
-
- /* stage 4 */
-
- movq_r2m (mm7, *(dataptr + 13)); /*save y6 */
- movq_r2r (mm4, mm1); /* copy tmp10 */
-
- psubw_r2r (mm2, mm1); /* tmp10 - tmp12 */
- psllw_i2r (2, mm4); /* shift tmp10 */
-
- movq_m2r (RTjpeg_C2mC6, mm0); /* load C2mC6 */
- psllw_i2r (2, mm1); /* shift (tmp10-tmp12) */
-
- pmulhw_m2r (RTjpeg_C6, mm1); /* z5 */
- psllw_i2r (2, mm5); /* prepare for multiply */
-
- pmulhw_r2r (mm0, mm4); /* multiply by converted real */
-
- /* stage 5 */
-
- pmulhw_m2r (RTjpeg_C4, mm5); /* z3 */
- psllw_i2r (2, mm2); /* prepare for multiply */
-
- pmulhw_m2r (RTjpeg_C2pC6, mm2); /* multiply */
- movq_r2r (mm3, mm0); /* copy tmp7 */
-
- movq_m2r (*(dataptr + 9), mm7); /* m03:m02|m01:m00 - first line (line 4)and copy into mm7 */
- paddw_r2r (mm1, mm4); /* z2 */
-
- paddw_r2r (mm5, mm0); /* z11 */
- psubw_r2r (mm5, mm3); /* z13 */
-
- /* stage 6 */
-
- movq_r2r (mm3, mm5); /* copy z13 */
- paddw_r2r (mm1, mm2); /* z4 */
-
- movq_r2r (mm0, mm6); /* copy z11 */
- psubw_r2r (mm4, mm5); /* y3 */
-
- paddw_r2r (mm2, mm6); /* y1 */
- paddw_r2r (mm4, mm3); /* y5 */
-
- movq_r2m (mm5, *(dataptr + 7)); /*save y3 */
-
- movq_r2m (mm6, *(dataptr + 3)); /*save y1 */
- psubw_r2r (mm2, mm0); /* y7 */
-
-/************************************************************************************************
- Start of Transpose
-************************************************************************************************/
-
- movq_m2r (*(dataptr + 13), mm6); /* m23:m22|m21:m20 - third line (line 6)and copy into m2 */
- movq_r2r (mm7, mm5); /* copy first line */
-
- punpcklwd_r2r (mm3, mm7); /* m11:m01|m10:m00 - interleave first and second lines */
- movq_r2r (mm6, mm2); /* copy third line */
-
- punpcklwd_r2r (mm0, mm6); /* m31:m21|m30:m20 - interleave third and fourth lines */
- movq_r2r (mm7, mm1); /* copy first intermediate result */
-
- punpckldq_r2r (mm6, mm7); /* m30:m20|m10:m00 - interleave to produce result 1 */
-
- punpckhdq_r2r (mm6, mm1); /* m31:m21|m11:m01 - interleave to produce result 2 */
-
- movq_r2m (mm7, *(dataptr + 9)); /* write result 1 */
- punpckhwd_r2r (mm3, mm5); /* m13:m03|m12:m02 - interleave first and second lines */
-
- movq_r2m (mm1, *(dataptr + 11)); /* write result 2 */
- punpckhwd_r2r (mm0, mm2); /* m33:m23|m32:m22 - interleave third and fourth lines */
-
- movq_r2r (mm5, mm1); /* copy first intermediate result */
- punpckldq_r2r (mm2, mm5); /* m32:m22|m12:m02 - interleave to produce result 3 */
-
- movq_m2r (*(dataptr + 1), mm0); /* m03:m02|m01:m00 - first line, 4x4 */
- punpckhdq_r2r (mm2, mm1); /* m33:m23|m13:m03 - interleave to produce result 4 */
-
- movq_r2m (mm5, *(dataptr + 13)); /* write result 3 */
-
- /****** last 4x4 done */
-
- movq_r2m (mm1, *(dataptr + 15)); /* write result 4, last 4x4 */
-
- movq_m2r (*(dataptr + 5), mm2); /* m23:m22|m21:m20 - third line */
- movq_r2r (mm0, mm6); /* copy first line */
-
- punpcklwd_m2r (*(dataptr + 3), mm0); /* m11:m01|m10:m00 - interleave first and second lines */
- movq_r2r (mm2, mm7); /* copy third line */
-
- punpcklwd_m2r (*(dataptr + 7), mm2); /* m31:m21|m30:m20 - interleave third and fourth lines */
- movq_r2r (mm0, mm4); /* copy first intermediate result */
-
-
-
- movq_m2r (*(dataptr + 8), mm1); /* n03:n02|n01:n00 - first line */
- punpckldq_r2r (mm2, mm0); /* m30:m20|m10:m00 - interleave to produce first result */
-
- movq_m2r (*(dataptr + 12), mm3); /* n23:n22|n21:n20 - third line */
- punpckhdq_r2r (mm2, mm4); /* m31:m21|m11:m01 - interleave to produce second result */
-
- punpckhwd_m2r (*(dataptr + 3), mm6); /* m13:m03|m12:m02 - interleave first and second lines */
- movq_r2r (mm1, mm2); /* copy first line */
-
- punpckhwd_m2r (*(dataptr + 7), mm7); /* m33:m23|m32:m22 - interleave third and fourth lines */
- movq_r2r (mm6, mm5); /* copy first intermediate result */
-
- movq_r2m (mm0, *(dataptr + 8)); /* write result 1 */
- punpckhdq_r2r (mm7, mm5); /* m33:m23|m13:m03 - produce third result */
-
- punpcklwd_m2r (*(dataptr + 10), mm1); /* n11:n01|n10:n00 - interleave first and second lines */
- movq_r2r (mm3, mm0); /* copy third line */
-
- punpckhwd_m2r (*(dataptr + 10), mm2); /* n13:n03|n12:n02 - interleave first and second lines */
-
- movq_r2m (mm4, *(dataptr + 10)); /* write result 2 out */
- punpckldq_r2r (mm7, mm6); /* m32:m22|m12:m02 - produce fourth result */
-
- punpcklwd_m2r (*(dataptr + 14), mm3); /* n33:n23|n32:n22 - interleave third and fourth lines */
- movq_r2r (mm1, mm4); /* copy second intermediate result */
-
- movq_r2m (mm6, *(dataptr + 12)); /* write result 3 out */
- punpckldq_r2r (mm3, mm1); /* */
-
- punpckhwd_m2r (*(dataptr + 14), mm0); /* n33:n23|n32:n22 - interleave third and fourth lines */
- movq_r2r (mm2, mm6); /* copy second intermediate result */
-
- movq_r2m (mm5, *(dataptr + 14)); /* write result 4 out */
- punpckhdq_r2r (mm3, mm4); /* n31:n21|n11:n01- produce second result */
-
- movq_r2m (mm1, *(dataptr + 1)); /* write result 5 out - (first result for other 4 x 4 block) */
- punpckldq_r2r (mm0, mm2); /* n32:n22|n12:n02- produce third result */
-
- movq_r2m (mm4, *(dataptr + 3)); /* write result 6 out */
- punpckhdq_r2r (mm0, mm6); /* n33:n23|n13:n03 - produce fourth result */
-
- movq_r2m (mm2, *(dataptr + 5)); /* write result 7 out */
-
- movq_m2r (*dataptr, mm0); /* m03:m02|m01:m00 - first line, first 4x4 */
-
- movq_r2m (mm6, *(dataptr + 7)); /* write result 8 out */
-
-/* Do first 4x4 quadrant, which is used in the beginning of the DCT: */
-
- movq_m2r (*(dataptr + 4), mm7); /* m23:m22|m21:m20 - third line */
- movq_r2r (mm0, mm2); /* copy first line */
-
- punpcklwd_m2r (*(dataptr + 2), mm0); /* m11:m01|m10:m00 - interleave first and second lines */
- movq_r2r (mm7, mm4); /* copy third line */
-
- punpcklwd_m2r (*(dataptr + 6), mm7); /* m31:m21|m30:m20 - interleave third and fourth lines */
- movq_r2r (mm0, mm1); /* copy first intermediate result */
-
- movq_m2r (*(dataptr + 2), mm6); /* m13:m12|m11:m10 - second line */
- punpckldq_r2r (mm7, mm0); /* m30:m20|m10:m00 - interleave to produce result 1 */
-
- movq_m2r (*(dataptr + 6), mm5); /* m33:m32|m31:m30 - fourth line */
- punpckhdq_r2r (mm7, mm1); /* m31:m21|m11:m01 - interleave to produce result 2 */
-
- movq_r2r (mm0, mm7); /* write result 1 */
- punpckhwd_r2r (mm6, mm2); /* m13:m03|m12:m02 - interleave first and second lines */
-
- psubw_m2r (*(dataptr + 14), mm7); /* tmp07=x0-x7: Stage 1 */
- movq_r2r (mm1, mm6); /* write result 2 */
-
- paddw_m2r (*(dataptr + 14), mm0); /* tmp00=x0+x7: Stage 1 */
- punpckhwd_r2r (mm5, mm4); /* m33:m23|m32:m22 - interleave third and fourth lines */
-
- paddw_m2r (*(dataptr + 12), mm1); /* tmp01=x1+x6: Stage 1 */
- movq_r2r (mm2, mm3); /* copy first intermediate result */
-
- psubw_m2r (*(dataptr + 12), mm6); /* tmp06=x1-x6: Stage 1 */
- punpckldq_r2r (mm4, mm2); /* m32:m22|m12:m02 - interleave to produce result 3 */
-
- movq_r2m (mm7, tmp7); /* save tmp07 */
- movq_r2r (mm2, mm5); /* write result 3 */
-
- movq_r2m (mm6, tmp6); /* save tmp06 */
-
- punpckhdq_r2r (mm4, mm3); /* m33:m23|m13:m03 - interleave to produce result 4 */
-
- paddw_m2r (*(dataptr + 10), mm2); /* tmp02=x2+x5: stage 1 */
- movq_r2r (mm3, mm4); /* write result 4 */
-
-/************************************************************************************************
- End of Transpose 2
-************************************************************************************************/
-
- paddw_m2r (*(dataptr + 8), mm3); /* tmp03=x3+x4: stage 1 */
- movq_r2r (mm0, mm7);
-
- psubw_m2r (*(dataptr + 8), mm4); /* tmp04=x3-x4: stage 1 */
- movq_r2r (mm1, mm6);
-
- paddw_r2r (mm3, mm0); /* tmp10 = tmp00 + tmp03: even 2 */
- psubw_r2r (mm3, mm7); /* tmp13 = tmp00 - tmp03: even 2 */
-
- psubw_r2r (mm2, mm6); /* tmp12 = tmp01 - tmp02: even 2 */
- paddw_r2r (mm2, mm1); /* tmp11 = tmp01 + tmp02: even 2 */
-
- psubw_m2r (*(dataptr + 10), mm5); /* tmp05=x2-x5: stage 1 */
- paddw_r2r (mm7, mm6); /* tmp12 + tmp13 */
-
- /* stage 3 */
-
- movq_m2r (tmp6, mm2);
- movq_r2r (mm0, mm3);
-
- psllw_i2r (2, mm6); /* m8 * 2^2 */
- paddw_r2r (mm1, mm0);
-
- pmulhw_m2r (RTjpeg_C4, mm6); /* z1 */
- psubw_r2r (mm1, mm3);
-
- movq_r2m (mm0, *dataptr);
- movq_r2r (mm7, mm0);
-
- /* Odd part */
- movq_r2m (mm3, *(dataptr + 8));
- paddw_r2r (mm5, mm4); /* tmp10 */
-
- movq_m2r (tmp7, mm3);
- paddw_r2r (mm6, mm0); /* tmp32 */
-
- paddw_r2r (mm2, mm5); /* tmp11 */
- psubw_r2r (mm6, mm7); /* tmp33 */
-
- movq_r2m (mm0, *(dataptr + 4));
- paddw_r2r (mm3, mm2); /* tmp12 */
-
- /* stage 4 */
- movq_r2m (mm7, *(dataptr + 12));
- movq_r2r (mm4, mm1); /* copy of tmp10 */
-
- psubw_r2r (mm2, mm1); /* tmp10 - tmp12 */
- psllw_i2r (2, mm4); /* m8 * 2^2 */
-
- movq_m2r (RTjpeg_C2mC6, mm0);
- psllw_i2r (2, mm1);
-
- pmulhw_m2r (RTjpeg_C6, mm1); /* z5 */
- psllw_i2r (2, mm2);
-
- pmulhw_r2r (mm0, mm4); /* z5 */
-
- /* stage 5 */
-
- pmulhw_m2r (RTjpeg_C2pC6, mm2);
- psllw_i2r (2, mm5);
-
- pmulhw_m2r (RTjpeg_C4, mm5); /* z3 */
- movq_r2r (mm3, mm0); /* copy tmp7 */
-
- movq_m2r (*(dataptr + 1), mm7);
- paddw_r2r (mm1, mm4); /* z2 */
-
- paddw_r2r (mm1, mm2); /* z4 */
-
- paddw_r2r (mm5, mm0); /* z11 */
- psubw_r2r (mm5, mm3); /* z13 */
-
- /* stage 6 */
-
- movq_r2r (mm3, mm5); /* copy z13 */
- psubw_r2r (mm4, mm3); /* y3=z13 - z2 */
-
- paddw_r2r (mm4, mm5); /* y5=z13 + z2 */
- movq_r2r (mm0, mm6); /* copy z11 */
-
- movq_r2m (mm3, *(dataptr + 6)); /*save y3 */
- psubw_r2r (mm2, mm0); /* y7=z11 - z4 */
-
- movq_r2m (mm5, *(dataptr + 10)); /*save y5 */
- paddw_r2r (mm2, mm6); /* y1=z11 + z4 */
-
- movq_r2m (mm0, *(dataptr + 14)); /*save y7 */
-
- /************************************************
- * End of 1st 4 rows
- ************************************************/
-
- movq_m2r (*(dataptr + 3), mm1); /* load x1 : stage 1 */
- movq_r2r (mm7, mm0); /* copy x0 */
-
- movq_r2m (mm6, *(dataptr + 2)); /*save y1 */
-
- movq_m2r (*(dataptr + 5), mm2); /* load x2 : stage 1 */
- movq_r2r (mm1, mm6); /* copy x1 */
-
- paddw_m2r (*(dataptr + 15), mm0); /* tmp00 = x0 + x7 */
-
- movq_m2r (*(dataptr + 7), mm3); /* load x3 : stage 1 */
- movq_r2r (mm2, mm5); /* copy x2 */
-
- psubw_m2r (*(dataptr + 15), mm7); /* tmp07 = x0 - x7 */
- movq_r2r (mm3, mm4); /* copy x3 */
-
- paddw_m2r (*(dataptr + 13), mm1); /* tmp01 = x1 + x6 */
-
- movq_r2m (mm7, tmp7); /* save tmp07 */
- movq_r2r (mm0, mm7); /* copy tmp00 */
-
- psubw_m2r (*(dataptr + 13), mm6); /* tmp06 = x1 - x6 */
-
- /* stage 2, Even Part */
-
- paddw_m2r (*(dataptr + 9), mm3); /* tmp03 = x3 + x4 */
-
- movq_r2m (mm6, tmp6); /* save tmp07 */
- movq_r2r (mm1, mm6); /* copy tmp01 */
-
- paddw_m2r (*(dataptr + 11), mm2); /* tmp02 = x2 + x5 */
- paddw_r2r (mm3, mm0); /* tmp10 = tmp00 + tmp03 */
-
- psubw_r2r (mm3, mm7); /* tmp13 = tmp00 - tmp03 */
-
- psubw_m2r (*(dataptr + 9), mm4); /* tmp04 = x3 - x4 */
- psubw_r2r (mm2, mm6); /* tmp12 = tmp01 - tmp02 */
-
- paddw_r2r (mm2, mm1); /* tmp11 = tmp01 + tmp02 */
-
- psubw_m2r (*(dataptr + 11), mm5); /* tmp05 = x2 - x5 */
- paddw_r2r (mm7, mm6); /* tmp12 + tmp13 */
-
- /* stage 3, Even and stage 4 & 5 even */
-
- movq_m2r (tmp6, mm2); /* load tmp6 */
- movq_r2r (mm0, mm3); /* copy tmp10 */
-
- psllw_i2r (2, mm6); /* shift z1 */
- paddw_r2r (mm1, mm0); /* y0=tmp10 + tmp11 */
-
- pmulhw_m2r (RTjpeg_C4, mm6); /* z1 */
- psubw_r2r (mm1, mm3); /* y4=tmp10 - tmp11 */
-
- movq_r2m (mm0, *(dataptr + 1)); /*save y0 */
- movq_r2r (mm7, mm0); /* copy tmp13 */
-
- /* odd part */
-
- movq_r2m (mm3, *(dataptr + 9)); /*save y4 */
- paddw_r2r (mm5, mm4); /* tmp10 = tmp4 + tmp5 */
-
- movq_m2r (tmp7, mm3); /* load tmp7 */
- paddw_r2r (mm6, mm0); /* tmp32 = tmp13 + z1 */
-
- paddw_r2r (mm2, mm5); /* tmp11 = tmp5 + tmp6 */
- psubw_r2r (mm6, mm7); /* tmp33 = tmp13 - z1 */
-
- movq_r2m (mm0, *(dataptr + 5)); /*save y2 */
- paddw_r2r (mm3, mm2); /* tmp12 = tmp6 + tmp7 */
-
- /* stage 4 */
-
- movq_r2m (mm7, *(dataptr + 13)); /*save y6 */
- movq_r2r (mm4, mm1); /* copy tmp10 */
-
- psubw_r2r (mm2, mm1); /* tmp10 - tmp12 */
- psllw_i2r (2, mm4); /* shift tmp10 */
-
- movq_m2r (RTjpeg_C2mC6, mm0); /* load C2mC6 */
- psllw_i2r (2, mm1); /* shift (tmp10-tmp12) */
-
- pmulhw_m2r (RTjpeg_C6, mm1); /* z5 */
- psllw_i2r (2, mm5); /* prepare for multiply */
-
- pmulhw_r2r (mm0, mm4); /* multiply by converted real */
-
- /* stage 5 */
-
- pmulhw_m2r (RTjpeg_C4, mm5); /* z3 */
- psllw_i2r (2, mm2); /* prepare for multiply */
-
- pmulhw_m2r (RTjpeg_C2pC6, mm2); /* multiply */
- movq_r2r (mm3, mm0); /* copy tmp7 */
-
- movq_m2r (*(dataptr + 9), mm7); /* m03:m02|m01:m00 - first line (line 4)and copy into mm7 */
- paddw_r2r (mm1, mm4); /* z2 */
-
- paddw_r2r (mm5, mm0); /* z11 */
- psubw_r2r (mm5, mm3); /* z13 */
-
- /* stage 6 */
-
- movq_r2r (mm3, mm5); /* copy z13 */
- paddw_r2r (mm1, mm2); /* z4 */
-
- movq_r2r (mm0, mm6); /* copy z11 */
- psubw_r2r (mm4, mm5); /* y3 */
-
- paddw_r2r (mm2, mm6); /* y1 */
- paddw_r2r (mm4, mm3); /* y5 */
-
- movq_r2m (mm5, *(dataptr + 7)); /*save y3 */
- psubw_r2r (mm2, mm0); /* yè=z11 - z4 */
-
- movq_r2m (mm3, *(dataptr + 11)); /*save y5 */
-
- movq_r2m (mm6, *(dataptr + 3)); /*save y1 */
-
- movq_r2m (mm0, *(dataptr + 15)); /*save y7 */
-
-
-#endif
-}
-
-#define FIX_1_082392200 ((__s32) 277) /* FIX(1.082392200) */
-#define FIX_1_414213562 ((__s32) 362) /* FIX(1.414213562) */
-#define FIX_1_847759065 ((__s32) 473) /* FIX(1.847759065) */
-#define FIX_2_613125930 ((__s32) 669) /* FIX(2.613125930) */
-
-#define DESCALE(x) (__s16)( ((x)+4) >> 3)
-
-/* clip yuv to 16..235 (should be 16..240 for cr/cb but ... */
-
-#define RL(x) ((x)>235) ? 235 : (((x)<16) ? 16 : (x))
-#define MULTIPLY(var,const) (((__s32) ((var) * (const)) + 128)>>8)
-
-void
-RTjpeg_idct_init (void)
-{
- int i;
-
- for (i = 0; i < 64; i++) {
- RTjpeg_liqt[i] = ((__u64) RTjpeg_liqt[i] * RTjpeg_aan_tab[i]) >> 32;
- RTjpeg_ciqt[i] = ((__u64) RTjpeg_ciqt[i] * RTjpeg_aan_tab[i]) >> 32;
- }
-}
-
-void
-RTjpeg_idct (__u8 * odata, __s16 * data, int rskip)
-{
-#ifdef HAVE_LIBMMX
-
- static mmx_t fix_141 = (mmx_t) (long long) 0x5a825a825a825a82LL;
- static mmx_t fix_184n261 = (mmx_t) (long long) 0xcf04cf04cf04cf04LL;
- static mmx_t fix_184 = (mmx_t) (long long) 0x7641764176417641LL;
- static mmx_t fix_n184 = (mmx_t) (long long) 0x896f896f896f896fLL;
- static mmx_t fix_108n184 = (mmx_t) (long long) 0xcf04cf04cf04cf04LL;
-
- mmx_t workspace[64];
- mmx_t *wsptr = workspace;
- register mmx_t *dataptr = (mmx_t *) odata;
- mmx_t *idata = (mmx_t *) data;
-
- rskip = rskip >> 3;
-/*
- * Perform inverse DCT on one block of coefficients.
- */
-
- /* Odd part */
-
- movq_m2r (*(idata + 10), mm1); /* load idata[DCTSIZE*5] */
-
- movq_m2r (*(idata + 6), mm0); /* load idata[DCTSIZE*3] */
-
- movq_m2r (*(idata + 2), mm3); /* load idata[DCTSIZE*1] */
-
- movq_r2r (mm1, mm2); /* copy tmp6 : phase 6 */
- */movq_m2r (*(idata + 14), mm4); /* load idata[DCTSIZE*7] */
-
- paddw_r2r (mm0, mm1); /* z13 = tmp6 + tmp5; */
-
- psubw_r2r (mm0, mm2); /* z10 = tmp6 - tmp5 */
-
- psllw_i2r (2, mm2); /* shift z10 */
- movq_r2r (mm2, mm0); /* copy z10 */
-
- pmulhw_m2r (fix_184n261, mm2); /* MULTIPLY( z12, FIX_1_847759065); : 2*c2 */
- movq_r2r (mm3, mm5); /* copy tmp4 */
-
- pmulhw_m2r (fix_n184, mm0); /* MULTIPLY(z10, -FIX_1_847759065); : 2*c2 */
- paddw_r2r (mm4, mm3); /* z11 = tmp4 + tmp7; */
-
- movq_r2r (mm3, mm6); /* copy z11 : phase 5 */
- psubw_r2r (mm4, mm5); /* z12 = tmp4 - tmp7; */
-
- psubw_r2r (mm1, mm6); /* z11-z13 */
- psllw_i2r (2, mm5); /* shift z12 */
-
- movq_m2r (*(idata + 12), mm4); /* load idata[DCTSIZE*6], even part */
- movq_r2r (mm5, mm7); /* copy z12 */
-
- pmulhw_m2r (fix_108n184, mm5); /* MULT(z12, (FIX_1_08-FIX_1_84)) //- z5; 2*(c2-c6): even part */
- paddw_r2r (mm1, mm3); /* tmp7 = z11 + z13; */
-
- /*ok */
-
- /* Even part */
- pmulhw_m2r (fix_184, mm7); /* MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) //+ z5; -2*(c2+c6) */
- psllw_i2r (2, mm6);
-
- movq_m2r (*(idata + 4), mm1); /* load idata[DCTSIZE*2] */
-
- paddw_r2r (mm5, mm0); /* tmp10 */
-
- paddw_r2r (mm7, mm2); /* tmp12 */
-
- pmulhw_m2r (fix_141, mm6); /* tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); 2*c4 */
- psubw_r2r (mm3, mm2); /* tmp6 = tmp12 - tmp7 */
-
- movq_r2r (mm1, mm5); /* copy tmp1 */
- paddw_r2r (mm4, mm1); /* tmp13= tmp1 + tmp3; phases 5-3 */
-
- psubw_r2r (mm4, mm5); /* tmp1-tmp3 */
- psubw_r2r (mm2, mm6); /* tmp5 = tmp11 - tmp6; */
-
- movq_r2m (mm1, *(wsptr)); /* save tmp13 in workspace */
- psllw_i2r (2, mm5); /* shift tmp1-tmp3 */
-
- movq_m2r (*(idata), mm7); /* load idata[DCTSIZE*0] */
-
- pmulhw_m2r (fix_141, mm5); /* MULTIPLY(tmp1 - tmp3, FIX_1_414213562) */
- paddw_r2r (mm6, mm0); /* tmp4 = tmp10 + tmp5; */
-
- movq_m2r (*(idata + 8), mm4); /* load idata[DCTSIZE*4] */
-
- psubw_r2r (mm1, mm5); /* tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; 2*c4 */
-
- movq_r2m (mm0, *(wsptr + 4)); /* save tmp4 in workspace */
- movq_r2r (mm7, mm1); /* copy tmp0 : phase 3 */
-
- movq_r2m (mm5, *(wsptr + 2)); /* save tmp12 in workspace */
- psubw_r2r (mm4, mm1); /* tmp11 = tmp0 - tmp2; */
-
- paddw_r2r (mm4, mm7); /* tmp10 = tmp0 + tmp2; */
- movq_r2r (mm1, mm5); /* copy tmp11 */
-
- paddw_m2r (*(wsptr + 2), mm1); /* tmp1 = tmp11 + tmp12; */
- movq_r2r (mm7, mm4); /* copy tmp10 : phase 2 */
-
- paddw_m2r (*(wsptr), mm7); /* tmp0 = tmp10 + tmp13; */
-
- psubw_m2r (*(wsptr), mm4); /* tmp3 = tmp10 - tmp13; */
- movq_r2r (mm7, mm0); /* copy tmp0 */
-
- psubw_m2r (*(wsptr + 2), mm5); /* tmp2 = tmp11 - tmp12; */
- paddw_r2r (mm3, mm7); /* wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7); */
-
- psubw_r2r (mm3, mm0); /* wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7); */
-
- movq_r2m (mm7, *(wsptr)); /* wsptr[DCTSIZE*0] */
- movq_r2r (mm1, mm3); /* copy tmp1 */
-
- movq_r2m (mm0, *(wsptr + 14)); /* wsptr[DCTSIZE*7] */
- paddw_r2r (mm2, mm1); /* wsptr[DCTSIZE*1] = (int) (tmp1 + tmp6); */
-
- psubw_r2r (mm2, mm3); /* wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6); */
-
- movq_r2m (mm1, *(wsptr + 2)); /* wsptr[DCTSIZE*1] */
- movq_r2r (mm4, mm1); /* copy tmp3 */
-
- movq_r2m (mm3, *(wsptr + 12)); /* wsptr[DCTSIZE*6] */
-
- paddw_m2r (*(wsptr + 4), mm4); /* wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4); */
-
- psubw_m2r (*(wsptr + 4), mm1); /* wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4); */
-
- movq_r2m (mm4, *(wsptr + 8));
- movq_r2r (mm5, mm7); /* copy tmp2 */
-
- paddw_r2r (mm6, mm5); /* wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5) */
-
- movq_r2m (mm1, *(wsptr + 6));
- psubw_r2r (mm6, mm7); /* wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5); */
-
- movq_r2m (mm5, *(wsptr + 4));
-
- movq_r2m (mm7, *(wsptr + 10));
-
- /*ok */
-
-
-/*****************************************************************/
-
- idata++;
- wsptr++;
-
-/*****************************************************************/
-
- movq_m2r (*(idata + 10), mm1); /* load idata[DCTSIZE*5] */
-
- movq_m2r (*(idata + 6), mm0); /* load idata[DCTSIZE*3] */
-
- movq_m2r (*(idata + 2), mm3); /* load idata[DCTSIZE*1] */
- movq_r2r (mm1, mm2); /* copy tmp6 : phase 6 */
- */movq_m2r (*(idata + 14), mm4); /* load idata[DCTSIZE*7] */
- paddw_r2r (mm0, mm1); /* z13 = tmp6 + tmp5; */
-
- psubw_r2r (mm0, mm2); /* z10 = tmp6 - tmp5 */
-
- psllw_i2r (2, mm2); /* shift z10 */
- movq_r2r (mm2, mm0); /* copy z10 */
-
- pmulhw_m2r (fix_184n261, mm2); /* MULTIPLY( z12, FIX_1_847759065); : 2*c2 */
- movq_r2r (mm3, mm5); /* copy tmp4 */
-
- pmulhw_m2r (fix_n184, mm0); /* MULTIPLY(z10, -FIX_1_847759065); : 2*c2 */
- paddw_r2r (mm4, mm3); /* z11 = tmp4 + tmp7; */
-
- movq_r2r (mm3, mm6); /* copy z11 : phase 5 */
- psubw_r2r (mm4, mm5); /* z12 = tmp4 - tmp7; */
-
- psubw_r2r (mm1, mm6); /* z11-z13 */
- psllw_i2r (2, mm5); /* shift z12 */
-
- movq_m2r (*(idata + 12), mm4); /* load idata[DCTSIZE*6], even part */
- movq_r2r (mm5, mm7); /* copy z12 */
-
- pmulhw_m2r (fix_108n184, mm5); /* MULT(z12, (FIX_1_08-FIX_1_84)) //- z5; 2*(c2-c6) even part */
- paddw_r2r (mm1, mm3); /* tmp7 = z11 + z13; */
-
- /*ok */
-
- /* Even part */
- pmulhw_m2r (fix_184, mm7); /* MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) //+ z5; -2*(c2+c6) */
- psllw_i2r (2, mm6);
-
- movq_m2r (*(idata + 4), mm1); /* load idata[DCTSIZE*2] */
-
- paddw_r2r (mm5, mm0); /* tmp10 */
-
- paddw_r2r (mm7, mm2); /* tmp12 */
-
- pmulhw_m2r (fix_141, mm6); /* tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); 2*c4 */
- psubw_r2r (mm3, mm2); /* tmp6 = tmp12 - tmp7 */
-
- movq_r2r (mm1, mm5); /* copy tmp1 */
- paddw_r2r (mm4, mm1); /* tmp13= tmp1 + tmp3; phases 5-3 */
-
- psubw_r2r (mm4, mm5); /* tmp1-tmp3 */
- psubw_r2r (mm2, mm6); /* tmp5 = tmp11 - tmp6; */
-
- movq_r2m (mm1, *(wsptr)); /* save tmp13 in workspace */
- psllw_i2r (2, mm5); /* shift tmp1-tmp3 */
-
- movq_m2r (*(idata), mm7); /* load idata[DCTSIZE*0] */
- paddw_r2r (mm6, mm0); /* tmp4 = tmp10 + tmp5; */
-
- pmulhw_m2r (fix_141, mm5); /* MULTIPLY(tmp1 - tmp3, FIX_1_414213562) */
-
- movq_m2r (*(idata + 8), mm4); /* load idata[DCTSIZE*4] */
-
- psubw_r2r (mm1, mm5); /* tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; 2*c4 */
-
- movq_r2m (mm0, *(wsptr + 4)); /* save tmp4 in workspace */
- movq_r2r (mm7, mm1); /* copy tmp0: phase 3 */
-
- movq_r2m (mm5, *(wsptr + 2)); /* save tmp12 in workspace */
- psubw_r2r (mm4, mm1); /* tmp11 = tmp0 - tmp2; */
-
- paddw_r2r (mm4, mm7); /* tmp10 = tmp0 + tmp2; */
- movq_r2r (mm1, mm5); /* copy tmp11 */
-
- paddw_m2r (*(wsptr + 2), mm1); /* tmp1 = tmp11 + tmp12; */
- movq_r2r (mm7, mm4); /* copy tmp10: phase 2 */
-
- paddw_m2r (*(wsptr), mm7); /* tmp0 = tmp10 + tmp13; */
-
- psubw_m2r (*(wsptr), mm4); /* tmp3 = tmp10 - tmp13; */
- movq_r2r (mm7, mm0); /* copy tmp0 */
-
- psubw_m2r (*(wsptr + 2), mm5); /* tmp2 = tmp11 - tmp12; */
- paddw_r2r (mm3, mm7); /* wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7); */
-
- psubw_r2r (mm3, mm0); /* wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7); */
-
- movq_r2m (mm7, *(wsptr)); /* wsptr[DCTSIZE*0] */
- movq_r2r (mm1, mm3); /* copy tmp1 */
-
- movq_r2m (mm0, *(wsptr + 14)); /* wsptr[DCTSIZE*7] */
- paddw_r2r (mm2, mm1); /* wsptr[DCTSIZE*1] = (int) (tmp1 + tmp6); */
-
- psubw_r2r (mm2, mm3); /* wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6); */
-
- movq_r2m (mm1, *(wsptr + 2)); /* wsptr[DCTSIZE*1] */
- movq_r2r (mm4, mm1); /* copy tmp3 */
-
- movq_r2m (mm3, *(wsptr + 12)); /* wsptr[DCTSIZE*6] */
-
- paddw_m2r (*(wsptr + 4), mm4); /* wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4); */
-
- psubw_m2r (*(wsptr + 4), mm1); /* wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4); */
-
- movq_r2m (mm4, *(wsptr + 8));
- movq_r2r (mm5, mm7); /* copy tmp2 */
-
- paddw_r2r (mm6, mm5); /* wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5) */
-
- movq_r2m (mm1, *(wsptr + 6));
- psubw_r2r (mm6, mm7); /* wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5); */
-
- movq_r2m (mm5, *(wsptr + 4));
-
- movq_r2m (mm7, *(wsptr + 10));
-
-/*****************************************************************/
-
- /* Pass 2: process rows from work array, store into output array. */
- /* Note that we must descale the results by a factor of 8 == 2**3, */
- /* and also undo the PASS1_BITS scaling. */
-
-/*****************************************************************/
- /* Even part */
-
- wsptr--;
-
-/* tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]); */
-/* tmp13 = ((DCTELEM) wsptr[2] + (DCTELEM) wsptr[6]); */
-/* tmp11 = ((DCTELEM) wsptr[0] - (DCTELEM) wsptr[4]); */
-/* tmp14 = ((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6]); */
- movq_m2r (*(wsptr), mm0); /* wsptr[0,0],[0,1],[0,2],[0,3] */
-
- movq_m2r (*(wsptr + 1), mm1); /* wsptr[0,4],[0,5],[0,6],[0,7] */
- movq_r2r (mm0, mm2);
-
- movq_m2r (*(wsptr + 2), mm3); /* wsptr[1,0],[1,1],[1,2],[1,3] */
- paddw_r2r (mm1, mm0); /* wsptr[0,tmp10],[xxx],[0,tmp13],[xxx] */
-
- movq_m2r (*(wsptr + 3), mm4); /* wsptr[1,4],[1,5],[1,6],[1,7] */
- psubw_r2r (mm1, mm2); /* wsptr[0,tmp11],[xxx],[0,tmp14],[xxx] */
-
- movq_r2r (mm0, mm6);
- movq_r2r (mm3, mm5);
-
- paddw_r2r (mm4, mm3); /* wsptr[1,tmp10],[xxx],[1,tmp13],[xxx] */
- movq_r2r (mm2, mm1);
-
- psubw_r2r (mm4, mm5); /* wsptr[1,tmp11],[xxx],[1,tmp14],[xxx] */
- punpcklwd_r2r (mm3, mm0); /* wsptr[0,tmp10],[1,tmp10],[xxx],[xxx] */
-
- movq_m2r (*(wsptr + 7), mm7); /* wsptr[3,4],[3,5],[3,6],[3,7] */
- punpckhwd_r2r (mm3, mm6); /* wsptr[0,tmp13],[1,tmp13],[xxx],[xxx] */
-
- movq_m2r (*(wsptr + 4), mm3); /* wsptr[2,0],[2,1],[2,2],[2,3] */
- punpckldq_r2r (mm6, mm0); /* wsptr[0,tmp10],[1,tmp10],[0,tmp13],[1,tmp13] */
-
- punpcklwd_r2r (mm5, mm1); /* wsptr[0,tmp11],[1,tmp11],[xxx],[xxx] */
- movq_r2r (mm3, mm4);
-
- movq_m2r (*(wsptr + 6), mm6); /* wsptr[3,0],[3,1],[3,2],[3,3] */
- punpckhwd_r2r (mm5, mm2); /* wsptr[0,tmp14],[1,tmp14],[xxx],[xxx] */
-
- movq_m2r (*(wsptr + 5), mm5); /* wsptr[2,4],[2,5],[2,6],[2,7] */
- punpckldq_r2r (mm2, mm1); /* wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14] */
-
-
- paddw_r2r (mm5, mm3); /* wsptr[2,tmp10],[xxx],[2,tmp13],[xxx] */
- movq_r2r (mm6, mm2);
-
- psubw_r2r (mm5, mm4); /* wsptr[2,tmp11],[xxx],[2,tmp14],[xxx] */
- paddw_r2r (mm7, mm6); /* wsptr[3,tmp10],[xxx],[3,tmp13],[xxx] */
-
- movq_r2r (mm3, mm5);
- punpcklwd_r2r (mm6, mm3); /* wsptr[2,tmp10],[3,tmp10],[xxx],[xxx] */
-
- psubw_r2r (mm7, mm2); /* wsptr[3,tmp11],[xxx],[3,tmp14],[xxx] */
- punpckhwd_r2r (mm6, mm5); /* wsptr[2,tmp13],[3,tmp13],[xxx],[xxx] */
-
- movq_r2r (mm4, mm7);
- punpckldq_r2r (mm5, mm3); /* wsptr[2,tmp10],[3,tmp10],[2,tmp13],[3,tmp13] */
-
- punpcklwd_r2r (mm2, mm4); /* wsptr[2,tmp11],[3,tmp11],[xxx],[xxx] */
-
- punpckhwd_r2r (mm2, mm7); /* wsptr[2,tmp14],[3,tmp14],[xxx],[xxx] */
-
- punpckldq_r2r (mm7, mm4); /* wsptr[2,tmp11],[3,tmp11],[2,tmp14],[3,tmp14] */
- movq_r2r (mm1, mm6);
-
- /*ok */
-
-/* mm0 = ;wsptr[0,tmp10],[1,tmp10],[0,tmp13],[1,tmp13] */
-/* mm1 = ;wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14] */
-
-
- movq_r2r (mm0, mm2);
- punpckhdq_r2r (mm4, mm6); /* wsptr[0,tmp14],[1,tmp14],[2,tmp14],[3,tmp14] */
-
- punpckldq_r2r (mm4, mm1); /* wsptr[0,tmp11],[1,tmp11],[2,tmp11],[3,tmp11] */
- psllw_i2r (2, mm6);
-
- pmulhw_m2r (fix_141, mm6);
- punpckldq_r2r (mm3, mm0); /* wsptr[0,tmp10],[1,tmp10],[2,tmp10],[3,tmp10] */
-
- punpckhdq_r2r (mm3, mm2); /* wsptr[0,tmp13],[1,tmp13],[2,tmp13],[3,tmp13] */
- movq_r2r (mm0, mm7);
-
-/* tmp0 = tmp10 + tmp13; */
-/* tmp3 = tmp10 - tmp13; */
- paddw_r2r (mm2, mm0); /* [0,tmp0],[1,tmp0],[2,tmp0],[3,tmp0] */
- psubw_r2r (mm2, mm7); /* [0,tmp3],[1,tmp3],[2,tmp3],[3,tmp3] */
-
-/* tmp12 = MULTIPLY(tmp14, FIX_1_414213562) - tmp13; */
- psubw_r2r (mm2, mm6); /* wsptr[0,tmp12],[1,tmp12],[2,tmp12],[3,tmp12] */
-/* tmp1 = tmp11 + tmp12; */
-/* tmp2 = tmp11 - tmp12; */
- movq_r2r (mm1, mm5);
-
- /*OK */
-
- /* Odd part */
-
-/* z13 = (DCTELEM) wsptr[5] + (DCTELEM) wsptr[3]; */
-/* z10 = (DCTELEM) wsptr[5] - (DCTELEM) wsptr[3]; */
-/* z11 = (DCTELEM) wsptr[1] + (DCTELEM) wsptr[7]; */
-/* z12 = (DCTELEM) wsptr[1] - (DCTELEM) wsptr[7]; */
- movq_m2r (*(wsptr), mm3); /* wsptr[0,0],[0,1],[0,2],[0,3] */
- paddw_r2r (mm6, mm1); /* [0,tmp1],[1,tmp1],[2,tmp1],[3,tmp1] */
-
- movq_m2r (*(wsptr + 1), mm4); /* wsptr[0,4],[0,5],[0,6],[0,7] */
- psubw_r2r (mm6, mm5); /* [0,tmp2],[1,tmp2],[2,tmp2],[3,tmp2] */
-
- movq_r2r (mm3, mm6);
- punpckldq_r2r (mm4, mm3); /* wsptr[0,0],[0,1],[0,4],[0,5] */
-
- punpckhdq_r2r (mm6, mm4); /* wsptr[0,6],[0,7],[0,2],[0,3] */
- movq_r2r (mm3, mm2);
-
-/*Save tmp0 and tmp1 in wsptr */
- movq_r2m (mm0, *(wsptr)); /* save tmp0 */
- paddw_r2r (mm4, mm2); /* wsptr[xxx],[0,z11],[xxx],[0,z13] */
-
-
-/*Continue with z10 --- z13 */
- movq_m2r (*(wsptr + 2), mm6); /* wsptr[1,0],[1,1],[1,2],[1,3] */
- psubw_r2r (mm4, mm3); /* wsptr[xxx],[0,z12],[xxx],[0,z10] */
-
- movq_m2r (*(wsptr + 3), mm0); /* wsptr[1,4],[1,5],[1,6],[1,7] */
- movq_r2r (mm6, mm4);
-
- movq_r2m (mm1, *(wsptr + 1)); /* save tmp1 */
- punpckldq_r2r (mm0, mm6); /* wsptr[1,0],[1,1],[1,4],[1,5] */
-
- punpckhdq_r2r (mm4, mm0); /* wsptr[1,6],[1,7],[1,2],[1,3] */
- movq_r2r (mm6, mm1);
-
-/*Save tmp2 and tmp3 in wsptr */
- paddw_r2r (mm0, mm6); /* wsptr[xxx],[1,z11],[xxx],[1,z13] */
- movq_r2r (mm2, mm4);
-
-/*Continue with z10 --- z13 */
- movq_r2m (mm5, *(wsptr + 2)); /* save tmp2 */
- punpcklwd_r2r (mm6, mm2); /* wsptr[xxx],[xxx],[0,z11],[1,z11] */
-
- psubw_r2r (mm0, mm1); /* wsptr[xxx],[1,z12],[xxx],[1,z10] */
- punpckhwd_r2r (mm6, mm4); /* wsptr[xxx],[xxx],[0,z13],[1,z13] */
-
- movq_r2r (mm3, mm0);
- punpcklwd_r2r (mm1, mm3); /* wsptr[xxx],[xxx],[0,z12],[1,z12] */
-
- movq_r2m (mm7, *(wsptr + 3)); /* save tmp3 */
- punpckhwd_r2r (mm1, mm0); /* wsptr[xxx],[xxx],[0,z10],[1,z10] */
-
- movq_m2r (*(wsptr + 4), mm6); /* wsptr[2,0],[2,1],[2,2],[2,3] */
- punpckhdq_r2r (mm2, mm0); /* wsptr[0,z10],[1,z10],[0,z11],[1,z11] */
-
- movq_m2r (*(wsptr + 5), mm7); /* wsptr[2,4],[2,5],[2,6],[2,7] */
- punpckhdq_r2r (mm4, mm3); /* wsptr[0,z12],[1,z12],[0,z13],[1,z13] */
-
- movq_m2r (*(wsptr + 6), mm1); /* wsptr[3,0],[3,1],[3,2],[3,3] */
- movq_r2r (mm6, mm4);
-
- punpckldq_r2r (mm7, mm6); /* wsptr[2,0],[2,1],[2,4],[2,5] */
- movq_r2r (mm1, mm5);
-
- punpckhdq_r2r (mm4, mm7); /* wsptr[2,6],[2,7],[2,2],[2,3] */
- movq_r2r (mm6, mm2);
-
- movq_m2r (*(wsptr + 7), mm4); /* wsptr[3,4],[3,5],[3,6],[3,7] */
- paddw_r2r (mm7, mm6); /* wsptr[xxx],[2,z11],[xxx],[2,z13] */
-
- psubw_r2r (mm7, mm2); /* wsptr[xxx],[2,z12],[xxx],[2,z10] */
- punpckldq_r2r (mm4, mm1); /* wsptr[3,0],[3,1],[3,4],[3,5] */
-
- punpckhdq_r2r (mm5, mm4); /* wsptr[3,6],[3,7],[3,2],[3,3] */
- movq_r2r (mm1, mm7);
-
- paddw_r2r (mm4, mm1); /* wsptr[xxx],[3,z11],[xxx],[3,z13] */
- psubw_r2r (mm4, mm7); /* wsptr[xxx],[3,z12],[xxx],[3,z10] */
-
- movq_r2r (mm6, mm5);
- punpcklwd_r2r (mm1, mm6); /* wsptr[xxx],[xxx],[2,z11],[3,z11] */
-
- punpckhwd_r2r (mm1, mm5); /* wsptr[xxx],[xxx],[2,z13],[3,z13] */
- movq_r2r (mm2, mm4);
-
- punpcklwd_r2r (mm7, mm2); /* wsptr[xxx],[xxx],[2,z12],[3,z12] */
-
- punpckhwd_r2r (mm7, mm4); /* wsptr[xxx],[xxx],[2,z10],[3,z10] */
-
- punpckhdq_r2r (mm6, mm4); /*/ wsptr[2,z10],[3,z10],[2,z11],[3,z11] */
-
- punpckhdq_r2r (mm5, mm2); /* wsptr[2,z12],[3,z12],[2,z13],[3,z13] */
- movq_r2r (mm0, mm5);
-
- punpckldq_r2r (mm4, mm0); /* wsptr[0,z10],[1,z10],[2,z10],[3,z10] */
-
- punpckhdq_r2r (mm4, mm5); /* wsptr[0,z11],[1,z11],[2,z11],[3,z11] */
- movq_r2r (mm3, mm4);
-
- punpckhdq_r2r (mm2, mm4); /* wsptr[0,z13],[1,z13],[2,z13],[3,z13] */
- movq_r2r (mm5, mm1);
-
- punpckldq_r2r (mm2, mm3); /* wsptr[0,z12],[1,z12],[2,z12],[3,z12] */
-/* tmp7 = z11 + z13; : phase 5 */
-/* tmp8 = z11 - z13; : phase 5 */
- psubw_r2r (mm4, mm1); /* tmp8 */
-
- paddw_r2r (mm4, mm5); /* tmp7 */
-/* tmp21 = MULTIPLY(tmp8, FIX_1_414213562); 2*c4 */
- psllw_i2r (2, mm1);
-
- psllw_i2r (2, mm0);
-
- pmulhw_m2r (fix_141, mm1); /* tmp21 */
-/* tmp20 = MULTIPLY(z12, (FIX_1_082392200- FIX_1_847759065)) 2*(c2-c6) */
-/* + MULTIPLY(z10, - FIX_1_847759065); : 2*c2 */
- psllw_i2r (2, mm3);
- movq_r2r (mm0, mm7);
-
- pmulhw_m2r (fix_n184, mm7);
- movq_r2r (mm3, mm6);
-
- movq_m2r (*(wsptr), mm2); /* tmp0,final1 */
-
- pmulhw_m2r (fix_108n184, mm6);
-/* tmp22 = MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) : -2*(c2+c6) */
-/* + MULTIPLY(z12, FIX_1_847759065); 2*c2 */
- movq_r2r (mm2, mm4); /* final1 */
-
- pmulhw_m2r (fix_184n261, mm0);
- paddw_r2r (mm5, mm2); /* tmp0+tmp7,final1 */
-
- pmulhw_m2r (fix_184, mm3);
- psubw_r2r (mm5, mm4); /* tmp0-tmp7,final1 */
-
-/* tmp6 = tmp22 - tmp7; phase 2 */
- psraw_i2r (3, mm2); /* outptr[0,0],[1,0],[2,0],[3,0],final1 */
-
- paddw_r2r (mm6, mm7); /* tmp20 */
- psraw_i2r (3, mm4); /* outptr[0,7],[1,7],[2,7],[3,7],final1 */
-
- paddw_r2r (mm0, mm3); /* tmp22 */
-
-/* tmp5 = tmp21 - tmp6; */
- psubw_r2r (mm5, mm3); /* tmp6 */
-
-/* tmp4 = tmp20 + tmp5; */
- movq_m2r (*(wsptr + 1), mm0); /* tmp1,final2 */
- psubw_r2r (mm3, mm1); /* tmp5 */
-
- movq_r2r (mm0, mm6); /* final2 */
- paddw_r2r (mm3, mm0); /* tmp1+tmp6,final2 */
-
- /* Final output stage: scale down by a factor of 8 and range-limit */
-
-
-/* outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3) */
-/* & RANGE_MASK]; */
-/* outptr[7] = range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS+3) */
-/* & RANGE_MASK]; final1 */
-
-
-/* outptr[1] = range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS+3) */
-/* & RANGE_MASK]; */
-/* outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3) */
-/* & RANGE_MASK]; final2 */
- psubw_r2r (mm3, mm6); /* tmp1-tmp6,final2 */
- psraw_i2r (3, mm0); /* outptr[0,1],[1,1],[2,1],[3,1] */
-
- psraw_i2r (3, mm6); /* outptr[0,6],[1,6],[2,6],[3,6] */
-
- packuswb_r2r (mm4, mm0); /* out[0,1],[1,1],[2,1],[3,1],[0,7],[1,7],[2,7],[3,7] */
-
- movq_m2r (*(wsptr + 2), mm5); /* tmp2,final3 */
- packuswb_r2r (mm6, mm2); /* out[0,0],[1,0],[2,0],[3,0],[0,6],[1,6],[2,6],[3,6] */
-
-/* outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3) */
-/* & RANGE_MASK]; */
-/* outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3) */
-/* & RANGE_MASK]; final3 */
- paddw_r2r (mm1, mm7); /* tmp4 */
- movq_r2r (mm5, mm3);
-
- paddw_r2r (mm1, mm5); /* tmp2+tmp5 */
- psubw_r2r (mm1, mm3); /* tmp2-tmp5 */
-
- psraw_i2r (3, mm5); /* outptr[0,2],[1,2],[2,2],[3,2] */
-
- movq_m2r (*(wsptr + 3), mm4); /* tmp3,final4 */
- psraw_i2r (3, mm3); /* outptr[0,5],[1,5],[2,5],[3,5] */
-
-
-
-/* outptr[4] = range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS+3) */
-/* & RANGE_MASK]; */
-/* outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3) */
-/* & RANGE_MASK]; final4 */
- movq_r2r (mm4, mm6);
- paddw_r2r (mm7, mm4); /* tmp3+tmp4 */
-
- psubw_r2r (mm7, mm6); /* tmp3-tmp4 */
- psraw_i2r (3, mm4); /* outptr[0,4],[1,4],[2,4],[3,4] */
-
- /* mov ecx, [dataptr] */
-
- psraw_i2r (3, mm6); /* outptr[0,3],[1,3],[2,3],[3,3] */
-
- packuswb_r2r (mm4, mm5); /* out[0,2],[1,2],[2,2],[3,2],[0,4],[1,4],[2,4],[3,4] */
-
- packuswb_r2r (mm3, mm6); /* out[0,3],[1,3],[2,3],[3,3],[0,5],[1,5],[2,5],[3,5] */
- movq_r2r (mm2, mm4);
-
- movq_r2r (mm5, mm7);
- punpcklbw_r2r (mm0, mm2); /* out[0,0],[0,1],[1,0],[1,1],[2,0],[2,1],[3,0],[3,1] */
-
- punpckhbw_r2r (mm0, mm4); /* out[0,6],[0,7],[1,6],[1,7],[2,6],[2,7],[3,6],[3,7] */
- movq_r2r (mm2, mm1);
-
- punpcklbw_r2r (mm6, mm5); /* out[0,2],[0,3],[1,2],[1,3],[2,2],[2,3],[3,2],[3,3] */
-
- /* add dataptr, 4 */
-
- punpckhbw_r2r (mm6, mm7); /* out[0,4],[0,5],[1,4],[1,5],[2,4],[2,5],[3,4],[3,5] */
-
- punpcklwd_r2r (mm5, mm2); /* out[0,0],[0,1],[0,2],[0,3],[1,0],[1,1],[1,2],[1,3] */
-
- /* add ecx, output_col */
-
- movq_r2r (mm7, mm6);
- punpckhwd_r2r (mm5, mm1); /* out[2,0],[2,1],[2,2],[2,3],[3,0],[3,1],[3,2],[3,3] */
-
- movq_r2r (mm2, mm0);
- punpcklwd_r2r (mm4, mm6); /* out[0,4],[0,5],[0,6],[0,7],[1,4],[1,5],[1,6],[1,7] */
-
- /* mov idata, [dataptr] */
-
- punpckldq_r2r (mm6, mm2); /* out[0,0],[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7] */
-
- /* add dataptr, 4 */
-
- movq_r2r (mm1, mm3);
-
- /* add idata, output_col */
-
- punpckhwd_r2r (mm4, mm7); /* out[2,4],[2,5],[2,6],[2,7],[3,4],[3,5],[3,6],[3,7] */
-
- movq_r2m (mm2, *(dataptr));
-
- punpckhdq_r2r (mm6, mm0); /* out[1,0],[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7] */
-
- dataptr += rskip;
- movq_r2m (mm0, *(dataptr));
-
- punpckldq_r2r (mm7, mm1); /* out[2,0],[2,1],[2,2],[2,3],[2,4],[2,5],[2,6],[2,7] */
- punpckhdq_r2r (mm7, mm3); /* out[3,0],[3,1],[3,2],[3,3],[3,4],[3,5],[3,6],[3,7] */
-
- dataptr += rskip;
- movq_r2m (mm1, *(dataptr));
-
- dataptr += rskip;
- movq_r2m (mm3, *(dataptr));
-
-/*******************************************************************/
-
- wsptr += 8;
-
-/*******************************************************************/
-
-/* tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]); */
-/* tmp13 = ((DCTELEM) wsptr[2] + (DCTELEM) wsptr[6]); */
-/* tmp11 = ((DCTELEM) wsptr[0] - (DCTELEM) wsptr[4]); */
-/* tmp14 = ((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6]); */
- movq_m2r (*(wsptr), mm0); /* wsptr[0,0],[0,1],[0,2],[0,3] */
-
- movq_m2r (*(wsptr + 1), mm1); /* wsptr[0,4],[0,5],[0,6],[0,7] */
- movq_r2r (mm0, mm2);
-
- movq_m2r (*(wsptr + 2), mm3); /* wsptr[1,0],[1,1],[1,2],[1,3] */
- paddw_r2r (mm1, mm0); /* wsptr[0,tmp10],[xxx],[0,tmp13],[xxx] */
-
- movq_m2r (*(wsptr + 3), mm4); /* wsptr[1,4],[1,5],[1,6],[1,7] */
- psubw_r2r (mm1, mm2); /* wsptr[0,tmp11],[xxx],[0,tmp14],[xxx] */
-
- movq_r2r (mm0, mm6);
- movq_r2r (mm3, mm5);
-
- paddw_r2r (mm4, mm3); /* wsptr[1,tmp10],[xxx],[1,tmp13],[xxx] */
- movq_r2r (mm2, mm1);
-
- psubw_r2r (mm4, mm5); /* wsptr[1,tmp11],[xxx],[1,tmp14],[xxx] */
- punpcklwd_r2r (mm3, mm0); /* wsptr[0,tmp10],[1,tmp10],[xxx],[xxx] */
-
- movq_m2r (*(wsptr + 7), mm7); /* wsptr[3,4],[3,5],[3,6],[3,7] */
- punpckhwd_r2r (mm3, mm6); /* wsptr[0,tmp13],[1,tmp13],[xxx],[xxx] */
-
- movq_m2r (*(wsptr + 4), mm3); /* wsptr[2,0],[2,1],[2,2],[2,3] */
- punpckldq_r2r (mm6, mm0); /* wsptr[0,tmp10],[1,tmp10],[0,tmp13],[1,tmp13] */
-
- punpcklwd_r2r (mm5, mm1); /* wsptr[0,tmp11],[1,tmp11],[xxx],[xxx] */
- movq_r2r (mm3, mm4);
-
- movq_m2r (*(wsptr + 6), mm6); /* wsptr[3,0],[3,1],[3,2],[3,3] */
- punpckhwd_r2r (mm5, mm2); /* wsptr[0,tmp14],[1,tmp14],[xxx],[xxx] */
-
- movq_m2r (*(wsptr + 5), mm5); /* wsptr[2,4],[2,5],[2,6],[2,7] */
- punpckldq_r2r (mm2, mm1); /* wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14] */
-
- paddw_r2r (mm5, mm3); /* wsptr[2,tmp10],[xxx],[2,tmp13],[xxx] */
- movq_r2r (mm6, mm2);
-
- psubw_r2r (mm5, mm4); /* wsptr[2,tmp11],[xxx],[2,tmp14],[xxx] */
- paddw_r2r (mm7, mm6); /* wsptr[3,tmp10],[xxx],[3,tmp13],[xxx] */
-
- movq_r2r (mm3, mm5);
- punpcklwd_r2r (mm6, mm3); /* wsptr[2,tmp10],[3,tmp10],[xxx],[xxx] */
-
- psubw_r2r (mm7, mm2); /* wsptr[3,tmp11],[xxx],[3,tmp14],[xxx] */
- punpckhwd_r2r (mm6, mm5); /* wsptr[2,tmp13],[3,tmp13],[xxx],[xxx] */
-
- movq_r2r (mm4, mm7);
- punpckldq_r2r (mm5, mm3); /* wsptr[2,tmp10],[3,tmp10],[2,tmp13],[3,tmp13] */
-
- punpcklwd_r2r (mm2, mm4); /* wsptr[2,tmp11],[3,tmp11],[xxx],[xxx] */
-
- punpckhwd_r2r (mm2, mm7); /* wsptr[2,tmp14],[3,tmp14],[xxx],[xxx] */
-
- punpckldq_r2r (mm7, mm4); /* wsptr[2,tmp11],[3,tmp11],[2,tmp14],[3,tmp14] */
- movq_r2r (mm1, mm6);
-
- /*OK */
-
-/* mm0 = ;wsptr[0,tmp10],[1,tmp10],[0,tmp13],[1,tmp13] */
-/* mm1 = ;wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14] */
-
- movq_r2r (mm0, mm2);
- punpckhdq_r2r (mm4, mm6); /* wsptr[0,tmp14],[1,tmp14],[2,tmp14],[3,tmp14] */
-
- punpckldq_r2r (mm4, mm1); /* wsptr[0,tmp11],[1,tmp11],[2,tmp11],[3,tmp11] */
- psllw_i2r (2, mm6);
-
- pmulhw_m2r (fix_141, mm6);
- punpckldq_r2r (mm3, mm0); /* wsptr[0,tmp10],[1,tmp10],[2,tmp10],[3,tmp10] */
-
- punpckhdq_r2r (mm3, mm2); /* wsptr[0,tmp13],[1,tmp13],[2,tmp13],[3,tmp13] */
- movq_r2r (mm0, mm7);
-
-/* tmp0 = tmp10 + tmp13; */
-/* tmp3 = tmp10 - tmp13; */
- paddw_r2r (mm2, mm0); /* [0,tmp0],[1,tmp0],[2,tmp0],[3,tmp0] */
- psubw_r2r (mm2, mm7); /* [0,tmp3],[1,tmp3],[2,tmp3],[3,tmp3] */
-
-/* tmp12 = MULTIPLY(tmp14, FIX_1_414213562) - tmp13; */
- psubw_r2r (mm2, mm6); /* wsptr[0,tmp12],[1,tmp12],[2,tmp12],[3,tmp12] */
-/* tmp1 = tmp11 + tmp12; */
-/* tmp2 = tmp11 - tmp12; */
- movq_r2r (mm1, mm5);
-
- /*OK */
-
-
- /* Odd part */
-
-/* z13 = (DCTELEM) wsptr[5] + (DCTELEM) wsptr[3]; */
-/* z10 = (DCTELEM) wsptr[5] - (DCTELEM) wsptr[3]; */
-/* z11 = (DCTELEM) wsptr[1] + (DCTELEM) wsptr[7]; */
-/* z12 = (DCTELEM) wsptr[1] - (DCTELEM) wsptr[7]; */
- movq_m2r (*(wsptr), mm3); /* wsptr[0,0],[0,1],[0,2],[0,3] */
- paddw_r2r (mm6, mm1); /* [0,tmp1],[1,tmp1],[2,tmp1],[3,tmp1] */
-
- movq_m2r (*(wsptr + 1), mm4); /* wsptr[0,4],[0,5],[0,6],[0,7] */
- psubw_r2r (mm6, mm5); /* [0,tmp2],[1,tmp2],[2,tmp2],[3,tmp2] */
-
- movq_r2r (mm3, mm6);
- punpckldq_r2r (mm4, mm3); /* wsptr[0,0],[0,1],[0,4],[0,5] */
-
- punpckhdq_r2r (mm6, mm4); /* wsptr[0,6],[0,7],[0,2],[0,3] */
- movq_r2r (mm3, mm2);
-
-/*Save tmp0 and tmp1 in wsptr */
- movq_r2m (mm0, *(wsptr)); /* save tmp0 */
- paddw_r2r (mm4, mm2); /* wsptr[xxx],[0,z11],[xxx],[0,z13] */
-
-
-/*Continue with z10 --- z13 */
- movq_m2r (*(wsptr + 2), mm6); /* wsptr[1,0],[1,1],[1,2],[1,3] */
- psubw_r2r (mm4, mm3); /* wsptr[xxx],[0,z12],[xxx],[0,z10] */
-
- movq_m2r (*(wsptr + 3), mm0); /* wsptr[1,4],[1,5],[1,6],[1,7] */
- movq_r2r (mm6, mm4);
-
- movq_r2m (mm1, *(wsptr + 1)); /* save tmp1 */
- punpckldq_r2r (mm0, mm6); /* wsptr[1,0],[1,1],[1,4],[1,5] */
-
- punpckhdq_r2r (mm4, mm0); /* wsptr[1,6],[1,7],[1,2],[1,3] */
- movq_r2r (mm6, mm1);
-
-/*Save tmp2 and tmp3 in wsptr */
- paddw_r2r (mm0, mm6); /* wsptr[xxx],[1,z11],[xxx],[1,z13] */
- movq_r2r (mm2, mm4);
-
-/*Continue with z10 --- z13 */
- movq_r2m (mm5, *(wsptr + 2)); /* save tmp2 */
- punpcklwd_r2r (mm6, mm2); /* wsptr[xxx],[xxx],[0,z11],[1,z11] */
-
- psubw_r2r (mm0, mm1); /* wsptr[xxx],[1,z12],[xxx],[1,z10] */
- punpckhwd_r2r (mm6, mm4); /* wsptr[xxx],[xxx],[0,z13],[1,z13] */
-
- movq_r2r (mm3, mm0);
- punpcklwd_r2r (mm1, mm3); /* wsptr[xxx],[xxx],[0,z12],[1,z12] */
-
- movq_r2m (mm7, *(wsptr + 3)); /* save tmp3 */
- punpckhwd_r2r (mm1, mm0); /* wsptr[xxx],[xxx],[0,z10],[1,z10] */
-
- movq_m2r (*(wsptr + 4), mm6); /* wsptr[2,0],[2,1],[2,2],[2,3] */
- punpckhdq_r2r (mm2, mm0); /* wsptr[0,z10],[1,z10],[0,z11],[1,z11] */
-
- movq_m2r (*(wsptr + 5), mm7); /* wsptr[2,4],[2,5],[2,6],[2,7] */
- punpckhdq_r2r (mm4, mm3); /* wsptr[0,z12],[1,z12],[0,z13],[1,z13] */
-
- movq_m2r (*(wsptr + 6), mm1); /* wsptr[3,0],[3,1],[3,2],[3,3] */
- movq_r2r (mm6, mm4);
-
- punpckldq_r2r (mm7, mm6); /* wsptr[2,0],[2,1],[2,4],[2,5] */
- movq_r2r (mm1, mm5);
-
- punpckhdq_r2r (mm4, mm7); /* wsptr[2,6],[2,7],[2,2],[2,3] */
- movq_r2r (mm6, mm2);
-
- movq_m2r (*(wsptr + 7), mm4); /* wsptr[3,4],[3,5],[3,6],[3,7] */
- paddw_r2r (mm7, mm6); /* wsptr[xxx],[2,z11],[xxx],[2,z13] */
-
- psubw_r2r (mm7, mm2); /* wsptr[xxx],[2,z12],[xxx],[2,z10] */
- punpckldq_r2r (mm4, mm1); /* wsptr[3,0],[3,1],[3,4],[3,5] */
-
- punpckhdq_r2r (mm5, mm4); /* wsptr[3,6],[3,7],[3,2],[3,3] */
- movq_r2r (mm1, mm7);
-
- paddw_r2r (mm4, mm1); /* wsptr[xxx],[3,z11],[xxx],[3,z13] */
- psubw_r2r (mm4, mm7); /* wsptr[xxx],[3,z12],[xxx],[3,z10] */
-
- movq_r2r (mm6, mm5);
- punpcklwd_r2r (mm1, mm6); /* wsptr[xxx],[xxx],[2,z11],[3,z11] */
-
- punpckhwd_r2r (mm1, mm5); /* wsptr[xxx],[xxx],[2,z13],[3,z13] */
- movq_r2r (mm2, mm4);
-
- punpcklwd_r2r (mm7, mm2); /* wsptr[xxx],[xxx],[2,z12],[3,z12] */
-
- punpckhwd_r2r (mm7, mm4); /* wsptr[xxx],[xxx],[2,z10],[3,z10] */
-
- punpckhdq_r2r (mm6, mm4); /* wsptr[2,z10],[3,z10],[2,z11],[3,z11] */
-
- punpckhdq_r2r (mm5, mm2); /* wsptr[2,z12],[3,z12],[2,z13],[3,z13] */
- movq_r2r (mm0, mm5);
-
- punpckldq_r2r (mm4, mm0); /* wsptr[0,z10],[1,z10],[2,z10],[3,z10] */
-
- punpckhdq_r2r (mm4, mm5); /* wsptr[0,z11],[1,z11],[2,z11],[3,z11] */
- movq_r2r (mm3, mm4);
-
- punpckhdq_r2r (mm2, mm4); /* wsptr[0,z13],[1,z13],[2,z13],[3,z13] */
- movq_r2r (mm5, mm1);
-
- punpckldq_r2r (mm2, mm3); /* wsptr[0,z12],[1,z12],[2,z12],[3,z12] */
-/* tmp7 = z11 + z13; : phase 5 */
-/* tmp8 = z11 - z13; : phase 5 */
- psubw_r2r (mm4, mm1); /* tmp8 */
-
- paddw_r2r (mm4, mm5); /* tmp7 */
-/* tmp21 = MULTIPLY(tmp8, FIX_1_414213562); 2*c4 */
- psllw_i2r (2, mm1);
-
- psllw_i2r (2, mm0);
-
- pmulhw_m2r (fix_141, mm1); /* tmp21 */
-/* tmp20 = MULTIPLY(z12, (FIX_1_082392200- FIX_1_847759065)) : 2*(c2-c6) */
-/* + MULTIPLY(z10, - FIX_1_847759065); : 2*c2 */
- psllw_i2r (2, mm3);
- movq_r2r (mm0, mm7);
-
- pmulhw_m2r (fix_n184, mm7);
- movq_r2r (mm3, mm6);
-
- movq_m2r (*(wsptr), mm2); /* tmp0,final1 */
-
- pmulhw_m2r (fix_108n184, mm6);
-/* tmp22 = MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) : -2*(c2+c6) */
-/* + MULTIPLY(z12, FIX_1_847759065); : 2*c2 */
- movq_r2r (mm2, mm4); /* final1 */
-
- pmulhw_m2r (fix_184n261, mm0);
- paddw_r2r (mm5, mm2); /* tmp0+tmp7,final1 */
-
- pmulhw_m2r (fix_184, mm3);
- psubw_r2r (mm5, mm4); /* tmp0-tmp7,final1 */
-
-/* tmp6 = tmp22 - tmp7; phase 2 */
- psraw_i2r (3, mm2); /* outptr[0,0],[1,0],[2,0],[3,0],final1 */
-
- paddw_r2r (mm6, mm7); /* tmp20 */
- psraw_i2r (3, mm4); /* outptr[0,7],[1,7],[2,7],[3,7],final1 */
-
- paddw_r2r (mm0, mm3); /* tmp22 */
-
-/* tmp5 = tmp21 - tmp6; */
- psubw_r2r (mm5, mm3); /* tmp6 */
-
-/* tmp4 = tmp20 + tmp5; */
- movq_m2r (*(wsptr + 1), mm0); /* tmp1,final2 */
- psubw_r2r (mm3, mm1); /* tmp5 */
-
- movq_r2r (mm0, mm6); /* final2 */
- paddw_r2r (mm3, mm0); /* tmp1+tmp6,final2 */
-
- /* Final output stage: scale down by a factor of 8 and range-limit */
-
-/* outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3) */
-/* & RANGE_MASK]; */
-/* outptr[7] = range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS+3) */
-/* & RANGE_MASK]; final1 */
-
-
-/* outptr[1] = range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS+3) */
-/* & RANGE_MASK]; */
-/* outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3) */
-/* & RANGE_MASK]; final2 */
- psubw_r2r (mm3, mm6); /* tmp1-tmp6,final2 */
- psraw_i2r (3, mm0); /* outptr[0,1],[1,1],[2,1],[3,1] */
-
- psraw_i2r (3, mm6); /* outptr[0,6],[1,6],[2,6],[3,6] */
-
- packuswb_r2r (mm4, mm0); /* out[0,1],[1,1],[2,1],[3,1],[0,7],[1,7],[2,7],[3,7] */
-
- movq_m2r (*(wsptr + 2), mm5); /* tmp2,final3 */
- packuswb_r2r (mm6, mm2); /* out[0,0],[1,0],[2,0],[3,0],[0,6],[1,6],[2,6],[3,6] */
-
-/* outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3) */
-/* & RANGE_MASK]; */
-/* outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3) */
-/* & RANGE_MASK]; final3 */
- paddw_r2r (mm1, mm7); /* tmp4 */
- movq_r2r (mm5, mm3);
-
- paddw_r2r (mm1, mm5); /* tmp2+tmp5 */
- psubw_r2r (mm1, mm3); /* tmp2-tmp5 */
-
- psraw_i2r (3, mm5); /* outptr[0,2],[1,2],[2,2],[3,2] */
-
- movq_m2r (*(wsptr + 3), mm4); /* tmp3,final4 */
- psraw_i2r (3, mm3); /* outptr[0,5],[1,5],[2,5],[3,5] */
-
-
-
-/* outptr[4] = range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS+3) */
-/* & RANGE_MASK]; */
-/* outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3) */
-/* & RANGE_MASK]; final4 */
- movq_r2r (mm4, mm6);
- paddw_r2r (mm7, mm4); /* tmp3+tmp4 */
-
- psubw_r2r (mm7, mm6); /* tmp3-tmp4 */
- psraw_i2r (3, mm4); /* outptr[0,4],[1,4],[2,4],[3,4] */
-
- psraw_i2r (3, mm6); /* outptr[0,3],[1,3],[2,3],[3,3] */
-
- /*
- movq_r2m(mm4, *dummy);
- fprintf(stderr, "3-4 %016llx\n", dummy);
- movq_r2m(mm4, *dummy);
- fprintf(stderr, "3+4 %016llx\n", dummy);
- */
-
-
- packuswb_r2r (mm4, mm5); /* out[0,2],[1,2],[2,2],[3,2],[0,4],[1,4],[2,4],[3,4] */
-
- packuswb_r2r (mm3, mm6); /* out[0,3],[1,3],[2,3],[3,3],[0,5],[1,5],[2,5],[3,5] */
- movq_r2r (mm2, mm4);
-
- movq_r2r (mm5, mm7);
- punpcklbw_r2r (mm0, mm2); /* out[0,0],[0,1],[1,0],[1,1],[2,0],[2,1],[3,0],[3,1] */
-
- punpckhbw_r2r (mm0, mm4); /* out[0,6],[0,7],[1,6],[1,7],[2,6],[2,7],[3,6],[3,7] */
- movq_r2r (mm2, mm1);
-
- punpcklbw_r2r (mm6, mm5); /* out[0,2],[0,3],[1,2],[1,3],[2,2],[2,3],[3,2],[3,3] */
-
- punpckhbw_r2r (mm6, mm7); /* out[0,4],[0,5],[1,4],[1,5],[2,4],[2,5],[3,4],[3,5] */
-
- punpcklwd_r2r (mm5, mm2); /* out[0,0],[0,1],[0,2],[0,3],[1,0],[1,1],[1,2],[1,3] */
-
- movq_r2r (mm7, mm6);
- punpckhwd_r2r (mm5, mm1); /* out[2,0],[2,1],[2,2],[2,3],[3,0],[3,1],[3,2],[3,3] */
-
- movq_r2r (mm2, mm0);
- punpcklwd_r2r (mm4, mm6); /* out[0,4],[0,5],[0,6],[0,7],[1,4],[1,5],[1,6],[1,7] */
-
- punpckldq_r2r (mm6, mm2); /* out[0,0],[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7] */
-
- movq_r2r (mm1, mm3);
-
- punpckhwd_r2r (mm4, mm7); /* out[2,4],[2,5],[2,6],[2,7],[3,4],[3,5],[3,6],[3,7] */
-
- dataptr += rskip;
- movq_r2m (mm2, *(dataptr));
-
- punpckhdq_r2r (mm6, mm0); /* out[1,0],[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7] */
-
- dataptr += rskip;
- movq_r2m (mm0, *(dataptr));
-
- punpckldq_r2r (mm7, mm1); /* out[2,0],[2,1],[2,2],[2,3],[2,4],[2,5],[2,6],[2,7] */
-
- punpckhdq_r2r (mm7, mm3); /* out[3,0],[3,1],[3,2],[3,3],[3,4],[3,5],[3,6],[3,7] */
-
- dataptr += rskip;
- movq_r2m (mm1, *(dataptr));
-
- dataptr += rskip;
- movq_r2m (mm3, *(dataptr));
-
-#else
- __s32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- __s32 tmp10, tmp11, tmp12, tmp13;
- __s32 z5, z10, z11, z12, z13;
- __s16 *inptr;
- __s32 *wsptr;
- __u8 *outptr;
- int ctr;
- __s32 dcval;
- __s32 workspace[64];
-
- inptr = data;
- wsptr = workspace;
- for (ctr = 8; ctr > 0; ctr--) {
-
- if ((inptr[8] | inptr[16] | inptr[24] |
- inptr[32] | inptr[40] | inptr[48] | inptr[56]) == 0) {
- dcval = inptr[0];
- wsptr[0] = dcval;
- wsptr[8] = dcval;
- wsptr[16] = dcval;
- wsptr[24] = dcval;
- wsptr[32] = dcval;
- wsptr[40] = dcval;
- wsptr[48] = dcval;
- wsptr[56] = dcval;
-
- inptr++;
- wsptr++;
- continue;
- }
-
- tmp0 = inptr[0];
- tmp1 = inptr[16];
- tmp2 = inptr[32];
- tmp3 = inptr[48];
-
- tmp10 = tmp0 + tmp2;
- tmp11 = tmp0 - tmp2;
-
- tmp13 = tmp1 + tmp3;
- tmp12 = MULTIPLY (tmp1 - tmp3, FIX_1_414213562) - tmp13;
-
- tmp0 = tmp10 + tmp13;
- tmp3 = tmp10 - tmp13;
- tmp1 = tmp11 + tmp12;
- tmp2 = tmp11 - tmp12;
-
- tmp4 = inptr[8];
- tmp5 = inptr[24];
- tmp6 = inptr[40];
- tmp7 = inptr[56];
-
- z13 = tmp6 + tmp5;
- z10 = tmp6 - tmp5;
- z11 = tmp4 + tmp7;
- z12 = tmp4 - tmp7;
-
- tmp7 = z11 + z13;
- tmp11 = MULTIPLY (z11 - z13, FIX_1_414213562);
-
- z5 = MULTIPLY (z10 + z12, FIX_1_847759065);
- tmp10 = MULTIPLY (z12, FIX_1_082392200) - z5;
- tmp12 = MULTIPLY (z10, -FIX_2_613125930) + z5;
-
- tmp6 = tmp12 - tmp7;
- tmp5 = tmp11 - tmp6;
- tmp4 = tmp10 + tmp5;
-
- wsptr[0] = (__s32) (tmp0 + tmp7);
- wsptr[56] = (__s32) (tmp0 - tmp7);
- wsptr[8] = (__s32) (tmp1 + tmp6);
- wsptr[48] = (__s32) (tmp1 - tmp6);
- wsptr[16] = (__s32) (tmp2 + tmp5);
- wsptr[40] = (__s32) (tmp2 - tmp5);
- wsptr[32] = (__s32) (tmp3 + tmp4);
- wsptr[24] = (__s32) (tmp3 - tmp4);
-
- inptr++;
- wsptr++;
- }
-
- wsptr = workspace;
- for (ctr = 0; ctr < 8; ctr++) {
- outptr = &(odata[ctr * rskip]);
-
- tmp10 = wsptr[0] + wsptr[4];
- tmp11 = wsptr[0] - wsptr[4];
-
- tmp13 = wsptr[2] + wsptr[6];
- tmp12 = MULTIPLY (wsptr[2] - wsptr[6], FIX_1_414213562) - tmp13;
-
- tmp0 = tmp10 + tmp13;
- tmp3 = tmp10 - tmp13;
- tmp1 = tmp11 + tmp12;
- tmp2 = tmp11 - tmp12;
-
- z13 = wsptr[5] + wsptr[3];
- z10 = wsptr[5] - wsptr[3];
- z11 = wsptr[1] + wsptr[7];
- z12 = wsptr[1] - wsptr[7];
-
- tmp7 = z11 + z13;
- tmp11 = MULTIPLY (z11 - z13, FIX_1_414213562);
-
- z5 = MULTIPLY (z10 + z12, FIX_1_847759065);
- tmp10 = MULTIPLY (z12, FIX_1_082392200) - z5;
- tmp12 = MULTIPLY (z10, -FIX_2_613125930) + z5;
-
- tmp6 = tmp12 - tmp7;
- tmp5 = tmp11 - tmp6;
- tmp4 = tmp10 + tmp5;
-
- outptr[0] = RL (DESCALE (tmp0 + tmp7));
- outptr[7] = RL (DESCALE (tmp0 - tmp7));
- outptr[1] = RL (DESCALE (tmp1 + tmp6));
- outptr[6] = RL (DESCALE (tmp1 - tmp6));
- outptr[2] = RL (DESCALE (tmp2 + tmp5));
- outptr[5] = RL (DESCALE (tmp2 - tmp5));
- outptr[4] = RL (DESCALE (tmp3 + tmp4));
- outptr[3] = RL (DESCALE (tmp3 - tmp4));
-
- wsptr += 8;
- }
-#endif
-}
-
-/*
-
-Main Routines
-
-This file contains most of the initialisation and control functions
-
-(C) Justin Schoeman 1998
-
-*/
-
-/*
-
-Private function
-
-Initialise all the cache-aliged data blocks
-
-*/
-
-void
-RTjpeg_init_data (void)
-{
- unsigned long dptr;
-
- dptr = (unsigned long) &(RTjpeg_alldata[0]);
- dptr += 32;
- dptr = dptr >> 5;
- dptr = dptr << 5; /* cache align data */
-
- RTjpeg_block = (__s16 *) dptr;
- dptr += sizeof (__s16) * 64;
- RTjpeg_lqt = (__s32 *) dptr;
- dptr += sizeof (__s32) * 64;
- RTjpeg_cqt = (__s32 *) dptr;
- dptr += sizeof (__s32) * 64;
- RTjpeg_liqt = (__u32 *) dptr;
- dptr += sizeof (__u32) * 64;
- RTjpeg_ciqt = (__u32 *) dptr;
-}
-
-/*
-
-External Function
-
-Re-set quality factor
-
-Input: buf -> pointer to 128 ints for quant values store to pass back to
- init_decompress.
- Q -> quality factor (192=best, 32=worst)
-*/
-
-void
-RTjpeg_init_Q (__u8 Q)
-{
- int i;
- __u64 qual;
-
- qual = (__u64) Q << (32 - 7); /* 32 bit FP, 255=2, 0=0 */
-
- for (i = 0; i < 64; i++) {
- RTjpeg_lqt[i] =
- (__s32) ((qual / ((__u64) RTjpeg_lum_quant_tbl[i] << 16)) >> 3);
- if (RTjpeg_lqt[i] == 0)
- RTjpeg_lqt[i] = 1;
- RTjpeg_cqt[i] =
- (__s32) ((qual / ((__u64) RTjpeg_chrom_quant_tbl[i] << 16)) >> 3);
- if (RTjpeg_cqt[i] == 0)
- RTjpeg_cqt[i] = 1;
- RTjpeg_liqt[i] = (1 << 16) / (RTjpeg_lqt[i] << 3);
- RTjpeg_ciqt[i] = (1 << 16) / (RTjpeg_cqt[i] << 3);
- RTjpeg_lqt[i] = ((1 << 16) / RTjpeg_liqt[i]) >> 3;
- RTjpeg_cqt[i] = ((1 << 16) / RTjpeg_ciqt[i]) >> 3;
- }
-
- RTjpeg_lb8 = 0;
- while (RTjpeg_liqt[RTjpeg_ZZ[++RTjpeg_lb8]] <= 8);
- RTjpeg_lb8--;
- RTjpeg_cb8 = 0;
- while (RTjpeg_ciqt[RTjpeg_ZZ[++RTjpeg_cb8]] <= 8);
- RTjpeg_cb8--;
-
- RTjpeg_dct_init ();
- RTjpeg_idct_init ();
- RTjpeg_quant_init ();
-}
-
-/*
-
-External Function
-
-Initialise compression.
-
-Input: buf -> pointer to 128 ints for quant values store to pass back to
- init_decompress.
- width -> width of image
- height -> height of image
- Q -> quality factor (192=best, 32=worst)
-
-*/
-
-void
-RTjpeg_init_compress (__u32 * buf, int width, int height, __u8 Q)
-{
- int i;
- __u64 qual;
-
- RTjpeg_init_data ();
-
- RTjpeg_width = width;
- RTjpeg_height = height;
- RTjpeg_Ywidth = RTjpeg_width >> 3;
- RTjpeg_Ysize = width * height;
- RTjpeg_Cwidth = RTjpeg_width >> 4;
- RTjpeg_Csize = (width >> 1) * height;
-
- qual = (__u64) Q << (32 - 7); /* 32 bit FP, 255=2, 0=0 */
-
- for (i = 0; i < 64; i++) {
- RTjpeg_lqt[i] =
- (__s32) ((qual / ((__u64) RTjpeg_lum_quant_tbl[i] << 16)) >> 3);
- if (RTjpeg_lqt[i] == 0)
- RTjpeg_lqt[i] = 1;
- RTjpeg_cqt[i] =
- (__s32) ((qual / ((__u64) RTjpeg_chrom_quant_tbl[i] << 16)) >> 3);
- if (RTjpeg_cqt[i] == 0)
- RTjpeg_cqt[i] = 1;
- RTjpeg_liqt[i] = (1 << 16) / (RTjpeg_lqt[i] << 3);
- RTjpeg_ciqt[i] = (1 << 16) / (RTjpeg_cqt[i] << 3);
- RTjpeg_lqt[i] = ((1 << 16) / RTjpeg_liqt[i]) >> 3;
- RTjpeg_cqt[i] = ((1 << 16) / RTjpeg_ciqt[i]) >> 3;
- }
-
- RTjpeg_lb8 = 0;
- while (RTjpeg_liqt[RTjpeg_ZZ[++RTjpeg_lb8]] <= 8);
- RTjpeg_lb8--;
- RTjpeg_cb8 = 0;
- while (RTjpeg_ciqt[RTjpeg_ZZ[++RTjpeg_cb8]] <= 8);
- RTjpeg_cb8--;
-
- RTjpeg_dct_init ();
- RTjpeg_quant_init ();
-
- for (i = 0; i < 64; i++)
- buf[i] = RTjpeg_liqt[i];
- for (i = 0; i < 64; i++)
- buf[64 + i] = RTjpeg_ciqt[i];
-}
-
-void
-RTjpeg_init_decompress (__u32 * buf, int width, int height)
-{
- int i;
-
- RTjpeg_init_data ();
-
- RTjpeg_width = width;
- RTjpeg_height = height;
- RTjpeg_Ywidth = RTjpeg_width >> 3;
- RTjpeg_Ysize = width * height;
- RTjpeg_Cwidth = RTjpeg_width >> 4;
- RTjpeg_Csize = (width >> 1) * height;
-
- for (i = 0; i < 64; i++) {
- RTjpeg_liqt[i] = buf[i];
- RTjpeg_ciqt[i] = buf[i + 64];
- }
-
- RTjpeg_lb8 = 0;
- while (RTjpeg_liqt[RTjpeg_ZZ[++RTjpeg_lb8]] <= 8);
- RTjpeg_lb8--;
- RTjpeg_cb8 = 0;
- while (RTjpeg_ciqt[RTjpeg_ZZ[++RTjpeg_cb8]] <= 8);
- RTjpeg_cb8--;
-
- RTjpeg_idct_init ();
-
-/* RTjpeg_color_init(); */
-}
-
-int
-RTjpeg_compressYUV420 (__s8 * sp, unsigned char *bp)
-{
- __s8 *sb;
- register __s8 *bp1 = bp + (RTjpeg_width << 3);
- register __s8 *bp2 = bp + RTjpeg_Ysize;
- register __s8 *bp3 = bp2 + (RTjpeg_Csize >> 1);
- register int i, j, k;
-
-#ifdef HAVE_LIBMMX
- emms ();
-#endif
- sb = sp;
-/* Y */
- for (i = RTjpeg_height >> 1; i; i -= 8) {
- for (j = 0, k = 0; j < RTjpeg_width; j += 16, k += 8) {
- RTjpeg_dctY (bp + j, RTjpeg_block, RTjpeg_Ywidth);
- RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
- sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
-
- RTjpeg_dctY (bp + j + 8, RTjpeg_block, RTjpeg_Ywidth);
- RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
- sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
-
- RTjpeg_dctY (bp1 + j, RTjpeg_block, RTjpeg_Ywidth);
- RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
- sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
-
- RTjpeg_dctY (bp1 + j + 8, RTjpeg_block, RTjpeg_Ywidth);
- RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
- sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
-
- RTjpeg_dctY (bp2 + k, RTjpeg_block, RTjpeg_Cwidth);
- RTjpeg_quant (RTjpeg_block, RTjpeg_cqt);
- sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_cb8);
-
- RTjpeg_dctY (bp3 + k, RTjpeg_block, RTjpeg_Cwidth);
- RTjpeg_quant (RTjpeg_block, RTjpeg_cqt);
- sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_cb8);
-
- }
- bp += RTjpeg_width << 4;
- bp1 += RTjpeg_width << 4;
- bp2 += RTjpeg_width << 2;
- bp3 += RTjpeg_width << 2;
-
- }
-#ifdef HAVE_LIBMMX
- emms ();
-#endif
- return (sp - sb);
-}
-
-int
-RTjpeg_compressYUV422 (__s8 * sp, unsigned char *bp)
-{
- __s8 *sb;
- register __s8 *bp2 = bp + RTjpeg_Ysize;
- register __s8 *bp3 = bp2 + RTjpeg_Csize;
- register int i, j, k;
-
-#ifdef HAVE_LIBMMX
- emms ();
-#endif
- sb = sp;
-/* Y */
- for (i = RTjpeg_height; i; i -= 8) {
- for (j = 0, k = 0; j < RTjpeg_width; j += 16, k += 8) {
- RTjpeg_dctY (bp + j, RTjpeg_block, RTjpeg_Ywidth);
- RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
- sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
-
- RTjpeg_dctY (bp + j + 8, RTjpeg_block, RTjpeg_Ywidth);
- RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
- sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
-
- RTjpeg_dctY (bp2 + k, RTjpeg_block, RTjpeg_Cwidth);
- RTjpeg_quant (RTjpeg_block, RTjpeg_cqt);
- sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_cb8);
-
- RTjpeg_dctY (bp3 + k, RTjpeg_block, RTjpeg_Cwidth);
- RTjpeg_quant (RTjpeg_block, RTjpeg_cqt);
- sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_cb8);
-
- }
- bp += RTjpeg_width << 3;
- bp2 += RTjpeg_width << 2;
- bp3 += RTjpeg_width << 2;
-
- }
-#ifdef HAVE_LIBMMX
- emms ();
-#endif
- return (sp - sb);
-}
-
-int
-RTjpeg_compress8 (__s8 * sp, unsigned char *bp)
-{
- __s8 *sb;
- int i, j;
-
-#ifdef HAVE_LIBMMX
- emms ();
-#endif
-
- sb = sp;
-/* Y */
- for (i = 0; i < RTjpeg_height; i += 8) {
- for (j = 0; j < RTjpeg_width; j += 8) {
- RTjpeg_dctY (bp + j, RTjpeg_block, RTjpeg_width);
- RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
- sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
- }
- bp += RTjpeg_width;
- }
-
-#ifdef HAVE_LIBMMX
- emms ();
-#endif
- return (sp - sb);
-}
-
-void
-RTjpeg_decompressYUV422 (__s8 * sp, __u8 * bp)
-{
- register __s8 *bp2 = bp + RTjpeg_Ysize;
- register __s8 *bp3 = bp2 + (RTjpeg_Csize);
- int i, j, k;
-
-#ifdef HAVE_LIBMMX
- emms ();
-#endif
-
-/* Y */
- for (i = RTjpeg_height; i; i -= 8) {
- for (k = 0, j = 0; j < RTjpeg_width; j += 16, k += 8) {
- if (*sp == -1)
- sp++;
- else {
- sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
- RTjpeg_idct (bp + j, RTjpeg_block, RTjpeg_width);
- }
- if (*sp == -1)
- sp++;
- else {
- sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
- RTjpeg_idct (bp + j + 8, RTjpeg_block, RTjpeg_width);
- }
- if (*sp == -1)
- sp++;
- else {
- sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt);
- RTjpeg_idct (bp2 + k, RTjpeg_block, RTjpeg_width >> 1);
- }
- if (*sp == -1)
- sp++;
- else {
- sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt);
- RTjpeg_idct (bp3 + k, RTjpeg_block, RTjpeg_width >> 1);
- }
- }
- bp += RTjpeg_width << 3;
- bp2 += RTjpeg_width << 2;
- bp3 += RTjpeg_width << 2;
- }
-#ifdef HAVE_LIBMMX
- emms ();
-#endif
-}
-
-void
-RTjpeg_decompressYUV420 (__s8 * sp, __u8 * bp)
-{
- register __s8 *bp1 = bp + (RTjpeg_width << 3);
- register __s8 *bp2 = bp + RTjpeg_Ysize;
- register __s8 *bp3 = bp2 + (RTjpeg_Csize >> 1);
- int i, j, k;
-
-#ifdef HAVE_LIBMMX
- emms ();
-#endif
-
-/* Y */
- for (i = RTjpeg_height >> 1; i; i -= 8) {
- for (k = 0, j = 0; j < RTjpeg_width; j += 16, k += 8) {
- if (*sp == -1)
- sp++;
- else {
- sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
- RTjpeg_idct (bp + j, RTjpeg_block, RTjpeg_width);
- }
- if (*sp == -1)
- sp++;
- else {
- sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
- RTjpeg_idct (bp + j + 8, RTjpeg_block, RTjpeg_width);
- }
- if (*sp == -1)
- sp++;
- else {
- sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
- RTjpeg_idct (bp1 + j, RTjpeg_block, RTjpeg_width);
- }
- if (*sp == -1)
- sp++;
- else {
- sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
- RTjpeg_idct (bp1 + j + 8, RTjpeg_block, RTjpeg_width);
- }
- if (*sp == -1)
- sp++;
- else {
- sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt);
- RTjpeg_idct (bp2 + k, RTjpeg_block, RTjpeg_width >> 1);
- }
- if (*sp == -1)
- sp++;
- else {
- sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt);
- RTjpeg_idct (bp3 + k, RTjpeg_block, RTjpeg_width >> 1);
- }
- }
- bp += RTjpeg_width << 4;
- bp1 += RTjpeg_width << 4;
- bp2 += RTjpeg_width << 2;
- bp3 += RTjpeg_width << 2;
- }
-#ifdef HAVE_LIBMMX
- emms ();
-#endif
-}
-
-void
-RTjpeg_decompress8 (__s8 * sp, __u8 * bp)
-{
- int i, j;
-
-#ifdef HAVE_LIBMMX
- emms ();
-#endif
-
-/* Y */
- for (i = 0; i < RTjpeg_height; i += 8) {
- for (j = 0; j < RTjpeg_width; j += 8)
- if (*sp == -1)
- sp++;
- else {
- sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
- RTjpeg_idct (bp + j, RTjpeg_block, RTjpeg_width);
- }
- bp += RTjpeg_width << 3;
- }
-}
-
-/*
-External Function
-
-Initialise additional data structures for motion compensation
-
-*/
-
-void
-RTjpeg_init_mcompress (void)
-{
- unsigned long tmp;
-
- if (!RTjpeg_old) {
- RTjpeg_old = malloc ((4 * RTjpeg_width * RTjpeg_height) + 32);
- tmp = (unsigned long) RTjpeg_old;
- tmp += 32;
- tmp = tmp >> 5;
- RTjpeg_old = (__s16 *) (tmp << 5);
- }
- if (!RTjpeg_old) {
- fprintf (stderr, "RTjpeg: Could not allocate memory\n");
- exit (-1);
- }
- memset (RTjpeg_old, 0, ((4 * RTjpeg_width * RTjpeg_height)));
-}
-
-#ifdef HAVE_LIBMMX
-
-int
-RTjpeg_bcomp (__s16 * old, mmx_t * mask)
-{
- int i;
- mmx_t *mold = (mmx_t *) old;
- mmx_t *mblock = (mmx_t *) RTjpeg_block;
- mmx_t result;
- static mmx_t neg = (mmx_t) (unsigned long long) 0xffffffffffffffffULL;
-
- movq_m2r (*mask, mm7);
- movq_m2r (neg, mm6);
- pxor_r2r (mm5, mm5);
-
- for (i = 0; i < 8; i++) {
- movq_m2r (*(mblock++), mm0);
- movq_m2r (*(mblock++), mm2);
- movq_m2r (*(mold++), mm1);
- movq_m2r (*(mold++), mm3);
- psubsw_r2r (mm1, mm0);
- psubsw_r2r (mm3, mm2);
- movq_r2r (mm0, mm1);
- movq_r2r (mm2, mm3);
- pcmpgtw_r2r (mm7, mm0);
- pcmpgtw_r2r (mm7, mm2);
- pxor_r2r (mm6, mm1);
- pxor_r2r (mm6, mm3);
- pcmpgtw_r2r (mm7, mm1);
- pcmpgtw_r2r (mm7, mm3);
- por_r2r (mm0, mm5);
- por_r2r (mm2, mm5);
- por_r2r (mm1, mm5);
- por_r2r (mm3, mm5);
- }
- movq_r2m (mm5, result);
-
- if (result.q) {
- if (!RTjpeg_mtest)
- for (i = 0; i < 16; i++)
- ((__u64 *) old)[i] = ((__u64 *) RTjpeg_block)[i];
- return 0;
- }
-/* printf("."); */
- return 1;
-}
-
-#else
-int
-RTjpeg_bcomp (__s16 * old, __u16 * mask)
-{
- int i;
-
- for (i = 0; i < 64; i++)
- if (abs (old[i] - RTjpeg_block[i]) > *mask) {
- if (!RTjpeg_mtest)
- for (i = 0; i < 16; i++)
- ((__u64 *) old)[i] = ((__u64 *) RTjpeg_block)[i];
- return 0;
- }
- return 1;
-}
-#endif
-
-void
-RTjpeg_set_test (int i)
-{
- RTjpeg_mtest = i;
-}
-
-int
-RTjpeg_mcompress (__s8 * sp, unsigned char *bp, __u16 lmask, __u16 cmask)
-{
- __s8 *sb;
- __s16 *block;
- register __s8 *bp2;
- register __s8 *bp3;
- register int i, j, k;
-
-#ifdef HAVE_LIBMMX
- emms ();
- RTjpeg_lmask =
- (mmx_t) (((__u64) lmask << 48) | ((__u64) lmask << 32) | ((__u64) lmask <<
- 16) | lmask);
- RTjpeg_cmask =
- (mmx_t) (((__u64) cmask << 48) | ((__u64) cmask << 32) | ((__u64) cmask <<
- 16) | cmask);
-#else
- RTjpeg_lmask = lmask;
- RTjpeg_cmask = cmask;
-#endif
-
- bp = bp - RTjpeg_width * 0;
- bp2 = bp + RTjpeg_Ysize - RTjpeg_width * 0;
- bp3 = bp2 + RTjpeg_Csize;
-
- sb = sp;
- block = RTjpeg_old;
-/* Y */
- for (i = RTjpeg_height; i; i -= 8) {
- for (j = 0, k = 0; j < RTjpeg_width; j += 16, k += 8) {
- RTjpeg_dctY (bp + j, RTjpeg_block, RTjpeg_Ywidth);
- RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
- if (RTjpeg_bcomp (block, &RTjpeg_lmask)) {
- *((__u8 *) sp++) = 255;
- } else
- sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
- block += 64;
-
- RTjpeg_dctY (bp + j + 8, RTjpeg_block, RTjpeg_Ywidth);
- RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
- if (RTjpeg_bcomp (block, &RTjpeg_lmask)) {
- *((__u8 *) sp++) = 255;
- } else
- sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
- block += 64;
-
- RTjpeg_dctY (bp2 + k, RTjpeg_block, RTjpeg_Cwidth);
- RTjpeg_quant (RTjpeg_block, RTjpeg_cqt);
- if (RTjpeg_bcomp (block, &RTjpeg_cmask)) {
- *((__u8 *) sp++) = 255;
- } else
- sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_cb8);
- block += 64;
-
- RTjpeg_dctY (bp3 + k, RTjpeg_block, RTjpeg_Cwidth);
- RTjpeg_quant (RTjpeg_block, RTjpeg_cqt);
- if (RTjpeg_bcomp (block, &RTjpeg_cmask)) {
- *((__u8 *) sp++) = 255;
- } else
- sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_cb8);
- block += 64;
-
- }
- bp += RTjpeg_width << 3;
- bp2 += RTjpeg_width << 2;
- bp3 += RTjpeg_width << 2;
- }
- /*printf ("%d\n", block - RTjpeg_old); */
-#ifdef HAVE_LIBMMX
- emms ();
-#endif
- return (sp - sb);
-}
-
-int
-RTjpeg_mcompress8 (__s8 * sp, unsigned char *bp, __u16 lmask)
-{
- __s8 *sb;
- __s16 *block;
- int i, j;
-
-#ifdef HAVE_LIBMMX
- emms ();
- RTjpeg_lmask =
- (mmx_t) (((__u64) lmask << 48) | ((__u64) lmask << 32) | ((__u64) lmask <<
- 16) | lmask);
-#else
- RTjpeg_lmask = lmask;
-#endif
-
-
- sb = sp;
- block = RTjpeg_old;
-/* Y */
- for (i = 0; i < RTjpeg_height; i += 8) {
- for (j = 0; j < RTjpeg_width; j += 8) {
- RTjpeg_dctY (bp + j, RTjpeg_block, RTjpeg_width);
- RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
- if (RTjpeg_bcomp (block, &RTjpeg_lmask)) {
- *((__u8 *) sp++) = 255;
-/* printf("* %d ", sp[-1]); */
- } else
- sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
- block += 64;
- }
- bp += RTjpeg_width << 3;
- }
-#ifdef HAVE_LIBMMX
- emms ();
-#endif
- return (sp - sb);
-}
-
-void
-RTjpeg_color_init (void)
-{
-}
-
-#define KcrR 76284
-#define KcrG 53281
-#define KcbG 25625
-#define KcbB 132252
-#define Ky 76284
-
-void
-RTjpeg_yuv422rgb (__u8 * buf, __u8 * rgb)
-{
- int tmp;
- int i, j;
- __s32 y, crR, crG, cbG, cbB;
- __u8 *bufcr, *bufcb, *bufy, *bufoute;
- int yskip;
-
- yskip = RTjpeg_width;
-
- bufcb = &buf[RTjpeg_width * RTjpeg_height];
- bufcr =
- &buf[RTjpeg_width * RTjpeg_height + (RTjpeg_width * RTjpeg_height) / 2];
- bufy = &buf[0];
- bufoute = rgb;
-
- for (i = 0; i < (RTjpeg_height); i++) {
- for (j = 0; j < RTjpeg_width; j += 2) {
- crR = (*bufcr - 128) * KcrR;
- crG = (*(bufcr++) - 128) * KcrG;
- cbG = (*bufcb - 128) * KcbG;
- cbB = (*(bufcb++) - 128) * KcbB;
-
- y = (bufy[j] - 16) * Ky;
-
- tmp = (y + crR) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y - crG - cbG) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y + cbB) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
-
- y = (bufy[j + 1] - 16) * Ky;
-
- tmp = (y + crR) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y - crG - cbG) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y + cbB) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
-
- }
- bufy += yskip;
- }
-}
-
-
-void
-RTjpeg_yuv420rgb (__u8 * buf, __u8 * rgb)
-{
- int tmp;
- int i, j;
- __s32 y, crR, crG, cbG, cbB;
- __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto;
- int oskip, yskip;
-
- oskip = RTjpeg_width * 3;
- yskip = RTjpeg_width;
-
- bufcb = &buf[RTjpeg_width * RTjpeg_height];
- bufcr =
- &buf[RTjpeg_width * RTjpeg_height + (RTjpeg_width * RTjpeg_height) / 4];
- bufy = &buf[0];
- bufoute = rgb;
- bufouto = rgb + oskip;
-
- for (i = 0; i < (RTjpeg_height >> 1); i++) {
- for (j = 0; j < RTjpeg_width; j += 2) {
- crR = (*bufcr - 128) * KcrR;
- crG = (*(bufcr++) - 128) * KcrG;
- cbG = (*bufcb - 128) * KcbG;
- cbB = (*(bufcb++) - 128) * KcbB;
-
- y = (bufy[j] - 16) * Ky;
-
- tmp = (y + crR) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y - crG - cbG) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y + cbB) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
-
- y = (bufy[j + 1] - 16) * Ky;
-
- tmp = (y + crR) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y - crG - cbG) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y + cbB) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
-
- y = (bufy[j + yskip] - 16) * Ky;
-
- tmp = (y + crR) >> 16;
- *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y - crG - cbG) >> 16;
- *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y + cbB) >> 16;
- *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
-
- y = (bufy[j + 1 + yskip] - 16) * Ky;
-
- tmp = (y + crR) >> 16;
- *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y - crG - cbG) >> 16;
- *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y + cbB) >> 16;
- *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
-
- }
- bufoute += oskip;
- bufouto += oskip;
- bufy += yskip << 1;
- }
-}
-
-
-void
-RTjpeg_yuvrgb32 (__u8 * buf, __u8 * rgb)
-{
- int tmp;
- int i, j;
- __s32 y, crR, crG, cbG, cbB;
- __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto;
- int oskip, yskip;
-
- oskip = RTjpeg_width * 4;
- yskip = RTjpeg_width;
-
- bufcb = &buf[RTjpeg_width * RTjpeg_height];
- bufcr =
- &buf[RTjpeg_width * RTjpeg_height + (RTjpeg_width * RTjpeg_height) / 2];
- bufy = &buf[0];
- bufoute = rgb;
- bufouto = rgb + oskip;
-
- for (i = 0; i < (RTjpeg_height >> 1); i++) {
- for (j = 0; j < RTjpeg_width; j += 2) {
- crR = (*bufcr - 128) * KcrR;
- crG = (*(bufcr++) - 128) * KcrG;
- cbG = (*bufcb - 128) * KcbG;
- cbB = (*(bufcb++) - 128) * KcbB;
-
- y = (bufy[j] - 16) * Ky;
-
- tmp = (y + cbB) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y - crG - cbG) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y + crR) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- bufoute++;
-
- y = (bufy[j + 1] - 16) * Ky;
-
- tmp = (y + cbB) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y - crG - cbG) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y + crR) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- bufoute++;
-
- y = (bufy[j + yskip] - 16) * Ky;
-
- tmp = (y + cbB) >> 16;
- *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y - crG - cbG) >> 16;
- *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y + crR) >> 16;
- *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- bufouto++;
-
- y = (bufy[j + 1 + yskip] - 16) * Ky;
-
- tmp = (y + cbB) >> 16;
- *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y - crG - cbG) >> 16;
- *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y + crR) >> 16;
- *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- bufouto++;
-
- }
- bufoute += oskip;
- bufouto += oskip;
- bufy += yskip << 1;
- }
-}
-
-void
-RTjpeg_yuvrgb24 (__u8 * buf, __u8 * rgb)
-{
- int tmp;
- int i, j;
- __s32 y, crR, crG, cbG, cbB;
- __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto;
- int oskip, yskip;
-
- oskip = RTjpeg_width * 3;
- yskip = RTjpeg_width;
-
- bufcb = &buf[RTjpeg_width * RTjpeg_height];
- bufcr =
- &buf[RTjpeg_width * RTjpeg_height + (RTjpeg_width * RTjpeg_height) / 4];
- bufy = &buf[0];
- bufoute = rgb;
- bufouto = rgb + oskip;
-
- for (i = 0; i < (RTjpeg_height >> 1); i++) {
- for (j = 0; j < RTjpeg_width; j += 2) {
- crR = (*bufcr - 128) * KcrR;
- crG = (*(bufcr++) - 128) * KcrG;
- cbG = (*bufcb - 128) * KcbG;
- cbB = (*(bufcb++) - 128) * KcbB;
-
- y = (bufy[j] - 16) * Ky;
-
- tmp = (y + cbB) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y - crG - cbG) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y + crR) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
-
- y = (bufy[j + 1] - 16) * Ky;
-
- tmp = (y + cbB) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y - crG - cbG) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y + crR) >> 16;
- *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
-
- y = (bufy[j + yskip] - 16) * Ky;
-
- tmp = (y + cbB) >> 16;
- *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y - crG - cbG) >> 16;
- *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y + crR) >> 16;
- *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
-
- y = (bufy[j + 1 + yskip] - 16) * Ky;
-
- tmp = (y + cbB) >> 16;
- *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y - crG - cbG) >> 16;
- *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y + crR) >> 16;
- *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
-
- }
- bufoute += oskip;
- bufouto += oskip;
- bufy += yskip << 1;
- }
-}
-
-void
-RTjpeg_yuvrgb16 (__u8 * buf, __u8 * rgb)
-{
- int tmp;
- int i, j;
- __s32 y, crR, crG, cbG, cbB;
- __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto;
- int oskip, yskip;
- unsigned char r, g, b;
-
- oskip = RTjpeg_width * 2;
- yskip = RTjpeg_width;
-
- bufcb = &buf[RTjpeg_width * RTjpeg_height];
- bufcr =
- &buf[RTjpeg_width * RTjpeg_height + (RTjpeg_width * RTjpeg_height) / 4];
- bufy = &buf[0];
- bufoute = rgb;
- bufouto = rgb + oskip;
-
- for (i = 0; i < (RTjpeg_height >> 1); i++) {
- for (j = 0; j < RTjpeg_width; j += 2) {
- crR = (*bufcr - 128) * KcrR;
- crG = (*(bufcr++) - 128) * KcrG;
- cbG = (*bufcb - 128) * KcbG;
- cbB = (*(bufcb++) - 128) * KcbB;
-
- y = (bufy[j] - 16) * Ky;
-
- tmp = (y + cbB) >> 16;
- b = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y - crG - cbG) >> 16;
- g = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y + crR) >> 16;
- r = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (int) ((int) b >> 3);
- tmp |= (int) (((int) g >> 2) << 5);
- tmp |= (int) (((int) r >> 3) << 11);
- *(bufoute++) = tmp & 0xff;
- *(bufoute++) = tmp >> 8;
-
-
- y = (bufy[j + 1] - 16) * Ky;
-
- tmp = (y + cbB) >> 16;
- b = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y - crG - cbG) >> 16;
- g = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y + crR) >> 16;
- r = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (int) ((int) b >> 3);
- tmp |= (int) (((int) g >> 2) << 5);
- tmp |= (int) (((int) r >> 3) << 11);
- *(bufoute++) = tmp & 0xff;
- *(bufoute++) = tmp >> 8;
-
- y = (bufy[j + yskip] - 16) * Ky;
-
- tmp = (y + cbB) >> 16;
- b = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y - crG - cbG) >> 16;
- g = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y + crR) >> 16;
- r = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (int) ((int) b >> 3);
- tmp |= (int) (((int) g >> 2) << 5);
- tmp |= (int) (((int) r >> 3) << 11);
- *(bufouto++) = tmp & 0xff;
- *(bufouto++) = tmp >> 8;
-
- y = (bufy[j + 1 + yskip] - 16) * Ky;
-
- tmp = (y + cbB) >> 16;
- b = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y - crG - cbG) >> 16;
- g = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (y + crR) >> 16;
- r = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
- tmp = (int) ((int) b >> 3);
- tmp |= (int) (((int) g >> 2) << 5);
- tmp |= (int) (((int) r >> 3) << 11);
- *(bufouto++) = tmp & 0xff;
- *(bufouto++) = tmp >> 8;
-
- }
- bufoute += oskip;
- bufouto += oskip;
- bufy += yskip << 1;
- }
-}
-
-void
-RTjpeg_yuvrgb8 (__u8 * buf, __u8 * rgb)
-{
- memcpy (rgb, buf, RTjpeg_width * RTjpeg_height);
-}
-
-void
-RTjpeg_double32 (__u32 * buf)
-{
- int i, j;
-
- __u32 *iptr, *optr1, *optr2;
-
- iptr = buf + (RTjpeg_width * RTjpeg_height) - 1;
- optr1 = buf + (RTjpeg_width * RTjpeg_height * 4) - 1;
- optr2 = optr1 - (2 * RTjpeg_width);
-
- for (i = 0; i < RTjpeg_height; i++) {
- for (j = 0; j < RTjpeg_width; j++) {
- *(optr1--) = *iptr;
- *(optr1--) = *iptr;
- *(optr2--) = *iptr;
- *(optr2--) = *(iptr--);
- }
- optr2 = optr2 - 2 * RTjpeg_width;
- optr1 = optr1 - 2 * RTjpeg_width;
- }
-}
-
-void
-RTjpeg_double24 (__u8 * buf)
-{
-}
-
-void
-RTjpeg_double16 (__u16 * buf)
-{
- int i, j;
-
- __u16 *iptr, *optr1, *optr2;
-
- iptr = buf + (RTjpeg_width * RTjpeg_height) - 1;
- optr1 = buf + (RTjpeg_width * RTjpeg_height * 4) - 1;
- optr2 = optr1 - (2 * RTjpeg_width);
-
- for (i = 0; i < RTjpeg_height; i++) {
- for (j = 0; j < RTjpeg_width; j++) {
- *(optr1--) = *iptr;
- *(optr1--) = *iptr;
- *(optr2--) = *iptr;
- *(optr2--) = *(iptr--);
- }
- optr2 = optr2 - 2 * RTjpeg_width;
- optr1 = optr1 - 2 * RTjpeg_width;
- }
-}
-
-void
-RTjpeg_double8 (__u8 * buf)
-{
- int i, j;
-
- __u8 *iptr, *optr1, *optr2;
-
- iptr = buf + (RTjpeg_width * RTjpeg_height) - 1;
- optr1 = buf + (RTjpeg_width * RTjpeg_height * 4) - 1;
- optr2 = optr1 - (2 * RTjpeg_width);
-
- for (i = 0; i < RTjpeg_height; i++) {
- for (j = 0; j < RTjpeg_width; j++) {
- *(optr1--) = *iptr;
- *(optr1--) = *iptr;
- *(optr2--) = *iptr;
- *(optr2--) = *(iptr--);
- }
- optr2 = optr2 - 2 * RTjpeg_width;
- optr1 = optr1 - 2 * RTjpeg_width;
- }
-}
diff --git a/gst/rtjpeg/RTjpeg.h b/gst/rtjpeg/RTjpeg.h
deleted file mode 100644
index a2d0dc754..000000000
--- a/gst/rtjpeg/RTjpeg.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- bttvgrab 0.15.4 [1999-03-23]
- (c) 1998, 1999 by Joerg Walter <trouble@moes.pmnet.uni-oldenburg.de>
- Maintained by: Joerg Walter
- Current version at http://moes.pmnet.uni-oldenburg.de/bttvgrab/
-
- This program 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 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
- This file is a modified version of RTjpeg 0.1.2, (C) Justin Schoeman 1998
-*/
-
-#include <inttypes.h>
-
-typedef uint8_t __u8;
-typedef uint32_t __u32;
-typedef int8_t __s8;
-typedef uint16_t __u16;
-
-extern void RTjpeg_init_Q(__u8 Q);
-extern void RTjpeg_init_compress(long unsigned int *buf, int width, int height, __u8 Q);
-extern void RTjpeg_init_decompress(long unsigned int *buf, int width, int height);
-extern int RTjpeg_compressYUV420(__s8 *sp, unsigned char *bp);
-extern int RTjpeg_compressYUV422(__s8 *sp, unsigned char *bp);
-extern void RTjpeg_decompressYUV420(__s8 *sp, __u8 *bp);
-extern void RTjpeg_decompressYUV422(__s8 *sp, __u8 *bp);
-extern int RTjpeg_compress8(__s8 *sp, unsigned char *bp);
-extern void RTjpeg_decompress8(__s8 *sp, __u8 *bp);
-
-extern void RTjpeg_init_mcompress(void);
-extern int RTjpeg_mcompress(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask);
-extern int RTjpeg_mcompress8(__s8 *sp, unsigned char *bp, __u16 lmask);
-extern void RTjpeg_set_test(int i);
-
-extern void RTjpeg_yuv420rgb(__u8 *buf, __u8 *rgb);
-extern void RTjpeg_yuv422rgb(__u8 *buf, __u8 *rgb);
-extern void RTjpeg_yuvrgb8(__u8 *buf, __u8 *rgb);
-extern void RTjpeg_yuvrgb16(__u8 *buf, __u8 *rgb);
-extern void RTjpeg_yuvrgb24(__u8 *buf, __u8 *rgb);
-extern void RTjpeg_yuvrgb32(__u8 *buf, __u8 *rgb);
-
diff --git a/gst/rtjpeg/gstrtjpeg.c b/gst/rtjpeg/gstrtjpeg.c
deleted file mode 100644
index dbb7b00b9..000000000
--- a/gst/rtjpeg/gstrtjpeg.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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstrtjpegenc.h"
-#include "gstrtjpegdec.h"
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- if (!gst_element_register (plugin, "rtjpegenc",
- GST_RANK_NONE, GST_TYPE_RTJPEGENC) ||
- !gst_element_register (plugin, "rtjpegdec",
- GST_RANK_NONE, GST_TYPE_RTJPEGDEC))
- return FALSE;
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- rtjpeg,
- "Justin Schoeman's RTjpeg codec",
- plugin_init, VERSION, "GPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/rtjpeg/gstrtjpegdec.c b/gst/rtjpeg/gstrtjpegdec.c
deleted file mode 100644
index a03f15986..000000000
--- a/gst/rtjpeg/gstrtjpegdec.c
+++ /dev/null
@@ -1,123 +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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "gstrtjpegdec.h"
-
-/* GstRTJpegDec signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-enum
-{
- PROP_0,
-};
-
-
-static void gst_rtjpegdec_class_init (GstRTJpegDecClass * klass);
-static void gst_rtjpegdec_base_init (GstRTJpegDecClass * klass);
-static void gst_rtjpegdec_init (GstRTJpegDec * rtjpegdec);
-
-static void gst_rtjpegdec_chain (GstPad * pad, GstData * _data);
-
-static GstElementClass *parent_class = NULL;
-
-/*static guint gst_rtjpegdec_signals[LAST_SIGNAL] = { 0 }; */
-
-GType
-gst_rtjpegdec_get_type (void)
-{
- static GType rtjpegdec_type = 0;
-
- if (!rtjpegdec_type) {
- static const GTypeInfo rtjpegdec_info = {
- sizeof (GstRTJpegDecClass),
- (GBaseInitFunc) gst_rtjpegdec_base_init,
- NULL,
- (GClassInitFunc) gst_rtjpegdec_class_init,
- NULL,
- NULL,
- sizeof (GstRTJpegDec),
- 0,
- (GInstanceInitFunc) gst_rtjpegdec_init,
- };
-
- rtjpegdec_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstRTJpegDec",
- &rtjpegdec_info, 0);
- }
- return rtjpegdec_type;
-}
-
-static void
-gst_rtjpegdec_base_init (GstRTJpegDecClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_set_static_metadata (element_class, "RTjpeg video decoder",
- "Codec/Decoder/Video",
- "Decodes video in RTjpeg format", "Erik Walthinsen <omega@cse.ogi.edu>");
-}
-
-static void
-gst_rtjpegdec_class_init (GstRTJpegDecClass * klass)
-{
- GstElementClass *gstelement_class;
-
- gstelement_class = (GstElementClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-}
-
-static void
-gst_rtjpegdec_init (GstRTJpegDec * rtjpegdec)
-{
- rtjpegdec->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
- gst_element_add_pad (GST_ELEMENT (rtjpegdec), rtjpegdec->sinkpad);
- gst_pad_set_chain_function (rtjpegdec->sinkpad, gst_rtjpegdec_chain);
- rtjpegdec->srcpad = gst_pad_new ("src", GST_PAD_SRC);
- gst_element_add_pad (GST_ELEMENT (rtjpegdec), rtjpegdec->srcpad);
-}
-
-static void
-gst_rtjpegdec_chain (GstPad * pad, GstData * _data)
-{
- GstBuffer *buf = GST_BUFFER (_data);
- GstRTJpegDec *rtjpegdec;
- guchar *data;
- gulong size;
-
- g_return_if_fail (pad != NULL);
- g_return_if_fail (GST_IS_PAD (pad));
- g_return_if_fail (buf != NULL);
-
- rtjpegdec = GST_RTJPEGDEC (GST_OBJECT_PARENT (pad));
- data = GST_BUFFER_DATA (buf);
- size = GST_BUFFER_SIZE (buf);
-
- g_warning ("would be encoding frame here\n");
-
- gst_pad_push (rtjpegdec->srcpad, GST_DATA (buf));
-}
diff --git a/gst/rtjpeg/gstrtjpegdec.h b/gst/rtjpeg/gstrtjpegdec.h
deleted file mode 100644
index 132487915..000000000
--- a/gst/rtjpeg/gstrtjpegdec.h
+++ /dev/null
@@ -1,70 +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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifndef __RTJPEGDEC_H__
-#define __RTJPEGDEC_H__
-
-
-#include <gst/gst.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GST_TYPE_RTJPEGDEC \
- (gst_rtjpegdec_get_type())
-#define GST_RTJPEGDEC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTJPEGDEC,GstRTJpegDec))
-#define GST_RTJPEGDEC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTJPEGDEC,GstRTJpegDecClass))
-#define GST_IS_RTJPEGDEC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTJPEGDEC))
-#define GST_IS_RTJPEGDEC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTJPEGDEC)))
-
-typedef struct _GstRTJpegDec GstRTJpegDec;
-typedef struct _GstRTJpegDecClass GstRTJpegDecClass;
-
-struct _GstRTJpegDec {
- GstElement element;
-
- GstPad *sinkpad,*srcpad;
-
- gint width,height;
- gint quality;
- gint quant[128];
-
-};
-
-struct _GstRTJpegDecClass {
- GstElementClass parent_class;
-};
-
-GType gst_rtjpegdec_get_type(void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __RTJPEGDEC_H__ */
diff --git a/gst/rtjpeg/gstrtjpegenc.c b/gst/rtjpeg/gstrtjpegenc.c
deleted file mode 100644
index 6bafb02ba..000000000
--- a/gst/rtjpeg/gstrtjpegenc.c
+++ /dev/null
@@ -1,123 +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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "gstrtjpegenc.h"
-
-/* GstRTJpegEnc signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-enum
-{
- PROP_0,
-};
-
-
-static void gst_rtjpegenc_class_init (GstRTJpegEncClass * klass);
-static void gst_rtjpegenc_base_init (GstRTJpegEncClass * klass);
-static void gst_rtjpegenc_init (GstRTJpegEnc * rtjpegenc);
-
-static void gst_rtjpegenc_chain (GstPad * pad, GstData * _data);
-
-static GstElementClass *parent_class = NULL;
-
-/*static guint gst_rtjpegenc_signals[LAST_SIGNAL] = { 0 }; */
-
-GType
-gst_rtjpegenc_get_type (void)
-{
- static GType rtjpegenc_type = 0;
-
- if (!rtjpegenc_type) {
- static const GTypeInfo rtjpegenc_info = {
- sizeof (GstRTJpegEncClass),
- (GBaseInitFunc) gst_rtjpegenc_base_init,
- NULL,
- (GClassInitFunc) gst_rtjpegenc_class_init,
- NULL,
- NULL,
- sizeof (GstRTJpegEnc),
- 0,
- (GInstanceInitFunc) gst_rtjpegenc_init,
- };
-
- rtjpegenc_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstRTJpegEnc",
- &rtjpegenc_info, 0);
- }
- return rtjpegenc_type;
-}
-
-static void
-gst_rtjpegenc_base_init (GstRTJpegEncClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_set_static_metadata (element_class, "RTjpeg video encoder",
- "Codec/Encoder/Video",
- "Encodes video in RTjpeg format", "Erik Walthinsen <omega@cse.ogi.edu>");
-}
-
-static void
-gst_rtjpegenc_class_init (GstRTJpegEncClass * klass)
-{
- GstElementClass *gstelement_class;
-
- gstelement_class = (GstElementClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-}
-
-static void
-gst_rtjpegenc_init (GstRTJpegEnc * rtjpegenc)
-{
- rtjpegenc->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
- gst_element_add_pad (GST_ELEMENT (rtjpegenc), rtjpegenc->sinkpad);
- gst_pad_set_chain_function (rtjpegenc->sinkpad, gst_rtjpegenc_chain);
- rtjpegenc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
- gst_element_add_pad (GST_ELEMENT (rtjpegenc), rtjpegenc->srcpad);
-}
-
-static void
-gst_rtjpegenc_chain (GstPad * pad, GstData * _data)
-{
- GstBuffer *buf = GST_BUFFER (_data);
- GstRTJpegEnc *rtjpegenc;
- guchar *data;
- gulong size;
-
- g_return_if_fail (pad != NULL);
- g_return_if_fail (GST_IS_PAD (pad));
- g_return_if_fail (buf != NULL);
-
- rtjpegenc = GST_RTJPEGENC (GST_OBJECT_PARENT (pad));
- data = GST_BUFFER_DATA (buf);
- size = GST_BUFFER_SIZE (buf);
-
- g_warning ("would be encoding frame here\n");
-
- gst_pad_push (rtjpegenc->srcpad, GST_DATA (buf));
-}
diff --git a/gst/rtjpeg/gstrtjpegenc.h b/gst/rtjpeg/gstrtjpegenc.h
deleted file mode 100644
index 9d81037d1..000000000
--- a/gst/rtjpeg/gstrtjpegenc.h
+++ /dev/null
@@ -1,71 +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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifndef __RTJPEGENC_H__
-#define __RTJPEGENC_H__
-
-
-#include <gst/gst.h>
-
-#include "RTjpeg.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GST_TYPE_RTJPEGENC \
- (gst_rtjpegenc_get_type())
-#define GST_RTJPEGENC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTJPEGENC,GstRTJpegEnc))
-#define GST_RTJPEGENC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTJPEGENC,GstRTJpegEncClass))
-#define GST_IS_RTJPEGENC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTJPEGENC))
-#define GST_IS_RTJPEGENC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTJPEGENC))
-
-typedef struct _GstRTJpegEnc GstRTJpegEnc;
-typedef struct _GstRTJpegEncClass GstRTJpegEncClass;
-
-struct _GstRTJpegEnc {
- GstElement element;
-
- GstPad *sinkpad,*srcpad;
-
- gint width,height;
- gint quality;
- gint quant[128];
-};
-
-struct _GstRTJpegEncClass {
- GstElementClass parent_class;
-};
-
-GType gst_rtjpegenc_get_type(void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __RTJPEGENC_H__ */
diff --git a/gst/rtjpeg/meson.build b/gst/rtjpeg/meson.build
deleted file mode 100644
index e583baf83..000000000
--- a/gst/rtjpeg/meson.build
+++ /dev/null
@@ -1,15 +0,0 @@
-rtjpeg_sources = [
- 'gstrtjpeg.c',
- 'gstrtjpegenc.c',
- 'gstrtjpegdec.c',
- 'RTjpeg.c',
-]
-
-gstrtjpeg = library('gstrtjpeg',
- rtjpeg_sources,
- c_args : gst_plugins_bad_args,
- include_directories : [configinc],
- dependencies : [gstbase_dep],
- install : true,
- install_dir : plugins_install_dir,
-)
diff --git a/gst/sdi/Makefile.am b/gst/sdi/Makefile.am
deleted file mode 100644
index 04744fa93..000000000
--- a/gst/sdi/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-plugin_LTLIBRARIES = libgstsdi.la
-
-libgstsdi_la_SOURCES = gstsdi.c \
- gstsdidemux.c \
- gstsdimux.c
-
-libgstsdi_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-libgstsdi_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) \
- $(GST_LIBS)
-libgstsdi_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstsdi_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-noinst_HEADERS = gstsdidemux.h gstsdimux.h
diff --git a/gst/sdi/gstsdi.c b/gst/sdi/gstsdi.c
deleted file mode 100644
index 5d5130169..000000000
--- a/gst/sdi/gstsdi.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* GStreamer
- * Copyright (C) 2010 David Schleef <ds@schleef.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstsdidemux.h"
-#include "gstsdimux.h"
-
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-
- gst_element_register (plugin, "sdidemux", GST_RANK_NONE,
- gst_sdi_demux_get_type ());
- gst_element_register (plugin, "sdimux", GST_RANK_NONE,
- gst_sdi_mux_get_type ());
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- sdi,
- "SDI elements", plugin_init, VERSION, "LGPL", PACKAGE_NAME,
- GST_PACKAGE_ORIGIN)
diff --git a/gst/sdi/gstsdidemux.c b/gst/sdi/gstsdidemux.c
deleted file mode 100644
index 70184f478..000000000
--- a/gst/sdi/gstsdidemux.c
+++ /dev/null
@@ -1,537 +0,0 @@
-/* GStreamer
- * Copyright (C) 2010 David Schleef <ds@schleef.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-/**
- * SECTION:element-gstsdidemux
- *
- * The gstsdidemux element does FIXME stuff.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch -v fakesrc ! gstsdidemux ! FIXME ! fakesink
- * ]|
- * FIXME Describe what the pipeline does.
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/gst.h>
-#include <string.h>
-#include "gstsdidemux.h"
-
-/* prototypes */
-
-
-static void gst_sdi_demux_set_property (GObject * object,
- guint property_id, const GValue * value, GParamSpec * pspec);
-static void gst_sdi_demux_get_property (GObject * object,
- guint property_id, GValue * value, GParamSpec * pspec);
-static void gst_sdi_demux_dispose (GObject * object);
-static void gst_sdi_demux_finalize (GObject * object);
-
-static GstStateChangeReturn
-gst_sdi_demux_change_state (GstElement * element, GstStateChange transition);
-static GstFlowReturn gst_sdi_demux_chain (GstPad * pad, GstBuffer * buffer);
-static gboolean gst_sdi_demux_sink_event (GstPad * pad, GstEvent * event);
-static gboolean gst_sdi_demux_src_event (GstPad * pad, GstEvent * event);
-static GstCaps *gst_sdi_demux_src_getcaps (GstPad * pad);
-
-
-enum
-{
- PROP_0
-};
-
-/* pad templates */
-
-#define GST_VIDEO_CAPS_NTSC(fourcc) \
- "video/x-raw-yuv,format=(fourcc)" fourcc ",width=720,height=480," \
- "framerate=30000/1001,interlaced=TRUE,pixel-aspect-ratio=10/11," \
- "chroma-site=mpeg2,color-matrix=sdtv"
-#define GST_VIDEO_CAPS_NTSC_WIDE(fourcc) \
- "video/x-raw-yuv,format=(fourcc)" fourcc ",width=720,height=480," \
- "framerate=30000/1001,interlaced=TRUE,pixel-aspect-ratio=40/33," \
- "chroma-site=mpeg2,color-matrix=sdtv"
-#define GST_VIDEO_CAPS_PAL(fourcc) \
- "video/x-raw-yuv,format=(fourcc)" fourcc ",width=720,height=576," \
- "framerate=25/1,interlaced=TRUE,pixel-aspect-ratio=12/11," \
- "chroma-site=mpeg2,color-matrix=sdtv"
-#define GST_VIDEO_CAPS_PAL_WIDE(fourcc) \
- "video/x-raw-yuv,format=(fourcc)" fourcc ",width=720,height=576," \
- "framerate=25/1,interlaced=TRUE,pixel-aspect-ratio=16/11," \
- "chroma-site=mpeg2,color-matrix=sdtv"
-
-static GstStaticPadTemplate gst_sdi_demux_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-raw-sdi")
- );
-
-static GstStaticPadTemplate gst_sdi_demux_src_template =
- GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_NTSC ("UYVY") ";"
- GST_VIDEO_CAPS_PAL ("UYVY"))
- );
-
-/* class initialization */
-
-GST_BOILERPLATE (GstSdiDemux, gst_sdi_demux, GstElement, GST_TYPE_ELEMENT);
-
-static void
-gst_sdi_demux_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_static_pad_template (element_class,
- &gst_sdi_demux_src_template);
- gst_element_class_add_static_pad_template (element_class,
- &gst_sdi_demux_sink_template);
-
- gst_element_class_set_static_metadata (element_class,
- "SDI Demuxer",
- "Demuxer",
- "Demultiplex SDI streams into raw audio and video",
- "David Schleef <ds@schleef.org>");
-}
-
-static void
-gst_sdi_demux_class_init (GstSdiDemuxClass * klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gobject_class->set_property = gst_sdi_demux_set_property;
- gobject_class->get_property = gst_sdi_demux_get_property;
- gobject_class->dispose = gst_sdi_demux_dispose;
- gobject_class->finalize = gst_sdi_demux_finalize;
- if (0)
- element_class->change_state =
- GST_DEBUG_FUNCPTR (gst_sdi_demux_change_state);
-
-}
-
-static void
-gst_sdi_demux_init (GstSdiDemux * sdidemux, GstSdiDemuxClass * sdidemux_class)
-{
-
- sdidemux->sinkpad =
- gst_pad_new_from_static_template (&gst_sdi_demux_sink_template, "sink");
- gst_pad_set_event_function (sdidemux->sinkpad,
- GST_DEBUG_FUNCPTR (gst_sdi_demux_sink_event));
- gst_pad_set_chain_function (sdidemux->sinkpad,
- GST_DEBUG_FUNCPTR (gst_sdi_demux_chain));
- gst_element_add_pad (GST_ELEMENT (sdidemux), sdidemux->sinkpad);
-
- sdidemux->srcpad =
- gst_pad_new_from_static_template (&gst_sdi_demux_src_template, "src");
- gst_pad_set_event_function (sdidemux->srcpad,
- GST_DEBUG_FUNCPTR (gst_sdi_demux_src_event));
- gst_pad_set_getcaps_function (sdidemux->srcpad,
- GST_DEBUG_FUNCPTR (gst_sdi_demux_src_getcaps));
- gst_element_add_pad (GST_ELEMENT (sdidemux), sdidemux->srcpad);
-
-
-}
-
-void
-gst_sdi_demux_set_property (GObject * object, guint property_id,
- const GValue * value, GParamSpec * pspec)
-{
- g_return_if_fail (GST_IS_SDI_DEMUX (object));
-
- switch (property_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-void
-gst_sdi_demux_get_property (GObject * object, guint property_id,
- GValue * value, GParamSpec * pspec)
-{
- g_return_if_fail (GST_IS_SDI_DEMUX (object));
-
- switch (property_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-void
-gst_sdi_demux_dispose (GObject * object)
-{
- g_return_if_fail (GST_IS_SDI_DEMUX (object));
-
- /* clean up as possible. may be called multiple times */
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-void
-gst_sdi_demux_finalize (GObject * object)
-{
- g_return_if_fail (GST_IS_SDI_DEMUX (object));
-
- /* clean up object here */
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-
-static GstStateChangeReturn
-gst_sdi_demux_change_state (GstElement * element, GstStateChange transition)
-{
-
- return GST_STATE_CHANGE_SUCCESS;
-}
-
-static GstCaps *
-gst_sdi_demux_src_getcaps (GstPad * pad)
-{
- return gst_caps_from_string (GST_VIDEO_CAPS_NTSC ("UYVY"));
-}
-
-static void
-gst_sdi_demux_get_output_buffer (GstSdiDemux * sdidemux)
-{
- sdidemux->output_buffer =
- gst_buffer_new_and_alloc (720 * sdidemux->format->active_lines * 2);
- gst_buffer_set_caps (sdidemux->output_buffer,
- gst_caps_from_string (GST_VIDEO_CAPS_PAL ("UYVY")));
- GST_BUFFER_TIMESTAMP (sdidemux->output_buffer) =
- GST_SECOND * sdidemux->frame_number;
- sdidemux->frame_number++;
-}
-
-static guint32
-get_word10 (guint8 * ptr)
-{
- guint32 a;
-
- a = (((ptr[0] >> 2) | (ptr[1] << 6)) & 0xff) << 24;
- a |= (((ptr[1] >> 4) | (ptr[2] << 4)) & 0xff) << 16;
- a |= (((ptr[2] >> 6) | (ptr[3] << 2)) & 0xff) << 8;
- a |= ptr[4];
-
- return a;
-}
-
-static void
-line10_copy (guint8 * dest, guint8 * src, int n)
-{
- int i;
- guint32 a;
- for (i = 0; i < n; i++) {
- a = get_word10 (src);
- GST_WRITE_UINT32_BE (dest, a);
- src += 5;
- dest += 4;
- }
-
-}
-
-
-static GstFlowReturn
-copy_line (GstSdiDemux * sdidemux, guint8 * line)
-{
- guint8 *output_data;
- GstFlowReturn ret = GST_FLOW_OK;
- GstSdiFormat *format = sdidemux->format;
-
- output_data = GST_BUFFER_DATA (sdidemux->output_buffer);
-
- /* line is one less than the video line */
- if (sdidemux->line >= format->start0 - 1 &&
- sdidemux->line < format->start0 - 1 + format->active_lines / 2) {
-#if 0
- memcpy (output_data + 720 * 2 * ((sdidemux->line -
- (format->start0 - 1)) * 2 + (!format->tff)),
- line + (format->width - 720) * 2, 720 * 2);
-#else
- line10_copy (output_data + 720 * 2 * ((sdidemux->line -
- (format->start0 - 1)) * 2 + (!format->tff)),
- line + (format->width - 720) / 2 * 5, 720 / 2);
-#endif
- }
- if (sdidemux->line >= format->start1 - 1 &&
- sdidemux->line < format->start1 - 1 + format->active_lines / 2) {
-#if 0
- memcpy (output_data + 720 * 2 * ((sdidemux->line -
- (format->start1 - 1)) * 2 + (format->tff)),
- line + (format->width - 720) * 2, 720 * 2);
-#else
- line10_copy (output_data + 720 * 2 * ((sdidemux->line -
- (format->start1 - 1)) * 2 + (format->tff)),
- line + (format->width - 720) / 2 * 5, 720 / 2);
-#endif
- }
-
- sdidemux->offset = 0;
- sdidemux->line++;
- if (sdidemux->line == format->lines) {
- ret = gst_pad_push (sdidemux->srcpad, sdidemux->output_buffer);
- gst_sdi_demux_get_output_buffer (sdidemux);
- sdidemux->line = 0;
- }
-
- return ret;
-}
-
-#define SDI_IS_SYNC(a) (((a)&0xffffff80) == 0xff000080)
-#define SDI_SYNC_F(a) (((a)>>6)&1)
-#define SDI_SYNC_V(a) (((a)>>5)&1)
-#define SDI_SYNC_H(a) (((a)>>4)&1)
-
-GstSdiFormat sd_ntsc = { 525, 480, 858, 20, 283, 0 };
-GstSdiFormat sd_pal = { 625, 576, 864, 23, 336, 1 };
-
-static GstFlowReturn
-gst_sdi_demux_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstSdiDemux *sdidemux;
- int offset = 0;
- guint8 *data = GST_BUFFER_DATA (buffer);
- int size = GST_BUFFER_SIZE (buffer);
- GstFlowReturn ret = GST_FLOW_OK;
- GstSdiFormat *format;
-
- sdidemux = GST_SDI_DEMUX (gst_pad_get_parent (pad));
- sdidemux->format = &sd_pal;
- format = sdidemux->format;
-
- GST_DEBUG_OBJECT (sdidemux, "chain");
-
- if (GST_BUFFER_IS_DISCONT (buffer)) {
- sdidemux->have_hsync = FALSE;
- sdidemux->have_vsync = FALSE;
- }
-
- if (!sdidemux->have_hsync) {
-#if 0
- for (offset = 0; offset < size; offset += 4) {
- guint32 sync = READ_UINT32_BE (data + offset);
- GST_ERROR ("sync value %08x", sync);
- if (SDI_IS_SYNC (sync) && SDI_SYNC_H (sync)) {
- sdidemux->have_hsync = TRUE;
- sdidemux->line = 0;
- sdidemux->offset = 0;
- break;
- }
- }
-#else
- for (offset = 0; offset < size; offset += 5) {
- guint32 sync = get_word10 (data + offset);
- //GST_ERROR("sync value %08x", sync);
- if (SDI_IS_SYNC (sync) && SDI_SYNC_H (sync)) {
- sdidemux->have_hsync = TRUE;
- sdidemux->line = 0;
- sdidemux->offset = 0;
- break;
- }
- }
-#endif
- if (!sdidemux->have_hsync) {
- GST_ERROR ("no sync");
- goto out;
- }
- }
-
- if (sdidemux->output_buffer == NULL) {
- gst_sdi_demux_get_output_buffer (sdidemux);
- }
-#if 0
- if (sdidemux->offset) {
- int n;
-
- /* second half of a line */
- n = MIN (size - offset, format->width * 2 - sdidemux->offset);
-
- memcpy (sdidemux->stored_line + sdidemux->offset, data + offset, n);
-
- offset += n;
- sdidemux->offset += n;
-
- if (sdidemux->offset == format->width * 2) {
- guint32 sync =
- GST_READ_UINT32_BE (data + offset + (format->width - 720 - 2) * 2);
-
- //GST_ERROR("%08x", sync);
- if (!sdidemux->have_vsync) {
- //GST_ERROR("%08x", GST_READ_UINT32_BE(data+offset));
- if (SDI_IS_SYNC (sync) && !SDI_SYNC_F (sync) &&
- SDI_SYNC_F (sdidemux->last_sync)) {
- sdidemux->have_vsync = TRUE;
- }
- sdidemux->line = 0;
- }
-
- ret = copy_line (sdidemux, sdidemux->stored_line);
-
- sdidemux->last_sync = sync;
- }
- }
-
- while (size - offset >= format->width * 2) {
- guint32 sync =
- GST_READ_UINT32_BE (data + offset + (format->width - 720 - 2) * 2);
-
- //GST_ERROR("%08x", sync);
- if (!sdidemux->have_vsync) {
- if (SDI_IS_SYNC (sync) && !SDI_SYNC_F (sync) &&
- SDI_SYNC_F (sdidemux->last_sync)) {
- sdidemux->have_vsync = TRUE;
- }
- sdidemux->line = 0;
- }
-
- ret = copy_line (sdidemux, data + offset);
- offset += format->width * 2;
-
- sdidemux->last_sync = sync;
- }
-
- if (size - offset > 0) {
- memcpy (sdidemux->stored_line, data + offset, size - offset);
- sdidemux->offset = size - offset;
- }
-#else
- if (sdidemux->offset) {
- int n;
-
- /* second half of a line */
- n = MIN (size - offset, format->width / 2 * 5 - sdidemux->offset);
-
- memcpy (sdidemux->stored_line + sdidemux->offset, data + offset, n);
-
- offset += n;
- sdidemux->offset += n;
-
- if (sdidemux->offset == (format->width / 2) * 5) {
- guint32 sync =
- get_word10 (data + offset + ((format->width - 720 - 2) / 2) * 5);
-
- if (!sdidemux->have_vsync) {
- //GST_ERROR("%08x", GST_READ_UINT32_BE(data+offset));
- if (SDI_IS_SYNC (sync) && !SDI_SYNC_F (sync) &&
- SDI_SYNC_F (sdidemux->last_sync)) {
- sdidemux->have_vsync = TRUE;
- }
- sdidemux->line = 0;
- }
-
- ret = copy_line (sdidemux, sdidemux->stored_line);
-
- sdidemux->last_sync = sync;
- }
- }
-
- while (size - offset >= format->width / 2 * 5) {
- guint32 sync =
- get_word10 (data + offset + ((format->width - 720 - 2) / 2) * 5);
-
- //GST_ERROR("%08x", sync);
- if (!sdidemux->have_vsync) {
- if (SDI_IS_SYNC (sync) && !SDI_SYNC_F (sync) &&
- SDI_SYNC_F (sdidemux->last_sync)) {
- sdidemux->have_vsync = TRUE;
- }
- sdidemux->line = 0;
- }
-
- ret = copy_line (sdidemux, data + offset);
- offset += (format->width / 2) * 5;
-
- sdidemux->last_sync = sync;
- }
-
- if (size - offset > 0) {
- memcpy (sdidemux->stored_line, data + offset, size - offset);
- sdidemux->offset = size - offset;
- }
-#endif
-
-out:
- gst_buffer_unref (buffer);
- gst_object_unref (sdidemux);
- return ret;
-}
-
-static gboolean
-gst_sdi_demux_sink_event (GstPad * pad, GstEvent * event)
-{
- gboolean res = TRUE;
- GstSdiDemux *sdidemux;
-
- sdidemux = GST_SDI_DEMUX (gst_pad_get_parent (pad));
-
- GST_DEBUG_OBJECT (sdidemux, "event");
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_FLUSH_START:
- res = gst_pad_push_event (sdidemux->srcpad, event);
- break;
- case GST_EVENT_FLUSH_STOP:
- res = gst_pad_push_event (sdidemux->srcpad, event);
- break;
- case GST_EVENT_NEWSEGMENT:
- res = gst_pad_push_event (sdidemux->srcpad, event);
- break;
- case GST_EVENT_EOS:
- res = gst_pad_push_event (sdidemux->srcpad, event);
- break;
- default:
- res = gst_pad_push_event (sdidemux->srcpad, event);
- break;
- }
-
- gst_object_unref (sdidemux);
- return res;
-}
-
-static gboolean
-gst_sdi_demux_src_event (GstPad * pad, GstEvent * event)
-{
- gboolean res;
- GstSdiDemux *sdidemux;
-
- sdidemux = GST_SDI_DEMUX (gst_pad_get_parent (pad));
-
- GST_DEBUG_OBJECT (sdidemux, "event");
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_SEEK:
- res = gst_pad_push_event (sdidemux->sinkpad, event);
- break;
- default:
- res = gst_pad_push_event (sdidemux->sinkpad, event);
- break;
- }
-
- gst_object_unref (sdidemux);
- return res;
-}
diff --git a/gst/sdi/gstsdidemux.h b/gst/sdi/gstsdidemux.h
deleted file mode 100644
index d5284d2e4..000000000
--- a/gst/sdi/gstsdidemux.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* GStreamer
- * Copyright (C) 2010 REAL_NAME <EMAIL_ADDRESS>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _GST_SDI_DEMUX_H_
-#define _GST_SDI_DEMUX_H_
-
-#include <gst/gst.h>
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_SDI_DEMUX (gst_sdi_demux_get_type())
-#define GST_SDI_DEMUX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SDI_DEMUX,GstSdiDemux))
-#define GST_SDI_DEMUX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SDI_DEMUX,GstSdiDemuxClass))
-#define GST_IS_SDI_DEMUX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SDI_DEMUX))
-#define GST_IS_SDI_DEMUX_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SDI_DEMUX))
-
-typedef struct _GstSdiDemux GstSdiDemux;
-typedef struct _GstSdiDemuxClass GstSdiDemuxClass;
-typedef struct _GstSdiFormat GstSdiFormat;
-
-struct _GstSdiDemux
-{
- GstElement base_sdidemux;
- GstPad *sinkpad;
- GstPad *srcpad;
-
- GstBuffer *output_buffer;
- int line;
- int offset;
-
- gboolean have_hsync;
- gboolean have_vsync;
- guchar stored_line[2160]; /* 864/2*5 */
-
- int frame_number;
- guint32 last_sync;
- GstSdiFormat *format;
-};
-
-struct _GstSdiFormat
-{
- int lines;
- int active_lines;
- int width;
- int start0;
- int start1;
- int tff;
-};
-
-struct _GstSdiDemuxClass
-{
- GstElementClass base_sdidemux_class;
-};
-
-GType gst_sdi_demux_get_type (void);
-
-G_END_DECLS
-
-#endif
diff --git a/gst/sdi/gstsdimux.c b/gst/sdi/gstsdimux.c
deleted file mode 100644
index 7734baddd..000000000
--- a/gst/sdi/gstsdimux.c
+++ /dev/null
@@ -1,312 +0,0 @@
-/* GStreamer
- * Copyright (C) 2010 David Schleef <ds@schleef.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-/**
- * SECTION:element-gstsdimux
- *
- * The gstsdimux element does FIXME stuff.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch -v fakesrc ! gstsdimux ! FIXME ! fakesink
- * ]|
- * FIXME Describe what the pipeline does.
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/gst.h>
-#include "gstsdimux.h"
-
-/* prototypes */
-
-
-static void gst_sdi_mux_set_property (GObject * object,
- guint property_id, const GValue * value, GParamSpec * pspec);
-static void gst_sdi_mux_get_property (GObject * object,
- guint property_id, GValue * value, GParamSpec * pspec);
-static void gst_sdi_mux_dispose (GObject * object);
-static void gst_sdi_mux_finalize (GObject * object);
-
-static GstPad *gst_sdi_mux_request_new_pad (GstElement * element,
- GstPadTemplate * templ, const gchar * name);
-static void gst_sdi_mux_release_pad (GstElement * element, GstPad * pad);
-static GstStateChangeReturn
-gst_sdi_mux_change_state (GstElement * element, GstStateChange transition);
-static const GstQueryType *gst_sdi_mux_get_query_types (GstElement * element);
-static gboolean gst_sdi_mux_query (GstElement * element, GstQuery * query);
-static GstFlowReturn gst_sdi_mux_chain (GstPad * pad, GstBuffer * buffer);
-static gboolean gst_sdi_mux_sink_event (GstPad * pad, GstEvent * event);
-static gboolean gst_sdi_mux_src_event (GstPad * pad, GstEvent * event);
-
-enum
-{
- PROP_0
-};
-
-/* pad templates */
-
-#define GST_VIDEO_CAPS_NTSC(fourcc) \
- "video/x-raw-yuv,format=(fourcc)" fourcc ",width=720,height=480," \
- "framerate=30000/1001,interlaced=TRUE,pixel-aspect-ratio=10/11," \
- "chroma-site=mpeg2,color-matrix=sdtv"
-#define GST_VIDEO_CAPS_NTSC_WIDE(fourcc) \
- "video/x-raw-yuv,format=(fourcc)" fourcc ",width=720,height=480," \
- "framerate=30000/1001,interlaced=TRUE,pixel-aspect-ratio=40/33," \
- "chroma-site=mpeg2,color-matrix=sdtv"
-#define GST_VIDEO_CAPS_PAL(fourcc) \
- "video/x-raw-yuv,format=(fourcc)" fourcc ",width=720,height=576," \
- "framerate=25/1,interlaced=TRUE,pixel-aspect-ratio=12/11," \
- "chroma-site=mpeg2,color-matrix=sdtv"
-#define GST_VIDEO_CAPS_PAL_WIDE(fourcc) \
- "video/x-raw-yuv,format=(fourcc)" fourcc ",width=720,height=576," \
- "framerate=25/1,interlaced=TRUE,pixel-aspect-ratio=16/11," \
- "chroma-site=mpeg2,color-matrix=sdtv"
-
-static GstStaticPadTemplate gst_sdi_mux_sink_template =
- GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_NTSC ("{UYVY,v210}") ";"
- GST_VIDEO_CAPS_PAL ("{UYVY,v210}"))
- );
-
-static GstStaticPadTemplate gst_sdi_mux_src_template =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS
- ("application/x-raw-sdi,rate=270,format=(fourcc){UYVY,v210}")
- );
-
-/* class initialization */
-
-GST_BOILERPLATE (GstSdiMux, gst_sdi_mux, GstElement, GST_TYPE_ELEMENT);
-
-static void
-gst_sdi_mux_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_static_pad_template (element_class,
- &gst_sdi_mux_src_template);
- gst_element_class_add_static_pad_template (element_class,
- &gst_sdi_mux_sink_template);
-
- gst_element_class_set_static_metadata (element_class, "SDI Muxer",
- "Muxer",
- "Multiplex raw audio and video into SDI",
- "David Schleef <ds@schleef.org>");
-}
-
-static void
-gst_sdi_mux_class_init (GstSdiMuxClass * klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gobject_class->set_property = gst_sdi_mux_set_property;
- gobject_class->get_property = gst_sdi_mux_get_property;
- gobject_class->dispose = gst_sdi_mux_dispose;
- gobject_class->finalize = gst_sdi_mux_finalize;
- element_class->request_new_pad =
- GST_DEBUG_FUNCPTR (gst_sdi_mux_request_new_pad);
- element_class->release_pad = GST_DEBUG_FUNCPTR (gst_sdi_mux_release_pad);
- element_class->change_state = GST_DEBUG_FUNCPTR (gst_sdi_mux_change_state);
- element_class->get_query_types =
- GST_DEBUG_FUNCPTR (gst_sdi_mux_get_query_types);
- element_class->query = GST_DEBUG_FUNCPTR (gst_sdi_mux_query);
-
-}
-
-static void
-gst_sdi_mux_init (GstSdiMux * sdimux, GstSdiMuxClass * sdimux_class)
-{
-
- sdimux->sinkpad =
- gst_pad_new_from_static_template (&gst_sdi_mux_sink_template, "sink");
- gst_pad_set_event_function (sdimux->sinkpad,
- GST_DEBUG_FUNCPTR (gst_sdi_mux_sink_event));
- gst_pad_set_chain_function (sdimux->sinkpad,
- GST_DEBUG_FUNCPTR (gst_sdi_mux_chain));
- gst_element_add_pad (GST_ELEMENT (sdimux), sdimux->sinkpad);
-
- sdimux->srcpad = gst_pad_new_from_static_template (&gst_sdi_mux_src_template,
- "src");
- gst_pad_set_event_function (sdimux->srcpad,
- GST_DEBUG_FUNCPTR (gst_sdi_mux_src_event));
- gst_element_add_pad (GST_ELEMENT (sdimux), sdimux->srcpad);
-
-}
-
-void
-gst_sdi_mux_set_property (GObject * object, guint property_id,
- const GValue * value, GParamSpec * pspec)
-{
- g_return_if_fail (GST_IS_SDI_MUX (object));
-
- switch (property_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-void
-gst_sdi_mux_get_property (GObject * object, guint property_id,
- GValue * value, GParamSpec * pspec)
-{
- g_return_if_fail (GST_IS_SDI_MUX (object));
-
- switch (property_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-void
-gst_sdi_mux_dispose (GObject * object)
-{
- g_return_if_fail (GST_IS_SDI_MUX (object));
-
- /* clean up as possible. may be called multiple times */
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-void
-gst_sdi_mux_finalize (GObject * object)
-{
- g_return_if_fail (GST_IS_SDI_MUX (object));
-
- /* clean up object here */
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-
-
-static GstPad *
-gst_sdi_mux_request_new_pad (GstElement * element, GstPadTemplate * templ,
- const gchar * name)
-{
-
- return NULL;
-}
-
-static void
-gst_sdi_mux_release_pad (GstElement * element, GstPad * pad)
-{
-
-}
-
-static GstStateChangeReturn
-gst_sdi_mux_change_state (GstElement * element, GstStateChange transition)
-{
-
- return GST_STATE_CHANGE_SUCCESS;
-}
-
-static const GstQueryType *
-gst_sdi_mux_get_query_types (GstElement * element)
-{
-
- return NULL;
-}
-
-static gboolean
-gst_sdi_mux_query (GstElement * element, GstQuery * query)
-{
-
- return FALSE;
-}
-
-static GstFlowReturn
-gst_sdi_mux_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstSdiMux *sdimux;
-
- sdimux = GST_SDI_MUX (gst_pad_get_parent (pad));
-
- GST_DEBUG_OBJECT (sdimux, "chain");
-
-
- gst_object_unref (sdimux);
- return GST_FLOW_OK;
-}
-
-static gboolean
-gst_sdi_mux_sink_event (GstPad * pad, GstEvent * event)
-{
- gboolean res;
- GstSdiMux *sdimux;
-
- sdimux = GST_SDI_MUX (gst_pad_get_parent (pad));
-
- GST_DEBUG_OBJECT (sdimux, "event");
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_FLUSH_START:
- res = gst_pad_push_event (sdimux->srcpad, event);
- break;
- case GST_EVENT_FLUSH_STOP:
- res = gst_pad_push_event (sdimux->srcpad, event);
- break;
- case GST_EVENT_NEWSEGMENT:
- res = gst_pad_push_event (sdimux->srcpad, event);
- break;
- case GST_EVENT_EOS:
- res = gst_pad_push_event (sdimux->srcpad, event);
- break;
- default:
- res = gst_pad_push_event (sdimux->srcpad, event);
- break;
- }
-
- gst_object_unref (sdimux);
- return res;
-}
-
-static gboolean
-gst_sdi_mux_src_event (GstPad * pad, GstEvent * event)
-{
- gboolean res;
- GstSdiMux *sdimux;
-
- sdimux = GST_SDI_MUX (gst_pad_get_parent (pad));
-
- GST_DEBUG_OBJECT (sdimux, "event");
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_SEEK:
- res = gst_pad_push_event (sdimux->sinkpad, event);
- break;
- default:
- res = gst_pad_push_event (sdimux->sinkpad, event);
- break;
- }
-
- gst_object_unref (sdimux);
- return res;
-}
diff --git a/gst/sdi/gstsdimux.h b/gst/sdi/gstsdimux.h
deleted file mode 100644
index 481f4ea8d..000000000
--- a/gst/sdi/gstsdimux.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* GStreamer
- * Copyright (C) 2010 REAL_NAME <EMAIL_ADDRESS>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _GST_SDI_MUX_H_
-#define _GST_SDI_MUX_H_
-
-#include <gst/gst.h>
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_SDI_MUX (gst_sdi_mux_get_type())
-#define GST_SDI_MUX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SDI_MUX,GstSdiMux))
-#define GST_SDI_MUX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SDI_MUX,GstSdiMuxClass))
-#define GST_IS_SDI_MUX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SDI_MUX))
-#define GST_IS_SDI_MUX_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SDI_MUX))
-
-typedef struct _GstSdiMux GstSdiMux;
-typedef struct _GstSdiMuxClass GstSdiMuxClass;
-
-struct _GstSdiMux
-{
- GstElement base_sdimux;
-
- GstPad *srcpad;
- GstPad *sinkpad;
-};
-
-struct _GstSdiMuxClass
-{
- GstElementClass base_sdimux_class;
-};
-
-GType gst_sdi_mux_get_type (void);
-
-G_END_DECLS
-
-#endif
diff --git a/gst/sdi/meson.build b/gst/sdi/meson.build
deleted file mode 100644
index 022002541..000000000
--- a/gst/sdi/meson.build
+++ /dev/null
@@ -1,13 +0,0 @@
-sdi_sources = [
- 'gstsdidemux.c',
- 'gstsdimux.c',
-]
-
-gstsdi = library('gstsdi',
- sdi_sources,
- c_args : gst_plugins_bad_args,
- include_directories : [configinc],
- dependencies : [gstbase_dep],
- install : true,
- install_dir : plugins_install_dir,
-)
diff --git a/gst/tta/Makefile.am b/gst/tta/Makefile.am
deleted file mode 100644
index 3c8aa0f48..000000000
--- a/gst/tta/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-plugin_LTLIBRARIES = libgsttta.la
-
-libgsttta_la_SOURCES = gsttta.c \
- gstttaparse.c \
- gstttadec.c
-
-noinst_HEADERS = gstttaparse.h gstttadec.h \
- ttadec.h crc32.h filters.h
-
-libgsttta_la_CFLAGS = $(GST_CFLAGS)
-libgsttta_la_LIBADD = $(GST_LIBS) $(LIBM)
-libgsttta_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgsttta_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
diff --git a/gst/tta/crc32.h b/gst/tta/crc32.h
deleted file mode 100644
index 2d6d37dc8..000000000
--- a/gst/tta/crc32.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * crc32.h
- *
- * Description: CRC32 functions
- * Developed by: Alexander Djourik <sasha@iszf.irk.ru>
- * Pavel Zhilin <pzh@iszf.irk.ru>
- *
- * Copyright (c) 1999-2004 Alexander Djourik. All rights reserved.
- *
- */
-
-/*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Please see the file COPYING in this directory for full copyright
- * information.
- */
-
-#ifndef CRC32_H
-#define CRC32_H
-
-static const unsigned long crc32_table[256] = {
- 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
- 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
- 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
- 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
- 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
- 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
- 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
- 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
- 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
- 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
- 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
- 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
- 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
- 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
- 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
- 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
- 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
- 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
- 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
- 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
- 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
- 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
- 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
- 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
- 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
- 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
- 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
- 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
- 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
- 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
- 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
- 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
- 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
- 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
- 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
- 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
- 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
- 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
- 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
- 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
- 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
- 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
- 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
- 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
- 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
- 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
- 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
- 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
- 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
- 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
- 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
- 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
- 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
- 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
- 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
- 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
- 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
- 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
- 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
- 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
- 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
- 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
- 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
- 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
-};
-
-#define UPDATE_CRC32(x, crc) crc = \
- (((crc>>8) & 0x00FFFFFF) ^ crc32_table[(crc^x) & 0xFF])
-
-static unsigned long
-crc32 (unsigned char *buffer, unsigned long len) {
- unsigned long i;
- unsigned long crc = 0xFFFFFFFF;
-
- for (i = 0; i < len; i++) UPDATE_CRC32(buffer[i], crc);
-
- return (crc ^ 0xFFFFFFFF);
-}
-
-#endif /* CRC32_H */
diff --git a/gst/tta/filters.h b/gst/tta/filters.h
deleted file mode 100644
index 9df5e1d43..000000000
--- a/gst/tta/filters.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * filters.h
- *
- * Description: TTAv1 filter functions
- * Developed by: Alexander Djourik <sasha@iszf.irk.ru>
- * Pavel Zhilin <pzh@iszf.irk.ru>
- *
- * Copyright (c) 1999-2004 Alexander Djourik. All rights reserved.
- *
- */
-
-/*
- * This program 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 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * aint with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please see the file COPYING in this directory for full copyright
- * information.
- */
-
-#ifndef FILTERS_H
-#define FILTERS_H
-
-///////// Filter Settings //////////
-static const long flt_set[3] = {10, 9, 10};
-
-static void
-memshl (register long *pA, register long *pB) {
- *pA++ = *pB++;
- *pA++ = *pB++;
- *pA++ = *pB++;
- *pA++ = *pB++;
- *pA++ = *pB++;
- *pA++ = *pB++;
- *pA++ = *pB++;
- *pA = *pB;
-}
-
-static void
-hybrid_filter (fltst *fs, long *in) {
- register long *pA = fs->dl;
- register long *pB = fs->qm;
- register long *pM = fs->dx;
- register long sum = fs->round;
-
- if (!fs->error) {
- sum += *pA++ * *pB, pB++;
- sum += *pA++ * *pB, pB++;
- sum += *pA++ * *pB, pB++;
- sum += *pA++ * *pB, pB++;
- sum += *pA++ * *pB, pB++;
- sum += *pA++ * *pB, pB++;
- sum += *pA++ * *pB, pB++;
- sum += *pA++ * *pB, pB++; pM += 8;
- } else if (fs->error < 0) {
- sum += *pA++ * (*pB -= *pM++), pB++;
- sum += *pA++ * (*pB -= *pM++), pB++;
- sum += *pA++ * (*pB -= *pM++), pB++;
- sum += *pA++ * (*pB -= *pM++), pB++;
- sum += *pA++ * (*pB -= *pM++), pB++;
- sum += *pA++ * (*pB -= *pM++), pB++;
- sum += *pA++ * (*pB -= *pM++), pB++;
- sum += *pA++ * (*pB -= *pM++), pB++;
- } else {
- sum += *pA++ * (*pB += *pM++), pB++;
- sum += *pA++ * (*pB += *pM++), pB++;
- sum += *pA++ * (*pB += *pM++), pB++;
- sum += *pA++ * (*pB += *pM++), pB++;
- sum += *pA++ * (*pB += *pM++), pB++;
- sum += *pA++ * (*pB += *pM++), pB++;
- sum += *pA++ * (*pB += *pM++), pB++;
- sum += *pA++ * (*pB += *pM++), pB++;
- }
-
- *(pM-0) = ((*(pA-1) >> 30) | 1) << 2;
- *(pM-1) = ((*(pA-2) >> 30) | 1) << 1;
- *(pM-2) = ((*(pA-3) >> 30) | 1) << 1;
- *(pM-3) = ((*(pA-4) >> 30) | 1);
-
- fs->error = *in;
- *in += (sum >> fs->shift);
- *pA = *in;
-
- *(pA-1) = *(pA-0) - *(pA-1);
- *(pA-2) = *(pA-1) - *(pA-2);
- *(pA-3) = *(pA-2) - *(pA-3);
-
- memshl (fs->dl, fs->dl + 1);
- memshl (fs->dx, fs->dx + 1);
-}
-
-static void
-filter_init (fltst *fs, long shift) {
- memset (fs, 0, sizeof(fltst));
- fs->shift = shift;
- fs->round = 1 << (shift - 1);
-}
-
-#endif /* FILTERS_H */
-
diff --git a/gst/tta/gsttta.c b/gst/tta/gsttta.c
deleted file mode 100644
index 00e33d49b..000000000
--- a/gst/tta/gsttta.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* GStreamer TTA plugin
- * (c) 2004 Arwed v. Merkatz <v.merkatz@gmx.net>
- *
- * gsttta.c: plugin loader
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstttaparse.h"
-#include "gstttadec.h"
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- return (gst_tta_parse_plugin_init (plugin) &&
- gst_tta_dec_plugin_init (plugin));
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- tta,
- "TTA lossless audio format handling",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/tta/gstttadec.c b/gst/tta/gstttadec.c
deleted file mode 100644
index 1aa9d95f1..000000000
--- a/gst/tta/gstttadec.c
+++ /dev/null
@@ -1,444 +0,0 @@
-/* GStreamer TTA plugin
- * (c) 2004 Arwed v. Merkatz <v.merkatz@gmx.net>
- *
- * based on ttalib
- * (c) 1999-2004 Alexander Djourik <sasha@iszf.irk.ru>
- *
- * gstttadec.c: raw TTA bitstream decoder
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <gst/gst.h>
-
-#include <math.h>
-#include <string.h>
-
-#include "gstttadec.h"
-#include "ttadec.h"
-#include "filters.h"
-
-#define TTA_BUFFER_SIZE (1024 * 32 * 8)
-
-/* this is from ttadec.h originally */
-
-static const unsigned long bit_mask[] = {
- 0x00000000, 0x00000001, 0x00000003, 0x00000007,
- 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f,
- 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff,
- 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff,
- 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff,
- 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff,
- 0x00ffffff, 0x01ffffff, 0x03ffffff, 0x07ffffff,
- 0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff,
- 0xffffffff
-};
-
-static const unsigned long bit_shift[] = {
- 0x00000001, 0x00000002, 0x00000004, 0x00000008,
- 0x00000010, 0x00000020, 0x00000040, 0x00000080,
- 0x00000100, 0x00000200, 0x00000400, 0x00000800,
- 0x00001000, 0x00002000, 0x00004000, 0x00008000,
- 0x00010000, 0x00020000, 0x00040000, 0x00080000,
- 0x00100000, 0x00200000, 0x00400000, 0x00800000,
- 0x01000000, 0x02000000, 0x04000000, 0x08000000,
- 0x10000000, 0x20000000, 0x40000000, 0x80000000,
- 0x80000000, 0x80000000, 0x80000000, 0x80000000,
- 0x80000000, 0x80000000, 0x80000000, 0x80000000
-};
-
-static const unsigned long *shift_16 = bit_shift + 4;
-
-/* Filter signals and args */
-enum
-{
- LAST_SIGNAL
-};
-
-enum
-{
- PROP_0
-};
-
-static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-tta, "
- "width = (int) { 8, 16, 24 }, "
- "channels = (int) { 1, 2 }, " "rate = (int) [ 8000, 96000 ]")
- );
-
-static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-int, "
- "width = (int) { 8, 16, 24 }, "
- "depth = (int) { 8, 16, 24 }, "
- "channels = (int) { 1, 2 }, "
- "rate = (int) [ 8000, 96000 ], "
- "endianness = (int) BYTE_ORDER, " "signed = (boolean) true")
- );
-
-static void gst_tta_dec_class_init (GstTtaDecClass * klass);
-static void gst_tta_dec_base_init (GstTtaDecClass * klass);
-static void gst_tta_dec_init (GstTtaDec * ttadec);
-
-static GstFlowReturn gst_tta_dec_chain (GstPad * pad, GstBuffer * in);
-
-static GstElementClass *parent = NULL;
-
-static gboolean
-gst_tta_dec_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstTtaDec *ttadec = GST_TTA_DEC (gst_pad_get_parent (pad));
- GstStructure *structure = gst_caps_get_structure (caps, 0);
- GstCaps *srccaps;
- gint bits, channels;
- gint32 samplerate;
-
-// if (!gst_caps_is_fixed (caps))
-// return GST_PAD_LINK_DELAYED;
-
- gst_structure_get_int (structure, "rate", &samplerate);
- ttadec->samplerate = (guint32) samplerate;
- gst_structure_get_int (structure, "channels", &channels);
- ttadec->channels = (guint) channels;
- gst_structure_get_int (structure, "width", &bits);
- ttadec->bytes = bits / 8;
-
- srccaps = gst_caps_new_simple ("audio/x-raw-int",
- "rate", G_TYPE_INT, ttadec->samplerate,
- "channels", G_TYPE_INT, ttadec->channels,
- "depth", G_TYPE_INT, bits,
- "width", G_TYPE_INT, bits,
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "signed", G_TYPE_BOOLEAN, TRUE, NULL);
-
- if (!gst_pad_set_caps (ttadec->srcpad, srccaps))
- return FALSE;
-
- ttadec->frame_length = FRAME_TIME * ttadec->samplerate;
-
- ttadec->tta = g_malloc (ttadec->channels * sizeof (decoder));
- ttadec->cache = g_malloc (ttadec->channels * sizeof (long));
-
- ttadec->decdata =
- (guchar *) g_malloc (ttadec->channels * ttadec->frame_length *
- ttadec->bytes * sizeof (guchar));
-
- return TRUE;
-}
-
-GType
-gst_tta_dec_get_type (void)
-{
- static GType plugin_type = 0;
-
- if (!plugin_type) {
- static const GTypeInfo plugin_info = {
- sizeof (GstTtaDecClass),
- (GBaseInitFunc) gst_tta_dec_base_init,
- NULL,
- (GClassInitFunc) gst_tta_dec_class_init,
- NULL,
- NULL,
- sizeof (GstTtaDec),
- 0,
- (GInstanceInitFunc) gst_tta_dec_init,
- };
- plugin_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstTtaDec", &plugin_info, 0);
- }
- return plugin_type;
-}
-
-static void
-gst_tta_dec_base_init (GstTtaDecClass * klass)
-{
-
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_static_pad_template (element_class, &src_factory);
- gst_element_class_add_static_pad_template (element_class, &sink_factory);
- gst_element_class_set_static_metadata (element_class, "TTA audio decoder",
- "Codec/Decoder/Audio",
- "Decode TTA audio data", "Arwed v. Merkatz <v.merkatz@gmx.net>");
-}
-
-static void
-gst_tta_dec_dispose (GObject * object)
-{
- GstTtaDec *ttadec = GST_TTA_DEC (object);
-
- g_free (ttadec->tta);
- g_free (ttadec->decdata);
- g_free (ttadec->tta_buf.buffer);
-
- G_OBJECT_CLASS (parent)->dispose (object);
-}
-
-static void
-gst_tta_dec_class_init (GstTtaDecClass * klass)
-{
- GObjectClass *gobject_class;
-
- gobject_class = (GObjectClass *) klass;
-
- parent = g_type_class_peek_parent (klass);
-
- gobject_class->dispose = gst_tta_dec_dispose;
-}
-
-static void
-gst_tta_dec_init (GstTtaDec * ttadec)
-{
- GstElementClass *klass = GST_ELEMENT_GET_CLASS (ttadec);
-
- ttadec->sinkpad =
- gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
- "sink"), "sink");
- gst_pad_set_setcaps_function (ttadec->sinkpad, gst_tta_dec_setcaps);
-
- ttadec->srcpad =
- gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
- "src"), "src");
- gst_pad_use_fixed_caps (ttadec->srcpad);
-
- gst_element_add_pad (GST_ELEMENT (ttadec), ttadec->sinkpad);
- gst_element_add_pad (GST_ELEMENT (ttadec), ttadec->srcpad);
- gst_pad_set_chain_function (ttadec->sinkpad, gst_tta_dec_chain);
- ttadec->tta_buf.buffer = (guchar *) g_malloc (TTA_BUFFER_SIZE + 4);
- ttadec->tta_buf.buffer_end = ttadec->tta_buf.buffer + TTA_BUFFER_SIZE;
-}
-
-static void
-rice_init (adapt * rice, unsigned long k0, unsigned long k1)
-{
- rice->k0 = k0;
- rice->k1 = k1;
- rice->sum0 = shift_16[k0];
- rice->sum1 = shift_16[k1];
-}
-
-static void
-decoder_init (decoder * tta, long nch, long byte_size)
-{
- long shift = flt_set[byte_size - 1];
- long i;
-
- for (i = 0; i < nch; i++) {
- filter_init (&tta[i].fst, shift);
- rice_init (&tta[i].rice, 10, 10);
- tta[i].last = 0;
- }
-}
-
-static void
-get_binary (tta_buffer * tta_buf, guchar * buffer, unsigned long buffersize,
- unsigned long *value, unsigned long bits)
-{
- while (tta_buf->bit_count < bits) {
- if (tta_buf->bitpos == tta_buf->buffer_end) {
- int max =
- TTA_BUFFER_SIZE <=
- buffersize - tta_buf->offset ? TTA_BUFFER_SIZE : buffersize -
- tta_buf->offset;
- memcpy (tta_buf->buffer, buffer + tta_buf->offset, max);
- tta_buf->offset += max;
- tta_buf->bitpos = tta_buf->buffer;
- }
-
- tta_buf->bit_cache |= *tta_buf->bitpos << tta_buf->bit_count;
- tta_buf->bit_count += 8;
- tta_buf->bitpos++;
- }
-
- *value = tta_buf->bit_cache & bit_mask[bits];
- tta_buf->bit_cache >>= bits;
- tta_buf->bit_count -= bits;
- tta_buf->bit_cache &= bit_mask[tta_buf->bit_count];
-}
-
-static void
-get_unary (tta_buffer * tta_buf, guchar * buffer, unsigned long buffersize,
- unsigned long *value)
-{
- *value = 0;
-
- while (!(tta_buf->bit_cache ^ bit_mask[tta_buf->bit_count])) {
- if (tta_buf->bitpos == tta_buf->buffer_end) {
- int max =
- TTA_BUFFER_SIZE <=
- buffersize - tta_buf->offset ? TTA_BUFFER_SIZE : buffersize -
- tta_buf->offset;
- memcpy (tta_buf->buffer, buffer + tta_buf->offset, max);
- tta_buf->offset += max;
- tta_buf->bitpos = tta_buf->buffer;
- }
-
- *value += tta_buf->bit_count;
- tta_buf->bit_cache = *tta_buf->bitpos++;
- tta_buf->bit_count = 8;
- }
-
- while (tta_buf->bit_cache & 1) {
- (*value)++;
- tta_buf->bit_cache >>= 1;
- tta_buf->bit_count--;
- }
-
- tta_buf->bit_cache >>= 1;
- tta_buf->bit_count--;
-}
-
-static GstFlowReturn
-gst_tta_dec_chain (GstPad * pad, GstBuffer * in)
-{
- GstTtaDec *ttadec;
- GstBuffer *outbuf, *buf = GST_BUFFER (in);
- guchar *data, *p;
- decoder *dec;
- unsigned long outsize;
- unsigned long size;
- guint32 frame_samples;
- long res;
- long *prev;
-
- ttadec = GST_TTA_DEC (GST_OBJECT_PARENT (pad));
-
- data = GST_BUFFER_DATA (buf);
- size = GST_BUFFER_SIZE (buf);
-
- ttadec->tta_buf.bit_count = 0;
- ttadec->tta_buf.bit_cache = 0;
- ttadec->tta_buf.bitpos = ttadec->tta_buf.buffer_end;
- ttadec->tta_buf.offset = 0;
- decoder_init (ttadec->tta, ttadec->channels, ttadec->bytes);
-
- if (GST_BUFFER_DURATION_IS_VALID (buf)) {
- frame_samples =
- ceil ((gdouble) (GST_BUFFER_DURATION (buf) * ttadec->samplerate) /
- (gdouble) GST_SECOND);
- } else {
- frame_samples = ttadec->samplerate * FRAME_TIME;
- }
- outsize = ttadec->channels * frame_samples * ttadec->bytes;
-
- dec = ttadec->tta;
- p = ttadec->decdata;
- prev = ttadec->cache;
- for (res = 0;
- p < ttadec->decdata + frame_samples * ttadec->channels * ttadec->bytes;) {
- unsigned long unary, binary, depth, k;
- long value, temp_value;
- fltst *fst = &dec->fst;
- adapt *rice = &dec->rice;
- long *last = &dec->last;
-
- // decode Rice unsigned
- get_unary (&ttadec->tta_buf, data, size, &unary);
-
- switch (unary) {
- case 0:
- depth = 0;
- k = rice->k0;
- break;
- default:
- depth = 1;
- k = rice->k1;
- unary--;
- }
-
- if (k) {
- get_binary (&ttadec->tta_buf, data, size, &binary, k);
- value = (unary << k) + binary;
- } else
- value = unary;
-
- switch (depth) {
- case 1:
- rice->sum1 += value - (rice->sum1 >> 4);
- if (rice->k1 > 0 && rice->sum1 < shift_16[rice->k1])
- rice->k1--;
- else if (rice->sum1 > shift_16[rice->k1 + 1])
- rice->k1++;
- value += bit_shift[rice->k0];
- default:
- rice->sum0 += value - (rice->sum0 >> 4);
- if (rice->k0 > 0 && rice->sum0 < shift_16[rice->k0])
- rice->k0--;
- else if (rice->sum0 > shift_16[rice->k0 + 1])
- rice->k0++;
- }
-
- /* this only uses a temporary variable to silence a gcc warning */
- temp_value = DEC (value);
- value = temp_value;
-
- // decompress stage 1: adaptive hybrid filter
- hybrid_filter (fst, &value);
-
- // decompress stage 2: fixed order 1 prediction
- switch (ttadec->bytes) {
- case 1:
- value += PREDICTOR1 (*last, 4);
- break; // bps 8
- case 2:
- value += PREDICTOR1 (*last, 5);
- break; // bps 16
- case 3:
- value += PREDICTOR1 (*last, 5);
- break; // bps 24
- case 4:
- value += *last;
- break; // bps 32
- }
- *last = value;
-
- if (dec < ttadec->tta + ttadec->channels - 1) {
- *prev++ = value;
- dec++;
- } else {
- *prev = value;
- if (ttadec->channels > 1) {
- long *r = prev - 1;
-
- for (*prev += *r / 2; r >= ttadec->cache; r--)
- *r = *(r + 1) - *r;
- for (r = ttadec->cache; r < prev; r++)
- WRITE_BUFFER (r, ttadec->bytes, p);
- }
- WRITE_BUFFER (prev, ttadec->bytes, p);
- prev = ttadec->cache;
- res++;
- dec = ttadec->tta;
- }
- }
-
- outbuf = gst_buffer_new_and_alloc (outsize);
- memcpy (GST_BUFFER_DATA (outbuf), ttadec->decdata, outsize);
- GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
- GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf);
- gst_buffer_set_caps (outbuf, GST_PAD_CAPS (ttadec->srcpad));
- return gst_pad_push (ttadec->srcpad, outbuf);
-}
-
-gboolean
-gst_tta_dec_plugin_init (GstPlugin * plugin)
-{
- return gst_element_register (plugin, "ttadec",
- GST_RANK_NONE, GST_TYPE_TTA_DEC);
-}
diff --git a/gst/tta/gstttadec.h b/gst/tta/gstttadec.h
deleted file mode 100644
index 6c6fb4376..000000000
--- a/gst/tta/gstttadec.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* GStreamer TTA plugin
- * (c) 2004 Arwed v. Merkatz <v.merkatz@gmx.net>
- *
- * gstttadec.h: raw TTA bitstream decoder
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_TTA_DEC_H__
-#define __GST_TTA_DEC_H__
-
-#include <gst/gst.h>
-
-#include "ttadec.h"
-
-G_BEGIN_DECLS
-
-/* #define's don't like whitespacey bits */
-#define GST_TYPE_TTA_DEC \
- (gst_tta_dec_get_type())
-#define GST_TTA_DEC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TTA_DEC,GstTtaDec))
-#define GST_TTA_DEC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TTA_DEC,GstTtaDecClass))
-#define GST_IS_TTA_DEC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TTA_DEC))
-#define GST_IS_TTA_DEC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TTA_DEC))
-
-typedef struct _GstTtaDec GstTtaDec;
-typedef struct _GstTtaDecClass GstTtaDecClass;
-
-typedef struct _tta_buffer
-{
- guchar *buffer;
- guchar *buffer_end;
- gulong bit_count;
- gulong bit_cache;
- guchar *bitpos;
- gulong offset;
-} tta_buffer;
-
-struct _GstTtaDec
-{
- GstElement element;
-
- GstPad *sinkpad, *srcpad;
-
- guint32 samplerate;
- guint channels;
- guint bytes;
- long frame_length;
-
- decoder *tta;
- guchar *decdata;
- tta_buffer tta_buf;
- long *cache;
-};
-
-struct _GstTtaDecClass
-{
- GstElementClass parent;
-};
-
-GType gst_tta_dec_get_type (void);
-
-gboolean gst_tta_dec_plugin_init (GstPlugin *plugin);
-
-G_END_DECLS
-
-#endif /* __GST_TTA_DEC_H__ */
diff --git a/gst/tta/gstttaparse.c b/gst/tta/gstttaparse.c
deleted file mode 100644
index 485a19746..000000000
--- a/gst/tta/gstttaparse.c
+++ /dev/null
@@ -1,507 +0,0 @@
-/* GStreamer TTA plugin
- * (c) 2004 Arwed v. Merkatz <v.merkatz@gmx.net>
- *
- * gstttaparse.c: TTA file 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
-#include <gst/gst.h>
-
-#include <math.h>
-
-#include "gstttaparse.h"
-#include "ttadec.h"
-#include "crc32.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_tta_parse_debug);
-#define GST_CAT_DEFAULT gst_tta_parse_debug
-
-static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-ttafile")
- );
-
-static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-tta, "
- "width = (int) { 8, 16, 24 }, "
- "channels = (int) { 1, 2 }, " "rate = (int) [ 8000, 96000 ]")
- );
-
-static void gst_tta_parse_class_init (GstTtaParseClass * klass);
-static void gst_tta_parse_base_init (GstTtaParseClass * klass);
-static void gst_tta_parse_init (GstTtaParse * ttaparse);
-
-static gboolean gst_tta_parse_src_event (GstPad * pad, GstEvent * event);
-static const GstQueryType *gst_tta_parse_get_query_types (GstPad * pad);
-static gboolean gst_tta_parse_query (GstPad * pad, GstQuery * query);
-static gboolean gst_tta_parse_activate (GstPad * pad);
-static gboolean gst_tta_parse_activate_pull (GstPad * pad, gboolean active);
-static void gst_tta_parse_loop (GstTtaParse * ttaparse);
-static GstStateChangeReturn gst_tta_parse_change_state (GstElement * element,
- GstStateChange transition);
-
-static GstElementClass *parent_class = NULL;
-
-GType
-gst_tta_parse_get_type (void)
-{
- static GType plugin_type = 0;
-
- if (!plugin_type) {
- static const GTypeInfo plugin_info = {
- sizeof (GstTtaParseClass),
- (GBaseInitFunc) gst_tta_parse_base_init,
- NULL,
- (GClassInitFunc) gst_tta_parse_class_init,
- NULL,
- NULL,
- sizeof (GstTtaParse),
- 0,
- (GInstanceInitFunc) gst_tta_parse_init,
- };
- plugin_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstTtaParse", &plugin_info, 0);
- }
- return plugin_type;
-}
-
-static void
-gst_tta_parse_base_init (GstTtaParseClass * klass)
-{
-
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_static_pad_template (element_class, &src_factory);
- gst_element_class_add_static_pad_template (element_class, &sink_factory);
- gst_element_class_set_static_metadata (element_class, "TTA file parser",
- "Codec/Demuxer/Audio",
- "Parses TTA files", "Arwed v. Merkatz <v.merkatz@gmx.net>");
-}
-
-static void
-gst_tta_parse_dispose (GObject * object)
-{
- GstTtaParse *ttaparse = GST_TTA_PARSE (object);
-
- g_free (ttaparse->index);
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-gst_tta_parse_class_init (GstTtaParseClass * 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->dispose = gst_tta_parse_dispose;
- gstelement_class->change_state = gst_tta_parse_change_state;
-}
-
-static void
-gst_tta_parse_reset (GstTtaParse * ttaparse)
-{
- ttaparse->header_parsed = FALSE;
- ttaparse->current_frame = 0;
- ttaparse->data_length = 0;
- ttaparse->samplerate = 0;
-}
-
-static void
-gst_tta_parse_init (GstTtaParse * ttaparse)
-{
- GstElementClass *klass = GST_ELEMENT_GET_CLASS (ttaparse);
-
- ttaparse->sinkpad =
- gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
- "sink"), "sink");
-
- ttaparse->srcpad =
- gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
- "src"), "src");
- gst_pad_use_fixed_caps (ttaparse->srcpad);
- gst_pad_set_query_type_function (ttaparse->srcpad,
- gst_tta_parse_get_query_types);
- gst_pad_set_query_function (ttaparse->srcpad, gst_tta_parse_query);
- gst_pad_set_event_function (ttaparse->srcpad, gst_tta_parse_src_event);
-
- gst_element_add_pad (GST_ELEMENT (ttaparse), ttaparse->sinkpad);
- gst_element_add_pad (GST_ELEMENT (ttaparse), ttaparse->srcpad);
- gst_pad_set_activate_function (ttaparse->sinkpad, gst_tta_parse_activate);
- gst_pad_set_activatepull_function (ttaparse->sinkpad,
- gst_tta_parse_activate_pull);
-
- gst_tta_parse_reset (ttaparse);
-}
-
-static gboolean
-gst_tta_parse_src_event (GstPad * pad, GstEvent * event)
-{
- GstTtaParse *ttaparse = GST_TTA_PARSE (GST_PAD_PARENT (pad));
-
- gboolean res = TRUE;
-
- switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_SEEK:
- {
- gdouble rate;
- GstFormat format;
- GstSeekFlags flags;
- GstSeekType start_type, stop_type;
- gint64 start, stop;
-
- gst_event_parse_seek (event, &rate, &format, &flags,
- &start_type, &start, &stop_type, &stop);
-
- if (format == GST_FORMAT_TIME) {
- if (flags & GST_SEEK_FLAG_FLUSH) {
- gst_pad_push_event (ttaparse->srcpad, gst_event_new_flush_start ());
- gst_pad_push_event (ttaparse->sinkpad, gst_event_new_flush_start ());
- } else {
- gst_pad_pause_task (ttaparse->sinkpad);
- }
- GST_PAD_STREAM_LOCK (ttaparse->sinkpad);
-
- switch (start_type) {
- case GST_SEEK_TYPE_CUR:
- ttaparse->current_frame += (start / GST_SECOND) / FRAME_TIME;
- break;
- case GST_SEEK_TYPE_END:
- ttaparse->current_frame += (start / GST_SECOND) / FRAME_TIME;
- break;
- case GST_SEEK_TYPE_SET:
- ttaparse->current_frame = (start / GST_SECOND) / FRAME_TIME;
- break;
- case GST_SEEK_TYPE_NONE:
- break;
- }
- res = TRUE;
-
- if (flags & GST_SEEK_FLAG_FLUSH) {
- gst_pad_push_event (ttaparse->srcpad, gst_event_new_flush_stop ());
- gst_pad_push_event (ttaparse->sinkpad, gst_event_new_flush_stop ());
- }
-
- gst_pad_push_event (ttaparse->srcpad, gst_event_new_new_segment (FALSE,
- 1.0, GST_FORMAT_TIME, 0,
- ttaparse->num_frames * FRAME_TIME * GST_SECOND, 0));
-
- gst_pad_start_task (ttaparse->sinkpad,
- (GstTaskFunction) gst_tta_parse_loop, ttaparse, NULL);
-
- GST_PAD_STREAM_UNLOCK (ttaparse->sinkpad);
-
- } else {
- res = FALSE;
- }
-
- gst_event_unref (event);
- break;
- }
- default:
- res = gst_pad_event_default (pad, event);
- break;
- }
-
- return res;
-}
-
-static const GstQueryType *
-gst_tta_parse_get_query_types (GstPad * pad)
-{
- static const GstQueryType types[] = {
- GST_QUERY_POSITION,
- GST_QUERY_DURATION,
- 0
- };
-
- return types;
-}
-
-static gboolean
-gst_tta_parse_query (GstPad * pad, GstQuery * query)
-{
- GstTtaParse *ttaparse = GST_TTA_PARSE (gst_pad_get_parent (pad));
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_POSITION:
- {
- GstFormat format;
- gint64 cur;
-
- gst_query_parse_position (query, &format, NULL);
- switch (format) {
- case GST_FORMAT_TIME:
- cur = ttaparse->index[ttaparse->current_frame].time;
- break;
- default:
- format = GST_FORMAT_BYTES;
- cur = ttaparse->index[ttaparse->current_frame].pos;
- break;
- }
- gst_query_set_position (query, format, cur);
- break;
- }
- case GST_QUERY_DURATION:
- {
- GstFormat format;
- gint64 end;
-
- gst_query_parse_duration (query, &format, NULL);
- switch (format) {
- case GST_FORMAT_TIME:
- end = ((gdouble) ttaparse->data_length /
- (gdouble) ttaparse->samplerate) * GST_SECOND;
- break;
- default:
- format = GST_FORMAT_BYTES;
- end = ttaparse->index[ttaparse->num_frames].pos +
- ttaparse->index[ttaparse->num_frames].size;
- break;
- }
- gst_query_set_duration (query, format, end);
- break;
- }
- default:
- return FALSE;
- break;
- }
- return TRUE;
-}
-
-static gboolean
-gst_tta_parse_activate (GstPad * pad)
-{
- if (gst_pad_check_pull_range (pad)) {
- return gst_pad_activate_pull (pad, TRUE);
- }
- return FALSE;
-}
-
-static gboolean
-gst_tta_parse_activate_pull (GstPad * pad, gboolean active)
-{
- GstTtaParse *ttaparse = GST_TTA_PARSE (GST_OBJECT_PARENT (pad));
-
- if (active) {
- gst_pad_start_task (pad, (GstTaskFunction) gst_tta_parse_loop, ttaparse,
- NULL);
- } else {
- gst_pad_stop_task (pad);
- }
-
- return TRUE;
-}
-
-static GstFlowReturn
-gst_tta_parse_parse_header (GstTtaParse * ttaparse)
-{
- guchar *data;
- GstBuffer *buf = NULL;
- guint32 crc;
- double frame_length;
- int num_frames;
- GstCaps *caps;
- int i;
- guint32 offset;
- GstEvent *discont;
-
- if (gst_pad_pull_range (ttaparse->sinkpad, 0, 22, &buf) != GST_FLOW_OK)
- goto pull_fail;
- data = GST_BUFFER_DATA (buf);
- ttaparse->channels = GST_READ_UINT16_LE (data + 6);
- ttaparse->bits = GST_READ_UINT16_LE (data + 8);
- ttaparse->samplerate = GST_READ_UINT32_LE (data + 10);
- ttaparse->data_length = GST_READ_UINT32_LE (data + 14);
- crc = crc32 (data, 18);
- if (crc != GST_READ_UINT32_LE (data + 18)) {
- GST_DEBUG ("Header CRC wrong!");
- }
- frame_length = FRAME_TIME * ttaparse->samplerate;
- num_frames = (ttaparse->data_length / frame_length) + 1;
- ttaparse->num_frames = num_frames;
- gst_buffer_unref (buf);
-
- ttaparse->index =
- (GstTtaIndex *) g_malloc (num_frames * sizeof (GstTtaIndex));
- if (gst_pad_pull_range (ttaparse->sinkpad,
- 22, num_frames * 4 + 4, &buf) != GST_FLOW_OK)
- goto pull_fail;
- data = GST_BUFFER_DATA (buf);
-
- offset = 22 + num_frames * 4 + 4; // header size + seektable size
- for (i = 0; i < num_frames; i++) {
- ttaparse->index[i].size = GST_READ_UINT32_LE (data + i * 4);
- ttaparse->index[i].pos = offset;
- offset += ttaparse->index[i].size;
- ttaparse->index[i].time = i * FRAME_TIME * GST_SECOND;
- }
- crc = crc32 (data, num_frames * 4);
- if (crc != GST_READ_UINT32_LE (data + num_frames * 4)) {
- GST_DEBUG ("Seektable CRC wrong!");
- }
-
- GST_DEBUG
- ("channels: %u, bits: %u, samplerate: %u, data_length: %u, num_frames: %u",
- ttaparse->channels, ttaparse->bits, ttaparse->samplerate,
- ttaparse->data_length, num_frames);
-
- ttaparse->header_parsed = TRUE;
- caps = gst_caps_new_simple ("audio/x-tta",
- "width", G_TYPE_INT, ttaparse->bits,
- "channels", G_TYPE_INT, ttaparse->channels,
- "rate", G_TYPE_INT, ttaparse->samplerate, NULL);
- gst_pad_set_caps (ttaparse->srcpad, caps);
-
- discont =
- gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0,
- num_frames * FRAME_TIME * GST_SECOND, 0);
-
- gst_pad_push_event (ttaparse->srcpad, discont);
-
- return GST_FLOW_OK;
-
-pull_fail:
- {
- GST_ELEMENT_ERROR (ttaparse, STREAM, DEMUX, (NULL),
- ("Couldn't read header"));
- return GST_FLOW_ERROR;
- }
-}
-
-static GstFlowReturn
-gst_tta_parse_stream_data (GstTtaParse * ttaparse)
-{
- GstBuffer *buf = NULL;
- GstFlowReturn res = GST_FLOW_OK;
-
- if (ttaparse->current_frame >= ttaparse->num_frames)
- goto found_eos;
-
- GST_DEBUG ("playing frame %u of %u", ttaparse->current_frame + 1,
- ttaparse->num_frames);
- if ((res = gst_pad_pull_range (ttaparse->sinkpad,
- ttaparse->index[ttaparse->current_frame].pos,
- ttaparse->index[ttaparse->current_frame].size,
- &buf)) != GST_FLOW_OK)
- goto pull_error;
-
- GST_BUFFER_OFFSET (buf) = ttaparse->index[ttaparse->current_frame].pos;
- GST_BUFFER_TIMESTAMP (buf) = ttaparse->index[ttaparse->current_frame].time;
- if (ttaparse->current_frame + 1 == ttaparse->num_frames) {
- guint32 samples =
- ttaparse->data_length % (gint64) (ttaparse->samplerate * FRAME_TIME);
- gdouble frametime = (gdouble) samples / (gdouble) ttaparse->samplerate;
-
- GST_BUFFER_DURATION (buf) = (guint64) (frametime * GST_SECOND);
- } else {
- GST_BUFFER_DURATION (buf) = FRAME_TIME * GST_SECOND;
- }
- gst_buffer_set_caps (buf, GST_PAD_CAPS (ttaparse->srcpad));
-
- if ((res = gst_pad_push (ttaparse->srcpad, buf)) != GST_FLOW_OK)
- goto push_error;
- ttaparse->current_frame++;
-
- return res;
-
-found_eos:
- {
- GST_DEBUG ("found EOS");
- gst_pad_push_event (ttaparse->srcpad, gst_event_new_eos ());
- return GST_FLOW_FLUSHING;
- }
-pull_error:
- {
- GST_DEBUG ("Error getting frame from the sinkpad");
- return res;
- }
-push_error:
- {
- GST_DEBUG ("Error pushing on srcpad");
- return res;
- }
-}
-
-static void
-gst_tta_parse_loop (GstTtaParse * ttaparse)
-{
- GstFlowReturn ret;
-
- if (!ttaparse->header_parsed)
- if ((ret = gst_tta_parse_parse_header (ttaparse)) != GST_FLOW_OK)
- goto pause;
- if ((ret = gst_tta_parse_stream_data (ttaparse)) != GST_FLOW_OK)
- goto pause;
-
- return;
-
-pause:
- GST_LOG_OBJECT (ttaparse, "pausing task, %s", gst_flow_get_name (ret));
- gst_pad_pause_task (ttaparse->sinkpad);
- if (ret == GST_FLOW_UNEXPECTED) {
- gst_pad_push_event (ttaparse->srcpad, gst_event_new_eos ());
- } else if (ret < GST_FLOW_UNEXPECTED || ret == GST_FLOW_NOT_LINKED) {
- GST_ELEMENT_FLOW_ERROR (ttaparse, ret);
- gst_pad_push_event (ttaparse->srcpad, gst_event_new_eos ());
- }
-}
-
-static GstStateChangeReturn
-gst_tta_parse_change_state (GstElement * element, GstStateChange transition)
-{
- GstStateChangeReturn ret;
- GstTtaParse *ttaparse = GST_TTA_PARSE (element);
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- gst_tta_parse_reset (ttaparse);
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-gboolean
-gst_tta_parse_plugin_init (GstPlugin * plugin)
-{
- if (!gst_element_register (plugin, "ttaparse",
- GST_RANK_NONE, GST_TYPE_TTA_PARSE)) {
- return FALSE;
- }
-
- GST_DEBUG_CATEGORY_INIT (gst_tta_parse_debug, "ttaparse", 0,
- "tta file parser");
-
- return TRUE;
-}
diff --git a/gst/tta/gstttaparse.h b/gst/tta/gstttaparse.h
deleted file mode 100644
index 2c1ccc7f3..000000000
--- a/gst/tta/gstttaparse.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* GStreamer TTA plugin
- * (c) 2004 Arwed v. Merkatz <v.merkatz@gmx.net>
- *
- * gstttaparse.h: TTA file 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_TTA_PARSE_H__
-#define __GST_TTA_PARSE_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-/* #define's don't like whitespacey bits */
-#define GST_TYPE_TTA_PARSE \
- (gst_tta_parse_get_type())
-#define GST_TTA_PARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TTA_PARSE,GstTtaParse))
-#define GST_TTA_PARSE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TTA_PARSE,GstTtaParseClass))
-#define GST_IS_TTA_PARSE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TTA_PARSE))
-#define GST_IS_TTA_PARSE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TTA_PARSE))
-
-typedef struct _GstTtaParse GstTtaParse;
-typedef struct _GstTtaParseClass GstTtaParseClass;
-
-typedef struct _GstTtaIndex {
- guint32 size; /* size of frame frameno */
- guint64 pos; /* start of the frame */
- guint64 time; /* in nanoseconds */
-} GstTtaIndex;
-
-struct _GstTtaParse
-{
- GstElement element;
-
- GstPad *sinkpad, *srcpad;
-
- gboolean header_parsed;
- guint32 samplerate;
- guint16 channels;
- guint16 bits;
- guint32 data_length;
- guint num_frames;
-
- GstTtaIndex *index;
-
- guint32 current_frame;
-};
-
-struct _GstTtaParseClass
-{
- GstElementClass parent;
-};
-
-GType gst_tta_parse_get_type (void);
-
-gboolean gst_tta_parse_plugin_init (GstPlugin *plugin);
-
-G_END_DECLS
-
-#endif /* __GST_TTA_PARSE_H__ */
diff --git a/gst/tta/meson.build b/gst/tta/meson.build
deleted file mode 100644
index cd14b3f9a..000000000
--- a/gst/tta/meson.build
+++ /dev/null
@@ -1,14 +0,0 @@
-tta_sources = [
- 'gsttta.c',
- 'gstttaparse.c',
- 'gstttadec.c',
-]
-
-gsttta = library('gsttta',
- tta_sources,
- c_args : gst_plugins_bad_args,
- include_directories : [configinc],
- dependencies : [gstbase_dep],
- install : true,
- install_dir : plugins_install_dir,
-)
diff --git a/gst/tta/ttadec.h b/gst/tta/ttadec.h
deleted file mode 100644
index 7a889d9e2..000000000
--- a/gst/tta/ttadec.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * ttadec.h
- *
- * Description: TTAv1 decoder definitions and prototypes
- * Developed by: Alexander Djourik <sasha@iszf.irk.ru>
- * Pavel Zhilin <pzh@iszf.irk.ru>
- *
- * Copyright (c) 1999-2004 Alexander Djourik. All rights reserved.
- *
- */
-
-/*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Please see the file COPYING in this directory for full copyright
- * information.
- */
-
-#ifndef TTADEC_H_
-#define TTADEC_H_
-
-#ifdef _WIN32
-#pragma pack(1)
-#define __ATTRIBUTE_PACKED__
-#else
-#define __ATTRIBUTE_PACKED__ __attribute__((packed))
-#endif
-
-#define TTA1_SIGN 0x31415454
-#define FRAME_TIME 1.04489795918367346939
-#define MAX_ORDER 8
-
-#ifndef WAVE_FORMAT_PCM
-#define WAVE_FORMAT_PCM 1
-#endif
-
-#ifdef _WIN32
- typedef unsigned __int64 uint64;
-#else
- typedef unsigned long long uint64;
-#endif
-
-/**
- * moved to gstttadec.c to silence gcc warnings
- */
-/*
-static const unsigned long bit_mask[] = {
- 0x00000000, 0x00000001, 0x00000003, 0x00000007,
- 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f,
- 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff,
- 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff,
- 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff,
- 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff,
- 0x00ffffff, 0x01ffffff, 0x03ffffff, 0x07ffffff,
- 0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff,
- 0xffffffff
-};
-
-static const unsigned long bit_shift[] = {
- 0x00000001, 0x00000002, 0x00000004, 0x00000008,
- 0x00000010, 0x00000020, 0x00000040, 0x00000080,
- 0x00000100, 0x00000200, 0x00000400, 0x00000800,
- 0x00001000, 0x00002000, 0x00004000, 0x00008000,
- 0x00010000, 0x00020000, 0x00040000, 0x00080000,
- 0x00100000, 0x00200000, 0x00400000, 0x00800000,
- 0x01000000, 0x02000000, 0x04000000, 0x08000000,
- 0x10000000, 0x20000000, 0x40000000, 0x80000000,
- 0x80000000, 0x80000000, 0x80000000, 0x80000000,
- 0x80000000, 0x80000000, 0x80000000, 0x80000000
-};
-
-static const unsigned long *shift_16 = bit_shift + 4;
-*/
-
-typedef unsigned char byte;
-
-#ifdef _BIG_ENDIAN
-#define ENDSWAP_INT16(x) (((((x)>>8)&0xFF)|(((x)&0xFF)<<8)))
-#define ENDSWAP_INT32(x) (((((x)>>24)&0xFF)|(((x)>>8)&0xFF00)|(((x)&0xFF00)<<8)|(((x)&0xFF)<<24)))
-#define WRITE_BUFFER(x, bsize, out) { \
- if (bsize > 2) *out++ = (byte)(*x >> 16); \
- if (bsize > 1) *out++ = (byte)(*x >> 8); \
- *out++ = (byte) *x; }
-#else
-#define ENDSWAP_INT16(x) (x)
-#define ENDSWAP_INT32(x) (x)
-#define WRITE_BUFFER(x, bsize, out) { \
- *out++ = (byte) *x; \
- if (bsize > 1) *out++ = (byte)(*x >> 8); \
- if (bsize > 2) *out++ = (byte)(*x >> 16); }
-#endif
-
-#define PREDICTOR1(x, k) ((long)((((uint64)x << k) - x) >> k))
-#define DEC(x) (((x)&1)?(++(x)>>1):(-(x)>>1))
-
-#if 0
-/* This doesn't compile on non-gcc compilers */
-typedef struct {
- unsigned long TTAid;
- unsigned short AudioFormat;
- unsigned short NumChannels;
- unsigned short BitsPerSample;
- unsigned long SampleRate;
- unsigned long DataLength;
- unsigned long CRC32;
-} __ATTRIBUTE_PACKED__ tta_hdr;
-#endif
-
-typedef struct {
- unsigned long k0;
- unsigned long k1;
- unsigned long sum0;
- unsigned long sum1;
-} adapt;
-
-typedef struct {
- long shift;
- long round;
- long error;
- long mutex;
- long qm[MAX_ORDER+1];
- long dx[MAX_ORDER+1];
- long dl[MAX_ORDER+1];
-} fltst;
-
-typedef struct {
- fltst fst;
- adapt rice;
- long last;
-} decoder;
-
-#endif /* TTADEC_H_ */
diff --git a/gst/vbidec/Makefile.am b/gst/vbidec/Makefile.am
deleted file mode 100644
index 804452530..000000000
--- a/gst/vbidec/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-
-plugin_LTLIBRARIES = libgstvbidec.la
-
-libgstvbidec_la_SOURCES = gstvbidec.h gstvbidec.c \
- vbidata.h vbidata.c \
- vbiscreen.h vbiscreen.c
-libgstvbidec_la_CFLAGS = $(GST_CFLAGS)
-libgstvbidec_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstvbidec_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
diff --git a/gst/vbidec/gstvbidec.c b/gst/vbidec/gstvbidec.c
deleted file mode 100644
index 36531a9ac..000000000
--- a/gst/vbidec/gstvbidec.c
+++ /dev/null
@@ -1,381 +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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <inttypes.h>
-#include <ctype.h>
-#include <gst/gst.h>
-#include "gstvbidec.h"
-#include "vbidata.h"
-#include "vbiscreen.h"
-
-#define GST_TYPE_VBIDEC \
- (gst_vbidec_get_type())
-#define GST_VBIDEC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VBIDEC,GstVBIDec))
-#define GST_VBIDEC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VBIDEC,GstVBIDec))
-#define GST_IS_VBIDEC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VBIDEC))
-#define GST_IS_VBIDEC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VBIDEC))
-
-//typedef struct _GstVBIDec GstVBIDec;
-typedef struct _GstVBIDecClass GstVBIDecClass;
-
-struct _GstVBIDec
-{
- GstElement element;
-
- /* pads */
- GstPad *sinkpad, *srcpad;
- char caption[128];
- vbiscreen_t *vbiscreen;
- vbidata_t *vbidata;
- int caption_type;
- gboolean dvd_input;
-};
-
-struct _GstVBIDecClass
-{
- GstElementClass parent_class;
-};
-
-GType gst_vbidec_get_type (void);
-
-/* VBIDec signals and args */
-enum
-{
- LAST_SIGNAL
-};
-
-enum
-{
- PROP_0,
- PROP_VERBOSE,
- PROP_CAPTION_TYPE,
- PROP_DVD_INPUT
-};
-
-static GstStaticPadTemplate gst_vbidec_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-static GstStaticPadTemplate gst_vbidec_src_template =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("text/plain")
- );
-
-
-#define GST_TYPE_VBIDEC_CAPTION_TYPE_TYPE (gst_vbidec_caption_type_get_type())
-static GType
-gst_vbidec_caption_type_get_type (void)
-{
- static GType vbidec_caption_type_type = 0;
- static const GEnumValue vbidec_caption_type[] = {
- {CAPTURE_OFF, "0", "Closed Captions off"},
- {CAPTURE_CC1, "1", "Closed Caption CC1"},
- {CAPTURE_CC2, "2", "Closed Caption CC2"},
- {CAPTURE_CC3, "4", "Closed Caption CC3"},
- {CAPTURE_CC4, "5", "Closed Caption CC4"},
- {CAPTURE_T1, "6", "Closed Caption T1"},
- {CAPTURE_T2, "7", "Closed Caption T2"},
- {CAPTURE_T3, "8", "Closed Caption T3"},
- {CAPTURE_T4, "9", "Closed Caption T4"},
- {0, NULL, NULL},
- };
-
- if (!vbidec_caption_type_type) {
- vbidec_caption_type_type =
- g_enum_register_static ("GstVBIDecCaptionTypeType",
- vbidec_caption_type);
- }
- return vbidec_caption_type_type;
-}
-
-static void gst_vbidec_base_init (gpointer g_class);
-static void gst_vbidec_class_init (GstVBIDecClass * klass);
-static void gst_vbidec_init (GstVBIDec * vbidec);
-
-static void gst_vbidec_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_vbidec_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static void gst_vbidec_chain (GstPad * pad, GstData * _data);
-
-static GstElementClass *parent_class = NULL;
-
-/*static guint gst_vbidec_signals[LAST_SIGNAL] = { 0 };*/
-
-GType
-gst_vbidec_get_type (void)
-{
- static GType vbidec_type = 0;
-
- if (!vbidec_type) {
- static const GTypeInfo vbidec_info = {
- sizeof (GstVBIDecClass),
- gst_vbidec_base_init,
- NULL,
- (GClassInitFunc) gst_vbidec_class_init,
- NULL,
- NULL,
- sizeof (GstVBIDec),
- 0,
- (GInstanceInitFunc) gst_vbidec_init,
- };
-
- vbidec_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstVBIDec", &vbidec_info, 0);
- }
- return vbidec_type;
-}
-
-static void
-gst_vbidec_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_static_metadata (element_class, "VBI decoder",
- "Codec/Decoder/Video",
- "Decodes closed captions and XDS data from VBI data",
- "David I. Lehn <dlehn@users.sourceforge.net>");
-
- gst_element_class_add_static_pad_template (element_class,
- &gst_vbidec_src_template);
- gst_element_class_add_static_pad_template (element_class,
- &gst_vbidec_sink_template);
-}
-
-static void
-gst_vbidec_class_init (GstVBIDecClass * 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->set_property = gst_vbidec_set_property;
- gobject_class->get_property = gst_vbidec_get_property;
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_VERBOSE,
- g_param_spec_boolean ("verbose", "verbose", "verbose",
- FALSE, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_CAPTION_TYPE,
- g_param_spec_enum ("caption-type", "caption type", "Closed Caption Type",
- GST_TYPE_VBIDEC_CAPTION_TYPE_TYPE, CAPTURE_OFF,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_DVD_INPUT,
- g_param_spec_boolean ("dvd-input", "dvd input",
- "VBI is encapsulated in MPEG2 GOP user_data field (as on DVDs)",
- FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-}
-
-static void
-gst_vbidec_init (GstVBIDec * vbidec)
-{
- /* create the sink and src pads */
- vbidec->sinkpad =
- gst_pad_new_from_static_template (&gst_vbidec_sink_template, "sink");
- gst_element_add_pad (GST_ELEMENT (vbidec), vbidec->sinkpad);
- gst_pad_set_chain_function (vbidec->sinkpad,
- GST_DEBUG_FUNCPTR (gst_vbidec_chain));
-
- vbidec->srcpad =
- gst_pad_new_from_static_template (&gst_vbidec_src_template, "src");
- gst_element_add_pad (GST_ELEMENT (vbidec), vbidec->srcpad);
-
- vbidec->vbiscreen = vbiscreen_new (0, 0, 1.0, 0, (void *) vbidec);
- vbidec->vbidata = vbidata_new_line (vbidec->vbiscreen, 0);
- vbidec->caption_type = CAPTURE_OFF;
- vbidata_capture_mode (vbidec->vbidata, vbidec->caption_type);
- vbidec->dvd_input = FALSE;
-}
-
-static void
-line21_decode (GstVBIDec * vbidec, guint8 * data, guint32 size)
-{
- vbidata_process_line (vbidec->vbidata, data, 0);
-}
-
-static void
-dvd_user_data_decode (GstVBIDec * vbidec, guint8 * data, guint32 size)
-{
- //char caption[128];
- //int ci; /* caption index */
- int i; /* buf index */
- int num_disp_field;
- guint8 b1, b2;
- int w;
-
- //g_print("%%%% vbi decode\n");
- //g_print("== %p %d\n", data, size);
- i = 0;
- /* Check for Closed Captioning data */
- if (data[i] != 0x43 || data[i + 1] != 0x43 ||
- data[i + 2] != 0x01 || data[i + 3] != 0xf8) {
- g_print ("non-CC data\n");
- return;
- }
- //g_print ("CC data\n");
- i += 4; /* above */
- i += 4; /* ? */
- num_disp_field = data[i] & 0x3f;
- //g_print ("ndf %d\n", num_disp_field);
- while ((data[i] & 0xfe) == 0xfe) {
- if (data[i] & 0x1) {
- b1 = data[i + 1] & 0x7f;
- b2 = data[i + 2] & 0x7f;
- w = (b2 << 8) | b1;
- vbidata_process_16b (vbidec->vbidata, 0, w);
- }
- i += 3;
- }
-}
-
-static void
-gst_vbidec_chain (GstPad * pad, GstData * _data)
-{
- GstBuffer *buf = GST_BUFFER (_data);
- GstVBIDec *vbidec = GST_VBIDEC (gst_pad_get_parent (pad));
- guint32 size;
- guint8 *data;
- guint64 pts;
-
- size = GST_BUFFER_SIZE (buf);
- data = GST_BUFFER_DATA (buf);
- pts = GST_BUFFER_TIMESTAMP (buf);
-
- /*
- g_print("** user_data: addr:%p len:%d state:%d\n", data, size, 0);
- {
- int i;
- guint8 ud;
- g_print("** \"");
- for (i=0; i<size; i++) {
- ud = data[i];
- if (isprint((char)ud)) {
- g_print("%c", (char)ud);
- } else {
- g_print("[0x%02x]", ud);
- }
- }
- g_print("\"\n");
- }
- */
-
- if (vbidec->dvd_input) {
- dvd_user_data_decode (vbidec, data, size);
- } else {
- line21_decode (vbidec, data, size);
- }
-
- gst_buffer_unref (buf);
-}
-
-void
-gst_vbidec_show_text (GstVBIDec * vbidec, char *text, int len)
-{
- //fprintf(stderr, "%*s\n", len, text);
- if (len > 0) {
- if (GST_PAD_IS_USABLE (vbidec->srcpad)) {
- GstBuffer *buf = gst_buffer_new_and_alloc (len);
-
- memcpy (GST_BUFFER_DATA (buf), text, len);
- GST_BUFFER_SIZE (buf) = len;
- // FIXME
- //GST_BUFFER_TIMESTAMP (buf) = vbidec->...
- //...
- //fprintf(stderr, "vbi text pushed\n");
- gst_pad_push (vbidec->srcpad, GST_DATA (buf));
- }
- }
-}
-
-static void
-gst_vbidec_set_property (GObject * object, guint prop_id, const GValue * value,
- GParamSpec * pspec)
-{
- GstVBIDec *vbidec;
-
- g_return_if_fail (GST_IS_VBIDEC (object));
- vbidec = GST_VBIDEC (object);
-
- switch (prop_id) {
- case PROP_VERBOSE:
- vbidata_set_verbose (vbidec->vbidata, g_value_get_boolean (value));
- vbiscreen_set_verbose (vbidec->vbiscreen, g_value_get_boolean (value));
- break;
- case PROP_DVD_INPUT:
- vbidec->dvd_input = g_value_get_boolean (value);
- break;
- case PROP_CAPTION_TYPE:
- vbidec->caption_type = g_value_get_enum (value);
- vbidata_capture_mode (vbidec->vbidata, vbidec->caption_type);
- break;
- default:
- break;
- }
-}
-
-static void
-gst_vbidec_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstVBIDec *vbidec;
-
- g_return_if_fail (GST_IS_VBIDEC (object));
- vbidec = GST_VBIDEC (object);
-
- switch (prop_id) {
- case PROP_DVD_INPUT:
- g_value_set_boolean (value, vbidec->dvd_input);
- break;
- case PROP_CAPTION_TYPE:
- g_value_set_enum (value, vbidec->caption_type);
- break;
- default:
- break;
- }
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- return gst_element_register (plugin, "vbidec", GST_RANK_NONE,
- GST_TYPE_VBIDEC);
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- vbidec,
- "Decodes closed captions and XDS data from VBI data",
- plugin_init, VERSION, "GPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/gst/vbidec/gstvbidec.h b/gst/vbidec/gstvbidec.h
deleted file mode 100644
index 9383029b4..000000000
--- a/gst/vbidec/gstvbidec.h
+++ /dev/null
@@ -1,22 +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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-typedef struct _GstVBIDec GstVBIDec;
-
-void gst_vbidec_show_text (GstVBIDec *vbidec, char *text, int len);
diff --git a/gst/vbidec/meson.build b/gst/vbidec/meson.build
deleted file mode 100644
index 43d870e6c..000000000
--- a/gst/vbidec/meson.build
+++ /dev/null
@@ -1,14 +0,0 @@
-vbi_sources = [
- 'gstvbidec.c',
- 'vbidata.c',
- 'vbiscreen.c',
-]
-
-gstvbidec = library('gstvbidec',
- vbi_sources,
- c_args : gst_plugins_bad_args,
- include_directories : [configinc],
- dependencies : [gstbase_dep],
- install : true,
- install_dir : plugins_install_dir,
-)
diff --git a/gst/vbidec/vbidata.c b/gst/vbidec/vbidata.c
deleted file mode 100644
index 0dc013ad6..000000000
--- a/gst/vbidec/vbidata.c
+++ /dev/null
@@ -1,1201 +0,0 @@
-/*
- * Copyright (c) 2002 Billy Biggs <vektor@dumbterm.net>.
- * Copyright (c) 2002 Doug Bell <drbell@users.sourceforge.net>
- *
- * CC code from Nathan Laredo's ccdecode, used under the GPL.
- * Lots of 'hey what does this mean?' code from
- * Billy Biggs and Doug Bell, like all the crap with
- * XDS and stuff. Some help from Zapping's vbi library by
- * Michael H. Schimek and others, released under the GPL.
- *
- * Modified and adapted to GStreamer by
- * David I. Lehn <dlehn@users.sourceforge.net>
- *
- * This program 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 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <fcntl.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <errno.h>
-#include "vbidata.h"
-#include "vbiscreen.h"
-/*#include "tvtimeosd.h"*/
-
-#define DO_LINE 11
-static int pll = 0;
-
-struct vbidata_s
-{
- int fd;
- vbiscreen_t *vs;
- /*tvtime_osd_t *osd; */
- char buf[65536];
- int wanttop;
- int wanttext;
-
- unsigned int colour;
- int row, ital;
- int indent, ul;
- int chan;
-
- unsigned int current_colour;
- int current_row, current_ital;
- int current_indent, current_ul;
- int current_chan;
- int current_istext;
-
- int initialised;
- int enabled;
- int lastcode;
- int lastcount;
- int verbose;
-
- /* XDS data */
- char xds_packet[2048];
- int xds_cursor;
-
- char *program_name;
- char *network_name;
- char *call_letters;
- const char *rating;
- const char *program_type;
- int start_day;
- int start_month;
- int start_min;
- int start_hour;
- int length_hour;
- int length_min;
- int length_elapsed_hour;
- int length_elapsed_min;
- int length_elapsed_sec;
- char *program_desc[8];
-};
-
-
-/* this is NOT exactly right */
-//static char ccode[] = " !\"#$%&'()\0341+,-./0123456789:;<=>?@"
-static const char ccode[] = " !\"#$%&'()a+,-./0123456789:;<=>?@"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-// "abcdefghijklmnopqrstuvwxyz"
-// "[\0351]\0355\0363\0372abcdefghijklmnopqr"
- "[e]iouabcdefghijklmnopqr"
-// "stuvwxyz\0347\0367\0245\0244\0240";
- "stuvwxyzcoNn ";
-static const char wccode[] = "\0256\0260\0275\0277T\0242\0243#\0340 "
- "\0350\0354\0362\0371";
-
-static const char extcode1[] = "\0301\0311\0323\0332\0334\0374"
- "`\0241*'-\0251S*\"\"\0300\0302"
- "\0307\0310\0312\0313\0353\0316\0317\0357" "\0324\0331\0371\0333\0253\0273";
-
-static const char extcode2[] = "\0303\0343\0315\0314\0354\0322\0362\0325"
- "{}\\^_|~\0304\0344\0326\0366\0337\0245\0244|" "\0305\0345\0330\0370++++";
-
-int
-parityok (int n)
-{ /* check parity for 2 bytes packed in n */
- int j, k;
-
- for (k = 0, j = 0; j < 7; j++)
- if (n & (1 << j))
- k++;
- if ((k & 1) && (n & 0x80))
- return 0;
- for (k = 0, j = 8; j < 15; j++)
- if (n & (1 << j))
- k++;
- if ((k & 1) && (n & 0x8000))
- return 0;
- return 1;
-}
-
-int
-decodebit (unsigned char *data, int threshold)
-{
- return ((data[0] + data[1] + data[2] + data[3] + data[4] + data[5] +
- data[6] + data[7] + data[8] + data[9] + data[10] + data[11] +
- data[12] + data[13] + data[14] + data[15] + data[16] + data[17] +
- data[18] + data[19] + data[20] + data[21] + data[22] + data[23] +
- data[24] + data[25] + data[26] + data[27] + data[28] + data[29] +
- data[30] + data[31]) >> 5 > threshold);
-}
-
-
-int
-ccdecode (unsigned char *vbiline)
-{
- int max = 0, maxval = 0, minval = 255, i = 0, clk = 0, tmp = 0;
- int sample, packedbits = 0;
-
- for (i = 0; i < 250; i++) {
- sample = vbiline[i];
- if (sample - maxval > 10)
- (maxval = sample, max = i);
- if (sample < minval)
- minval = sample;
- if (maxval - sample > 40)
- break;
- }
- sample = ((maxval + minval) >> 1);
- pll = max;
-
- /* found clock lead-in, double-check start */
-#ifndef PAL_DECODE
- i = max + 478;
-#else
- i = max + 538;
-#endif
- if (!decodebit (&vbiline[i], sample))
- return 0;
-#ifndef PAL_DECODE
- tmp = i + 57; /* tmp = data bit zero */
-#else
- tmp = i + 71;
-#endif
- for (i = 0; i < 16; i++) {
-#ifndef PAL_DECODE
- clk = tmp + i * 57;
-#else
- clk = tmp + i * 71;
-#endif
- if (decodebit (&vbiline[clk], sample)) {
- packedbits |= 1 << i;
- }
- }
- if (parityok (packedbits))
- return packedbits;
- return 0;
-} /* ccdecode */
-
-const char *movies[] = { "N/A", "G", "PG", "PG-13", "R",
- "NC-17", "X", "Not Rated"
-};
-
-const char *usa_tv[] = { "Not Rated", "TV-Y", "TV-Y7", "TV-G",
- "TV-PG", "TV-14", "TV-MA", "Not Rated"
-};
-
-const char *cane_tv[] = { "Exempt", "C", "C8+", "G", "PG",
- "14+", "18+", "Reserved"
-};
-
-const char *canf_tv[] = { "Exempt", "G", "8 ans +", "13 ans +",
- "16 ans +", "18 ans +", "Reserved",
- "Reserved"
-};
-
-const char *months[] = { 0, "Jan", "Feb", "Mar", "Apr", "May",
- "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-};
-
-static const char *eia608_program_type[96] = {
- "education", "entertainment", "movie", "news", "religious", "sports",
- "other", "action", "advertisement", "animated", "anthology",
- "automobile", "awards", "baseball", "basketball", "bulletin", "business",
- "classical", "college", "combat", "comedy", "commentary", "concert",
- "consumer", "contemporary", "crime", "dance", "documentary", "drama",
- "elementary", "erotica", "exercise", "fantasy", "farm", "fashion",
- "fiction", "food", "football", "foreign", "fund raiser", "game/quiz",
- "garden", "golf", "government", "health", "high school", "history",
- "hobby", "hockey", "home", "horror", "information", "instruction",
- "international", "interview", "language", "legal", "live", "local",
- "math", "medical", "meeting", "military", "miniseries", "music", "mystery",
- "national", "nature", "police", "politics", "premiere", "prerecorded",
- "product", "professional", "public", "racing", "reading", "repair", "repeat",
- "review", "romance", "science", "series", "service", "shopping",
- "soap opera", "special", "suspense", "talk", "technical", "tennis",
- "travel", "variety", "video", "weather", "western"
-};
-
-
-static void
-parse_xds_packet (vbidata_t * vbi, char *packet, int length)
-{
- int sum = 0;
- int i;
-
- if (!vbi)
- return;
-
- /* Check the checksum for validity of the packet. */
- for (i = 0; i < length - 1; i++) {
- sum += packet[i];
- }
- if ((((~sum) & 0x7f) + 1) != packet[length - 1]) {
- return;
- }
-
- /* Stick a null at the end, and cut off the last two characters. */
- packet[length - 2] = '\0';
- length -= 2;
-
- if (packet[0] == 0x01 && packet[1] == 0x03) {
- if (vbi->program_name && !strcmp (vbi->program_name, packet + 2)) {
- return;
- }
- if (vbi->verbose)
- fprintf (stderr, "Current program name: '%s'\n", packet + 2);
- if (vbi->program_name)
- free (vbi->program_name);
- vbi->program_name = strdup (packet + 2);
- /*tvtime_osd_set_show_name( vbi->osd, vbi->program_name ); */
- } else if (packet[0] == 0x03 && packet[1] == 0x03) {
- if (vbi->verbose)
- fprintf (stderr, "Future program name: '%s'\n", packet + 2);
- } else if (packet[0] == 0x05 && packet[1] == 0x01) {
- if (vbi->network_name && !strcmp (vbi->network_name, packet + 2)) {
- return;
- }
-
- if (vbi->verbose)
- fprintf (stderr, "Network name: '%s'\n", packet + 2);
- if (vbi->network_name)
- free (vbi->network_name);
- vbi->network_name = strdup (packet + 2);
- /*tvtime_osd_set_network_name( vbi->osd, vbi->network_name ); */
- } else if (packet[0] == 0x01 && packet[1] == 0x05) {
- int movie_rating = packet[2] & 7;
- int scheme = (packet[2] & 56) >> 3;
- int tv_rating = packet[3] & 7;
- int VSL = packet[3] & 56;
- const char *str;
-
- switch (VSL | scheme) {
- case 3: /* Canadian English TV */
- str = cane_tv[tv_rating];
- break;
- case 7: /* Canadian French TV */
- str = canf_tv[tv_rating];
- break;
- case 19: /* Reserved */
- case 31:
- str = "";
- break;
- default:
- if (((VSL | scheme) & 3) == 1) {
- /* USA TV */
- str = usa_tv[tv_rating];
- } else {
- /* MPAA Movie Rating */
- str = movies[movie_rating];
- }
- break;
- }
-
- if (vbi->rating && !strcmp (vbi->rating, str)) {
- return;
- }
-
- if (vbi->verbose)
- fprintf (stderr, "Show rating: %s", str);
- if (((VSL | scheme) & 3) == 1 || ((VSL | scheme) & 3) == 0) {
- /* show VSLD for the americans */
- if ((VSL | scheme) & 32) {
- if (vbi->verbose)
- fprintf (stderr, " V");
- }
- if ((VSL | scheme) & 16) {
- if (vbi->verbose)
- fprintf (stderr, " S");
- }
- if ((VSL | scheme) & 8) {
- if (vbi->verbose)
- fprintf (stderr, " L");
- }
- if ((VSL | scheme) & 4) {
- if (vbi->verbose)
- fprintf (stderr, " D");
- }
- }
- if (vbi->verbose)
- fprintf (stderr, "\n");
- vbi->rating = str;
- /*tvtime_osd_set_show_rating( vbi->osd, vbi->rating ); */
- } else if (packet[0] == 0x05 && packet[1] == 0x02) {
- if (vbi->call_letters && !strcmp (vbi->call_letters, packet + 2)) {
- return;
- }
-
- if (vbi->verbose)
- fprintf (stderr, "Network call letters: '%s'\n", packet + 2);
- if (vbi->call_letters)
- free (vbi->call_letters);
- vbi->call_letters = strdup (packet + 2);
- /*tvtime_osd_set_network_call( vbi->osd, vbi->call_letters ); */
- } else if (packet[0] == 0x01 && packet[1] == 0x01) {
- int month = packet[5]; // & 15;
- int day = packet[4]; // & 31;
- int hour = packet[3]; // & 31;
- int min = packet[2]; // & 63;
- char str[33];
-
- if (vbi->verbose)
- fprintf (stderr, "Program Start: %02d %s, %02d:%02d\n",
- day & 31, months[month & 15], hour & 31, min & 63);
- // packet[ 3 ], packet[ 4 ], packet[ 5 ], packet[ 6 ] );
- //packet[ 5 ] & 31, packet[ 6 ], packet[ 4 ] & 31, packet[ 3 ] & 63 );
- vbi->start_month = month & 15;
- vbi->start_day = day & 31;
- vbi->start_hour = hour & 31;
- vbi->start_min = hour & 63;
- snprintf (str, 32, "%02d %s, %02d:%02d",
- day & 31, months[month & 15], hour & 31, min & 63);
- /*tvtime_osd_set_show_start( vbi->osd, str ); */
- } else if (packet[0] == 0x01 && packet[1] == 0x04) {
- if (vbi->verbose)
- fprintf (stderr, "Program type: ");
- for (i = 0; i < length - 2; i++) {
- int cur = packet[2 + i] - 0x20;
-
- if (cur >= 0 && cur < 96) {
- if (vbi->verbose)
- fprintf (stderr, "%s%s", i ? ", " : "", eia608_program_type[cur]);
- /* this will cause us to keep only the last type we check */
- vbi->program_type = eia608_program_type[cur];
- }
- }
- if (vbi->verbose)
- fprintf (stderr, "\n");
- } else if (packet[0] < 0x03 && packet[1] >= 0x10 && packet[1] <= 0x17) {
-
- if (vbi->program_desc[packet[1] & 0xf] &&
- !strcmp (vbi->program_desc[packet[1] & 0xf], packet + 2)) {
- return;
- }
-
- if (vbi->verbose)
- fprintf (stderr, "Program Description: Line %d", packet[1] & 0xf);
- if (vbi->verbose)
- fprintf (stderr, "%s\n", packet + 2);
- if (vbi->program_desc[packet[1] & 0xf])
- free (vbi->program_desc[packet[1] & 0xf]);
- vbi->program_desc[packet[1] & 0xf] = strdup (packet + 2);
- } else if (packet[0] == 0x01 && packet[1] == 0x02) {
- char str[33];
-
- str[0] = 0;
- if (vbi->verbose)
- fprintf (stderr, "Program Length: %02d:%02d",
- packet[3] & 63, packet[2] & 63);
- vbi->length_hour = packet[3] & 63;
- vbi->length_min = packet[2] & 63;
- snprintf (str, 32, "%02d:%02d", packet[3] & 63, packet[2] & 63);
- if (length > 4) {
- if (vbi->verbose)
- fprintf (stderr, " Elapsed: %02d:%02d", packet[5] & 63, packet[4] & 63);
- vbi->length_elapsed_hour = packet[5] & 63;
- vbi->length_elapsed_min = packet[4] & 63;
- snprintf (str, 32, "%02d:%02d/%02d:%02d",
- packet[5] & 63, packet[4] & 63, packet[3] & 63, packet[2] & 63);
- } else {
- vbi->length_elapsed_hour = 0;
- vbi->length_elapsed_min = 0;
- }
-
- if (length > 6) {
- if (vbi->verbose)
- fprintf (stderr, ".%02d", packet[6] & 63);
- vbi->length_elapsed_hour = packet[6] & 63;
- snprintf (str, 32, "%02d:%02d.%02d/%02d:%02d",
- packet[5] & 63, packet[4] & 63, packet[6] & 63,
- packet[3] & 63, packet[2] & 63);
- } else {
- vbi->length_elapsed_hour = 0;
- }
- /*tvtime_osd_set_show_length( vbi->osd, str ); */
- if (vbi->verbose)
- fprintf (stderr, "\n");
- } else if (packet[0] == 0x05 && packet[1] == 0x04) {
- if (vbi->verbose)
- fprintf (stderr, "Transmission Signal Identifier (TSID): 0x%04x\n",
- packet[2] << 24 | packet[3] << 16 | packet[4] << 8 | packet[5]);
- } else {
- /* unknown */
-
- if (vbi->verbose)
- fprintf (stderr, "Unknown XDS packet, class ");
- switch (packet[0]) {
- case 0x1:
- if (vbi->verbose)
- fprintf (stderr, "CURRENT start\n");
- break;
- case 0x2:
- if (vbi->verbose)
- fprintf (stderr, "CURRENT continue\n");
- break;
-
- case 0x3:
- if (vbi->verbose)
- fprintf (stderr, "FUTURE start\n");
- break;
- case 0x4:
- if (vbi->verbose)
- fprintf (stderr, "FUTURE continue\n");
- break;
-
- case 0x5:
- if (vbi->verbose)
- fprintf (stderr, "CHANNEL start\n");
- break;
- case 0x6:
- if (vbi->verbose)
- fprintf (stderr, "CHANNEL continue\n");
- break;
-
- case 0x7:
- if (vbi->verbose)
- fprintf (stderr, "MISC start\n");
- break;
- case 0x8:
- if (vbi->verbose)
- fprintf (stderr, "MISC continue\n");
- break;
-
- case 0x9:
- if (vbi->verbose)
- fprintf (stderr, "PUB start\n");
- break;
- case 0xa:
- if (vbi->verbose)
- fprintf (stderr, "PUB continue\n");
- break;
-
- case 0xb:
- if (vbi->verbose)
- fprintf (stderr, "RES start\n");
- break;
- case 0xc:
- if (vbi->verbose)
- fprintf (stderr, "RES continue\n");
- break;
-
- case 0xd:
- if (vbi->verbose)
- fprintf (stderr, "UNDEF start\n");
- break;
- case 0xe:
- if (vbi->verbose)
- fprintf (stderr, "UNDEF continue\n");
- break;
- }
- for (i = 0; i < length; i++) {
- if (vbi->verbose)
- fprintf (stderr, "0x%02x ", packet[i]);
- }
- if (vbi->verbose)
- fprintf (stderr, "\n");
- }
-}
-
-static int
-xds_decode (vbidata_t * vbi, int b1, int b2)
-{
- if (!vbi)
- return 0;
- if (vbi->xds_cursor > 2046) {
- vbi->xds_cursor = 0;
- }
-
- if (!vbi->xds_cursor && b1 > 0xf) {
- return 0;
- }
-
-
- if (b1 < 0xf && (b1 & 0x2)) {
- /* ignore the continue and thus 'support' continuation of
- a single packet */
- return 1;
- } else if (b1 < 0xf) {
- /* kill old packet cause we got a new one */
- vbi->xds_cursor = 0;
- }
-
- vbi->xds_packet[vbi->xds_cursor] = b1;
- vbi->xds_packet[vbi->xds_cursor + 1] = b2;
- vbi->xds_cursor += 2;
-
- if (b1 == 0xf) {
- parse_xds_packet (vbi, vbi->xds_packet, vbi->xds_cursor);
- vbi->xds_cursor = 0;
- }
-
- return 1;
-}
-
-#define NOMODE 0
-
-#define CC1 1
-#define CC2 2
-#define T1 3
-#define T2 4
-
-#define CC3 1
-#define CC4 2
-#define T3 3
-#define T4 4
-
-const unsigned int colours[] = {
- 0xFFFFFFFFU, /* white */
- 0xFF00FF00U, /* green */
- 0xFF0000FFU, /* blue */
- 0xFF00C7C7U, /* cyan */
- 0xFFFF0000U, /* red */
- 0xFFFFFF00U, /* yellow */
- 0xFFC700C7U /* magenta */
-};
-
-const int rows[] = {
- 11,
- 0, /* unused */
- 1,
- 2,
- 3,
- 4,
- 12,
- 13,
- 14,
- 15,
- 5,
- 6,
- 7,
- 8,
- 9,
- 10
-};
-
-#define ROLL_2 6
-#define ROLL_3 7
-#define ROLL_4 8
-#define POP_UP 9
-#define PAINT_ON 10
-
-
-static int
-Process16b (vbidata_t * vbi, int bottom, int w1)
-{
- int b1, b2;
-
- b1 = w1 & 0x7f;
- b2 = (w1 >> 8) & 0x7f;
-
- if (!b1 && !b2) {
- return 0;
- }
-
- if (vbi->enabled && b1 >= 0x10 && b1 <= 0x1F && b2 >= 0x20 && b2 <= 0x7F) {
- int code;
-
- if ((b2 & 64)) {
- /* Preamble Code */
- /* This sets up colors and indenting */
-
- if (!bottom && vbi->lastcode == ((b1 << 8) | b2)) {
- vbi->lastcount = (vbi->lastcount + 1) % 2;
- return 1;
- }
-
- vbi->current_chan = (b1 & 8) >> 3;
- if (!bottom == vbi->wanttop) {
- if (vbi->chan != vbi->current_chan)
- return 0;
- } else
- return 0;
-
- vbi->current_ital = (b2 & 1);
- if (!(b2 & 16)) {
- vbi->current_colour = colours[(b2 & 30) >> 1];
- vbi->current_indent = 0;
- } else {
- vbi->current_colour = 0xFFFFFFFFU; /* white */
- vbi->current_indent = 4 * ((b2 & 14) >> 1);
- }
- vbi->current_row = rows[((b1 & 7) << 1) | ((b2 & 32) >> 5)];
- vbi->current_ul = b2 & 1;
-
- if (vbi->verbose)
- fprintf (stderr, "field: %d chan %d, ital %d, ul %d, colour 0x%x, "
- "indent %d, row %d\n", bottom, vbi->current_chan,
- vbi->current_ital, vbi->current_ul, vbi->current_colour,
- vbi->current_indent, vbi->current_row);
-
- if (!bottom == vbi->wanttop &&
- vbi->current_chan == vbi->chan &&
- vbi->current_istext == vbi->wanttext) {
-
- vbi->indent = vbi->current_indent;
- vbi->ital = vbi->current_ital;
- vbi->colour = vbi->current_colour;
- vbi->row = vbi->current_row;
- vbi->current_istext = 0;
-
- vbiscreen_new_caption (vbi->vs, vbi->indent, vbi->ital,
- vbi->colour, vbi->row);
-
- }
-
- vbi->lastcode = (b1 << 8) | b2;
- vbi->lastcount = 0;
- return 1;
- }
-
- if ((b1 & 8) == 1) {
- /* Midrow code */
- if (!vbi->initialised)
- return 0;
-
- if (!bottom && vbi->lastcode == ((b1 << 8) | b2)) {
- vbi->lastcount = (vbi->lastcount + 1) % 2;
- return 1;
- }
-
- if (vbi->verbose)
- fprintf (stderr, "Midrow TODO: Add me.\n");
-
- vbi->lastcode = (b1 << 8) | b2;
- return 1;
- }
-
- if ((b1 & 2) && !(b2 & 64)) {
- if (!vbi->initialised)
- return 0;
-
- if (!bottom && vbi->lastcode == ((b1 << 8) | b2)) {
- vbi->lastcount = (vbi->lastcount + 1) % 2;
- return 1;
- }
-
- if (vbi->verbose)
- fprintf (stderr, "Tab Offset: %d columns\n", b2 & 3);
- if (vbi->wanttext && vbi->current_istext &&
- vbi->current_chan == vbi->chan && !bottom == vbi->wanttop) {
- vbiscreen_tab (vbi->vs, b2 & 3);
- }
- vbi->lastcode = (b1 << 8) | b2;
- return 1;
- }
-
- switch ((code = b2 & 15)) {
- case 0: /* POP-UP */
- case 5: /* ROLL UP 2 */
- case 6: /* ROLL UP 3 */
- case 7: /* ROLL UP 4 */
- case 9: /* PAINT-ON */
- case 10: /* TEXT */
- case 11: /* TEXT */
- vbi->initialised = 1;
- if (!bottom && vbi->lastcode == ((b1 << 8) | b2)) {
- /* This is the repeated Control Code */
- vbi->lastcount = (vbi->lastcount + 1) % 2;
- return 1;
- }
- switch (code) {
- case 0: /* POP-UP */
- if (!vbi->wanttext && vbi->current_chan == vbi->chan &&
- !bottom == vbi->wanttop) {
- if (vbi->verbose)
- fprintf (stderr, "Pop-Up\n");
- vbi->indent = vbi->current_indent;
- vbi->ital = vbi->current_ital;
- vbi->colour = vbi->current_colour;
- vbi->row = vbi->current_row;
- vbi->current_istext = 0;
- vbiscreen_set_mode (vbi->vs, 1, POP_UP);
- }
- break;
- case 5: /* ROLL UP 2 */
- if (!vbi->wanttext && vbi->current_chan == vbi->chan &&
- !bottom == vbi->wanttop) {
- if (vbi->verbose)
- fprintf (stderr, "Roll-Up 2 (RU2)\n");
- vbi->indent = vbi->current_indent;
- vbi->ital = vbi->current_ital;
- vbi->colour = vbi->current_colour;
- vbi->row = vbi->current_row;
- vbi->current_istext = 0;
- vbiscreen_set_mode (vbi->vs, 1, ROLL_2);
- }
- break;
- case 6: /* ROLL UP 3 */
- if (!vbi->wanttext && vbi->current_chan == vbi->chan &&
- !bottom == vbi->wanttop) {
- if (vbi->verbose)
- fprintf (stderr, "Roll-Up 3 (RU3)\n");
- vbi->indent = vbi->current_indent;
- vbi->ital = vbi->current_ital;
- vbi->colour = vbi->current_colour;
- vbi->row = vbi->current_row;
- vbi->current_istext = 0;
- vbiscreen_set_mode (vbi->vs, 1, ROLL_3);
- }
- break;
- case 7: /* ROLL UP 4 */
- if (!vbi->wanttext && vbi->current_chan == vbi->chan &&
- !bottom == vbi->wanttop) {
- if (vbi->verbose)
- fprintf (stderr, "Roll-Up 4 (RU4)\n");
- vbi->indent = vbi->current_indent;
- vbi->ital = vbi->current_ital;
- vbi->colour = vbi->current_colour;
- vbi->row = vbi->current_row;
- vbi->current_istext = 0;
- vbiscreen_set_mode (vbi->vs, 1, ROLL_4);
- }
- break;
- case 9: /* PAINT-ON */
- if (!vbi->wanttext && vbi->current_chan == vbi->chan &&
- !bottom == vbi->wanttop) {
- if (vbi->verbose)
- fprintf (stderr, "Paint-On\n");
- vbi->indent = vbi->current_indent;
- vbi->ital = vbi->current_ital;
- vbi->colour = vbi->current_colour;
- vbi->row = vbi->current_row;
- vbi->current_istext = 0;
- vbiscreen_set_mode (vbi->vs, 1, PAINT_ON);
- }
- break;
- case 10: /* TEXT */
- if (vbi->wanttext && vbi->current_chan == vbi->chan &&
- !bottom == vbi->wanttop) {
- if (vbi->verbose)
- fprintf (stderr, "Text Restart\n");
- vbi->indent = vbi->current_indent;
- vbi->ital = vbi->current_ital;
- vbi->colour = vbi->current_colour;
- vbi->row = vbi->current_row;
- vbi->current_istext = 1;
- vbiscreen_set_mode (vbi->vs, 0, 0);
- }
- break;
- case 11: /* TEXT */
- if (vbi->wanttext && vbi->current_chan == vbi->chan &&
- !bottom == vbi->wanttop) {
- if (vbi->verbose)
- fprintf (stderr, "Resume Text Display\n");
- vbi->indent = vbi->current_indent;
- vbi->ital = vbi->current_ital;
- vbi->colour = vbi->current_colour;
- vbi->row = vbi->current_row;
- vbi->current_istext = 1;
- vbiscreen_set_mode (vbi->vs, 0, 0);
- }
- break;
- default: /* impossible */
- break;
- }
- break;
- case 1:
- if (!vbi->initialised)
- return 0;
- if (!bottom && vbi->lastcode == ((b1 << 8) | b2)) {
- vbi->lastcount = (vbi->lastcount + 1) % 2;
- }
- if (!bottom == vbi->wanttop && vbi->current_chan == vbi->chan &&
- vbi->current_istext == vbi->wanttext) {
- if (vbi->verbose)
- fprintf (stderr, "Backspace\n");
- vbiscreen_backspace (vbi->vs);
- }
- break;
- case 2:
- case 3:
- if (!vbi->initialised)
- return 0;
- fprintf (stderr, "Reserved\n");
- break;
- case 4:
- if (!vbi->initialised)
- return 0;
- if (!bottom && vbi->lastcode == ((b1 << 8) | b2)) {
- vbi->lastcount = (vbi->lastcount + 1) % 2;
- }
- if (!bottom == vbi->wanttop && vbi->current_chan == vbi->chan &&
- vbi->current_istext == vbi->wanttext) {
- if (vbi->verbose)
- fprintf (stderr, "Delete to End of Row\n");
- vbiscreen_delete_to_end (vbi->vs);
- }
- break;
- case 8:
- if (!vbi->initialised)
- return 0;
- if (vbi->verbose)
- fprintf (stderr, "Flash On\n");
- break;
- case 12:
- case 13:
- case 14:
- case 15:
- if (!vbi->initialised)
- return 0;
- if (!bottom && vbi->lastcode == ((b1 << 8) | b2)) {
- vbi->lastcount = (vbi->lastcount + 1) % 2;
- return 1;
- }
-
- switch (code) {
- case 12:
- /* Show buffer 1, Fill buffer 2 */
- if (!bottom == vbi->wanttop &&
- vbi->current_chan == vbi->chan &&
- vbi->current_istext == vbi->wanttext) {
- if (vbi->verbose)
- fprintf (stderr, "Erase Displayed Memory\n");
- vbiscreen_erase_displayed (vbi->vs);
- }
- break;
- case 13:
- if (!bottom == vbi->wanttop &&
- vbi->current_chan == vbi->chan &&
- vbi->current_istext == vbi->wanttext) {
- if (vbi->verbose)
- fprintf (stderr, "Carriage Return\n");
- vbiscreen_carriage_return (vbi->vs);
- }
- break;
- case 14:
- if (!bottom == vbi->wanttop &&
- vbi->current_chan == vbi->chan &&
- vbi->current_istext == vbi->wanttext) {
- if (vbi->verbose)
- fprintf (stderr, "Erase Non-Displayed\n");
- vbiscreen_erase_non_displayed (vbi->vs);
- }
- break;
- case 15:
- /* Show buffer 2, Fill Buffer 1 */
- if (!bottom == vbi->wanttop &&
- vbi->current_chan == vbi->chan &&
- vbi->current_istext == vbi->wanttext) {
- if (vbi->verbose)
- fprintf (stderr, "End Of Caption\n");
- vbiscreen_end_of_caption (vbi->vs);
- }
- break;
- default: /* impossible */
- return 0;
- break;
- }
- break;
- default: /* Impossible */
- return 0;
- break;
- }
-
- if (vbi->lastcode != ((b1 << 8) | b2)) {
- vbi->lastcount = 0;
- }
-
- vbi->lastcode = (b1 << 8) | b2;
- return 1;
- }
-
- if (bottom && xds_decode (vbi, b1, b2)) {
- return 1;
- }
-
- if (!vbi->enabled)
- return 0;
-
- vbi->lastcode = 0;
- vbi->lastcount = 0;
-
- if (!vbi->initialised)
- return 0;
-
- if (!bottom != vbi->wanttop || vbi->current_chan != vbi->chan ||
- vbi->current_istext != vbi->wanttext) {
- return 0;
- }
-
- if (b1 == 0x11 || b1 == 0x19 ||
- b1 == 0x12 || b1 == 0x13 || b1 == 0x1A || b1 == 0x1B) {
- switch (b1) {
- case 0x1A:
- case 0x12:
- /* use extcode1 */
- if (b1 > 31 && b2 > 31 && b1 <= 0x3F && b2 <= 0x3F)
- if (vbi->verbose)
- fprintf (stderr, "char %d (%c), char %d (%c)\n", b1,
- extcode1[b1 - 32], b2, extcode1[b2 - 32]);
-
- break;
- case 0x13:
- case 0x1B:
- /* use extcode2 */
- if (b1 > 31 && b2 > 31 && b1 <= 0x3F && b2 <= 0x3F)
- if (vbi->verbose)
- fprintf (stderr, "char %d (%c), char %d (%c)\n", b1,
- extcode2[b1 - 32], b2, extcode2[b2 - 32]);
-
- break;
- case 0x11:
- case 0x19:
- /* use wcode */
- if (b1 > 31 && b2 > 31 && b1 <= 0x3F && b2 <= 0x3F)
- if (vbi->verbose)
- fprintf (stderr, "char %d (%c), char %d (%c)\n", b1,
- wccode[b1 - 32], b2, wccode[b2 - 32]);
-
- break;
- default:
- break;
- }
- } else if (b1) {
- /* use ccode */
- if (b1 < 32)
- b1 = 32;
- if (b2 < 32)
- b2 = 32;
- if (vbi->verbose)
- fprintf (stderr, "vbidata: data: %c %c\n", ccode[b1 - 32],
- ccode[b2 - 32]);
- vbiscreen_print (vbi->vs, ccode[b1 - 32], ccode[b2 - 32]);
- }
-
-
- return 1;
-} /* Process16b */
-
-int
-ProcessLine (vbidata_t * vbi, unsigned char *s, int bottom)
-{
- int w1;
-
- /*char *outbuf = NULL; */
-
- if (!vbi)
- return 0;
-
- w1 = ccdecode (s);
-
- return Process16b (vbi, bottom, w1);
-} /* ProcessLine */
-
-
-
-vbidata_t *
-vbidata_new_file (const char *filename, vbiscreen_t * vs,
- /*tvtime_osd_t* osd, */ int verbose)
-{
- vbidata_t *vbi = (vbidata_t *) malloc (sizeof (vbidata_t));
-
- if (!vbi) {
- return 0;
- }
-
- vbi->fd = open (filename, O_RDONLY);
- if (vbi->fd < 0) {
- fprintf (stderr, "vbidata: Can't open %s: %s\n",
- filename, strerror (errno));
- free (vbi);
- return 0;
- }
-
- vbi->vs = vs;
- /*vbi->osd = osd; */
- vbi->verbose = verbose;
-
- vbidata_reset (vbi);
-
- return vbi;
-}
-
-vbidata_t *
-vbidata_new_line (vbiscreen_t * vs, int verbose)
-{
- vbidata_t *vbi = (vbidata_t *) malloc (sizeof (vbidata_t));
-
- if (!vbi) {
- return 0;
- }
-
- vbi->vs = vs;
- /*vbi->osd = osd; */
- vbi->verbose = verbose;
-
- vbidata_reset (vbi);
-
- return vbi;
-}
-
-void
-vbidata_delete (vbidata_t * vbi)
-{
- if (!vbi)
- return;
- if (vbi->fd != 0) {
- close (vbi->fd);
- }
- free (vbi);
-}
-
-void
-vbidata_reset (vbidata_t * vbi)
-{
- if (!vbi)
- return;
-
- vbi->wanttop = 0;
- vbi->wanttext = 0;
- vbi->colour = 0xFFFFFFFFU;
- vbi->row = 0;
-
- vbi->ital = 0;
- vbi->indent = 0;
- vbi->ul = 0;
-
- vbi->chan = 0;
-
- vbi->initialised = 0;
- vbi->enabled = 0;
-
- memset (vbi->program_desc, 0, 8 * sizeof (char *));
- vbi->program_name = NULL;
- vbi->network_name = NULL;
- vbi->call_letters = NULL;
- vbi->rating = NULL;
- vbi->program_type = NULL;
-
- vbi->start_day = 0;
- vbi->start_month = 0;
- vbi->start_min = 0;
- vbi->start_hour = 0;
- vbi->length_hour = 0;
- vbi->length_min = 0;
- vbi->length_elapsed_hour = 0;
- vbi->length_elapsed_min = 0;
- vbi->length_elapsed_sec = 0;
-
- /*
- tvtime_osd_set_network_call( vbi->osd, "" );
- tvtime_osd_set_network_name( vbi->osd, "" );
- tvtime_osd_set_show_name( vbi->osd, "" );
- tvtime_osd_set_show_rating( vbi->osd, "" );
- tvtime_osd_set_show_start( vbi->osd, "" );
- tvtime_osd_set_show_length( vbi->osd, "" );
- */
-
-
-
- vbi->lastcode = 0;
- vbi->lastcount = 0;
- vbi->xds_packet[0] = 0;
- vbi->xds_cursor = 0;
- vbiscreen_reset (vbi->vs);
-}
-
-void
-vbidata_set_verbose (vbidata_t * vbi, int verbose)
-{
- vbi->verbose = verbose;
-}
-
-void
-vbidata_capture_mode (vbidata_t * vbi, int mode)
-{
- if (!vbi)
- return;
- switch (mode) {
- case CAPTURE_OFF:
- vbi->enabled = 0;
- break;
- case CAPTURE_CC1:
- vbi->wanttop = 1;
- vbi->wanttext = 0;
- vbi->chan = 0;
- vbi->enabled = 1;
- break;
- case CAPTURE_CC2:
- vbi->wanttop = 1;
- vbi->wanttext = 0;
- vbi->chan = 1;
- vbi->enabled = 1;
- break;
- case CAPTURE_CC3:
- vbi->wanttop = 0;
- vbi->wanttext = 0;
- vbi->chan = 0;
- vbi->enabled = 1;
- break;
- case CAPTURE_CC4:
- vbi->wanttop = 0;
- vbi->wanttext = 0;
- vbi->chan = 1;
- vbi->enabled = 1;
- break;
- case CAPTURE_T1:
- vbi->wanttop = 1;
- vbi->wanttext = 1;
- vbi->chan = 0;
- vbi->enabled = 1;
- break;
- case CAPTURE_T2:
- vbi->wanttop = 1;
- vbi->wanttext = 1;
- vbi->chan = 1;
- vbi->enabled = 1;
- break;
- case CAPTURE_T3:
- vbi->wanttop = 0;
- vbi->wanttext = 1;
- vbi->chan = 0;
- vbi->enabled = 1;
- break;
- case CAPTURE_T4:
- vbi->wanttop = 0;
- vbi->wanttext = 1;
- vbi->chan = 1;
- vbi->enabled = 1;
- break;
- default:
- vbi->enabled = 0;
- break;
- }
-}
-
-void
-vbidata_process_frame (vbidata_t * vbi, int printdebug)
-{
- if (read (vbi->fd, vbi->buf, 65536) < 65536) {
- fprintf (stderr, "error, can't read vbi data.\n");
- return;
- }
-
- ProcessLine (vbi, &vbi->buf[DO_LINE * 2048], 0);
- ProcessLine (vbi, &vbi->buf[(16 + DO_LINE) * 2048], 1);
-}
-
-void
-vbidata_process_line (vbidata_t * vbi, unsigned char *s, int bottom)
-{
- ProcessLine (vbi, s, bottom);
-}
-
-void
-vbidata_process_16b (vbidata_t * vbi, int bottom, int w)
-{
- Process16b (vbi, bottom, w);
-}
diff --git a/gst/vbidec/vbidata.h b/gst/vbidec/vbidata.h
deleted file mode 100644
index c3045335c..000000000
--- a/gst/vbidec/vbidata.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2002 Billy Biggs <vektor@dumbterm.net>.
- * Copyright (c) 2002 Doug Bell <drbell@users.sourceforge.net>
- *
- * CC code from Nathan Laredo's ccdecode.
- * Lots of 'hey what does this mean?' code from
- * Billy Biggs and Doug Bell, like all the crap with
- * XDS and stuff. Some help from Zapping's vbi library by
- * Michael H. Schimek and others, released under the GPL.
- *
- * Modified and adapted to GStreamer by
- * David I. Lehn <dlehn@users.sourceforge.net>
- *
- * This program 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 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef VBIDATA_H_INCLUDED
-#define VBIDATA_H_INCLUDED
-
-#include "vbiscreen.h"
-/*#include "tvtimeosd.h"*/
-
-typedef struct vbidata_s vbidata_t;
-
-#define CAPTURE_OFF 0
-#define CAPTURE_CC1 1
-#define CAPTURE_CC2 2
-#define CAPTURE_CC3 4
-#define CAPTURE_CC4 5
-#define CAPTURE_T1 6
-#define CAPTURE_T2 7
-#define CAPTURE_T3 8
-#define CAPTURE_T4 9
-
-vbidata_t *vbidata_new_file( const char *filename, vbiscreen_t *vs,
- /*tvtime_osd_t* osd,*/ int verbose );
-vbidata_t *vbidata_new_line( vbiscreen_t *vs, int verbose );
-
-void vbidata_delete( vbidata_t *vbi );
-void vbidata_reset( vbidata_t *vbi );
-void vbidata_set_verbose( vbidata_t *vbi, int verbose );
-void vbidata_capture_mode( vbidata_t *vbi, int mode );
-void vbidata_process_frame( vbidata_t *vbi, int printdebug );
-void vbidata_process_line( vbidata_t *vbi, unsigned char *s, int bottom );
-void vbidata_process_16b( vbidata_t *vbi, int bottom, int w );
-
-#endif /* VBIDATA_H_INCLUDED */
diff --git a/gst/vbidec/vbiscreen.c b/gst/vbidec/vbiscreen.c
deleted file mode 100644
index 52e91e0d9..000000000
--- a/gst/vbidec/vbiscreen.c
+++ /dev/null
@@ -1,825 +0,0 @@
-/*
- * Copyright (c) 2002 Billy Biggs <vektor@dumbterm.net>.
- * Copyright (c) 2002 Doug Bell <drbell@users.sourceforge.net>.
- *
- * Modified and adapted to GStreamer by
- * David I. Lehn <dlehn@users.sourceforge.net>
- *
- * This program 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 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <ctype.h>
-#include <unistd.h>
-/*#include "osdtools.h"*/
-/*#include "speedy.h"*/
-#include <glib.h>
-#include "vbiscreen.h"
-#include "gstvbidec.h"
-
-#define ROLL_2 6
-#define ROLL_3 7
-#define ROLL_4 8
-#define POP_UP 9
-#define PAINT_ON 10
-
-
-#define NUM_LINES 15
-#define ROWS 15
-#define COLS 32
-#define FONT_SIZE 20
-
-typedef struct osd_string_s osd_string_t;
-struct osd_string_s
-{
- int width;
- int height;
- int r, g, b;
- int visible;
- GstVBIDec *vbidec;
-};
-
-osd_string_t *
-osd_string_new (char *c, int s, int w, int h, int a, void *user_data)
-{
- osd_string_t *os;
-
- os = (osd_string_t *) malloc (sizeof (osd_string_t));
- if (!os)
- return NULL;
- os->width = 0;
- os->height = 0;
- os->r = os->g = os->b = 0;
- os->visible = 1;
- os->vbidec = (GstVBIDec *) user_data;
- return os;
-}
-
-void
-osd_string_show_text (osd_string_t * os, char *s, int len)
-{
- /* FIXME: just print data when it gets here */
- if (len > 0) {
- gst_vbidec_show_text (os->vbidec, s, len);
- }
-}
-
-int
-osd_string_get_height (osd_string_t * os)
-{
- return os->height;
-}
-
-int
-osd_string_get_width (osd_string_t * os)
-{
- return os->width;
-}
-
-void
-osd_string_delete (osd_string_t * os)
-{
- free (os);
-}
-
-void
-osd_string_set_colour_rgb (osd_string_t * os, int r, int g, int b)
-{
- os->r = r;
- os->g = g;
- os->b = b;
-}
-
-void
-blit_colour_packed422_scanline (unsigned char *d, int w, int luma, int cb,
- int cr)
-{
-}
-
-int
-osd_string_visible (osd_string_t * os)
-{
- return os->visible;
-}
-
-void
-osd_string_composite_packed422_scanline (osd_string_t * os, unsigned char *a,
- unsigned char *b, int w, int x, int y)
-{
-}
-
-struct vbiscreen_s
-{
-
- osd_string_t *line[ROWS];
-
- char buffers[ROWS * COLS * 2];
- char text[2 * ROWS * COLS];
- char hiddenbuf[COLS];
- char paintbuf[ROWS * COLS];
-
- unsigned int fgcolour;
- unsigned int bgcolour;
- int bg_luma, bg_cb, bg_cr;
-
- int frame_width;
- int frame_height;
- int frame_aspect;
-
- int x, y; /* where to draw console */
- int width, height; /* the size box we have to draw in */
- int rowheight, charwidth;
-
- int curx, cury; /* cursor position */
- int rows, cols; /* 32 cols 15 rows */
- int captions, style; /* CC (1) or Text (0), RU2 RU3 RU4 POP_UP PAINT_ON */
- int first_line; /* where to start drawing */
- int curbuffer;
- int top_of_screen; /* a pointer into line[] */
- int indent;
- int got_eoc;
- int scroll;
-
- char *fontfile;
- int fontsize;
- int verbose;
-
- void *user_data;
-};
-
-vbiscreen_t *
-vbiscreen_new (int video_width, int video_height,
- double video_aspect, int verbose, void *user_data)
-{
- int i = 0, fontsize = FONT_SIZE;
- vbiscreen_t *vs = (vbiscreen_t *) malloc (sizeof (struct vbiscreen_s));
-
- if (!vs) {
- return NULL;
- }
-
- vs->verbose = verbose;
- vs->x = 0;
- vs->y = 0;
- vs->frame_width = video_width;
- vs->frame_height = video_height;
- vs->frame_aspect = video_aspect;
- vs->curx = 0;
- vs->cury = 0;
- vs->fgcolour = 0xFFFFFFFFU; /* white */
- vs->bgcolour = 0xFF000000U; /* black */
- vs->bg_luma = 16;
- vs->bg_cb = 128;
- vs->bg_cr = 128;
- vs->rows = ROWS;
- vs->cols = COLS;
- /*vs->fontfile = DATADIR "/FreeMonoBold.ttf"; */
- vs->fontfile = NULL;
- vs->fontsize = fontsize;
- vs->width = video_width;
- vs->height = video_height;
- vs->first_line = 0;
- vs->captions = 0;
- vs->style = 0;
- vs->curbuffer = 0;
- vs->top_of_screen = 0;
- vs->indent = 0;
- memset (vs->buffers, 0, 2 * COLS * ROWS);
- memset (vs->hiddenbuf, 0, COLS);
- memset (vs->paintbuf, 0, ROWS * COLS);
- vs->scroll = 0;
-
- vs->user_data = user_data;
-
- vs->line[0] = osd_string_new (vs->fontfile, fontsize, video_width,
- video_height, video_aspect, user_data);
-
- if (!vs->line[0]) {
- vs->fontfile = "./FreeMonoBold.ttf";
-
- vs->line[0] = osd_string_new (vs->fontfile, fontsize,
- video_width, video_height, video_aspect, user_data);
- }
-
- if (!vs->line[0]) {
- fprintf (stderr, "vbiscreen: Could not find my font (%s)!\n", vs->fontfile);
- vbiscreen_delete (vs);
- return NULL;
- }
-
- osd_string_show_text (vs->line[0], "W", 0);
- vs->rowheight = osd_string_get_height (vs->line[0]);
- vs->charwidth = osd_string_get_width (vs->line[0]);
- osd_string_delete (vs->line[0]);
-
- for (i = 0; i < ROWS; i++) {
- vs->line[i] = osd_string_new (vs->fontfile, fontsize,
- video_width, video_height, video_aspect, user_data);
- if (!vs->line[i]) {
- fprintf (stderr, "vbiscreen: Could not allocate a line.\n");
- vbiscreen_delete (vs);
- return NULL;
- }
- osd_string_set_colour_rgb (vs->line[i],
- (vs->fgcolour & 0xff0000) >> 16,
- (vs->fgcolour & 0xff00) >> 8, (vs->fgcolour & 0xff));
- osd_string_show_text (vs->line[i], " ", 0);
- }
- memset (vs->text, 0, 2 * ROWS * COLS);
- return vs;
-}
-
-void
-blank_screen (vbiscreen_t * vs)
-{
- int i;
-
- if (vs->verbose)
- fprintf (stderr, "in blank\n");
- for (i = 0; i < ROWS; i++) {
- osd_string_show_text (vs->line[i], " ", 0);
- }
-}
-
-void
-clear_screen (vbiscreen_t * vs)
-{
- int base, i;
-
- if (!vs)
- return;
-
- base = vs->top_of_screen * COLS;
- for (i = 0; i < ROWS * COLS; i++) {
- vs->text[base] = 0;
- base++;
- base %= 2 * ROWS * COLS;
- }
- blank_screen (vs);
-}
-
-void
-clear_hidden_roll (vbiscreen_t * vs)
-{
- if (!vs)
- return;
- memset (vs->hiddenbuf, 0, COLS);
-}
-
-void
-clear_hidden_pop (vbiscreen_t * vs)
-{
- if (!vs)
- return;
- memset (vs->buffers + vs->curbuffer * COLS * ROWS, 0, COLS * ROWS);
-}
-
-void
-clear_hidden_paint (vbiscreen_t * vs)
-{
- if (!vs)
- return;
- memset (vs->paintbuf, 0, COLS * ROWS);
-}
-
-void
-clear_displayed_pop (vbiscreen_t * vs)
-{
- if (!vs)
- return;
- memset (vs->buffers + (vs->curbuffer ^ 1) * COLS * ROWS, 0, COLS * ROWS);
-}
-
-void
-vbiscreen_dump_screen_text (vbiscreen_t * vs)
-{
- int i, offset;
-
- if (!vs)
- return;
- offset = vs->top_of_screen * COLS;
-
- fprintf (stderr, "\n 0123456789abcdefghij012345678901");
- for (i = 0; i < ROWS * COLS; i++) {
- if (!(i % COLS))
- fprintf (stderr, "\n%.2d ", i / COLS);
- fprintf (stderr, "%c", vs->text[offset] ? vs->text[offset] : ' ');
- offset++;
- offset %= 2 * ROWS * COLS;
- }
- fprintf (stderr, "\n 0123456789abcdefghij012345678901\n ");
- for (i = 0; i < COLS; i++) {
- fprintf (stderr, "%c", vs->text[offset] ? vs->text[offset] : ' ');
- offset++;
- offset %= 2 * ROWS * COLS;
- }
- fprintf (stderr, "\n 0123456789abcdefghij012345678901\n");
-}
-
-int
-update_row_x (vbiscreen_t * vs, int row)
-{
- char text[COLS + 1];
- int i, j, haschars = 0, base;
-
- if (!vs)
- return 0;
-
- text[COLS] = 0;
- base = ((vs->top_of_screen + row) % (2 * ROWS)) * COLS;
- for (j = 0, i = base; i < base + COLS; i++, j++) {
- if (vs->text[i]) {
- text[j] = vs->text[i];
- haschars = 1;
- } else {
- text[j] = ' ';
- }
- }
-
- osd_string_set_colour_rgb (vs->line[row],
- (vs->fgcolour & 0xff0000) >> 16,
- (vs->fgcolour & 0xff00) >> 8, (vs->fgcolour & 0xff));
- if (!haschars)
- osd_string_show_text (vs->line[row], " ", 0);
- else
- osd_string_show_text (vs->line[row], text, 51);
-
- return haschars;
-}
-
-void
-update_row (vbiscreen_t * vs)
-{
- if (!vs)
- return;
-
- update_row_x (vs, vs->cury);
- //vbiscreen_dump_screen_text( vs );
-}
-
-void
-update_all_rows (vbiscreen_t * vs)
-{
- int row = 0;
-
- if (!vs)
- return;
-
- for (row = 0; row < ROWS; row++) {
- update_row_x (vs, row);
- }
- //vbiscreen_dump_screen_text( vs );
-}
-
-void
-vbiscreen_delete (vbiscreen_t * vs)
-{
- free (vs);
-}
-
-void
-copy_row_to_screen (vbiscreen_t * vs, char *row)
-{
- int base, i, j;
-
- base = ((vs->top_of_screen + vs->cury) % (2 * ROWS)) * COLS;
- for (j = 0, i = base; i < base + COLS; j++, i++) {
- vs->text[i] = row[j];
- }
- update_row (vs);
-}
-
-void
-scroll_screen (vbiscreen_t * vs)
-{
- int start_row;
-
- if (!vs || !vs->captions || !vs->style || vs->style > ROLL_4)
- return;
-
- start_row = (vs->first_line + vs->top_of_screen) % (2 * ROWS);
- if (vs->verbose)
- fprintf (stderr, "start row : %d first line %d\n ", start_row,
- vs->first_line);
-
- /* zero out top row */
- memset ((char *) (vs->text + start_row * COLS), 0, COLS);
- vs->top_of_screen = (vs->top_of_screen + 1) % (2 * ROWS);
- vs->curx = vs->indent;
- update_all_rows (vs);
- copy_row_to_screen (vs, vs->hiddenbuf);
- clear_hidden_roll (vs);
- vs->scroll = 26;
-}
-
-void
-vbiscreen_set_verbose (vbiscreen_t * vs, int verbose)
-{
- vs->verbose = verbose;
-}
-
-void
-vbiscreen_new_caption (vbiscreen_t * vs, int indent, int ital,
- unsigned int colour, int row)
-{
- if (!vs)
- return;
- if (vs->verbose)
- fprintf (stderr, "indent: %d, ital: %d, colour: 0x%x, row: %d\n", indent,
- ital, colour, row);
-
- if (0 && vs->captions && vs->style <= ROLL_4 && vs->style) {
- if (row != vs->cury + 1) {
- vs->cury = row - 1;
- clear_hidden_roll (vs);
- } else {
-// scroll_screen( vs );
- }
- }
-
- if (vs->style > ROLL_4) {
- vs->cury = ((row > 0) ? row - 1 : 0);
- }
-
- vs->fgcolour = colour;
- vs->indent = indent;
- vs->curx = indent;
-}
-
-void
-vbiscreen_set_mode (vbiscreen_t * vs, int caption, int style)
-{
- if (!vs)
- return;
- if (vs->verbose)
- fprintf (stderr, "in set mode\n");
-
- if (vs->verbose) {
- fprintf (stderr, "Caption: %d ", caption);
- switch (style) {
- case ROLL_2:
- fprintf (stderr, "ROLL 2\n");
- break;
- case ROLL_3:
- fprintf (stderr, "ROLL 3\n");
- break;
- case ROLL_4:
- fprintf (stderr, "ROLL 4\n");
- break;
- case POP_UP:
- fprintf (stderr, "POP UP\n");
- break;
- case PAINT_ON:
- fprintf (stderr, "PAINT ON\n");
- break;
- default:
- break;
- }
- }
- if (!caption) {
- /* text mode */
- vs->cury = 0;
- } else {
- /* captioning mode */
- /* styles: ru2 ru3 ru4 pop paint
- */
- if (style != POP_UP && vs->style == POP_UP && !vs->got_eoc) {
- /* stupid that sometimes they dont send a EOC */
- vbiscreen_end_of_caption (vs);
- }
-
- switch (style) {
- case ROLL_2:
- case ROLL_3:
- case ROLL_4:
- if (vs->style == style) {
- return;
- }
- vs->first_line = ROWS - (style - 4);
-
- if (vs->verbose)
- fprintf (stderr, "first_line %d\n", vs->first_line);
-
- vs->cury = ROWS - 1;
- break;
- case POP_UP:
- vs->got_eoc = 0;
- break;
- case PAINT_ON:
- break;
- }
- }
-
- vs->captions = caption;
- vs->style = style;
-}
-
-void
-vbiscreen_tab (vbiscreen_t * vs, int cols)
-{
- if (!vs)
- return;
- if (cols < 0 || cols > 3)
- return;
- vs->curx += cols;
- if (vs->curx > 31)
- vs->curx = 31;
-}
-
-void
-vbiscreen_set_colour (vbiscreen_t * vs, unsigned int col)
-{
- if (!vs)
- return;
- vs->fgcolour = col;
-}
-
-void
-vbiscreen_clear_current_cell (vbiscreen_t * vs)
-{
- vs->text[((vs->top_of_screen + vs->cury) % (2 * ROWS)) * COLS
- + vs->curx + vs->indent] = 0;
-}
-
-void
-vbiscreen_set_current_cell (vbiscreen_t * vs, char text)
-{
- int base;
-
- if (!vs)
- return;
- base = ((vs->top_of_screen + vs->cury) % (2 * ROWS)) * COLS;
- if (g_ascii_isprint (text))
- vs->text[base + vs->curx + vs->indent] = text;
- else
- vs->text[base + vs->curx + vs->indent] = ' ';
-}
-
-void
-vbiscreen_delete_to_end (vbiscreen_t * vs)
-{
- int i;
-
- if (!vs)
- return;
- if (vs->verbose)
- fprintf (stderr, "in del to end\n");
- for (i = vs->curx; i < COLS; i++) {
- vbiscreen_clear_current_cell (vs);
- vs->curx++;
- }
- vs->curx = COLS - 1; /* is this right ? */
- if (vs->captions && vs->style && vs->style != POP_UP)
- update_row (vs);
-}
-
-void
-vbiscreen_backspace (vbiscreen_t * vs)
-{
- if (!vs)
- return;
- if (vs->verbose)
- fprintf (stderr, "in backspace\n");
- if (!vs->curx)
- return;
- vs->curx--;
- vbiscreen_clear_current_cell (vs);
- update_row (vs);
-}
-
-void
-vbiscreen_erase_displayed (vbiscreen_t * vs)
-{
- if (!vs)
- return;
- if (vs->verbose)
- fprintf (stderr, "in erase disp\n");
-
- if (vs->captions && vs->style && vs->style <= ROLL_4) {
- clear_hidden_roll (vs);
- }
-
- clear_displayed_pop (vs);
- clear_screen (vs);
-}
-
-void
-vbiscreen_erase_non_displayed (vbiscreen_t * vs)
-{
- if (!vs)
- return;
- if (vs->verbose)
- fprintf (stderr, "in erase non disp\n");
-
- if (vs->captions && vs->style == POP_UP) {
- memset (vs->buffers + vs->curbuffer * COLS * ROWS + vs->cury * COLS, 0,
- COLS);
-// clear_hidden_pop( vs );
- } else if (vs->captions && vs->style && vs->style <= ROLL_4) {
- clear_hidden_roll (vs);
- }
-}
-
-void
-vbiscreen_carriage_return (vbiscreen_t * vs)
-{
- if (!vs)
- return;
- if (vs->verbose)
- fprintf (stderr, "in CR\n");
- if (vs->style != POP_UP) {
- /* not sure if this is right for text mode */
- /* in text mode, perhaps a CR on last row clears screen and goes
- * to (0,0) */
- scroll_screen (vs);
- }
-
- /* keep cursor on bottom for rollup */
- if (vs->captions && vs->style && vs->style <= ROLL_4)
- vs->cury--;
-
- vs->cury++;
- vs->curx = 0;
-}
-
-void
-copy_buf_to_screen (vbiscreen_t * vs, char *buf)
-{
- int base, i, j;
-
- if (!vs)
- return;
-
- base = vs->top_of_screen * COLS;
- for (j = 0, i = 0; i < ROWS * COLS; i++, j++) {
- vs->text[base] = buf[j];
- base++;
- base %= 2 * ROWS * COLS;
- }
- update_all_rows (vs);
-}
-
-void
-vbiscreen_end_of_caption (vbiscreen_t * vs)
-{
- /*int i; */
- if (!vs)
- return;
- if (vs->verbose)
- fprintf (stderr, "in end of caption\n");
-
- if (vs->style == PAINT_ON) {
- copy_buf_to_screen (vs, vs->paintbuf);
- clear_hidden_paint (vs);
- } else if (vs->style == POP_UP) {
- copy_buf_to_screen (vs, vs->buffers + vs->curbuffer * COLS * ROWS);
- vs->curbuffer ^= 1;
- }
-
- /* to be safe? */
- vs->curx = 0;
- vs->cury = ROWS - 1;
- vs->got_eoc = 1;
-}
-
-void
-vbiscreen_print (vbiscreen_t * vs, char c1, char c2)
-{
- if (!vs)
- return;
- if (vs->verbose)
- fprintf (stderr, "in print (%d, %d)[%c %c]\n", vs->curx, vs->cury, c1, c2);
- if (vs->captions && vs->style == POP_UP) {
- /* this all gets displayed at another time */
- if (vs->curx != COLS - 1) {
- *(vs->buffers + vs->curx + vs->curbuffer * ROWS * COLS +
- vs->cury * COLS) = c1;
- vs->curx++;
- }
-
- if (vs->curx != COLS - 1 && c2) {
- *(vs->buffers + vs->curx + vs->curbuffer * ROWS * COLS +
- vs->cury * COLS) = c2;
- vs->curx++;
- } else if (c2) {
- *(vs->buffers + vs->curx + vs->curbuffer * ROWS * COLS +
- vs->cury * COLS) = c2;
- }
- }
-
- if (vs->captions && vs->style == PAINT_ON) {
- if (vs->curx != COLS - 1) {
- vs->paintbuf[vs->curx + vs->cury * COLS] = c1;
- vs->curx++;
- }
-
- if (vs->curx != COLS - 1 && c2) {
- vs->paintbuf[vs->curx + vs->cury * COLS] = c2;
- vs->curx++;
- } else if (c2) {
- vs->paintbuf[vs->curx + vs->cury * COLS] = c2;
- }
- }
-
- if (vs->captions && vs->style && vs->style <= ROLL_4) {
- if (vs->curx != COLS - 1) {
- vs->hiddenbuf[vs->curx] = c1;
- vs->curx++;
- } else {
- vs->hiddenbuf[vs->curx] = c1;
- }
-
- if (vs->curx != COLS - 1 && c2) {
- vs->hiddenbuf[vs->curx] = c2;
- vs->curx++;
- } else if (c2) {
- vs->hiddenbuf[vs->curx] = c2;
- }
- }
-}
-
-void
-vbiscreen_reset (vbiscreen_t * vs)
-{
- if (!vs)
- return;
- clear_screen (vs);
- clear_hidden_pop (vs);
- clear_displayed_pop (vs);
- clear_hidden_roll (vs);
- vs->captions = 0;
- vs->style = 0;
-}
-
-void
-vbiscreen_composite_packed422_scanline (vbiscreen_t * vs,
- unsigned char *output, int width, int xpos, int scanline)
-{
- int x = 0, y = 0, row = 0, index = 0;
-
- if (!vs)
- return;
- if (!output)
- return;
- if (scanline >= vs->y && scanline < vs->y + vs->height) {
-
- if (0 && !vs->captions)
- blit_colour_packed422_scanline (output + (vs->x * 2), vs->width,
- vs->bg_luma, vs->bg_cb, vs->bg_cr);
-
- index = vs->top_of_screen * COLS;
- x = (vs->x + vs->charwidth) & ~1;
- for (row = 0; row < ROWS; row++) {
- y = vs->y + row * vs->rowheight + vs->rowheight;
- if (osd_string_visible (vs->line[row])) {
- if (scanline >= y && scanline < y + vs->rowheight) {
-
- int startx;
- int strx;
-
- startx = x - xpos;
- strx = 0;
-
- if (startx < 0) {
- strx = -startx;
- startx = 0;
- }
-
-
- if (startx < width) {
-
- if (vs->captions)
- blit_colour_packed422_scanline (output + (startx * 2),
- osd_string_get_width (vs->line[row]),
- vs->bg_luma, vs->bg_cb, vs->bg_cr);
-
- osd_string_composite_packed422_scanline (vs->line[row],
- output + (startx * 2),
- output + (startx * 2), width - startx, strx, scanline - y);
- }
- }
- index++;
- }
- }
- }
-}
diff --git a/gst/vbidec/vbiscreen.h b/gst/vbidec/vbiscreen.h
deleted file mode 100644
index d81fb52df..000000000
--- a/gst/vbidec/vbiscreen.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2002 Billy Biggs <vektor@dumbterm.net>.
- * Copyright (c) 2002 Doug Bell <drbell@users.sourceforge.net>.
- *
- * Modified and adapted to GStreamer by
- * David I. Lehn <dlehn@users.sourceforge.net>
- *
- * This program 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 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef HAVE_VBISCREEN_H
-#define HAVE_VBISCREEN_H
-
-typedef struct vbiscreen_s vbiscreen_t;
-
-vbiscreen_t *vbiscreen_new( int video_width, int video_height,
- double video_aspect, int verbose, void *user_data );
-void vbiscreen_delete( vbiscreen_t *vs );
-void vbiscreen_set_verbose( vbiscreen_t *vs, int verbose );
-void vbiscreen_set_mode( vbiscreen_t *vs, int caption, int style);
-void vbiscreen_new_caption( vbiscreen_t *vs, int indent, int ital,
- unsigned int colour, int row );
-void vbiscreen_tab( vbiscreen_t *vs, int cols );
-void vbiscreen_delete_to_end( vbiscreen_t *vs );
-void vbiscreen_backspace( vbiscreen_t *vs );
-void vbiscreen_erase_displayed( vbiscreen_t *vs );
-void vbiscreen_erase_non_displayed( vbiscreen_t *vs );
-void vbiscreen_carriage_return( vbiscreen_t *vs );
-void vbiscreen_end_of_caption( vbiscreen_t *vs );
-void vbiscreen_print( vbiscreen_t *vs, char c1, char c2 );
-void vbiscreen_composite_packed422_scanline( vbiscreen_t *vs,
- unsigned char *output,
- int width, int xpos,
- int scanline );
-void vbiscreen_dump_screen_text( vbiscreen_t *vs );
-void vbiscreen_reset( vbiscreen_t *vs );
-
-#endif
diff --git a/meson.build b/meson.build
index 178826763..79f792412 100644
--- a/meson.build
+++ b/meson.build
@@ -72,7 +72,6 @@ check_headers = [
['HAVE_SYS_UTSNAME_H', 'sys/utsname.h'],
['HAVE_UNISTD_H', 'unistd.h'],
['HAVE_WINDOWS_H', 'windows.h'],
- ['HAVE_WININET_H', 'wininet.h'],
['HAVE_WINSOCK2_H', 'winsock2.h'],
['HAVE_WS2TCPIP_H', 'ws2tcpip.h'],
]
@@ -128,8 +127,6 @@ check_functions = [
# check token HAVE_FAAC
# check token HAVE_FAAD
# check token HAVE_FBDEV
-# check token HAVE_FIONREAD_IN_SYS_FILIO
-# check token HAVE_FIONREAD_IN_SYS_IOCTL
# check token HAVE_FLITE
# check token HAVE_FLUIDSYNTH
['HAVE_GETPAGESIZE', 'getpagesize'],
diff --git a/po/POTFILES.in b/po/POTFILES.in
index dcb3471ec..0cf980239 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -4,8 +4,6 @@ ext/opencv/gsttemplatematch.cpp
ext/resindvd/resindvdsrc.c
ext/smoothstreaming/gstmssdemux.c
ext/sndfile/gstsfdec.c
-ext/sndio/sndiosink.c
-ext/sndio/sndiosrc.c
gst/aiff/aiffparse.c
gst/asfmux/gstasfmux.c
gst/camerabin2/camerabingeneral.c
@@ -16,6 +14,5 @@ gst/camerabin2/gstwrappercamerabinsrc.c
gst/dvdspu/gstdvdspu.c
gst-libs/gst/adaptivedemux/gstadaptivedemux.c
gst/mpegtsdemux/mpegtsbase.c
-gst/nuvdemux/gstnuvdemux.c
sys/dvb/gstdvbsrc.c
sys/dvb/parsechannels.c
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 50ff92f8b..ee7151261 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -1,8 +1,5 @@
ext/sndfile/gstsfsink.c
ext/sndfile/gstsfsrc.c
-sys/dxr3/dxr3audiosink.c
-sys/dxr3/dxr3spusink.c
-sys/dxr3/dxr3videosink.c
tests/examples/camerabin2/gst-camera2.ui
tests/examples/uvch264/boolean_property.glade
tests/examples/uvch264/enum_property.glade
diff --git a/sys/Makefile.am b/sys/Makefile.am
index 4e6e58125..e5aa70491 100644
--- a/sys/Makefile.am
+++ b/sys/Makefile.am
@@ -16,12 +16,6 @@ else
APPLE_MEDIA_DIR=
endif
-if USE_AVC
-AVC_DIR=avc
-else
-AVC_DIR=
-endif
-
if USE_BLUEZ
BLUEZ_DIR=bluez
else
@@ -76,24 +70,6 @@ else
DVB_DIR=
endif
-# if USE_DXR3
-# DXR3_DIR=dxr3
-# else
-# DXR3_DIR=
-# endif
-
-if USE_LINSYS
-LINSYS_DIR=linsys
-else
-LINSYS_DIR=
-endif
-
-if USE_PVR
-PVR_DIR=pvr2d
-else
-PVR_DIR=
-endif
-
if USE_SHM
SHM_DIR=shm
else
@@ -106,18 +82,6 @@ else
OPENSLES_DIR=
endif
-# if USE_QCAM
-# QCAM_DIR=qcam
-# else
-# QCAM_DIR=
-# endif
-
-if USE_WININET
-WININET_DIR=wininet
-else
-WININET_DIR=
-endif
-
if USE_VCD
VCD_DIR=vcd
else
@@ -160,10 +124,10 @@ else
MSDK_DIR=
endif
-SUBDIRS = $(ACM_DIR) $(ANDROID_MEDIA_DIR) $(APPLE_MEDIA_DIR) $(AVC_DIR) $(BLUEZ_DIR) $(D3DVIDEOSINK_DIR) $(DECKLINK_DIR) $(DIRECTSOUND_DIR) $(WINKS_DIR) $(DVB_DIR) $(FBDEV_DIR) $(KMS_DIR) $(LINSYS_DIR) $(OPENSLES_DIR) $(PVR_DIR) $(SHM_DIR) $(UVCH264_DIR) $(VCD_DIR) $(VDPAU_DIR) $(WININET_DIR) $(WINSCREENCAP_DIR) $(WASAPI_DIR) $(NVENC_DIR) $(TINYALSA_DIR) $(MSDK_DIR)
+SUBDIRS = $(ACM_DIR) $(ANDROID_MEDIA_DIR) $(APPLE_MEDIA_DIR) $(BLUEZ_DIR) $(D3DVIDEOSINK_DIR) $(DECKLINK_DIR) $(DIRECTSOUND_DIR) $(WINKS_DIR) $(DVB_DIR) $(FBDEV_DIR) $(KMS_DIR) $(OPENSLES_DIR) $(SHM_DIR) $(UVCH264_DIR) $(VCD_DIR) $(VDPAU_DIR) $(WININET_DIR) $(WINSCREENCAP_DIR) $(WASAPI_DIR) $(NVENC_DIR) $(TINYALSA_DIR) $(MSDK_DIR)
-DIST_SUBDIRS = acmenc acmmp3dec androidmedia applemedia avc bluez d3dvideosink decklink directsound dvb linsys fbdev kms dshowdecwrapper dshowsrcwrapper dshowvideosink \
- opensles pvr2d shm uvch264 vcd vdpau wasapi wininet winks winscreencap \
+DIST_SUBDIRS = acmenc acmmp3dec androidmedia applemedia bluez d3dvideosink decklink directsound dvb fbdev kms dshowdecwrapper dshowsrcwrapper dshowvideosink \
+ opensles shm uvch264 vcd vdpau wasapi winks winscreencap \
nvenc tinyalsa msdk
include $(top_srcdir)/common/parallel-subdirs.mak
diff --git a/sys/avc/Makefile.am b/sys/avc/Makefile.am
deleted file mode 100644
index dd61d9e7c..000000000
--- a/sys/avc/Makefile.am
+++ /dev/null
@@ -1,25 +0,0 @@
-
-plugin_LTLIBRARIES = libgstavc.la
-
-libgstavc_la_SOURCES = gstavcplugin.cpp gstavcsrc.cpp
-libgstavc_la_CPPFLAGS = \
- $(GST_PLUGINS_BAD_CXXFLAGS) \
- $(GST_PLUGINS_BASE_CXXFLAGS) \
- $(GST_CXXFLAGS) \
- -framework AVCVideoServices \
- -Wno-deprecated-declarations
-libgstavc_la_LIBADD = \
- $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \
- -lgstinterfaces-$(GST_API_VERSION) \
- $(GST_BASE_LIBS) \
- $(GST_LIBS)
-
-libgstavc_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-libgstavc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) \
- -Wl,-framework -Wl,AVCVideoServices \
- -Wl,-framework -Wl,Cocoa \
- -Wl,-framework -Wl,QuickTime
-
-noinst_HEADERS = gstavcsrc.h
-
diff --git a/sys/avc/gstavcplugin.cpp b/sys/avc/gstavcplugin.cpp
deleted file mode 100644
index 82ba93525..000000000
--- a/sys/avc/gstavcplugin.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/* GStreamer
- * Copyright (C) 2011 David Schleef <ds@entropywave.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
- * Boston, MA 02110-1335, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include "gstavcsrc.h"
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-
- gst_element_register (plugin, "avcsrc", GST_RANK_NONE,
- gst_avc_src_get_type ());
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- avcsrc,
- "AVC Video Services plugin",
- plugin_init, VERSION, "LGPL", PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/sys/avc/gstavcsrc.cpp b/sys/avc/gstavcsrc.cpp
deleted file mode 100644
index 09d3f05ff..000000000
--- a/sys/avc/gstavcsrc.cpp
+++ /dev/null
@@ -1,423 +0,0 @@
-/* GStreamer
- * Copyright (C) 2011 David Schleef <ds@entropywave.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
- * Boston, MA 02110-1335, USA.
- */
-/**
- * SECTION:element-gstavcsrc
- *
- * The avcsrc element captures video from an OS/X AVC Video Services
- * devices, typically a FireWire camera.
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch -v avcsrc ! decodebin ! osxvideosink
- * ]|
- *
- * This pipeline captures from an AVC source, decodes the stream (either
- * DV or HDV), and displays the video.
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <AVCVideoServices/AVCVideoServices.h>
-using namespace AVS;
-
-#include <gst/gst.h>
-#include <gst/base/gstbasesrc.h>
-#include "gstavcsrc.h"
-
-GST_DEBUG_CATEGORY_STATIC (gst_avc_src_debug_category);
-#define GST_CAT_DEFAULT gst_avc_src_debug_category
-
-/* prototypes */
-
-
-static void gst_avc_src_set_property (GObject * object,
- guint property_id, const GValue * value, GParamSpec * pspec);
-static void gst_avc_src_get_property (GObject * object,
- guint property_id, GValue * value, GParamSpec * pspec);
-static void gst_avc_src_dispose (GObject * object);
-static void gst_avc_src_finalize (GObject * object);
-
-static GstCaps *gst_avc_src_get_caps (GstBaseSrc * src);
-static gboolean gst_avc_src_start (GstBaseSrc * src);
-static gboolean gst_avc_src_stop (GstBaseSrc * src);
-static gboolean gst_avc_src_is_seekable (GstBaseSrc * src);
-static gboolean gst_avc_src_unlock (GstBaseSrc * src);
-static gboolean gst_avc_src_event (GstBaseSrc * src, GstEvent * event);
-static GstFlowReturn
-gst_avc_src_create (GstBaseSrc * src, guint64 offset, guint size,
- GstBuffer ** buf);
-static gboolean gst_avc_src_query (GstBaseSrc * src, GstQuery * query);
-static gboolean gst_avc_src_unlock_stop (GstBaseSrc * src);
-
-enum
-{
- PROP_0
-};
-
-/* pad templates */
-
-static GstStaticPadTemplate gst_avc_src_src_template =
- GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS
- ("video/dv,systemstream=true;video/mpegts,systemstream=true,packetsize=188")
- );
-
-
-/* class initialization */
-
-#define DEBUG_INIT(bla) \
- GST_DEBUG_CATEGORY_INIT (gst_avc_src_debug_category, "avcsrc", 0, \
- "debug category for avcsrc element");
-
-GST_BOILERPLATE_FULL (GstAVCSrc, gst_avc_src, GstBaseSrc,
- GST_TYPE_BASE_SRC, DEBUG_INIT);
-
-static void
-gst_avc_src_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_static_pad_template (element_class, &gst_avc_src_src_template);
-
- gst_element_class_set_static_metadata (element_class,
- "AVC Video Services Source", "Video/Source",
- "Captures DV or HDV video from Firewire port",
- "David Schleef <ds@entropywave.com>");
-}
-
-static void
-gst_avc_src_class_init (GstAVCSrcClass * klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GstBaseSrcClass *base_src_class = GST_BASE_SRC_CLASS (klass);
-
- gobject_class->set_property = gst_avc_src_set_property;
- gobject_class->get_property = gst_avc_src_get_property;
- gobject_class->dispose = gst_avc_src_dispose;
- gobject_class->finalize = gst_avc_src_finalize;
- base_src_class->get_caps = GST_DEBUG_FUNCPTR (gst_avc_src_get_caps);
- base_src_class->start = GST_DEBUG_FUNCPTR (gst_avc_src_start);
- base_src_class->stop = GST_DEBUG_FUNCPTR (gst_avc_src_stop);
- base_src_class->is_seekable = GST_DEBUG_FUNCPTR (gst_avc_src_is_seekable);
- base_src_class->unlock = GST_DEBUG_FUNCPTR (gst_avc_src_unlock);
- base_src_class->event = GST_DEBUG_FUNCPTR (gst_avc_src_event);
- base_src_class->create = GST_DEBUG_FUNCPTR (gst_avc_src_create);
- if (0)
- base_src_class->query = GST_DEBUG_FUNCPTR (gst_avc_src_query);
- if (0)
- base_src_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_avc_src_unlock_stop);
-
-}
-
-static void
-gst_avc_src_init (GstAVCSrc * avcsrc, GstAVCSrcClass * avcsrc_class)
-{
- gst_base_src_set_live (GST_BASE_SRC (avcsrc), TRUE);
-
- avcsrc->srcpad = gst_pad_new_from_static_template (&gst_avc_src_src_template,
- "src");
-
- avcsrc->queue = gst_atomic_queue_new (16);
- avcsrc->cond = g_cond_new ();
- avcsrc->queue_lock = g_mutex_new ();
-}
-
-void
-gst_avc_src_set_property (GObject * object, guint property_id,
- const GValue * value, GParamSpec * pspec)
-{
- /* GstAVCSrc *avcsrc = GST_AVC_SRC (object); */
-
- switch (property_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-void
-gst_avc_src_get_property (GObject * object, guint property_id,
- GValue * value, GParamSpec * pspec)
-{
- /* GstAVCSrc *avcsrc = GST_AVC_SRC (object); */
-
- switch (property_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-void
-gst_avc_src_dispose (GObject * object)
-{
- /* GstAVCSrc *avcsrc = GST_AVC_SRC (object); */
-
- /* clean up as possible. may be called multiple times */
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-void
-gst_avc_src_finalize (GObject * object)
-{
- GstAVCSrc *avcsrc = GST_AVC_SRC (object);
-
- /* clean up object here */
- gst_atomic_queue_unref (avcsrc->queue);
- g_cond_free (avcsrc->cond);
- g_mutex_free (avcsrc->queue_lock);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-
-static GstCaps *
-gst_avc_src_get_caps (GstBaseSrc * src)
-{
- /* GstAVCSrc *avcsrc = GST_AVC_SRC (src); */
-
- return gst_caps_from_string ("video/mpegts,systemstream=true,packetsize=188");
-}
-
-#define kNumCyclesInMPEGReceiverSegment 200
-#define kNumSegmentsInMPEGReceiverProgram 10
-
-void
-MPEGReceiverMessageReceivedProc (UInt32 msg, UInt32 param1, UInt32 param2,
- void *pRefCon)
-{
-
-}
-
-IOReturn
-MyStructuredDataPushProc (UInt32 CycleDataCount,
- MPEGReceiveCycleData * pCycleData, void *pRefCon)
-{
- GstAVCSrc *avcsrc = GST_AVC_SRC (pRefCon);
-
- if (avcsrc) {
- UInt32 numPackets = 0;
- for (UInt32 cycle = 0; cycle < CycleDataCount; cycle++)
- numPackets += pCycleData[cycle].tsPacketCount;
- GstBuffer *buffer;
-
- buffer = gst_buffer_new_and_alloc (numPackets*kMPEG2TSPacketSize);
-
- guint8 *data = GST_BUFFER_DATA (buffer);
-
- for (UInt32 cycle = 0; cycle < CycleDataCount; cycle++) {
- GST_LOG("Received cycle %lu of %lu - %lu packets (fw time %lx)",
- cycle, CycleDataCount, pCycleData[cycle].tsPacketCount,
- pCycleData[cycle].fireWireTimeStamp);
- for (UInt32 sourcePacket = 0; sourcePacket < pCycleData[cycle].tsPacketCount;
- sourcePacket++) {
- memcpy (data,
- pCycleData[cycle].pBuf[sourcePacket], kMPEG2TSPacketSize);
- data += kMPEG2TSPacketSize;
-
- avcsrc->packets_enqueued++;
- }
- }
-
- gst_atomic_queue_push (avcsrc->queue, buffer);
-
- g_mutex_lock (avcsrc->queue_lock);
- g_cond_signal (avcsrc->cond);
- g_mutex_unlock (avcsrc->queue_lock);
- }
-
- return 0;
-}
-
-static gboolean
-gst_avc_src_start (GstBaseSrc * src)
-{
- GstAVCSrc *avcsrc = GST_AVC_SRC (src);
-
- GST_DEBUG_OBJECT (avcsrc, "start");
-
- avcsrc->unlock = FALSE;
-
- // Create a AVCDeviceController
- if (!avcsrc->pAVCDeviceController)
- CreateAVCDeviceController (&avcsrc->pAVCDeviceController);
- if (!avcsrc->pAVCDeviceController) {
- // TODO: This should never happen (unless we've run out of memory), but we should handle it cleanly anyway
- GST_ERROR ("Failed to create AVC device controller.");
- return FALSE;
- }
-
- GST_INFO ("Created AVC device controller.");
-
- if (avcsrc->deviceIndex >= CFArrayGetCount (avcsrc->pAVCDeviceController->avcDeviceArray)) {
- GST_ERROR ("Failed to find AVC device %d", avcsrc->deviceIndex);
- return FALSE;
- }
-
- avcsrc->pAVCDevice = (AVCDevice *)
- CFArrayGetValueAtIndex (avcsrc->pAVCDeviceController->avcDeviceArray,
- avcsrc->deviceIndex);
-
- if (!avcsrc->pAVCDevice) {
- GST_ERROR ("Failed to find AVC device %d", avcsrc->deviceIndex);
- return FALSE;
- }
-
- GST_INFO ("Found device with GUID 0x%016llX\n", avcsrc->pAVCDevice->guid);
-
- avcsrc->pAVCDevice->openDevice (nil, nil);
-
- avcsrc->pAVCDeviceStream = avcsrc->pAVCDevice->CreateMPEGReceiverForDevicePlug (0, nil, // We'll install the structured callback later (MyStructuredDataPushProc),
- nil,
- MPEGReceiverMessageReceivedProc,
- nil,
- nil, kNumCyclesInMPEGReceiverSegment, kNumSegmentsInMPEGReceiverProgram);
-
- avcsrc->pAVCDeviceStream->pMPEGReceiver->registerStructuredDataPushCallback
- (MyStructuredDataPushProc,
- kNumCyclesInMPEGReceiverSegment, (void *) avcsrc);
-
- avcsrc->pAVCDevice->StartAVCDeviceStream (avcsrc->pAVCDeviceStream);
-
- return TRUE;
-}
-
-static gboolean
-gst_avc_src_stop (GstBaseSrc * src)
-{
- GstAVCSrc *avcsrc = GST_AVC_SRC (src);
- GstBuffer *buffer;
-
- GST_DEBUG_OBJECT (avcsrc, "stop");
-
- // Stop the stream
- avcsrc->pAVCDevice->StopAVCDeviceStream(avcsrc->pAVCDeviceStream);
- // Destroy the stream
- avcsrc->pAVCDevice->DestroyAVCDeviceStream(avcsrc->pAVCDeviceStream);
- avcsrc->pAVCDeviceStream = nil;
-
- // Forget about the device (don't destroy it; pAVCDeviceController manages it)
- avcsrc->pAVCDevice = nil;
-
- GST_DEBUG("Packets enqueued = %llu", avcsrc->packets_enqueued);
- GST_DEBUG("Packets dequeued = %llu", avcsrc->packets_dequeued);
-
- while ((buffer = GST_BUFFER (gst_atomic_queue_pop (avcsrc->queue))) != NULL) {
- gst_buffer_unref (buffer);
- }
-
- return TRUE;
-}
-
-static gboolean
-gst_avc_src_is_seekable (GstBaseSrc * src)
-{
- GstAVCSrc *avcsrc = GST_AVC_SRC (src);
-
- GST_DEBUG_OBJECT (avcsrc, "is_seekable");
-
- return FALSE;
-}
-
-static gboolean
-gst_avc_src_unlock (GstBaseSrc * src)
-{
- GstAVCSrc *avcsrc = GST_AVC_SRC (src);
-
- GST_DEBUG_OBJECT (avcsrc, "unlock");
-
- g_mutex_lock (avcsrc->queue_lock);
- avcsrc->unlock = TRUE;
- g_cond_signal (avcsrc->cond);
- g_mutex_unlock (avcsrc->queue_lock);
-
- return TRUE;
-}
-
-static gboolean
-gst_avc_src_event (GstBaseSrc * src, GstEvent * event)
-{
- GstAVCSrc *avcsrc = GST_AVC_SRC (src);
-
- GST_DEBUG_OBJECT (avcsrc, "event of type '%s'", GST_EVENT_TYPE_NAME(event));
-
- GST_DEBUG("Packets enqueued = %llu, dequeued = %llu",
- avcsrc->packets_enqueued, avcsrc->packets_dequeued);
-
- return TRUE;
-}
-
-static GstFlowReturn
-gst_avc_src_create (GstBaseSrc * src, guint64 offset, guint size,
- GstBuffer ** buf)
-{
- GstAVCSrc *avcsrc = GST_AVC_SRC (src);
- GstBuffer *buffer;
-
- GST_DEBUG_OBJECT (avcsrc, "create");
-
- g_mutex_lock (avcsrc->queue_lock);
- buffer = GST_BUFFER (gst_atomic_queue_pop (avcsrc->queue));
- while (buffer == NULL && !avcsrc->unlock) {
- g_cond_wait (avcsrc->cond, avcsrc->queue_lock);
- buffer = GST_BUFFER (gst_atomic_queue_pop (avcsrc->queue));
- }
- g_mutex_unlock (avcsrc->queue_lock);
-
- if (avcsrc->unlock) {
- if (buffer)
- gst_buffer_unref (buffer);
- return GST_FLOW_FLUSHING;
- }
-
- gst_buffer_set_caps (buffer, GST_PAD_CAPS (avcsrc->srcpad));
-
- *buf = buffer;
-
- avcsrc->packets_dequeued++;
-
- return GST_FLOW_OK;
-}
-
-static gboolean
-gst_avc_src_query (GstBaseSrc * src, GstQuery * query)
-{
- GstAVCSrc *avcsrc = GST_AVC_SRC (src);
-
- GST_DEBUG_OBJECT (avcsrc, "query");
-
- return TRUE;
-}
-
-static gboolean
-gst_avc_src_unlock_stop (GstBaseSrc * src)
-{
- GstAVCSrc *avcsrc = GST_AVC_SRC (src);
-
- GST_DEBUG_OBJECT (avcsrc, "stop");
-
- return TRUE;
-}
diff --git a/sys/avc/gstavcsrc.h b/sys/avc/gstavcsrc.h
deleted file mode 100644
index 81c6f1c71..000000000
--- a/sys/avc/gstavcsrc.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* GStreamer
- * Copyright (C) 2011 FIXME <fixme@example.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _GST_AVC_SRC_H_
-#define _GST_AVC_SRC_H_
-
-#include <gst/base/gstbasesrc.h>
-#include <AVCVideoServices/AVCVideoServices.h>
-using namespace AVS;
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_AVC_SRC (gst_avc_src_get_type())
-#define GST_AVC_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AVC_SRC,GstAVCSrc))
-#define GST_AVC_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AVC_SRC,GstAVCSrcClass))
-#define GST_IS_AVC_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AVC_SRC))
-#define GST_IS_AVC_SRC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AVC_SRC))
-
-typedef struct _GstAVCSrc GstAVCSrc;
-typedef struct _GstAVCSrcClass GstAVCSrcClass;
-
-struct _GstAVCSrc
-{
- GstBaseSrc base_avcsrc;
-
- GstPad *srcpad;
-
- AVCDeviceController *pAVCDeviceController;
- AVCDevice *pAVCDevice;
- AVCDeviceStream *pAVCDeviceStream;
- int deviceIndex;
-
- guint64 packets_enqueued;
- guint64 packets_dequeued;
-
- GstAtomicQueue *queue;
- GCond *cond;
- GMutex *queue_lock;
- gboolean unlock;
-};
-
-struct _GstAVCSrcClass
-{
- GstBaseSrcClass base_avcsrc_class;
-};
-
-GType gst_avc_src_get_type (void);
-
-G_END_DECLS
-
-#endif
diff --git a/sys/dxr3/.gitignore b/sys/dxr3/.gitignore
deleted file mode 100644
index 58fd01e03..000000000
--- a/sys/dxr3/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-dxr3marshal.c
diff --git a/sys/dxr3/Makefile.am b/sys/dxr3/Makefile.am
deleted file mode 100644
index dc81c0c44..000000000
--- a/sys/dxr3/Makefile.am
+++ /dev/null
@@ -1,30 +0,0 @@
-
-plugin_LTLIBRARIES = libgstdxr3.la
-
-libgstdxr3_la_SOURCES = dxr3videosink.c dxr3audiosink.c dxr3spusink.c \
- dxr3init.c ac3_padder.c
-nodist_libgstdxr3_la_SOURCES = dxr3marshal.c
-libgstdxr3_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_CFLAGS)
-libgstdxr3_la_LIBADD =
-libgstdxr3_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstdxr3_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-BUILT_SOURCES = dxr3marshal.c dxr3marshal.h
-built_headers = dxr3marshal.h
-
-noinst_HEADERS = dxr3videosink.h dxr3audiosink.h dxr3spusink.h \
- dxr3common.h ac3_padder.h
-
-EXTRA_DIST = dxr3marshal.list
-
-
-dxr3marshal.h: dxr3marshal.list
- glib-genmarshal --header --prefix=dxr3_marshal $^ > dxr3marshal.h.tmp
- mv dxr3marshal.h.tmp dxr3marshal.h
-
-dxr3marshal.c: dxr3marshal.list
- echo "#include \"dxr3marshal.h\"" >> dxr3marshal.c.tmp
- glib-genmarshal --body --prefix=dxr3_marshal $^ >> dxr3marshal.c.tmp
- mv dxr3marshal.c.tmp dxr3marshal.c
-
-CLEANFILES = $(BUILT_SOURCES)
diff --git a/sys/dxr3/ac3_padder.c b/sys/dxr3/ac3_padder.c
deleted file mode 100644
index e64c88bfb..000000000
--- a/sys/dxr3/ac3_padder.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net>
- *
- * ac3_padder.c: Pad AC3 frames for use with an SPDIF interface.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <string.h>
-
-#include "ac3_padder.h"
-
-#define IEC61937_DATA_TYPE_AC3 1
-
-struct frmsize_s
-{
- unsigned short bit_rate;
- unsigned short frm_size[3];
-};
-
-
-static const struct frmsize_s frmsizecod_tbl[64] = {
- {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}}
-};
-
-
-
-/* Go one byte forward in the input buffer. */
-#define ac3p_in_fw(padder) ((padder)->in_ptr++, (padder)->remaining--)
-
-/* Go one byte forward in the output buffer. */
-#define ac3p_out_fw(padder) ((padder)->out_ptr++, (padder)->bytes_to_copy--)
-
-
-/**
- * ac3p_init:
- * @padder: The padder structure to initialize.
- *
- * Initializes an AC3 stream padder. This structure can be
- * subsequently used to parse an AC3 stream and convert it to IEC958
- * (S/PDIF) padded packets.
- */
-extern void
-ac3p_init (ac3_padder * padder)
-{
- const char sync[4] = { 0x72, 0xF8, 0x1F, 0x4E };
-
- padder->state = AC3P_STATE_SYNC1;
-
- /* No material to read yet. */
- padder->remaining = 0;
-
- /* Initialize the sync bytes in the frame. */
- memcpy (padder->frame.header, sync, 4);
-}
-
-
-/**
- * ac3_push_data:
- * @padder: The padder structure.
- * @data: A pointer to a buffer with new data to parse. This should
- * correspond to a new piece of a stream containing raw AC3 data.
- * @size: The number of available bytes in the buffer.
- *
- * Pushes a new buffer of data to be parsed by the ac3 padder. The
- * ac3_parse() function will actually parse the data and report when
- * new frames are found. This funcion should only be called once at
- * the beginning of the parsing process, or when the ac3_parse()
- * function returns the %AC3P_EVENT_PUSH event.
- */
-extern void
-ac3p_push_data (ac3_padder * padder, guchar * data, guint size)
-{
- padder->in_ptr = data;
- padder->remaining = size;
-}
-
-
-/**
- * ac3p_parse:
- * @padder: The padder structure.
- *
- * Parses the bytes already pushed into the padder structure (see
- * ac3p_push_data()) and returns an event value depending on the
- * results of the parsing.
- *
- * Returns: %AC3P_EVENT_FRAME to indicate that a new AC3 was found and
- * padded for IEC958 transmission. This frame can be read inmediatly
- * with ac3p_frame(). %AC3P_EVENT_PUSH to indicate that new data from
- * the input stream must be pushed into the padder using
- * ac3p_push_data(). This function should be called again after
- * pushing the data.
- */
-extern int
-ac3p_parse (ac3_padder * padder)
-{
- while (padder->remaining > 0) {
- switch (padder->state) {
- case AC3P_STATE_SYNC1:
- if (*(padder->in_ptr) == 0x0b) {
- /* The first sync byte was found. Go to the next state. */
- padder->frame.sync_byte1 = 0x0b;
- padder->state = AC3P_STATE_SYNC2;
- }
- ac3p_in_fw (padder);
- break;
-
- case AC3P_STATE_SYNC2:
- if (*(padder->in_ptr) == 0x77) {
- /* The second sync byte was seen right after the first. Go to
- the next state. */
- padder->frame.sync_byte2 = 0x77;
- padder->state = AC3P_STATE_HEADER;
-
- /* Skip one byte. */
- ac3p_in_fw (padder);
-
- /* Prepare for reading the header. */
- padder->out_ptr = (guchar *) & (padder->frame.crc1);
- /* Discount the 2 sync bytes from the header size. */
- padder->bytes_to_copy = AC3P_AC3_HEADER_SIZE - 2;
- } else {
- /* The second sync byte was not seen. Go back to the
- first state. */
- padder->state = AC3P_STATE_SYNC1;
- }
- break;
-
- case AC3P_STATE_HEADER:
- if (padder->bytes_to_copy > 0) {
- /* Copy one byte. */
- *(padder->out_ptr) = *(padder->in_ptr);
- ac3p_in_fw (padder);
- ac3p_out_fw (padder);
- } else {
- int fscod;
-
- /* The header is ready: */
-
- fscod = (padder->frame.code >> 6) & 0x03;
-
- /* Calculate the frame size. */
- padder->ac3_frame_size =
- 2 * frmsizecod_tbl[padder->frame.code & 0x3f].frm_size[fscod];
-
- /* Set up the IEC header. */
- if (padder->ac3_frame_size > 0) {
- padder->frame.header[4] = IEC61937_DATA_TYPE_AC3;
- } else {
- /* Don't know what it is, better be careful. */
- padder->state = AC3P_STATE_SYNC1;
- break;
- }
- padder->frame.header[5] = 0x00;
- padder->frame.header[6] = (padder->ac3_frame_size * 8) & 0xFF;
- padder->frame.header[7] = ((padder->ac3_frame_size * 8) >> 8) & 0xFF;
-
- /* Prepare for reading the body. */
- padder->bytes_to_copy = padder->ac3_frame_size - AC3P_AC3_HEADER_SIZE;
- padder->state = AC3P_STATE_CONTENT;
- }
- break;
-
- case AC3P_STATE_CONTENT:
- if (padder->bytes_to_copy > 0) {
- /* Copy one byte. */
- *(padder->out_ptr) = *(padder->in_ptr);
- ac3p_in_fw (padder);
- ac3p_out_fw (padder);
- } else {
- guint16 *ptr, i;
-
- /* Frame ready. Prepare for output: */
-
- /* Zero the non AC3 portion of the padded frame. */
- memset (&(padder->frame.sync_byte1) + padder->ac3_frame_size, 0,
- AC3P_IEC_FRAME_SIZE - AC3P_IEC_HEADER_SIZE -
- padder->ac3_frame_size);
-
- /* Fix the byte order in the AC3 portion: */
- ptr = (guint16 *) & (padder->frame.sync_byte1);
- i = padder->ac3_frame_size / 2;
- while (i > 0) {
- *ptr = GUINT16_TO_BE (*ptr);
- ptr++;
- i--;
- }
-
- /* Start over again. */
- padder->state = AC3P_STATE_SYNC1;
-
- return AC3P_EVENT_FRAME;
- }
- break;
- }
- }
-
- return AC3P_EVENT_PUSH;
-}
diff --git a/sys/dxr3/ac3_padder.h b/sys/dxr3/ac3_padder.h
deleted file mode 100644
index 7c0313810..000000000
--- a/sys/dxr3/ac3_padder.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net>
- *
- * ac3_padder.h: Pad AC3 frames for use with an SPDIF interface.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef AC3_PADDER_INC
-#define AC3_PADDER_INC
-
-#include <glib.h>
-
-
-/* Size of an IEC958 padded AC3 frame. */
-#define AC3P_IEC_FRAME_SIZE 6144
-/* Size of the IEC958 header. */
-#define AC3P_IEC_HEADER_SIZE 8
-/* Size of the AC3 header. */
-#define AC3P_AC3_HEADER_SIZE 7
-
-
-/* An IEC958 padded AC3 frame. */
-typedef struct {
- /* IEC header. */
- guchar header[AC3P_IEC_HEADER_SIZE];
-
- /* Begin of AC3 header. */
- guchar sync_byte1;
- guchar sync_byte2;
-
- guchar crc1[2];
- guchar code;
- guchar bsidmod;
- guchar acmod;
- /* End of AC3 header. */
-
- unsigned char data[AC3P_IEC_FRAME_SIZE - AC3P_IEC_HEADER_SIZE
- - AC3P_AC3_HEADER_SIZE];
-} ac3p_iec958_burst_frame;
-
-
-/* Possible states for the reading automaton: */
-
-/* Searching for sync byte 1. */
-#define AC3P_STATE_SYNC1 1
-/* Searching for sync byte 2. */
-#define AC3P_STATE_SYNC2 2
-/* Reading AC3 header. */
-#define AC3P_STATE_HEADER 3
-/* Reading packet contents.*/
-#define AC3P_STATE_CONTENT 4
-
-
-/* Events generated by the parse function: */
-
-/* The parser needs new data to be pushed. */
-#define AC3P_EVENT_PUSH 1
-/* There is a new padded frame ready to read from the padder structure. */
-#define AC3P_EVENT_FRAME 2
-
-
-/* The internal state for the padder. */
-typedef struct {
- guint state; /* State of the reading automaton. */
-
- guchar *in_ptr; /* Input pointer, marking the current
- postion in the input buffer. */
- guint remaining; /* The number of bytes remaining in the current
- reading buffer. */
-
- guchar *out_ptr; /* Output pointer, marking the current
- position in the output frame. */
- guint bytes_to_copy;
- /* Number of bytes that still must be copied
- to the output frame *during this reading
- stage*. */
-
- guint ac3_frame_size;
- /* The size in bytes of the pure AC3 portion
- of the current frame. */
-
- ac3p_iec958_burst_frame frame;
- /* The current output frame. */
-} ac3_padder;
-
-
-
-extern void
-ac3p_init(ac3_padder *padder);
-
-extern void
-ac3p_push_data(ac3_padder *padder, guchar *data, guint size);
-
-extern int
-ac3p_parse(ac3_padder *padder);
-
-
-/*
- * ac3p_frame
- * @padder The padder structure.
- *
- * Returns a pointer to the padded frame contained in the padder.
- */
-#define ac3p_frame(padder) ((guint *) &((padder)->frame))
-
-/*
- * ac3p_frame_size
- * @padder The padder structure.
- *
- * Returns the length in bytes of the last read raw AC3 frame.
- */
-#define ac3p_frame_size(padder) ((padder)->ac3_frame_size)
-
-
-#endif
diff --git a/sys/dxr3/dxr3audiosink.c b/sys/dxr3/dxr3audiosink.c
deleted file mode 100644
index 9638feb01..000000000
--- a/sys/dxr3/dxr3audiosink.c
+++ /dev/null
@@ -1,740 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net>
- *
- * dxr3audiosink.c: Audio sink for em8300 based DVD cards.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <errno.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-
-#include <linux/soundcard.h>
-#include <linux/em8300.h>
-
-#include <gst/gst-i18n-plugin.h>
-#include <gst/gst.h>
-
-#include "dxr3audiosink.h"
-#include "dxr3marshal.h"
-#include "dxr3common.h"
-
-/* Our only supported AC3 byte rate. */
-#define AC3_BYTE_RATE 48000
-
-/* Determines the amount of time to play the given number of bytes of
- the original AC3 stream. The result is expressed as MPEG2. */
-#define TIME_FOR_BYTES(bytes) (((bytes) * 90) / 48)
-
-/* Dxr3AudioSink signals and args */
-enum
-{
- SIGNAL_FLUSHED,
- LAST_SIGNAL
-};
-
-enum
-{
- ARG_0,
- ARG_DIGITAL_PCM
-};
-
-static GstStaticPadTemplate dxr3audiosink_pcm_sink_factory =
-GST_STATIC_PAD_TEMPLATE ("pcm_sink",
- GST_PAD_SINK,
- 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) { 32000, 44100, 48000, 66000 }, " "channels = (int) 2")
- );
-
-static GstStaticPadTemplate dxr3audiosink_ac3_sink_factory =
-GST_STATIC_PAD_TEMPLATE ("ac3_sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-ac3"
- /* no parameters needed, we don't need a parsed stream */
- )
- );
-
-
-static void dxr3audiosink_class_init (Dxr3AudioSinkClass * klass);
-static void dxr3audiosink_base_init (Dxr3AudioSinkClass * klass);
-static void dxr3audiosink_init (Dxr3AudioSink * sink);
-
-static void dxr3audiosink_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void dxr3audiosink_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-static gboolean dxr3audiosink_open (Dxr3AudioSink * sink);
-static gboolean dxr3audiosink_set_mode_pcm (Dxr3AudioSink * sink);
-static gboolean dxr3audiosink_set_mode_ac3 (Dxr3AudioSink * sink);
-static void dxr3audiosink_close (Dxr3AudioSink * sink);
-static gboolean dxr3audiosink_set_clock (GstElement * element,
- GstClock * clock);
-
-static GstPadLinkReturn dxr3audiosink_pcm_sinklink (GstPad * pad,
- const GstCaps * caps);
-static void dxr3audiosink_set_scr (Dxr3AudioSink * sink, guint32 scr);
-
-static gboolean dxr3audiosink_handle_event (GstPad * pad, GstEvent * event);
-static void dxr3audiosink_chain_pcm (GstPad * pad, GstData * buf);
-static void dxr3audiosink_chain_ac3 (GstPad * pad, GstData * buf);
-
-/* static void dxr3audiosink_wait (Dxr3AudioSink *sink, */
-/* GstClockTime time); */
-/* static int dxr3audiosink_mvcommand (Dxr3AudioSink *sink, */
-/* int command); */
-
-static GstStateChangeReturn dxr3audiosink_change_state (GstElement * element,
- GstStateChange transition);
-
-static void dxr3audiosink_flushed (Dxr3AudioSink * sink);
-
-static GstElementClass *parent_class = NULL;
-static guint dxr3audiosink_signals[LAST_SIGNAL] = { 0 };
-
-
-extern GType
-dxr3audiosink_get_type (void)
-{
- static GType dxr3audiosink_type = 0;
-
- if (!dxr3audiosink_type) {
- static const GTypeInfo dxr3audiosink_info = {
- sizeof (Dxr3AudioSinkClass),
- (GBaseInitFunc) dxr3audiosink_base_init,
- NULL,
- (GClassInitFunc) dxr3audiosink_class_init,
- NULL,
- NULL,
- sizeof (Dxr3AudioSink),
- 0,
- (GInstanceInitFunc) dxr3audiosink_init,
- };
-
- dxr3audiosink_type = g_type_register_static (GST_TYPE_ELEMENT,
- "Dxr3AudioSink", &dxr3audiosink_info, 0);
- }
-
- return dxr3audiosink_type;
-}
-
-
-static void
-dxr3audiosink_base_init (Dxr3AudioSinkClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_static_pad_template (element_class,
- &dxr3audiosink_pcm_sink_factory);
- gst_element_class_add_static_pad_template (element_class,
- &dxr3audiosink_ac3_sink_factory);
- gst_element_class_set_static_metadata (element_class,
- "dxr3/Hollywood+ mpeg decoder board audio plugin", "Audio/Sink",
- "Feeds audio to Sigma Designs em8300 based boards",
- "Martin Soto <martinsoto@users.sourceforge.net>");
-}
-
-static void
-dxr3audiosink_class_init (Dxr3AudioSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- dxr3audiosink_signals[SIGNAL_FLUSHED] =
- g_signal_new ("flushed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (Dxr3AudioSinkClass, flushed),
- NULL, NULL, dxr3_marshal_VOID__VOID, G_TYPE_NONE, 0);
-
- klass->flushed = dxr3audiosink_flushed;
-
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DIGITAL_PCM,
- g_param_spec_boolean ("digital-pcm", "Digital PCM",
- "Use the digital output for PCM sound", FALSE, G_PARAM_READWRITE));
-
- gobject_class->set_property = dxr3audiosink_set_property;
- gobject_class->get_property = dxr3audiosink_get_property;
-
- gstelement_class->change_state = dxr3audiosink_change_state;
- gstelement_class->set_clock = dxr3audiosink_set_clock;
-}
-
-
-static void
-dxr3audiosink_init (Dxr3AudioSink * sink)
-{
- GstPadTemplate *temp;
-
- /* Create the PCM pad. */
- temp = gst_static_pad_template_get (&dxr3audiosink_pcm_sink_factory);
- sink->pcm_sinkpad = gst_pad_new_from_template (temp, "pcm_sink");
- gst_pad_set_chain_function (sink->pcm_sinkpad, dxr3audiosink_chain_pcm);
- gst_pad_set_link_function (sink->pcm_sinkpad, dxr3audiosink_pcm_sinklink);
- gst_element_add_pad (GST_ELEMENT (sink), sink->pcm_sinkpad);
-
- /* Create the AC3 pad. */
- temp = gst_static_pad_template_get (&dxr3audiosink_ac3_sink_factory);
- sink->ac3_sinkpad = gst_pad_new_from_template (temp, "ac3_sink");
- gst_pad_set_chain_function (sink->ac3_sinkpad, dxr3audiosink_chain_ac3);
- gst_element_add_pad (GST_ELEMENT (sink), sink->ac3_sinkpad);
-
- GST_OBJECT_FLAG_SET (GST_ELEMENT (sink), GST_ELEMENT_EVENT_AWARE);
-
- sink->card_number = 0;
-
- sink->audio_filename = NULL;
- sink->audio_fd = -1;
-
- sink->control_filename = NULL;
- sink->control_fd = -1;
-
- /* Since we don't know any better, we set the initial scr to 0. */
- sink->scr = 0;
-
- /* Initially don't use digital output. */
- sink->digital_pcm = FALSE;
-
- /* Initially there's no padder. */
- sink->padder = NULL;
-
- sink->mode = DXR3AUDIOSINK_MODE_NONE;
-}
-
-
-static void
-dxr3audiosink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- Dxr3AudioSink *sink;
-
- sink = DXR3AUDIOSINK (object);
-
- switch (prop_id) {
- case ARG_DIGITAL_PCM:
- sink->digital_pcm = g_value_get_boolean (value);
- /* Refresh the setup of the device. */
- if (sink->mode == DXR3AUDIOSINK_MODE_PCM) {
- dxr3audiosink_set_mode_pcm (sink);
- }
- g_object_notify (G_OBJECT (sink), "digital-pcm");
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-static void
-dxr3audiosink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- Dxr3AudioSink *sink;
-
- g_return_if_fail (GST_IS_DXR3AUDIOSINK (object));
-
- sink = DXR3AUDIOSINK (object);
-
- switch (prop_id) {
- case ARG_DIGITAL_PCM:
- g_value_set_boolean (value, sink->digital_pcm);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-static gboolean
-dxr3audiosink_open (Dxr3AudioSink * sink)
-{
- g_return_val_if_fail (!GST_OBJECT_FLAG_IS_SET (sink, DXR3AUDIOSINK_OPEN),
- FALSE);
-
- /* Compute the name of the audio device file. */
- sink->audio_filename = g_strdup_printf ("/dev/em8300_ma-%d",
- sink->card_number);
-
- sink->audio_fd = open (sink->audio_filename, O_WRONLY);
- if (sink->audio_fd < 0) {
- GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
- (_("Could not open audio device \"%s\" for writing."),
- sink->audio_filename), GST_ERROR_SYSTEM);
- return FALSE;
- }
-
- /* Open the control device. */
- sink->control_filename = g_strdup_printf ("/dev/em8300-%d",
- sink->card_number);
-
- sink->control_fd = open (sink->control_filename, O_WRONLY);
- if (sink->control_fd < 0) {
- GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
- (_("Could not open control device \"%s\" for writing."),
- sink->control_filename), GST_ERROR_SYSTEM);
- return FALSE;
- }
-
- GST_OBJECT_FLAG_SET (sink, DXR3AUDIOSINK_OPEN);
-
- dxr3audiosink_set_mode_pcm (sink);
-
- return TRUE;
-}
-
-
-/**
- * dxr3audiosink_set_mode:
- * @sink: The sink element to operate on.
- *
- * Set the operation mode of the element to PCM.
- */
-static gboolean
-dxr3audiosink_set_mode_pcm (Dxr3AudioSink * sink)
-{
- int tmp, oss_mode, audiomode;
-
- if (sink->audio_fd == -1 || sink->control_fd == -1) {
- return FALSE;
- }
-
- /* Set the audio device mode. */
- oss_mode = (G_BYTE_ORDER == G_BIG_ENDIAN ? AFMT_S16_BE : AFMT_S16_LE);
- tmp = oss_mode;
- if (ioctl (sink->audio_fd, SNDCTL_DSP_SETFMT, &tmp) < 0 || tmp != oss_mode) {
- GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS,
- (_("Could not configure audio device \"%s\"."), sink->audio_filename),
- GST_ERROR_SYSTEM);
- return FALSE;
- }
-
- /* Set the card's general audio output mode. */
- audiomode = sink->digital_pcm ?
- EM8300_AUDIOMODE_DIGITALPCM : EM8300_AUDIOMODE_ANALOG;
- ioctl (sink->control_fd, EM8300_IOCTL_SET_AUDIOMODE, &audiomode);
-
- /* Set the sampling rate. */
- tmp = sink->rate;
- if (ioctl (sink->audio_fd, SNDCTL_DSP_SPEED, &tmp) < 0) {
- GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS,
- (_("Could not set audio device \"%s\" to %d Hz."), sink->audio_filename,
- sink->rate), GST_ERROR_SYSTEM);
- return FALSE;
- }
-
- /* Get rid of the padder, if any. */
- if (sink->padder != NULL) {
- g_free (sink->padder);
- sink->padder = NULL;
- }
-
- sink->mode = DXR3AUDIOSINK_MODE_PCM;
-
- return TRUE;
-}
-
-
-/**
- * dxr3audiosink_set_mode:
- * @sink: The sink element to operate on
- *
- * Set the operation mode of the element to AC3.
- */
-static gboolean
-dxr3audiosink_set_mode_ac3 (Dxr3AudioSink * sink)
-{
- int tmp, audiomode;
-
- if (sink->audio_fd == -1 || sink->control_fd == -1) {
- return FALSE;
- }
-
- /* Set the sampling rate. */
- tmp = AC3_BYTE_RATE;
- if (ioctl (sink->audio_fd, SNDCTL_DSP_SPEED, &tmp) < 0 ||
- tmp != AC3_BYTE_RATE) {
- GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS,
- (_("Could not set audio device \"%s\" to %d Hz."), sink->audio_filename,
- AC3_BYTE_RATE), GST_ERROR_SYSTEM);
- return FALSE;
- }
-
- /* Set the card's general audio output mode to AC3. */
- audiomode = EM8300_AUDIOMODE_DIGITALAC3;
- ioctl (sink->control_fd, EM8300_IOCTL_SET_AUDIOMODE, &audiomode);
-
- /* Create a padder if necessary, */
- if (sink->padder == NULL) {
- sink->padder = g_malloc (sizeof (ac3_padder));
- ac3p_init (sink->padder);
- }
-
- sink->mode = DXR3AUDIOSINK_MODE_AC3;
-
- return TRUE;
-}
-
-
-static void
-dxr3audiosink_close (Dxr3AudioSink * sink)
-{
- g_return_if_fail (GST_OBJECT_FLAG_IS_SET (sink, DXR3AUDIOSINK_OPEN));
-
- if (close (sink->audio_fd) != 0) {
- GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
- (_("Could not close audio device \"%s\"."), sink->audio_filename),
- GST_ERROR_SYSTEM);
- return;
- }
-
- if (close (sink->control_fd) != 0) {
- GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
- (_("Could not close control device \"%s\"."), sink->audio_filename),
- GST_ERROR_SYSTEM);
- return;
- }
-
- GST_OBJECT_FLAG_UNSET (sink, DXR3AUDIOSINK_OPEN);
-
- g_free (sink->audio_filename);
- sink->audio_filename = NULL;
-
- g_free (sink->control_filename);
- sink->control_filename = NULL;
-
- /* Get rid of the padder, if any. */
- if (sink->padder != NULL) {
- g_free (sink->padder);
- sink->padder = NULL;
- }
-}
-
-
-static gboolean
-dxr3audiosink_set_clock (GstElement * element, GstClock * clock)
-{
- Dxr3AudioSink *src = DXR3AUDIOSINK (element);
-
- src->clock = clock;
-
- return GST_ELEMENT_CLASS (parent_class)->set_clock (element, clock);
-}
-
-
-static GstPadLinkReturn
-dxr3audiosink_pcm_sinklink (GstPad * pad, const GstCaps * caps)
-{
- Dxr3AudioSink *sink = DXR3AUDIOSINK (gst_pad_get_parent (pad));
- GstStructure *structure = gst_caps_get_structure (caps, 0);
- gint rate;
-
- if (!gst_caps_is_fixed (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
-
- gst_structure_get_int (structure, "rate", &rate);
- sink->rate = rate;
-
- return GST_PAD_LINK_OK;
-}
-
-
-static void
-dxr3audiosink_set_scr (Dxr3AudioSink * sink, guint32 scr)
-{
- guint32 zero = 0;
-
-/* fprintf (stderr, "====== Adjusting SCR\n"); */
- ioctl (sink->control_fd, EM8300_IOCTL_SCR_SET, &zero);
- ioctl (sink->control_fd, EM8300_IOCTL_SCR_SET, &scr);
-}
-
-
-static gboolean
-dxr3audiosink_handle_event (GstPad * pad, GstEvent * event)
-{
- GstEventType type;
- Dxr3AudioSink *sink = DXR3AUDIOSINK (gst_pad_get_parent (pad));
-
- type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN;
-
- switch (type) {
- case GST_EVENT_FLUSH:
- if (sink->control_fd >= 0) {
- unsigned audiomode;
-
- if (sink->mode == DXR3AUDIOSINK_MODE_AC3) {
- audiomode = EM8300_AUDIOMODE_DIGITALPCM;
- ioctl (sink->control_fd, EM8300_IOCTL_SET_AUDIOMODE, &audiomode);
- audiomode = EM8300_AUDIOMODE_DIGITALAC3;
- ioctl (sink->control_fd, EM8300_IOCTL_SET_AUDIOMODE, &audiomode);
- }
-
- /* Report the flush operation. */
- g_signal_emit (G_OBJECT (sink),
- dxr3audiosink_signals[SIGNAL_FLUSHED], 0);
- }
- break;
- default:
- gst_pad_event_default (pad, event);
- break;
- }
-
- return TRUE;
-}
-
-
-static void
-dxr3audiosink_chain_pcm (GstPad * pad, GstData * _data)
-{
- Dxr3AudioSink *sink;
- gint bytes_written = 0;
- GstBuffer *buf;
-
- g_return_if_fail (pad != NULL);
- g_return_if_fail (GST_IS_PAD (pad));
- g_return_if_fail (_data != NULL);
-
- sink = DXR3AUDIOSINK (gst_pad_get_parent (pad));
-
- if (GST_IS_EVENT (_data)) {
- dxr3audiosink_handle_event (pad, GST_EVENT (_data));
- return;
- }
-
- buf = GST_BUFFER (_data);
-
- if (sink->mode != DXR3AUDIOSINK_MODE_PCM) {
- /* Switch to PCM mode. */
- dxr3audiosink_set_mode_pcm (sink);
- }
-
- if (GST_OBJECT_FLAG_IS_SET (sink, DXR3AUDIOSINK_OPEN)) {
- if (GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) {
- /* We have a new scr value. */
- sink->scr = GSTTIME_TO_MPEGTIME (GST_BUFFER_TIMESTAMP (buf));
- }
-
- /* Update the system reference clock (SCR) in the card. */
- {
- unsigned in, out, odelay;
- unsigned diff;
-
- ioctl (sink->control_fd, EM8300_IOCTL_SCR_GET, &out);
-
- ioctl (sink->audio_fd, SNDCTL_DSP_GETODELAY, &odelay);
-
- in = MPEGTIME_TO_DXRTIME (sink->scr - (odelay * 90) / 192);
- diff = in > out ? in - out : out - in;
- if (diff > 1800) {
- dxr3audiosink_set_scr (sink, in);
- }
- }
-
- /* Update our SCR value. */
- sink->scr += (unsigned) (GST_BUFFER_SIZE (buf) *
- (90000.0 / ((float) sink->rate * 4)));
-
- /* Write the buffer to the sound device. */
- bytes_written = write (sink->audio_fd, GST_BUFFER_DATA (buf),
- GST_BUFFER_SIZE (buf));
- if (bytes_written < GST_BUFFER_SIZE (buf)) {
- fprintf (stderr, "dxr3audiosink: Warning: %d bytes should be "
- "written, only %d bytes written\n",
- GST_BUFFER_SIZE (buf), bytes_written);
- }
- }
-
- gst_buffer_unref (buf);
-}
-
-
-static void
-dxr3audiosink_chain_ac3 (GstPad * pad, GstData * _data)
-{
- Dxr3AudioSink *sink;
- gint bytes_written = 0;
- GstBuffer *buf;
-
- g_return_if_fail (pad != NULL);
- g_return_if_fail (GST_IS_PAD (pad));
- g_return_if_fail (_data != NULL);
-
- sink = DXR3AUDIOSINK (gst_pad_get_parent (pad));
-
- if (GST_IS_EVENT (_data)) {
- dxr3audiosink_handle_event (pad, GST_EVENT (_data));
- return;
- }
-
- buf = GST_BUFFER (_data);
-
- if (sink->mode != DXR3AUDIOSINK_MODE_AC3) {
- /* Switch to AC3 mode. */
- dxr3audiosink_set_mode_ac3 (sink);
- }
-
- if (GST_OBJECT_FLAG_IS_SET (sink, DXR3AUDIOSINK_OPEN)) {
- int event;
-
- if (GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) {
- /* We have a new scr value. */
-
-/* fprintf (stderr, "------ Audio Time %.04f\n", */
-/* (double) GST_BUFFER_TIMESTAMP (buf) / GST_SECOND); */
-
- sink->scr = GSTTIME_TO_MPEGTIME (GST_BUFFER_TIMESTAMP (buf));
- }
-
- /* Push the new data into the padder. */
- ac3p_push_data (sink->padder, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
-
- /* Parse the data. */
- event = ac3p_parse (sink->padder);
- while (event != AC3P_EVENT_PUSH) {
- switch (event) {
- case AC3P_EVENT_FRAME:
- /* We have a new frame: */
-
- /* Update the system reference clock (SCR) in the card. */
- {
- unsigned in, out, odelay;
- unsigned diff;
-
- ioctl (sink->control_fd, EM8300_IOCTL_SCR_GET, &out);
-
- ioctl (sink->audio_fd, SNDCTL_DSP_GETODELAY, &odelay);
- /* 192000 bytes/sec */
-
- in = MPEGTIME_TO_DXRTIME (sink->scr - (odelay * 90) / 192);
- diff = in > out ? in - out : out - in;
- if (diff > 1800) {
- dxr3audiosink_set_scr (sink, in);
- }
- }
-
- /* Update our SCR value. */
- sink->scr += TIME_FOR_BYTES (ac3p_frame_size (sink->padder));
-
- /* Write the frame to the sound device. */
- bytes_written = write (sink->audio_fd, ac3p_frame (sink->padder),
- AC3P_IEC_FRAME_SIZE);
-
- if (bytes_written < AC3P_IEC_FRAME_SIZE) {
- fprintf (stderr, "dxr3audiosink: Warning: %d bytes should be "
- "written, only %d bytes written\n",
- AC3P_IEC_FRAME_SIZE, bytes_written);
- }
-
- break;
- }
-
- event = ac3p_parse (sink->padder);
- }
- }
-
- gst_buffer_unref (buf);
-}
-
-#if 0
-/**
- * dxr3audiosink_wait:
- *
- * Make the sink wait the specified amount of time.
- */
-static void
-dxr3audiosink_wait (Dxr3AudioSink * sink, GstClockTime time)
-{
- GstClockID id;
- GstClockTimeDiff jitter;
- GstClockReturn ret;
- GstClockTime current_time = gst_clock_get_time (sink->clock);
-
- id = gst_clock_new_single_shot_id (sink->clock, current_time + time);
- ret = gst_clock_id_wait (id, &jitter);
- gst_clock_id_free (id);
-}
-
-
-static int
-dxr3audiosink_mvcommand (Dxr3AudioSink * sink, int command)
-{
- em8300_register_t regs;
-
- regs.microcode_register = 1;
- regs.reg = 0;
- regs.val = command;
-
- return ioctl (sink->control_fd, EM8300_IOCTL_WRITEREG, &regs);
-}
-#endif
-
-static GstStateChangeReturn
-dxr3audiosink_change_state (GstElement * element, GstStateChange transition)
-{
- g_return_val_if_fail (GST_IS_DXR3AUDIOSINK (element),
- GST_STATE_CHANGE_FAILURE);
-
- if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
- if (GST_OBJECT_FLAG_IS_SET (element, DXR3AUDIOSINK_OPEN)) {
- dxr3audiosink_close (DXR3AUDIOSINK (element));
- }
- } else {
- if (!GST_OBJECT_FLAG_IS_SET (element, DXR3AUDIOSINK_OPEN)) {
- if (!dxr3audiosink_open (DXR3AUDIOSINK (element))) {
- return GST_STATE_CHANGE_FAILURE;
- }
- }
- }
-
- if (GST_ELEMENT_CLASS (parent_class)->change_state) {
- return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- }
-
- return GST_STATE_CHANGE_SUCCESS;
-}
-
-
-/**
- * dxr3audiosink_flushed:
- *
- * Default do nothing implementation for the "flushed" signal. The
- * "flushed" signal will be fired right after flushing the hardware
- * queues due to a received flush event
- */
-static void
-dxr3audiosink_flushed (Dxr3AudioSink * sink)
-{
- /* Do nothing. */
-}
diff --git a/sys/dxr3/dxr3audiosink.h b/sys/dxr3/dxr3audiosink.h
deleted file mode 100644
index d1394a057..000000000
--- a/sys/dxr3/dxr3audiosink.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net>
- *
- * dxr3audiosink.h: Audio sink for em8300 based DVD cards.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __DXR3AUDIOSINK_H__
-#define __DXR3AUDIOSINK_H__
-
-#include <gst/gst.h>
-
-#include "ac3_padder.h"
-
-G_BEGIN_DECLS
-
-
-#define GST_TYPE_DXR3AUDIOSINK \
- (dxr3audiosink_get_type())
-#define DXR3AUDIOSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DXR3AUDIOSINK,Dxr3AudioSink))
-#define DXR3AUDIOSINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DXR3AUDIOSINK,Dxr3AudioSinkClass))
-#define GST_IS_DXR3AUDIOSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DXR3AUDIOSINK))
-#define GST_IS_DXR3AUDIOSINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DXR3AUDIOSINK))
-
-
-typedef struct _Dxr3AudioSink Dxr3AudioSink;
-typedef struct _Dxr3AudioSinkClass Dxr3AudioSinkClass;
-
-
-typedef enum {
- DXR3AUDIOSINK_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
- DXR3AUDIOSINK_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2),
-} Dxr3AudioSinkFlags;
-
-
-/* PCM or AC3? */
-typedef enum {
- DXR3AUDIOSINK_MODE_NONE, /* No mode set. */
- DXR3AUDIOSINK_MODE_AC3, /* AC3 out. */
- DXR3AUDIOSINK_MODE_PCM, /* PCM out. */
-} Dxr3AudioSinkMode;
-
-
-/* Information for a delayed SCR set operation. */
-typedef struct {
- struct _Dxr3AudioSink *sink;
- guint32 scr;
-} Dxr3AudioSinkDelayedSCR;
-
-
-struct _Dxr3AudioSink {
- GstElement element;
-
- GstPad *pcm_sinkpad; /* The AC3 audio sink pad. */
- GstPad *ac3_sinkpad; /* The PCM audio sink pad. */
-
- int card_number; /* The number of the card to open. */
-
- gchar *audio_filename; /* File name for the audio device. */
- int audio_fd; /* File descriptor for the audio device. */
-
- gchar *control_filename; /* File name for the control device. */
- int control_fd; /* File descriptor for the control
- device. */
-
- guint64 scr; /* The current System Reference Clock value
- for the audio stream. */
-
- gboolean digital_pcm; /* Should PCM use the digital or the
- analog output? */
-
- Dxr3AudioSinkMode mode; /* The current sound output mode. */
-
- gint rate; /* The sampling rate for PCM sound. */
-
- ac3_padder *padder; /* AC3 to SPDIF padder object. */
-
- GstClock *clock; /* The clock for this element. */
-};
-
-
-struct _Dxr3AudioSinkClass {
- GstElementClass parent_class;
-
- /* signals */
- void (*flushed) (Dxr3AudioSink *sink);
-};
-
-
-extern GType dxr3audiosink_get_type (void);
-
-G_END_DECLS
-
-#endif /* __DXR3AUDIOINK_H__ */
diff --git a/sys/dxr3/dxr3common.h b/sys/dxr3/dxr3common.h
deleted file mode 100644
index 40aec8f41..000000000
--- a/sys/dxr3/dxr3common.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net>
- *
- * dxr3videosink.h: Common declarations for the DXR3 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __DXR3COMMON_H__
-#define __DXR3COMMON_H__
-
-/* Convert from GStreamer time to MPEG time. */
-#define GSTTIME_TO_MPEGTIME(time) (((time) * 9) / (GST_MSECOND/10))
-
-
-/* The em8300 driver expresses time in units of 1/45000 of second. */
-
-/* Convert from MPEG time to em8300 time. */
-#define MPEGTIME_TO_DXRTIME(time) ((guint32) ((time) >> 1))
-
-/* Convert from em8300 time to GStreamer time. */
-#define DXRTIME_TO_GSTTIME(time) \
- ((GstClockTime) ((double) (time) * (((double) GST_MSECOND) / 45.0)))
-
-
-#endif /* __DXR3COMMON_H__ */
diff --git a/sys/dxr3/dxr3init.c b/sys/dxr3/dxr3init.c
deleted file mode 100644
index ba3631685..000000000
--- a/sys/dxr3/dxr3init.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net>
- *
- * dxr3init.c: DXR3 plugin initialization.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gst/gst-i18n-plugin.h"
-
-#include "dxr3videosink.h"
-#include "dxr3spusink.h"
-#include "dxr3audiosink.h"
-
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- if (!gst_element_register (plugin, "dxr3videosink",
- GST_RANK_NONE, GST_TYPE_DXR3VIDEOSINK) ||
- !gst_element_register (plugin, "dxr3audiosink",
- GST_RANK_NONE, GST_TYPE_DXR3AUDIOSINK) ||
- !gst_element_register (plugin, "dxr3spusink",
- GST_RANK_NONE, GST_TYPE_DXR3SPUSINK))
- return FALSE;
-
-#ifdef ENABLE_NLS
- setlocale (LC_ALL, "");
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
-#endif /* ENABLE_NLS */
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- dxr3,
- "dxr3 mpeg video board elements",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/sys/dxr3/dxr3marshal.list b/sys/dxr3/dxr3marshal.list
deleted file mode 100644
index 7b99b1ef3..000000000
--- a/sys/dxr3/dxr3marshal.list
+++ /dev/null
@@ -1,5 +0,0 @@
-VOID:VOID
-VOID:BOOLEAN
-VOID:POINTER
-VOID:UINT,UINT,UINT,UINT,UINT,UINT
-
diff --git a/sys/dxr3/dxr3spusink.c b/sys/dxr3/dxr3spusink.c
deleted file mode 100644
index fbf1cf50c..000000000
--- a/sys/dxr3/dxr3spusink.c
+++ /dev/null
@@ -1,513 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net>
- *
- * dxr3spusink.h: Subpicture sink for em8300 based cards.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <errno.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-
-#include <linux/em8300.h>
-
-#include <gst/gst-i18n-plugin.h>
-#include <gst/gst.h>
-
-#include "dxr3spusink.h"
-#include "dxr3marshal.h"
-
-#include "dxr3common.h"
-
-/* Dxr3SpuSink signals and args */
-enum
-{
- SET_CLUT_SIGNAL,
- HIGHLIGHT_ON_SIGNAL,
- HIGHLIGHT_OFF_SIGNAL,
- SIGNAL_FLUSHED,
- LAST_SIGNAL
-};
-
-enum
-{
- ARG_0
-};
-
-
-static GstStaticPadTemplate dxr3spusink_sink_factory =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-
-static void dxr3spusink_class_init (Dxr3SpuSinkClass * klass);
-static void dxr3spusink_base_init (Dxr3SpuSinkClass * klass);
-static void dxr3spusink_init (Dxr3SpuSink * dxr3spusink);
-
-static void dxr3spusink_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void dxr3spusink_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-static gboolean dxr3spusink_open (Dxr3SpuSink * sink);
-static void dxr3spusink_close (Dxr3SpuSink * sink);
-static gboolean dxr3spusink_set_clock (GstElement * element, GstClock * clock);
-
-static gboolean dxr3spusink_handle_event (GstPad * pad, GstEvent * event);
-static void dxr3spusink_chain (GstPad * pad, GstData * _data);
-
-static GstStateChangeReturn dxr3spusink_change_state (GstElement * element,
- GstStateChange transition);
-
-/* static void dxr3spusink_wait (Dxr3SpuSink *sink, */
-/* GstClockTime time); */
-
-static void dxr3spusink_set_clut (Dxr3SpuSink * sink, const guint32 * clut);
-static void dxr3spusink_highlight_on (Dxr3SpuSink * sink,
- unsigned palette,
- unsigned sx, unsigned sy, unsigned ex, unsigned ey, unsigned pts);
-static void dxr3spusink_highlight_off (Dxr3SpuSink * sink);
-
-static void dxr3spusink_flushed (Dxr3SpuSink * sink);
-
-
-static GstElementClass *parent_class = NULL;
-static guint dxr3spusink_signals[LAST_SIGNAL] = { 0 };
-
-
-GType
-dxr3spusink_get_type (void)
-{
- static GType dxr3spusink_type = 0;
-
- if (!dxr3spusink_type) {
- static const GTypeInfo dxr3spusink_info = {
- sizeof (Dxr3SpuSinkClass),
- (GBaseInitFunc) dxr3spusink_base_init,
- NULL,
- (GClassInitFunc) dxr3spusink_class_init,
- NULL,
- NULL,
- sizeof (Dxr3SpuSink),
- 0,
- (GInstanceInitFunc) dxr3spusink_init,
- };
-
- dxr3spusink_type = g_type_register_static (GST_TYPE_ELEMENT,
- "Dxr3SpuSink", &dxr3spusink_info, 0);
- }
- return dxr3spusink_type;
-}
-
-
-static void
-dxr3spusink_base_init (Dxr3SpuSinkClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_static_pad_template (element_class,
- &dxr3spusink_sink_factory);
- gst_element_class_set_static_metadata (element_class,
- "dxr3/Hollywood+ mpeg decoder board subpicture element", "Sink/Video",
- "Feeds subpicture information to Sigma Designs em8300 based boards",
- "Martin Soto <martinsoto@users.sourceforge.net>");
-}
-
-static void
-dxr3spusink_class_init (Dxr3SpuSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- dxr3spusink_signals[SET_CLUT_SIGNAL] =
- g_signal_new ("set-clut",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (Dxr3SpuSinkClass, set_clut),
- NULL, NULL, dxr3_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
-
- dxr3spusink_signals[HIGHLIGHT_ON_SIGNAL] =
- g_signal_new ("highlight-on",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (Dxr3SpuSinkClass, highlight_on),
- NULL, NULL,
- dxr3_marshal_VOID__UINT_UINT_UINT_UINT_UINT_UINT,
- G_TYPE_NONE, 6,
- G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT,
- G_TYPE_UINT, G_TYPE_UINT);
-
- dxr3spusink_signals[HIGHLIGHT_OFF_SIGNAL] =
- g_signal_new ("highlight-off",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (Dxr3SpuSinkClass, highlight_off),
- NULL, NULL, dxr3_marshal_VOID__VOID, G_TYPE_NONE, 0);
-
- dxr3spusink_signals[SIGNAL_FLUSHED] =
- g_signal_new ("flushed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (Dxr3SpuSinkClass, flushed),
- NULL, NULL, dxr3_marshal_VOID__VOID, G_TYPE_NONE, 0);
-
- klass->set_clut = dxr3spusink_set_clut;
- klass->highlight_on = dxr3spusink_highlight_on;
- klass->highlight_off = dxr3spusink_highlight_off;
- klass->flushed = dxr3spusink_flushed;
-
- gobject_class->set_property = dxr3spusink_set_property;
- gobject_class->get_property = dxr3spusink_get_property;
-
- gstelement_class->change_state = dxr3spusink_change_state;
- gstelement_class->set_clock = dxr3spusink_set_clock;
-}
-
-
-static void
-dxr3spusink_init (Dxr3SpuSink * sink)
-{
- GstPad *pad;
-
- pad = gst_pad_new_from_static_template (&dxr3spusink_sink_factory, "sink");
- gst_element_add_pad (GST_ELEMENT (sink), pad);
- gst_pad_set_chain_function (pad, dxr3spusink_chain);
-
- GST_OBJECT_FLAG_SET (GST_ELEMENT (sink), GST_ELEMENT_EVENT_AWARE);
-
- sink->card_number = 0;
-
- sink->spu_filename = NULL;
- sink->spu_fd = -1;
- sink->control_filename = NULL;
- sink->control_fd = -1;
-
- sink->clock = NULL;
-}
-
-
-static void
-dxr3spusink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- Dxr3SpuSink *sink;
-
- sink = DXR3SPUSINK (object);
-
- switch (prop_id) {
- default:
- break;
- }
-}
-
-
-static void
-dxr3spusink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- Dxr3SpuSink *sink;
-
- g_return_if_fail (GST_IS_DXR3SPUSINK (object));
-
- sink = DXR3SPUSINK (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-static gboolean
-dxr3spusink_open (Dxr3SpuSink * sink)
-{
- g_return_val_if_fail (!GST_OBJECT_FLAG_IS_SET (sink, DXR3SPUSINK_OPEN),
- FALSE);
-
- /* Compute the name of the spu device file. */
- sink->spu_filename = g_strdup_printf ("/dev/em8300_sp-%d", sink->card_number);
-
- sink->spu_fd = open (sink->spu_filename, O_WRONLY);
- if (sink->spu_fd < 0) {
- GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
- (_("Could not open spu device \"%s\" for writing."),
- sink->spu_filename), GST_ERROR_SYSTEM);
- return FALSE;
- }
-
- /* Open the control device. */
- sink->control_filename = g_strdup_printf ("/dev/em8300-%d",
- sink->card_number);
-
- sink->control_fd = open (sink->control_filename, O_WRONLY);
- if (sink->control_fd < 0) {
- GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
- (_("Could not open control device \"%s\" for writing."),
- sink->control_filename), GST_ERROR_SYSTEM);
- return FALSE;
- }
-
- GST_OBJECT_FLAG_SET (sink, DXR3SPUSINK_OPEN);
-
- return TRUE;
-}
-
-
-static void
-dxr3spusink_close (Dxr3SpuSink * sink)
-{
- g_return_if_fail (GST_OBJECT_FLAG_IS_SET (sink, DXR3SPUSINK_OPEN));
-
- if (close (sink->spu_fd) != 0) {
- GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
- (_("Could not close spu device \"%s\"."), sink->spu_filename),
- GST_ERROR_SYSTEM);
- return;
- }
-
- if (close (sink->control_fd) != 0) {
- GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
- (_("Could not close control device \"%s\"."), sink->control_filename),
- GST_ERROR_SYSTEM);
- return;
- }
-
- GST_OBJECT_FLAG_UNSET (sink, DXR3SPUSINK_OPEN);
-
- free (sink->spu_filename);
- sink->spu_filename = NULL;
-}
-
-
-static gboolean
-dxr3spusink_set_clock (GstElement * element, GstClock * clock)
-{
- Dxr3SpuSink *src = DXR3SPUSINK (element);
-
- src->clock = clock;
-
- return GST_ELEMENT_CLASS (element)->set_clock (element, clock);
-}
-
-
-static gboolean
-dxr3spusink_handle_event (GstPad * pad, GstEvent * event)
-{
- GstEventType type;
- Dxr3SpuSink *sink;
-
- sink = DXR3SPUSINK (gst_pad_get_parent (pad));
-
- type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN;
-
- switch (type) {
- case GST_EVENT_FLUSH:
- if (sink->control_fd >= 0) {
- int subdevice;
-
- subdevice = EM8300_SUBDEVICE_SUBPICTURE;
- ioctl (sink->control_fd, EM8300_IOCTL_FLUSH, &subdevice);
-
- /* FIXME: There should be a nicer way to do this, but I tried
- everything and nothing else seems to really reset the video
- fifo. */
-/* dxr3spusink_close (sink); */
-/* dxr3spusink_open (sink); */
-
- /* Report the flush operation. */
- g_signal_emit (G_OBJECT (sink), dxr3spusink_signals[SIGNAL_FLUSHED], 0);
- }
- break;
- default:
- gst_pad_event_default (pad, event);
- break;
- }
-
- return TRUE;
-}
-
-
-static void
-dxr3spusink_chain (GstPad * pad, GstData * _data)
-{
- GstBuffer *buf = GST_BUFFER (_data);
- Dxr3SpuSink *sink;
- gint bytes_written = 0;
-
- g_return_if_fail (pad != NULL);
- g_return_if_fail (GST_IS_PAD (pad));
- g_return_if_fail (buf != NULL);
-
- sink = DXR3SPUSINK (gst_pad_get_parent (pad));
-
- if (GST_IS_EVENT (buf)) {
- dxr3spusink_handle_event (pad, GST_EVENT (buf));
- return;
- }
-
- if (GST_OBJECT_FLAG_IS_SET (sink, DXR3SPUSINK_OPEN)) {
- /* If we have PTS information for the SPU unit, register it now.
- The card needs the PTS to be written *before* the actual data. */
- if (GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) {
- guint pts = (guint) GSTTIME_TO_MPEGTIME (GST_BUFFER_TIMESTAMP (buf));
-
- ioctl (sink->spu_fd, EM8300_IOCTL_SPU_SETPTS, &pts);
- }
-
- bytes_written = write (sink->spu_fd, GST_BUFFER_DATA (buf),
- GST_BUFFER_SIZE (buf));
- if (bytes_written < GST_BUFFER_SIZE (buf)) {
- fprintf (stderr, "dxr3spusink: Warning: %d bytes should be written,"
- " only %d bytes written\n", GST_BUFFER_SIZE (buf), bytes_written);
- }
- }
-
- gst_buffer_unref (buf);
-}
-
-
-static GstStateChangeReturn
-dxr3spusink_change_state (GstElement * element, GstStateChange transition)
-{
- g_return_val_if_fail (GST_IS_DXR3SPUSINK (element), GST_STATE_CHANGE_FAILURE);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- if (!GST_OBJECT_FLAG_IS_SET (element, DXR3SPUSINK_OPEN)) {
- if (!dxr3spusink_open (DXR3SPUSINK (element))) {
- return GST_STATE_CHANGE_FAILURE;
- }
- }
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- if (GST_OBJECT_FLAG_IS_SET (element, DXR3SPUSINK_OPEN)) {
- dxr3spusink_close (DXR3SPUSINK (element));
- }
- break;
- }
-
- if (GST_ELEMENT_CLASS (parent_class)->change_state) {
- return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- }
-
- return GST_STATE_CHANGE_SUCCESS;
-}
-
-#if 0
-/**
- * dxr3spusink_wait:
- *
- * Make the sink wait the specified amount of time.
- */
-static void
-dxr3spusink_wait (Dxr3SpuSink * sink, GstClockTime time)
-{
- GstClockID id;
- GstClockTimeDiff jitter;
- GstClockReturn ret;
- GstClockTime current_time = gst_clock_get_time (sink->clock);
-
- id = gst_clock_new_single_shot_id (sink->clock, current_time + time);
- ret = gst_clock_id_wait (id, &jitter);
- gst_clock_id_free (id);
-}
-#endif
-
-/**
- * dxr3spusink_set_clut:
- *
- * Set a new SPU color lookup table (clut) in the dxr3 card.
- */
-static void
-dxr3spusink_set_clut (Dxr3SpuSink * sink, const guint32 * clut)
-{
- guint32 clut_fixed[16];
- int i;
-
- /* Fix the byte order of the table. */
- for (i = 0; i < 16; i++) {
- clut_fixed[i] = GUINT32_TO_LE (clut[i]);
- }
-
- if (ioctl (sink->spu_fd, EM8300_IOCTL_SPU_SETPALETTE, clut_fixed))
- fprintf (stderr, "dxr3spusink: failed to set CLUT (%s)\n",
- strerror (errno));
-}
-
-
-static void
-dxr3spusink_highlight_on (Dxr3SpuSink * sink, unsigned palette,
- unsigned sx, unsigned sy, unsigned ex, unsigned ey, unsigned pts)
-{
- em8300_button_t btn;
-
- btn.color = palette >> 16;
- btn.contrast = palette;
- btn.left = sx;
- btn.top = sy;
- btn.right = ex;
- btn.bottom = ey;
-
- if (ioctl (sink->spu_fd, EM8300_IOCTL_SPU_BUTTON, &btn)) {
- fprintf (stderr, "dxr3spusink: failed to set spu button (%s)\n",
- strerror (errno));
- }
-}
-
-
-static void
-dxr3spusink_highlight_off (Dxr3SpuSink * sink)
-{
- if (ioctl (sink->spu_fd, EM8300_IOCTL_SPU_BUTTON, NULL)) {
- fprintf (stderr, "dxr3spusink: failed to set spu button (%s)\n",
- strerror (errno));
- }
-}
-
-
-/**
- * dxr3spusink_flushed:
- *
- * Default do nothing implementation for the "flushed" signal. The
- * "flushed" signal will be fired right after flushing the hardware
- * queues due to a received flush event
- */
-static void
-dxr3spusink_flushed (Dxr3SpuSink * sink)
-{
- /* Do nothing. */
-}
diff --git a/sys/dxr3/dxr3spusink.h b/sys/dxr3/dxr3spusink.h
deleted file mode 100644
index 99a80864a..000000000
--- a/sys/dxr3/dxr3spusink.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net>
- *
- * dxr3spusink.h: Subpicture sink for em8300 based cards.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __DXR3SPUSINK_H__
-#define __DXR3SPUSINK_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-
-#define GST_TYPE_DXR3SPUSINK \
- (dxr3spusink_get_type())
-#define DXR3SPUSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DXR3SPUSINK,Dxr3SpuSink))
-#define DXR3SPUSINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DXR3SPUSINK,Dxr3SpuSinkClass))
-#define GST_IS_DXR3SPUSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DXR3SPUSINK))
-#define GST_IS_DXR3SPUSINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DXR3SPUSINK))
-
-
-typedef struct _Dxr3SpuSink Dxr3SpuSink;
-typedef struct _Dxr3SpuSinkClass Dxr3SpuSinkClass;
-
-
-typedef enum {
- DXR3SPUSINK_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
- DXR3SPUSINK_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2),
-} Dxr3SpuSinkFlags;
-
-
-struct _Dxr3SpuSink {
- GstElement element;
-
- int card_number; /* The number of the card to open. */
-
- gchar *spu_filename; /* File name for the spu device. */
- int spu_fd; /* File descriptor for the spu device. */
-
- gchar *control_filename; /* File name for the control device. */
- int control_fd; /* File descriptor for the control
- device. */
-
- GstClock *clock; /* The clock for this element. */
-};
-
-
-struct _Dxr3SpuSinkClass {
- GstElementClass parent_class;
-
- /* Signals */
- void (*set_clut) (Dxr3SpuSink *sink, const guint32 *clut);
- void (*highlight_on) (Dxr3SpuSink *sink, unsigned palette,
- unsigned sx, unsigned sy,
- unsigned ex, unsigned ey,
- unsigned pts);
- void (*highlight_off) (Dxr3SpuSink *sink);
- void (*flushed) (Dxr3SpuSink *sink);
-};
-
-
-extern GType dxr3spusink_get_type (void);
-
-G_END_DECLS
-
-#endif /* __DXR3SPUSINK_H__ */
diff --git a/sys/dxr3/dxr3videosink.c b/sys/dxr3/dxr3videosink.c
deleted file mode 100644
index 486786b86..000000000
--- a/sys/dxr3/dxr3videosink.c
+++ /dev/null
@@ -1,717 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net>
- *
- * dxr3videosink.c: Video sink for em8300 based cards.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <errno.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-
-#include <linux/em8300.h>
-
-#include <gst/gst-i18n-plugin.h>
-#include <gst/gst.h>
-
-#include "dxr3videosink.h"
-#include "dxr3marshal.h"
-
-#include "dxr3common.h"
-
-/* Dxr3VideoSink signals and args */
-enum
-{
- SIGNAL_FLUSHED,
- LAST_SIGNAL
-};
-
-enum
-{
- ARG_0,
-};
-
-/* Possible states for the MPEG start code scanner. */
-enum
-{
- SCAN_STATE_WAITING, /* Waiting for a code. */
- SCAN_STATE_0, /* 0 seen. */
- SCAN_STATE_00, /* 00 seen. */
- SCAN_STATE_001 /* 001 seen. */
-};
-
-/* Possible states for the MPEG sequence parser. */
-enum
-{
- PARSE_STATE_WAITING, /* Waiting for the start of a sequence. */
- PARSE_STATE_START, /* Start of sequence seen. */
- PARSE_STATE_PICTURE /* Picture start seen. */
-};
-
-
-/* Relevant mpeg start codes. */
-#define START_CODE_PICTURE 0x00
-#define START_CODE_SEQUENCE_HEADER 0xB3
-#define START_CODE_SEQUENCE_END 0xB7
-
-static GstStaticPadTemplate dxr3videosink_sink_factory =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/mpeg, "
- "mpegversion = (int) { 1, 2 }, " "systemstream = (boolean) FALSE"
- /* width/height/framerate omitted, we don't
- * need a parsed stream */
- )
- );
-
-
-static void dxr3videosink_class_init (Dxr3VideoSinkClass * klass);
-static void dxr3videosink_base_init (Dxr3VideoSinkClass * klass);
-static void dxr3videosink_init (Dxr3VideoSink * dxr3videosink);
-
-static void dxr3videosink_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec);
-static void dxr3videosink_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec);
-
-static gboolean dxr3videosink_open (Dxr3VideoSink * sink);
-static void dxr3videosink_close (Dxr3VideoSink * sink);
-static gboolean dxr3videosink_set_clock (GstElement * element,
- GstClock * clock);
-
-static void dxr3videosink_reset_parser (Dxr3VideoSink * sink);
-static int dxr3videosink_next_start_code (Dxr3VideoSink * sink);
-static void dxr3videosink_discard_data (Dxr3VideoSink * sink, guint cut);
-static void dxr3videosink_write_data (Dxr3VideoSink * sink, guint cut);
-static void dxr3videosink_parse_data (Dxr3VideoSink * sink);
-
-static gboolean dxr3videosink_handle_event (GstPad * pad, GstEvent * event);
-static void dxr3videosink_chain (GstPad * pad, GstData * _data);
-
-static GstStateChangeReturn dxr3videosink_change_state (GstElement * element,
- GstStateChange transition);
-
-/* static void dxr3videosink_wait (Dxr3VideoSink *sink, */
-/* GstClockTime time); */
-static int dxr3videosink_mvcommand (Dxr3VideoSink * sink, int command);
-
-static void dxr3videosink_flushed (Dxr3VideoSink * sink);
-
-static GstElementClass *parent_class = NULL;
-static guint dxr3videosink_signals[LAST_SIGNAL] = { 0 };
-
-
-extern GType
-dxr3videosink_get_type (void)
-{
- static GType dxr3videosink_type = 0;
-
- if (!dxr3videosink_type) {
- static const GTypeInfo dxr3videosink_info = {
- sizeof (Dxr3VideoSinkClass),
- (GBaseInitFunc) dxr3videosink_base_init,
- NULL,
- (GClassInitFunc) dxr3videosink_class_init,
- NULL,
- NULL,
- sizeof (Dxr3VideoSink),
- 0,
- (GInstanceInitFunc) dxr3videosink_init,
- };
-
- dxr3videosink_type = g_type_register_static (GST_TYPE_ELEMENT,
- "Dxr3VideoSink", &dxr3videosink_info, 0);
- }
-
- return dxr3videosink_type;
-}
-
-
-static void
-dxr3videosink_base_init (Dxr3VideoSinkClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_static_pad_template (element_class,
- &dxr3videosink_sink_factory);
- gst_element_class_set_static_metadata (element_class,
- "dxr3/Hollywood+ mpeg decoder board video element", "Sink/Video",
- "Feeds MPEG2 video to Sigma Designs em8300 based boards",
- "Martin Soto <martinsoto@users.sourceforge.net>");
-}
-
-static void
-dxr3videosink_class_init (Dxr3VideoSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- dxr3videosink_signals[SIGNAL_FLUSHED] =
- g_signal_new ("flushed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (Dxr3VideoSinkClass, flushed),
- NULL, NULL, dxr3_marshal_VOID__VOID, G_TYPE_NONE, 0);
-
- klass->flushed = dxr3videosink_flushed;
-
- gobject_class->set_property = dxr3videosink_set_property;
- gobject_class->get_property = dxr3videosink_get_property;
-
- gstelement_class->change_state = dxr3videosink_change_state;
- gstelement_class->set_clock = dxr3videosink_set_clock;
-}
-
-
-static void
-dxr3videosink_init (Dxr3VideoSink * sink)
-{
- GstPad *pad;
-
- pad = gst_pad_new_from_static_template (&dxr3videosink_sink_factory, "sink");
- gst_element_add_pad (GST_ELEMENT (sink), pad);
- gst_pad_set_chain_function (pad, dxr3videosink_chain);
-
- GST_OBJECT_FLAG_SET (GST_ELEMENT (sink), GST_ELEMENT_EVENT_AWARE);
-
- sink->card_number = 0;
-
- sink->video_filename = NULL;
- sink->video_fd = -1;
- sink->control_filename = NULL;
- sink->control_fd = -1;
-
- sink->clock = NULL;
-
- sink->last_ts = GST_CLOCK_TIME_NONE;
-
- sink->cur_buf = NULL;
- dxr3videosink_reset_parser (sink);
-}
-
-
-static void
-dxr3videosink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- Dxr3VideoSink *sink;
-
- sink = DXR3VIDEOSINK (object);
-
- switch (prop_id) {
- default:
- break;
- }
-}
-
-
-static void
-dxr3videosink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- Dxr3VideoSink *sink;
-
- g_return_if_fail (GST_IS_DXR3VIDEOSINK (object));
-
- sink = DXR3VIDEOSINK (object);
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-static gboolean
-dxr3videosink_open (Dxr3VideoSink * sink)
-{
- g_return_val_if_fail (!GST_OBJECT_FLAG_IS_SET (sink, DXR3VIDEOSINK_OPEN),
- FALSE);
-
- /* Compute the name of the video device file. */
- sink->video_filename = g_strdup_printf ("/dev/em8300_mv-%d",
- sink->card_number);
-
- sink->video_fd = open (sink->video_filename, O_WRONLY);
- if (sink->video_fd < 0) {
- GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
- (_("Could not open video device \"%s\" for writing."),
- sink->video_filename), GST_ERROR_SYSTEM);
- return FALSE;
- }
-
- /* Open the control device. */
- sink->control_filename = g_strdup_printf ("/dev/em8300-%d",
- sink->card_number);
-
- sink->control_fd = open (sink->control_filename, O_WRONLY);
- if (sink->control_fd < 0) {
- GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
- (_("Could not open control device \"%s\" for writing."),
- sink->control_filename), GST_ERROR_SYSTEM);
- return FALSE;
- }
-
- GST_OBJECT_FLAG_SET (sink, DXR3VIDEOSINK_OPEN);
-
- return TRUE;
-}
-
-
-static void
-dxr3videosink_close (Dxr3VideoSink * sink)
-{
- g_return_if_fail (GST_OBJECT_FLAG_IS_SET (sink, DXR3VIDEOSINK_OPEN));
-
- if (close (sink->video_fd) != 0) {
- GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
- (_("Could not close video device \"%s\"."), sink->video_filename),
- GST_ERROR_SYSTEM);
- return;
- }
-
- if (close (sink->control_fd) != 0) {
- GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
- (_("Could not close control device \"%s\"."), sink->control_filename),
- GST_ERROR_SYSTEM);
- return;
- }
-
- GST_OBJECT_FLAG_UNSET (sink, DXR3VIDEOSINK_OPEN);
-
- free (sink->video_filename);
- sink->video_filename = NULL;
-}
-
-
-static gboolean
-dxr3videosink_set_clock (GstElement * element, GstClock * clock)
-{
- Dxr3VideoSink *src = DXR3VIDEOSINK (element);
-
- src->clock = clock;
-
- return GST_ELEMENT_CLASS (parent_class)->set_clock (element, clock);
-}
-
-
-static void
-dxr3videosink_reset_parser (Dxr3VideoSink * sink)
-{
- if (sink->cur_buf != NULL) {
- gst_buffer_unref (sink->cur_buf);
- sink->cur_buf = NULL;
- }
- sink->cur_ts = GST_CLOCK_TIME_NONE;
-
- sink->scan_state = SCAN_STATE_WAITING;
- sink->scan_pos = 0;
-
- sink->parse_state = PARSE_STATE_WAITING;
-}
-
-
-static int
-dxr3videosink_next_start_code (Dxr3VideoSink * sink)
-{
- guchar c;
-
- g_return_val_if_fail (sink->cur_buf != NULL, -1);
-
- while (sink->scan_pos < GST_BUFFER_SIZE (sink->cur_buf)) {
- c = (GST_BUFFER_DATA (sink->cur_buf))[sink->scan_pos];
-
- switch (sink->scan_state) {
- case SCAN_STATE_WAITING:
- if (c == 0x00) {
- sink->scan_state = SCAN_STATE_0;
- }
- break;
- case SCAN_STATE_0:
- if (c == 0x00) {
- sink->scan_state = SCAN_STATE_00;
- } else {
- sink->scan_state = SCAN_STATE_WAITING;
- }
- break;
- case SCAN_STATE_00:
- if (c == 0x01) {
- sink->scan_state = SCAN_STATE_001;
- } else if (c != 0x00) {
- sink->scan_state = SCAN_STATE_WAITING;
- }
- break;
- case SCAN_STATE_001:
- sink->scan_pos++;
- sink->scan_state = SCAN_STATE_WAITING;
- return c;
- }
-
- sink->scan_pos++;
- }
-
- return -1;
-}
-
-
-static void
-dxr3videosink_discard_data (Dxr3VideoSink * sink, guint cut)
-{
- GstBuffer *sub;
- guint size;
-
- g_return_if_fail (sink->cur_buf != NULL);
- g_assert (cut <= sink->scan_pos);
-
- size = sink->scan_pos - cut;
-
- g_return_if_fail (size <= GST_BUFFER_SIZE (sink->cur_buf));
-
- if (GST_BUFFER_SIZE (sink->cur_buf) == size) {
- gst_buffer_unref (sink->cur_buf);
- sink->cur_buf = NULL;
- } else {
- sub = gst_buffer_create_sub (sink->cur_buf, size,
- GST_BUFFER_SIZE (sink->cur_buf)
- - size);
- gst_buffer_unref (sink->cur_buf);
- sink->cur_buf = sub;
- }
-
- sink->scan_state = SCAN_STATE_WAITING;
- sink->scan_pos = cut;
-
- sink->cur_ts = GST_CLOCK_TIME_NONE;
-}
-
-
-static void
-dxr3videosink_write_data (Dxr3VideoSink * sink, guint cut)
-{
- guint size, written;
- guint8 *data;
-
- g_return_if_fail (sink->cur_buf != NULL);
-
- if (GST_OBJECT_FLAG_IS_SET (sink, DXR3VIDEOSINK_OPEN)) {
- if (sink->cur_ts != GST_CLOCK_TIME_NONE) {
- guint pts;
-
-/* fprintf (stderr, "------ Video Time %.04f\n", */
-/* (double) sink->cur_ts / GST_SECOND); */
-
- pts = (guint) GSTTIME_TO_MPEGTIME (sink->cur_ts);
- ioctl (sink->video_fd, EM8300_IOCTL_VIDEO_SETPTS, &pts);
- sink->cur_ts = GST_CLOCK_TIME_NONE;
- }
-
- data = GST_BUFFER_DATA (sink->cur_buf);
- size = sink->scan_pos - cut;
-
- g_assert (size <= GST_BUFFER_SIZE (sink->cur_buf));
-
- /* We should always write data that corresponds to whole MPEG
- video sintactical elements. They should always start with an
- MPEG start code. */
- g_assert (size >= 4 && data[0] == 0 && data[1] == 0 && data[2] == 1);
-
- while (size > 0) {
- written = write (sink->video_fd, data, size);
- if (written < 0) {
- GST_ELEMENT_ERROR (sink, RESOURCE, WRITE,
- (_("Could not write to device \"%s\"."), sink->video_filename),
- GST_ERROR_SYSTEM);
- break;
- }
- size = size - written;
- data = data + written;
- };
- }
-
- dxr3videosink_discard_data (sink, cut);
-}
-
-
-static void
-dxr3videosink_parse_data (Dxr3VideoSink * sink)
-{
- int code;
-
- /* Timestamp handling assumes that timestamps are associated to
- sequence starts. This seems to be the case, at least for
- DVDs. */
-
- code = dxr3videosink_next_start_code (sink);
- while (code >= 0) {
- switch (sink->parse_state) {
-
- case PARSE_STATE_WAITING:
- if (code == START_CODE_SEQUENCE_HEADER) {
- dxr3videosink_discard_data (sink, 4);
- sink->parse_state = PARSE_STATE_START;
- sink->cur_ts = sink->last_ts;
- }
- break;
-
- case PARSE_STATE_START:
- switch (code) {
- case START_CODE_SEQUENCE_HEADER:
- dxr3videosink_discard_data (sink, 4);
- sink->cur_ts = sink->last_ts;
- break;
- case START_CODE_SEQUENCE_END:
- dxr3videosink_discard_data (sink, 0);
- sink->parse_state = PARSE_STATE_WAITING;
- break;
- case START_CODE_PICTURE:
- sink->parse_state = PARSE_STATE_PICTURE;
- break;
- }
- break;
-
- case PARSE_STATE_PICTURE:
- switch (code) {
- case START_CODE_SEQUENCE_HEADER:
- dxr3videosink_write_data (sink, 4);
- sink->parse_state = PARSE_STATE_START;
- sink->cur_ts = sink->last_ts;
- break;
- case START_CODE_SEQUENCE_END:
- dxr3videosink_write_data (sink, 0);
- sink->parse_state = PARSE_STATE_WAITING;
- break;
- case START_CODE_PICTURE:
- dxr3videosink_write_data (sink, 4);
- break;
- }
- break;
-
- }
-
- code = dxr3videosink_next_start_code (sink);
- }
-
- if (sink->parse_state == PARSE_STATE_WAITING) {
- dxr3videosink_discard_data (sink, 0);
- }
-}
-
-
-static gboolean
-dxr3videosink_handle_event (GstPad * pad, GstEvent * event)
-{
- GstEventType type;
- Dxr3VideoSink *sink;
-
- sink = DXR3VIDEOSINK (gst_pad_get_parent (pad));
-
- type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN;
-
- switch (type) {
- case GST_EVENT_EMPTY:
- //fprintf (stderr, "++++++ Video empty event\n");
- {
- /* FIXME: Handle this with a discontinuity or something. */
- /* Write an MPEG2 sequence end code, to ensure that the card
- actually displays the last picture. Apparently some DVDs are
- encoded without proper sequence end codes. */
- static const guint8 sec[4] = { 0x00, 0x00, 0x01, 0xb7 };
-
- if (sink->cur_buf != NULL) {
- dxr3videosink_write_data (sink, 0);
- }
-
- write (sink->video_fd, &sec, 4);
- }
- break;
-
- case GST_EVENT_DISCONTINUOUS:
- //fprintf (stderr, "++++++ Video discont event\n");
- {
- gint64 time;
- gboolean has_time;
- unsigned cur_scr, mpeg_scr, diff;
-
- has_time = gst_event_discont_get_value (event, GST_FORMAT_TIME, &time);
- if (has_time) {
-/* fprintf (stderr, "^^^^^^ Discontinuous event has time %.4f\n", */
-/* (double) time / GST_SECOND); */
-
- /* If the SCR in the card is way off, fix it. */
- ioctl (sink->control_fd, EM8300_IOCTL_SCR_GET, &cur_scr);
- mpeg_scr = MPEGTIME_TO_DXRTIME (GSTTIME_TO_MPEGTIME (time));
-
- diff = cur_scr > mpeg_scr ? cur_scr - mpeg_scr : mpeg_scr - cur_scr;
- if (diff > 1800) {
- unsigned zero = 0;
-
-/* fprintf (stderr, "====== Adjusting SCR from video\n"); */
-
- ioctl (sink->control_fd, EM8300_IOCTL_SCR_SET, &zero);
- ioctl (sink->control_fd, EM8300_IOCTL_SCR_SET, &mpeg_scr);
- }
- } else {
-/* fprintf (stderr, "^^^^^^ Discontinuous event has no time\n"); */
- }
- }
- break;
-
- case GST_EVENT_FLUSH:
- dxr3videosink_reset_parser (sink);
- break;
-
- default:
- gst_pad_event_default (pad, event);
- break;
- }
-
- return TRUE;
-}
-
-
-static void
-dxr3videosink_chain (GstPad * pad, GstData * _data)
-{
- GstBuffer *buf = GST_BUFFER (_data);
- Dxr3VideoSink *sink;
-
- g_return_if_fail (pad != NULL);
- g_return_if_fail (GST_IS_PAD (pad));
- g_return_if_fail (buf != NULL);
-
- sink = DXR3VIDEOSINK (gst_pad_get_parent (pad));
-
- if (GST_IS_EVENT (buf)) {
- dxr3videosink_handle_event (pad, GST_EVENT (buf));
- return;
- }
-
-/* fprintf (stderr, "^^^^^^ Video block\n"); */
-
- if (sink->cur_buf == NULL) {
- sink->cur_buf = buf;
- } else {
- sink->cur_buf = gst_buffer_append (sink->cur_buf, buf);
- }
-
- sink->last_ts = GST_BUFFER_TIMESTAMP (buf);
-
- dxr3videosink_parse_data (sink);
-}
-
-
-static GstStateChangeReturn
-dxr3videosink_change_state (GstElement * element, GstStateChange transition)
-{
- g_return_val_if_fail (GST_IS_DXR3VIDEOSINK (element),
- GST_STATE_CHANGE_FAILURE);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- if (!GST_OBJECT_FLAG_IS_SET (element, DXR3VIDEOSINK_OPEN)) {
- if (!dxr3videosink_open (DXR3VIDEOSINK (element))) {
- return GST_STATE_CHANGE_FAILURE;
- }
- }
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- dxr3videosink_mvcommand (DXR3VIDEOSINK (element), MVCOMMAND_PAUSE);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- dxr3videosink_mvcommand (DXR3VIDEOSINK (element), MVCOMMAND_START);
- break;
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- dxr3videosink_mvcommand (DXR3VIDEOSINK (element), MVCOMMAND_PAUSE);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- dxr3videosink_mvcommand (DXR3VIDEOSINK (element), MVCOMMAND_STOP);
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- if (GST_OBJECT_FLAG_IS_SET (element, DXR3VIDEOSINK_OPEN)) {
- dxr3videosink_close (DXR3VIDEOSINK (element));
- }
- break;
- }
-
- if (GST_ELEMENT_CLASS (parent_class)->change_state) {
- return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- }
-
- return GST_STATE_CHANGE_SUCCESS;
-}
-
-#if 0
-/**
- * dxr3videosink_wait:
- *
- * Make the sink wait the specified amount of time.
- */
-static void
-dxr3videosink_wait (Dxr3VideoSink * sink, GstClockTime time)
-{
- GstClockID id;
- GstClockTimeDiff jitter;
- GstClockReturn ret;
- GstClockTime current_time = gst_clock_get_time (sink->clock);
-
- id = gst_clock_new_single_shot_id (sink->clock, current_time + time);
- ret = gst_clock_id_wait (id, &jitter);
- gst_clock_id_free (id);
-}
-#endif
-
-/**
- * dxr3videosink_mvcommand
- *
- * Send an MVCOMMAND to the card.
- */
-static int
-dxr3videosink_mvcommand (Dxr3VideoSink * sink, int command)
-{
- em8300_register_t regs;
-
- regs.microcode_register = 1;
- regs.reg = 0;
- regs.val = command;
-
- return ioctl (sink->control_fd, EM8300_IOCTL_WRITEREG, &regs);
-}
-
-
-/**
- * dxr3videosink_flushed:
- *
- * Default do nothing implementation for the "flushed" signal. The
- * "flushed" signal will be fired right after flushing the hardware
- * queues due to a received flush event
- */
-static void
-dxr3videosink_flushed (Dxr3VideoSink * sink)
-{
- /* Do nothing. */
-}
diff --git a/sys/dxr3/dxr3videosink.h b/sys/dxr3/dxr3videosink.h
deleted file mode 100644
index 1fd3669e7..000000000
--- a/sys/dxr3/dxr3videosink.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* GStreamer
- * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net>
- *
- * dxr3videosink.h: Video sink for em8300 based cards.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __DXR3VIDEOSINK_H__
-#define __DXR3VIDEOSINK_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-
-#define GST_TYPE_DXR3VIDEOSINK \
- (dxr3videosink_get_type())
-#define DXR3VIDEOSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DXR3VIDEOSINK,Dxr3VideoSink))
-#define DXR3VIDEOSINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DXR3VIDEOSINK,Dxr3VideoSinkClass))
-#define GST_IS_DXR3VIDEOSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DXR3VIDEOSINK))
-#define GST_IS_DXR3VIDEOSINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DXR3VIDEOSINK))
-
-
-typedef struct _Dxr3VideoSink Dxr3VideoSink;
-typedef struct _Dxr3VideoSinkClass Dxr3VideoSinkClass;
-
-
-typedef enum {
- DXR3VIDEOSINK_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
- DXR3VIDEOSINK_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2),
-} Dxr3VideoSinkFlags;
-
-
-struct _Dxr3VideoSink {
- GstElement element;
-
- int card_number; /* The number of the card to open. */
-
- gchar *video_filename; /* File name for the video device. */
- int video_fd; /* File descriptor for the video device. */
-
- gchar *control_filename; /* File name for the control device. */
- int control_fd; /* File descriptor for the control
- device. */
-
- GstClock *clock; /* The clock for this element. */
-
- GstClockTime last_ts; /* Last timestamp received. */
-
- GstBuffer *cur_buf; /* The buffer we are currently
- building. */
- GstClockTime cur_ts; /* Timestamp associated to the
- current buffer. */
-
- guchar scan_state; /* The current state of the MPEG start
- code scanner. */
- guint scan_pos; /* The current position of the MPEG
- start code scanner (with respect to
- the start of the current buffer. */
-
- guchar parse_state; /* The current state of the MPEG
- sequence parser. */
-};
-
-
-struct _Dxr3VideoSinkClass {
- GstElementClass parent_class;
-
- /* signals */
- void (*flushed) (Dxr3VideoSink *sink);
-};
-
-
-extern GType dxr3videosink_get_type (void);
-
-G_END_DECLS
-
-#endif /* __DXR3VIDEOSINK_H__ */
diff --git a/sys/linsys/Makefile.am b/sys/linsys/Makefile.am
deleted file mode 100644
index 8b1047248..000000000
--- a/sys/linsys/Makefile.am
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-plugin_LTLIBRARIES = libgstlinsys.la
-
-libgstlinsys_la_SOURCES = \
- gstlinsyssdisink.c \
- gstlinsyssdisrc.c \
- gstlinsys.c
-
-noinst_HEADERS = \
- gstlinsyssdisink.h \
- gstlinsyssdisrc.h \
- include/asi.h \
- include/master.h \
- include/sdi.h \
- include/sdiaudio.h \
- include/sdivideo.h
-
-libgstlinsys_la_CFLAGS = \
- -I$(srcdir)/include \
- $(GST_BASE_CFLAGS) \
- $(GST_CFLAGS)
-libgstlinsys_la_LDFLAGS = \
- $(GST_PLUGIN_LDFLAGS)
-libgstlinsys_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS)
-libgstlinsys_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
diff --git a/sys/linsys/gstlinsys.c b/sys/linsys/gstlinsys.c
deleted file mode 100644
index 4893fbe34..000000000
--- a/sys/linsys/gstlinsys.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* GStreamer
- * Copyright (C) 2010 FIXME <fixme@example.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/base/gstbasesrc.h>
-
-#include "gstlinsyssdisink.h"
-#include "gstlinsyssdisrc.h"
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
-
- gst_element_register (plugin, "linsyssdisrc", GST_RANK_NONE,
- gst_linsys_sdi_src_get_type ());
- gst_element_register (plugin, "linsyssdisink", GST_RANK_NONE,
- gst_linsys_sdi_sink_get_type ());
-
- return TRUE;
-}
-
-#define PACKAGE_ORIGIN "http://FIXME.org/"
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- linsys, "FIXME", plugin_init, VERSION, "LGPL", PACKAGE_NAME, PACKAGE_ORIGIN)
diff --git a/sys/linsys/gstlinsyssdisink.c b/sys/linsys/gstlinsyssdisink.c
deleted file mode 100644
index a8edf3731..000000000
--- a/sys/linsys/gstlinsyssdisink.c
+++ /dev/null
@@ -1,488 +0,0 @@
-/* GStreamer
- * Copyright (C) 2010 David Schleef <ds@entropywave.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/base/gstbasesink.h>
-#include "gstlinsyssdisink.h"
-
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <poll.h>
-#include <sys/ioctl.h>
-
-#include "sdivideo.h"
-
-/* prototypes */
-
-
-static void gst_linsys_sdi_sink_set_property (GObject * object,
- guint property_id, const GValue * value, GParamSpec * pspec);
-static void gst_linsys_sdi_sink_get_property (GObject * object,
- guint property_id, GValue * value, GParamSpec * pspec);
-static void gst_linsys_sdi_sink_dispose (GObject * object);
-static void gst_linsys_sdi_sink_finalize (GObject * object);
-
-static GstCaps *gst_linsys_sdi_sink_get_caps (GstBaseSink * sink);
-static gboolean gst_linsys_sdi_sink_set_caps (GstBaseSink * sink,
- GstCaps * caps);
-static GstFlowReturn gst_linsys_sdi_sink_buffer_alloc (GstBaseSink * sink,
- guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
-static void gst_linsys_sdi_sink_get_times (GstBaseSink * sink,
- GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
-static gboolean gst_linsys_sdi_sink_start (GstBaseSink * sink);
-static gboolean gst_linsys_sdi_sink_stop (GstBaseSink * sink);
-static gboolean gst_linsys_sdi_sink_unlock (GstBaseSink * sink);
-static gboolean gst_linsys_sdi_sink_event (GstBaseSink * sink,
- GstEvent * event);
-static GstFlowReturn gst_linsys_sdi_sink_preroll (GstBaseSink * sink,
- GstBuffer * buffer);
-static GstFlowReturn gst_linsys_sdi_sink_render (GstBaseSink * sink,
- GstBuffer * buffer);
-static GstStateChangeReturn gst_linsys_sdi_sink_async_play (GstBaseSink * sink);
-static gboolean gst_linsys_sdi_sink_activate_pull (GstBaseSink * sink,
- gboolean active);
-static void gst_linsys_sdi_sink_fixate (GstBaseSink * sink, GstCaps * caps);
-static gboolean gst_linsys_sdi_sink_unlock_stop (GstBaseSink * sink);
-static GstFlowReturn
-gst_linsys_sdi_sink_render_list (GstBaseSink * sink,
- GstBufferList * buffer_list);
-
-enum
-{
- PROP_0,
- PROP_DEVICE
-};
-
-#define DEFAULT_DEVICE "/dev/sditx0"
-
-/* pad templates */
-
-static GstStaticPadTemplate gst_linsys_sdi_sink_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-yuv,format=(fourcc)UYVY,"
- "width=720,height=480,pixel-aspect-ratio=10/11,"
- "framerate=30000/1001,interlaced=true,"
- "colorspec=sdtv,chroma-site=mpeg2")
- );
-
-/* class initialization */
-
-GST_BOILERPLATE (GstLinsysSdiSink, gst_linsys_sdi_sink, GstBaseSink,
- GST_TYPE_BASE_SINK);
-
-static void
-gst_linsys_sdi_sink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_static_pad_template (element_class,
- &gst_linsys_sdi_sink_sink_template);
-
- gst_element_class_set_static_metadata (element_class, "SDI video sink",
- "Sink/Video", "Writes video from SDI transmit device",
- "David Schleef <ds@entropywave.com>");
-}
-
-static void
-gst_linsys_sdi_sink_class_init (GstLinsysSdiSinkClass * klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GstBaseSinkClass *base_sink_class = GST_BASE_SINK_CLASS (klass);
-
- gobject_class->set_property = gst_linsys_sdi_sink_set_property;
- gobject_class->get_property = gst_linsys_sdi_sink_get_property;
- gobject_class->dispose = gst_linsys_sdi_sink_dispose;
- gobject_class->finalize = gst_linsys_sdi_sink_finalize;
- base_sink_class->get_caps = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_get_caps);
- base_sink_class->set_caps = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_set_caps);
- if (0)
- base_sink_class->buffer_alloc =
- GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_buffer_alloc);
- base_sink_class->get_times =
- GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_get_times);
- base_sink_class->start = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_start);
- base_sink_class->stop = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_stop);
- base_sink_class->unlock = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_unlock);
- base_sink_class->event = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_event);
- base_sink_class->preroll = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_preroll);
- base_sink_class->render = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_render);
- if (0)
- base_sink_class->async_play =
- GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_async_play);
- if (0)
- base_sink_class->activate_pull =
- GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_activate_pull);
- base_sink_class->fixate = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_fixate);
- base_sink_class->unlock_stop =
- GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_unlock_stop);
- base_sink_class->render_list =
- GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_render_list);
-
- g_object_class_install_property (gobject_class, PROP_DEVICE,
- g_param_spec_string ("device", "Device", "device to transmit data on",
- DEFAULT_DEVICE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-}
-
-static void
-gst_linsys_sdi_sink_init (GstLinsysSdiSink * linsyssdisink,
- GstLinsysSdiSinkClass * linsyssdisink_class)
-{
- linsyssdisink->device = g_strdup (DEFAULT_DEVICE);
-}
-
-void
-gst_linsys_sdi_sink_set_property (GObject * object, guint property_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstLinsysSdiSink *linsyssdisink;
-
- g_return_if_fail (GST_IS_LINSYS_SDI_SINK (object));
- linsyssdisink = GST_LINSYS_SDI_SINK (object);
-
- switch (property_id) {
- case PROP_DEVICE:
- g_free (linsyssdisink->device);
- linsyssdisink->device = g_value_dup_string (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-void
-gst_linsys_sdi_sink_get_property (GObject * object, guint property_id,
- GValue * value, GParamSpec * pspec)
-{
- GstLinsysSdiSink *linsyssdisink;
-
- g_return_if_fail (GST_IS_LINSYS_SDI_SINK (object));
- linsyssdisink = GST_LINSYS_SDI_SINK (object);
-
- switch (property_id) {
- case PROP_DEVICE:
- g_value_set_string (value, linsyssdisink->device);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-void
-gst_linsys_sdi_sink_dispose (GObject * object)
-{
- GstLinsysSdiSink *linsyssdisink;
-
- g_return_if_fail (GST_IS_LINSYS_SDI_SINK (object));
- linsyssdisink = GST_LINSYS_SDI_SINK (object);
-
- /* clean up as possible. may be called multiple times */
- g_free (linsyssdisink->device);
- linsyssdisink->device = NULL;
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-void
-gst_linsys_sdi_sink_finalize (GObject * object)
-{
- g_return_if_fail (GST_IS_LINSYS_SDI_SINK (object));
-
- /* clean up object here */
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-
-
-static GstCaps *
-gst_linsys_sdi_sink_get_caps (GstBaseSink * sink)
-{
- GST_ERROR_OBJECT (sink, "get_caps");
-
- return NULL;
-}
-
-static gboolean
-gst_linsys_sdi_sink_set_caps (GstBaseSink * sink, GstCaps * caps)
-{
- GST_ERROR_OBJECT (sink, "set_caps");
-
- return TRUE;
-}
-
-static GstFlowReturn
-gst_linsys_sdi_sink_buffer_alloc (GstBaseSink * sink, guint64 offset,
- guint size, GstCaps * caps, GstBuffer ** buf)
-{
- GST_ERROR_OBJECT (sink, "buffer_alloc");
-
- return GST_FLOW_ERROR;
-}
-
-static void
-gst_linsys_sdi_sink_get_times (GstBaseSink * sink, GstBuffer * buffer,
- GstClockTime * start, GstClockTime * end)
-{
-
-}
-
-static gboolean
-gst_linsys_sdi_sink_start (GstBaseSink * sink)
-{
- GstLinsysSdiSink *linsyssdisink = GST_LINSYS_SDI_SINK (sink);
- int fd;
-
- GST_ERROR_OBJECT (sink, "start");
-
- fd = open (linsyssdisink->device, O_WRONLY, 0);
- if (fd < 0) {
- GST_ERROR_OBJECT (sink, "failed to open device");
- return FALSE;
- }
-
- linsyssdisink->fd = fd;
- linsyssdisink->tmpdata = g_malloc (858 * 525 * 2);
-
- return TRUE;
-}
-
-static gboolean
-gst_linsys_sdi_sink_stop (GstBaseSink * sink)
-{
- GstLinsysSdiSink *linsyssdisink = GST_LINSYS_SDI_SINK (sink);
-
- GST_ERROR_OBJECT (sink, "stop");
-
- if (linsyssdisink->fd > 0) {
- close (linsyssdisink->fd);
- }
- g_free (linsyssdisink->tmpdata);
- linsyssdisink->tmpdata = NULL;
-
- return TRUE;
-}
-
-static gboolean
-gst_linsys_sdi_sink_unlock (GstBaseSink * sink)
-{
- GST_ERROR_OBJECT (sink, "unlock");
-
- return TRUE;
-}
-
-static gboolean
-gst_linsys_sdi_sink_event (GstBaseSink * sink, GstEvent * event)
-{
- GST_ERROR_OBJECT (sink, "event");
-
- return TRUE;
-}
-
-static GstFlowReturn
-gst_linsys_sdi_sink_preroll (GstBaseSink * sink, GstBuffer * buffer)
-{
- GST_ERROR_OBJECT (sink, "preroll");
-
- return GST_FLOW_OK;
-}
-
-#define EAV 0x74
-#define SAV 0x80
-
-static int
-get_av (int f, int v, int h)
-{
- static const int table[] = {
- 0x80, 0x9d, 0xab, 0xb6, 0xc7, 0xda, 0xec, 0xf1
- };
-
- return table[(f << 2) | (v << 1) | h];
-}
-
-static void
-sdi_mux (guint8 * data, GstBuffer * buffer)
-{
- int j;
- int i;
- guint8 *dest;
- int f, v;
- int line;
-
- for (j = 0; j < 525; j++) {
- dest = data + 858 * 2 * j;
-
- line = (j + 4) % 525;
-
- if (line < 10 || (line >= 264 && line < 273)) {
- v = 1;
- } else {
- v = 0;
- }
-
- if (line >= 266 || line < 4) {
- f = 1;
- } else {
- f = 0;
- }
-
- dest[0] = 0xff;
- dest[1] = 0;
- dest[2] = 0;
- dest[3] = get_av (f, v, 1);
-
- for (i = 1; i < (858 - 720) / 2 - 1; i++) {
- dest[i * 4 + 0] = 0x200 >> 2;
- dest[i * 4 + 1] = 0x040 >> 2;
- dest[i * 4 + 2] = 0x200 >> 2;
- dest[i * 4 + 3] = 0x040 >> 2;
- }
-
- i = (858 - 720) / 2 - 1;
- dest[i * 4 + 0] = 0xff;
- dest[i * 4 + 1] = 0x00;
- dest[i * 4 + 2] = 0x00;
- dest[3] = get_av (f, v, 0);
-
- i = (858 - 720) / 2;
- if (line >= 23 && line <= 262) {
- int src_line = (line - 23) * 2 + 1;
- memcpy (dest + i * 4, GST_BUFFER_DATA (buffer) + 720 * 2 * src_line,
- 720 * 2);
- } else if (line >= 285 && line <= 525) {
- int src_line = (line - 285) * 2 + 0;
- memcpy (dest + i * 4, GST_BUFFER_DATA (buffer) + 720 * 2 * src_line,
- 720 * 2);
- } else {
- for (i = (858 - 720) / 2; i < 858 / 2; i++) {
- dest[i * 4 + 0] = 0x200 >> 2;
- dest[i * 4 + 1] = 0x040 >> 2;
- dest[i * 4 + 2] = 0x200 >> 2;
- dest[i * 4 + 3] = 0x040 >> 2;
- }
- }
- }
-
-}
-
-static GstFlowReturn
-gst_linsys_sdi_sink_render (GstBaseSink * sink, GstBuffer * buffer)
-{
- GstLinsysSdiSink *linsyssdisink = GST_LINSYS_SDI_SINK (sink);
- int ret;
- struct pollfd pfd;
- int offset;
- guint8 *data = linsyssdisink->tmpdata;
-
- GST_ERROR_OBJECT (sink, "render");
-
- sdi_mux (data, buffer);
-
- offset = 0;
-#define SIZE (858*525*2)
- while (offset < SIZE) {
- pfd.fd = linsyssdisink->fd;
- pfd.events = POLLOUT | POLLPRI;
- ret = poll (&pfd, 1, -1);
- if (ret < 0) {
- GST_ERROR_OBJECT (sink, "poll failed %d", ret);
- return GST_FLOW_ERROR;
- }
-
- if (pfd.revents & POLLOUT) {
- ret = write (linsyssdisink->fd, data + offset, SIZE - offset);
- if (ret < 0) {
- GST_ERROR_OBJECT (sink, "write failed %d", ret);
- return GST_FLOW_ERROR;
- }
- offset += ret;
- }
- if (pfd.revents & POLLPRI) {
- long val;
-
- ret = ioctl (linsyssdisink->fd, SDIVIDEO_IOC_TXGETEVENTS, &val);
- if (ret < 0) {
- GST_ERROR_OBJECT (sink, "ioctl failed %d", ret);
- return GST_FLOW_ERROR;
- }
- if (val & SDIVIDEO_EVENT_TX_BUFFER) {
- GST_ERROR_OBJECT (sink, "transmit buffer underrun");
- return GST_FLOW_ERROR;
- }
- if (val & SDIVIDEO_EVENT_TX_FIFO) {
- GST_ERROR_OBJECT (sink, "transmit FIFO underrun");
- return GST_FLOW_ERROR;
- }
- if (val & SDIVIDEO_EVENT_TX_DATA) {
- GST_ERROR_OBJECT (sink, "transmit status change");
- }
- }
- }
-
- return GST_FLOW_OK;
-}
-
-static GstStateChangeReturn
-gst_linsys_sdi_sink_async_play (GstBaseSink * sink)
-{
- GST_ERROR_OBJECT (sink, "render");
-
- return GST_STATE_CHANGE_SUCCESS;
-}
-
-static gboolean
-gst_linsys_sdi_sink_activate_pull (GstBaseSink * sink, gboolean active)
-{
- GST_ERROR_OBJECT (sink, "activate_pull");
-
- return TRUE;
-}
-
-static void
-gst_linsys_sdi_sink_fixate (GstBaseSink * sink, GstCaps * caps)
-{
- GST_ERROR_OBJECT (sink, "fixate");
-
-}
-
-static gboolean
-gst_linsys_sdi_sink_unlock_stop (GstBaseSink * sink)
-{
- GST_ERROR_OBJECT (sink, "unlock_stop");
-
- return TRUE;
-}
-
-static GstFlowReturn
-gst_linsys_sdi_sink_render_list (GstBaseSink * sink,
- GstBufferList * buffer_list)
-{
- GST_ERROR_OBJECT (sink, "render_list");
-
- return GST_FLOW_OK;
-}
diff --git a/sys/linsys/gstlinsyssdisink.h b/sys/linsys/gstlinsyssdisink.h
deleted file mode 100644
index f036af72a..000000000
--- a/sys/linsys/gstlinsyssdisink.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* GStreamer
- * Copyright (C) 2010 FIXME <fixme@example.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _GST_LINSYS_SDI_SINK_H_
-#define _GST_LINSYS_SDI_SINK_H_
-
-#include <gst/gst.h>
-#include <gst/base/gstbasesink.h>
-
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_LINSYS_SDI_SINK (gst_linsys_sdi_sink_get_type())
-#define GST_LINSYS_SDI_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_LINSYS_SDI_SINK,GstLinsysSdiSink))
-#define GST_LINSYS_SDI_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_LINSYS_SDI_SINK,GstLinsysSdiSinkClass))
-#define GST_IS_LINSYS_SDI_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_LINSYS_SDI_SINK))
-#define GST_IS_LINSYS_SDI_SINK_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_LINSYS_SDI_SINK))
-
-typedef struct _GstLinsysSdiSink GstLinsysSdiSink;
-typedef struct _GstLinsysSdiSinkClass GstLinsysSdiSinkClass;
-
-struct _GstLinsysSdiSink
-{
- GstBaseSink base_linsyssdisink;
-
- /* properties */
- gchar *device;
-
- /* state */
- int fd;
- guint8 *tmpdata;
-};
-
-struct _GstLinsysSdiSinkClass
-{
- GstBaseSinkClass base_linsyssdisink_class;
-};
-
-GType gst_linsys_sdi_sink_get_type (void);
-
-G_END_DECLS
-
-#endif
diff --git a/sys/linsys/gstlinsyssdisrc.c b/sys/linsys/gstlinsyssdisrc.c
deleted file mode 100644
index 43e289881..000000000
--- a/sys/linsys/gstlinsyssdisrc.c
+++ /dev/null
@@ -1,551 +0,0 @@
-/* GStreamer
- * Copyright (C) 2010 David Schleef <ds@entropywave.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/base/gstbasesrc.h>
-#include "gstlinsyssdisrc.h"
-
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <poll.h>
-#include <sys/ioctl.h>
-
-#include "sdivideo.h"
-
-/* prototypes */
-
-
-static void gst_linsys_sdi_src_set_property (GObject * object,
- guint property_id, const GValue * value, GParamSpec * pspec);
-static void gst_linsys_sdi_src_get_property (GObject * object,
- guint property_id, GValue * value, GParamSpec * pspec);
-static void gst_linsys_sdi_src_dispose (GObject * object);
-static void gst_linsys_sdi_src_finalize (GObject * object);
-
-static GstCaps *gst_linsys_sdi_src_get_caps (GstBaseSrc * src);
-static gboolean gst_linsys_sdi_src_set_caps (GstBaseSrc * src, GstCaps * caps);
-static gboolean gst_linsys_sdi_src_negotiate (GstBaseSrc * src);
-static gboolean gst_linsys_sdi_src_newsegment (GstBaseSrc * src);
-static gboolean gst_linsys_sdi_src_start (GstBaseSrc * src);
-static gboolean gst_linsys_sdi_src_stop (GstBaseSrc * src);
-static void
-gst_linsys_sdi_src_get_times (GstBaseSrc * src, GstBuffer * buffer,
- GstClockTime * start, GstClockTime * end);
-static gboolean gst_linsys_sdi_src_get_size (GstBaseSrc * src, guint64 * size);
-static gboolean gst_linsys_sdi_src_is_seekable (GstBaseSrc * src);
-static gboolean gst_linsys_sdi_src_unlock (GstBaseSrc * src);
-static gboolean gst_linsys_sdi_src_event (GstBaseSrc * src, GstEvent * event);
-static GstFlowReturn
-gst_linsys_sdi_src_create (GstBaseSrc * src, guint64 offset, guint size,
- GstBuffer ** buf);
-static gboolean gst_linsys_sdi_src_do_seek (GstBaseSrc * src,
- GstSegment * segment);
-static gboolean gst_linsys_sdi_src_query (GstBaseSrc * src, GstQuery * query);
-static gboolean gst_linsys_sdi_src_check_get_range (GstBaseSrc * src);
-static void gst_linsys_sdi_src_fixate (GstBaseSrc * src, GstCaps * caps);
-static gboolean gst_linsys_sdi_src_unlock_stop (GstBaseSrc * src);
-static gboolean
-gst_linsys_sdi_src_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
- GstSegment * segment);
-
-enum
-{
- PROP_0,
- PROP_DEVICE
-};
-
-#define DEFAULT_DEVICE "/dev/sdirx0"
-
-GST_DEBUG_CATEGORY (gst_linsys_sdi_src_debug);
-#define GST_CAT_DEFAULT gst_linsys_sdi_src_debug
-
-/* pad templates */
-
-static GstStaticPadTemplate gst_linsys_sdi_src_src_template =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-yuv,format=(fourcc)UYVY,"
- "width=720,height=480,pixel-aspect-ratio=10/11,"
- "framerate=30000/1001,interlaced=true,"
- "colorspec=sdtv,chroma-site=mpeg2")
- );
-
-/* class initialization */
-
-GST_BOILERPLATE (GstLinsysSdiSrc, gst_linsys_sdi_src, GstBaseSrc,
- GST_TYPE_BASE_SRC);
-
-static void
-gst_linsys_sdi_src_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_static_pad_template (element_class,
- &gst_linsys_sdi_src_src_template);
-
- gst_element_class_set_static_metadata (element_class, "SDI video source",
- "Source/Video", "Reads video from SDI capture device",
- "David Schleef <ds@entropywave.com>");
-}
-
-static void
-gst_linsys_sdi_src_class_init (GstLinsysSdiSrcClass * klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GstBaseSrcClass *base_src_class = GST_BASE_SRC_CLASS (klass);
-
- GST_DEBUG_CATEGORY_INIT (gst_linsys_sdi_src_debug, "linsyssdisrc", 0,
- "FIXME");
-
- gobject_class->set_property = gst_linsys_sdi_src_set_property;
- gobject_class->get_property = gst_linsys_sdi_src_get_property;
- gobject_class->dispose = gst_linsys_sdi_src_dispose;
- gobject_class->finalize = gst_linsys_sdi_src_finalize;
- base_src_class->get_caps = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_get_caps);
- base_src_class->set_caps = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_set_caps);
- if (0)
- base_src_class->negotiate =
- GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_negotiate);
- base_src_class->newsegment =
- GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_newsegment);
- base_src_class->start = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_start);
- base_src_class->stop = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_stop);
- base_src_class->get_times = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_get_times);
- base_src_class->get_size = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_get_size);
- base_src_class->is_seekable =
- GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_is_seekable);
- base_src_class->unlock = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_unlock);
- base_src_class->event = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_event);
- base_src_class->create = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_create);
- if (0)
- base_src_class->do_seek = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_do_seek);
- base_src_class->query = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_query);
- base_src_class->check_get_range =
- GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_check_get_range);
- base_src_class->fixate = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_fixate);
- base_src_class->unlock_stop =
- GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_unlock_stop);
- base_src_class->prepare_seek_segment =
- GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_prepare_seek_segment);
-
- g_object_class_install_property (gobject_class, PROP_DEVICE,
- g_param_spec_string ("device", "Device", "device to transmit data on",
- DEFAULT_DEVICE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-}
-
-static void
-gst_linsys_sdi_src_init (GstLinsysSdiSrc * linsyssdisrc,
- GstLinsysSdiSrcClass * linsyssdisrc_class)
-{
-
- gst_base_src_set_live (GST_BASE_SRC (linsyssdisrc), TRUE);
- gst_base_src_set_blocksize (GST_BASE_SRC (linsyssdisrc), 720 * 480 * 2);
-
- linsyssdisrc->device = g_strdup (DEFAULT_DEVICE);
-
- linsyssdisrc->is_625 = FALSE;
- linsyssdisrc->fd = -1;
-}
-
-void
-gst_linsys_sdi_src_set_property (GObject * object, guint property_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstLinsysSdiSrc *linsyssdisrc;
-
- g_return_if_fail (GST_IS_LINSYS_SDI_SRC (object));
- linsyssdisrc = GST_LINSYS_SDI_SRC (object);
-
- switch (property_id) {
- case PROP_DEVICE:
- g_free (linsyssdisrc->device);
- linsyssdisrc->device = g_value_dup_string (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-void
-gst_linsys_sdi_src_get_property (GObject * object, guint property_id,
- GValue * value, GParamSpec * pspec)
-{
- GstLinsysSdiSrc *linsyssdisrc;
-
- g_return_if_fail (GST_IS_LINSYS_SDI_SRC (object));
- linsyssdisrc = GST_LINSYS_SDI_SRC (object);
-
- switch (property_id) {
- case PROP_DEVICE:
- g_value_set_string (value, linsyssdisrc->device);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-void
-gst_linsys_sdi_src_dispose (GObject * object)
-{
- GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (object);
- g_return_if_fail (linsyssdisrc != NULL);
-
- /* clean up as possible. may be called multiple times */
- g_free (linsyssdisrc->device);
- linsyssdisrc->device = NULL;
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-void
-gst_linsys_sdi_src_finalize (GObject * object)
-{
- g_return_if_fail (GST_IS_LINSYS_SDI_SRC (object));
-
- /* clean up object here */
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-
-static GstCaps *
-gst_linsys_sdi_src_get_caps (GstBaseSrc * src)
-{
- GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src);
-
- GST_DEBUG_OBJECT (linsyssdisrc, "get_caps");
-
- return NULL;
-}
-
-static gboolean
-gst_linsys_sdi_src_set_caps (GstBaseSrc * src, GstCaps * caps)
-{
- GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src);
-
- GST_DEBUG_OBJECT (linsyssdisrc, "set_caps");
-
- return TRUE;
-}
-
-static gboolean
-gst_linsys_sdi_src_negotiate (GstBaseSrc * src)
-{
- GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src);
-
- GST_DEBUG_OBJECT (linsyssdisrc, "negotiate");
-
- return TRUE;
-}
-
-static gboolean
-gst_linsys_sdi_src_newsegment (GstBaseSrc * src)
-{
- GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src);
-
- GST_DEBUG_OBJECT (linsyssdisrc, "newsegment");
-
- return TRUE;
-}
-
-static gboolean
-gst_linsys_sdi_src_start (GstBaseSrc * src)
-{
- GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src);
- int fd;
-
- GST_DEBUG_OBJECT (linsyssdisrc, "start");
-
- fd = open (linsyssdisrc->device, O_RDONLY);
- if (fd < 0) {
- GST_ERROR_OBJECT (src, "failed to open device");
- return FALSE;
- }
-
- linsyssdisrc->fd = fd;
-
- if (linsyssdisrc->is_625) {
- linsyssdisrc->tmpdata = g_malloc (864 * 625 * 2);
- } else {
- linsyssdisrc->tmpdata = g_malloc (858 * 525 * 2);
- }
- linsyssdisrc->have_sync = FALSE;
-
- return TRUE;
-}
-
-static gboolean
-gst_linsys_sdi_src_stop (GstBaseSrc * src)
-{
- GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src);
-
- GST_DEBUG_OBJECT (linsyssdisrc, "stop");
-
-#if 0
- if (linsyssdisrc->fd > 0) {
- close (linsyssdisrc->fd);
- linsyssdisrc->fd = -1;
- }
- g_free (linsyssdisrc->tmpdata);
- linsyssdisrc->tmpdata = NULL;
-#endif
-
- return TRUE;
-}
-
-static void
-gst_linsys_sdi_src_get_times (GstBaseSrc * src, GstBuffer * buffer,
- GstClockTime * start, GstClockTime * end)
-{
- GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src);
-
- GST_DEBUG_OBJECT (linsyssdisrc, "get_times");
-}
-
-static gboolean
-gst_linsys_sdi_src_get_size (GstBaseSrc * src, guint64 * size)
-{
- GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src);
-
- GST_DEBUG_OBJECT (linsyssdisrc, "get_size");
-
- return FALSE;
-}
-
-static gboolean
-gst_linsys_sdi_src_is_seekable (GstBaseSrc * src)
-{
- GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src);
-
- GST_DEBUG_OBJECT (linsyssdisrc, "is_seekable");
-
- return FALSE;
-}
-
-static gboolean
-gst_linsys_sdi_src_unlock (GstBaseSrc * src)
-{
- GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src);
-
- GST_DEBUG_OBJECT (linsyssdisrc, "unlock");
-
- return TRUE;
-}
-
-static gboolean
-gst_linsys_sdi_src_event (GstBaseSrc * src, GstEvent * event)
-{
- GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src);
-
- GST_DEBUG_OBJECT (linsyssdisrc, "event");
-
- return TRUE;
-}
-
-static void
-sdi_demux (guint8 * data, GstBuffer * buf, gboolean is_625)
-{
- int j;
- int line;
- int offset;
-
- if (is_625) {
- offset = (864 - 720) / 2;
-
- for (j = 0; j < 480; j++) {
- if (j & 1) {
- line = 23 + (j - 1) / 2;
- } else {
- line = 335 + j / 2;
- }
- memcpy (GST_BUFFER_DATA (buf) + j * 720 * 2,
- data + (line - 1) * 864 * 2 + offset * 4, 720 * 2);
- }
- } else {
- offset = (858 - 720) / 2;
-
- for (j = 0; j < 480; j++) {
- if (j & 1) {
- line = 23 + (j - 1) / 2;
- } else {
- line = 285 + j / 2;
- }
- memcpy (GST_BUFFER_DATA (buf) + j * 720 * 2,
- data + (line - 1) * 858 * 2 + offset * 4, 720 * 2);
- }
- }
-
-}
-
-static GstFlowReturn
-gst_linsys_sdi_src_create (GstBaseSrc * src, guint64 _offset, guint size,
- GstBuffer ** buf)
-{
- GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src);
- int offset;
- int ret;
- struct pollfd pfd;
- int sdi_size;
- int sdi_width;
- guint8 *data = linsyssdisrc->tmpdata;
-
- if (linsyssdisrc->fd < 0)
- return GST_FLOW_FLUSHING;
-
- if (linsyssdisrc->is_625) {
- sdi_width = 864;
- sdi_size = 864 * 625 * 2;
- } else {
- sdi_width = 858;
- sdi_size = 858 * 525 * 2;
- }
-
- GST_DEBUG_OBJECT (linsyssdisrc, "create size=%d fd=%d", size,
- linsyssdisrc->fd);
-
- offset = 0;
- while (offset < sdi_size) {
- pfd.fd = linsyssdisrc->fd;
- pfd.events = POLLIN | POLLPRI;
- ret = poll (&pfd, 1, 1000);
- if (ret < 0) {
- GST_ERROR_OBJECT (src, "poll failed %d", ret);
- return GST_FLOW_ERROR;
- }
-
- if (pfd.revents & POLLIN) {
- if (linsyssdisrc->have_sync) {
- ret = read (linsyssdisrc->fd, data + offset, sdi_size - offset);
- } else {
- ret = read (linsyssdisrc->fd, data + offset, sdi_width * 2);
- }
- if (ret < 0) {
- GST_ERROR_OBJECT (src, "read failed %d", ret);
- return GST_FLOW_ERROR;
- }
-
- if (!linsyssdisrc->have_sync) {
- int v = (data[3] >> 5) & 1;
- int f = (data[3] >> 6) & 1;
- if (!linsyssdisrc->have_vblank && (f == 0) && (v == 1)) {
- linsyssdisrc->have_vblank = TRUE;
- } else if (linsyssdisrc->have_vblank && (f == 0) && (v == 0)) {
- offset += sdi_width * 2 * 9;
- linsyssdisrc->have_sync = TRUE;
- offset += ret;
- }
- } else {
- offset += ret;
- }
- }
- if (pfd.revents & POLLPRI) {
- long val;
-
- ret = ioctl (linsyssdisrc->fd, SDIVIDEO_IOC_RXGETEVENTS, &val);
- if (ret < 0) {
- GST_ERROR_OBJECT (src, "ioctl failed %d", ret);
- return GST_FLOW_ERROR;
- }
- if (val & SDIVIDEO_EVENT_RX_BUFFER) {
- GST_ERROR_OBJECT (src, "receive buffer overrun");
- return GST_FLOW_ERROR;
- }
- if (val & SDIVIDEO_EVENT_RX_FIFO) {
- GST_ERROR_OBJECT (src, "receive FIFO overrun");
- return GST_FLOW_ERROR;
- }
- if (val & SDIVIDEO_EVENT_RX_CARRIER) {
- GST_ERROR_OBJECT (src, "carrier status change");
- }
- }
- }
-
- *buf = gst_buffer_new_and_alloc (size);
- sdi_demux (data, *buf, linsyssdisrc->is_625);
-
- return GST_FLOW_OK;
-}
-
-static gboolean
-gst_linsys_sdi_src_do_seek (GstBaseSrc * src, GstSegment * segment)
-{
- GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src);
-
- GST_DEBUG_OBJECT (linsyssdisrc, "do_seek");
-
- return FALSE;
-}
-
-static gboolean
-gst_linsys_sdi_src_query (GstBaseSrc * src, GstQuery * query)
-{
- GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src);
-
- GST_DEBUG_OBJECT (linsyssdisrc, "query");
-
- return TRUE;
-}
-
-static gboolean
-gst_linsys_sdi_src_check_get_range (GstBaseSrc * src)
-{
- GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src);
-
- GST_DEBUG_OBJECT (linsyssdisrc, "get_range");
-
- return FALSE;
-}
-
-static void
-gst_linsys_sdi_src_fixate (GstBaseSrc * src, GstCaps * caps)
-{
- GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src);
-
- GST_DEBUG_OBJECT (linsyssdisrc, "fixate");
-}
-
-static gboolean
-gst_linsys_sdi_src_unlock_stop (GstBaseSrc * src)
-{
- GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src);
-
- GST_DEBUG_OBJECT (linsyssdisrc, "stop");
-
- return TRUE;
-}
-
-static gboolean
-gst_linsys_sdi_src_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
- GstSegment * segment)
-{
- GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src);
-
- GST_DEBUG_OBJECT (linsyssdisrc, "seek_segment");
-
- return FALSE;
-}
diff --git a/sys/linsys/gstlinsyssdisrc.h b/sys/linsys/gstlinsyssdisrc.h
deleted file mode 100644
index 80d8d3148..000000000
--- a/sys/linsys/gstlinsyssdisrc.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* GStreamer
- * Copyright (C) 2010 FIXME <fixme@example.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _GST_LINSYS_SDI_SRC_H_
-#define _GST_LINSYS_SDI_SRC_H_
-
-#include <gst/gst.h>
-#include <gst/base/gstbasesrc.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_LINSYS_SDI_SRC (gst_linsys_sdi_src_get_type())
-#define GST_LINSYS_SDI_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_LINSYS_SDI_SRC,GstLinsysSdiSrc))
-#define GST_LINSYS_SDI_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_LINSYS_SDI_SRC,GstLinsysSdiSrcClass))
-#define GST_IS_LINSYS_SDI_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_LINSYS_SDI_SRC))
-#define GST_IS_LINSYS_SDI_SRC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_LINSYS_SDI_SRC))
-
-typedef struct _GstLinsysSdiSrc GstLinsysSdiSrc;
-typedef struct _GstLinsysSdiSrcClass GstLinsysSdiSrcClass;
-
-struct _GstLinsysSdiSrc
-{
- GstBaseSrc base_linsyssdisrc;
-
- /* properties */
- gchar *device;
- gboolean is_625;
-
- /* state */
- int fd;
- guint8 *tmpdata;
- gboolean have_sync;
- gboolean have_vblank;
-
-};
-
-struct _GstLinsysSdiSrcClass
-{
- GstBaseSrcClass base_linsyssdisrc_class;
-};
-
-GType gst_linsys_sdi_src_get_type (void);
-
-G_END_DECLS
-
-#endif
diff --git a/sys/linsys/include/asi.h b/sys/linsys/include/asi.h
deleted file mode 100644
index 89635886d..000000000
--- a/sys/linsys/include/asi.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/* asi.h
- *
- * Shared header file for the Linux user-space API for
- * Linear Systems Ltd. DVB Master ASI interface boards.
- *
- * Copyright (C) 1999 Tony Bolger <d7v@indigo.ie>
- * Copyright (C) 2000-2009 Linear Systems Ltd.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of Linear Systems Ltd. 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 LINEAR SYSTEMS LTD. "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 LINEAR SYSTEMS LTD. 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.
- *
- * Linear Systems can be contacted at <http://www.linsys.ca/>.
- *
- */
-
-#ifndef _ASI_H
-#define _ASI_H
-
-/* Driver info */
-#define ASI_DRIVER_NAME "asi"
-
-#define ASI_MAJOR 61 /* Set to 0 for dynamic allocation.
- * Otherwise, 61 is available.
- * See /usr/src/linux/Documentation/devices.txt */
-
-#define ASI_TX_BUFFERS_MIN 2 /* This must be at least 2 */
-/* The minimum transmit buffer size must be positive, divisible by 8,
- * and large enough that the buffers aren't transferred to the onboard FIFOs
- * too quickly for the machine to handle the interrupts.
- * This is especially a problem at startup, when the FIFOs are empty.
- * Relevant factors include onboard FIFO size, PCI bus throughput,
- * processor speed, and interrupt latency. */
-#define ASI_TX_BUFSIZE_MIN 1024
-#define ASI_RX_BUFFERS_MIN 2 /* This must be at least 2 */
-#define ASI_RX_BUFSIZE_MIN 8 /* This must be positive and divisible by 8 */
-
-#define ASI_TX_BUFFERS 54 /* This must be at least 2 */
-#define ASI_TX_BUFSIZE 38352 /* This must be positive and divisible by 8 */
-#define ASI_RX_BUFFERS 54 /* This must be at least 2 */
-#define ASI_RX_BUFSIZE 38352 /* This must be positive and divisible by 8 */
-
-/* Ioctl () definitions */
-#define ASI_IOC_MAGIC '?' /* This ioctl magic number is currently free. See
- * /usr/src/linux/Documentation/ioctl-number.txt */
-
-#define ASI_IOC_TXGETCAP _IOR(ASI_IOC_MAGIC, 1, unsigned int)
-#define ASI_IOC_TXGETEVENTS _IOR(ASI_IOC_MAGIC, 2, unsigned int)
-#define ASI_IOC_TXGETBUFLEVEL _IOR(ASI_IOC_MAGIC, 3, unsigned int)
-#define ASI_IOC_TXSETSTUFFING _IOW(ASI_IOC_MAGIC, 4, struct asi_txstuffing)
-#define ASI_IOC_TXGETBYTECOUNT _IOR(ASI_IOC_MAGIC, 5, unsigned int)
-/* #define ASI_IOC_TXGETFIFO _IOR(ASI_IOC_MAGIC, 6, int) */
-#define ASI_IOC_TXGETTXD _IOR(ASI_IOC_MAGIC, 7, int)
-#define ASI_IOC_TXGET27COUNT _IOR(ASI_IOC_MAGIC, 8, unsigned int)
-/* Provide compatibility with applications compiled for older API */
-#define ASI_IOC_TXSETPID_DEPRECATED _IOR(ASI_IOC_MAGIC, 9, unsigned int)
-#define ASI_IOC_TXSETPID _IOW(ASI_IOC_MAGIC, 9, unsigned int)
-#define ASI_IOC_TXGETPCRSTAMP _IOR(ASI_IOC_MAGIC, 10, struct asi_pcrstamp)
-/* Provide compatibility with applications compiled for older API */
-#define ASI_IOC_TXCHANGENEXTIP_DEPRECATED _IOR(ASI_IOC_MAGIC, 11, int)
-#define ASI_IOC_TXCHANGENEXTIP _IOW(ASI_IOC_MAGIC, 11, int)
-
-#define ASI_IOC_RXGETCAP _IOR(ASI_IOC_MAGIC, 65, unsigned int)
-#define ASI_IOC_RXGETEVENTS _IOR(ASI_IOC_MAGIC, 66, unsigned int)
-#define ASI_IOC_RXGETBUFLEVEL _IOR(ASI_IOC_MAGIC, 67, unsigned int)
-/* #define ASI_IOC_RXSETREFRAME _IOW(ASI_IOC_MAGIC, 68, int) */
-#define ASI_IOC_RXGETSTATUS _IOR(ASI_IOC_MAGIC, 69, int)
-#define ASI_IOC_RXGETBYTECOUNT _IOR(ASI_IOC_MAGIC, 70, unsigned int)
-/* #define ASI_IOC_RXGETFIFO _IOR(ASI_IOC_MAGIC, 71, int) */
-#define ASI_IOC_RXSETINVSYNC _IOW(ASI_IOC_MAGIC, 72, int)
-#define ASI_IOC_RXGETCARRIER _IOR(ASI_IOC_MAGIC, 73, int)
-#define ASI_IOC_RXSETDSYNC _IOW(ASI_IOC_MAGIC, 74, int)
-#define ASI_IOC_RXGETRXD _IOR(ASI_IOC_MAGIC, 75, int)
-#define ASI_IOC_RXSETPF _IOW(ASI_IOC_MAGIC, 76, unsigned int [256])
-/* #define ASI_IOC_RXSETPFE _IOW(ASI_IOC_MAGIC, 77, int) */
-#define ASI_IOC_RXSETPID0 _IOW(ASI_IOC_MAGIC, 78, int)
-#define ASI_IOC_RXGETPID0COUNT _IOR(ASI_IOC_MAGIC, 79, unsigned int)
-#define ASI_IOC_RXSETPID1 _IOW(ASI_IOC_MAGIC, 80, int)
-#define ASI_IOC_RXGETPID1COUNT _IOR(ASI_IOC_MAGIC, 81, unsigned int)
-#define ASI_IOC_RXSETPID2 _IOW(ASI_IOC_MAGIC, 82, int)
-#define ASI_IOC_RXGETPID2COUNT _IOR(ASI_IOC_MAGIC, 83, unsigned int)
-#define ASI_IOC_RXSETPID3 _IOW(ASI_IOC_MAGIC, 84, int)
-#define ASI_IOC_RXGETPID3COUNT _IOR(ASI_IOC_MAGIC, 85, unsigned int)
-/* #define ASI_IOC_RXGETSTAMP _IOR(ASI_IOC_MAGIC, 86, unsigned int) */
-#define ASI_IOC_RXGET27COUNT _IOR(ASI_IOC_MAGIC, 87, unsigned int)
-#define ASI_IOC_RXGETSTATUS2 _IOR(ASI_IOC_MAGIC, 88, int)
-/* Provide compatibility with applications compiled for older API */
-#define ASI_IOC_RXSETINPUT_DEPRECATED _IOR(ASI_IOC_MAGIC, 89, int)
-#define ASI_IOC_RXSETINPUT _IOW(ASI_IOC_MAGIC, 89, int)
-#define ASI_IOC_RXGETRXD2 _IOR(ASI_IOC_MAGIC, 90, int)
-
-#define ASI_IOC_GETID _IOR(ASI_IOC_MAGIC, 129, unsigned int)
-#define ASI_IOC_GETVERSION _IOR(ASI_IOC_MAGIC, 130, unsigned int)
-
-/* Transmitter event flag bit locations */
-#define ASI_EVENT_TX_BUFFER_ORDER 0
-#define ASI_EVENT_TX_BUFFER (1 << ASI_EVENT_TX_BUFFER_ORDER)
-#define ASI_EVENT_TX_FIFO_ORDER 1
-#define ASI_EVENT_TX_FIFO (1 << ASI_EVENT_TX_FIFO_ORDER)
-#define ASI_EVENT_TX_DATA_ORDER 2
-#define ASI_EVENT_TX_DATA (1 << ASI_EVENT_TX_DATA_ORDER)
-
-/* Receiver event flag bit locations */
-#define ASI_EVENT_RX_BUFFER_ORDER 0
-#define ASI_EVENT_RX_BUFFER (1 << ASI_EVENT_RX_BUFFER_ORDER)
-#define ASI_EVENT_RX_FIFO_ORDER 1
-#define ASI_EVENT_RX_FIFO (1 << ASI_EVENT_RX_FIFO_ORDER)
-#define ASI_EVENT_RX_CARRIER_ORDER 2
-#define ASI_EVENT_RX_CARRIER (1 << ASI_EVENT_RX_CARRIER_ORDER)
-#define ASI_EVENT_RX_AOS_ORDER 3
-#define ASI_EVENT_RX_AOS (1 << ASI_EVENT_RX_AOS_ORDER)
-#define ASI_EVENT_RX_LOS_ORDER 4
-#define ASI_EVENT_RX_LOS (1 << ASI_EVENT_RX_LOS_ORDER)
-#define ASI_EVENT_RX_DATA_ORDER 5
-#define ASI_EVENT_RX_DATA (1 << ASI_EVENT_RX_DATA_ORDER)
-
-/**
- * asi_txstuffing - Transmitter stuffing parameters
- * @ib: interbyte stuffing
- * @ip: interpacket stuffing
- * @normal_ip: FT0
- * @big_ip: FT1
- * @il_normal: IL0
- * @il_big: IL1
- **/
-struct asi_txstuffing {
- /* Number of K28.5 characters to insert between packet bytes */
- unsigned int ib;
-
- /* Base number of K28.5 characters to insert between packets,
- * not including the two required by ASI */
- unsigned int ip;
-
- /* Number of packets with (ip) bytes of interpacket stuffing
- * per finetuning cycle */
- unsigned int normal_ip;
-
- /* Number of packets with (ip + 1) bytes of interpacket stuffing
- * per finetuning cycle */
- unsigned int big_ip;
-
- /* Number of packets with (ip) bytes of interpacket stuffing
- * per interleaved finetuning cycle */
- unsigned int il_normal;
-
- /* Number of packets with (ip + 1) bytes of interpacket stuffing
- * per interleaved finetuning cycle */
- unsigned int il_big;
-};
-
-/**
- * asi_pcrstamp - PCR - departure time pair
- * @adaptation_field_length: adaptation field length
- * @adaptation_field_flags: adaptation field flags
- * @PCR: a program clock reference
- * @count: departure time of this PCR, in 1 / 27 MHz
- **/
-struct asi_pcrstamp {
- unsigned char adaptation_field_length;
- unsigned char adaptation_field_flags;
- unsigned char PCR[6];
- long long int count;
-};
-
-/* Interface capabilities */
-#define ASI_CAP_TX_MAKE204 0x00000004
-#define ASI_CAP_TX_FINETUNING 0x00000008
-#define ASI_CAP_TX_BYTECOUNTER 0x00000010
-#define ASI_CAP_TX_SETCLKSRC 0x00000020
-#define ASI_CAP_TX_FIFOUNDERRUN 0x00000040
-#define ASI_CAP_TX_LARGEIB 0x00000080
-#define ASI_CAP_TX_INTERLEAVING 0x00000100
-#define ASI_CAP_TX_DATA 0x00000200
-#define ASI_CAP_TX_RXCLKSRC 0x00000400
-/* #define ASI_CAP_TX_COMPOSITEREF 0x00000800 */
-#define ASI_CAP_TX_PCRSTAMP 0x00001000
-#define ASI_CAP_TX_CHANGENEXTIP 0x00002000
-#define ASI_CAP_TX_27COUNTER 0x00004000
-#define ASI_CAP_TX_BYTESOR27 0x00008000
-#define ASI_CAP_TX_TIMESTAMPS 0x00010000
-#define ASI_CAP_TX_PTIMESTAMPS 0x00020000
-#define ASI_CAP_TX_NULLPACKETS 0x00040000
-
-#define ASI_CAP_RX_SYNC 0x00000004
-#define ASI_CAP_RX_MAKE188 0x00000008
-#define ASI_CAP_RX_BYTECOUNTER 0x00000010
-/* #define ASI_CAP_RX_FIFOSTATUS 0x00000020 */
-#define ASI_CAP_RX_INVSYNC 0x00000040
-#define ASI_CAP_RX_CD 0x00000080
-#define ASI_CAP_RX_DSYNC 0x00000100
-#define ASI_CAP_RX_DATA 0x00000200
-#define ASI_CAP_RX_PIDFILTER 0x00000400
-#define ASI_CAP_RX_PIDCOUNTER 0x00000800
-#define ASI_CAP_RX_4PIDCOUNTER 0x00001000
-#define ASI_CAP_RX_FORCEDMA 0x00002000
-#define ASI_CAP_RX_27COUNTER 0x00004000
-#define ASI_CAP_RX_BYTESOR27 0x00008000
-#define ASI_CAP_RX_TIMESTAMPS 0x00010000
-#define ASI_CAP_RX_PTIMESTAMPS 0x00020000
-#define ASI_CAP_RX_NULLPACKETS 0x00040000
-#define ASI_CAP_RX_REDUNDANT 0x00080000
-#define ASI_CAP_RX_DATA2 0x00100000
-
-/* Transmitter clock source settings */
-#define ASI_CTL_TX_CLKSRC_ONBOARD 0
-#define ASI_CTL_TX_CLKSRC_EXT 1
-#define ASI_CTL_TX_CLKSRC_RX 2
-/* #define ASI_CTL_TX_CLKSRC_EXT_PAL 3 */
-
-/* Transmitter mode settings */
-#define ASI_CTL_TX_MODE_188 0
-#define ASI_CTL_TX_MODE_204 1
-#define ASI_CTL_TX_MODE_MAKE204 2
-
-/* Receiver mode settings */
-#define ASI_CTL_RX_MODE_RAW 0
-#define ASI_CTL_RX_MODE_188 1
-#define ASI_CTL_RX_MODE_204 2
-#define ASI_CTL_RX_MODE_AUTO 3
-#define ASI_CTL_RX_MODE_AUTOMAKE188 4
-#define ASI_CTL_RX_MODE_204MAKE188 5
-
-/* Timestamping settings */
-#define ASI_CTL_TSTAMP_NONE 0
-#define ASI_CTL_TSTAMP_APPEND 1
-#define ASI_CTL_TSTAMP_PREPEND 2
-
-/* Transport settings */
-#define ASI_CTL_TRANSPORT_DVB_ASI 0
-#define ASI_CTL_TRANSPORT_SMPTE_310M 1
-
-#endif
-
diff --git a/sys/linsys/include/master.h b/sys/linsys/include/master.h
deleted file mode 100644
index 1d005c668..000000000
--- a/sys/linsys/include/master.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* master.h
- *
- * Global definitions for Linear Systems Ltd.
- * digital television-related boards.
- *
- * Copyright (C) 2004-2009 Linear Systems Ltd.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of Linear Systems Ltd. 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 LINEAR SYSTEMS LTD. "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 LINEAR SYSTEMS LTD. 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.
- *
- * Linear Systems can be contacted at <http://www.linsys.ca/>.
- *
- */
-
-#ifndef _MASTER_H
-#define _MASTER_H
-
-#define MASTER_DRIVER_VERSION "2.7.0"
-#define MASTER_DRIVER_VERSION_CODE 0x020700
-#define MASTER_DRIVER_DATE "2010-01-11"
-
-#define MASTER_PCI_VENDOR_ID_LINSYS 0x1254
-
-/* Device capabilities */
-#define MASTER_CAP_BYPASS 0x00000001
-#define MASTER_CAP_WATCHDOG 0x00000002
-#define MASTER_CAP_GPI 0x00000004
-#define MASTER_CAP_GPO 0x00000008
-#define MASTER_CAP_UID 0x00000010
-#define MASTER_CAP_BLACKBURST 0x00000020
-
-/* Bypass mode settings */
-#define MASTER_CTL_BYPASS_ENABLE 0
-#define MASTER_CTL_BYPASS_DISABLE 1
-#define MASTER_CTL_BYPASS_WATCHDOG 2
-
-/* Black burst type settings */
-#define MASTER_CTL_BLACKBURST_NTSC 0
-#define MASTER_CTL_BLACKBURST_PAL 1
-
-/* Maximum watchdog timeout in milliseconds.
- * Limited to 32 bits at 40 MHz or 27 MHz */
-#define MASTER_WATCHDOG_MAX 100000
-
-#endif
-
diff --git a/sys/linsys/include/sdi.h b/sys/linsys/include/sdi.h
deleted file mode 100644
index 659c41847..000000000
--- a/sys/linsys/include/sdi.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* sdi.h
- *
- * Shared header file for the Linux user-space API for
- * Linear Systems Ltd. SMPTE 259M-C interface boards.
- *
- * Copyright (C) 2004-2009 Linear Systems Ltd.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of Linear Systems Ltd. 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 LINEAR SYSTEMS LTD. "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 LINEAR SYSTEMS LTD. 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.
- *
- * Linear Systems can be contacted at <http://www.linsys.ca/>.
- *
- */
-
-#ifndef _SDI_H
-#define _SDI_H
-
-/* Driver info */
-#define SDI_DRIVER_NAME "sdi"
-
-#define SDI_MAJOR 121 /* Set to 0 for dynamic allocation.
- * Otherwise, 121 is available.
- * See /usr/src/linux/Documentation/devices.txt */
-
-#define SDI_TX_BUFFERS_MIN 2 /* This must be at least 2 */
-/* The minimum transmit buffer size must be positive, divisible by 4,
- * and large enough that the buffers aren't transferred to the onboard FIFOs
- * too quickly for the machine to handle the interrupts.
- * This is especially a problem at startup, when the FIFOs are empty.
- * Relevant factors include onboard FIFO size, PCI bus throughput,
- * processor speed, and interrupt latency. */
-#define SDI_TX_BUFSIZE_MIN 1024
-#define SDI_RX_BUFFERS_MIN 2 /* This must be at least 2 */
-#define SDI_RX_BUFSIZE_MIN 8 /* This must be positive and divisible by 4 */
-
-#define SDI_TX_BUFFERS 25 /* This must be at least 2 */
-#define SDI_TX_BUFSIZE 1235520 /* This must be positive and divisible by 4 */
-#define SDI_RX_BUFFERS 25 /* This must be at least 2 */
-#define SDI_RX_BUFSIZE 1235520 /* This must be positive and divisible by 4 */
-
-/* Ioctl () definitions */
-#define SDI_IOC_MAGIC '=' /* This ioctl magic number is currently free. See
- * /usr/src/linux/Documentation/ioctl-number.txt */
-
-#define SDI_IOC_TXGETCAP _IOR(SDI_IOC_MAGIC, 1, unsigned int)
-#define SDI_IOC_TXGETEVENTS _IOR(SDI_IOC_MAGIC, 2, unsigned int)
-#define SDI_IOC_TXGETBUFLEVEL _IOR(SDI_IOC_MAGIC, 3, unsigned int)
-#define SDI_IOC_TXGETTXD _IOR(SDI_IOC_MAGIC, 4, int)
-
-#define SDI_IOC_RXGETCAP _IOR(SDI_IOC_MAGIC, 65, unsigned int)
-#define SDI_IOC_RXGETEVENTS _IOR(SDI_IOC_MAGIC, 66, unsigned int)
-#define SDI_IOC_RXGETBUFLEVEL _IOR(SDI_IOC_MAGIC, 67, unsigned int)
-#define SDI_IOC_RXGETCARRIER _IOR(SDI_IOC_MAGIC, 68, int)
-#define SDI_IOC_RXGETSTATUS _IOR(SDI_IOC_MAGIC, 69, int)
-
-#define SDI_IOC_GETID _IOR(SDI_IOC_MAGIC, 129, unsigned int)
-#define SDI_IOC_GETVERSION _IOR(SDI_IOC_MAGIC, 130, unsigned int)
-#define SDI_IOC_QBUF_DEPRECATED _IOR(SDI_IOC_MAGIC, 131, unsigned int)
-#define SDI_IOC_QBUF _IOW(SDI_IOC_MAGIC, 131, unsigned int)
-#define SDI_IOC_DQBUF_DEPRECATED _IOR(SDI_IOC_MAGIC, 132, unsigned int)
-#define SDI_IOC_DQBUF _IOW(SDI_IOC_MAGIC, 132, unsigned int)
-
-/* Transmitter event flag bit locations */
-#define SDI_EVENT_TX_BUFFER_ORDER 0
-#define SDI_EVENT_TX_BUFFER (1 << SDI_EVENT_TX_BUFFER_ORDER)
-#define SDI_EVENT_TX_FIFO_ORDER 1
-#define SDI_EVENT_TX_FIFO (1 << SDI_EVENT_TX_FIFO_ORDER)
-#define SDI_EVENT_TX_DATA_ORDER 2
-#define SDI_EVENT_TX_DATA (1 << SDI_EVENT_TX_DATA_ORDER)
-
-/* Receiver event flag bit locations */
-#define SDI_EVENT_RX_BUFFER_ORDER 0
-#define SDI_EVENT_RX_BUFFER (1 << SDI_EVENT_RX_BUFFER_ORDER)
-#define SDI_EVENT_RX_FIFO_ORDER 1
-#define SDI_EVENT_RX_FIFO (1 << SDI_EVENT_RX_FIFO_ORDER)
-#define SDI_EVENT_RX_CARRIER_ORDER 2
-#define SDI_EVENT_RX_CARRIER (1 << SDI_EVENT_RX_CARRIER_ORDER)
-
-/* Interface capabilities */
-#define SDI_CAP_TX_RXCLKSRC 0x00000001
-
-/* Transmitter clock source settings */
-#define SDI_CTL_TX_CLKSRC_ONBOARD 0
-#define SDI_CTL_TX_CLKSRC_EXT 1
-#define SDI_CTL_TX_CLKSRC_RX 2
-
-/* Mode settings */
-#define SDI_CTL_MODE_8BIT 0
-#define SDI_CTL_MODE_10BIT 1
-
-#endif
-
diff --git a/sys/linsys/include/sdiaudio.h b/sys/linsys/include/sdiaudio.h
deleted file mode 100644
index 1df6f86eb..000000000
--- a/sys/linsys/include/sdiaudio.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/* sdiaudio.h
- *
- * Shared header file for the Linux user-space API for
- * Linear Systems Ltd. SMPTE 292M and SMPTE 259M-C Audio interface boards.
- *
- * Copyright (C) 2009 Linear Systems Ltd.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of Linear Systems Ltd. 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 LINEAR SYSTEMS LTD. "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 LINEAR SYSTEMS LTD. 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.
- *
- * Linear Systems can be contacted at <http://www.linsys.ca/>.
- *
- */
-
-#ifndef _SDIAUDIO_H
-#define _SDIAUDIO_H
-
-/* Driver info */
-#define SDIAUDIO_DRIVER_NAME "sdiaudio"
-
-#define SDIAUDIO_MAJOR 0 /* Set to 0 for dynamic allocation.
- * See /usr/src/linux/Documentation/devices.txt */
-
-#define SDIAUDIO_TX_BUFFERS_MIN 2 /* This must be at least 2 */
-/* The minimum transmit buffer size must be positive, divisible by 4,
- * and large enough that the buffers aren't transferred to the onboard FIFOs
- * too quickly for the machine to handle the interrupts.
- * This is especially a problem at startup, when the FIFOs are empty.
- * Relevant factors include onboard FIFO size, PCI bus throughput,
- * processor speed, and interrupt latency. */
-#define SDIAUDIO_TX_BUFSIZE_MIN 1024
-#define SDIAUDIO_RX_BUFFERS_MIN 2 /* This must be at least 2 */
-#define SDIAUDIO_RX_BUFSIZE_MIN 8 /* This must be positive and divisible by 4 */
-
-#define SDIAUDIO_TX_BUFFERS 30 /* This must be at least 2 */
-#define SDIAUDIO_TX_BUFSIZE 6400 /* This must be positive and divisible by 4 */
-#define SDIAUDIO_RX_BUFFERS 30 /* This must be at least 2 */
-#define SDIAUDIO_RX_BUFSIZE 6400 /* This must be positive and divisible by 4 */
-
-/* Ioctl () definitions */
-#define SDIAUDIO_IOC_MAGIC '~' /* This ioctl magic number is currently free. See
- * /usr/src/linux/Documentation/ioctl-number.txt */
-
-#define SDIAUDIO_IOC_TXGETCAP _IOR(SDIAUDIO_IOC_MAGIC, 1, unsigned int)
-#define SDIAUDIO_IOC_TXGETEVENTS _IOR(SDIAUDIO_IOC_MAGIC, 2, unsigned int)
-#define SDIAUDIO_IOC_TXGETBUFLEVEL _IOR(SDIAUDIO_IOC_MAGIC, 3, unsigned int)
-#define SDIAUDIO_IOC_TXGETTXD _IOR(SDIAUDIO_IOC_MAGIC, 4, int)
-
-#define SDIAUDIO_IOC_RXGETCAP _IOR(SDIAUDIO_IOC_MAGIC, 65, unsigned int)
-#define SDIAUDIO_IOC_RXGETEVENTS _IOR(SDIAUDIO_IOC_MAGIC, 66, unsigned int)
-#define SDIAUDIO_IOC_RXGETBUFLEVEL _IOR(SDIAUDIO_IOC_MAGIC, 67, unsigned int)
-#define SDIAUDIO_IOC_RXGETCARRIER _IOR(SDIAUDIO_IOC_MAGIC, 68, int)
-#define SDIAUDIO_IOC_RXGETSTATUS _IOR(SDIAUDIO_IOC_MAGIC, 69, int)
-#define SDIAUDIO_IOC_RXGETAUDIOGR0ERROR _IOR(SDIAUDIO_IOC_MAGIC, 70, unsigned int)
-#define SDIAUDIO_IOC_RXGETAUDIOGR0DELAYA _IOR(SDIAUDIO_IOC_MAGIC, 71, unsigned int)
-#define SDIAUDIO_IOC_RXGETAUDIOGR0DELAYB _IOR(SDIAUDIO_IOC_MAGIC, 72, unsigned int)
-#define SDIAUDIO_IOC_RXGETNONAUDIO _IOR(SDIAUDIO_IOC_MAGIC, 73, unsigned int)
-#define SDIAUDIO_IOC_RXGETAUDSTAT _IOR(SDIAUDIO_IOC_MAGIC, 74, unsigned int)
-#define SDIAUDIO_IOC_RXGETAUDRATE _IOR(SDIAUDIO_IOC_MAGIC, 75, unsigned int)
-
-#define SDIAUDIO_IOC_GETID _IOR(SDIAUDIO_IOC_MAGIC, 129, unsigned int)
-#define SDIAUDIO_IOC_GETVERSION _IOR(SDIAUDIO_IOC_MAGIC, 130, unsigned int)
-#define SDIAUDIO_IOC_QBUF _IOW(SDIAUDIO_IOC_MAGIC, 131, unsigned int)
-#define SDIAUDIO_IOC_DQBUF _IOW(SDIAUDIO_IOC_MAGIC, 132, unsigned int)
-
-/* Transmitter event flag bit locations */
-#define SDIAUDIO_EVENT_TX_BUFFER_ORDER 0
-#define SDIAUDIO_EVENT_TX_BUFFER (1 << SDIAUDIO_EVENT_TX_BUFFER_ORDER)
-#define SDIAUDIO_EVENT_TX_FIFO_ORDER 1
-#define SDIAUDIO_EVENT_TX_FIFO (1 << SDIAUDIO_EVENT_TX_FIFO_ORDER)
-#define SDIAUDIO_EVENT_TX_DATA_ORDER 2
-#define SDIAUDIO_EVENT_TX_DATA (1 << SDIAUDIO_EVENT_TX_DATA_ORDER)
-
-/* Receiver event flag bit locations */
-#define SDIAUDIO_EVENT_RX_BUFFER_ORDER 0
-#define SDIAUDIO_EVENT_RX_BUFFER (1 << SDIAUDIO_EVENT_RX_BUFFER_ORDER)
-#define SDIAUDIO_EVENT_RX_FIFO_ORDER 1
-#define SDIAUDIO_EVENT_RX_FIFO (1 << SDIAUDIO_EVENT_RX_FIFO_ORDER)
-#define SDIAUDIO_EVENT_RX_CARRIER_ORDER 2
-#define SDIAUDIO_EVENT_RX_CARRIER (1 << SDIAUDIO_EVENT_RX_CARRIER_ORDER)
-#define SDIAUDIO_EVENT_RX_DATA_ORDER 3
-#define SDIAUDIO_EVENT_RX_DATA (1 << SDIAUDIO_EVENT_RX_DATA_ORDER)
-
-/* Interface capabilities */
-#define SDIAUDIO_CAP_RX_CD 0x00000001
-#define SDIAUDIO_CAP_RX_DATA 0x00000002
-#define SDIAUDIO_CAP_RX_STATS 0x00000004
-#define SDIAUDIO_CAP_RX_NONAUDIO 0x00000008
-#define SDIAUDIO_CAP_RX_24BIT 0x00000010
-
-/* Audio sample size */
-#define SDIAUDIO_CTL_AUDSAMP_SZ_16 16 /* 16 bit */
-#define SDIAUDIO_CTL_AUDSAMP_SZ_24 24 /* 24 bit */
-#define SDIAUDIO_CTL_AUDSAMP_SZ_32 32 /* 32 bit */
-
-/* Audio channel enable */
-#define SDIAUDIO_CTL_AUDCH_EN_0 0 /* 0 channel/disable audio */
-#define SDIAUDIO_CTL_AUDCH_EN_2 2 /* 2 channel */
-#define SDIAUDIO_CTL_AUDCH_EN_4 4 /* 4 channel */
-#define SDIAUDIO_CTL_AUDCH_EN_6 6 /* 6 channel */
-#define SDIAUDIO_CTL_AUDCH_EN_8 8 /* 8 channel */
-
-#define SDIAUDIO_CTL_PCM_ALLCHANNEL 0x00000000 /* PCM for channel 1 - 8 */
-#define SDIAUDIO_CTL_NONAUDIO_ALLCHANNEL 0x000000ff /* No audio for channel 1 - 8 */
-
-/* Active audio channels status */
-#define SDIAUDIO_CTL_ACT_CHAN_0 0x00 /* no audio control packets */
-#define SDIAUDIO_CTL_ACT_CHAN_2 0x03 /* 2 channels */
-#define SDIAUDIO_CTL_ACT_CHAN_4 0x0f /* 4 channels */
-#define SDIAUDIO_CTL_ACT_CHAN_6 0x3f /* 6 channels */
-#define SDIAUDIO_CTL_ACT_CHAN_8 0xff /* 8 channels */
-
-/* Audio rate */
-#define SDIAUDIO_CTL_SYNC_48_KHZ 0 /* Synchronous, 48 kHz */
-#define SDIAUDIO_CTL_SYNC_44_1_KHZ 2 /* Synchronous, 44.1 kHz */
-#define SDIAUDIO_CTL_SYNC_32_KHZ 4 /* Synchronous, 32 kHz */
-#define SDIAUDIO_CTL_SYNC_96_KHZ 8 /* Synchronous, 96 kHz */
-#define SDIAUDIO_CTL_SYNC_FREE_RUNNING 14 /* Synchronous, free running */
-#define SDIAUDIO_CTL_ASYNC_48_KHZ 1 /* Asynchronous, 48 kHz */
-#define SDIAUDIO_CTL_ASYNC_44_1_KHZ 3 /* Asynchronous, 44.1 kHz */
-#define SDIAUDIO_CTL_ASYNC_32_KHZ 5 /* Asynchronous, 32 kHz */
-#define SDIAUDIO_CTL_ASYNC_96_KHZ 9 /* Asynchronous, 96 kHz */
-#define SDIAUDIO_CTL_ASYNC_FREE_RUNNING 15 /* Asynchronous, free running */
-
-#endif
-
diff --git a/sys/linsys/include/sdivideo.h b/sys/linsys/include/sdivideo.h
deleted file mode 100644
index e894f6b99..000000000
--- a/sys/linsys/include/sdivideo.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/* sdivideo.h
- *
- * Shared header file for the Linux user-space API for
- * Linear Systems Ltd. SMPTE 292M and SMPTE 259M-C interface boards.
- *
- * Copyright (C) 2009-2010 Linear Systems Ltd.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of Linear Systems Ltd. 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 LINEAR SYSTEMS LTD. "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 LINEAR SYSTEMS LTD. 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.
- *
- * Linear Systems can be contacted at <http://www.linsys.ca/>.
- *
- */
-
-#ifndef _SDIVIDEO_H
-#define _SDIVIDEO_H
-
-/* Driver info */
-#define SDIVIDEO_DRIVER_NAME "sdivideo"
-
-#define SDIVIDEO_MAJOR 0 /* Set to 0 for dynamic allocation.
- * See /usr/src/linux/Documentation/devices.txt */
-
-#define SDIVIDEO_TX_BUFFERS_MIN 2 /* This must be at least 2 */
-/* The minimum transmit buffer size must be positive, divisible by 4,
- * and large enough that the buffers aren't transferred to the onboard FIFOs
- * too quickly for the machine to handle the interrupts.
- * This is especially a problem at startup, when the FIFOs are empty.
- * Relevant factors include onboard FIFO size, PCI bus throughput,
- * processor speed, and interrupt latency. */
-#define SDIVIDEO_TX_BUFSIZE_MIN 1024
-#define SDIVIDEO_RX_BUFFERS_MIN 2 /* This must be at least 2 */
-#define SDIVIDEO_RX_BUFSIZE_MIN 8 /* This must be positive and divisible by 4 */
-
-#define SDIVIDEO_TX_BUFFERS 30 /* This must be at least 2 */
-#define SDIVIDEO_TX_BUFSIZE 1843200 /* This must be positive and divisible by 4 */
-#define SDIVIDEO_RX_BUFFERS 30 /* This must be at least 2 */
-#define SDIVIDEO_RX_BUFSIZE 1843200 /* This must be positive and divisible by 4 */
-
-/* Ioctl () definitions */
-#define SDIVIDEO_IOC_MAGIC '=' /* This ioctl magic number is currently free. See
- * /usr/src/linux/Documentation/ioctl-number.txt */
-
-#define SDIVIDEO_IOC_TXGETCAP _IOR(SDIVIDEO_IOC_MAGIC, 1, unsigned int)
-#define SDIVIDEO_IOC_TXGETEVENTS _IOR(SDIVIDEO_IOC_MAGIC, 2, unsigned int)
-#define SDIVIDEO_IOC_TXGETBUFLEVEL _IOR(SDIVIDEO_IOC_MAGIC, 3, unsigned int)
-#define SDIVIDEO_IOC_TXGETTXD _IOR(SDIVIDEO_IOC_MAGIC, 4, int)
-
-#define SDIVIDEO_IOC_RXGETCAP _IOR(SDIVIDEO_IOC_MAGIC, 65, unsigned int)
-#define SDIVIDEO_IOC_RXGETEVENTS _IOR(SDIVIDEO_IOC_MAGIC, 66, unsigned int)
-#define SDIVIDEO_IOC_RXGETBUFLEVEL _IOR(SDIVIDEO_IOC_MAGIC, 67, unsigned int)
-#define SDIVIDEO_IOC_RXGETCARRIER _IOR(SDIVIDEO_IOC_MAGIC, 68, int)
-#define SDIVIDEO_IOC_RXGETSTATUS _IOR(SDIVIDEO_IOC_MAGIC, 69, int)
-#define SDIVIDEO_IOC_RXGETYCRCERROR _IOR(SDIVIDEO_IOC_MAGIC, 70, unsigned int)
-#define SDIVIDEO_IOC_RXGETCCRCERROR _IOR(SDIVIDEO_IOC_MAGIC, 71, unsigned int)
-#define SDIVIDEO_IOC_RXGETVIDSTATUS _IOR(SDIVIDEO_IOC_MAGIC, 72, unsigned int)
-
-#define SDIVIDEO_IOC_GETID _IOR(SDIVIDEO_IOC_MAGIC, 129, unsigned int)
-#define SDIVIDEO_IOC_GETVERSION _IOR(SDIVIDEO_IOC_MAGIC, 130, unsigned int)
-#define SDIVIDEO_IOC_QBUF _IOW(SDIVIDEO_IOC_MAGIC, 131, unsigned int)
-#define SDIVIDEO_IOC_DQBUF _IOW(SDIVIDEO_IOC_MAGIC, 132, unsigned int)
-
-/* Transmitter event flag bit locations */
-#define SDIVIDEO_EVENT_TX_BUFFER_ORDER 0
-#define SDIVIDEO_EVENT_TX_BUFFER (1 << SDIVIDEO_EVENT_TX_BUFFER_ORDER)
-#define SDIVIDEO_EVENT_TX_FIFO_ORDER 1
-#define SDIVIDEO_EVENT_TX_FIFO (1 << SDIVIDEO_EVENT_TX_FIFO_ORDER)
-#define SDIVIDEO_EVENT_TX_DATA_ORDER 2
-#define SDIVIDEO_EVENT_TX_DATA (1 << SDIVIDEO_EVENT_TX_DATA_ORDER)
-
-/* Receiver event flag bit locations */
-#define SDIVIDEO_EVENT_RX_BUFFER_ORDER 0
-#define SDIVIDEO_EVENT_RX_BUFFER (1 << SDIVIDEO_EVENT_RX_BUFFER_ORDER)
-#define SDIVIDEO_EVENT_RX_FIFO_ORDER 1
-#define SDIVIDEO_EVENT_RX_FIFO (1 << SDIVIDEO_EVENT_RX_FIFO_ORDER)
-#define SDIVIDEO_EVENT_RX_CARRIER_ORDER 2
-#define SDIVIDEO_EVENT_RX_CARRIER (1 << SDIVIDEO_EVENT_RX_CARRIER_ORDER)
-#define SDIVIDEO_EVENT_RX_DATA_ORDER 3
-#define SDIVIDEO_EVENT_RX_DATA (1 << SDIVIDEO_EVENT_RX_DATA_ORDER)
-
-/* Interface capabilities */
-#define SDIVIDEO_CAP_RX_CD 0x00000001
-#define SDIVIDEO_CAP_RX_DATA 0x00000002
-#define SDIVIDEO_CAP_RX_ERR_COUNT 0x00000004
-#define SDIVIDEO_CAP_RX_VBI 0x00000008
-#define SDIVIDEO_CAP_RX_RAWMODE 0x00000010
-#define SDIVIDEO_CAP_RX_DEINTERLACING 0x00000020
-
-/* Transmitter clock source settings */
-#define SDIVIDEO_CTL_TX_CLKSRC_ONBOARD 0
-#define SDIVIDEO_CTL_TX_CLKSRC_NTSC 1
-#define SDIVIDEO_CTL_TX_CLKSRC_PAL 2
-
-/* Mode settings */
-#define SDIVIDEO_CTL_MODE_UYVY 0
-#define SDIVIDEO_CTL_MODE_V210 1
-#define SDIVIDEO_CTL_MODE_V210_DEINTERLACE 2
-#define SDIVIDEO_CTL_MODE_RAW 3
-
-/* Frame mode settings */
-#define SDIVIDEO_CTL_UNLOCKED 0
-#define SDIVIDEO_CTL_SMPTE_125M_486I_29_97HZ 1
-#define SDIVIDEO_CTL_BT_601_576I_25HZ 2
-#define SDIVIDEO_CTL_SMPTE_267M_486I_29_97HZ 3
-
-#define SDIVIDEO_CTL_SMPTE_260M_1035I_30HZ 5
-#define SDIVIDEO_CTL_SMPTE_260M_1035I_29_97HZ 6
-#define SDIVIDEO_CTL_SMPTE_295M_1080I_25HZ 7
-#define SDIVIDEO_CTL_SMPTE_274M_1080I_30HZ 8
-#define SDIVIDEO_CTL_SMPTE_274M_1080PSF_30HZ 9
-#define SDIVIDEO_CTL_SMPTE_274M_1080I_29_97HZ 10
-#define SDIVIDEO_CTL_SMPTE_274M_1080PSF_29_97HZ 11
-#define SDIVIDEO_CTL_SMPTE_274M_1080I_25HZ 12
-#define SDIVIDEO_CTL_SMPTE_274M_1080PSF_25HZ 13
-#define SDIVIDEO_CTL_SMPTE_274M_1080PSF_24HZ 14
-#define SDIVIDEO_CTL_SMPTE_274M_1080PSF_23_98HZ 15
-#define SDIVIDEO_CTL_SMPTE_274M_1080P_30HZ 16
-#define SDIVIDEO_CTL_SMPTE_274M_1080P_29_97HZ 17
-#define SDIVIDEO_CTL_SMPTE_274M_1080P_25HZ 18
-#define SDIVIDEO_CTL_SMPTE_274M_1080P_24HZ 19
-#define SDIVIDEO_CTL_SMPTE_274M_1080P_23_98HZ 20
-#define SDIVIDEO_CTL_SMPTE_296M_720P_60HZ 21
-#define SDIVIDEO_CTL_SMPTE_296M_720P_59_94HZ 22
-#define SDIVIDEO_CTL_SMPTE_296M_720P_50HZ 23
-#define SDIVIDEO_CTL_SMPTE_296M_720P_30HZ 24
-#define SDIVIDEO_CTL_SMPTE_296M_720P_29_97HZ 25
-#define SDIVIDEO_CTL_SMPTE_296M_720P_25HZ 26
-#define SDIVIDEO_CTL_SMPTE_296M_720P_24HZ 27
-#define SDIVIDEO_CTL_SMPTE_296M_720P_23_98HZ 28
-
-#endif
-
diff --git a/sys/meson.build b/sys/meson.build
index d60ad358b..a61b4d174 100644
--- a/sys/meson.build
+++ b/sys/meson.build
@@ -3,9 +3,7 @@
#subdir('acmmp3dec')
#subdir('androidmedia')
#subdir('applemedia')
-#subdir('avc')
subdir('bluez')
-#subdir('cdrom')
subdir('d3dvideosink')
#subdir('decklink')
subdir('directsound')
@@ -13,20 +11,15 @@ subdir('directsound')
#subdir('dshowsrcwrapper')
#subdir('dshowvideosink')
subdir('dvb')
-#subdir('dxr3')
subdir('fbdev')
subdir('kms')
-#subdir('linsys')
subdir('msdk')
#subdir('nvenc')
#subdir('opensles')
-#subdir('pvr2d')
-#subdir('qcam')
#subdir('shm')
#subdir('uvch264')
#subdir('vcd')
#subdir('vdpau')
subdir('wasapi')
-#subdir('wininet')
subdir('winks')
subdir('winscreencap')
diff --git a/sys/pvr2d/Makefile.am b/sys/pvr2d/Makefile.am
deleted file mode 100644
index 8ed89866f..000000000
--- a/sys/pvr2d/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-plugin_LTLIBRARIES = libgstpvr.la
-
-libgstpvr_la_SOURCES = \
- gstpvr.c \
- gstpvrbufferpool.c \
- gstpvrvideosink.c
-
-libgstpvr_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(PVR_CFLAGS)
-
-libgstpvr_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) \
- $(GST_PLUGINS_BASE_LIBS) $(X11_LIBS) -lgstvideo-$(GST_API_VERSION) \
- -lgstinterfaces-$(GST_API_VERSION) -lpvr2d -lpvrPVR2D_DRIWSEGL\
- $(PVR_LIBS) \
- $(LIBM)
-
-libgstpvr_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstpvr_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-noinst_HEADERS = \
- gstpvr.h \
- gstpvrbufferpool.h \
- gstpvrvideosink.h
diff --git a/sys/pvr2d/gstpvr.c b/sys/pvr2d/gstpvr.c
deleted file mode 100644
index 1f86abc89..000000000
--- a/sys/pvr2d/gstpvr.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * GStreamer
- * Copyright (c) 2010, Texas Instruments Incorporated
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "gstpvr.h"
-#include "gstpvrvideosink.h"
-
-GST_DEBUG_CATEGORY (gst_debug_pvrvideosink);
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (gst_debug_pvrvideosink, "pvrvideosink", 0,
- "pvrvideosink");
-
- return gst_element_register (plugin, "pvrvideosink", GST_RANK_PRIMARY,
- GST_TYPE_PVRVIDEOSINK);
-}
-
-void *
-gst_ducati_alloc_1d (gint sz)
-{
- MemAllocBlock block = {
- .pixelFormat = PIXEL_FMT_PAGE,
- .dim.len = sz,
- };
- return MemMgr_Alloc (&block, 1);
-}
-
-void *
-gst_ducati_alloc_2d (gint width, gint height, guint * sz)
-{
- MemAllocBlock block[] = { {
- .pixelFormat = PIXEL_FMT_8BIT,
- .dim = {.area = {
- .width = width,
- .height = ALIGN2 (height, 1),
- }},
- .stride = 4096}, {
- .pixelFormat = PIXEL_FMT_16BIT,
- .dim = {.area = {
- .width = width,
- .height = ALIGN2 (height, 1) / 2,
- }},
- .stride = 4096}
- };
- if (sz) {
- *sz = (4096 * ALIGN2 (height, 1) * 3) / 2;
- }
- return MemMgr_Alloc (block, 2);
-}
-
-static struct
-{
- PVR2DERROR code;
- const gchar *errstring;
-} pvr2derrorcodestring[] = {
- {
- PVR2D_OK, "OK (0)"}, {
- PVR2DERROR_INVALID_PARAMETER, "Invalid Parameter (-1)"}, {
- PVR2DERROR_DEVICE_UNAVAILABLE, "Device Unavailable (-2)"}, {
- PVR2DERROR_INVALID_CONTEXT, "Invalid Context (-3)"}, {
- PVR2DERROR_MEMORY_UNAVAILABLE, "Memory Unavailable (-4)"}, {
- PVR2DERROR_DEVICE_NOT_PRESENT, "Device not present (-5)"}, {
- PVR2DERROR_IOCTL_ERROR, "ioctl Error (-6)"}, {
- PVR2DERROR_GENERIC_ERROR, "Generic Error (-7)"}, {
- PVR2DERROR_BLT_NOTCOMPLETE, "blt not complete (-8)"}, {
- PVR2DERROR_HW_FEATURE_NOT_SUPPORTED, "Hardware feature not supported (-9)"}, {
- PVR2DERROR_NOT_YET_IMPLEMENTED, "Not yet implemented (-10)"}, {
- PVR2DERROR_MAPPING_FAILED, "Mapping failed (-11)"}
-};
-
-const gchar *
-gst_pvr2d_error_get_string (PVR2DERROR code)
-{
- if (code <= PVR2D_OK && code >= PVR2DERROR_MAPPING_FAILED)
- return pvr2derrorcodestring[PVR2D_OK - code].errstring;
- return "Uknown Error";
-}
-
-/* PACKAGE: this is usually set by autotools depending on some _INIT macro
- * in configure.ac and then written into and defined in config.h, but we can
- * just set it ourselves here in case someone doesn't use autotools to
- * compile this code. GST_PLUGIN_DEFINE needs PACKAGE to be defined.
- */
-#ifndef PACKAGE
-# define PACKAGE "ducati"
-#endif
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- pvr,
- "Pvr2d based plugin",
- plugin_init, VERSION, "LGPL", "GStreamer", "http://gstreamer.net/")
diff --git a/sys/pvr2d/gstpvr.h b/sys/pvr2d/gstpvr.h
deleted file mode 100644
index bbde497ae..000000000
--- a/sys/pvr2d/gstpvr.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * GStreamer
- * Copyright (c) 2010, Texas Instruments Incorporated
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __GST_DUCATI_H__
-#define __GST_DUCATI_H__
-
-#include <stdint.h>
-#include <string.h>
-
-#include <tiler.h>
-#include <tilermem.h>
-#include <memmgr.h>
-#include "pvr2d.h"
-
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-/* align x to next highest multiple of 2^n */
-#define ALIGN2(x,n) (((x) + ((1 << (n)) - 1)) & ~((1 << (n)) - 1))
-
-void * gst_ducati_alloc_1d (gint sz);
-void * gst_ducati_alloc_2d (gint width, gint height, guint * sz);
-
-const gchar * gst_pvr2d_error_get_string (PVR2DERROR code);
-
-G_END_DECLS
-
-#endif /* __GST_DUCATI_H__ */
diff --git a/sys/pvr2d/gstpvrbufferpool.c b/sys/pvr2d/gstpvrbufferpool.c
deleted file mode 100644
index 620d581a1..000000000
--- a/sys/pvr2d/gstpvrbufferpool.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * GStreamer
- * Copyright (c) 2010, Texas Instruments Incorporated
- * Copyright (c) 2011, Collabora Ltd
- * @author: Edward Hervey <edward@collabora.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstpvrbufferpool.h"
-
-/* Debugging category */
-#include <gst/gstinfo.h>
-
-/* Helper functions */
-#include <gst/video/video.h>
-#include <gst/video/gstvideometa.h>
-#include <gst/video/gstvideopool.h>
-
-
-GST_DEBUG_CATEGORY_EXTERN (gst_debug_pvrvideosink);
-#define GST_CAT_DEFAULT gst_debug_pvrvideosink
-
-static gboolean
-gst_pvr_meta_init (GstPVRMeta * meta, gpointer params, GstBuffer * buffer)
-{
- meta->src_mem = NULL;
- meta->sink = NULL;
-
- return TRUE;
-}
-
-static void
-gst_pvr_meta_free (GstPVRMeta * meta, GstBuffer * buffer)
-{
- GstPVRVideoSink *pvrsink = (GstPVRVideoSink *) meta->sink;
-
- GST_LOG ("Releasing PVRMeta for buffer %p (src_mem:%p)",
- buffer, meta->src_mem);
-
- if (meta->src_mem) {
- PVR2DERROR pvr_error;
-
- GST_OBJECT_LOCK (pvrsink);
- if (pvrsink->dcontext == NULL || pvrsink->dcontext->pvr_context == NULL) {
- GST_OBJECT_UNLOCK (pvrsink);
- goto done;
- }
- pvr_error = PVR2DMemFree (pvrsink->dcontext->pvr_context, meta->src_mem);
- GST_OBJECT_UNLOCK (pvrsink);
-
- if (pvr_error != PVR2D_OK)
- GST_ERROR ("Failed to unwrap PVR memory buffer. Error : %s",
- gst_pvr2d_error_get_string (pvr_error));
- }
-
-done:
- gst_pvrvideosink_untrack_buffer (pvrsink, buffer);
- gst_object_unref (pvrsink);
-}
-
-const GstMetaInfo *
-gst_pvr_meta_get_info (void)
-{
- static const GstMetaInfo *pvr_meta_info = NULL;
-
- if (g_once_init_enter (&pvr_meta_info)) {
- const GstMetaInfo *meta = gst_meta_register ("GstPVRMeta", "GstPVRMeta",
- sizeof (GstPVRMeta),
- (GstMetaInitFunction) gst_pvr_meta_init,
- (GstMetaFreeFunction) gst_pvr_meta_free,
- (GstMetaTransformFunction) NULL);
- g_once_init_leave (&pvr_meta_info, meta);
- }
- return pvr_meta_info;
-
-}
-
-/* Wrap existing buffers */
-GstPVRMeta *
-gst_buffer_add_pvr_meta (GstBuffer * buffer, GstElement * sink)
-{
- guint8 *data;
- gsize size;
- GstPVRMeta *meta;
- PVR2DERROR pvr_error;
- GstPVRVideoSink *pvrsink = (GstPVRVideoSink *) sink;
-
- g_return_val_if_fail (gst_buffer_n_memory (buffer) > 0, NULL);
- g_return_val_if_fail (pvrsink != NULL, NULL);
-
- GST_LOG_OBJECT (pvrsink, "Adding PVRMeta to buffer %p", buffer);
-
- /* Add the meta */
- meta = (GstPVRMeta *) gst_buffer_add_meta (buffer, GST_PVR_META_INFO, NULL);
- meta->src_mem = NULL;
- meta->sink = gst_object_ref (pvrsink);
- gst_pvrvideosink_track_buffer (pvrsink, buffer);
-
- data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
-
- GST_LOG_OBJECT (pvrsink, "data:%p, size:%" G_GSIZE_FORMAT, data, size);
-
- GST_OBJECT_LOCK (pvrsink);
- if (pvrsink->dcontext == NULL || pvrsink->dcontext->pvr_context == NULL)
- goto no_pvr_context;
- /* Map the memory and wrap it */
- pvr_error =
- PVR2DMemWrap (pvrsink->dcontext->pvr_context, data, 0, size, NULL,
- &(meta->src_mem));
- GST_OBJECT_UNLOCK (pvrsink);
-
- gst_buffer_unmap (buffer, data, size);
-
- if (pvr_error != PVR2D_OK)
- goto wrap_error;
-
- return meta;
-
-wrap_error:
- {
- GST_WARNING_OBJECT (pvrsink, "Failed to Wrap buffer memory. Error : %s",
- gst_pvr2d_error_get_string (pvr_error));
- gst_buffer_remove_meta (buffer, (GstMeta *) meta);
-
- return NULL;
- }
-
-no_pvr_context:
- {
- GST_OBJECT_UNLOCK (pvrsink);
- GST_WARNING_OBJECT (pvrsink, "No PVR2D context available");
- gst_buffer_remove_meta (buffer, (GstMeta *) meta);
- return NULL;
- }
-}
-
-/*
- * GstDucatiBufferPool
- */
-static void gst_pvr_buffer_pool_finalize (GObject * object);
-
-#define gst_pvr_buffer_pool_parent_class parent_class
-G_DEFINE_TYPE (GstPVRBufferPool, gst_pvr_buffer_pool, GST_TYPE_BUFFER_POOL);
-static const gchar **
-pvr_buffer_pool_get_options (GstBufferPool * pool)
-{
- static const gchar *options[] = { GST_BUFFER_POOL_OPTION_VIDEO_META,
- GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT, NULL
- };
-
- return options;
-}
-
-static gboolean
-pvr_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
-{
- GstPVRBufferPool *pvrpool = GST_PVR_BUFFER_POOL_CAST (pool);
- GstVideoInfo info;
- guint size, align;
- gboolean ret;
- const GstCaps *caps;
-
- if (!gst_buffer_pool_config_get (config, &caps, &size, NULL, NULL, NULL,
- &align))
- goto wrong_config;
-
- if (caps == NULL)
- goto no_caps;
-
- /* now parse the caps from the config */
- if (!gst_video_info_from_caps (&info, caps))
- goto wrong_caps;
-
- GST_LOG_OBJECT (pool, "%dx%d, size:%u, align:%u caps %" GST_PTR_FORMAT,
- info.width, info.height, size, align, caps);
-
- if (pvrpool->caps)
- gst_caps_unref (pvrpool->caps);
- pvrpool->caps = gst_caps_copy (caps);
- pvrpool->info = info;
- pvrpool->size = size;
- gst_allocation_params_init (&pvrpool->params);
- pvrpool->params.align = align;
- pvrpool->padded_width = GST_VIDEO_INFO_WIDTH (&info);
- pvrpool->padded_height = GST_VIDEO_INFO_HEIGHT (&info);
-
- /* enable metadata based on config of the pool */
- pvrpool->add_metavideo =
- gst_buffer_pool_config_has_option (config,
- GST_BUFFER_POOL_OPTION_VIDEO_META);
-
-#if 0
- /* parse extra alignment info */
- priv->need_alignment = gst_buffer_pool_config_has_option (config,
- GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT);
-
- if (priv->need_alignment) {
- gst_buffer_pool_config_get_video_alignment (config, &priv->align);
-
- GST_LOG_OBJECT (pool, "padding %u-%ux%u-%u", priv->align.padding_top,
- priv->align.padding_left, priv->align.padding_left,
- priv->align.padding_bottom);
-
- /* we need the video metadata too now */
- priv->add_metavideo = TRUE;
- }
-
- /* add the padding */
- priv->padded_width =
- GST_VIDEO_INFO_WIDTH (&info) + priv->align.padding_left +
- priv->align.padding_right;
- priv->padded_height =
- GST_VIDEO_INFO_HEIGHT (&info) + priv->align.padding_top +
- priv->align.padding_bottom;
-#endif
-
- GST_DEBUG_OBJECT (pool, "before calling parent class");
-
- ret = GST_BUFFER_POOL_CLASS (parent_class)->set_config (pool, config);
-
- GST_DEBUG_OBJECT (pool, "parent_class returned %d", ret);
-
- return ret;
-
- /* ERRORS */
-wrong_config:
- {
- GST_WARNING_OBJECT (pool, "invalid config");
- return FALSE;
- }
-no_caps:
- {
- GST_WARNING_OBJECT (pool, "no caps in config");
- return FALSE;
- }
-wrong_caps:
- {
- GST_WARNING_OBJECT (pool,
- "failed getting geometry from caps %" GST_PTR_FORMAT, caps);
- return FALSE;
- }
-}
-
-/* This function handles GstXImageBuffer creation depending on XShm availability */
-static GstFlowReturn
-pvr_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer,
- GstBufferPoolAcquireParams * params)
-{
- GstPVRBufferPool *pvrpool = GST_PVR_BUFFER_POOL_CAST (pool);
- GstVideoInfo *info;
- GstBuffer *pvr;
- GstPVRMeta *meta;
-
- info = &pvrpool->info;
-
- pvr = gst_buffer_new_allocate (NULL, pvrpool->size, &pvrpool->params);
- meta = gst_buffer_add_pvr_meta (pvr, pvrpool->pvrsink);
- if (meta == NULL) {
- gst_buffer_unref (pvr);
- goto no_buffer;
- }
-
- if (pvrpool->add_metavideo) {
- GstVideoMeta *meta;
-
- GST_DEBUG_OBJECT (pool, "adding GstVideoMeta");
- /* these are just the defaults for now */
- meta = gst_buffer_add_video_meta (pvr, GST_VIDEO_FRAME_FLAG_NONE,
- GST_VIDEO_INFO_FORMAT (info), pvrpool->padded_width,
- pvrpool->padded_height);
- if (G_UNLIKELY (meta == NULL))
- GST_WARNING_OBJECT (pool, "Failed to add GstVideoMeta");
-
-#if 0
- const GstVideoFormatInfo *vinfo = info->finfo;
- gint i;
-
- if (pvrpool->need_alignment) {
- meta->width = GST_VIDEO_INFO_WIDTH (&pvrpool->info);
- meta->height = GST_VIDEO_INFO_HEIGHT (&pvrpool->info);
-
- /* FIXME, not quite correct, NV12 would apply the vedge twice on the second
- * plane */
- for (i = 0; i < GST_VIDEO_INFO_N_COMPONENTS (info); i++) {
- gint vedge, hedge, plane;
-
- hedge =
- GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (vinfo, i,
- pvrpool->align.padding_left);
- vedge =
- GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (vinfo, i,
- pvrpool->align.padding_top);
- plane = GST_VIDEO_FORMAT_INFO_PLANE (vinfo, i);
-
- GST_LOG_OBJECT (pool, "comp %d, plane %d: hedge %d, vedge %d", i,
- plane, hedge, vedge);
-
- meta->offset[plane] += (vedge * meta->stride[plane]) + hedge;
- }
- }
-#endif
- }
-
- *buffer = pvr;
-
- return GST_FLOW_OK;
-
- /* ERROR */
-no_buffer:
- {
- GST_WARNING_OBJECT (pool, "can't create image");
- return GST_FLOW_ERROR;
- }
-}
-
-/** create new bufferpool
- */
-GstBufferPool *
-gst_pvr_buffer_pool_new (GstElement * pvrsink)
-{
- GstPVRBufferPool *pool;
-
- g_return_val_if_fail (GST_IS_PVRVIDEOSINK (pvrsink), NULL);
-
- GST_DEBUG_OBJECT (pvrsink, "Creating new GstPVRBufferPool");
-
- pool = g_object_new (GST_TYPE_PVR_BUFFER_POOL, NULL);
- pool->pvrsink = gst_object_ref (pvrsink);
-
- return GST_BUFFER_POOL_CAST (pool);
-}
-
-static void
-gst_pvr_buffer_pool_class_init (GstPVRBufferPoolClass * klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
- GstBufferPoolClass *gstbufferpool_class = (GstBufferPoolClass *) klass;
-
- gobject_class->finalize = gst_pvr_buffer_pool_finalize;
-
- gstbufferpool_class->get_options = pvr_buffer_pool_get_options;
- gstbufferpool_class->set_config = pvr_buffer_pool_set_config;
- gstbufferpool_class->alloc_buffer = pvr_buffer_pool_alloc;
-}
-
-static void
-gst_pvr_buffer_pool_init (GstPVRBufferPool * pool)
-{
-
-}
-
-static void
-gst_pvr_buffer_pool_finalize (GObject * object)
-{
- GstPVRBufferPool *pool = GST_PVR_BUFFER_POOL_CAST (object);
-
- GST_LOG_OBJECT (pool, "finalize PVR buffer pool %p", pool);
-
- if (pool->caps)
- gst_caps_unref (pool->caps);
- gst_object_unref (pool->pvrsink);
-
- G_OBJECT_CLASS (gst_pvr_buffer_pool_parent_class)->finalize (object);
-}
diff --git a/sys/pvr2d/gstpvrbufferpool.h b/sys/pvr2d/gstpvrbufferpool.h
deleted file mode 100644
index b749b7cf8..000000000
--- a/sys/pvr2d/gstpvrbufferpool.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * GStreamer
- * Copyright (c) 2010, 2011 Texas Instruments Incorporated
- * Copyright (c) 2011, Collabora Ltda
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __GSTPVRBUFFERPOOL_H__
-#define __GSTPVRBUFFERPOOL_H__
-
-#include "gstpvr.h"
-#include <pvr2d.h>
-
-G_BEGIN_DECLS
-
-typedef struct _GstPVRMeta GstPVRMeta;
-
-typedef struct _GstPVRBufferPool GstPVRBufferPool;
-typedef struct _GstPVRBufferPoolClass GstPVRBufferPoolClass;
-
-#include "gstpvrvideosink.h"
-
-const GstMetaInfo * gst_pvr_meta_get_info (void);
-#define GST_PVR_META_INFO (gst_pvr_meta_get_info())
-
-#define gst_buffer_get_pvr_meta(b) ((GstPVRMeta*)gst_buffer_get_meta((b),GST_PVR_META_INFO))
-
-struct _GstPVRMeta
-{
- GstMeta meta;
-
- PVR2DMEMINFO *src_mem; /* Memory wrapped by pvr */
- GstElement *sink; /* sink, holds a ref */
-};
-
-GstPVRMeta *
-gst_buffer_add_pvr_meta(GstBuffer *buffer, GstElement *pvrsink);
-
-#define GST_TYPE_PVR_BUFFER_POOL (gst_pvr_buffer_pool_get_type())
-#define GST_IS_PVR_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PVR_BUFFER_POOL))
-#define GST_PVR_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PVR_BUFFER_POOL, GstPVRBufferPool))
-#define GST_PVR_BUFFER_POOL_CAST(obj) ((GstPVRBufferPool*)(obj))
-
-struct _GstPVRBufferPool
-{
- GstBufferPool parent;
-
- /* output (padded) size including any codec padding: */
- gint padded_width, padded_height;
- guint size;
- GstAllocationParams params;
-
- GstElement *pvrsink;
-
- GstCaps *caps;
- GstVideoInfo info;
- gboolean add_metavideo;
-};
-
-struct _GstPVRBufferPoolClass
-{
- GstBufferPoolClass parent_class;
-};
-
-GType gst_pvr_buffer_pool_get_type (void);
-GstBufferPool *gst_pvr_buffer_pool_new (GstElement *pvrsink);
-
-G_END_DECLS
-
-#endif /* __GSTPVRBUFFERPOOL_H__ */
diff --git a/sys/pvr2d/gstpvrvideosink.c b/sys/pvr2d/gstpvrvideosink.c
deleted file mode 100644
index 4e32a8c06..000000000
--- a/sys/pvr2d/gstpvrvideosink.c
+++ /dev/null
@@ -1,1479 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2011 Collabora Ltda
- * Copyright (C) 2011 Texas Instruments
- * @author: Luciana Fujii Pontello <luciana.fujii@collabora.co.uk>
- * @author: Edward Hervey <edward@collabora.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/* Object header */
-#include "gstpvrvideosink.h"
-#include "gstpvrbufferpool.h"
-
-#include <gst/video/gstvideosink.h>
-#include <gst/video/videooverlay.h>
-/* Helper functions */
-#include <gst/video/gstvideometa.h>
-
-/* Debugging category */
-#include <gst/gstinfo.h>
-
-#define LINUX
-#include <dri2_ws.h>
-#include <services.h>
-#include <img_defs.h>
-#include <servicesext.h>
-
-#define DEFAULT_QUEUE_SIZE 12
-
-GST_DEBUG_CATEGORY_EXTERN (gst_debug_pvrvideosink);
-#define GST_CAT_DEFAULT gst_debug_pvrvideosink
-
-#define PVR2DMEMINFO_INITIALISE(d, s) \
-{ \
- (d)->hPrivateData = (IMG_VOID *)(s); \
- (d)->hPrivateMapData = (IMG_VOID *)(s->hKernelMemInfo); \
- (d)->ui32DevAddr = (IMG_UINT32) (s)->sDevVAddr.uiAddr; \
- (d)->ui32MemSize = (s)->uAllocSize; \
- (d)->pBase = (s)->pvLinAddr;\
- (d)->ulFlags = (s)->ui32Flags;\
-}
-
-/* end of internal definitions */
-
-static void gst_pvrvideosink_reset (GstPVRVideoSink * pvrvideosink);
-static void gst_pvrvideosink_xwindow_draw_borders (GstPVRVideoSink *
- pvrvideosink, GstXWindow * xwindow, GstVideoRectangle rect);
-static void gst_pvrvideosink_expose (GstVideoOverlay * overlay);
-static void gst_pvrvideosink_xwindow_destroy (GstPVRVideoSink * pvrvideosink,
- GstXWindow * xwindow);
-static void gst_pvrvideosink_dcontext_free (GstDrawContext * dcontext);
-
-static void gst_pvrvideosink_videooverlay_init (GstVideoOverlayInterface *
- iface);
-
-#define gst_pvrvideosink_parent_class parent_class
-G_DEFINE_TYPE_WITH_CODE (GstPVRVideoSink, gst_pvrvideosink, GST_TYPE_VIDEO_SINK,
- G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_OVERLAY,
- gst_pvrvideosink_videooverlay_init));
-
-
-static GstStaticPadTemplate gst_pvrvideosink_sink_template_factory =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("NV12")));
-
-enum
-{
- PROP_0,
- PROP_FORCE_ASPECT_RATIO,
- PROP_WINDOW_WIDTH,
- PROP_WINDOW_HEIGHT
-};
-
-/* ============================================================= */
-/* */
-/* Private Methods */
-/* */
-/* ============================================================= */
-
-/* pvrvideo buffers */
-
-static void
-gst_pvrvideosink_xwindow_update_geometry (GstPVRVideoSink * pvrvideosink)
-{
- XWindowAttributes attr;
- WSEGLError glerror;
- WSEGLDrawableParams source_params;
- PVRSRV_CLIENT_MEM_INFO *client_mem_info;
-
- /* Update the window geometry */
- g_mutex_lock (pvrvideosink->dcontext->x_lock);
- if (G_UNLIKELY (pvrvideosink->xwindow == NULL)) {
- g_mutex_unlock (pvrvideosink->dcontext->x_lock);
- return;
- }
- pvrvideosink->redraw_borders = TRUE;
-
- XGetWindowAttributes (pvrvideosink->dcontext->x_display,
- pvrvideosink->xwindow->window, &attr);
-
- pvrvideosink->xwindow->width = attr.width;
- pvrvideosink->xwindow->height = attr.height;
-
- if (!pvrvideosink->have_render_rect) {
- pvrvideosink->render_rect.x = pvrvideosink->render_rect.y = 0;
- pvrvideosink->render_rect.w = attr.width;
- pvrvideosink->render_rect.h = attr.height;
- }
- if (pvrvideosink->dcontext != NULL) {
- glerror =
- pvrvideosink->dcontext->wsegl_table->
- pfnWSEGL_DeleteDrawable (pvrvideosink->dcontext->drawable_handle);
- if (glerror != WSEGL_SUCCESS) {
- GST_ERROR_OBJECT (pvrvideosink, "Error destroying drawable");
- return;
- }
- glerror =
- pvrvideosink->dcontext->wsegl_table->
- pfnWSEGL_CreateWindowDrawable (pvrvideosink->dcontext->display_handle,
- pvrvideosink->dcontext->glconfig,
- &pvrvideosink->dcontext->drawable_handle,
- (NativeWindowType) pvrvideosink->xwindow->window,
- &pvrvideosink->dcontext->rotation);
- if (glerror != WSEGL_SUCCESS) {
- GST_ERROR_OBJECT (pvrvideosink, "Error creating drawable");
- return;
- }
- glerror =
- pvrvideosink->dcontext->wsegl_table->
- pfnWSEGL_GetDrawableParameters (pvrvideosink->dcontext->drawable_handle,
- &source_params, &pvrvideosink->render_params);
- if (glerror != WSEGL_SUCCESS) {
- GST_ERROR_OBJECT (pvrvideosink, "Error getting Drawable params");
- return;
- }
-
- client_mem_info =
- (PVRSRV_CLIENT_MEM_INFO *) pvrvideosink->render_params.hPrivateData;
- PVR2DMEMINFO_INITIALISE (&pvrvideosink->dcontext->dst_mem, client_mem_info);
- }
-
- g_mutex_unlock (pvrvideosink->dcontext->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. 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_pvrvideosink_handle_xevents (GstPVRVideoSink * pvrvideosink)
-{
- XEvent e;
- gboolean exposed = FALSE;
- gboolean configured = FALSE;
-
- g_mutex_lock (pvrvideosink->flow_lock);
- g_mutex_lock (pvrvideosink->dcontext->x_lock);
-
- /* Handle Expose */
- while (XCheckWindowEvent (pvrvideosink->dcontext->x_display,
- pvrvideosink->xwindow->window, ExposureMask | StructureNotifyMask,
- &e)) {
- switch (e.type) {
- case Expose:
- exposed = TRUE;
- break;
- case ConfigureNotify:
- g_mutex_unlock (pvrvideosink->dcontext->x_lock);
- gst_pvrvideosink_xwindow_update_geometry (pvrvideosink);
- g_mutex_lock (pvrvideosink->dcontext->x_lock);
- configured = TRUE;
- break;
- default:
- break;
- }
- }
-
- if (exposed || configured) {
- g_mutex_unlock (pvrvideosink->dcontext->x_lock);
- g_mutex_unlock (pvrvideosink->flow_lock);
-
- gst_pvrvideosink_expose (GST_VIDEO_OVERLAY (pvrvideosink));
-
- g_mutex_lock (pvrvideosink->flow_lock);
- g_mutex_lock (pvrvideosink->dcontext->x_lock);
- }
-
- /* Handle Display events */
- while (XPending (pvrvideosink->dcontext->x_display)) {
- XNextEvent (pvrvideosink->dcontext->x_display, &e);
-
- switch (e.type) {
- case ClientMessage:{
- Atom wm_delete;
-
- wm_delete = XInternAtom (pvrvideosink->dcontext->x_display,
- "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 (pvrvideosink, RESOURCE, NOT_FOUND,
- ("Output window was closed"), (NULL));
-
- g_mutex_unlock (pvrvideosink->dcontext->x_lock);
- gst_pvrvideosink_xwindow_destroy (pvrvideosink,
- pvrvideosink->xwindow);
- pvrvideosink->xwindow = NULL;
- g_mutex_lock (pvrvideosink->dcontext->x_lock);
- }
- break;
- }
- default:
- break;
- }
- }
-
- g_mutex_unlock (pvrvideosink->dcontext->x_lock);
- g_mutex_unlock (pvrvideosink->flow_lock);
-}
-
-static gpointer
-gst_pvrvideosink_event_thread (GstPVRVideoSink * pvrvideosink)
-{
- GST_OBJECT_LOCK (pvrvideosink);
- while (pvrvideosink->running) {
- GST_OBJECT_UNLOCK (pvrvideosink);
-
- if (pvrvideosink->xwindow) {
- gst_pvrvideosink_handle_xevents (pvrvideosink);
- }
- g_usleep (G_USEC_PER_SEC / 20);
-
- GST_OBJECT_LOCK (pvrvideosink);
- }
- GST_OBJECT_UNLOCK (pvrvideosink);
-
- return NULL;
-}
-
-static void
-gst_pvrvideosink_manage_event_thread (GstPVRVideoSink * pvrvideosink)
-{
- GThread *thread = NULL;
-
- /* don't start the thread too early */
- if (pvrvideosink->dcontext == NULL) {
- return;
- }
-
- GST_OBJECT_LOCK (pvrvideosink);
- if (!pvrvideosink->event_thread) {
- /* Setup our event listening thread */
- GST_DEBUG_OBJECT (pvrvideosink, "run xevent thread");
- pvrvideosink->running = TRUE;
- pvrvideosink->event_thread = g_thread_create (
- (GThreadFunc) gst_pvrvideosink_event_thread, pvrvideosink, TRUE, NULL);
- }
- GST_OBJECT_UNLOCK (pvrvideosink);
-
- /* Wait for our event thread to finish */
- if (thread)
- g_thread_join (thread);
-}
-
-
-static GstDrawContext *
-gst_pvrvideosink_get_dcontext (GstPVRVideoSink * pvrvideosink)
-{
- GstDrawContext *dcontext = NULL;
- PVR2DERROR pvr_error;
- gint refresh_rate;
- DRI2WSDisplay *displayImpl;
- WSEGLError glerror;
- const WSEGLCaps *glcaps;
-
- GST_DEBUG_OBJECT (pvrvideosink, "Getting draw context");
-
- dcontext = g_new0 (GstDrawContext, 1);
- dcontext->x_lock = g_mutex_new ();
-
- dcontext->p_blt_info = g_new0 (PVR2D_3DBLT_EXT, 1);
- if (!dcontext->p_blt_info)
- goto p_blt_info_alloc_failed;
-
- dcontext->p_blt2d_info = g_new0 (PVR2DBLTINFO, 1);
-
- GST_LOG_OBJECT (pvrvideosink, "Opening X Display");
- dcontext->x_display = XOpenDisplay (NULL);
-
- if (dcontext->x_display == NULL)
- goto fail_open_display;
-
- GST_LOG_OBJECT (pvrvideosink, "WSEGL_GetFunctionTablePointer()");
- dcontext->wsegl_table = WSEGL_GetFunctionTablePointer ();
-
- GST_LOG_OBJECT (pvrvideosink, "pfnWSEGL_IsDisplayValid()");
- glerror = dcontext->wsegl_table->pfnWSEGL_IsDisplayValid (
- (NativeDisplayType) dcontext->x_display);
-
- if (glerror != WSEGL_SUCCESS)
- goto display_invalid;
-
- GST_LOG_OBJECT (pvrvideosink, "pfnWSEGL_InitialiseDisplay()");
-
- glerror = dcontext->wsegl_table->pfnWSEGL_InitialiseDisplay (
- (NativeDisplayType) dcontext->x_display, &dcontext->display_handle,
- &glcaps, &dcontext->glconfig);
- if (glerror != WSEGL_SUCCESS)
- goto display_init_failed;
-
- displayImpl = (DRI2WSDisplay *) dcontext->display_handle;
- dcontext->pvr_context = displayImpl->hContext;
-
- GST_LOG_OBJECT (pvrvideosink, "PVR2DGetScreenMode()");
-
- pvr_error = PVR2DGetScreenMode (dcontext->pvr_context,
- &dcontext->display_format, &dcontext->display_width,
- &dcontext->display_height, &dcontext->stride, &refresh_rate);
- if (pvr_error != PVR2D_OK)
- goto screen_mode_failed;
-
- GST_DEBUG_OBJECT (pvrvideosink,
- "Got format:%d, width:%d, height:%d, stride:%d, refresh_rate:%d",
- dcontext->display_format, dcontext->display_width,
- dcontext->display_height, dcontext->stride, refresh_rate);
-
- dcontext->screen_num = DefaultScreen (dcontext->x_display);
- dcontext->black = XBlackPixel (dcontext->x_display, dcontext->screen_num);
-
- GST_DEBUG_OBJECT (pvrvideosink, "Returning dcontext %p", dcontext);
-
- return dcontext;
-
-p_blt_info_alloc_failed:
- {
- GST_ERROR_OBJECT (pvrvideosink, "Alloc of bltinfo failed");
- gst_pvrvideosink_dcontext_free (dcontext);
- return NULL;
- }
-
-fail_open_display:
- {
- GST_ERROR_OBJECT (pvrvideosink, "Failed to open X Display");
- gst_pvrvideosink_dcontext_free (dcontext);
- return NULL;
- }
-
-display_invalid:
- {
- GST_ERROR_OBJECT (pvrvideosink, "Display is not valid (glerror:%d)",
- glerror);
- gst_pvrvideosink_dcontext_free (dcontext);
- return NULL;
- }
-
-display_init_failed:
- {
- GST_ERROR_OBJECT (pvrvideosink, "Error initializing display (glerror:%d)",
- glerror);
- gst_pvrvideosink_dcontext_free (dcontext);
- return NULL;
- }
-
-screen_mode_failed:
- {
- GST_ERROR_OBJECT (pvrvideosink, "Failed to get screen mode. error : %s",
- gst_pvr2d_error_get_string (pvr_error));
- gst_pvrvideosink_dcontext_free (dcontext);
- return NULL;
- }
-}
-
-static void
-gst_pvrvideosink_xwindow_set_title (GstPVRVideoSink * pvrvideosink,
- GstXWindow * xwindow, const gchar * media_title)
-{
- if (media_title) {
- g_free (pvrvideosink->media_title);
- pvrvideosink->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 && pvrvideosink->media_title) {
- title = title_mem = g_strconcat (pvrvideosink->media_title, " : ",
- app_name, NULL);
- } else if (app_name) {
- title = app_name;
- } else if (pvrvideosink->media_title) {
- title = pvrvideosink->media_title;
- }
-
- if (title) {
- if ((XStringListToTextProperty (((char **) &title), 1,
- &xproperty)) != 0) {
- XSetWMName (pvrvideosink->dcontext->x_display, xwindow->window,
- &xproperty);
- XFree (xproperty.value);
- }
-
- g_free (title_mem);
- }
- }
- }
-}
-
-static GstXWindow *
-gst_pvrvideosink_create_window (GstPVRVideoSink * pvrvideosink, gint width,
- gint height)
-{
- WSEGLError glerror;
- WSEGLDrawableParams source_params;
- Window root;
- GstXWindow *xwindow;
- GstDrawContext *dcontext;
- XGCValues values;
- Atom wm_delete;
- PVRSRV_CLIENT_MEM_INFO *client_mem_info;
-
- GST_DEBUG_OBJECT (pvrvideosink, "begin");
-
- dcontext = pvrvideosink->dcontext;
- xwindow = g_new0 (GstXWindow, 1);
-
- xwindow->internal = TRUE;
- pvrvideosink->render_rect.x = pvrvideosink->render_rect.y = 0;
- pvrvideosink->render_rect.w = width;
- pvrvideosink->render_rect.h = height;
- xwindow->width = width;
- xwindow->height = height;
- xwindow->internal = TRUE;
-
- g_mutex_lock (pvrvideosink->dcontext->x_lock);
-
- root = DefaultRootWindow (dcontext->x_display);
- xwindow->window = XCreateSimpleWindow (dcontext->x_display, root, 0, 0,
- width, height, 2, 2, pvrvideosink->dcontext->black);
- XSelectInput (dcontext->x_display, xwindow->window,
- ExposureMask | StructureNotifyMask);
-
- /* Tell the window manager we'd like delete client messages instead of
- * being killed */
- wm_delete = XInternAtom (pvrvideosink->dcontext->x_display,
- "WM_DELETE_WINDOW", True);
- if (wm_delete != None) {
- (void) XSetWMProtocols (pvrvideosink->dcontext->x_display, xwindow->window,
- &wm_delete, 1);
- }
-
- XMapWindow (dcontext->x_display, xwindow->window);
-
- /* We have to do that to prevent X from redrawing the background on
- * ConfigureNotify. This takes away flickering of video when resizing. */
- XSetWindowBackgroundPixmap (pvrvideosink->dcontext->x_display,
- xwindow->window, None);
-
- gst_pvrvideosink_xwindow_set_title (pvrvideosink, xwindow, NULL);
-
- xwindow->gc = XCreateGC (pvrvideosink->dcontext->x_display,
- xwindow->window, 0, &values);
-
- g_mutex_unlock (pvrvideosink->dcontext->x_lock);
-
- glerror =
- dcontext->wsegl_table->
- pfnWSEGL_CreateWindowDrawable (dcontext->display_handle,
- dcontext->glconfig, &(dcontext->drawable_handle),
- (NativeWindowType) xwindow->window, &(dcontext->rotation));
-
- if (glerror != WSEGL_SUCCESS) {
- GST_ERROR_OBJECT (pvrvideosink, "Error creating drawable");
- return NULL;
- }
- glerror =
- dcontext->wsegl_table->
- pfnWSEGL_GetDrawableParameters (dcontext->drawable_handle, &source_params,
- &pvrvideosink->render_params);
- client_mem_info =
- (PVRSRV_CLIENT_MEM_INFO *) pvrvideosink->render_params.hPrivateData;
- PVR2DMEMINFO_INITIALISE (&dcontext->dst_mem, client_mem_info);
-
- GST_DEBUG_OBJECT (pvrvideosink, "end");
- return xwindow;
-}
-
-static void
-gst_pvrvideosink_blit (GstPVRVideoSink * pvrvideosink, GstBuffer * buffer)
-{
- PVR2DERROR pvr_error;
- GstDrawContext *dcontext = pvrvideosink->dcontext;
- gint video_width;
- gint video_height;
- gboolean draw_border = FALSE;
- PPVR2D_3DBLT_EXT p_blt_3d;
- PVR2DMEMINFO *src_mem;
- PVR2DFORMAT pvr_format;
- GstVideoRectangle result;
- GstPVRMeta *meta;
- GstVideoCropMeta *cropmeta;
-
- GST_DEBUG_OBJECT (pvrvideosink, "buffer %p", buffer);
-
- pvr_format =
- GST_VIDEO_INFO_FORMAT (&pvrvideosink->info) ==
- GST_VIDEO_FORMAT_NV12 ? PVR2D_YUV420_2PLANE : PVR2D_ARGB8888;
-
- g_mutex_lock (pvrvideosink->flow_lock);
- if (buffer == NULL)
- buffer = pvrvideosink->current_buffer;
-
- if (buffer == NULL)
- goto done;
-
- meta = gst_buffer_get_pvr_meta (buffer);
- if (G_UNLIKELY (meta == NULL))
- goto no_pvr_meta;
-
- src_mem = meta->src_mem;
- p_blt_3d = dcontext->p_blt_info;
-
- video_width = GST_VIDEO_SINK_WIDTH (pvrvideosink);
- video_height = GST_VIDEO_SINK_HEIGHT (pvrvideosink);
-
- g_mutex_lock (pvrvideosink->dcontext->x_lock);
-
- /* Draw borders when displaying the first frame. After this
- draw borders only on expose event or after a size change. */
- if (!(pvrvideosink->current_buffer) || pvrvideosink->redraw_borders) {
- draw_border = TRUE;
- }
-
- /* Store a reference to the last image we put, lose the previous one */
- if (buffer && pvrvideosink->current_buffer != buffer) {
- if (pvrvideosink->current_buffer) {
- GST_LOG_OBJECT (pvrvideosink, "unreffing %p",
- pvrvideosink->current_buffer);
- gst_buffer_unref (GST_BUFFER_CAST (pvrvideosink->current_buffer));
- }
- GST_LOG_OBJECT (pvrvideosink, "reffing %p as our current buffer", buffer);
- pvrvideosink->current_buffer = gst_buffer_ref (buffer);
- }
-
- if (pvrvideosink->keep_aspect) {
- GstVideoRectangle src = { 0, };
- GstVideoRectangle dst = { 0, };
-
- src.w = GST_VIDEO_SINK_WIDTH (pvrvideosink);
- src.h = GST_VIDEO_SINK_HEIGHT (pvrvideosink);
- dst.w = pvrvideosink->render_rect.w;
- dst.h = pvrvideosink->render_rect.h;
- gst_video_sink_center_rect (src, dst, &result, TRUE);
- result.x += pvrvideosink->render_rect.x;
- result.y += pvrvideosink->render_rect.y;
- } else {
- memcpy (&result, &pvrvideosink->render_rect, sizeof (GstVideoRectangle));
- }
-
- p_blt_3d->sDst.pSurfMemInfo = &dcontext->dst_mem;
- p_blt_3d->sDst.SurfOffset = 0;
- p_blt_3d->sDst.Stride = 4 * pvrvideosink->render_params.ui32Stride;
- p_blt_3d->sDst.Format = PVR2D_ARGB8888;
- p_blt_3d->sDst.SurfWidth = pvrvideosink->xwindow->width;
- p_blt_3d->sDst.SurfHeight = pvrvideosink->xwindow->height;
-
- p_blt_3d->rcDest.left = result.x;
- p_blt_3d->rcDest.top = result.y;
- p_blt_3d->rcDest.right = result.w + result.x;
- p_blt_3d->rcDest.bottom = result.h + result.y;
-
- p_blt_3d->sSrc.pSurfMemInfo = src_mem;
- p_blt_3d->sSrc.SurfOffset = 0;
- p_blt_3d->sSrc.Stride = GST_VIDEO_INFO_COMP_STRIDE (&pvrvideosink->info, 0);
- p_blt_3d->sSrc.Format = pvr_format;
- p_blt_3d->sSrc.SurfWidth = video_width;
- p_blt_3d->sSrc.SurfHeight = video_height;
-
- /* If buffer has crop information, use that */
- if ((cropmeta = gst_buffer_get_video_crop_meta (buffer))) {
- p_blt_3d->rcSource.left = cropmeta->x;
- p_blt_3d->rcSource.top = cropmeta->y;
- p_blt_3d->rcSource.right = cropmeta->x + cropmeta->width;
- p_blt_3d->rcSource.bottom = cropmeta->y + cropmeta->height;
- } else {
- p_blt_3d->rcSource.left = 0;
- p_blt_3d->rcSource.top = 0;
- p_blt_3d->rcSource.right = video_width;
- p_blt_3d->rcSource.bottom = video_height;
- }
-
- p_blt_3d->hUseCode = NULL;
-
- if (GST_VIDEO_INFO_FORMAT (&pvrvideosink->info) == GST_VIDEO_FORMAT_NV12)
- p_blt_3d->bDisableDestInput = TRUE;
- else
- /* blit fails for RGB without this... not sure why yet... */
- p_blt_3d->bDisableDestInput = FALSE;
-
- GST_DEBUG_OBJECT (pvrvideosink, "about to blit");
-
- pvr_error = PVR2DBlt3DExt (pvrvideosink->dcontext->pvr_context,
- dcontext->p_blt_info);
-
- if (pvr_error != PVR2D_OK) {
- GST_ERROR_OBJECT (pvrvideosink, "Failed to blit. Error : %s",
- gst_pvr2d_error_get_string (pvr_error));
- goto done;
- }
- dcontext->wsegl_table->pfnWSEGL_SwapDrawable (dcontext->drawable_handle, 1);
-
- if (draw_border) {
- gst_pvrvideosink_xwindow_draw_borders (pvrvideosink, pvrvideosink->xwindow,
- result);
- pvrvideosink->redraw_borders = FALSE;
- }
- g_mutex_unlock (pvrvideosink->dcontext->x_lock);
-
-done:
- GST_DEBUG_OBJECT (pvrvideosink, "end");
- g_mutex_unlock (pvrvideosink->flow_lock);
- return;
-
- /* Error cases */
-
-no_pvr_meta:
- {
- g_mutex_unlock (pvrvideosink->flow_lock);
- GST_ERROR_OBJECT (pvrvideosink, "Got a buffer without GstPVRMeta");
- return;
- }
-}
-
-static void
-gst_pvrvideosink_destroy_drawable (GstPVRVideoSink * pvrvideosink)
-{
- GST_DEBUG_OBJECT (pvrvideosink, "dcontext : %p", pvrvideosink->dcontext);
-
- if (pvrvideosink->dcontext != NULL) {
- if (pvrvideosink->dcontext->drawable_handle) {
- GST_DEBUG_OBJECT (pvrvideosink, "Deleting Drawable (drawable_handle:%p)",
- pvrvideosink->dcontext->drawable_handle);
- pvrvideosink->dcontext->wsegl_table->
- pfnWSEGL_DeleteDrawable (pvrvideosink->dcontext->drawable_handle);
- }
-
- GST_DEBUG_OBJECT (pvrvideosink, "Closing display (display_handle:%p)",
- pvrvideosink->dcontext->display_handle);
- pvrvideosink->dcontext->wsegl_table->
- pfnWSEGL_CloseDisplay (pvrvideosink->dcontext->display_handle);
- }
-}
-
-/* We are called with the x_lock taken */
-static void
-gst_pvrvideosink_pvrfill_rectangle (GstPVRVideoSink * pvrvideosink,
- GstVideoRectangle rect)
-{
- PVR2DERROR pvr_error;
- PPVR2DBLTINFO p_blt2d_info = 0;
- GstDrawContext *dcontext = pvrvideosink->dcontext;
-
- GST_DEBUG_OBJECT (pvrvideosink, "begin");
-
- p_blt2d_info = dcontext->p_blt2d_info;
-
- p_blt2d_info->pDstMemInfo = &dcontext->dst_mem;
- p_blt2d_info->BlitFlags = PVR2D_BLIT_DISABLE_ALL;
- p_blt2d_info->DstOffset = 0;
- p_blt2d_info->CopyCode = PVR2DROPclear;
- p_blt2d_info->DstStride = 4 * pvrvideosink->render_params.ui32Stride;
- p_blt2d_info->DstFormat = PVR2D_ARGB8888;
- p_blt2d_info->DstSurfWidth = pvrvideosink->xwindow->width;
- p_blt2d_info->DstSurfHeight = pvrvideosink->xwindow->height;
- p_blt2d_info->DstX = rect.x;
- p_blt2d_info->DstY = rect.y;
- p_blt2d_info->DSizeX = rect.w;
- p_blt2d_info->DSizeY = rect.h;
-
- pvr_error = PVR2DBlt (pvrvideosink->dcontext->pvr_context, p_blt2d_info);
-
- if (pvr_error != PVR2D_OK) {
- GST_ERROR_OBJECT (pvrvideosink, "Failed to blit. Error : %s",
- gst_pvr2d_error_get_string (pvr_error));
- goto done;
- }
- dcontext->wsegl_table->pfnWSEGL_SwapDrawable (dcontext->drawable_handle, 1);
-
-done:
- GST_DEBUG_OBJECT (pvrvideosink, "end");
-}
-
-/* We are called with the x_lock taken */
-static void
-gst_pvrvideosink_xwindow_draw_borders (GstPVRVideoSink * pvrvideosink,
- GstXWindow * xwindow, GstVideoRectangle rect)
-{
- gint t1, t2;
- GstVideoRectangle result;
-
- g_return_if_fail (GST_IS_PVRVIDEOSINK (pvrvideosink));
- g_return_if_fail (xwindow != NULL);
-
- /* Left border */
- result.x = pvrvideosink->render_rect.x;
- result.y = pvrvideosink->render_rect.y;
- result.w = rect.x - pvrvideosink->render_rect.x;
- result.h = pvrvideosink->render_rect.h;
- if (rect.x > pvrvideosink->render_rect.x)
- gst_pvrvideosink_pvrfill_rectangle (pvrvideosink, result);
-
- /* Right border */
- t1 = rect.x + rect.w;
- t2 = pvrvideosink->render_rect.x + pvrvideosink->render_rect.w;
- result.x = t1;
- result.y = pvrvideosink->render_rect.y;
- result.w = t2 - t1;
- result.h = pvrvideosink->render_rect.h;
- if (t1 < t2)
- gst_pvrvideosink_pvrfill_rectangle (pvrvideosink, result);
-
- /* Top border */
- result.x = pvrvideosink->render_rect.x;
- result.y = pvrvideosink->render_rect.y;
- result.w = pvrvideosink->render_rect.w;
- result.h = rect.y - pvrvideosink->render_rect.y;
- if (rect.y > pvrvideosink->render_rect.y)
- gst_pvrvideosink_pvrfill_rectangle (pvrvideosink, result);
-
- /* Bottom border */
- t1 = rect.y + rect.h;
- t2 = pvrvideosink->render_rect.y + pvrvideosink->render_rect.h;
- result.x = pvrvideosink->render_rect.x;
- result.y = t1;
- result.w = pvrvideosink->render_rect.w;
- result.h = t2 - t1;
- if (t1 < t2)
- gst_pvrvideosink_pvrfill_rectangle (pvrvideosink, result);
-}
-
-/* Element stuff */
-
-static gboolean
-gst_pvrvideosink_setcaps (GstBaseSink * bsink, GstCaps * caps)
-{
- GstPVRVideoSink *pvrvideosink;
- GstVideoInfo info;
- GstStructure *structure;
- GstBufferPool *oldpool, *newpool;
-
- pvrvideosink = GST_PVRVIDEOSINK (bsink);
-
- GST_DEBUG_OBJECT (pvrvideosink,
- "sinkconnect possible caps with given caps %" GST_PTR_FORMAT, caps);
-
- if (!gst_video_info_from_caps (&info, caps))
- goto invalid_format;
-
- GST_VIDEO_SINK_WIDTH (pvrvideosink) = info.width;
- GST_VIDEO_SINK_HEIGHT (pvrvideosink) = info.height;
-
- /* Notify application to set xwindow id now */
- g_mutex_lock (pvrvideosink->flow_lock);
- if (!pvrvideosink->xwindow) {
- g_mutex_unlock (pvrvideosink->flow_lock);
- gst_video_overlay_prepare_window_handle (GST_VIDEO_OVERLAY (pvrvideosink));
- } else {
- g_mutex_unlock (pvrvideosink->flow_lock);
- }
-
- g_mutex_lock (pvrvideosink->flow_lock);
- if (!pvrvideosink->xwindow)
- pvrvideosink->xwindow = gst_pvrvideosink_create_window (pvrvideosink,
- GST_VIDEO_SINK_WIDTH (pvrvideosink),
- GST_VIDEO_SINK_HEIGHT (pvrvideosink));
- g_mutex_unlock (pvrvideosink->flow_lock);
-
- pvrvideosink->info = info;
-
- /* After a resize, we want to redraw the borders in case the new frame size
- * doesn't cover the same area */
- pvrvideosink->redraw_borders = TRUE;
-
- /* create a new pool for the new configuration */
- newpool = gst_pvr_buffer_pool_new (GST_ELEMENT_CAST (pvrvideosink));
-
- /* PVR needs at least 3 buffers */
- structure = gst_buffer_pool_get_config (newpool);
- gst_buffer_pool_config_set (structure, caps, GST_VIDEO_INFO_SIZE (&info), 3,
- 0, 0, 15);
- if (!gst_buffer_pool_set_config (newpool, structure))
- goto config_failed;
-
- oldpool = pvrvideosink->pool;
- pvrvideosink->pool = newpool;
- g_mutex_unlock (pvrvideosink->flow_lock);
-
- /* unref the old sink */
- if (oldpool) {
- /* we don't deactivate, some elements might still be using it, it will
- * be deactivated when the last ref is gone */
- gst_object_unref (oldpool);
- }
-
- return TRUE;
-
-config_failed:
- {
- GST_ERROR_OBJECT (pvrvideosink, "failed to set config.");
- g_mutex_unlock (pvrvideosink->flow_lock);
- return FALSE;
- }
-
-invalid_format:
- {
- GST_DEBUG_OBJECT (pvrvideosink,
- "Could not locate image format from caps %" GST_PTR_FORMAT, caps);
- return FALSE;
- }
-}
-
-static GstCaps *
-gst_pvrvideosink_getcaps (GstBaseSink * bsink, GstCaps * filter)
-{
- GstPVRVideoSink *pvrvideosink;
- GstCaps *caps;
-
- GST_DEBUG_OBJECT (bsink, "filter:%" GST_PTR_FORMAT, filter);
-
- pvrvideosink = GST_PVRVIDEOSINK (bsink);
-
- /* FIXME : If we have curently configured caps, we should return those
- * intersected with the filter*/
-
- caps = gst_pad_get_pad_template_caps (GST_BASE_SINK (pvrvideosink)->sinkpad);
- if (filter) {
- GstCaps *intersection;
-
- intersection =
- gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
- gst_caps_unref (caps);
- caps = intersection;
- }
-
- GST_DEBUG_OBJECT (bsink, "Returning %" GST_PTR_FORMAT, caps);
-
- return caps;
-}
-
-static GstStateChangeReturn
-gst_pvrvideosink_change_state (GstElement * element, GstStateChange transition)
-{
- GstPVRVideoSink *pvrvideosink;
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
- GstDrawContext *dcontext;
-
- pvrvideosink = GST_PVRVIDEOSINK (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- if (pvrvideosink->dcontext == NULL) {
- dcontext = gst_pvrvideosink_get_dcontext (pvrvideosink);
- if (dcontext == NULL)
- return GST_STATE_CHANGE_FAILURE;
- GST_OBJECT_LOCK (pvrvideosink);
- pvrvideosink->dcontext = dcontext;
- GST_OBJECT_UNLOCK (pvrvideosink);
- }
- gst_pvrvideosink_manage_event_thread (pvrvideosink);
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- 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:
- GST_VIDEO_SINK_WIDTH (pvrvideosink) = 0;
- GST_VIDEO_SINK_HEIGHT (pvrvideosink) = 0;
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- gst_pvrvideosink_reset (pvrvideosink);
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-static void
-gst_pvrvideosink_get_times (GstBaseSink * bsink, GstBuffer * buf,
- GstClockTime * start, GstClockTime * end)
-{
- GstPVRVideoSink *pvrvideosink;
-
- pvrvideosink = GST_PVRVIDEOSINK (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 {
- gint fps_n, fps_d;
- fps_n = GST_VIDEO_INFO_FPS_N (&pvrvideosink->info);
- fps_d = GST_VIDEO_INFO_FPS_D (&pvrvideosink->info);
- if (fps_n > 0) {
- *end = *start + gst_util_uint64_scale_int (GST_SECOND, fps_d, fps_n);
- }
- }
- }
-}
-
-static GstFlowReturn
-gst_pvrvideosink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
-{
- GstPVRVideoSink *pvrvideosink = GST_PVRVIDEOSINK (vsink);
- GstPVRMeta *meta;
-
- GST_DEBUG_OBJECT (pvrvideosink, "render buffer: %p", buf);
-
- meta = gst_buffer_get_pvr_meta (buf);
-
- if (G_UNLIKELY (meta == NULL)) {
- meta = gst_buffer_add_pvr_meta (buf, GST_ELEMENT_CAST (pvrvideosink));
- if (meta == NULL)
- goto meta_failure;
- }
-
- gst_pvrvideosink_blit (pvrvideosink, buf);
-
- return GST_FLOW_OK;
-
-meta_failure:
- {
- GST_WARNING_OBJECT (pvrvideosink, "Failed to map incoming buffer");
- return GST_FLOW_ERROR;
- }
-}
-
-static gboolean
-gst_pvrvideosink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
-{
- GstPVRVideoSink *pvrvideosink = (GstPVRVideoSink *) bsink;
- GstBufferPool *pool;
- GstStructure *config;
- GstCaps *caps;
- guint size;
- gboolean need_pool;
-
- gst_query_parse_allocation (query, &caps, &need_pool);
-
- if (caps == NULL)
- goto no_caps;
-
- g_mutex_lock (pvrvideosink->flow_lock);
- if ((pool = pvrvideosink->pool))
- gst_object_ref (pool);
- g_mutex_unlock (pvrvideosink->flow_lock);
-
- if (pool != NULL) {
- const GstCaps *pcaps;
-
- /* we had a pool, check caps */
- GST_DEBUG_OBJECT (pvrvideosink, "check existing pool caps");
- config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_get (config, &pcaps, &size, NULL, NULL, NULL, NULL);
- gst_structure_free (config);
-
- if (!gst_caps_is_equal (caps, pcaps)) {
- GST_DEBUG_OBJECT (pvrvideosink, "pool has different caps");
- /* different caps, we can't use this pool */
- gst_object_unref (pool);
- pool = NULL;
- }
- }
-
- if (pool == NULL && need_pool) {
- GstVideoInfo info;
-
- GST_DEBUG_OBJECT (pvrvideosink, "create new pool");
- pool = gst_pvr_buffer_pool_new (GST_ELEMENT_CAST (pvrvideosink));
-
- if (!gst_video_info_from_caps (&info, caps))
- goto invalid_caps;
-
- /* the normal size of a frame */
- size = info.size;
-
- config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set (config, caps, size, 0, 0, 0, 0);
- if (!gst_buffer_pool_set_config (pool, config))
- goto config_failed;
- }
- /* we need at least 3 buffers */
- gst_query_set_allocation_params (query, size, 3, 0, 0, 0, pool);
-
- /* we also support various metadata */
- gst_query_add_allocation_meta (query, GST_VIDEO_CROP_META_API, NULL);
-
- gst_object_unref (pool);
-
- return TRUE;
-
- /* ERRORS */
-no_caps:
- {
- GST_DEBUG_OBJECT (bsink, "no caps specified");
- return FALSE;
- }
-invalid_caps:
- {
- GST_DEBUG_OBJECT (bsink, "invalid caps specified");
- return FALSE;
- }
-config_failed:
- {
- GST_DEBUG_OBJECT (bsink, "failed setting config");
- return FALSE;
- }
-}
-
-/* Interfaces stuff */
-
-/* This function destroys a GstXWindow */
-static void
-gst_pvrvideosink_xwindow_destroy (GstPVRVideoSink * pvrvideosink,
- GstXWindow * xwindow)
-{
- g_return_if_fail (xwindow != NULL);
-
- g_mutex_lock (pvrvideosink->dcontext->x_lock);
-
- /* If we did not create that window we just free the GC and let it live */
- if (xwindow->internal)
- XDestroyWindow (pvrvideosink->dcontext->x_display, xwindow->window);
- else
- XSelectInput (pvrvideosink->dcontext->x_display, xwindow->window, 0);
-
- XFreeGC (pvrvideosink->dcontext->x_display, xwindow->gc);
-
- XSync (pvrvideosink->dcontext->x_display, FALSE);
-
- g_mutex_unlock (pvrvideosink->dcontext->x_lock);
-
- g_free (xwindow);
-}
-
-static void
-gst_pvrvideosink_set_window_handle (GstVideoOverlay * overlay, guintptr id)
-{
- XID window_handle = id;
- GstPVRVideoSink *pvrvideosink = GST_PVRVIDEOSINK (overlay);
- GstXWindow *xwindow = NULL;
-
- g_return_if_fail (GST_IS_PVRVIDEOSINK (pvrvideosink));
-
- g_mutex_lock (pvrvideosink->flow_lock);
-
- /* If we already use that window return */
- if (pvrvideosink->xwindow && (window_handle == pvrvideosink->xwindow->window)) {
- g_mutex_unlock (pvrvideosink->flow_lock);
- return;
- }
-
- /* If the element has not initialized the X11 context try to do so */
- if (!pvrvideosink->dcontext && !(pvrvideosink->dcontext =
- gst_pvrvideosink_get_dcontext (pvrvideosink))) {
- g_mutex_unlock (pvrvideosink->flow_lock);
- /* we have thrown a GST_ELEMENT_ERROR now */
- return;
- }
-
- /* If a window is there already we destroy it */
- if (pvrvideosink->xwindow) {
- gst_pvrvideosink_xwindow_destroy (pvrvideosink, pvrvideosink->xwindow);
- pvrvideosink->xwindow = NULL;
- }
-
- /* If the xid is 0 we will create an internal one in buffer_alloc */
- if (window_handle != 0) {
- XWindowAttributes attr;
- WSEGLError glerror;
- WSEGLDrawableParams source_params;
- PVRSRV_CLIENT_MEM_INFO *client_mem_info;
-
- xwindow = g_new0 (GstXWindow, 1);
- xwindow->window = window_handle;
-
- /* Set the event we want to receive and create a GC */
- g_mutex_lock (pvrvideosink->dcontext->x_lock);
-
- XGetWindowAttributes (pvrvideosink->dcontext->x_display, xwindow->window,
- &attr);
-
- xwindow->width = attr.width;
- xwindow->height = attr.height;
- xwindow->internal = FALSE;
- if (!pvrvideosink->have_render_rect) {
- pvrvideosink->render_rect.x = pvrvideosink->render_rect.y = 0;
- pvrvideosink->render_rect.w = attr.width;
- pvrvideosink->render_rect.h = attr.height;
- }
- XSelectInput (pvrvideosink->dcontext->x_display, xwindow->window,
- ExposureMask | StructureNotifyMask);
-
- XSetWindowBackgroundPixmap (pvrvideosink->dcontext->x_display,
- xwindow->window, None);
-
- XMapWindow (pvrvideosink->dcontext->x_display, xwindow->window);
- xwindow->gc = XCreateGC (pvrvideosink->dcontext->x_display,
- xwindow->window, 0, NULL);
- g_mutex_unlock (pvrvideosink->dcontext->x_lock);
-
- glerror =
- pvrvideosink->dcontext->wsegl_table->
- pfnWSEGL_CreateWindowDrawable (pvrvideosink->dcontext->display_handle,
- pvrvideosink->dcontext->glconfig,
- &(pvrvideosink->dcontext->drawable_handle),
- (NativeWindowType) xwindow->window,
- &(pvrvideosink->dcontext->rotation));
-
- if (glerror != WSEGL_SUCCESS) {
- GST_ERROR_OBJECT (pvrvideosink, "Error creating drawable");
- return;
- }
- glerror =
- pvrvideosink->dcontext->wsegl_table->
- pfnWSEGL_GetDrawableParameters (pvrvideosink->dcontext->drawable_handle,
- &source_params, &pvrvideosink->render_params);
-
- client_mem_info =
- (PVRSRV_CLIENT_MEM_INFO *) pvrvideosink->render_params.hPrivateData;
- PVR2DMEMINFO_INITIALISE (&pvrvideosink->dcontext->dst_mem, client_mem_info);
- }
-
- if (xwindow)
- pvrvideosink->xwindow = xwindow;
-
- g_mutex_unlock (pvrvideosink->flow_lock);
-}
-
-static void
-gst_pvrvideosink_expose (GstVideoOverlay * overlay)
-{
- GstPVRVideoSink *pvrvideosink = GST_PVRVIDEOSINK (overlay);
-
- gst_pvrvideosink_blit (pvrvideosink, NULL);
-}
-
-static void
-gst_pvrvideosink_set_event_handling (GstVideoOverlay * overlay,
- gboolean handle_events)
-{
- GstPVRVideoSink *pvrvideosink = GST_PVRVIDEOSINK (overlay);
-
- g_mutex_lock (pvrvideosink->flow_lock);
-
- if (G_UNLIKELY (!pvrvideosink->xwindow)) {
- g_mutex_unlock (pvrvideosink->flow_lock);
- return;
- }
-
- g_mutex_lock (pvrvideosink->dcontext->x_lock);
-
- XSelectInput (pvrvideosink->dcontext->x_display,
- pvrvideosink->xwindow->window, ExposureMask | StructureNotifyMask);
-
- g_mutex_unlock (pvrvideosink->dcontext->x_lock);
-
- g_mutex_unlock (pvrvideosink->flow_lock);
-}
-
-static void
-gst_pvrvideosink_set_render_rectangle (GstVideoOverlay * overlay, gint x,
- gint y, gint width, gint height)
-{
- GstPVRVideoSink *pvrvideosink = GST_PVRVIDEOSINK (overlay);
-
- /* FIXME: how about some locking? */
- if (width >= 0 && height >= 0) {
- pvrvideosink->render_rect.x = x;
- pvrvideosink->render_rect.y = y;
- pvrvideosink->render_rect.w = width;
- pvrvideosink->render_rect.h = height;
- pvrvideosink->have_render_rect = TRUE;
- } else {
- pvrvideosink->render_rect.x = 0;
- pvrvideosink->render_rect.y = 0;
- pvrvideosink->render_rect.w = pvrvideosink->xwindow->width;
- pvrvideosink->render_rect.h = pvrvideosink->xwindow->height;
- pvrvideosink->have_render_rect = FALSE;
- }
-}
-
-static void
-gst_pvrvideosink_videooverlay_init (GstVideoOverlayInterface * iface)
-{
- iface->set_window_handle = gst_pvrvideosink_set_window_handle;
- iface->expose = gst_pvrvideosink_expose;
- iface->handle_events = gst_pvrvideosink_set_event_handling;
- iface->set_render_rectangle = gst_pvrvideosink_set_render_rectangle;
-}
-
-/* =========================================== */
-/* */
-/* Init & Class init */
-/* */
-/* =========================================== */
-
-static void
-gst_pvrvideosink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstPVRVideoSink *pvrvideosink;
-
- g_return_if_fail (GST_IS_PVRVIDEOSINK (object));
-
- pvrvideosink = GST_PVRVIDEOSINK (object);
-
- switch (prop_id) {
- case PROP_FORCE_ASPECT_RATIO:
- pvrvideosink->keep_aspect = g_value_get_boolean (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_pvrvideosink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstPVRVideoSink *pvrvideosink;
-
- g_return_if_fail (GST_IS_PVRVIDEOSINK (object));
-
- pvrvideosink = GST_PVRVIDEOSINK (object);
-
- switch (prop_id) {
- case PROP_FORCE_ASPECT_RATIO:
- g_value_set_boolean (value, pvrvideosink->keep_aspect);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-void
-gst_pvrvideosink_track_buffer (GstPVRVideoSink * pvrsink, GstBuffer * buffer)
-{
- GST_DEBUG_OBJECT (pvrsink, "Adding buffer %p to tracked buffers", buffer);
- pvrsink->metabuffers = g_list_prepend (pvrsink->metabuffers, buffer);
-}
-
-void
-gst_pvrvideosink_untrack_buffer (GstPVRVideoSink * pvrsink, GstBuffer * buffer)
-{
- GST_DEBUG_OBJECT (pvrsink, "Removing buffer %p from tracked buffers", buffer);
- pvrsink->metabuffers = g_list_remove_all (pvrsink->metabuffers, buffer);
-}
-
-static void
-gst_pvrvideosink_release_pvr_metas (GstPVRVideoSink * pvrsink)
-{
- GstBuffer *buf;
- GstPVRMeta *pvrmeta;
-
- GST_DEBUG_OBJECT (pvrsink, "Releasing pending PVR metas");
-
- while (pvrsink->metabuffers) {
- buf = (GstBuffer *) pvrsink->metabuffers->data;
-
- pvrmeta = gst_buffer_get_pvr_meta (buf);
- if (pvrmeta)
- gst_buffer_remove_meta (buf, (GstMeta *) pvrmeta);
- }
-
- GST_DEBUG_OBJECT (pvrsink, "Done");
-}
-
-static void
-gst_pvrvideosink_dcontext_free (GstDrawContext * dcontext)
-{
- GST_DEBUG ("Freeing dcontext %p", dcontext);
-
- g_free (dcontext->p_blt_info);
- g_free (dcontext->p_blt2d_info);
-
- if (dcontext->x_lock)
- g_mutex_lock (dcontext->x_lock);
- if (dcontext->x_display) {
- GST_LOG ("Closing display");
- XCloseDisplay (dcontext->x_display);
- }
- if (dcontext->x_lock) {
- g_mutex_unlock (dcontext->x_lock);
- g_mutex_free (dcontext->x_lock);
- }
-
- g_free (dcontext);
-}
-
-static void
-gst_pvrvideosink_dcontext_clear (GstPVRVideoSink * pvrvideosink)
-{
- GstDrawContext *dcontext;
-
- GST_DEBUG_OBJECT (pvrvideosink, "Clearing dcontext %p",
- pvrvideosink->dcontext);
-
- GST_OBJECT_LOCK (pvrvideosink);
- if (!pvrvideosink->dcontext) {
- GST_OBJECT_UNLOCK (pvrvideosink);
- return;
- }
-
- dcontext = pvrvideosink->dcontext;
- pvrvideosink->dcontext = NULL;
- GST_OBJECT_UNLOCK (pvrvideosink);
-
- gst_pvrvideosink_dcontext_free (dcontext);
-}
-
-static void
-gst_pvrvideosink_reset (GstPVRVideoSink * pvrvideosink)
-{
- GThread *thread;
-
- GST_DEBUG_OBJECT (pvrvideosink, "Resetting");
-
- GST_OBJECT_LOCK (pvrvideosink);
- pvrvideosink->running = FALSE;
- thread = pvrvideosink->event_thread;
- pvrvideosink->event_thread = NULL;
- GST_OBJECT_UNLOCK (pvrvideosink);
-
- if (thread)
- g_thread_join (thread);
-
- if (pvrvideosink->current_buffer) {
- GST_LOG_OBJECT (pvrvideosink, "Removing cached buffer");
- gst_buffer_unref (pvrvideosink->current_buffer);
- pvrvideosink->current_buffer = NULL;
- }
-
- if (pvrvideosink->pool) {
- GST_LOG_OBJECT (pvrvideosink, "Unreffing pool");
- gst_object_unref (pvrvideosink->pool);
- pvrvideosink->pool = NULL;
- }
- memset (&pvrvideosink->render_params, 0, sizeof (WSEGLDrawableParams));
-
- pvrvideosink->render_rect.x = pvrvideosink->render_rect.y = 0;
- pvrvideosink->render_rect.w = pvrvideosink->render_rect.h = 0;
- pvrvideosink->have_render_rect = FALSE;
-
- gst_pvrvideosink_release_pvr_metas (pvrvideosink);
-
- gst_pvrvideosink_destroy_drawable (pvrvideosink);
-
- if (pvrvideosink->xwindow) {
- gst_pvrvideosink_xwindow_destroy (pvrvideosink, pvrvideosink->xwindow);
- pvrvideosink->xwindow = NULL;
- }
-
- gst_pvrvideosink_dcontext_clear (pvrvideosink);
-}
-
-static void
-gst_pvrvideosink_finalize (GObject * object)
-{
- GstPVRVideoSink *pvrvideosink;
-
- pvrvideosink = GST_PVRVIDEOSINK (object);
-
- gst_pvrvideosink_reset (pvrvideosink);
-
- if (pvrvideosink->flow_lock) {
- g_mutex_free (pvrvideosink->flow_lock);
- pvrvideosink->flow_lock = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_pvrvideosink_init (GstPVRVideoSink * pvrvideosink)
-{
- pvrvideosink->running = FALSE;
-
- pvrvideosink->flow_lock = g_mutex_new ();
- pvrvideosink->pool = NULL;
-
- pvrvideosink->keep_aspect = FALSE;
- pvrvideosink->current_caps = NULL;
- pvrvideosink->dcontext = NULL;
- pvrvideosink->xwindow = NULL;
- pvrvideosink->redraw_borders = TRUE;
- pvrvideosink->current_buffer = NULL;
- pvrvideosink->event_thread = NULL;
- memset (&pvrvideosink->render_params, 0, sizeof (WSEGLDrawableParams));
-}
-
-static void
-gst_pvrvideosink_class_init (GstPVRVideoSinkClass * 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_pvrvideosink_finalize;
- gobject_class->set_property = gst_pvrvideosink_set_property;
- gobject_class->get_property = gst_pvrvideosink_get_property;
-
- 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", TRUE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
- gst_element_class_set_static_metadata (gstelement_class,
- "PVR Video sink", "Sink/Video",
- "A PVR videosink",
- "Luciana Fujii Pontello <luciana.fujii@collabora.co.uk");
-
- gst_element_class_add_static_pad_template (gstelement_class,
- &gst_pvrvideosink_sink_template_factory);
-
- gstelement_class->change_state = gst_pvrvideosink_change_state;
-
- gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_pvrvideosink_setcaps);
- gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_pvrvideosink_getcaps);
- gstbasesink_class->propose_allocation =
- GST_DEBUG_FUNCPTR (gst_pvrvideosink_propose_allocation);
- gstbasesink_class->get_times = GST_DEBUG_FUNCPTR (gst_pvrvideosink_get_times);
-
- videosink_class->show_frame = GST_DEBUG_FUNCPTR (gst_pvrvideosink_show_frame);
-}
diff --git a/sys/pvr2d/gstpvrvideosink.h b/sys/pvr2d/gstpvrvideosink.h
deleted file mode 100644
index c84bb22f5..000000000
--- a/sys/pvr2d/gstpvrvideosink.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/* GStreamer
- *
- * Copyright (C) 2011 - Collabora Ltda
- * Copyright (C) 2011 - Texas Instruments
- * @author: Luciana Fujii Pontello <luciana.fujii@collabora.co.uk>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_PVRVIDEOSINK_H__
-#define __GST_PVRVIDEOSINK_H__
-
-#include <gst/video/gstvideosink.h>
-#include <gst/video/video.h>
-
-#include <string.h>
-#include <math.h>
-#include <pvr2d.h>
-#include <EGL/egl.h>
-#include <wsegl.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-G_BEGIN_DECLS
-#define GST_TYPE_PVRVIDEOSINK (gst_pvrvideosink_get_type())
-#define GST_PVRVIDEOSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_PVRVIDEOSINK, GstPVRVideoSink))
-#define GST_PVRVIDEOSINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_PVRVIDEOSINK, GstPVRVideoSinkClass))
-#define GST_IS_PVRVIDEOSINK(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_PVRVIDEOSINK))
-#define GST_IS_PVRVIDEOSINK_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_PVRVIDEOSINK))
-typedef struct _GstDrawContext GstDrawContext;
-typedef struct _GstXWindow GstXWindow;
-
-typedef struct _GstPVRVideoBuffer GstPVRVideoBuffer;
-typedef struct _GstPVRVideoBufferClass GstPVRVideoBufferClass;
-
-typedef struct _GstPVRVideoSink GstPVRVideoSink;
-typedef struct _GstPVRVideoSinkClass GstPVRVideoSinkClass;
-
-struct _GstDrawContext
-{
- /* PVR2D */
- PVR2DCONTEXTHANDLE pvr_context;
- PVR2DMEMINFO dst_mem;
- PPVR2D_3DBLT_EXT p_blt_info;
- PPVR2DBLTINFO p_blt2d_info;
-
- long stride;
- PVR2DFORMAT display_format;
- long display_width;
- long display_height;
-
- /* WSEGL */
- const WSEGL_FunctionTable *wsegl_table;
-
- WSEGLDisplayHandle display_handle;
- const WSEGLCaps **glcaps;
- WSEGLConfig *glconfig;
- WSEGLDrawableHandle drawable_handle;
- WSEGLRotationAngle rotation;
-
- GMutex *x_lock;
- Display *x_display;
- gint screen_num;
- gulong black;
-};
-
-struct _GstXWindow
-{
- Window window;
- gint width, height;
- gboolean internal;
- GC gc;
-};
-
-
-/**
- * GstPVRVideoSink:
- * @running: used to inform @event_thread if it should run/shutdown
- * @fps_n: the framerate fraction numerator
- * @fps_d: the framerate fraction denominator
- * @flow_lock: used to protect data flow routines from external calls such as
- * events from @event_thread or methods from the #GstXOverlay interface
- * @x_lock: used to protect X calls
- * @buffer_pool: a list of #GstPVRVideoBuffer that could be reused at next buffer
- * allocation call
- * @keep_aspect: used to remember if reverse negotiation scaling should respect
- * aspect ratio
- *
- * The #GstPVRVideoSink data structure.
- */
-struct _GstPVRVideoSink
-{
- /* Our element stuff */
- GstVideoSink videosink;
-
- gboolean running;
-
- /* Framerate numerator and denominator */
- GstVideoInfo info;
-
- GThread *event_thread;
- GMutex *flow_lock;
-
- GstBufferPool *pool;
-
- gboolean keep_aspect;
-
- GstCaps *current_caps;
- GstDrawContext *dcontext;
- GstXWindow *xwindow;
-
- GstVideoRectangle render_rect;
- gboolean have_render_rect;
-
- gchar *media_title;
- gboolean redraw_borders;
- GstBuffer *current_buffer;
-
- /* List of buffer using GstPVRMeta on ourselves */
- GList *metabuffers;
-
- WSEGLDrawableParams render_params;
-};
-
-struct _GstPVRVideoSinkClass
-{
- GstVideoSinkClass parent_class;
-};
-
-GType gst_pvrvideosink_get_type (void);
-
-void gst_pvrvideosink_track_buffer (GstPVRVideoSink * pvrsink, GstBuffer * buffer);
-void gst_pvrvideosink_untrack_buffer (GstPVRVideoSink * pvrsink, GstBuffer * buffer);
-
-G_END_DECLS
-#endif /* __GST_PVRVIDEOSINK_H__ */
diff --git a/sys/pvr2d/pvr_includes/dri2_ws.h b/sys/pvr2d/pvr_includes/dri2_ws.h
deleted file mode 100644
index 743d5bb9c..000000000
--- a/sys/pvr2d/pvr_includes/dri2_ws.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/**********************************************************************
-*
-* Copyright(c) Imagination Technologies Ltd.
-*
-* The contents of this file are subject to the MIT license as set out below.
-*
-* 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.
-*
-* This License is also included in this distribution in the file called
-* "COPYING".
-*
-******************************************************************************/
-
-
-
-#if !defined(__DRI2_WS_H__)
-#define __DRI2_WS_H__
-
-#define DRI2WS_DISPFLAG_DEFAULT_DISPLAY 0x00000001
-
-/*
-// Constants (macros) related to back-buffering.
-*/
-
-#define XWS_FLIP_BUFFERS 3
-#define DRI2_FLIP_BUFFERS_NUM XWS_FLIP_BUFFERS
-#define XWS_FLIP_BUFFER_INDEX (XWS_MAX_FLIP_BUFFERS - 1)
-
-#define XWS_BLIT_BUFFERS 2
-#define DRI2_BLIT_BUFFERS_NUM XWS_BLIT_BUFFERS
-#define XWS_BLIT_BUFFER_INDEX (XWS_MAX_BLIT_BUFFERS - 1)
-
-#if 0
-#define MIN(a,b) ((a)<(b)?(a):(b))
-#define MAX(a,b) ((a)>(b)?(a):(b))
-#endif
-
-#define XWS_MAX_BUFFERS MAX(XWS_FLIP_BUFFERS, XWS_BLIT_BUFFERS)
-#define DRI2_MAX_BUFFERS_NUM XWS_MAX_BUFFERS
-
-
-#define __DRI_BUFFER_EMPTY 103
-
-/** Used for ugly ugly ugly swap interval passing to dri2 driver and receiving current frame index */
-#define __DRI_BUFFER_PVR_CTRL 0x80 /* 100000XX <- last 2 bits for swap interval value */
-#define __DRI_BUFFER_PVR_CTRL_RET 0x90 /* 11000000 */
-
-
-
-#define DRI2_BACK_BUFFER_EXPORT_TYPE_BUFFERS 1
-#define DRI2_BACK_BUFFER_EXPORT_TYPE_SWAPCHAIN 2
-
-#define UNREFERENCED_PARAMETER(x) (x) = (x)
-
-
-/*
- * Structure used to pass information about back buffers between client application and
- * X.Org. Watch out for equivalent structure in pvr_video lib
- */
-typedef struct _PVRDRI2BackBuffersExport_
-{
- /* Type of export. _BUFFERS mean set of handles, _SWAPCHAIN mean Swap chain ID */
- unsigned int ui32Type;
- PVR2D_HANDLE hBuffers[DRI2_MAX_BUFFERS_NUM];
- unsigned int ui32BuffersCount;
- unsigned int ui32SwapChainID;
-} PVRDRI2BackBuffersExport;
-
-/*
-// Private window system display information
-*/
-typedef struct DRI2WS_Display_TAG
-{
- unsigned int ui32RefCount;
-
- Display *display;
- int screen;
- unsigned int ui32Flags;
-
- unsigned int ui32Width;
- unsigned int ui32Height;
- unsigned int ui32StrideInBytes;
- unsigned int ui32BytesPerPixel;
- WSEGLPixelFormat ePixelFormat;
-
- PVR2DFORMAT ePVR2DPixelFormat;
- PVR2DCONTEXTHANDLE hContext;
- PVR2DMEMINFO *psMemInfo;
-
- int iDRMfd;
-} DRI2WSDisplay;
-
-
-typedef enum DRI2WS_DrawableType_TAG
-{
- DRI2_DRAWABLE_UNKNOWN = 0,
- DRI2_DRAWABLE_WINDOW = 1,
- DRI2_DRAWABLE_PIXMAP = 2,
-} DRI2WS_DrawableType;
-
-
-/*
-// Private window system drawable information
-*/
-typedef struct DRI2WS_Drawable_TAG
-{
- DRI2WS_DrawableType eDrawableType;
-
- Window nativeWin;
-
- /** Index of current render-to back buffer (received from Xserver) */
- unsigned int ui32BackBufferCurrent;
-
- /** Number of buffers */
- unsigned int ui32BackBufferNum;
-
- /** Swap interval (works only in fliping/fullscreen case, values 0-3) */
- unsigned int ui32SwapInterval;
-
- /** PVR2D Handles received from Xserver (back buffers export structure) */
- PVR2D_HANDLE hPVR2DBackBufferExport;
-
- /** Stamp of current back buffer */
- unsigned char ucBackBufferExportStamp;
-
- /** Array of PVR2D Handles received from Xserver (our back buffers) */
- PVR2D_HANDLE hPVR2DBackBuffer[XWS_MAX_BUFFERS];
-
- /** Array of PVR2D mapped back buffers */
- PVR2DMEMINFO *psMemBackBuffer[XWS_MAX_BUFFERS];
-
- /** Stamp of current back buffer */
- unsigned char ucFrontBufferStamp;
-
- /** Array of PVR2D Handles received from Xserver (our back buffers) */
- PVR2D_HANDLE hPVR2DFrontBuffer;
-
- /** Array of PVR2D mapped back buffers */
- PVR2DMEMINFO *psMemFrontBuffer;
-
- /** ID of flip/swap chain received from X.Org */
- unsigned int ui32FlipChainID;
-
- /** PVR2D Handle of flip chain used to get buffers to draw to */
- PVR2DFLIPCHAINHANDLE hFlipChain;
-
- int iWidth;
- int iHeight;
-
- WSEGLPixelFormat ePixelFormat;
- unsigned int ui32BytesPerPixel;
- unsigned int ui32StrideInPixels;
- unsigned int ui32StrideInBytes;
- PVR2DFORMAT ePVR2DPixelFormat;
-
- DRI2WSDisplay *psXWSDisplay;
-
-} DRI2WSDrawable;
-
-#endif /* __DRI2_WS_H__ */
diff --git a/sys/pvr2d/pvr_includes/img_defs.h b/sys/pvr2d/pvr_includes/img_defs.h
deleted file mode 100644
index 64db71105..000000000
--- a/sys/pvr2d/pvr_includes/img_defs.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/**********************************************************************
-*
-* Copyright(c) Imagination Technologies Ltd.
-*
-* The contents of this file are subject to the MIT license as set out below.
-*
-* 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.
-*
-* This License is also included in this distribution in the file called
-* "COPYING".
-*
-******************************************************************************/
-
-
-
-#if !defined (__IMG_DEFS_H__)
-#define __IMG_DEFS_H__
-
-#include "img_types.h"
-
-typedef enum img_tag_TriStateSwitch
-{
- IMG_ON = 0x00,
- IMG_OFF,
- IMG_IGNORE
-
-} img_TriStateSwitch, * img_pTriStateSwitch;
-
-#define IMG_SUCCESS 0
-
-#define IMG_NO_REG 1
-
-#if defined (NO_INLINE_FUNCS)
- #define INLINE
- #define FORCE_INLINE
-#else
-#if defined (__cplusplus)
- #define INLINE inline
- #define FORCE_INLINE inline
-#else
-#if !defined(INLINE)
- #define INLINE __inline
-#endif
- #define FORCE_INLINE static __inline
-#endif
-#endif
-
-
-#ifndef PVR_UNREFERENCED_PARAMETER
-#define PVR_UNREFERENCED_PARAMETER(param) (param) = (param)
-#endif
-
-#ifdef __GNUC__
-#define unref__ __attribute__ ((unused))
-#else
-#define unref__
-#endif
-
-#ifndef _TCHAR_DEFINED
-#if defined(UNICODE)
-typedef unsigned short TCHAR, *PTCHAR, *PTSTR;
-#else
-typedef char TCHAR, *PTCHAR, *PTSTR;
-#endif
-#define _TCHAR_DEFINED
-#endif
-
-
- #if defined(__linux__) || defined(__METAG)
-
- #define IMG_CALLCONV
- #define IMG_INTERNAL __attribute__((visibility("hidden")))
- #define IMG_EXPORT __attribute__((visibility("default")))
- #define IMG_IMPORT
- #define IMG_RESTRICT __restrict__
-
- #else
- #error("define an OS")
- #endif
-
-#ifndef IMG_ABORT
- #define IMG_ABORT() abort()
-#endif
-
-#ifndef IMG_MALLOC
- #define IMG_MALLOC(A) malloc (A)
-#endif
-
-#ifndef IMG_FREE
- #define IMG_FREE(A) free (A)
-#endif
-
-#define IMG_CONST const
-
-#if defined(__GNUC__)
-#define IMG_FORMAT_PRINTF(x,y) __attribute__((format(printf,x,y)))
-#else
-#define IMG_FORMAT_PRINTF(x,y)
-#endif
-
-#if defined (_WIN64)
-#define IMG_UNDEF (~0ULL)
-#else
-#define IMG_UNDEF (~0UL)
-#endif
-
-#endif
diff --git a/sys/pvr2d/pvr_includes/img_types.h b/sys/pvr2d/pvr_includes/img_types.h
deleted file mode 100644
index c312c8374..000000000
--- a/sys/pvr2d/pvr_includes/img_types.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/**********************************************************************
-*
-* Copyright(c) Imagination Technologies Ltd.
-*
-* The contents of this file are subject to the MIT license as set out below.
-*
-* 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.
-*
-* This License is also included in this distribution in the file called
-* "COPYING".
-*
-******************************************************************************/
-
-
-
-#ifndef __IMG_TYPES_H__
-#define __IMG_TYPES_H__
-
-#if !defined(IMG_ADDRSPACE_CPUVADDR_BITS)
-#define IMG_ADDRSPACE_CPUVADDR_BITS 32
-#endif
-
-#if !defined(IMG_ADDRSPACE_PHYSADDR_BITS)
-#define IMG_ADDRSPACE_PHYSADDR_BITS 32
-#endif
-
-typedef unsigned int IMG_UINT, *IMG_PUINT;
-typedef signed int IMG_INT, *IMG_PINT;
-
-typedef unsigned char IMG_UINT8, *IMG_PUINT8;
-typedef unsigned char IMG_BYTE, *IMG_PBYTE;
-typedef signed char IMG_INT8, *IMG_PINT8;
-typedef char IMG_CHAR, *IMG_PCHAR;
-
-typedef unsigned short IMG_UINT16, *IMG_PUINT16;
-typedef signed short IMG_INT16, *IMG_PINT16;
-#if !defined(IMG_UINT32_IS_ULONG)
-typedef unsigned int IMG_UINT32, *IMG_PUINT32;
-typedef signed int IMG_INT32, *IMG_PINT32;
-#else
-typedef unsigned long IMG_UINT32, *IMG_PUINT32;
-typedef signed long IMG_INT32, *IMG_PINT32;
-#endif
-#if !defined(IMG_UINT32_MAX)
- #define IMG_UINT32_MAX 0xFFFFFFFFUL
-#endif
-
- #if (defined(LINUX) || defined(__METAG))
-#if !defined(USE_CODE)
- typedef unsigned long long IMG_UINT64, *IMG_PUINT64;
- typedef long long IMG_INT64, *IMG_PINT64;
-#endif
- #else
-
- #error("define an OS")
-
- #endif
-
-#if !(defined(LINUX) && defined (__KERNEL__))
-typedef float IMG_FLOAT, *IMG_PFLOAT;
-typedef double IMG_DOUBLE, *IMG_PDOUBLE;
-#endif
-
-typedef enum tag_img_bool
-{
- IMG_FALSE = 0,
- IMG_TRUE = 1,
- IMG_FORCE_ALIGN = 0x7FFFFFFF
-} IMG_BOOL, *IMG_PBOOL;
-
-typedef void IMG_VOID, *IMG_PVOID;
-
-typedef IMG_INT32 IMG_RESULT;
-
-#if defined(_WIN64)
-typedef unsigned __int64 IMG_UINTPTR_T;
-#else
-typedef unsigned int IMG_UINTPTR_T;
-#endif
-
-typedef IMG_PVOID IMG_HANDLE;
-
-typedef void** IMG_HVOID, * IMG_PHVOID;
-
-typedef IMG_UINT32 IMG_SIZE_T;
-
-#define IMG_NULL 0
-
-typedef IMG_UINT32 IMG_SID;
-
-
-typedef IMG_PVOID IMG_CPU_VIRTADDR;
-
-typedef struct _IMG_DEV_VIRTADDR
-{
-
- IMG_UINT32 uiAddr;
-#define IMG_CAST_TO_DEVVADDR_UINT(var) (IMG_UINT32)(var)
-
-} IMG_DEV_VIRTADDR;
-
-typedef struct _IMG_CPU_PHYADDR
-{
-
- IMG_UINTPTR_T uiAddr;
-} IMG_CPU_PHYADDR;
-
-typedef struct _IMG_DEV_PHYADDR
-{
-#if IMG_ADDRSPACE_PHYSADDR_BITS == 32
-
- IMG_UINTPTR_T uiAddr;
-#else
- IMG_UINT32 uiAddr;
- IMG_UINT32 uiHighAddr;
-#endif
-} IMG_DEV_PHYADDR;
-
-typedef struct _IMG_SYS_PHYADDR
-{
-
- IMG_UINTPTR_T uiAddr;
-} IMG_SYS_PHYADDR;
-
-#include "img_defs.h"
-
-#endif
diff --git a/sys/pvr2d/pvr_includes/pvr2d.h b/sys/pvr2d/pvr_includes/pvr2d.h
deleted file mode 100644
index 5dce7cf11..000000000
--- a/sys/pvr2d/pvr_includes/pvr2d.h
+++ /dev/null
@@ -1,669 +0,0 @@
-/**********************************************************************
-*
-* Copyright(c) Imagination Technologies Ltd.
-*
-* The contents of this file are subject to the MIT license as set out below.
-*
-* 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.
-*
-* This License is also included in this distribution in the file called
-* "COPYING".
-*
-******************************************************************************/
-
-
-
-/******************************************************************************
-Modifications :-
-$Log: pvr2d.h $
-
- --- Revision Logs Removed ---
-******************************************************************************/
-
-#ifndef _PVR2D_H_
-#define _PVR2D_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* PVR2D Platform-specific definitions */
-#if defined (__linux__)
-#define PVR2D_EXPORT __attribute__((visibility("default")))
-#define PVR2D_IMPORT
-#else
-#define PVR2D_EXPORT
-#define PVR2D_IMPORT
-#endif
-
-/* PVR2D header revision */
-#define PVR2D_REV_MAJOR 3
-#define PVR2D_REV_MINOR 5
-
-/* Basic types */
-typedef enum
-{
- PVR2D_FALSE = 0,
- PVR2D_TRUE
-} PVR2D_BOOL;
-
-typedef void* PVR2D_HANDLE;
-
-typedef char PVR2D_CHAR, *PVR2D_PCHAR;
-typedef unsigned char PVR2D_UCHAR, *PVR2D_PUCHAR;
-typedef int PVR2D_INT, *PVR2D_PINT;
-typedef unsigned int PVR2D_UINT, *PVR2D_PUINT;
-typedef long PVR2D_LONG, *PVR2D_PLONG;
-typedef unsigned long PVR2D_ULONG, *PVR2D_PULONG;
-
-typedef void PVR2D_VOID, *PVR2D_PVOID;
-
-
-/* error codes */
-typedef enum
-{
- PVR2D_OK = 0,
- PVR2DERROR_INVALID_PARAMETER = -1,
- PVR2DERROR_DEVICE_UNAVAILABLE = -2,
- PVR2DERROR_INVALID_CONTEXT = -3,
- PVR2DERROR_MEMORY_UNAVAILABLE = -4,
- PVR2DERROR_DEVICE_NOT_PRESENT = -5,
- PVR2DERROR_IOCTL_ERROR = -6,
- PVR2DERROR_GENERIC_ERROR = -7,
- PVR2DERROR_BLT_NOTCOMPLETE = -8,
- PVR2DERROR_HW_FEATURE_NOT_SUPPORTED = -9,
- PVR2DERROR_NOT_YET_IMPLEMENTED = -10,
- PVR2DERROR_MAPPING_FAILED = -11
-}PVR2DERROR;
-
-/* 32 bit PVR2D pixel format specifier */
-typedef unsigned long PVR2DFORMAT;
-
-/* Standard PVR2D pixel formats */
-#define PVR2D_1BPP 0x00UL // 1bpp mask surface or palletized 1 bit source with 2x32 bit CLUT
-#define PVR2D_RGB565 0x01UL // Common rgb 565 format
-#define PVR2D_ARGB4444 0x02UL // Common argb 4444 format
-#define PVR2D_RGB888 0x03UL // Common rgb 888 format (not supported)
-#define PVR2D_ARGB8888 0x04UL // Common argb 8888 format
-#define PVR2D_ARGB1555 0x05UL // Common argb 1555 format
-#define PVR2D_ALPHA8 0x06UL // Alpha-only 8 bit per pixel (used with a constant fill colour)
-#define PVR2D_ALPHA4 0x07UL // Alpha-only 4 bits per pixel (used with a constant fill colour)
-#define PVR2D_PAL2 0x08UL // Palletized 2 bit format (requires 4x32 bit CLUT)
-#define PVR2D_PAL4 0x09UL // Palletized 4 bit format (requires 16x32 bit CLUT)
-#define PVR2D_PAL8 0x0AUL // Palletized 8 bit format (requires 256x32 bit CLUT)
-#define PVR2D_U8 0x10UL // monochrome unsigned 8 bit
-#define PVR2D_U88 0x11UL // monochrome unsigned 16 bit
-#define PVR2D_S8 0x12UL // signed 8 bit
-#define PVR2D_YUV422_YUYV 0x13UL // YUV 422 low-high byte order Y0UY1V
-#define PVR2D_YUV422_UYVY 0x14UL // YUV 422 low-high byte order UY0VY1
-#define PVR2D_YUV422_YVYU 0x15UL // YUV 422 low-high byte order Y0VY1U
-#define PVR2D_YUV422_VYUY 0x16UL // YUV 422 low-high byte order VY0UY1
-#define PVR2D_YUV420_2PLANE 0x17UL // YUV420 2 Plane
-#define PVR2D_YUV420_3PLANE 0x18UL // YUV420 3 Plane
-#define PVR2D_2101010ARGB 0x19UL // 32 bit 2 10 10 10
-#define PVR2D_888RSGSBS 0x1AUL
-#define PVR2D_16BPP_RAW 0x1BUL // 16 bit raw (no format conversion)
-#define PVR2D_32BPP_RAW 0x1CUL // 32 bit raw
-#define PVR2D_64BPP_RAW 0x1DUL // 64 bit raw
-#define PVR2D_128BPP_RAW 0x1EUL // 128 bit raw
-
-#define PVR2D_NO_OF_FORMATS 0x1FUL
-
-/* Format modifier bit field (DstFormat and SrcFormat bits 16..23) */
-#define PVR2D_FORMAT_MASK 0x0000FFFFUL // PVR2D Format bits
-#define PVR2D_FORMAT_LAYOUT_MASK 0x000F0000UL // Format layout (strided / twiddled / tiled)
-#define PVR2D_FORMAT_FLAGS_MASK 0x0FF00000UL // Surface Flags mask
-
-/* Layout */
-#define PVR2D_FORMAT_LAYOUT_SHIFT 16
-#define PVR2D_FORMAT_LAYOUT_STRIDED 0x00000000UL
-#define PVR2D_FORMAT_LAYOUT_TILED 0x00010000UL
-#define PVR2D_FORMAT_LAYOUT_TWIDDLED 0x00020000UL
-
-/*
- PVR2D_SURFACE_PDUMP
- This flag requests a surface pdump, to capture the pixel state after host writes.
- Not needed if the surface state has resulted from previous SGX 2D/3D core writes.
-*/
-#define PVR2D_SURFACE_PDUMP 0x00100000UL // calls PVRSRVPDumpMem to capture the surface (pdump builds only)
-
-/*
- Low level 3D format extension - for blts via the 3D core only.
- If the top bit of the format field is set then PVR2D reads it as a PVRSRV_PIXEL_FORMAT.
- The outcome is hardware dependant.
- There is no guarantee that any specific PVRSRV format will be supported.
-*/
-#define PVR2D_FORMAT_PVRSRV 0x80000000
-
-/* wrap surface type */
-typedef enum
-{
- PVR2D_WRAPFLAG_NONCONTIGUOUS = 0,
- PVR2D_WRAPFLAG_CONTIGUOUS = 1,
-
-}PVR2DWRAPFLAGS;
-
-#define PVR2D_CONTEXT_FLAGS_PRIORITY_MASK 0x00000003
-
-#define PVR2D_CONTEXT_FLAGS_LOW_PRIORITY_CONTEXT 1
-#define PVR2D_CONTEXT_FLAGS_NORMAL_PRIORITY_CONTEXT 0
-#define PVR2D_CONTEXT_FLAGS_HIGH_PRIORITY_CONTEXT 2
-
-/* flags for control information of additional blits */
-typedef enum
-{
- PVR2D_BLIT_DISABLE_ALL = 0x00000000, /* disable all additional controls */
- PVR2D_BLIT_CK_ENABLE = 0x00000001, /* enable colour key */
- PVR2D_BLIT_GLOBAL_ALPHA_ENABLE = 0x00000002, /* enable standard global alpha */
- PVR2D_BLIT_PERPIXEL_ALPHABLEND_ENABLE = 0x00000004, /* enable per-pixel alpha bleding */
- PVR2D_BLIT_PAT_SURFACE_ENABLE = 0x00000008, /* enable pattern surf (disable fill) */
- PVR2D_BLIT_FULLY_SPECIFIED_ALPHA_ENABLE = 0x00000010, /* enable fully specified alpha */
- PVR2D_BLIT_ROT_90 = 0x00000020, /* apply 90 degree rotation to the blt */
- PVR2D_BLIT_ROT_180 = 0x00000040, /* apply 180 degree rotation to the blt */
- PVR2D_BLIT_ROT_270 = 0x00000080, /* apply 270 degree rotation to the blt */
- PVR2D_BLIT_COPYORDER_TL2BR = 0x00000100, /* copy order overrides */
- PVR2D_BLIT_COPYORDER_BR2TL = 0x00000200,
- PVR2D_BLIT_COPYORDER_TR2BL = 0x00000400,
- PVR2D_BLIT_COPYORDER_BL2TR = 0x00000800,
- PVR2D_BLIT_COLKEY_SOURCE = 0x00001000, /* Key colour is on the source surface */
- PVR2D_BLIT_COLKEY_DEST = 0x00002000, /* Key colour is on the destination surface */
- PVR2D_BLIT_COLKEY_MASKED = 0x00004000, /* Mask enabled for colour key */
- PVR2D_BLIT_COLKEY_OP_PASS = 0x00008000, /* Colour key op = pass */
- PVR2D_BLIT_COLKEY_OP_REJECT = 0x00010000, /* Colour key op = reject */
- PVR2D_BLIT_PATH_2DCORE = 0x00100000, /* Blt via dedicated 2D Core or PTLA */
- PVR2D_BLIT_PATH_3DCORE = 0x00200000, /* Blt via 3D Core */
- PVR2D_BLIT_PATH_SWBLT = 0x00400000, /* Blt via host software */
- PVR2D_BLIT_NO_SRC_SYNC_INFO = 0x00800000, /* Dont send a source sync info*/
- PVR2D_BLIT_ISSUE_STATUS_UPDATES = 0x01000000, /* Issue status updates */
-
-} PVR2DBLITFLAGS;
-
-/* standard alpha-blending functions, AlphaBlendingFunc field of PVR2DBLTINFO */
-typedef enum
-{
- PVR2D_ALPHA_OP_SRC_DSTINV = 1, /* source alpha : Cdst = Csrc*Asrc + Cdst*(1-Asrc) */
- PVR2D_ALPHA_OP_SRCP_DSTINV = 2 /* premultiplied source alpha : Cdst = Csrc + Cdst*(1-Asrc) */
-} PVR2D_ALPHABLENDFUNC;
-
-/* blend ops for fully specified alpha (SGX 2D Core only) */
-typedef enum
-{
- PVR2D_BLEND_OP_ZERO = 0,
- PVR2D_BLEND_OP_ONE = 1,
- PVR2D_BLEND_OP_SRC = 2,
- PVR2D_BLEND_OP_DST = 3,
- PVR2D_BLEND_OP_GLOBAL = 4,
- PVR2D_BLEND_OP_SRC_PLUS_GLOBAL = 5,
- PVR2D_BLEND_OP_DST_PLUS_GLOBAL = 6
-}PVR2D_BLEND_OP;
-
-/* SGX 2D Core Fully specified alpha blend : pAlpha field of PVR2DBLTINFO structure */
-/* a fully specified Alpha Blend operation is defined as */
-/* DST (ALPHA) = (ALPHA_1 * SRC (ALPHA)) + (ALPHA_3 * DST (ALPHA)) */
-/* DST (RGB) = (ALPHA_2 * SRC (RGB)) + (ALPHA_4 * DST (RGB)) */
-/* if the pre-multiplication stage is enabled then the equations become the following: */
-/* PRE_MUL = ((SRC(A)) * (Global Alpha Value)) */
-/* DST (ALPHA) = (ALPHA_1 * SRC (ALPHA)) + (PRE_MUL * DST (ALPHA)) */
-/* DST (RGB) = (ALPHA_2 * SRC (RGB)) + (PRE_MUL * DST (RGB)) */
-/* if the transparent source alpha stage is enabled then a source alpha of zero forces the */
-/* source to be transparent for that pixel regardless of the blend equation being used. */
-typedef struct _PVR2D_ALPHABLT
-{
- PVR2D_BLEND_OP eAlpha1;
- PVR2D_BOOL bAlpha1Invert;
- PVR2D_BLEND_OP eAlpha2;
- PVR2D_BOOL bAlpha2Invert;
- PVR2D_BLEND_OP eAlpha3;
- PVR2D_BOOL bAlpha3Invert;
- PVR2D_BLEND_OP eAlpha4;
- PVR2D_BOOL bAlpha4Invert;
- PVR2D_BOOL bPremulAlpha; /* enable pre-multiplication stage */
- PVR2D_BOOL bTransAlpha; /* enable transparent source alpha stage */
- PVR2D_BOOL bUpdateAlphaLookup; /* enable and update the 1555-Lookup alpha table */
- PVR2D_UCHAR uAlphaLookup0; /* 8 bit alpha when A=0 in a 1555-Lookup surface */
- PVR2D_UCHAR uAlphaLookup1; /* 8 bit alpha when A=1 in a 1555-Lookup surface */
- PVR2D_UCHAR uGlobalRGB; /* Global Alpha Value for RGB, 0=transparent 255=opaque */
- PVR2D_UCHAR uGlobalA; /* Global Alpha Value for Alpha */
-
-} PVR2D_ALPHABLT, *PPVR2D_ALPHABLT;
-
-
-/* surface memory info structure */
-typedef struct _PVR2DMEMINFO
-{
- PVR2D_VOID *pBase;
- PVR2D_ULONG ui32MemSize;
- PVR2D_ULONG ui32DevAddr;
- PVR2D_ULONG ulFlags;
- PVR2D_VOID *hPrivateData;
- PVR2D_VOID *hPrivateMapData;
-
-}PVR2DMEMINFO, *PPVR2DMEMINFO;
-
-
-#define PVR2D_MAX_DEVICE_NAME 20
-
-typedef struct _PVR2DDEVICEINFO
-{
- PVR2D_ULONG ulDevID;
- PVR2D_CHAR szDeviceName[PVR2D_MAX_DEVICE_NAME];
-}PVR2DDEVICEINFO;
-
-
-typedef struct _PVR2DISPLAYINFO
-{
- PVR2D_ULONG ulMaxFlipChains;
- PVR2D_ULONG ulMaxBuffersInChain;
- PVR2DFORMAT eFormat;
- PVR2D_ULONG ulWidth;
- PVR2D_ULONG ulHeight;
- PVR2D_LONG lStride;
- PVR2D_ULONG ulMinFlipInterval;
- PVR2D_ULONG ulMaxFlipInterval;
-
-}PVR2DDISPLAYINFO;
-
-
-typedef struct _PVR2MISCDISPLAYINFO
-{
- PVR2D_ULONG ulPhysicalWidthmm;
- PVR2D_ULONG ulPhysicalHeightmm;
- PVR2D_ULONG ulUnused[10];
-
-}PVR2DMISCDISPLAYINFO;
-
-
-typedef struct _PVR2DBLTINFO
-{
- PVR2D_ULONG CopyCode; /* rop code */
- PVR2D_ULONG Colour; /* fill colour */
- PVR2D_ULONG ColourKey; /* colour key argb8888 (see CKEY_ defs below) */
- PVR2D_UCHAR GlobalAlphaValue; /* global alpha blending */
- PVR2D_UCHAR AlphaBlendingFunc; /* per-pixel alpha-blending function */
-
- PVR2DBLITFLAGS BlitFlags; /* additional blit control information */
-
- PVR2DMEMINFO *pDstMemInfo; /* destination memory */
- PVR2D_ULONG DstOffset; /* byte offset from start of allocation to destination surface pixel 0,0 */
- PVR2D_LONG DstStride; /* signed stride, the number of bytes from pixel 0,0 to 0,1 */
- PVR2D_LONG DstX, DstY; /* pixel offset from start of dest surface to start of blt rectangle */
- PVR2D_LONG DSizeX,DSizeY; /* blt size */
- PVR2DFORMAT DstFormat; /* dest format */
- PVR2D_ULONG DstSurfWidth; /* size of dest surface in pixels */
- PVR2D_ULONG DstSurfHeight; /* size of dest surface in pixels */
-
- PVR2DMEMINFO *pSrcMemInfo; /* source mem, (source fields are also used for patterns) */
- PVR2D_ULONG SrcOffset; /* byte offset from start of allocation to src/pat surface pixel 0,0 */
- PVR2D_LONG SrcStride; /* signed stride, the number of bytes from pixel 0,0 to 0,1 */
- PVR2D_LONG SrcX, SrcY; /* pixel offset from start of surface to start of source rectangle */
- /* for patterns this is the start offset within the pattern */
- PVR2D_LONG SizeX,SizeY; /* source rectangle size or pattern size in pixels */
- PVR2DFORMAT SrcFormat; /* source/pattern format */
- PVR2DMEMINFO *pPalMemInfo; /* source/pattern palette memory containing argb8888 colour table */
- PVR2D_ULONG PalOffset; /* byte offset from start of allocation to start of palette */
- PVR2D_ULONG SrcSurfWidth; /* size of source surface in pixels */
- PVR2D_ULONG SrcSurfHeight; /* size of source surface in pixels */
-
- PVR2DMEMINFO *pMaskMemInfo; /* mask memory, 1bpp format implied */
- PVR2D_ULONG MaskOffset; /* byte offset from start of allocation to mask surface pixel 0,0 */
- PVR2D_LONG MaskStride; /* signed stride, the number of bytes from pixel 0,0 to 0,1 */
- PVR2D_LONG MaskX, MaskY; /* mask rect top left (mask size = blt size) */
- PVR2D_ULONG MaskSurfWidth; /* size of mask surface in pixels */
- PVR2D_ULONG MaskSurfHeight; /* size of mask surface in pixels */
-
- PPVR2D_ALPHABLT pAlpha; /* fully specified alpha blend (2DCore only) */
-
- PVR2D_ULONG uSrcChromaPlane1; /* mem offset from start of source alloc to chroma plane 1 */
- PVR2D_ULONG uSrcChromaPlane2; /* mem offset from start of source alloc to chroma plane 2 */
- PVR2D_ULONG uDstChromaPlane1; /* mem offset from start of dest alloc to chroma plane 1 */
- PVR2D_ULONG uDstChromaPlane2; /* mem offset from start of dest alloc to chroma plane 2 */
-
- PVR2D_ULONG ColourKeyMask; /* 32 bit colour key mask, only valid when PVR2D_BLIT_COLKEY_MASKED is set */
-
-}PVR2DBLTINFO, *PPVR2DBLTINFO;
-
-typedef struct _PVR2DRECT
-{
- PVR2D_LONG left, top;
- PVR2D_LONG right, bottom;
-} PVR2DRECT;
-
-typedef struct
-{
- PVR2DMEMINFO *pSurfMemInfo; /* surface memory */
- PVR2D_ULONG SurfOffset; /* byte offset from start of allocation to destination surface pixel 0,0 */
- PVR2D_LONG Stride; /* signed stride */
- PVR2DFORMAT Format; /* format */
- PVR2D_ULONG SurfWidth; /* surface width in pixels */
- PVR2D_ULONG SurfHeight; /* surface height in pixels */
-
-} PVR2D_SURFACE, *PPVR2D_SURFACE;
-
-typedef struct
-{
- PVR2D_ULONG uChromaPlane1; /* YUV multiplane - byte offset from start of alloc to chroma plane 1 */
- PVR2D_ULONG uChromaPlane2; /* YUV multiplane - byte offset from start of alloc to chroma plane 2 */
- PVR2D_LONG Reserved[2]; /* Reserved, must be zero */
-
-} PVR2D_SURFACE_EXT, *PPVR2D_SURFACE_EXT;
-
-typedef struct
-{
- PVR2D_ULONG *pUseCode; /* USSE code */
- PVR2D_ULONG UseCodeSize; /* usse code size in bytes */
-
-} PVR2D_USECODE, *PPVR2D_USECODE;
-
-typedef struct
-{
- PVR2D_SURFACE sDst; /* destination surface */
- PVR2D_SURFACE sSrc; /* source surface */
- PVR2DRECT rcDest; /* destination rectangle */
- PVR2DRECT rcSource; /* source rectangle */
- PVR2D_HANDLE hUseCode; /* custom USE code (NULL implies source copy) */
- PVR2D_ULONG UseParams[2]; /* per-blt params for use code */
-
-} PVR2D_3DBLT, *PPVR2D_3DBLT;
-
-typedef struct
-{
- PVR2D_SURFACE sDst; /* destination surface */
- PVR2DRECT rcDest; /* destination rectangle; scaling is supported */
- PVR2D_SURFACE sSrc; /* source surface */
- PVR2DRECT rcSource; /* source rectangle; scaling is supported */
- PPVR2D_SURFACE pSrc2; /* optional second source surface (NULL if not required) */
- PVR2DRECT* prcSource2; /* optional pSrc2 rectangle */
- PVR2D_HANDLE hUseCode; /* custom USSE shader code (NULL implies default source copy) */
- PVR2D_ULONG UseParams[2]; /* per-blt params for usse code */
- PVR2D_ULONG uiNumTemporaryRegisters; /* no. of temporary registers used in custom shader code */
- PVR2D_BOOL bDisableDestInput; /* set true if the destination is output only */
- PPVR2D_SURFACE_EXT pDstExt; /* Extended format params for dest */
- PPVR2D_SURFACE_EXT pSrcExt[2]; /* Extended format params for source 1 and 2 */
- PVR2D_LONG Reserved[4]; /* Reserved, must be zero */
-
-} PVR2D_3DBLT_EXT, *PPVR2D_3DBLT_EXT;
-
-
-#define MAKE_COPY_BLIT(src,soff,dest,doff,sx,sy,dx,dy,sz)
-
-typedef void* PVR2DCONTEXTHANDLE;
-typedef void* PVR2DFLIPCHAINHANDLE;
-
-
-// CopyCode field of PVR2DBLTINFO structure:
-// the CopyCode field of the PVR2DBLTINFO structure should contain a rop3 or rop4 code.
-// a rop3 is an 8 bit code that describes a blt with three inputs : source dest and pattern
-// rop4 is a 16 bit code that describes a blt with four inputs : source dest pattern and mask
-// common rop3 codes are defined below
-// a colour fill blt is processed in the pattern channel as a constant colour with a rop code of 0xF0
-// PVR2D_BLIT_PAT_SURFACE_ENABLE defines whether the pattern channel is a surface or a fill colour.
-// a rop4 is defined by two rop3 codes, and the 1 bit-per-pixel mask surface defines which is used.
-// a common rop4 is 0xAAF0 which is the mask copy blt used for text glyphs.
-// CopyCode is taken to be a rop4 when pMaskMemInfo is non zero, otherwise it is assumed to be a rop3
-// use the PVR2DMASKROP4 macro below to construct a rop4 from two rop3's
-// rop3a is the rop used when mask pixel = 1, and rop3b when mask = 0
-#define PVR2DROP4(rop3b, rop3a) ((rop3b<<8)|rop3a)
-
-/* common rop codes */
-#define PVR2DROPclear 0x00 /* 0 (whiteness) */
-#define PVR2DROPset 0xFF /* 1 (blackness) */
-#define PVR2DROPnoop 0xAA /* dst (used for masked blts) */
-
-/* source and dest rop codes */
-#define PVR2DROPand 0x88 /* src AND dst */
-#define PVR2DROPandReverse 0x44 /* src AND NOT dst */
-#define PVR2DROPcopy 0xCC /* src (used for source copy and alpha blts) */
-#define PVR2DROPandInverted 0x22 /* NOT src AND dst */
-#define PVR2DROPxor 0x66 /* src XOR dst */
-#define PVR2DROPor 0xEE /* src OR dst */
-#define PVR2DROPnor 0x11 /* NOT src AND NOT dst */
-#define PVR2DROPequiv 0x99 /* NOT src XOR dst */
-#define PVR2DROPinvert 0x55 /* NOT dst */
-#define PVR2DROPorReverse 0xDD /* src OR NOT dst */
-#define PVR2DROPcopyInverted 0x33 /* NOT src */
-#define PVR2DROPorInverted 0xBB /* NOT src OR dst */
-#define PVR2DROPnand 0x77 /* NOT src OR NOT dst */
-
-/* pattern rop codes */
-#define PVR2DPATROPand 0xA0 /* pat AND dst */
-#define PVR2DPATROPandReverse 0x50 /* pat AND NOT dst */
-#define PVR2DPATROPcopy 0xF0 /* pat (used for solid color fills and pattern blts) */
-#define PVR2DPATROPandInverted 0x0A /* NOT pat AND dst */
-#define PVR2DPATROPxor 0x5A /* pat XOR dst */
-#define PVR2DPATROPor 0xFA /* pat OR dst */
-#define PVR2DPATROPnor 0x05 /* NOT pat AND NOT dst */
-#define PVR2DPATROPequiv 0xA5 /* NOT pat XOR dst */
-#define PVR2DPATROPinvert 0x55 /* NOT dst */
-#define PVR2DPATROPorReverse 0xF5 /* pat OR NOT dst */
-#define PVR2DPATROPcopyInverted 0x0F /* NOT pat */
-#define PVR2DPATROPorInverted 0xAF /* NOT pat OR dst */
-#define PVR2DPATROPnand 0x5F /* NOT pat OR NOT dst */
-
-/* common rop4 codes */
-#define PVR2DROP4MaskedCopy PVR2DROP4(PVR2DROPnoop,PVR2DROPcopy) /* masked source copy blt (used for rounded window corners etc) */
-#define PVR2DROP4MaskedFill PVR2DROP4(PVR2DROPnoop,PVR2DPATROPcopy) /* masked colour fill blt (used for text) */
-
-/* Legacy support */
-#define PVR2DROP3_PATMASK PVR2DPATROPcopy
-#define PVR2DROP3_SRCMASK PVR2DROPcopy
-
-/* pixmap memory alignment */
-#define PVR2D_ALIGNMENT_4 4 /* DWORD alignment */
-#define PVR2D_ALIGNMENT_ANY 0 /* no alignment */
-#define PVR2D_ALIGNMENT_PALETTE 16 /* 16 byte alignment is required for palettes */
-
-/* Heap number for PVR2DGetFrameBuffer */
-#define PVR2D_FB_PRIMARY_SURFACE 0
-
-#define PVR2D_PRESENT_PROPERTY_SRCSTRIDE (1UL << 0)
-#define PVR2D_PRESENT_PROPERTY_DSTSIZE (1UL << 1)
-#define PVR2D_PRESENT_PROPERTY_DSTPOS (1UL << 2)
-#define PVR2D_PRESENT_PROPERTY_CLIPRECTS (1UL << 3)
-#define PVR2D_PRESENT_PROPERTY_INTERVAL (1UL << 4)
-
-#define PVR2D_CREATE_FLIPCHAIN_SHARED (1UL << 0)
-#define PVR2D_CREATE_FLIPCHAIN_QUERY (1UL << 1)
-#define PVR2D_CREATE_FLIPCHAIN_OEMOVERLAY (1UL << 2)
-#define PVR2D_CREATE_FLIPCHAIN_AS_BLITCHAIN (1UL << 3)
-
-/* Colour-key colour must be translated into argb8888 format */
-#define CKEY_8888(P) (P)
-#define CKEY_4444(P) (((P&0xF000UL)<<16) | ((P&0x0F00UL)<<12) | ((P&0x00F0UL)<<8) | ((P&0x000FUL)<<4))
-#define CKEY_1555(P) (((P&0x8000UL)<<16) | ((P&0x7C00UL)<<9) | ((P&0x3E0UL)<<6) | ((P&0x1FUL)<<3))
-#define CKEY_565(P) (((P&0xF800UL)<<8) | ((P&0x7E0UL)<<5) | ((P&0x1FUL)<<3))
-#define CKEY_MASK_8888 0x00FFFFFFUL
-#define CKEY_MASK_4444 0x00F0F0F0UL
-#define CKEY_MASK_1555 0x00F8F8F8UL /* Alpha is not normally included in the key test */
-#define CKEY_MASK_565 0x00F8FCF8UL
-
-/* Fill colours must be translated into argb8888 format */
-#define CFILL_4444(P) (((P&0xF000UL)<<16) | ((P&0x0F00UL)<<12) | ((P&0x00F0UL)<<8) | ((P&0x000FUL)<<4))
-#define CFILL_1555(P) (((P&0x8000UL)<<16) | ((P&0x7C00UL)<<9) | ((P&0x3E0UL)<<6) | ((P&0x1FUL)<<3))
-#define CFILL_565(P) (((P&0xF800UL)<<8) | ((P&0x7E0UL)<<5) | ((P&0x1FUL)<<3))
-
-/* PVR2DCreateDeviceContext flags */
-#define PVR2D_XSERVER_PROC 0x00000001UL /*!< Set for the Xserver connection */
-
-/* PVR2DMemAlloc flags */
-#define PVR2D_MEM_UNCACHED 0x00000000UL /* Default */
-#define PVR2D_MEM_CACHED 0x00000001UL /* Caller must flush and sync when necessary */
-#define PVR2D_MEM_WRITECOMBINE 0x00000002UL
-
-/* Functions that the library exports */
-
-PVR2D_IMPORT
-int PVR2DEnumerateDevices(PVR2DDEVICEINFO *pDevInfo);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DCreateDeviceContext(PVR2D_ULONG ulDevID,
- PVR2DCONTEXTHANDLE* phContext,
- PVR2D_ULONG ulFlags);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DDestroyDeviceContext(PVR2DCONTEXTHANDLE hContext);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DGetDeviceInfo(PVR2DCONTEXTHANDLE hContext,
- PVR2DDISPLAYINFO *pDisplayInfo);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DGetMiscDisplayInfo(PVR2DCONTEXTHANDLE hContext,
- PVR2DMISCDISPLAYINFO *pMiscDisplayInfo);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DGetScreenMode(PVR2DCONTEXTHANDLE hContext,
- PVR2DFORMAT *pFormat,
- PVR2D_LONG *plWidth,
- PVR2D_LONG *plHeight,
- PVR2D_LONG *plStride,
- PVR2D_INT *piRefreshRate);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DGetFrameBuffer(PVR2DCONTEXTHANDLE hContext,
- PVR2D_INT nHeap,
- PVR2DMEMINFO **ppsMemInfo);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DMemAlloc(PVR2DCONTEXTHANDLE hContext,
- PVR2D_ULONG ulBytes,
- PVR2D_ULONG ulAlign,
- PVR2D_ULONG ulFlags,
- PVR2DMEMINFO **ppsMemInfo);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DMemExport(PVR2DCONTEXTHANDLE hContext,
- PVR2D_ULONG ulFlags,
- PVR2DMEMINFO *psMemInfo,
- PVR2D_HANDLE *phMemHandle);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DMemWrap(PVR2DCONTEXTHANDLE hContext,
- PVR2D_VOID *pMem,
- PVR2D_ULONG ulFlags,
- PVR2D_ULONG ulBytes,
- PVR2D_ULONG alPageAddress[],
- PVR2DMEMINFO **ppsMemInfo);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DMemMap(PVR2DCONTEXTHANDLE hContext,
- PVR2D_ULONG ulFlags,
- PVR2D_HANDLE hMemHandle,
- PVR2DMEMINFO **ppsDstMem);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DMemFree(PVR2DCONTEXTHANDLE hContext,
- PVR2DMEMINFO *psMemInfo);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DBlt(PVR2DCONTEXTHANDLE hContext,
- PVR2DBLTINFO *pBltInfo);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DBltClipped(PVR2DCONTEXTHANDLE hContext,
- PVR2DBLTINFO *pBltInfo,
- PVR2D_ULONG ulNumClipRects,
- PVR2DRECT *pClipRects);
-
-PVR2D_EXPORT
-PVR2DERROR PVR2DSet1555Alpha (PVR2DCONTEXTHANDLE hContext,
- PVR2D_UCHAR Alpha0, PVR2D_UCHAR Alpha1);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DQueryBlitsComplete(PVR2DCONTEXTHANDLE hContext,
- const PVR2DMEMINFO *pMemInfo,
- PVR2D_UINT uiWaitForComplete);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DSetPresentBltProperties(PVR2DCONTEXTHANDLE hContext,
- PVR2D_ULONG ulPropertyMask,
- PVR2D_LONG lSrcStride,
- PVR2D_ULONG ulDstWidth,
- PVR2D_ULONG ulDstHeight,
- PVR2D_LONG lDstXPos,
- PVR2D_LONG lDstYPos,
- PVR2D_ULONG ulNumClipRects,
- PVR2DRECT *pClipRects,
- PVR2D_ULONG ulSwapInterval);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DPresentBlt(PVR2DCONTEXTHANDLE hContext,
- PVR2DMEMINFO *pMemInfo,
- PVR2D_LONG lRenderID);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DCreateFlipChain(PVR2DCONTEXTHANDLE hContext,
- PVR2D_ULONG ulFlags,
- PVR2D_ULONG ulNumBuffers,
- PVR2D_ULONG ulWidth,
- PVR2D_ULONG ulHeight,
- PVR2DFORMAT eFormat,
- PVR2D_LONG *plStride,
- PVR2D_ULONG *pulFlipChainID,
- PVR2DFLIPCHAINHANDLE *phFlipChain);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DDestroyFlipChain(PVR2DCONTEXTHANDLE hContext,
- PVR2DFLIPCHAINHANDLE hFlipChain);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DGetFlipChainBuffers(PVR2DCONTEXTHANDLE hContext,
- PVR2DFLIPCHAINHANDLE hFlipChain,
- PVR2D_ULONG *pulNumBuffers,
- PVR2DMEMINFO *psMemInfo[]);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DSetPresentFlipProperties(PVR2DCONTEXTHANDLE hContext,
- PVR2DFLIPCHAINHANDLE hFlipChain,
- PVR2D_ULONG ulPropertyMask,
- PVR2D_LONG lDstXPos,
- PVR2D_LONG lDstYPos,
- PVR2D_ULONG ulNumClipRects,
- PVR2DRECT *pClipRects,
- PVR2D_ULONG ulSwapInterval);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DPresentFlip(PVR2DCONTEXTHANDLE hContext,
- PVR2DFLIPCHAINHANDLE hFlipChain,
- PVR2DMEMINFO *psMemInfo,
- PVR2D_LONG lRenderID);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DGetAPIRev(PVR2D_LONG *lRevMajor, PVR2D_LONG *lRevMinor);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DLoadUseCode (const PVR2DCONTEXTHANDLE hContext, const PVR2D_UCHAR *pUseCode,
- const PVR2D_ULONG UseCodeSize, PVR2D_HANDLE *pUseCodeHandle);
-PVR2D_IMPORT
-PVR2DERROR PVR2DFreeUseCode (const PVR2DCONTEXTHANDLE hContext, const PVR2D_HANDLE hUseCodeHandle);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DBlt3D (const PVR2DCONTEXTHANDLE hContext, const PPVR2D_3DBLT pBlt3D);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DBlt3DExt (const PVR2DCONTEXTHANDLE hContext, const PPVR2D_3DBLT_EXT pBlt3D);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PVR2D_H_ */
-
-/******************************************************************************
- End of file (pvr2d.h)
-******************************************************************************/
diff --git a/sys/pvr2d/pvr_includes/services.h b/sys/pvr2d/pvr_includes/services.h
deleted file mode 100644
index 93263a874..000000000
--- a/sys/pvr2d/pvr_includes/services.h
+++ /dev/null
@@ -1,1211 +0,0 @@
-/**********************************************************************
- *
- * Copyright (C) Imagination Technologies Ltd. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful but, except
- * as otherwise stated in writing, 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 program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * The full GNU General Public License is included in this distribution in
- * the file called "COPYING".
- *
- * Contact Information:
- * Imagination Technologies Ltd. <gpl-support@imgtec.com>
- * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
- *
- ******************************************************************************/
-
-#ifndef __SERVICES_H__
-#define __SERVICES_H__
-
-#if defined (__cplusplus)
-extern "C" {
-#endif
-
-#include "img_defs.h"
-#include "servicesext.h"
-
-#define PVRSRV_4K_PAGE_SIZE 4096UL
-
-#define PVRSRV_MAX_CMD_SIZE 1024
-
-#define PVRSRV_MAX_DEVICES 16
-
-#define EVENTOBJNAME_MAXLENGTH (50)
-
-#define PVRSRV_MEM_READ (1U<<0)
-#define PVRSRV_MEM_WRITE (1U<<1)
-#define PVRSRV_MEM_CACHE_CONSISTENT (1U<<2)
-#define PVRSRV_MEM_NO_SYNCOBJ (1U<<3)
-#define PVRSRV_MEM_INTERLEAVED (1U<<4)
-#define PVRSRV_MEM_DUMMY (1U<<5)
-#define PVRSRV_MEM_EDM_PROTECT (1U<<6)
-#define PVRSRV_MEM_ZERO (1U<<7)
-#define PVRSRV_MEM_USER_SUPPLIED_DEVVADDR (1U<<8)
-#define PVRSRV_MEM_RAM_BACKED_ALLOCATION (1U<<9)
-#define PVRSRV_MEM_NO_RESMAN (1U<<10)
-#define PVRSRV_MEM_EXPORTED (1U<<11)
-
-
-#define PVRSRV_HAP_CACHED (1U<<12)
-#define PVRSRV_HAP_UNCACHED (1U<<13)
-#define PVRSRV_HAP_SMART (1U<<20) /* XXX could we use CACHED|UNCACHED? */
-#define PVRSRV_HAP_WRITECOMBINE (1U<<14)
-#define PVRSRV_HAP_CACHETYPE_MASK (PVRSRV_HAP_CACHED|PVRSRV_HAP_UNCACHED|PVRSRV_HAP_SMART|PVRSRV_HAP_WRITECOMBINE)
-#define PVRSRV_HAP_KERNEL_ONLY (1U<<15)
-#define PVRSRV_HAP_SINGLE_PROCESS (1U<<16)
-#define PVRSRV_HAP_MULTI_PROCESS (1U<<17)
-#define PVRSRV_HAP_FROM_EXISTING_PROCESS (1U<<18)
-#define PVRSRV_HAP_NO_CPU_VIRTUAL (1U<<19)
-#define PVRSRV_HAP_GPU_PAGEABLE (1U<<21)
-#define PVRSRV_HAP_MAPTYPE_MASK (PVRSRV_HAP_KERNEL_ONLY \
- |PVRSRV_HAP_SINGLE_PROCESS \
- |PVRSRV_HAP_MULTI_PROCESS \
- |PVRSRV_HAP_FROM_EXISTING_PROCESS \
- |PVRSRV_HAP_NO_CPU_VIRTUAL\
- |PVRSRV_HAP_GPU_PAGEABLE)
-
-#define PVRSRV_MEM_CACHED PVRSRV_HAP_CACHED
-#define PVRSRV_MEM_UNCACHED PVRSRV_HAP_UNCACHED
-#define PVRSRV_MEM_SMART PVRSRV_HAP_SMART
-#define PVRSRV_MEM_WRITECOMBINE PVRSRV_HAP_WRITECOMBINE
-
-#define PVRSRV_MEM_BACKINGSTORE_FIELD_SHIFT (24)
-
-#define PVRSRV_MAP_NOUSERVIRTUAL (1UL<<27)
-#define PVRSRV_MEM_XPROC (1U<<28)
-
-#define PVRSRV_NO_CONTEXT_LOSS 0
-#define PVRSRV_SEVERE_LOSS_OF_CONTEXT 1
-#define PVRSRV_PRE_STATE_CHANGE_MASK 0x80
-
-
-#define PVRSRV_DEFAULT_DEV_COOKIE (1)
-
-
-#define PVRSRV_MISC_INFO_TIMER_PRESENT (1U<<0)
-#define PVRSRV_MISC_INFO_CLOCKGATE_PRESENT (1U<<1)
-#define PVRSRV_MISC_INFO_MEMSTATS_PRESENT (1U<<2)
-#define PVRSRV_MISC_INFO_GLOBALEVENTOBJECT_PRESENT (1U<<3)
-#define PVRSRV_MISC_INFO_DDKVERSION_PRESENT (1U<<4)
-#define PVRSRV_MISC_INFO_CPUCACHEOP_PRESENT (1U<<5)
-#define PVRSRV_MISC_INFO_FREEMEM_PRESENT (1U<<6)
-
-#define PVRSRV_MISC_INFO_RESET_PRESENT (1U<<31)
-
-#define PVRSRV_PDUMP_MAX_FILENAME_SIZE 20
-#define PVRSRV_PDUMP_MAX_COMMENT_SIZE 200
-
-
-#define PVRSRV_CHANGEDEVMEM_ATTRIBS_CACHECOHERENT 0x00000001
-
-#define PVRSRV_MAPEXTMEMORY_FLAGS_ALTERNATEVA 0x00000001
-#define PVRSRV_MAPEXTMEMORY_FLAGS_PHYSCONTIG 0x00000002
-
-#define PVRSRV_MODIFYSYNCOPS_FLAGS_WO_INC 0x00000001
-#define PVRSRV_MODIFYSYNCOPS_FLAGS_RO_INC 0x00000002
-
-#define SRV_FLAGS_PERSIST 0x1
-#define SRV_FLAGS_PDUMP_ACTIVE 0x2
-
-#define PVRSRV_PDUMP_FLAGS_CONTINUOUS 0x1
-
-#define PVR_FULL_CACHE_OP_THRESHOLD (0x7D000)
-
-typedef enum _PVRSRV_DEVICE_TYPE_
-{
- PVRSRV_DEVICE_TYPE_UNKNOWN = 0 ,
- PVRSRV_DEVICE_TYPE_MBX1 = 1 ,
- PVRSRV_DEVICE_TYPE_MBX1_LITE = 2 ,
-
- PVRSRV_DEVICE_TYPE_M24VA = 3,
- PVRSRV_DEVICE_TYPE_MVDA2 = 4,
- PVRSRV_DEVICE_TYPE_MVED1 = 5,
- PVRSRV_DEVICE_TYPE_MSVDX = 6,
-
- PVRSRV_DEVICE_TYPE_SGX = 7,
-
- PVRSRV_DEVICE_TYPE_VGX = 8,
-
-
- PVRSRV_DEVICE_TYPE_EXT = 9,
-
- PVRSRV_DEVICE_TYPE_LAST = 9,
-
- PVRSRV_DEVICE_TYPE_FORCE_I32 = 0x7fffffff
-
-} PVRSRV_DEVICE_TYPE;
-
-#define HEAP_ID( _dev_ , _dev_heap_idx_ ) ( ((_dev_)<<24) | ((_dev_heap_idx_)&((1<<24)-1)) )
-#define HEAP_IDX( _heap_id_ ) ( (_heap_id_)&((1<<24) - 1 ) )
-#define HEAP_DEV( _heap_id_ ) ( (_heap_id_)>>24 )
-
-#define PVRSRV_UNDEFINED_HEAP_ID (~0LU)
-
-typedef enum
-{
- IMG_EGL = 0x00000001,
- IMG_OPENGLES1 = 0x00000002,
- IMG_OPENGLES2 = 0x00000003,
- IMG_D3DM = 0x00000004,
- IMG_SRV_UM = 0x00000005,
- IMG_OPENVG = 0x00000006,
- IMG_SRVCLIENT = 0x00000007,
- IMG_VISTAKMD = 0x00000008,
- IMG_VISTA3DNODE = 0x00000009,
- IMG_VISTAMVIDEONODE = 0x0000000A,
- IMG_VISTAVPBNODE = 0x0000000B,
- IMG_OPENGL = 0x0000000C,
- IMG_D3D = 0x0000000D,
-#if defined(SUPPORT_GRAPHICS_HAL) || defined(SUPPORT_COMPOSER_HAL)
- IMG_ANDROID_HAL = 0x0000000E,
-#endif
-#if defined(SUPPORT_OPENCL)
- IMG_OPENCL = 0x0000000F,
-#endif
-
-} IMG_MODULE_ID;
-
-
-#define APPHINT_MAX_STRING_SIZE 256
-
-typedef enum
-{
- IMG_STRING_TYPE = 1,
- IMG_FLOAT_TYPE ,
- IMG_UINT_TYPE ,
- IMG_INT_TYPE ,
- IMG_FLAG_TYPE
-}IMG_DATA_TYPE;
-
-
-typedef struct _PVRSRV_DEV_DATA_ *PPVRSRV_DEV_DATA;
-
-typedef struct _PVRSRV_DEVICE_IDENTIFIER_
-{
- PVRSRV_DEVICE_TYPE eDeviceType;
- PVRSRV_DEVICE_CLASS eDeviceClass;
- IMG_UINT32 ui32DeviceIndex;
- IMG_CHAR *pszPDumpDevName;
- IMG_CHAR *pszPDumpRegName;
-
-} PVRSRV_DEVICE_IDENTIFIER;
-
-
-typedef struct _PVRSRV_CLIENT_DEV_DATA_
-{
- IMG_UINT32 ui32NumDevices;
- PVRSRV_DEVICE_IDENTIFIER asDevID[PVRSRV_MAX_DEVICES];
- PVRSRV_ERROR (*apfnDevConnect[PVRSRV_MAX_DEVICES])(PPVRSRV_DEV_DATA);
- PVRSRV_ERROR (*apfnDumpTrace[PVRSRV_MAX_DEVICES])(PPVRSRV_DEV_DATA);
-
-} PVRSRV_CLIENT_DEV_DATA;
-
-
-typedef struct _PVRSRV_CONNECTION_
-{
- IMG_HANDLE hServices;
- IMG_UINT32 ui32ProcessID;
- PVRSRV_CLIENT_DEV_DATA sClientDevData;
- IMG_UINT32 ui32SrvFlags;
-}PVRSRV_CONNECTION;
-
-
-typedef struct _PVRSRV_DEV_DATA_
-{
- IMG_CONST PVRSRV_CONNECTION *psConnection;
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hDevCookie;
-#else
- IMG_HANDLE hDevCookie;
-#endif
-
-} PVRSRV_DEV_DATA;
-
-typedef struct _PVRSRV_MEMUPDATE_
-{
- IMG_UINT32 ui32UpdateAddr;
- IMG_UINT32 ui32UpdateVal;
-} PVRSRV_MEMUPDATE;
-
-typedef struct _PVRSRV_HWREG_
-{
- IMG_UINT32 ui32RegAddr;
- IMG_UINT32 ui32RegVal;
-} PVRSRV_HWREG;
-
-typedef struct _PVRSRV_MEMBLK_
-{
- IMG_DEV_VIRTADDR sDevVirtAddr;
- IMG_HANDLE hOSMemHandle;
- IMG_HANDLE hOSWrapMem;
- IMG_HANDLE hBuffer;
- IMG_HANDLE hResItem;
- IMG_SYS_PHYADDR *psIntSysPAddr;
-
-} PVRSRV_MEMBLK;
-
-typedef struct _PVRSRV_KERNEL_MEM_INFO_ *PPVRSRV_KERNEL_MEM_INFO;
-
-typedef struct _PVRSRV_CLIENT_MEM_INFO_
-{
-
- IMG_PVOID pvLinAddr;
-
-
- IMG_PVOID pvLinAddrKM;
-
-
- IMG_DEV_VIRTADDR sDevVAddr;
-
-
-
-
-
-
- IMG_CPU_PHYADDR sCpuPAddr;
-
-
- IMG_UINT32 ui32Flags;
-
-
-
-
- IMG_UINT32 ui32ClientFlags;
-
-
- IMG_SIZE_T uAllocSize;
-
-
-
- struct _PVRSRV_CLIENT_SYNC_INFO_ *psClientSyncInfo;
-
-#if defined (SUPPORT_SID_INTERFACE)
-
- IMG_SID hMappingInfo;
-
-
- IMG_SID hKernelMemInfo;
-
-
- IMG_SID hResItem;
-#else
-
- IMG_HANDLE hMappingInfo;
-
-
- IMG_HANDLE hKernelMemInfo;
-
-
- IMG_HANDLE hResItem;
-#endif
-
-#if defined(SUPPORT_MEMINFO_IDS)
- #if !defined(USE_CODE)
-
- IMG_UINT64 ui64Stamp;
- #else
- IMG_UINT32 dummy1;
- IMG_UINT32 dummy2;
- #endif
-#endif
-
-
-
-
- struct _PVRSRV_CLIENT_MEM_INFO_ *psNext;
-
-} PVRSRV_CLIENT_MEM_INFO, *PPVRSRV_CLIENT_MEM_INFO;
-
-
-#define PVRSRV_MAX_CLIENT_HEAPS (32)
-typedef struct _PVRSRV_HEAP_INFO_
-{
- IMG_UINT32 ui32HeapID;
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hDevMemHeap;
-#else
- IMG_HANDLE hDevMemHeap;
-#endif
- IMG_DEV_VIRTADDR sDevVAddrBase;
- IMG_UINT32 ui32HeapByteSize;
- IMG_UINT32 ui32Attribs;
- IMG_UINT32 ui32XTileStride;
-}PVRSRV_HEAP_INFO;
-
-
-
-
-typedef struct _PVRSRV_EVENTOBJECT_
-{
-
- IMG_CHAR szName[EVENTOBJNAME_MAXLENGTH];
-
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hOSEventKM;
-#else
- IMG_HANDLE hOSEventKM;
-#endif
-
-} PVRSRV_EVENTOBJECT;
-
-typedef enum
-{
- PVRSRV_MISC_INFO_CPUCACHEOP_NONE = 0,
- PVRSRV_MISC_INFO_CPUCACHEOP_CLEAN,
- PVRSRV_MISC_INFO_CPUCACHEOP_FLUSH,
- PVRSRV_MISC_INFO_CPUCACHEOP_CUSTOM_FLUSH,
- PVRSRV_MISC_INFO_CPUCACHEOP_CUSTOM_INV
-} PVRSRV_MISC_INFO_CPUCACHEOP_TYPE;
-
-typedef struct _PVRSRV_MISC_INFO_
-{
- IMG_UINT32 ui32StateRequest;
- IMG_UINT32 ui32StatePresent;
-
-
- IMG_VOID *pvSOCTimerRegisterKM;
- IMG_VOID *pvSOCTimerRegisterUM;
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hSOCTimerRegisterOSMemHandle;
- IMG_SID hSOCTimerRegisterMappingInfo;
-#else
- IMG_HANDLE hSOCTimerRegisterOSMemHandle;
- IMG_HANDLE hSOCTimerRegisterMappingInfo;
-#endif
-
-
- IMG_VOID *pvSOCClockGateRegs;
- IMG_UINT32 ui32SOCClockGateRegsSize;
-
-
- IMG_CHAR *pszMemoryStr;
- IMG_UINT32 ui32MemoryStrLen;
-
-
- PVRSRV_EVENTOBJECT sGlobalEventObject;
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_EVENTSID hOSGlobalEvent;
-#else
- IMG_HANDLE hOSGlobalEvent;
-#endif
-
-
- IMG_UINT32 aui32DDKVersion[4];
-
-
- struct
- {
-
- IMG_BOOL bDeferOp;
-
-
- PVRSRV_MISC_INFO_CPUCACHEOP_TYPE eCacheOpType;
-
-
-#if !defined (SUPPORT_SID_INTERFACE)
- union
- {
-
- PVRSRV_CLIENT_MEM_INFO *psClientMemInfo;
-
-
- struct _PVRSRV_KERNEL_MEM_INFO_ *psKernelMemInfo;
- } u;
-#endif
-
-
- IMG_VOID *pvBaseVAddr;
-
-
- IMG_UINT32 ui32Length;
- } sCacheOpCtl;
-} PVRSRV_MISC_INFO;
-
-typedef struct _PVRSRV_SYNC_TOKEN_
-{
-
-
- struct
- {
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hKernelSyncInfo;
-#else
- IMG_HANDLE hKernelSyncInfo;
-#endif
- IMG_UINT32 ui32ReadOpsPendingSnapshot;
- IMG_UINT32 ui32WriteOpsPendingSnapshot;
- } sPrivate;
-} PVRSRV_SYNC_TOKEN;
-
-
-typedef enum _PVRSRV_CLIENT_EVENT_
-{
- PVRSRV_CLIENT_EVENT_HWTIMEOUT = 0,
-} PVRSRV_CLIENT_EVENT;
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVClientEvent(IMG_CONST PVRSRV_CLIENT_EVENT eEvent,
- PVRSRV_DEV_DATA *psDevData,
- IMG_PVOID pvData);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVConnect(PVRSRV_CONNECTION **ppsConnection, IMG_UINT32 ui32SrvFlags);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVDisconnect(IMG_CONST PVRSRV_CONNECTION *psConnection);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVEnumerateDevices(IMG_CONST PVRSRV_CONNECTION *psConnection,
- IMG_UINT32 *puiNumDevices,
- PVRSRV_DEVICE_IDENTIFIER *puiDevIDs);
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVAcquireDeviceData(IMG_CONST PVRSRV_CONNECTION *psConnection,
- IMG_UINT32 uiDevIndex,
- PVRSRV_DEV_DATA *psDevData,
- PVRSRV_DEVICE_TYPE eDeviceType);
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVGetMiscInfo (IMG_CONST PVRSRV_CONNECTION *psConnection, PVRSRV_MISC_INFO *psMiscInfo);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVReleaseMiscInfo (IMG_CONST PVRSRV_CONNECTION *psConnection, PVRSRV_MISC_INFO *psMiscInfo);
-
-#if 1
-IMG_IMPORT
-IMG_UINT32 ReadHWReg(IMG_PVOID pvLinRegBaseAddr, IMG_UINT32 ui32Offset);
-
-IMG_IMPORT
-IMG_VOID WriteHWReg(IMG_PVOID pvLinRegBaseAddr, IMG_UINT32 ui32Offset, IMG_UINT32 ui32Value);
-
-IMG_IMPORT IMG_VOID WriteHWRegs(IMG_PVOID pvLinRegBaseAddr, IMG_UINT32 ui32Count, PVRSRV_HWREG *psHWRegs);
-#endif
-
-IMG_IMPORT
-PVRSRV_ERROR PVRSRVPollForValue ( const PVRSRV_CONNECTION *psConnection,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hOSEvent,
-#else
- IMG_HANDLE hOSEvent,
-#endif
- volatile IMG_UINT32 *pui32LinMemAddr,
- IMG_UINT32 ui32Value,
- IMG_UINT32 ui32Mask,
- IMG_UINT32 ui32Waitus,
- IMG_UINT32 ui32Tries);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateDeviceMemContext(IMG_CONST PVRSRV_DEV_DATA *psDevData,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID *phDevMemContext,
-#else
- IMG_HANDLE *phDevMemContext,
-#endif
- IMG_UINT32 *pui32SharedHeapCount,
- PVRSRV_HEAP_INFO *psHeapInfo);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyDeviceMemContext(IMG_CONST PVRSRV_DEV_DATA *psDevData,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hDevMemContext);
-#else
- IMG_HANDLE hDevMemContext);
-#endif
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVGetDeviceMemHeapInfo(IMG_CONST PVRSRV_DEV_DATA *psDevData,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hDevMemContext,
-#else
- IMG_HANDLE hDevMemContext,
-#endif
- IMG_UINT32 *pui32SharedHeapCount,
- PVRSRV_HEAP_INFO *psHeapInfo);
-
-#if defined(PVRSRV_LOG_MEMORY_ALLOCS)
- #define PVRSRVAllocDeviceMem_log(psDevData, hDevMemHeap, ui32Attribs, ui32Size, ui32Alignment, ppsMemInfo, logStr) \
- (PVR_TRACE(("PVRSRVAllocDeviceMem(" #psDevData "," #hDevMemHeap "," #ui32Attribs "," #ui32Size "," #ui32Alignment "," #ppsMemInfo ")" \
- ": " logStr " (size = 0x%lx)", ui32Size)), \
- PVRSRVAllocDeviceMem(psDevData, hDevMemHeap, ui32Attribs, ui32Size, ui32Alignment, ppsMemInfo))
-#else
- #define PVRSRVAllocDeviceMem_log(psDevData, hDevMemHeap, ui32Attribs, ui32Size, ui32Alignment, ppsMemInfo, logStr) \
- PVRSRVAllocDeviceMem(psDevData, hDevMemHeap, ui32Attribs, ui32Size, ui32Alignment, ppsMemInfo)
-#endif
-
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVAllocDeviceMem(IMG_CONST PVRSRV_DEV_DATA *psDevData,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hDevMemHeap,
-#else
- IMG_HANDLE hDevMemHeap,
-#endif
- IMG_UINT32 ui32Attribs,
- IMG_SIZE_T ui32Size,
- IMG_SIZE_T ui32Alignment,
- PVRSRV_CLIENT_MEM_INFO **ppsMemInfo);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVFreeDeviceMem(IMG_CONST PVRSRV_DEV_DATA *psDevData,
- PVRSRV_CLIENT_MEM_INFO *psMemInfo);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVRemapToDev(IMG_CONST PVRSRV_DEV_DATA *psDevData,
- PVRSRV_CLIENT_MEM_INFO *psMemInfo);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVUnmapFromDev(IMG_CONST PVRSRV_DEV_DATA *psDevData,
- PVRSRV_CLIENT_MEM_INFO *psMemInfo);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVExportDeviceMem(IMG_CONST PVRSRV_DEV_DATA *psDevData,
- PVRSRV_CLIENT_MEM_INFO *psMemInfo,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID *phMemInfo);
-#else
- IMG_HANDLE *phMemInfo);
-#endif
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVReserveDeviceVirtualMem(IMG_CONST PVRSRV_DEV_DATA *psDevData,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hDevMemHeap,
-#else
- IMG_HANDLE hDevMemHeap,
-#endif
- IMG_DEV_VIRTADDR *psDevVAddr,
- IMG_SIZE_T ui32Size,
- IMG_SIZE_T ui32Alignment,
- PVRSRV_CLIENT_MEM_INFO **ppsMemInfo);
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVFreeDeviceVirtualMem(IMG_CONST PVRSRV_DEV_DATA *psDevData,
- PVRSRV_CLIENT_MEM_INFO *psMemInfo);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hKernelMemInfo,
- IMG_SID hDstDevMemHeap,
-#else
- IMG_HANDLE hKernelMemInfo,
- IMG_HANDLE hDstDevMemHeap,
-#endif
- PVRSRV_CLIENT_MEM_INFO **ppsDstMemInfo);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVUnmapDeviceMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData,
- PVRSRV_CLIENT_MEM_INFO *psMemInfo);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVMapExtMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData,
- PVRSRV_CLIENT_MEM_INFO *psMemInfo,
- IMG_SYS_PHYADDR *psSysPAddr,
- IMG_UINT32 ui32Flags);
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVUnmapExtMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData,
- PVRSRV_CLIENT_MEM_INFO *psMemInfo,
- IMG_UINT32 ui32Flags);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVWrapExtMemory(IMG_CONST PVRSRV_DEV_DATA *psDevData,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hDevMemContext,
-#else
- IMG_HANDLE hDevMemContext,
-#endif
- IMG_SIZE_T ui32ByteSize,
- IMG_SIZE_T ui32PageOffset,
- IMG_BOOL bPhysContig,
- IMG_SYS_PHYADDR *psSysPAddr,
- IMG_VOID *pvLinAddr,
- IMG_UINT32 ui32Flags,
- PVRSRV_CLIENT_MEM_INFO **ppsMemInfo);
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVUnwrapExtMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData,
- PVRSRV_CLIENT_MEM_INFO *psMemInfo);
-
-PVRSRV_ERROR PVRSRVChangeDeviceMemoryAttributes(IMG_CONST PVRSRV_DEV_DATA *psDevData,
- PVRSRV_CLIENT_MEM_INFO *psClientMemInfo,
- IMG_UINT32 ui32Attribs);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceClassMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hDevMemContext,
- IMG_SID hDeviceClassBuffer,
-#else
- IMG_HANDLE hDevMemContext,
- IMG_HANDLE hDeviceClassBuffer,
-#endif
- PVRSRV_CLIENT_MEM_INFO **ppsMemInfo);
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVUnmapDeviceClassMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData,
- PVRSRV_CLIENT_MEM_INFO *psMemInfo);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVMapPhysToUserSpace(IMG_CONST PVRSRV_DEV_DATA *psDevData,
- IMG_SYS_PHYADDR sSysPhysAddr,
- IMG_UINT32 uiSizeInBytes,
- IMG_PVOID *ppvUserAddr,
- IMG_UINT32 *puiActualSize,
- IMG_PVOID *ppvProcess);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVUnmapPhysToUserSpace(IMG_CONST PVRSRV_DEV_DATA *psDevData,
- IMG_PVOID pvUserAddr,
- IMG_PVOID pvProcess);
-
-#if defined(LINUX)
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVExportDeviceMem2(IMG_CONST PVRSRV_DEV_DATA *psDevData,
- PVRSRV_CLIENT_MEM_INFO *psMemInfo,
- IMG_INT *iFd);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceMemory2(IMG_CONST PVRSRV_DEV_DATA *psDevData,
- IMG_INT iFd,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hDstDevMemHeap,
-#else
- IMG_HANDLE hDstDevMemHeap,
-#endif
- PVRSRV_CLIENT_MEM_INFO **ppsDstMemInfo);
-#endif
-
-typedef enum _PVRSRV_SYNCVAL_MODE_
-{
- PVRSRV_SYNCVAL_READ = IMG_TRUE,
- PVRSRV_SYNCVAL_WRITE = IMG_FALSE,
-
-} PVRSRV_SYNCVAL_MODE, *PPVRSRV_SYNCVAL_MODE;
-
-typedef IMG_UINT32 PVRSRV_SYNCVAL;
-
-IMG_IMPORT PVRSRV_ERROR PVRSRVWaitForOpsComplete(PPVRSRV_CLIENT_MEM_INFO psMemInfo,
- PVRSRV_SYNCVAL_MODE eMode, PVRSRV_SYNCVAL OpRequired);
-
-IMG_IMPORT PVRSRV_ERROR PVRSRVWaitForAllOpsComplete(PPVRSRV_CLIENT_MEM_INFO psMemInfo,
- PVRSRV_SYNCVAL_MODE eMode);
-
-IMG_IMPORT IMG_BOOL PVRSRVTestOpsComplete(PPVRSRV_CLIENT_MEM_INFO psMemInfo,
- PVRSRV_SYNCVAL_MODE eMode, PVRSRV_SYNCVAL OpRequired);
-
-IMG_IMPORT IMG_BOOL PVRSRVTestAllOpsComplete(PPVRSRV_CLIENT_MEM_INFO psMemInfo,
- PVRSRV_SYNCVAL_MODE eMode);
-
-IMG_IMPORT IMG_BOOL PVRSRVTestOpsNotComplete(PPVRSRV_CLIENT_MEM_INFO psMemInfo,
- PVRSRV_SYNCVAL_MODE eMode, PVRSRV_SYNCVAL OpRequired);
-
-IMG_IMPORT IMG_BOOL PVRSRVTestAllOpsNotComplete(PPVRSRV_CLIENT_MEM_INFO psMemInfo,
- PVRSRV_SYNCVAL_MODE eMode);
-
-IMG_IMPORT PVRSRV_SYNCVAL PVRSRVGetPendingOpSyncVal(PPVRSRV_CLIENT_MEM_INFO psMemInfo,
- PVRSRV_SYNCVAL_MODE eMode);
-
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVEnumerateDeviceClass(IMG_CONST PVRSRV_CONNECTION *psConnection,
- PVRSRV_DEVICE_CLASS DeviceClass,
- IMG_UINT32 *pui32DevCount,
- IMG_UINT32 *pui32DevID);
-
-IMG_IMPORT
-IMG_HANDLE IMG_CALLCONV PVRSRVOpenDCDevice(IMG_CONST PVRSRV_DEV_DATA *psDevData,
- IMG_UINT32 ui32DeviceID);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVCloseDCDevice(IMG_CONST PVRSRV_CONNECTION *psConnection, IMG_HANDLE hDevice);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVEnumDCFormats (IMG_HANDLE hDevice,
- IMG_UINT32 *pui32Count,
- DISPLAY_FORMAT *psFormat);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVEnumDCDims (IMG_HANDLE hDevice,
- IMG_UINT32 *pui32Count,
- DISPLAY_FORMAT *psFormat,
- DISPLAY_DIMS *psDims);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVGetDCSystemBuffer(IMG_HANDLE hDevice,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID *phBuffer);
-#else
- IMG_HANDLE *phBuffer);
-#endif
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVGetDCInfo(IMG_HANDLE hDevice,
- DISPLAY_INFO* psDisplayInfo);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateDCSwapChain (IMG_HANDLE hDevice,
- IMG_UINT32 ui32Flags,
- DISPLAY_SURF_ATTRIBUTES *psDstSurfAttrib,
- DISPLAY_SURF_ATTRIBUTES *psSrcSurfAttrib,
- IMG_UINT32 ui32BufferCount,
- IMG_UINT32 ui32OEMFlags,
- IMG_UINT32 *pui32SwapChainID,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID *phSwapChain);
-#else
- IMG_HANDLE *phSwapChain);
-#endif
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyDCSwapChain (IMG_HANDLE hDevice,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hSwapChain);
-#else
- IMG_HANDLE hSwapChain);
-#endif
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVSetDCDstRect (IMG_HANDLE hDevice,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hSwapChain,
-#else
- IMG_HANDLE hSwapChain,
-#endif
- IMG_RECT *psDstRect);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVSetDCSrcRect (IMG_HANDLE hDevice,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hSwapChain,
-#else
- IMG_HANDLE hSwapChain,
-#endif
- IMG_RECT *psSrcRect);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVSetDCDstColourKey (IMG_HANDLE hDevice,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hSwapChain,
-#else
- IMG_HANDLE hSwapChain,
-#endif
- IMG_UINT32 ui32CKColour);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVSetDCSrcColourKey (IMG_HANDLE hDevice,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hSwapChain,
-#else
- IMG_HANDLE hSwapChain,
-#endif
- IMG_UINT32 ui32CKColour);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVGetDCBuffers(IMG_HANDLE hDevice,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hSwapChain,
- IMG_SID *phBuffer);
-#else
- IMG_HANDLE hSwapChain,
- IMG_HANDLE *phBuffer);
-#endif
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVSwapToDCBuffer (IMG_HANDLE hDevice,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hBuffer,
-#else
- IMG_HANDLE hBuffer,
-#endif
- IMG_UINT32 ui32ClipRectCount,
- IMG_RECT *psClipRect,
- IMG_UINT32 ui32SwapInterval,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hPrivateTag);
-#else
- IMG_HANDLE hPrivateTag);
-#endif
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVSwapToDCSystem (IMG_HANDLE hDevice,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hSwapChain);
-#else
- IMG_HANDLE hSwapChain);
-#endif
-
-
-IMG_IMPORT
-IMG_HANDLE IMG_CALLCONV PVRSRVOpenBCDevice(IMG_CONST PVRSRV_DEV_DATA *psDevData,
- IMG_UINT32 ui32DeviceID);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVCloseBCDevice(IMG_CONST PVRSRV_CONNECTION *psConnection,
- IMG_HANDLE hDevice);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVGetBCBufferInfo(IMG_HANDLE hDevice,
- BUFFER_INFO *psBuffer);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVGetBCBuffer(IMG_HANDLE hDevice,
- IMG_UINT32 ui32BufferIndex,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID *phBuffer);
-#else
- IMG_HANDLE *phBuffer);
-#endif
-
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpInit(IMG_CONST PVRSRV_CONNECTION *psConnection);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpStartInitPhase(IMG_CONST PVRSRV_CONNECTION *psConnection);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpStopInitPhase(IMG_CONST PVRSRV_CONNECTION *psConnection);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpSyncPol(IMG_CONST PVRSRV_CONNECTION *psConnection,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hKernelSyncInfo,
-#else
- PVRSRV_CLIENT_SYNC_INFO *psClientSyncInfo,
-#endif
- IMG_BOOL bIsRead,
- IMG_UINT32 ui32Value,
- IMG_UINT32 ui32Mask);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpSyncPol2(IMG_CONST PVRSRV_CONNECTION *psConnection,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hKernelSyncInfo,
-#else
- PVRSRV_CLIENT_SYNC_INFO *psClientSyncInfo,
-#endif
- IMG_BOOL bIsRead);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpMem(IMG_CONST PVRSRV_CONNECTION *psConnection,
- IMG_PVOID pvAltLinAddr,
- PVRSRV_CLIENT_MEM_INFO *psMemInfo,
- IMG_UINT32 ui32Offset,
- IMG_UINT32 ui32Bytes,
- IMG_UINT32 ui32Flags);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpSync(IMG_CONST PVRSRV_CONNECTION *psConnection,
- IMG_PVOID pvAltLinAddr,
- PVRSRV_CLIENT_SYNC_INFO *psClientSyncInfo,
- IMG_UINT32 ui32Offset,
- IMG_UINT32 ui32Bytes);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpReg(IMG_CONST PVRSRV_DEV_DATA *psDevData,
- IMG_CHAR *pszRegRegion,
- IMG_UINT32 ui32RegAddr,
- IMG_UINT32 ui32RegValue,
- IMG_UINT32 ui32Flags);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpRegPolWithFlags(const PVRSRV_DEV_DATA *psDevData,
- IMG_CHAR *pszRegRegion,
- IMG_UINT32 ui32RegAddr,
- IMG_UINT32 ui32RegValue,
- IMG_UINT32 ui32Mask,
- IMG_UINT32 ui32Flags);
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpRegPol(const PVRSRV_DEV_DATA *psDevData,
- IMG_CHAR *pszRegRegion,
- IMG_UINT32 ui32RegAddr,
- IMG_UINT32 ui32RegValue,
- IMG_UINT32 ui32Mask);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpPDReg(IMG_CONST PVRSRV_CONNECTION *psConnection,
- IMG_UINT32 ui32RegAddr,
- IMG_UINT32 ui32RegValue);
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpPDDevPAddr(IMG_CONST PVRSRV_CONNECTION *psConnection,
- PVRSRV_CLIENT_MEM_INFO *psMemInfo,
- IMG_UINT32 ui32Offset,
- IMG_DEV_PHYADDR sPDDevPAddr);
-
-#if !defined(USE_CODE)
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpMemPages(IMG_CONST PVRSRV_DEV_DATA *psDevData,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hKernelMemInfo,
-#else
- IMG_HANDLE hKernelMemInfo,
-#endif
- IMG_DEV_PHYADDR *pPages,
- IMG_UINT32 ui32NumPages,
- IMG_DEV_VIRTADDR sDevVAddr,
- IMG_UINT32 ui32Start,
- IMG_UINT32 ui32Length,
- IMG_UINT32 ui32Flags);
-#endif
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpSetFrame(IMG_CONST PVRSRV_CONNECTION *psConnection,
- IMG_UINT32 ui32Frame);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpComment(IMG_CONST PVRSRV_CONNECTION *psConnection,
- IMG_CONST IMG_CHAR *pszComment,
- IMG_BOOL bContinuous);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpCommentf(IMG_CONST PVRSRV_CONNECTION *psConnection,
- IMG_BOOL bContinuous,
- IMG_CONST IMG_CHAR *pszFormat, ...)
-#if !defined(USE_CODE)
- IMG_FORMAT_PRINTF(3, 4)
-#endif
-;
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpCommentWithFlagsf(IMG_CONST PVRSRV_CONNECTION *psConnection,
- IMG_UINT32 ui32Flags,
- IMG_CONST IMG_CHAR *pszFormat, ...)
-#if !defined(USE_CODE)
- IMG_FORMAT_PRINTF(3, 4)
-#endif
-;
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpDriverInfo(IMG_CONST PVRSRV_CONNECTION *psConnection,
- IMG_CHAR *pszString,
- IMG_BOOL bContinuous);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpIsCapturing(IMG_CONST PVRSRV_CONNECTION *psConnection,
- IMG_BOOL *pbIsCapturing);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpRegRead(IMG_CONST PVRSRV_DEV_DATA *psDevData,
- IMG_CONST IMG_CHAR *pszRegRegion,
- IMG_CONST IMG_CHAR *pszFileName,
- IMG_UINT32 ui32FileOffset,
- IMG_UINT32 ui32Address,
- IMG_UINT32 ui32Size,
- IMG_UINT32 ui32PDumpFlags);
-
-
-IMG_IMPORT
-IMG_BOOL IMG_CALLCONV PVRSRVPDumpIsCapturingTest(IMG_CONST PVRSRV_CONNECTION *psConnection);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpCycleCountRegRead(IMG_CONST PVRSRV_DEV_DATA *psDevData,
- IMG_UINT32 ui32RegOffset,
- IMG_BOOL bLastFrame);
-
-IMG_IMPORT IMG_HANDLE PVRSRVLoadLibrary(const IMG_CHAR *pszLibraryName);
-IMG_IMPORT PVRSRV_ERROR PVRSRVUnloadLibrary(IMG_HANDLE hExtDrv);
-IMG_IMPORT PVRSRV_ERROR PVRSRVGetLibFuncAddr(IMG_HANDLE hExtDrv, const IMG_CHAR *pszFunctionName, IMG_VOID **ppvFuncAddr);
-
-IMG_IMPORT IMG_UINT32 PVRSRVClockus (void);
-IMG_IMPORT IMG_VOID PVRSRVWaitus (IMG_UINT32 ui32Timeus);
-IMG_IMPORT IMG_VOID PVRSRVReleaseThreadQuanta (void);
-IMG_IMPORT IMG_UINT32 IMG_CALLCONV PVRSRVGetCurrentProcessID(void);
-IMG_IMPORT IMG_CHAR * IMG_CALLCONV PVRSRVSetLocale(const IMG_CHAR *pszLocale);
-
-
-
-
-
-IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVCreateAppHintState(IMG_MODULE_ID eModuleID,
- const IMG_CHAR *pszAppName,
- IMG_VOID **ppvState);
-IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVFreeAppHintState(IMG_MODULE_ID eModuleID,
- IMG_VOID *pvHintState);
-
-IMG_IMPORT IMG_BOOL IMG_CALLCONV PVRSRVGetAppHint(IMG_VOID *pvHintState,
- const IMG_CHAR *pszHintName,
- IMG_DATA_TYPE eDataType,
- const IMG_VOID *pvDefault,
- IMG_VOID *pvReturn);
-
-IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVAllocUserModeMem (IMG_SIZE_T ui32Size);
-IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVCallocUserModeMem (IMG_SIZE_T ui32Size);
-IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVReallocUserModeMem (IMG_PVOID pvBase, IMG_SIZE_T uNewSize);
-IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVFreeUserModeMem (IMG_PVOID pvMem);
-IMG_IMPORT IMG_VOID PVRSRVMemCopy(IMG_VOID *pvDst, const IMG_VOID *pvSrc, IMG_SIZE_T ui32Size);
-IMG_IMPORT IMG_VOID PVRSRVMemSet(IMG_VOID *pvDest, IMG_UINT8 ui8Value, IMG_SIZE_T ui32Size);
-
-struct _PVRSRV_MUTEX_OPAQUE_STRUCT_;
-typedef struct _PVRSRV_MUTEX_OPAQUE_STRUCT_ *PVRSRV_MUTEX_HANDLE;
-
-IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateMutex(PVRSRV_MUTEX_HANDLE *phMutex);
-IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyMutex(PVRSRV_MUTEX_HANDLE hMutex);
-IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVLockMutex(PVRSRV_MUTEX_HANDLE hMutex);
-IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVUnlockMutex(PVRSRV_MUTEX_HANDLE hMutex);
-
-IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVLockProcessGlobalMutex(void);
-IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVUnlockProcessGlobalMutex(void);
-
-
-struct _PVRSRV_SEMAPHORE_OPAQUE_STRUCT_;
-typedef struct _PVRSRV_SEMAPHORE_OPAQUE_STRUCT_ *PVRSRV_SEMAPHORE_HANDLE;
-
-
- #define IMG_SEMAPHORE_WAIT_INFINITE ((IMG_UINT64)0xFFFFFFFFFFFFFFFFull)
-
-
-#if !defined(USE_CODE)
-
-#ifdef INLINE_IS_PRAGMA
-#pragma inline(PVRSRVCreateSemaphore)
-#endif
-static INLINE PVRSRV_ERROR PVRSRVCreateSemaphore(PVRSRV_SEMAPHORE_HANDLE *phSemaphore, IMG_INT iInitialCount)
-{
- PVR_UNREFERENCED_PARAMETER(iInitialCount);
- *phSemaphore = 0;
- return PVRSRV_OK;
-}
-
-#ifdef INLINE_IS_PRAGMA
-#pragma inline(PVRSRVDestroySemaphore)
-#endif
-static INLINE PVRSRV_ERROR PVRSRVDestroySemaphore(PVRSRV_SEMAPHORE_HANDLE hSemaphore)
-{
- PVR_UNREFERENCED_PARAMETER(hSemaphore);
- return PVRSRV_OK;
-}
-
-#ifdef INLINE_IS_PRAGMA
-#pragma inline(PVRSRVWaitSemaphore)
-#endif
-static INLINE PVRSRV_ERROR PVRSRVWaitSemaphore(PVRSRV_SEMAPHORE_HANDLE hSemaphore, IMG_UINT64 ui64TimeoutMicroSeconds)
-{
- PVR_UNREFERENCED_PARAMETER(hSemaphore);
- PVR_UNREFERENCED_PARAMETER(ui64TimeoutMicroSeconds);
- return PVRSRV_ERROR_INVALID_PARAMS;
-}
-
-#ifdef INLINE_IS_PRAGMA
-#pragma inline(PVRSRVPostSemaphore)
-#endif
-static INLINE IMG_VOID PVRSRVPostSemaphore(PVRSRV_SEMAPHORE_HANDLE hSemaphore, IMG_INT iPostCount)
-{
- PVR_UNREFERENCED_PARAMETER(hSemaphore);
- PVR_UNREFERENCED_PARAMETER(iPostCount);
-}
-
-#endif
-
-
-#if (defined(DEBUG) && defined(__linux__))
-IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVAllocUserModeMemTracking(IMG_SIZE_T ui32Size, IMG_CHAR *pszFileName, IMG_UINT32 ui32LineNumber);
-
-IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVCallocUserModeMemTracking(IMG_SIZE_T ui32Size, IMG_CHAR *pszFileName, IMG_UINT32 ui32LineNumber);
-
-IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVFreeUserModeMemTracking(IMG_VOID *pvMem);
-
-IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVReallocUserModeMemTracking(IMG_VOID *pvMem, IMG_SIZE_T ui32NewSize,
- IMG_CHAR *pszFileName, IMG_UINT32 ui32LineNumber);
-#endif
-
-IMG_IMPORT PVRSRV_ERROR PVRSRVEventObjectWait(const PVRSRV_CONNECTION *psConnection,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_EVENTSID hOSEvent);
-#else
- IMG_HANDLE hOSEvent);
-#endif
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateSyncInfoModObj(const PVRSRV_CONNECTION *psConnection,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID *phKernelSyncInfoModObj);
-#else
- IMG_HANDLE *phKernelSyncInfoModObj);
-#endif
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroySyncInfoModObj(const PVRSRV_CONNECTION *psConnection,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hKernelSyncInfoModObj);
-#else
- IMG_HANDLE hKernelSyncInfoModObj);
-#endif
-
-
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVModifyPendingSyncOps(const PVRSRV_CONNECTION *psConnection,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hKernelSyncInfoModObj,
-#else
- IMG_HANDLE hKernelSyncInfoModObj,
-#endif
- PVRSRV_CLIENT_SYNC_INFO *psSyncInfo,
- IMG_UINT32 ui32ModifyFlags,
- IMG_UINT32 *pui32ReadOpsPending,
- IMG_UINT32 *pui32WriteOpsPending);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVModifyCompleteSyncOps(const PVRSRV_CONNECTION *psConnection,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hKernelSyncInfoModObj);
-#else
- IMG_HANDLE hKernelSyncInfoModObj);
-#endif
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVSyncOpsTakeToken(const PVRSRV_CONNECTION *psConnection,
-#if defined (SUPPORT_SID_INTERFACE)
- const IMG_SID hKernelSyncInfo,
-#else
- const PVRSRV_CLIENT_SYNC_INFO *psSyncInfo,
-#endif
- PVRSRV_SYNC_TOKEN *psSyncToken);
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVSyncOpsFlushToToken(const PVRSRV_CONNECTION *psConnection,
-#if defined (SUPPORT_SID_INTERFACE)
- const IMG_SID hKernelSyncInfo,
-#else
- const PVRSRV_CLIENT_SYNC_INFO *psSyncInfo,
-#endif
- const PVRSRV_SYNC_TOKEN *psSyncToken,
- IMG_BOOL bWait);
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVSyncOpsFlushToModObj(const PVRSRV_CONNECTION *psConnection,
-#if defined (SUPPORT_SID_INTERFACE)
- IMG_SID hKernelSyncInfoModObj,
-#else
- IMG_HANDLE hKernelSyncInfoModObj,
-#endif
- IMG_BOOL bWait);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVSyncOpsFlushToDelta(const PVRSRV_CONNECTION *psConnection,
- PVRSRV_CLIENT_SYNC_INFO *psClientSyncInfo,
- IMG_UINT32 ui32Delta,
- IMG_BOOL bWait);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVAllocSyncInfo(IMG_CONST PVRSRV_DEV_DATA *psDevData,
- PVRSRV_CLIENT_SYNC_INFO **ppsSyncInfo);
-
-IMG_IMPORT
-PVRSRV_ERROR IMG_CALLCONV PVRSRVFreeSyncInfo(IMG_CONST PVRSRV_DEV_DATA *psDevData,
- PVRSRV_CLIENT_SYNC_INFO *psSyncInfo);
-
-IMG_IMPORT
-const IMG_CHAR *PVRSRVGetErrorString(PVRSRV_ERROR eError);
-
-
-#define TIME_NOT_PASSED_UINT32(a,b,c) (((a) - (b)) < (c))
-
-#if defined (__cplusplus)
-}
-#endif
-#endif
-
diff --git a/sys/pvr2d/pvr_includes/servicesext.h b/sys/pvr2d/pvr_includes/servicesext.h
deleted file mode 100644
index d32624511..000000000
--- a/sys/pvr2d/pvr_includes/servicesext.h
+++ /dev/null
@@ -1,855 +0,0 @@
-/**********************************************************************
-*
-* Copyright(c) Imagination Technologies Ltd.
-*
-* The contents of this file are subject to the MIT license as set out below.
-*
-* 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.
-*
-* This License is also included in this distribution in the file called
-* "COPYING".
-*
-******************************************************************************/
-
-
-
-#if !defined (__SERVICESEXT_H__)
-#define __SERVICESEXT_H__
-
-#define PVRSRV_LOCKFLG_READONLY (1)
-
-typedef enum _PVRSRV_ERROR_
-{
- PVRSRV_OK = 0,
- PVRSRV_ERROR_OUT_OF_MEMORY,
- PVRSRV_ERROR_TOO_FEW_BUFFERS,
- PVRSRV_ERROR_INVALID_PARAMS,
- PVRSRV_ERROR_INIT_FAILURE,
- PVRSRV_ERROR_CANT_REGISTER_CALLBACK,
- PVRSRV_ERROR_INVALID_DEVICE,
- PVRSRV_ERROR_NOT_OWNER,
- PVRSRV_ERROR_BAD_MAPPING,
- PVRSRV_ERROR_TIMEOUT,
- PVRSRV_ERROR_FLIP_CHAIN_EXISTS,
- PVRSRV_ERROR_INVALID_SWAPINTERVAL,
- PVRSRV_ERROR_SCENE_INVALID,
- PVRSRV_ERROR_STREAM_ERROR,
- PVRSRV_ERROR_FAILED_DEPENDENCIES,
- PVRSRV_ERROR_CMD_NOT_PROCESSED,
- PVRSRV_ERROR_CMD_TOO_BIG,
- PVRSRV_ERROR_DEVICE_REGISTER_FAILED,
- PVRSRV_ERROR_TOOMANYBUFFERS,
- PVRSRV_ERROR_NOT_SUPPORTED,
- PVRSRV_ERROR_PROCESSING_BLOCKED,
-
- PVRSRV_ERROR_CANNOT_FLUSH_QUEUE,
- PVRSRV_ERROR_CANNOT_GET_QUEUE_SPACE,
- PVRSRV_ERROR_CANNOT_GET_RENDERDETAILS,
- PVRSRV_ERROR_RETRY,
-
- PVRSRV_ERROR_DDK_VERSION_MISMATCH,
- PVRSRV_ERROR_BUILD_MISMATCH,
- PVRSRV_ERROR_CORE_REVISION_MISMATCH,
-
- PVRSRV_ERROR_UPLOAD_TOO_BIG,
-
- PVRSRV_ERROR_INVALID_FLAGS,
- PVRSRV_ERROR_FAILED_TO_REGISTER_PROCESS,
-
- PVRSRV_ERROR_UNABLE_TO_LOAD_LIBRARY,
- PVRSRV_ERROR_UNABLE_GET_FUNC_ADDR,
- PVRSRV_ERROR_UNLOAD_LIBRARY_FAILED,
-
- PVRSRV_ERROR_BRIDGE_CALL_FAILED,
- PVRSRV_ERROR_IOCTL_CALL_FAILED,
-
- PVRSRV_ERROR_MMU_CONTEXT_NOT_FOUND,
- PVRSRV_ERROR_BUFFER_DEVICE_NOT_FOUND,
- PVRSRV_ERROR_BUFFER_DEVICE_ALREADY_PRESENT,
-
- PVRSRV_ERROR_PCI_DEVICE_NOT_FOUND,
- PVRSRV_ERROR_PCI_CALL_FAILED,
- PVRSRV_ERROR_PCI_REGION_TOO_SMALL,
- PVRSRV_ERROR_PCI_REGION_UNAVAILABLE,
- PVRSRV_ERROR_BAD_REGION_SIZE_MISMATCH,
-
- PVRSRV_ERROR_REGISTER_BASE_NOT_SET,
-
- PVRSRV_ERROR_FAILED_TO_ALLOC_USER_MEM,
- PVRSRV_ERROR_FAILED_TO_ALLOC_VP_MEMORY,
- PVRSRV_ERROR_FAILED_TO_MAP_SHARED_PBDESC,
- PVRSRV_ERROR_FAILED_TO_GET_PHYS_ADDR,
-
- PVRSRV_ERROR_FAILED_TO_ALLOC_VIRT_MEMORY,
- PVRSRV_ERROR_FAILED_TO_COPY_VIRT_MEMORY,
-
- PVRSRV_ERROR_FAILED_TO_ALLOC_PAGES,
- PVRSRV_ERROR_FAILED_TO_FREE_PAGES,
- PVRSRV_ERROR_FAILED_TO_COPY_PAGES,
- PVRSRV_ERROR_UNABLE_TO_LOCK_PAGES,
- PVRSRV_ERROR_UNABLE_TO_UNLOCK_PAGES,
- PVRSRV_ERROR_STILL_MAPPED,
- PVRSRV_ERROR_MAPPING_NOT_FOUND,
- PVRSRV_ERROR_PHYS_ADDRESS_EXCEEDS_32BIT,
- PVRSRV_ERROR_FAILED_TO_MAP_PAGE_TABLE,
-
- PVRSRV_ERROR_INVALID_SEGMENT_BLOCK,
- PVRSRV_ERROR_INVALID_SGXDEVDATA,
- PVRSRV_ERROR_INVALID_DEVINFO,
- PVRSRV_ERROR_INVALID_MEMINFO,
- PVRSRV_ERROR_INVALID_MISCINFO,
- PVRSRV_ERROR_UNKNOWN_IOCTL,
- PVRSRV_ERROR_INVALID_CONTEXT,
- PVRSRV_ERROR_UNABLE_TO_DESTROY_CONTEXT,
- PVRSRV_ERROR_INVALID_HEAP,
- PVRSRV_ERROR_INVALID_KERNELINFO,
- PVRSRV_ERROR_UNKNOWN_POWER_STATE,
- PVRSRV_ERROR_INVALID_HANDLE_TYPE,
- PVRSRV_ERROR_INVALID_WRAP_TYPE,
- PVRSRV_ERROR_INVALID_PHYS_ADDR,
- PVRSRV_ERROR_INVALID_CPU_ADDR,
- PVRSRV_ERROR_INVALID_HEAPINFO,
- PVRSRV_ERROR_INVALID_PERPROC,
- PVRSRV_ERROR_FAILED_TO_RETRIEVE_HEAPINFO,
- PVRSRV_ERROR_INVALID_MAP_REQUEST,
- PVRSRV_ERROR_INVALID_UNMAP_REQUEST,
- PVRSRV_ERROR_UNABLE_TO_FIND_MAPPING_HEAP,
- PVRSRV_ERROR_MAPPING_STILL_IN_USE,
-
- PVRSRV_ERROR_EXCEEDED_HW_LIMITS,
- PVRSRV_ERROR_NO_STAGING_BUFFER_ALLOCATED,
-
- PVRSRV_ERROR_UNABLE_TO_CREATE_PERPROC_AREA,
- PVRSRV_ERROR_UNABLE_TO_CREATE_EVENT,
- PVRSRV_ERROR_UNABLE_TO_ENABLE_EVENT,
- PVRSRV_ERROR_UNABLE_TO_REGISTER_EVENT,
- PVRSRV_ERROR_UNABLE_TO_DESTROY_EVENT,
- PVRSRV_ERROR_UNABLE_TO_CREATE_THREAD,
- PVRSRV_ERROR_UNABLE_TO_CLOSE_THREAD,
- PVRSRV_ERROR_THREAD_READ_ERROR,
- PVRSRV_ERROR_UNABLE_TO_REGISTER_ISR_HANDLER,
- PVRSRV_ERROR_UNABLE_TO_INSTALL_ISR,
- PVRSRV_ERROR_UNABLE_TO_UNINSTALL_ISR,
- PVRSRV_ERROR_ISR_ALREADY_INSTALLED,
- PVRSRV_ERROR_ISR_NOT_INSTALLED,
- PVRSRV_ERROR_UNABLE_TO_INITIALISE_INTERRUPT,
- PVRSRV_ERROR_UNABLE_TO_RETRIEVE_INFO,
- PVRSRV_ERROR_UNABLE_TO_DO_BACKWARDS_BLIT,
- PVRSRV_ERROR_UNABLE_TO_CLOSE_SERVICES,
- PVRSRV_ERROR_UNABLE_TO_REGISTER_CONTEXT,
- PVRSRV_ERROR_UNABLE_TO_REGISTER_RESOURCE,
-
- PVRSRV_ERROR_INVALID_CCB_COMMAND,
-
- PVRSRV_ERROR_UNABLE_TO_LOCK_RESOURCE,
- PVRSRV_ERROR_INVALID_LOCK_ID,
- PVRSRV_ERROR_RESOURCE_NOT_LOCKED,
-
- PVRSRV_ERROR_FLIP_FAILED,
- PVRSRV_ERROR_UNBLANK_DISPLAY_FAILED,
-
- PVRSRV_ERROR_TIMEOUT_POLLING_FOR_VALUE,
-
- PVRSRV_ERROR_CREATE_RENDER_CONTEXT_FAILED,
- PVRSRV_ERROR_UNKNOWN_PRIMARY_FRAG,
- PVRSRV_ERROR_UNEXPECTED_SECONDARY_FRAG,
- PVRSRV_ERROR_UNEXPECTED_PRIMARY_FRAG,
-
- PVRSRV_ERROR_UNABLE_TO_INSERT_FENCE_ID,
-
- PVRSRV_ERROR_BLIT_SETUP_FAILED,
-
- PVRSRV_ERROR_PDUMP_NOT_AVAILABLE,
- PVRSRV_ERROR_PDUMP_BUFFER_FULL,
- PVRSRV_ERROR_PDUMP_BUF_OVERFLOW,
- PVRSRV_ERROR_PDUMP_NOT_ACTIVE,
- PVRSRV_ERROR_INCOMPLETE_LINE_OVERLAPS_PAGES,
-
- PVRSRV_ERROR_MUTEX_DESTROY_FAILED,
- PVRSRV_ERROR_MUTEX_INTERRUPTIBLE_ERROR,
-
- PVRSRV_ERROR_INSUFFICIENT_SCRIPT_SPACE,
- PVRSRV_ERROR_INSUFFICIENT_SPACE_FOR_COMMAND,
-
- PVRSRV_ERROR_PROCESS_NOT_INITIALISED,
- PVRSRV_ERROR_PROCESS_NOT_FOUND,
- PVRSRV_ERROR_SRV_CONNECT_FAILED,
- PVRSRV_ERROR_SRV_DISCONNECT_FAILED,
- PVRSRV_ERROR_DEINT_PHASE_FAILED,
- PVRSRV_ERROR_INIT2_PHASE_FAILED,
-
- PVRSRV_ERROR_UNABLE_TO_FIND_RESOURCE,
-
- PVRSRV_ERROR_NO_DC_DEVICES_FOUND,
- PVRSRV_ERROR_UNABLE_TO_OPEN_DC_DEVICE,
- PVRSRV_ERROR_UNABLE_TO_REMOVE_DEVICE,
- PVRSRV_ERROR_NO_DEVICEDATA_FOUND,
- PVRSRV_ERROR_NO_DEVICENODE_FOUND,
- PVRSRV_ERROR_NO_CLIENTNODE_FOUND,
- PVRSRV_ERROR_FAILED_TO_PROCESS_QUEUE,
-
- PVRSRV_ERROR_UNABLE_TO_INIT_TASK,
- PVRSRV_ERROR_UNABLE_TO_SCHEDULE_TASK,
- PVRSRV_ERROR_UNABLE_TO_KILL_TASK,
-
- PVRSRV_ERROR_UNABLE_TO_ENABLE_TIMER,
- PVRSRV_ERROR_UNABLE_TO_DISABLE_TIMER,
- PVRSRV_ERROR_UNABLE_TO_REMOVE_TIMER,
-
- PVRSRV_ERROR_UNKNOWN_PIXEL_FORMAT,
- PVRSRV_ERROR_UNKNOWN_SCRIPT_OPERATION,
-
- PVRSRV_ERROR_HANDLE_INDEX_OUT_OF_RANGE,
- PVRSRV_ERROR_HANDLE_NOT_ALLOCATED,
- PVRSRV_ERROR_HANDLE_TYPE_MISMATCH,
- PVRSRV_ERROR_UNABLE_TO_ADD_HANDLE,
- PVRSRV_ERROR_HANDLE_NOT_SHAREABLE,
- PVRSRV_ERROR_HANDLE_NOT_FOUND,
- PVRSRV_ERROR_INVALID_SUBHANDLE,
- PVRSRV_ERROR_HANDLE_BATCH_IN_USE,
- PVRSRV_ERROR_HANDLE_BATCH_COMMIT_FAILURE,
-
- PVRSRV_ERROR_UNABLE_TO_CREATE_HASH_TABLE,
- PVRSRV_ERROR_INSERT_HASH_TABLE_DATA_FAILED,
-
- PVRSRV_ERROR_UNSUPPORTED_BACKING_STORE,
- PVRSRV_ERROR_UNABLE_TO_DESTROY_BM_HEAP,
-
- PVRSRV_ERROR_UNKNOWN_INIT_SERVER_STATE,
-
- PVRSRV_ERROR_NO_FREE_DEVICEIDS_AVALIABLE,
- PVRSRV_ERROR_INVALID_DEVICEID,
- PVRSRV_ERROR_DEVICEID_NOT_FOUND,
-
- PVRSRV_ERROR_MEMORY_TEST_FAILED,
- PVRSRV_ERROR_CPUPADDR_TEST_FAILED,
- PVRSRV_ERROR_COPY_TEST_FAILED,
-
- PVRSRV_ERROR_SEMAPHORE_NOT_INITIALISED,
-
- PVRSRV_ERROR_UNABLE_TO_RELEASE_CLOCK,
- PVRSRV_ERROR_CLOCK_REQUEST_FAILED,
- PVRSRV_ERROR_DISABLE_CLOCK_FAILURE,
- PVRSRV_ERROR_UNABLE_TO_SET_CLOCK_RATE,
- PVRSRV_ERROR_UNABLE_TO_ROUND_CLOCK_RATE,
- PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK,
- PVRSRV_ERROR_UNABLE_TO_GET_CLOCK,
- PVRSRV_ERROR_UNABLE_TO_GET_PARENT_CLOCK,
- PVRSRV_ERROR_UNABLE_TO_GET_SYSTEM_CLOCK,
-
- PVRSRV_ERROR_UNKNOWN_SGL_ERROR,
-
- PVRSRV_ERROR_SYSTEM_POWER_CHANGE_FAILURE,
- PVRSRV_ERROR_DEVICE_POWER_CHANGE_FAILURE,
-
- PVRSRV_ERROR_BAD_SYNC_STATE,
-
- PVRSRV_ERROR_CACHEOP_FAILED,
-
- PVRSRV_ERROR_FORCE_I32 = 0x7fffffff
-
-} PVRSRV_ERROR;
-
-
-typedef enum _PVRSRV_DEVICE_CLASS_
-{
- PVRSRV_DEVICE_CLASS_3D = 0 ,
- PVRSRV_DEVICE_CLASS_DISPLAY = 1 ,
- PVRSRV_DEVICE_CLASS_BUFFER = 2 ,
- PVRSRV_DEVICE_CLASS_VIDEO = 3 ,
-
- PVRSRV_DEVICE_CLASS_FORCE_I32 = 0x7fffffff
-
-} PVRSRV_DEVICE_CLASS;
-
-
-typedef enum _PVRSRV_SYS_POWER_STATE_
-{
- PVRSRV_SYS_POWER_STATE_Unspecified = -1,
- PVRSRV_SYS_POWER_STATE_D0 = 0,
- PVRSRV_SYS_POWER_STATE_D1 = 1,
- PVRSRV_SYS_POWER_STATE_D2 = 2,
- PVRSRV_SYS_POWER_STATE_D3 = 3,
- PVRSRV_SYS_POWER_STATE_D4 = 4,
-
- PVRSRV_SYS_POWER_STATE_FORCE_I32 = 0x7fffffff
-
-} PVRSRV_SYS_POWER_STATE, *PPVRSRV_SYS_POWER_STATE;
-
-
-typedef enum _PVRSRV_DEV_POWER_STATE_
-{
- PVRSRV_DEV_POWER_STATE_DEFAULT = -1,
- PVRSRV_DEV_POWER_STATE_ON = 0,
- PVRSRV_DEV_POWER_STATE_IDLE = 1,
- PVRSRV_DEV_POWER_STATE_OFF = 2,
-
- PVRSRV_DEV_POWER_STATE_FORCE_I32 = 0x7fffffff
-
-} PVRSRV_DEV_POWER_STATE, *PPVRSRV_DEV_POWER_STATE;
-
-
-typedef PVRSRV_ERROR (*PFN_PRE_POWER) (IMG_HANDLE hDevHandle,
- PVRSRV_DEV_POWER_STATE eNewPowerState,
- PVRSRV_DEV_POWER_STATE eCurrentPowerState);
-typedef PVRSRV_ERROR (*PFN_POST_POWER) (IMG_HANDLE hDevHandle,
- PVRSRV_DEV_POWER_STATE eNewPowerState,
- PVRSRV_DEV_POWER_STATE eCurrentPowerState);
-
-typedef PVRSRV_ERROR (*PFN_PRE_CLOCKSPEED_CHANGE) (IMG_HANDLE hDevHandle,
- IMG_BOOL bIdleDevice,
- PVRSRV_DEV_POWER_STATE eCurrentPowerState);
-typedef PVRSRV_ERROR (*PFN_POST_CLOCKSPEED_CHANGE) (IMG_HANDLE hDevHandle,
- IMG_BOOL bIdleDevice,
- PVRSRV_DEV_POWER_STATE eCurrentPowerState);
-
-
-typedef enum _PVRSRV_PIXEL_FORMAT_ {
-
- PVRSRV_PIXEL_FORMAT_UNKNOWN = 0,
- PVRSRV_PIXEL_FORMAT_RGB565 = 1,
- PVRSRV_PIXEL_FORMAT_RGB555 = 2,
- PVRSRV_PIXEL_FORMAT_RGB888 = 3,
- PVRSRV_PIXEL_FORMAT_BGR888 = 4,
- PVRSRV_PIXEL_FORMAT_GREY_SCALE = 8,
- PVRSRV_PIXEL_FORMAT_PAL12 = 13,
- PVRSRV_PIXEL_FORMAT_PAL8 = 14,
- PVRSRV_PIXEL_FORMAT_PAL4 = 15,
- PVRSRV_PIXEL_FORMAT_PAL2 = 16,
- PVRSRV_PIXEL_FORMAT_PAL1 = 17,
- PVRSRV_PIXEL_FORMAT_ARGB1555 = 18,
- PVRSRV_PIXEL_FORMAT_ARGB4444 = 19,
- PVRSRV_PIXEL_FORMAT_ARGB8888 = 20,
- PVRSRV_PIXEL_FORMAT_ABGR8888 = 21,
- PVRSRV_PIXEL_FORMAT_YV12 = 22,
- PVRSRV_PIXEL_FORMAT_I420 = 23,
- PVRSRV_PIXEL_FORMAT_IMC2 = 25,
- PVRSRV_PIXEL_FORMAT_XRGB8888 = 26,
- PVRSRV_PIXEL_FORMAT_XBGR8888 = 27,
- PVRSRV_PIXEL_FORMAT_BGRA8888 = 28,
- PVRSRV_PIXEL_FORMAT_XRGB4444 = 29,
- PVRSRV_PIXEL_FORMAT_ARGB8332 = 30,
- PVRSRV_PIXEL_FORMAT_A2RGB10 = 31,
- PVRSRV_PIXEL_FORMAT_A2BGR10 = 32,
- PVRSRV_PIXEL_FORMAT_P8 = 33,
- PVRSRV_PIXEL_FORMAT_L8 = 34,
- PVRSRV_PIXEL_FORMAT_A8L8 = 35,
- PVRSRV_PIXEL_FORMAT_A4L4 = 36,
- PVRSRV_PIXEL_FORMAT_L16 = 37,
- PVRSRV_PIXEL_FORMAT_L6V5U5 = 38,
- PVRSRV_PIXEL_FORMAT_V8U8 = 39,
- PVRSRV_PIXEL_FORMAT_V16U16 = 40,
- PVRSRV_PIXEL_FORMAT_QWVU8888 = 41,
- PVRSRV_PIXEL_FORMAT_XLVU8888 = 42,
- PVRSRV_PIXEL_FORMAT_QWVU16 = 43,
- PVRSRV_PIXEL_FORMAT_D16 = 44,
- PVRSRV_PIXEL_FORMAT_D24S8 = 45,
- PVRSRV_PIXEL_FORMAT_D24X8 = 46,
-
-
- PVRSRV_PIXEL_FORMAT_ABGR16 = 47,
- PVRSRV_PIXEL_FORMAT_ABGR16F = 48,
- PVRSRV_PIXEL_FORMAT_ABGR32 = 49,
- PVRSRV_PIXEL_FORMAT_ABGR32F = 50,
- PVRSRV_PIXEL_FORMAT_B10GR11 = 51,
- PVRSRV_PIXEL_FORMAT_GR88 = 52,
- PVRSRV_PIXEL_FORMAT_BGR32 = 53,
- PVRSRV_PIXEL_FORMAT_GR32 = 54,
- PVRSRV_PIXEL_FORMAT_E5BGR9 = 55,
-
-
- PVRSRV_PIXEL_FORMAT_RESERVED1 = 56,
- PVRSRV_PIXEL_FORMAT_RESERVED2 = 57,
- PVRSRV_PIXEL_FORMAT_RESERVED3 = 58,
- PVRSRV_PIXEL_FORMAT_RESERVED4 = 59,
- PVRSRV_PIXEL_FORMAT_RESERVED5 = 60,
-
-
- PVRSRV_PIXEL_FORMAT_R8G8_B8G8 = 61,
- PVRSRV_PIXEL_FORMAT_G8R8_G8B8 = 62,
-
-
- PVRSRV_PIXEL_FORMAT_NV11 = 63,
- PVRSRV_PIXEL_FORMAT_NV12 = 64,
-
-
- PVRSRV_PIXEL_FORMAT_YUY2 = 65,
- PVRSRV_PIXEL_FORMAT_YUV420 = 66,
- PVRSRV_PIXEL_FORMAT_YUV444 = 67,
- PVRSRV_PIXEL_FORMAT_VUY444 = 68,
- PVRSRV_PIXEL_FORMAT_YUYV = 69,
- PVRSRV_PIXEL_FORMAT_YVYU = 70,
- PVRSRV_PIXEL_FORMAT_UYVY = 71,
- PVRSRV_PIXEL_FORMAT_VYUY = 72,
-
- PVRSRV_PIXEL_FORMAT_FOURCC_ORG_UYVY = 73,
- PVRSRV_PIXEL_FORMAT_FOURCC_ORG_YUYV = 74,
- PVRSRV_PIXEL_FORMAT_FOURCC_ORG_YVYU = 75,
- PVRSRV_PIXEL_FORMAT_FOURCC_ORG_VYUY = 76,
- PVRSRV_PIXEL_FORMAT_FOURCC_ORG_AYUV = 77,
-
-
- PVRSRV_PIXEL_FORMAT_A32B32G32R32 = 78,
- PVRSRV_PIXEL_FORMAT_A32B32G32R32F = 79,
- PVRSRV_PIXEL_FORMAT_A32B32G32R32_UINT = 80,
- PVRSRV_PIXEL_FORMAT_A32B32G32R32_SINT = 81,
-
-
- PVRSRV_PIXEL_FORMAT_B32G32R32 = 82,
- PVRSRV_PIXEL_FORMAT_B32G32R32F = 83,
- PVRSRV_PIXEL_FORMAT_B32G32R32_UINT = 84,
- PVRSRV_PIXEL_FORMAT_B32G32R32_SINT = 85,
-
-
- PVRSRV_PIXEL_FORMAT_G32R32 = 86,
- PVRSRV_PIXEL_FORMAT_G32R32F = 87,
- PVRSRV_PIXEL_FORMAT_G32R32_UINT = 88,
- PVRSRV_PIXEL_FORMAT_G32R32_SINT = 89,
-
-
- PVRSRV_PIXEL_FORMAT_D32F = 90,
- PVRSRV_PIXEL_FORMAT_R32 = 91,
- PVRSRV_PIXEL_FORMAT_R32F = 92,
- PVRSRV_PIXEL_FORMAT_R32_UINT = 93,
- PVRSRV_PIXEL_FORMAT_R32_SINT = 94,
-
-
- PVRSRV_PIXEL_FORMAT_A16B16G16R16 = 95,
- PVRSRV_PIXEL_FORMAT_A16B16G16R16F = 96,
- PVRSRV_PIXEL_FORMAT_A16B16G16R16_SINT = 97,
- PVRSRV_PIXEL_FORMAT_A16B16G16R16_SNORM = 98,
- PVRSRV_PIXEL_FORMAT_A16B16G16R16_UINT = 99,
- PVRSRV_PIXEL_FORMAT_A16B16G16R16_UNORM = 100,
-
-
- PVRSRV_PIXEL_FORMAT_G16R16 = 101,
- PVRSRV_PIXEL_FORMAT_G16R16F = 102,
- PVRSRV_PIXEL_FORMAT_G16R16_UINT = 103,
- PVRSRV_PIXEL_FORMAT_G16R16_UNORM = 104,
- PVRSRV_PIXEL_FORMAT_G16R16_SINT = 105,
- PVRSRV_PIXEL_FORMAT_G16R16_SNORM = 106,
-
-
- PVRSRV_PIXEL_FORMAT_R16 = 107,
- PVRSRV_PIXEL_FORMAT_R16F = 108,
- PVRSRV_PIXEL_FORMAT_R16_UINT = 109,
- PVRSRV_PIXEL_FORMAT_R16_UNORM = 110,
- PVRSRV_PIXEL_FORMAT_R16_SINT = 111,
- PVRSRV_PIXEL_FORMAT_R16_SNORM = 112,
-
-
- PVRSRV_PIXEL_FORMAT_X8R8G8B8 = 113,
- PVRSRV_PIXEL_FORMAT_X8R8G8B8_UNORM = 114,
- PVRSRV_PIXEL_FORMAT_X8R8G8B8_UNORM_SRGB = 115,
-
- PVRSRV_PIXEL_FORMAT_A8R8G8B8 = 116,
- PVRSRV_PIXEL_FORMAT_A8R8G8B8_UNORM = 117,
- PVRSRV_PIXEL_FORMAT_A8R8G8B8_UNORM_SRGB = 118,
-
- PVRSRV_PIXEL_FORMAT_A8B8G8R8 = 119,
- PVRSRV_PIXEL_FORMAT_A8B8G8R8_UINT = 120,
- PVRSRV_PIXEL_FORMAT_A8B8G8R8_UNORM = 121,
- PVRSRV_PIXEL_FORMAT_A8B8G8R8_UNORM_SRGB = 122,
- PVRSRV_PIXEL_FORMAT_A8B8G8R8_SINT = 123,
- PVRSRV_PIXEL_FORMAT_A8B8G8R8_SNORM = 124,
-
-
- PVRSRV_PIXEL_FORMAT_G8R8 = 125,
- PVRSRV_PIXEL_FORMAT_G8R8_UINT = 126,
- PVRSRV_PIXEL_FORMAT_G8R8_UNORM = 127,
- PVRSRV_PIXEL_FORMAT_G8R8_SINT = 128,
- PVRSRV_PIXEL_FORMAT_G8R8_SNORM = 129,
-
-
- PVRSRV_PIXEL_FORMAT_A8 = 130,
- PVRSRV_PIXEL_FORMAT_R8 = 131,
- PVRSRV_PIXEL_FORMAT_R8_UINT = 132,
- PVRSRV_PIXEL_FORMAT_R8_UNORM = 133,
- PVRSRV_PIXEL_FORMAT_R8_SINT = 134,
- PVRSRV_PIXEL_FORMAT_R8_SNORM = 135,
-
-
- PVRSRV_PIXEL_FORMAT_A2B10G10R10 = 136,
- PVRSRV_PIXEL_FORMAT_A2B10G10R10_UNORM = 137,
- PVRSRV_PIXEL_FORMAT_A2B10G10R10_UINT = 138,
-
-
- PVRSRV_PIXEL_FORMAT_B10G11R11 = 139,
- PVRSRV_PIXEL_FORMAT_B10G11R11F = 140,
-
-
- PVRSRV_PIXEL_FORMAT_X24G8R32 = 141,
- PVRSRV_PIXEL_FORMAT_G8R24 = 142,
- PVRSRV_PIXEL_FORMAT_X8R24 = 143,
- PVRSRV_PIXEL_FORMAT_E5B9G9R9 = 144,
- PVRSRV_PIXEL_FORMAT_R1 = 145,
-
- PVRSRV_PIXEL_FORMAT_RESERVED6 = 146,
- PVRSRV_PIXEL_FORMAT_RESERVED7 = 147,
- PVRSRV_PIXEL_FORMAT_RESERVED8 = 148,
- PVRSRV_PIXEL_FORMAT_RESERVED9 = 149,
- PVRSRV_PIXEL_FORMAT_RESERVED10 = 150,
- PVRSRV_PIXEL_FORMAT_RESERVED11 = 151,
- PVRSRV_PIXEL_FORMAT_RESERVED12 = 152,
- PVRSRV_PIXEL_FORMAT_RESERVED13 = 153,
- PVRSRV_PIXEL_FORMAT_RESERVED14 = 154,
- PVRSRV_PIXEL_FORMAT_RESERVED15 = 155,
- PVRSRV_PIXEL_FORMAT_RESERVED16 = 156,
- PVRSRV_PIXEL_FORMAT_RESERVED17 = 157,
- PVRSRV_PIXEL_FORMAT_RESERVED18 = 158,
- PVRSRV_PIXEL_FORMAT_RESERVED19 = 159,
- PVRSRV_PIXEL_FORMAT_RESERVED20 = 160,
-
-
- PVRSRV_PIXEL_FORMAT_UBYTE4 = 161,
- PVRSRV_PIXEL_FORMAT_SHORT4 = 162,
- PVRSRV_PIXEL_FORMAT_SHORT4N = 163,
- PVRSRV_PIXEL_FORMAT_USHORT4N = 164,
- PVRSRV_PIXEL_FORMAT_SHORT2N = 165,
- PVRSRV_PIXEL_FORMAT_SHORT2 = 166,
- PVRSRV_PIXEL_FORMAT_USHORT2N = 167,
- PVRSRV_PIXEL_FORMAT_UDEC3 = 168,
- PVRSRV_PIXEL_FORMAT_DEC3N = 169,
- PVRSRV_PIXEL_FORMAT_F16_2 = 170,
- PVRSRV_PIXEL_FORMAT_F16_4 = 171,
-
-
- PVRSRV_PIXEL_FORMAT_L_F16 = 172,
- PVRSRV_PIXEL_FORMAT_L_F16_REP = 173,
- PVRSRV_PIXEL_FORMAT_L_F16_A_F16 = 174,
- PVRSRV_PIXEL_FORMAT_A_F16 = 175,
- PVRSRV_PIXEL_FORMAT_B16G16R16F = 176,
-
- PVRSRV_PIXEL_FORMAT_L_F32 = 177,
- PVRSRV_PIXEL_FORMAT_A_F32 = 178,
- PVRSRV_PIXEL_FORMAT_L_F32_A_F32 = 179,
-
-
- PVRSRV_PIXEL_FORMAT_PVRTC2 = 180,
- PVRSRV_PIXEL_FORMAT_PVRTC4 = 181,
- PVRSRV_PIXEL_FORMAT_PVRTCII2 = 182,
- PVRSRV_PIXEL_FORMAT_PVRTCII4 = 183,
- PVRSRV_PIXEL_FORMAT_PVRTCIII = 184,
- PVRSRV_PIXEL_FORMAT_PVRO8 = 185,
- PVRSRV_PIXEL_FORMAT_PVRO88 = 186,
- PVRSRV_PIXEL_FORMAT_PT1 = 187,
- PVRSRV_PIXEL_FORMAT_PT2 = 188,
- PVRSRV_PIXEL_FORMAT_PT4 = 189,
- PVRSRV_PIXEL_FORMAT_PT8 = 190,
- PVRSRV_PIXEL_FORMAT_PTW = 191,
- PVRSRV_PIXEL_FORMAT_PTB = 192,
- PVRSRV_PIXEL_FORMAT_MONO8 = 193,
- PVRSRV_PIXEL_FORMAT_MONO16 = 194,
-
-
- PVRSRV_PIXEL_FORMAT_C0_YUYV = 195,
- PVRSRV_PIXEL_FORMAT_C0_UYVY = 196,
- PVRSRV_PIXEL_FORMAT_C0_YVYU = 197,
- PVRSRV_PIXEL_FORMAT_C0_VYUY = 198,
- PVRSRV_PIXEL_FORMAT_C1_YUYV = 199,
- PVRSRV_PIXEL_FORMAT_C1_UYVY = 200,
- PVRSRV_PIXEL_FORMAT_C1_YVYU = 201,
- PVRSRV_PIXEL_FORMAT_C1_VYUY = 202,
-
-
- PVRSRV_PIXEL_FORMAT_C0_YUV420_2P_UV = 203,
- PVRSRV_PIXEL_FORMAT_C0_YUV420_2P_VU = 204,
- PVRSRV_PIXEL_FORMAT_C0_YUV420_3P = 205,
- PVRSRV_PIXEL_FORMAT_C1_YUV420_2P_UV = 206,
- PVRSRV_PIXEL_FORMAT_C1_YUV420_2P_VU = 207,
- PVRSRV_PIXEL_FORMAT_C1_YUV420_3P = 208,
-
- PVRSRV_PIXEL_FORMAT_A2B10G10R10F = 209,
- PVRSRV_PIXEL_FORMAT_B8G8R8_SINT = 210,
- PVRSRV_PIXEL_FORMAT_PVRF32SIGNMASK = 211,
-
- PVRSRV_PIXEL_FORMAT_ABGR4444 = 212,
- PVRSRV_PIXEL_FORMAT_ABGR1555 = 213,
- PVRSRV_PIXEL_FORMAT_BGR565 = 214,
-
- PVRSRV_PIXEL_FORMAT_FORCE_I32 = 0x7fffffff
-
-} PVRSRV_PIXEL_FORMAT;
-
-typedef enum _PVRSRV_ALPHA_FORMAT_ {
- PVRSRV_ALPHA_FORMAT_UNKNOWN = 0x00000000,
- PVRSRV_ALPHA_FORMAT_PRE = 0x00000001,
- PVRSRV_ALPHA_FORMAT_NONPRE = 0x00000002,
- PVRSRV_ALPHA_FORMAT_MASK = 0x0000000F,
-} PVRSRV_ALPHA_FORMAT;
-
-typedef enum _PVRSRV_COLOURSPACE_FORMAT_ {
- PVRSRV_COLOURSPACE_FORMAT_UNKNOWN = 0x00000000,
- PVRSRV_COLOURSPACE_FORMAT_LINEAR = 0x00010000,
- PVRSRV_COLOURSPACE_FORMAT_NONLINEAR = 0x00020000,
- PVRSRV_COLOURSPACE_FORMAT_MASK = 0x000F0000,
-} PVRSRV_COLOURSPACE_FORMAT;
-
-
-typedef enum _PVRSRV_ROTATION_ {
- PVRSRV_ROTATE_0 = 0,
- PVRSRV_ROTATE_90 = 1,
- PVRSRV_ROTATE_180 = 2,
- PVRSRV_ROTATE_270 = 3,
- PVRSRV_FLIP_Y
-
-} PVRSRV_ROTATION;
-
-#define PVRSRV_CREATE_SWAPCHAIN_SHARED (1<<0)
-#define PVRSRV_CREATE_SWAPCHAIN_QUERY (1<<1)
-#define PVRSRV_CREATE_SWAPCHAIN_OEMOVERLAY (1<<2)
-
-typedef struct _PVRSRV_SYNC_DATA_
-{
-
- IMG_UINT32 ui32WriteOpsPending;
- volatile IMG_UINT32 ui32WriteOpsComplete;
-
-
- IMG_UINT32 ui32ReadOpsPending;
- volatile IMG_UINT32 ui32ReadOpsComplete;
-
-
- IMG_UINT32 ui32LastOpDumpVal;
- IMG_UINT32 ui32LastReadOpDumpVal;
-
-} PVRSRV_SYNC_DATA;
-
-typedef struct _PVRSRV_CLIENT_SYNC_INFO_
-{
-
- PVRSRV_SYNC_DATA *psSyncData;
-
-
-
-
-
- IMG_DEV_VIRTADDR sWriteOpsCompleteDevVAddr;
-
-
- IMG_DEV_VIRTADDR sReadOpsCompleteDevVAddr;
-
-
- IMG_HANDLE hMappingInfo;
-
-
- IMG_HANDLE hKernelSyncInfo;
-
-} PVRSRV_CLIENT_SYNC_INFO, *PPVRSRV_CLIENT_SYNC_INFO;
-
-typedef struct PVRSRV_RESOURCE_TAG
-{
- volatile IMG_UINT32 ui32Lock;
- IMG_UINT32 ui32ID;
-}PVRSRV_RESOURCE;
-typedef PVRSRV_RESOURCE PVRSRV_RES_HANDLE;
-
-
-typedef IMG_VOID (*PFN_CMD_COMPLETE) (IMG_HANDLE);
-typedef IMG_VOID (**PPFN_CMD_COMPLETE) (IMG_HANDLE);
-
-typedef IMG_BOOL (*PFN_CMD_PROC) (IMG_HANDLE, IMG_UINT32, IMG_VOID*);
-typedef IMG_BOOL (**PPFN_CMD_PROC) (IMG_HANDLE, IMG_UINT32, IMG_VOID*);
-
-
-typedef struct _IMG_RECT_
-{
- IMG_INT32 x0;
- IMG_INT32 y0;
- IMG_INT32 x1;
- IMG_INT32 y1;
-}IMG_RECT;
-
-typedef struct _IMG_RECT_16_
-{
- IMG_INT16 x0;
- IMG_INT16 y0;
- IMG_INT16 x1;
- IMG_INT16 y1;
-}IMG_RECT_16;
-
-
-typedef PVRSRV_ERROR (*PFN_GET_BUFFER_ADDR)(IMG_HANDLE,
- IMG_HANDLE,
- IMG_SYS_PHYADDR**,
- IMG_SIZE_T*,
- IMG_VOID**,
- IMG_HANDLE*,
- IMG_BOOL*,
- IMG_UINT32*);
-
-
-typedef struct DISPLAY_DIMS_TAG
-{
- IMG_UINT32 ui32ByteStride;
- IMG_UINT32 ui32Width;
- IMG_UINT32 ui32Height;
-} DISPLAY_DIMS;
-
-
-typedef struct DISPLAY_FORMAT_TAG
-{
-
- PVRSRV_PIXEL_FORMAT pixelformat;
-} DISPLAY_FORMAT;
-
-typedef struct DISPLAY_SURF_ATTRIBUTES_TAG
-{
-
- PVRSRV_PIXEL_FORMAT pixelformat;
-
- DISPLAY_DIMS sDims;
-} DISPLAY_SURF_ATTRIBUTES;
-
-
-typedef struct DISPLAY_MODE_INFO_TAG
-{
-
- PVRSRV_PIXEL_FORMAT pixelformat;
-
- DISPLAY_DIMS sDims;
-
- IMG_UINT32 ui32RefreshHZ;
-
- IMG_UINT32 ui32OEMFlags;
-} DISPLAY_MODE_INFO;
-
-
-
-#define MAX_DISPLAY_NAME_SIZE (50)
-
-typedef struct DISPLAY_INFO_TAG
-{
-
- IMG_UINT32 ui32MaxSwapChains;
-
- IMG_UINT32 ui32MaxSwapChainBuffers;
-
- IMG_UINT32 ui32MinSwapInterval;
-
- IMG_UINT32 ui32MaxSwapInterval;
-
- IMG_UINT32 ui32PhysicalWidthmm;
- IMG_UINT32 ui32PhysicalHeightmm;
-
- IMG_CHAR szDisplayName[MAX_DISPLAY_NAME_SIZE];
-#if defined(SUPPORT_HW_CURSOR)
-
- IMG_UINT16 ui32CursorWidth;
- IMG_UINT16 ui32CursorHeight;
-#endif
-} DISPLAY_INFO;
-
-typedef struct ACCESS_INFO_TAG
-{
- IMG_UINT32 ui32Size;
- IMG_UINT32 ui32FBPhysBaseAddress;
- IMG_UINT32 ui32FBMemAvailable;
- IMG_UINT32 ui32SysPhysBaseAddress;
- IMG_UINT32 ui32SysSize;
- IMG_UINT32 ui32DevIRQ;
-}ACCESS_INFO;
-
-
-typedef struct PVRSRV_CURSOR_SHAPE_TAG
-{
- IMG_UINT16 ui16Width;
- IMG_UINT16 ui16Height;
- IMG_INT16 i16XHot;
- IMG_INT16 i16YHot;
-
-
- IMG_VOID* pvMask;
- IMG_INT16 i16MaskByteStride;
-
-
- IMG_VOID* pvColour;
- IMG_INT16 i16ColourByteStride;
- PVRSRV_PIXEL_FORMAT eColourPixelFormat;
-} PVRSRV_CURSOR_SHAPE;
-
-#define PVRSRV_SET_CURSOR_VISIBILITY (1<<0)
-#define PVRSRV_SET_CURSOR_POSITION (1<<1)
-#define PVRSRV_SET_CURSOR_SHAPE (1<<2)
-#define PVRSRV_SET_CURSOR_ROTATION (1<<3)
-
-typedef struct PVRSRV_CURSOR_INFO_TAG
-{
-
- IMG_UINT32 ui32Flags;
-
-
- IMG_BOOL bVisible;
-
-
- IMG_INT16 i16XPos;
- IMG_INT16 i16YPos;
-
-
- PVRSRV_CURSOR_SHAPE sCursorShape;
-
-
- IMG_UINT32 ui32Rotation;
-
-} PVRSRV_CURSOR_INFO;
-
-
-typedef struct _PVRSRV_REGISTRY_INFO_
-{
- IMG_UINT32 ui32DevCookie;
- IMG_PCHAR pszKey;
- IMG_PCHAR pszValue;
- IMG_PCHAR pszBuf;
- IMG_UINT32 ui32BufSize;
-} PVRSRV_REGISTRY_INFO, *PPVRSRV_REGISTRY_INFO;
-
-
-PVRSRV_ERROR IMG_CALLCONV PVRSRVReadRegistryString (PPVRSRV_REGISTRY_INFO psRegInfo);
-PVRSRV_ERROR IMG_CALLCONV PVRSRVWriteRegistryString (PPVRSRV_REGISTRY_INFO psRegInfo);
-
-
-#define PVRSRV_BC_FLAGS_YUVCSC_CONFORMANT_RANGE (0 << 0)
-#define PVRSRV_BC_FLAGS_YUVCSC_FULL_RANGE (1 << 0)
-
-#define PVRSRV_BC_FLAGS_YUVCSC_BT601 (0 << 1)
-#define PVRSRV_BC_FLAGS_YUVCSC_BT709 (1 << 1)
-
-#define MAX_BUFFER_DEVICE_NAME_SIZE (50)
-
-typedef struct BUFFER_INFO_TAG
-{
- IMG_UINT32 ui32BufferCount;
- IMG_UINT32 ui32BufferDeviceID;
- PVRSRV_PIXEL_FORMAT pixelformat;
- IMG_UINT32 ui32ByteStride;
- IMG_UINT32 ui32Width;
- IMG_UINT32 ui32Height;
- IMG_UINT32 ui32Flags;
- IMG_CHAR szDeviceName[MAX_BUFFER_DEVICE_NAME_SIZE];
-} BUFFER_INFO;
-
-typedef enum _OVERLAY_DEINTERLACE_MODE_
-{
- WEAVE=0x0,
- BOB_ODD,
- BOB_EVEN,
- BOB_EVEN_NONINTERLEAVED
-} OVERLAY_DEINTERLACE_MODE;
-
-#endif
diff --git a/sys/pvr2d/pvr_includes/wsegl.h b/sys/pvr2d/pvr_includes/wsegl.h
deleted file mode 100644
index e5191ec4d..000000000
--- a/sys/pvr2d/pvr_includes/wsegl.h
+++ /dev/null
@@ -1,285 +0,0 @@
-/**********************************************************************
-*
-* Copyright(c) Imagination Technologies Ltd.
-*
-* The contents of this file are subject to the MIT license as set out below.
-*
-* 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.
-*
-* This License is also included in this distribution in the file called
-* "COPYING".
-*
-******************************************************************************/
-
-
-
-#if !defined(__WSEGL_H__)
-#define __WSEGL_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-// WSEGL Platform-specific definitions
-*/
-#if defined(__linux__)
-#define WSEGL_EXPORT __attribute__((visibility("default")))
-#define WSEGL_IMPORT
-#else
-#define WSEGL_EXPORT
-#define WSEGL_IMPORT
-#endif
-
-/*
-// WSEGL API Version Number
-*/
-
-#define WSEGL_VERSION 2
-#define WSEGL_DEFAULT_DISPLAY 0
-#define WSEGL_DEFAULT_NATIVE_ENGINE 0
-
-#define WSEGL_FALSE 0
-#define WSEGL_TRUE 1
-#define WSEGL_NULL 0
-
-#define WSEGL_UNREFERENCED_PARAMETER(param) (param) = (param)
-
-/*
-// WSEGL handles
-*/
-typedef void *WSEGLDisplayHandle;
-typedef void *WSEGLDrawableHandle;
-
-/*
-// Display capability type
-*/
-typedef enum WSEGLCapsType_TAG
-{
- WSEGL_NO_CAPS = 0,
- WSEGL_CAP_MIN_SWAP_INTERVAL = 1, /* System default value = 1 */
- WSEGL_CAP_MAX_SWAP_INTERVAL = 2, /* System default value = 1 */
- WSEGL_CAP_WINDOWS_USE_HW_SYNC = 3, /* System default value = 0 (FALSE) */
- WSEGL_CAP_PIXMAPS_USE_HW_SYNC = 4, /* System default value = 0 (FALSE) */
-
-} WSEGLCapsType;
-
-/*
-// Display capability
-*/
-typedef struct WSEGLCaps_TAG
-{
- WSEGLCapsType eCapsType;
- unsigned long ui32CapsValue;
-
-} WSEGLCaps;
-
-/*
-// Drawable type
-*/
-#define WSEGL_NO_DRAWABLE 0x0
-#define WSEGL_DRAWABLE_WINDOW 0x1
-#define WSEGL_DRAWABLE_PIXMAP 0x2
-
-
-/*
-// Pixel format of display/drawable
-*/
-typedef enum WSEGLPixelFormat_TAG
-{
- /* These must not be re-ordered */
- WSEGL_PIXELFORMAT_RGB565 = 0,
- WSEGL_PIXELFORMAT_ARGB4444 = 1,
- WSEGL_PIXELFORMAT_ARGB8888 = 2,
- WSEGL_PIXELFORMAT_ARGB1555 = 3,
- WSEGL_PIXELFORMAT_ABGR8888 = 4,
- WSEGL_PIXELFORMAT_XBGR8888 = 5,
-
- /* These are compatibility names only; new WSEGL
- * modules should not use them.
- */
- WSEGL_PIXELFORMAT_565 = WSEGL_PIXELFORMAT_RGB565,
- WSEGL_PIXELFORMAT_4444 = WSEGL_PIXELFORMAT_ARGB4444,
- WSEGL_PIXELFORMAT_8888 = WSEGL_PIXELFORMAT_ARGB8888,
- WSEGL_PIXELFORMAT_1555 = WSEGL_PIXELFORMAT_ARGB1555,
-
-} WSEGLPixelFormat;
-
-/*
-// Transparent of display/drawable
-*/
-typedef enum WSEGLTransparentType_TAG
-{
- WSEGL_OPAQUE = 0,
- WSEGL_COLOR_KEY = 1,
-
-} WSEGLTransparentType;
-
-/*
-// Display/drawable configuration
-*/
-typedef struct WSEGLConfig_TAG
-{
- /*
- // Type of drawables this configuration applies to -
- // OR'd values of drawable types.
- */
- unsigned long ui32DrawableType;
-
- /* Pixel format */
- WSEGLPixelFormat ePixelFormat;
-
- /* Native Renderable - set to WSEGL_TRUE if native renderable */
- unsigned long ulNativeRenderable;
-
- /* FrameBuffer Level Parameter */
- unsigned long ulFrameBufferLevel;
-
- /* Native Visual ID */
- unsigned long ulNativeVisualID;
-
- /* Native Visual */
- void *hNativeVisual;
-
- /* Transparent Type */
- WSEGLTransparentType eTransparentType;
-
- /* Transparent Color - only used if transparent type is COLOR_KEY */
- unsigned long ulTransparentColor; /* packed as 0x00RRGGBB */
-
-
-} WSEGLConfig;
-
-/*
-// WSEGL errors
-*/
-typedef enum WSEGLError_TAG
-{
- WSEGL_SUCCESS = 0,
- WSEGL_CANNOT_INITIALISE = 1,
- WSEGL_BAD_NATIVE_DISPLAY = 2,
- WSEGL_BAD_NATIVE_WINDOW = 3,
- WSEGL_BAD_NATIVE_PIXMAP = 4,
- WSEGL_BAD_NATIVE_ENGINE = 5,
- WSEGL_BAD_DRAWABLE = 6,
- WSEGL_BAD_MATCH = 7,
- WSEGL_OUT_OF_MEMORY = 8,
-
- /* These are compatibility names only; new WSEGL
- * modules should not use them.
- */
- WSEGL_BAD_CONFIG = WSEGL_BAD_MATCH,
-
-} WSEGLError;
-
-/*
-// Drawable orientation (in degrees anti-clockwise)
-*/
-typedef enum WSEGLRotationAngle_TAG
-{
- WSEGL_ROTATE_0 = 0,
- WSEGL_ROTATE_90 = 1,
- WSEGL_ROTATE_180 = 2,
- WSEGL_ROTATE_270 = 3
-
-} WSEGLRotationAngle;
-
-/*
-// Drawable information required by OpenGL-ES driver
-*/
-typedef struct WSEGLDrawableParams_TAG
-{
- /* Width in pixels of the drawable */
- unsigned long ui32Width;
-
- /* Height in pixels of the drawable */
- unsigned long ui32Height;
-
- /* Stride in pixels of the drawable */
- unsigned long ui32Stride;
-
- /* Pixel format of the drawable */
- WSEGLPixelFormat ePixelFormat;
-
- /* User space cpu virtual address of the drawable */
- void *pvLinearAddress;
-
- /* HW address of the drawable */
- unsigned long ui32HWAddress;
-
- /* Private data for the drawable */
- void *hPrivateData;
-
-
-} WSEGLDrawableParams;
-
-
-/*
-// Table of function pointers that is returned by WSEGL_GetFunctionTablePointer()
-//
-// The first entry in the table is the version number of the wsegl.h header file that
-// the module has been written against, and should therefore be set to WSEGL_VERSION
-*/
-typedef struct WSEGL_FunctionTable_TAG
-{
- unsigned long ui32WSEGLVersion;
-
- WSEGLError (*pfnWSEGL_IsDisplayValid)(NativeDisplayType);
-
- WSEGLError (*pfnWSEGL_InitialiseDisplay)(NativeDisplayType, WSEGLDisplayHandle *, const WSEGLCaps **, WSEGLConfig **);
-
- WSEGLError (*pfnWSEGL_CloseDisplay)(WSEGLDisplayHandle);
-
- WSEGLError (*pfnWSEGL_CreateWindowDrawable)(WSEGLDisplayHandle, WSEGLConfig *, WSEGLDrawableHandle *, NativeWindowType, WSEGLRotationAngle *);
-
- WSEGLError (*pfnWSEGL_CreatePixmapDrawable)(WSEGLDisplayHandle, WSEGLConfig *, WSEGLDrawableHandle *, NativePixmapType, WSEGLRotationAngle *);
-
- WSEGLError (*pfnWSEGL_DeleteDrawable)(WSEGLDrawableHandle);
-
- WSEGLError (*pfnWSEGL_SwapDrawable)(WSEGLDrawableHandle, unsigned long);
-
- WSEGLError (*pfnWSEGL_SwapControlInterval)(WSEGLDrawableHandle, unsigned long);
-
- WSEGLError (*pfnWSEGL_WaitNative)(WSEGLDrawableHandle, unsigned long);
-
- WSEGLError (*pfnWSEGL_CopyFromDrawable)(WSEGLDrawableHandle, NativePixmapType);
-
- WSEGLError (*pfnWSEGL_CopyFromPBuffer)(void *, unsigned long, unsigned long, unsigned long, WSEGLPixelFormat, NativePixmapType);
-
- WSEGLError (*pfnWSEGL_GetDrawableParameters)(WSEGLDrawableHandle, WSEGLDrawableParams *, WSEGLDrawableParams *);
-
- WSEGLError (*pfnWSEGL_ConnectDrawable)(WSEGLDrawableHandle);
-
- WSEGLError (*pfnWSEGL_DisconnectDrawable)(WSEGLDrawableHandle);
-
-
-} WSEGL_FunctionTable;
-
-
-WSEGL_IMPORT const WSEGL_FunctionTable *WSEGL_GetFunctionTablePointer(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __WSEGL_H__ */
-
-/******************************************************************************
- End of file (wsegl.h)
-******************************************************************************/
diff --git a/sys/qcam/Makefile.am b/sys/qcam/Makefile.am
deleted file mode 100644
index 3843ae8bc..000000000
--- a/sys/qcam/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-
-plugin_LTLIBRARIES = libgstqcam.la
-
-EXTRA_DIST = qcam-os.c qcam-Linux.c
-
-libgstqcam_la_SOURCES = gstqcamsrc.c qcam-lib.c exposure.c
-libgstqcam_la_CFLAGS = -O2 $(GST_CFLAGS)
-libgstqcam_la_LIBADD =
-libgstqcam_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstqcam_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-noinst_HEADERS = gstqcamsrc.h qcam-os.h qcam.h qcamip.h qcam-Linux.h
diff --git a/sys/qcam/dark.c b/sys/qcam/dark.c
deleted file mode 100644
index cdfa2ab8d..000000000
--- a/sys/qcam/dark.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/******************************************************************
-
-Copyright (C) 1996 by Brian Scearce
-
-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,
-and/or distribute copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-1. The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
-2. Redistribution for profit requires the express, written permission of
- the author.
-
-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 BRIAN SCEARCE 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.
-******************************************************************/
-
-/* Fixdark
- Routine to repair dark current artifacts in qcam output.
- Basic idea: the Qcam CCD suffers from "dark current";
- that is, some of the CCD pixels will leak current under
- long exposures, even if they're in the dark, and this
- shows up as ugly speckling on images taken in low light.
-
- Fortunately, the leaky pixels are the same from shot to
- shot. So, we can figure out which pixels are leaky by
- taking some establishing shots in the dark, and try to
- fix those pixels on subsequent shots. The dark
- establishing shots need only be done once per camera.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include "qcam.h"
-#define MAX_LOOPS 10
-#define FNAME "qcam.darkfile"
-
-static unsigned char master_darkmask1[MAX_HEIGHT][MAX_WIDTH];
-static unsigned char master_darkmask2[MAX_HEIGHT / 2 + 1][MAX_WIDTH / 2 + 1];
-static unsigned char master_darkmask4[MAX_HEIGHT / 4 + 1][MAX_WIDTH / 4 + 1];
-
-/*
-int
-read_darkmask()
-{
- int x, y;
- int min_bright;
- char darkfile[BUFSIZ], *p;
- FILE *fp;
-
- strcpy(darkfile, CONFIG_FILE);
- if ( (p = strrchr(darkfile, '/'))) {
- strcpy(p+1, FNAME);
- } else {
- strcpy(darkfile, FNAME);
- }
-
- if (!(fp = fopen(darkfile, "r"))) {
-#ifdef DEBUG
- fprintf(stderr, "Can't open darkfile %s\n", darkfile);
-#endif
- return 0;
- }
-
- if (fread(master_darkmask1, sizeof(unsigned char), MAX_WIDTH*MAX_HEIGHT, fp) !=
- MAX_WIDTH*MAX_HEIGHT) {
-#ifdef DEBUG
- fprintf(stderr, "Error reading darkfile\n");
-#endif
- return 0;
- }
-
- for (y = 0; y < MAX_HEIGHT; y += 2) {
- for (x = 0; x < MAX_WIDTH; x += 2) {
- min_bright = master_darkmask1[y][x];
- if (y < MAX_HEIGHT-1 && master_darkmask1[y+1][x] < min_bright)
- min_bright = master_darkmask1[y+1][x];
- if (x < MAX_WIDTH-1 && master_darkmask1[y][x+1] < min_bright)
- min_bright = master_darkmask1[y][x+1];
- if (y < MAX_HEIGHT-1 && x < MAX_WIDTH-1 && master_darkmask1[y+1][x+1] < min_bright)
- min_bright = master_darkmask1[y+1][x+1];
- master_darkmask2[y/2][x/2] = min_bright;
- assert(y/2 < MAX_HEIGHT/2+1);
- assert(x/2 < MAX_WIDTH/2+1);
- }
- }
-
- for (y = 0; y < MAX_HEIGHT/2; y += 2) {
- for (x = 0; x < MAX_WIDTH/2; x += 2) {
- min_bright = master_darkmask2[y][x];
- if (y < MAX_HEIGHT/2-1 && master_darkmask2[y+1][x] < min_bright)
- min_bright = master_darkmask2[y+1][x];
- if (x < MAX_WIDTH/2-1 && master_darkmask2[y][x+1] < min_bright)
- min_bright = master_darkmask2[y][x+1];
- if (y < MAX_HEIGHT/2-1 && x < MAX_WIDTH-1 && master_darkmask2[y+1][x+1] < min_bright)
- min_bright = master_darkmask2[y+1][x+1];
- master_darkmask4[y/2][x/2] = min_bright;
- assert(y/2 < MAX_HEIGHT/4+1);
- assert(x/2 < MAX_WIDTH/4+1);
- }
- }
-
- fclose(fp);
- return 1;
-}
-*/
-
-
-/* fixdark
- We first record a list of bad leaky pixels, by making a
- number of exposures in the dark. master_darkmask holds
- this information. It's a map of the CCD.
- master_darkmask[y][x] == val means that the pixel is
- unreliable for brightnesses of "val" and above.
-
- We go over the image. If a pixel is bad, look at the
- adjacent four pixels, average the ones that have good
- values, and use that instead.
-*/
-
-int
-fixdark (const struct qcam *q, scanbuf * scan)
-{
- static int init = 0;
- static int smallest_dm = 255;
- unsigned char darkmask[MAX_HEIGHT][MAX_WIDTH];
- unsigned char new_image[MAX_HEIGHT][MAX_WIDTH];
- int width, height;
- int max_width, max_height;
- int x, y;
- int ccd_x, ccd_y;
- int pixelcount, pixeltotal;
- int again, loopcount = 0;
- int val;
- int brightness = q->brightness;
- int scale = q->transfer_scale;
-
- if (!init) {
- if (!read_darkmask ())
- return 0;
- for (y = 0; y < MAX_HEIGHT; y++)
- for (x = 0; x < MAX_HEIGHT; x++)
- if (master_darkmask1[y][x] < smallest_dm) {
- smallest_dm = master_darkmask1[y][x];
-#ifdef DEBUG
- fprintf (stderr, "Smallest mask is %d at (%d, %d)\n",
- smallest_dm, x, y);
-#endif
- }
- init = 1;
- }
-
- if (brightness < smallest_dm) {
-#ifdef DEBUG
- fprintf (stderr,
- "Brightness %d (dark current starts at %d), no fixup needed\n",
- brightness, smallest_dm);
-#endif
- return 1;
- }
-
- width = q->width / scale;
- height = q->height / scale;
-
- max_height = MAX_HEIGHT / scale;
- max_width = MAX_WIDTH / scale;
- for (y = 0; y < max_height; y++)
- for (x = 0; x < max_width; x++)
- if (scale == 1) {
- darkmask[y][x] = master_darkmask1[y][x];
- } else if (scale == 2) {
- darkmask[y][x] = master_darkmask2[y][x];
- } else if (scale == 4) {
- darkmask[y][x] = master_darkmask4[y][x];
- } else {
-#ifdef DEBUG
- fprintf (stderr, "Bad transfer_scale in darkmask assignment!\n");
-#endif
- return 0;
- }
-
- do {
- again = 0;
- ccd_y = (q->top - 1) / scale;
- for (y = 0; y < height; y++, ccd_y++) {
- ccd_x = q->left - 1;
- ccd_x /= 2;
- ccd_x *= 2;
- ccd_x /= scale;
- for (x = 0; x < width; x++, ccd_x++) {
- val = scan[y * width + x];
- if (brightness < darkmask[ccd_y][ccd_x]) { /* good pixel */
- new_image[y][x] = val;
- } else { /* bad pixel */
- /* look at nearby pixels, average the good values */
- pixelcount = 0;
- pixeltotal = 0;
- if (x > 0) { /* left */
- if (brightness < darkmask[ccd_y][ccd_x - 1]) {
- pixelcount++;
- pixeltotal += scan[y * width + x - 1];
- }
- }
- if (x < width - 1) { /* right */
- if (brightness < darkmask[ccd_y][ccd_x + 1]) {
- pixelcount++;
- pixeltotal += scan[y * width + x + 1];
- }
- }
- if (y > 0) { /* above */
- if (brightness < darkmask[ccd_y - 1][ccd_x]) {
- pixelcount++;
- pixeltotal += scan[(y - 1) * width + x];
- }
- }
- if (y < height - 1) { /* below */
- if (brightness < darkmask[ccd_y + 1][ccd_x]) {
- pixelcount++;
- pixeltotal += scan[(y + 1) * width + x];
- }
- }
-
- if (pixelcount == 0) { /* no valid neighbors! */
- again = 1;
- } else {
- new_image[y][x] = pixeltotal / pixelcount;
- /* mark this pixel as valid, so we don't loop forever */
- darkmask[ccd_y][ccd_x] = 255;
- }
- }
- }
- }
-
- for (y = 0; y < height; y++)
- for (x = 0; x < width; x++)
- scan[y * width + x] = new_image[y][x];
-
- } while (loopcount++ < MAX_LOOPS && again);
-#ifdef DEBUG
- fprintf (stderr, "Darkmask fix took %d loop%s\n",
- loopcount, (loopcount == 1) ? "" : "s");
-#endif
- return 1;
-}
diff --git a/sys/qcam/exposure.c b/sys/qcam/exposure.c
deleted file mode 100644
index 8f18e488a..000000000
--- a/sys/qcam/exposure.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/* exposure.c
- *
- * Time-stamp: <02 Sep 96 11:52:21 HST edo@eosys.com>
- *
- * Version 0.2
- */
-
-
-/******************************************************************
-
-Copyright (C) 1996 by Ed Orcutt Systems
-
-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, and/or distribute copies of the
-Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-1. The above copyright notice and this permission notice shall
- be included in all copies or substantial portions of the
- Software.
-
-2. Redistribution for profit requires the express, written
- permission of the author.
-
-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 ED ORCUTT SYSTEMS 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.
-
-******************************************************************/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include "qcam.h"
-#include "qcamip.h"
-
-/* Prototypes for private (static) functions used by the routines
- * within this file. Externally visible functions should be
- * prototyped in qcamip.h
- */
-
-static int qcip_pixel_average (struct qcam *q, scanbuf * scan);
-static int qcip_luminance_std (struct qcam *q, scanbuf * scan, int avg);
-
-/* Private data used by the auto exposure routine */
-
-static int luminance_target = -1;
-static int luminance_tolerance = 0;
-static int luminance_std_target = -1;
-static int luminance_std_tolerance = 0;
-static int ae_mode = AE_ALL_AVG;
-
-/* Calculate average pixel value for entire image */
-
-static int
-qcip_pixel_average (struct qcam *q, scanbuf * scan)
-{
- int count = 0;
- int sum = 0;
- int pixels;
- int i;
-
- pixels = q->height / q->transfer_scale;
- pixels *= q->width / q->transfer_scale;
-
- for (i = 0; i < pixels; i++) {
- sum += scan[i];
- count++;
- }
- return (sum / count);
-}
-
-/* Calculate average pixel value for center of image */
-
-static int
-qcip_pixel_average_center (struct qcam *q, scanbuf * scan)
-{
- int count = 0;
- int sum = 0;
- int height, width;
- int maxrow, maxcol;
- int i, j;
-
- /* actual image width & height after scaling */
- width = q->width / q->transfer_scale;
- height = q->height / q->transfer_scale;
-
- maxcol = width * 2 / 3;
- maxrow = height * 2 / 3;
-
- for (i = width / 3; i < maxcol; i++) {
- for (j = height / 3; j < maxrow; j++) {
- sum += scan[j * width + i];
- count++;
- }
- }
- return (sum / count);
-}
-
-int
-qcip_set_luminance_target (struct qcam *q, int val)
-{
- const int max_pixel_val = q->bpp == 6 ? 63 : 15;
-
- if ((val - luminance_tolerance) >= 0 &&
- (val + luminance_tolerance) <= max_pixel_val) {
- luminance_target = val;
- return QCIP_XPSR_OK;
- }
- return QCIP_XPSR_LUM_INVLD;
-}
-
-int
-qcip_set_luminance_tolerance (struct qcam *q, int val)
-{
- const int max_pixel_val = q->bpp == 6 ? 63 : 15;
-
- /* set target if it has not been explicitly set */
- if (luminance_target == -1) {
- luminance_target = q->bpp == 6 ? 32 : 8;
- }
-
- if ((luminance_target - val) >= 0 &&
- (luminance_target + val) <= max_pixel_val) {
- luminance_tolerance = val;
- return QCIP_XPSR_OK;
- }
- return QCIP_XPSR_LUM_INVLD;
-}
-
-int
-qcip_set_luminance_std_target (struct qcam *q, int val)
-{
- luminance_std_target = val;
- return QCIP_XPSR_OK;
-}
-
-int
-qcip_set_luminance_std_tolerance (struct qcam *q, int val)
-{
- luminance_std_tolerance = val;
- return QCIP_XPSR_OK;
-}
-
-int
-qcip_set_autoexposure_mode (int val)
-{
- ae_mode = val;
- return 0;
-}
-
-/* Calculate standard deviation of pixel value for entire image */
-
-static int
-qcip_luminance_std (struct qcam *q, scanbuf * scan, int avg)
-{
- int count = 0;
- int sum = 0;
- int pixels;
- int i;
-
- pixels = q->height / q->transfer_scale;
- pixels *= q->width / q->transfer_scale;
-
- for (i = 0; i < pixels; i++) {
- if (scan[i] < avg) {
- sum += avg - scan[i];
- } else {
- sum += scan[i] - avg;
- }
- count++;
- }
- return (sum / count);
-}
-
-
-/* If necessary adjust the brightness in an attempt to achieve
- * a target average pixel value: 32 for 6 bpp, 8 for 4bpp.
- * This routine *will* modify the brightness value in preparation
- * for another scan unless the target average pixel values has
- * been reached. If the exposure is correct (yes, I realize that
- * this is subjective) QCIP_XPSR_OK will be returned, otherwise
- * return QCIP_XPSR_RSCN after adjusting the exposure.
- *
- * Caveat: If the new calculated brightness value is invalid,
- * QCIP_XPSR_ERR will be returned.
- */
-
-int
-qcip_autoexposure (struct qcam *q, scanbuf * scan)
-{
- int luminance_dif;
- int luminance_avg;
- int brightness_adj;
- int lum_min, lum_max;
- int lum_std, lum_std_min, lum_std_max;
- int ret = QCIP_XPSR_OK;
-
-#ifdef DEBUG
- fprintf (stderr, "Brightness: %d Contrast: %d\n",
- qc_getbrightness (q), qc_getcontrast (q));
-#endif
-
- switch (ae_mode) {
- case AE_CTR_AVG:
- luminance_avg = qcip_pixel_average_center (q, scan);
- break;
- case AE_STD_AVG:
- luminance_avg = qcip_pixel_average (q, scan);
- lum_std = qcip_luminance_std (q, scan, luminance_avg);
-
- /* ==>> Contrast adjustment <<== */
-
- /* set target if it has not been explicitly set */
- if (luminance_std_target == -1) {
- luminance_std_target = q->bpp == 6 ? 10 : 2;
- }
-
- /* Adjust contrast to reach target luminance standard deviation */
- lum_std_min = luminance_std_target - luminance_std_tolerance;
- lum_std_max = luminance_std_target + luminance_std_tolerance;
-
- if (lum_std < lum_std_min || lum_std > lum_std_max) {
- ret = QCIP_XPSR_RSCN;
- if (qc_setcontrast (q,
- luminance_std_target - lum_std + qc_getcontrast (q))) {
- return QCIP_XPSR_ERR;
- }
- }
-#ifdef DEBUG
- fprintf (stderr, "Luminance std/target/tolerance: %d/%d/%d\n",
- lum_std, luminance_std_target, luminance_std_tolerance);
-#endif
-
- break;
- case AE_ALL_AVG:
- default:
- luminance_avg = qcip_pixel_average (q, scan);
- break;
- }
-
- /* ==>> Brightness adjustment <<== */
-
- /* set target if it has not been explicitly set */
- if (luminance_target == -1) {
- luminance_target = q->bpp == 6 ? 32 : 8;
- }
-
- lum_min = luminance_target - luminance_tolerance;
- lum_max = luminance_target + luminance_tolerance;
-
-#ifdef DEBUG
- fprintf (stderr, "Luminance avg/target/tolerance: %d/%d/%d\n",
- luminance_avg, luminance_target, luminance_tolerance);
-#endif
-
- /* check for luminance within target range */
- if (luminance_avg < lum_min || luminance_avg > lum_max) {
- ret = QCIP_XPSR_RSCN;
- /* we need to adjust the brighness, which way? */
- luminance_dif = luminance_target - luminance_avg;
- if (luminance_dif > 0) {
- brightness_adj = luminance_dif / 2 + 1;
- } else {
- brightness_adj = luminance_dif / 2 - 1;
- }
-
- /* Adjusted brightness is out of range ..
- * throw in the towel ... auto-exposure has failed!
- */
- if (qc_setbrightness (q, brightness_adj + qc_getbrightness (q))) {
- return QCIP_XPSR_ERR;
- }
- }
-
- return ret;
-}
diff --git a/sys/qcam/gstqcamsrc.c b/sys/qcam/gstqcamsrc.c
deleted file mode 100644
index dbe774090..000000000
--- a/sys/qcam/gstqcamsrc.c
+++ /dev/null
@@ -1,445 +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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, 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>
-
-/*#define DEBUG_ENABLED */
-#include <gstqcamsrc.h>
-#include <gst/video/video.h>
-
-#include "qcamip.h"
-
-#define AE_NONE 3
-
-#define DEF_WIDTH 320
-#define DEF_HEIGHT 224
-#define DEF_BRIGHTNESS 226
-#define DEF_WHITEBAL 128
-#define DEF_CONTRAST 72
-#define DEF_TOP 1
-#define DEF_LEFT 14
-#define DEF_TRANSFER_SCALE 2
-#define DEF_DEPTH 6
-#define DEF_PORT 0x378
-#define DEF_AUTOEXP AE_NONE
-
-static GstStaticPadTemplate gst_qcamsrc_src_factory =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
- );
-
-#define GST_TYPE_AUTOEXP_MODE (gst_autoexp_mode_get_type())
-static GType
-gst_autoexp_mode_get_type (void)
-{
- static GType autoexp_mode_type = 0;
- static const GEnumValue autoexp_modes[] = {
- {AE_ALL_AVG, "0", "Average Picture"},
- {AE_CTR_AVG, "1", "Average Center"},
- {AE_STD_AVG, "2", "Standard Deviation"},
- {AE_NONE, "3", "None"},
- {0, NULL, NULL},
- };
-
- if (!autoexp_mode_type) {
- autoexp_mode_type =
- g_enum_register_static ("GstAutoExposureMode", autoexp_modes);
- }
- return autoexp_mode_type;
-}
-
-/* QCamSrc signals and args */
-enum
-{
- /* FILL ME */
- LAST_SIGNAL
-};
-
-enum
-{
- ARG_0,
- ARG_WIDTH,
- ARG_HEIGHT,
- ARG_BRIGHTNESS,
- ARG_WHITEBAL,
- ARG_CONTRAST,
- ARG_TOP,
- ARG_LEFT,
- ARG_TRANSFER_SCALE,
- ARG_DEPTH,
- ARG_PORT,
- ARG_AUTOEXP
-};
-
-static void gst_qcamsrc_base_init (gpointer g_class);
-static void gst_qcamsrc_class_init (GstQCamSrcClass * klass);
-static void gst_qcamsrc_init (GstQCamSrc * qcamsrc);
-
-static void gst_qcamsrc_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_qcamsrc_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static GstStateChangeReturn gst_qcamsrc_change_state (GstElement * element,
- GstStateChange transition);
-static void gst_qcamsrc_close (GstQCamSrc * src);
-static gboolean gst_qcamsrc_open (GstQCamSrc * src);
-
-static GstData *gst_qcamsrc_get (GstPad * pad);
-
-static GstElementClass *parent_class = NULL;
-
-/*//static guint gst_qcamsrc_signals[LAST_SIGNAL] = { 0 }; */
-
-GType
-gst_qcamsrc_get_type (void)
-{
- static GType qcamsrc_type = 0;
-
- if (!qcamsrc_type) {
- static const GTypeInfo qcamsrc_info = {
- sizeof (GstQCamSrcClass),
- gst_qcamsrc_base_init,
- NULL,
- (GClassInitFunc) gst_qcamsrc_class_init,
- NULL,
- NULL,
- sizeof (GstQCamSrc),
- 0,
- (GInstanceInitFunc) gst_qcamsrc_init,
- NULL
- };
-
- qcamsrc_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstQCamSrc", &qcamsrc_info,
- 0);
- }
- return qcamsrc_type;
-}
-
-static void
-gst_qcamsrc_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_static_pad_template (element_class,
- &gst_qcamsrc_src_factory);
- gst_element_class_set_static_metadata (element_class, "QCam Source",
- "Source/Video", "Read from a QuickCam device",
- "Wim Taymans <wim.taymans@chello.be>");
-}
-
-static void
-gst_qcamsrc_class_init (GstQCamSrcClass * 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_WIDTH,
- g_param_spec_int ("width", "width", "width",
- 0, 320, DEF_WIDTH, G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HEIGHT,
- g_param_spec_int ("height", "height", "height",
- 0, 240, DEF_HEIGHT, G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BRIGHTNESS,
- g_param_spec_int ("brightness", "brightness", "brightness",
- 0, 255, DEF_BRIGHTNESS, G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WHITEBAL,
- g_param_spec_int ("whitebal", "whitebal", "whitebal",
- 0, 255, DEF_WHITEBAL, G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CONTRAST,
- g_param_spec_int ("contrast", "contrast", "contrast",
- 0, 255, DEF_CONTRAST, G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOP,
- g_param_spec_int ("top", "top", "top",
- 0, 240, DEF_TOP, G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LEFT,
- g_param_spec_int ("left", "left", "left",
- 0, 320, DEF_LEFT, G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TRANSFER_SCALE,
- g_param_spec_int ("transfer_scale", "transfer_scale", "transfer_scale",
- 1, 4, DEF_TRANSFER_SCALE, G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DEPTH,
- g_param_spec_int ("depth", "depth", "depth",
- 4, 6, DEF_DEPTH, G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PORT,
- g_param_spec_int ("port", "port", "port",
- 0, G_MAXINT, DEF_PORT, G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_AUTOEXP,
- g_param_spec_enum ("autoexposure", "autoexposure", "autoexposure",
- GST_TYPE_AUTOEXP_MODE, DEF_AUTOEXP, G_PARAM_READWRITE));
-
- gobject_class->set_property = gst_qcamsrc_set_property;
- gobject_class->get_property = gst_qcamsrc_get_property;
-
- gstelement_class->change_state = gst_qcamsrc_change_state;
-}
-
-static void
-gst_qcamsrc_init (GstQCamSrc * qcamsrc)
-{
- qcamsrc->srcpad =
- gst_pad_new_from_static_template (&gst_qcamsrc_src_factory, "src");
- gst_element_add_pad (GST_ELEMENT (qcamsrc), qcamsrc->srcpad);
- gst_pad_set_get_function (qcamsrc->srcpad, gst_qcamsrc_get);
-
- /* if the destination cannot say what it wants, we give this */
- qcamsrc->qcam = qc_init ();
- qcamsrc->qcam->port = DEF_PORT;
- qc_setwidth (qcamsrc->qcam, DEF_WIDTH);
- qc_setheight (qcamsrc->qcam, DEF_HEIGHT);
- qc_setbrightness (qcamsrc->qcam, DEF_BRIGHTNESS);
- qc_setwhitebal (qcamsrc->qcam, DEF_WHITEBAL);
- qc_setcontrast (qcamsrc->qcam, DEF_CONTRAST);
- qc_settop (qcamsrc->qcam, DEF_TOP);
- qc_setleft (qcamsrc->qcam, DEF_LEFT);
- qc_settransfer_scale (qcamsrc->qcam, DEF_TRANSFER_SCALE);
- qc_setbitdepth (qcamsrc->qcam, DEF_DEPTH);
- qcamsrc->autoexposure = DEF_AUTOEXP;
- if (qcamsrc->autoexposure != AE_NONE)
- qcip_set_autoexposure_mode (qcamsrc->autoexposure);
-}
-
-static GstData *
-gst_qcamsrc_get (GstPad * pad)
-{
- GstQCamSrc *qcamsrc;
- GstBuffer *buf;
- scanbuf *scan;
- guchar *outdata;
- gint i, frame, scale, convert;
-
- g_return_val_if_fail (pad != NULL, NULL);
-
- qcamsrc = GST_QCAMSRC (gst_pad_get_parent (pad));
-
- scale = qc_gettransfer_scale (qcamsrc->qcam);
-
- frame = qcamsrc->qcam->width * qcamsrc->qcam->height / (scale * scale);
-
- buf = gst_buffer_new ();
- outdata = GST_BUFFER_DATA (buf) = g_malloc0 ((frame * 3) / 2);
- GST_BUFFER_SIZE (buf) = (frame * 3) / 2;
-
- qc_set (qcamsrc->qcam);
- if (!GST_PAD_CAPS (pad)) {
- gst_pad_try_set_caps (pad, gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, "I420",
- "width", G_TYPE_INT, qcamsrc->qcam->width / scale,
- "height", G_TYPE_INT, qcamsrc->qcam->height / scale,
- "framerate", G_TYPE_DOUBLE, 10., NULL));
- }
- scan = qc_scan (qcamsrc->qcam);
-
- /* FIXME, this doesn't seem to work... */
- /*fixdark(qcamsrc->qcam, scan); */
-
- if (qcamsrc->autoexposure != AE_NONE)
- qcip_autoexposure (qcamsrc->qcam, scan);
-
- convert = (qcamsrc->qcam->bpp == 4 ? 4 : 2);
-
- for (i = frame; i; i--) {
- outdata[i] = scan[i] << convert;
- }
- memset (outdata + frame, 128, frame >> 1);
- g_free (scan);
-
- return GST_DATA (buf);
-}
-
-static void
-gst_qcamsrc_set_property (GObject * object, guint prop_id, const GValue * value,
- GParamSpec * pspec)
-{
- GstQCamSrc *src;
-
- g_return_if_fail (GST_IS_QCAMSRC (object));
- src = GST_QCAMSRC (object);
-
- switch (prop_id) {
- case ARG_WIDTH:
- qc_setwidth (src->qcam, g_value_get_int (value));
- break;
- case ARG_HEIGHT:
- qc_setheight (src->qcam, g_value_get_int (value));
- break;
- case ARG_BRIGHTNESS:
- qc_setbrightness (src->qcam, g_value_get_int (value));
- break;
- case ARG_WHITEBAL:
- qc_setwhitebal (src->qcam, g_value_get_int (value));
- break;
- case ARG_CONTRAST:
- qc_setcontrast (src->qcam, g_value_get_int (value));
- break;
- case ARG_TOP:
- qc_settop (src->qcam, g_value_get_int (value));
- break;
- case ARG_LEFT:
- qc_setleft (src->qcam, g_value_get_int (value));
- break;
- case ARG_TRANSFER_SCALE:
- qc_settransfer_scale (src->qcam, g_value_get_int (value));
- break;
- case ARG_DEPTH:
- qc_setbitdepth (src->qcam, g_value_get_int (value));
- break;
- case ARG_PORT:
- src->qcam->port = g_value_get_int (value);
- break;
- case ARG_AUTOEXP:
- src->autoexposure = g_value_get_enum (value);
- if (src->autoexposure != AE_NONE)
- qcip_set_autoexposure_mode (src->autoexposure);
- break;
- default:
- break;
- }
-}
-
-static void
-gst_qcamsrc_get_property (GObject * object, guint prop_id, GValue * value,
- GParamSpec * pspec)
-{
- GstQCamSrc *src;
-
- g_return_if_fail (GST_IS_QCAMSRC (object));
- src = GST_QCAMSRC (object);
-
- switch (prop_id) {
- case ARG_WIDTH:
- g_value_set_int (value, qc_getwidth (src->qcam));
- break;
- case ARG_HEIGHT:
- g_value_set_int (value, qc_getheight (src->qcam));
- break;
- case ARG_BRIGHTNESS:
- g_value_set_int (value, qc_getbrightness (src->qcam));
- break;
- case ARG_WHITEBAL:
- g_value_set_int (value, qc_getwhitebal (src->qcam));
- break;
- case ARG_CONTRAST:
- g_value_set_int (value, qc_getcontrast (src->qcam));
- break;
- case ARG_TOP:
- g_value_set_int (value, qc_gettop (src->qcam));
- break;
- case ARG_LEFT:
- g_value_set_int (value, qc_getleft (src->qcam));
- break;
- case ARG_TRANSFER_SCALE:
- g_value_set_int (value, qc_gettransfer_scale (src->qcam));
- break;
- case ARG_DEPTH:
- g_value_set_int (value, qc_getbitdepth (src->qcam));
- break;
- case ARG_PORT:
- g_value_set_int (value, src->qcam->port);
- break;
- case ARG_AUTOEXP:
- g_value_set_enum (value, src->autoexposure);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GstStateChangeReturn
-gst_qcamsrc_change_state (GstElement * element, GstStateChange transition)
-{
- g_return_val_if_fail (GST_IS_QCAMSRC (element), FALSE);
-
- switch (transition) {
- case GST_STATE_CHANGE_READY_TO_NULL:
- if (GST_OBJECT_FLAG_IS_SET (element, GST_QCAMSRC_OPEN))
- gst_qcamsrc_close (GST_QCAMSRC (element));
- break;
- case GST_STATE_CHANGE_NULL_TO_READY:
- if (!GST_OBJECT_FLAG_IS_SET (element, GST_QCAMSRC_OPEN)) {
- GST_DEBUG ("opening");
- if (!gst_qcamsrc_open (GST_QCAMSRC (element))) {
- GST_DEBUG ("open failed");
- return GST_STATE_CHANGE_FAILURE;
- }
- }
- break;
- default:
- 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 gboolean
-gst_qcamsrc_open (GstQCamSrc * qcamsrc)
-{
- if (qc_open (qcamsrc->qcam)) {
- GST_ELEMENT_ERROR (qcamsrc, RESOURCE, OPEN_READ, (NULL),
- ("Failed to open QuickCam"));
- return FALSE;
- }
-
- GST_OBJECT_FLAG_SET (qcamsrc, GST_QCAMSRC_OPEN);
-
- return TRUE;
-}
-
-static void
-gst_qcamsrc_close (GstQCamSrc * src)
-{
- qc_close (src->qcam);
- GST_OBJECT_FLAG_UNSET (src, GST_QCAMSRC_OPEN);
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- if (!gst_element_register (plugin, "qcamsrc", GST_RANK_NONE,
- GST_TYPE_QCAMSRC))
- return FALSE;
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- qcamsrc,
- "Read from a QuickCam device",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/sys/qcam/gstqcamsrc.h b/sys/qcam/gstqcamsrc.h
deleted file mode 100644
index a617b8d19..000000000
--- a/sys/qcam/gstqcamsrc.h
+++ /dev/null
@@ -1,78 +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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifndef __GST_QCAMSRC_H__
-#define __GST_QCAMSRC_H__
-
-
-#include <gst/gst.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/** QuickCam include files */
-#include "qcam.h"
-#include "qcam-os.h"
-
-#define GST_TYPE_QCAMSRC \
- (gst_qcamsrc_get_type())
-#define GST_QCAMSRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_QCAMSRC,GstQCamSrc))
-#define GST_QCAMSRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_QCAMSRC,GstQCamSrcClass))
-#define GST_IS_QCAMSRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_QCAMSRC))
-#define GST_IS_QCAMSRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_QCAMSRC))
-
-/* NOTE: per-element flags start with 16 for now */
-typedef enum {
- GST_QCAMSRC_OPEN = (GST_ELEMENT_FLAG_LAST << 0),
-
- GST_QCAMSRC_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2),
-} GstQCamSrcFlags;
-
-typedef struct _GstQCamSrc GstQCamSrc;
-typedef struct _GstQCamSrcClass GstQCamSrcClass;
-
-struct _GstQCamSrc {
- GstElement element;
-
- /* pads */
- GstPad *srcpad;
-
- struct qcam *qcam;
- gboolean autoexposure;
- gint port;
-};
-
-struct _GstQCamSrcClass {
- GstElementClass parent_class;
-};
-
-GType gst_qcamsrc_get_type(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GST_QCAMSRC_H__ */
diff --git a/sys/qcam/qcam-Linux.c b/sys/qcam/qcam-Linux.c
deleted file mode 100644
index 07e69170b..000000000
--- a/sys/qcam/qcam-Linux.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/* qcam-Linux.c -- Linux-specific routines for accessing QuickCam */
-
-/* Version 0.1, January 2, 1996 */
-/* Version 0.5, August 24, 1996 */
-
-#define LOCALSTATEDIR ""
-//#define LOCALSTATEDIR "/var/run"
-
-/******************************************************************
-
-Copyright (C) 1996 by Scott Laird
-
-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 SCOTT LAIRD 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.
-
-******************************************************************/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <unistd.h>
-#ifdef TESTING
-#include <errno.h>
-#endif
-#include <sys/io.h>
-
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include "qcam.h"
-#include "qcam-Linux.h"
-
-int __inline__
-read_lpstatus (const struct qcam *q)
-{
- return inb (q->port + 1);
-}
-
-int
-read_lpcontrol (const struct qcam *q)
-{
- return inb (q->port + 2);
-}
-
-int
-read_lpdata (const struct qcam *q)
-{
- return inb (q->port);
-}
-
-void
-write_lpdata (const struct qcam *q, int d)
-{
- outb (d, q->port);
-}
-
-void
-write_lpcontrol (const struct qcam *q, int d)
-{
- outb (d, q->port + 2);
-}
-
-int
-enable_ports (const struct qcam *q)
-{
- if (q->port < 0x278)
- return 1; /* Better safe than sorry */
- if (q->port > 0x3bc)
- return 1;
- return (ioperm (q->port, 3, 1));
-}
-
-int
-disable_ports (const struct qcam *q)
-{
- return (ioperm (q->port, 3, 0));
-}
-
-/* Lock port. This is currently sub-optimal, and is begging to be
- fixed. It should check for dead locks. Any takers? */
-
-/* qc_lock_wait
- * This function uses POSIX fcntl-style locking on a file created in the
- * /tmp directory. Because it uses the Unix record locking facility, locks
- * are relinquished automatically on process termination, so "dead locks"
- * are not a problem. (FYI, the lock file will remain after process
- * termination, but this is actually desired so that the next process need
- * not re-creat(2)e it... just lock it.)
- * The wait argument indicates whether or not this funciton should "block"
- * waiting for the previous lock to be relinquished. This is ideal so that
- * multiple processes (eg. qcam) taking "snapshots" can peacefully coexist.
- * - Dave Plonka (plonka@carroll1.cc.edu)
- */
-int
-qc_lock_wait (struct qcam *q, int wait)
-{
-#if 1
- static struct flock sfl;
-
- if (-1 == q->fd) { /* we've yet to open the lock file */
- static char lockfile[128];
-
- sprintf (lockfile, LOCALSTATEDIR "/LOCK.qcam.0x%x", q->port);
- if (-1 == (q->fd = open (lockfile, O_WRONLY | O_CREAT, 0666))) {
- perror ("open");
- return 1;
- }
-#ifdef TESTING
- fprintf (stderr, "%s - %d: %s open(2)ed\n", __FILE__, __LINE__, lockfile);
-#endif
-
- /* initialize the l_type memver to lock the file exclusively */
- sfl.l_type = F_WRLCK;
- }
-#ifdef TESTING
- if (0 != fcntl (q->fd, F_SETLK, &sfl)) /* non-blocking set lock */
-#else
- if (0 != fcntl (q->fd, wait ? F_SETLKW : F_SETLK, &sfl))
-#endif
- {
-#ifdef TESTING
- perror ("fcntl");
- if (EAGAIN != errno || !wait)
- return 1;
-
- fprintf (stderr, "%s - %d: waiting for exclusive lock on fd %d...\n",
- __FILE__, __LINE__, q->fd);
-
- if (0 != fcntl (q->fd, F_SETLKW, &sfl)) /* "blocking" set lock */
-#endif
- {
- perror ("fcntl");
- return 1;
- }
- }
-#ifdef TESTING
- fprintf (stderr, "%s - %d: fd %d locked exclusively\n", __FILE__, __LINE__,
- q->fd);
-#endif
-
-#else
- char lockfile[128], tmp[128];
- struct stat statbuf;
-
- sprintf (lockfile, LOCALSTATEDIR "/LOCK.qcam.0x%x", q->port);
- sprintf (tmp, "%s-%d", lockfile, getpid ());
-
- if ((creat (tmp, 0) == -1) ||
- (link (tmp, lockfile) == -1) ||
- (stat (tmp, &statbuf) == -1) || (statbuf.st_nlink == 1)) {
-#ifdef DEBUGQC
- perror ("QuickCam Locked");
- if (unlink (tmp) == -1)
- perror ("Error unlinking temp file.");
-#else
- unlink (tmp);
-#endif
- return 1;
- }
-
- unlink (tmp);
- if (chown (lockfile, getuid (), getgid ()) == -1)
- perror ("Chown problems");
-#endif
-
- return 0;
-}
-
-int
-qc_lock (struct qcam *q)
-{
-#if 1
- return qc_lock_wait (q, 1 /*wait */ );
-#else
- return qc_lock_wait (q, 0 /*don't wait */ );
-#endif
-}
-
-/* Unlock port */
-
-int
-qc_unlock (struct qcam *q)
-{
- static struct flock sfl;
-
-#if 1
- if (-1 == q->fd) { /* port was not locked */
- return 1;
- }
-
- /* clear the exclusive lock */
- sfl.l_type = F_UNLCK;
- if (0 != fcntl (q->fd, F_SETLK, &sfl)) {
- perror ("fcntl");
- return 1;
- }
-#ifdef TESTING
- fprintf (stderr, "%s - %d: fd %d unlocked\n", __FILE__, __LINE__, q->fd);
-#endif
-
-#else
- char lockfile[128];
-
- sprintf (lockfile, LOCALSTATEDIR "/LOCK.qcam.0x%x", q->port);
- unlink (lockfile); /* What would I do with an error? */
-#endif
-
- return 0;
-}
-
-
-/* Probe for camera. Returns 0 if found, 1 if not found, sets
- q->port.*/
-
-int
-qc_probe (struct qcam *q)
-{
- int ioports[] = { 0x378, 0x278, 0x3bc, 0 };
- int i = 0;
-
- /* Attempt to get permission to access IO ports. Must be root */
-
- while (ioports[i] != 0) {
- q->port = ioports[i++];
-
- if (qc_open (q)) {
- perror ("Can't get I/O permission");
- exit (1);
- }
-
- if (qc_detect (q)) {
- fprintf (stderr, "QuickCam detected at 0x%x\n", q->port);
- qc_close (q);
- return (0);
- } else
- qc_close (q);
- }
-
- return 1;
-}
-
-
-/* THIS IS UGLY. I need a short delay loop -- somthing well under a
-millisecond. Unfortunately, adding 2 usleep(1)'s to qc_command slowed
-it down by a factor of over 1000 over the same loop with 2
-usleep(0)'s, and that's too slow -- qc_start was taking over a second
-to run. This seems to help, but if anyone has a good
-speed-independent pause routine, please tell me. -- Scott */
-
-void
-qc_wait (int val)
-{
- int i;
-
- while (val--)
- for (i = 0; i < 50000; i++);
-}
diff --git a/sys/qcam/qcam-Linux.h b/sys/qcam/qcam-Linux.h
deleted file mode 100644
index 46dcbe519..000000000
--- a/sys/qcam/qcam-Linux.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* qcam-linux.h -- Linux-specific routines for accessing QuickCam */
-
-/* Version 0.1, January 2, 1996 */
-/* Version 0.5, August 24, 1996 */
-
-
-/******************************************************************
-
-Copyright (C) 1996 by Scott Laird
-
-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 SCOTT LAIRD 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.
-
-******************************************************************/
-
-
diff --git a/sys/qcam/qcam-lib.c b/sys/qcam/qcam-lib.c
deleted file mode 100644
index c472e5778..000000000
--- a/sys/qcam/qcam-lib.c
+++ /dev/null
@@ -1,849 +0,0 @@
-/* qcam-lib.c -- Library for programming with the Connectix QuickCam.
- * See the included documentation for usage instructions and details
- * of the protocol involved. */
-
-
-/* Version 0.5, August 4, 1996 */
-/* Version 0.7, August 27, 1996 */
-/* Version 0.9, November 17, 1996 */
-
-
-/******************************************************************
-
-Copyright (C) 1996 by Scott Laird
-
-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 SCOTT LAIRD 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.
-
-******************************************************************/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include <unistd.h>
-
-#include <assert.h>
-
-#include "qcam.h"
-#include "qcam-os.h"
-#include "qcam-os.c"
-
-/* Prototypes for static functions. Externally visible functions
- * should be prototyped in qcam.h */
-
-static int qc_waithand (const struct qcam *q, int val);
-static int qc_command (const struct qcam *q, int command);
-static int qc_readparam (const struct qcam *q);
-static int qc_setscanmode (struct qcam *q);
-static int qc_readbytes (const struct qcam *q, char buffer[]);
-
-/* The next several functions are used for controlling the qcam
- * structure. They aren't used inside this library, but they should
- * provide a clean interface for external programs.*/
-
-/* Gets/sets the brightness. */
-
-int
-qc_getbrightness (const struct qcam *q)
-{
- return q->brightness;
-}
-
-int
-qc_setbrightness (struct qcam *q, int val)
-{
- if (val >= 0 && val <= 255) {
- q->brightness = val;
- return 0;
- }
- return 1;
-}
-
-
-/* Gets/sets the contrast */
-
-int
-qc_getcontrast (const struct qcam *q)
-{
- return q->contrast;
-}
-
-int
-qc_setcontrast (struct qcam *q, int val)
-{
- if (val >= 0 && val <= 255) {
- q->contrast = val;
- return 0;
- }
- return 1;
-}
-
-
-/* Gets/sets the white balance */
-
-int
-qc_getwhitebal (const struct qcam *q)
-{
- return q->whitebal;
-}
-
-int
-qc_setwhitebal (struct qcam *q, int val)
-{
- if (val >= 0 && val <= 255) {
- q->whitebal = val;
- return 0;
- }
- return 1;
-}
-
-
-/* Gets/sets the resolution */
-
-void
-qc_getresolution (const struct qcam *q, int *x, int *y)
-{
- *x = q->width;
- *y = q->height;
-}
-
-int
-qc_setresolution (struct qcam *q, int x, int y)
-{
- if (x >= 0 && x <= 336 && y >= 0 && y <= 243) {
- q->width = x;
- q->height = y;
- return 0;
- }
- return 1;
-}
-
-int
-qc_getheight (const struct qcam *q)
-{
- return q->height;
-}
-
-int
-qc_setheight (struct qcam *q, int y)
-{
- if (y >= 0 && y <= 243) {
- q->height = y;
- return 0;
- }
- return 1;
-}
-
-int
-qc_getwidth (const struct qcam *q)
-{
- return q->width;
-}
-
-int
-qc_setwidth (struct qcam *q, int x)
-{
- if (x >= 0 && x <= 336) {
- q->width = x;
- return 0;
- }
- return 1;
-}
-
-/* Gets/sets the bit depth */
-
-int
-qc_getbitdepth (const struct qcam *q)
-{
- return q->bpp;
-}
-
-int
-qc_setbitdepth (struct qcam *q, int val)
-{
- if (val == 4 || val == 6) {
- q->bpp = val;
- return qc_setscanmode (q);
- }
- return 1;
-}
-
-int
-qc_gettop (const struct qcam *q)
-{
- return q->top;
-}
-
-int
-qc_settop (struct qcam *q, int val)
-{
- if (val >= 1 && val <= 243) {
- q->top = val;
- return 0;
- }
- return 1;
-}
-
-int
-qc_getleft (const struct qcam *q)
-{
- return q->left;
-}
-
-int
-qc_setleft (struct qcam *q, int val)
-{
- if (val % 2 == 0 && val >= 2 && val <= 336) {
- q->left = val;
- return 0;
- }
- return 1;
-}
-
-int
-qc_gettransfer_scale (const struct qcam *q)
-{
- return q->transfer_scale;
-}
-
-int
-qc_settransfer_scale (struct qcam *q, int val)
-{
- if (val == 1 || val == 2 || val == 4) {
- q->transfer_scale = val;
- return qc_setscanmode (q);
- }
- return 1;
-}
-
-int
-qc_calibrate (struct qcam *q)
-/* bugfix by Hanno Mueller hmueller@kabel.de, Mai 21 96 */
-/* The white balance is an individiual value for each */
-/* quickcam. Run calibration once, write the value down */
-/* and put it in your qcam.conf file. You won't need to */
-/* recalibrate your camera again. */
-{
- int value;
-
-#ifdef DEBUG
- int count = 0;
-#endif
-
- qc_command (q, 27); /* AutoAdjustOffset */
- qc_command (q, 0); /* Dummy Parameter, ignored by the camera */
-
- /* GetOffset (33) will read 255 until autocalibration */
- /* is finished. After that, a value of 1-254 will be */
- /* returned. */
-
- do {
- qc_command (q, 33);
- value = qc_readparam (q);
-#ifdef DEBUG
- count++;
-#endif
- } while (value == 0xff);
-
- q->whitebal = value;
-
-#ifdef DEBUG
- fprintf (stderr, "%d loops to calibrate\n", count);
- fprintf (stderr, "Calibrated to %d\n", value);
-#endif
-
- return value;
-}
-
-int
-qc_forceunidir (struct qcam *q)
-{
- q->port_mode = (q->port_mode & ~QC_FORCE_MASK) | QC_FORCE_UNIDIR;
- return 0;
-}
-
-
-/* Initialize the QuickCam driver control structure. This is where
- * defaults are set for people who don't have a config file.*/
-struct qcam *
-qc_init (void)
-{
- struct qcam *q;
-
- q = malloc (sizeof (struct qcam));
-
- q->port = 0; /* Port 0 == Autoprobe */
- q->port_mode = (QC_ANY | QC_NOTSET);
- q->width = 160;
- q->height = 120;
- q->bpp = 4;
- q->transfer_scale = 2;
- q->contrast = 104;
- q->brightness = 150;
- q->whitebal = 150;
- q->top = 1;
- q->left = 14;
- q->mode = -1;
- q->fd = -1; /* added initialization of fd member
- * BTW, there doesn't seem to be a place to close this fd...
- * I think we need a qc_free function.
- * - Dave Plonka (plonka@carroll1.cc.edu)
- */
-
- return q;
-}
-
-
-/* qc_open enables access to the port specified in q->port. It takes
- * care of locking and enabling I/O port access by calling the
- * appropriate routines.
- *
- * Returns 0 for success, 1 for opening error, 2 for locking error,
- * and 3 for qcam not found */
-
-int
-qc_open (struct qcam *q)
-{
- if (q->port == 0)
- if (qc_probe (q)) {
- fprintf (stderr, "Qcam not found\n");
- return 3;
- }
-
- if (qc_lock (q)) {
- fprintf (stderr, "Cannot lock qcam.\n");
- return 2;
- }
-
- if (enable_ports (q)) {
- fprintf (stderr, "Cannot open QuickCam -- permission denied.");
- return 1;
- } else {
- return 0;
- }
-}
-
-
-/* qc_close closes and unlocks the driver. You *need* to call this,
- * or lockfiles will be left behind and everything will be screwed. */
-
-int
-qc_close (struct qcam *q)
-{
- qc_unlock (q);
-
- disable_ports (q);
- return 0;
-}
-
-
-/* qc_command is probably a bit of a misnomer -- it's used to send
- * bytes *to* the camera. Generally, these bytes are either commands
- * or arguments to commands, so the name fits, but it still bugs me a
- * bit. See the documentation for a list of commands. */
-
-static int
-qc_command (const struct qcam *q, int command)
-{
- int n1, n2;
- int cmd;
-
- write_lpdata (q, command);
- write_lpcontrol (q, 6);
-
- n1 = qc_waithand (q, 1);
-
- write_lpcontrol (q, 0xe);
- n2 = qc_waithand (q, 0);
-
- cmd = (n1 & 0xf0) | ((n2 & 0xf0) >> 4);
-#ifdef DEBUG
- if (cmd != command) {
- fprintf (stderr, "Command 0x%02x sent, 0x%02x echoed", command, cmd);
- n2 = read_lpstatus (q);
- cmd = (n1 & 0xf0) | ((n2 & 0xf0) >> 4);
- if (cmd != command)
- fprintf (stderr, " (re-read does not help)\n");
- else
- fprintf (stderr, " (fixed on re-read)\n");
- }
-#endif
- return cmd;
-}
-
-static int
-qc_readparam (const struct qcam *q)
-{
- int n1, n2;
- int cmd;
-
- write_lpcontrol (q, 6);
- n1 = qc_waithand (q, 1);
-
- write_lpcontrol (q, 0xe);
- n2 = qc_waithand (q, 0);
-
- cmd = (n1 & 0xf0) | ((n2 & 0xf0) >> 4);
- return cmd;
-}
-
-/* qc_waithand busy-waits for a handshake signal from the QuickCam.
- * Almost all communication with the camera requires handshaking. */
-
-static int
-qc_waithand (const struct qcam *q, int val)
-{
- int status;
-
- if (val)
- while (!((status = read_lpstatus (q)) & 8));
- else
- while (((status = read_lpstatus (q)) & 8));
-
- return status;
-}
-
-/* Waithand2 is used when the qcam is in bidirectional mode, and the
- * handshaking signal is CamRdy2 (bit 0 of data reg) instead of CamRdy1
- * (bit 3 of status register). It also returns the last value read,
- * since this data is useful. */
-
-static unsigned int
-qc_waithand2 (const struct qcam *q, int val)
-{
- unsigned int status;
-
- do {
- status = read_lpdata (q);
- } while ((status & 1) != val);
-
- return status;
-}
-
-
-/* Try to detect a QuickCam. It appears to flash the upper 4 bits of
- the status register at 5-10 Hz. This is only used in the autoprobe
- code. Be aware that this isn't the way Connectix detects the
- camera (they send a reset and try to handshake), but this should be
- almost completely safe, while their method screws up my printer if
- I plug it in before the camera. */
-
-int
-qc_detect (const struct qcam *q)
-{
- int reg, lastreg;
- int count = 0;
- int i;
-
- lastreg = reg = read_lpstatus (q) & 0xf0;
-
- for (i = 0; i < 30; i++) {
- reg = read_lpstatus (q) & 0xf0;
- if (reg != lastreg)
- count++;
- lastreg = reg;
- usleep (10000);
- }
-
- /* Be liberal in what you accept... */
-
- if (count > 3 && count < 15)
- return 1; /* found */
- else
- return 0; /* not found */
-}
-
-
-/* Reset the QuickCam. This uses the same sequence the Windows
- * QuickPic program uses. Someone with a bi-directional port should
- * check that bi-directional mode is detected right, and then
- * implement bi-directional mode in qc_readbyte(). */
-
-void
-qc_reset (struct qcam *q)
-{
- switch (q->port_mode & QC_FORCE_MASK) {
- case QC_FORCE_UNIDIR:
- q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR;
- break;
-
- case QC_FORCE_BIDIR:
- q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR;
- break;
-
- case QC_ANY:
- write_lpcontrol (q, 0x20);
- write_lpdata (q, 0x75);
-
- if (read_lpdata (q) != 0x75) {
- q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR;
- } else {
- q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR;
- }
- break;
-
- case QC_FORCE_SERIAL:
- default:
- fprintf (stderr, "Illegal port_mode %x\n", q->port_mode);
- break;
- }
-
- /* usleep(250); */
- write_lpcontrol (q, 0xb);
- usleep (250);
- write_lpcontrol (q, 0xe);
- (void) qc_setscanmode (q); /* in case port_mode changed */
-}
-
-
-/* Decide which scan mode to use. There's no real requirement that
- * the scanmode match the resolution in q->height and q-> width -- the
- * camera takes the picture at the resolution specified in the
- * "scanmode" and then returns the image at the resolution specified
- * with the resolution commands. If the scan is bigger than the
- * requested resolution, the upper-left hand corner of the scan is
- * returned. If the scan is smaller, then the rest of the image
- * returned contains garbage. */
-
-static int
-qc_setscanmode (struct qcam *q)
-{
- switch (q->transfer_scale) {
- case 1:
- q->mode = 0;
- break;
- case 2:
- q->mode = 4;
- break;
- case 4:
- q->mode = 8;
- break;
- default:
- return 1;
- }
-
- switch (q->bpp) {
- case 4:
- break;
- case 6:
- q->mode += 2;
- break;
- default:
- fprintf (stderr, "Error: Unsupported bit depth\n");
- return 1;
- }
-
- switch (q->port_mode & QC_MODE_MASK) {
- case QC_BIDIR:
- q->mode += 1;
- break;
- case QC_NOTSET:
- case QC_UNIDIR:
- break;
- default:
- return 1;
- }
- return 0;
-}
-
-
-/* Reset the QuickCam and program for brightness, contrast,
- * white-balance, and resolution. */
-
-void
-qc_set (struct qcam *q)
-{
- int val;
- int val2;
-
- qc_reset (q);
-
- /* Set the brightness. Yes, this is repetitive, but it works.
- * Shorter versions seem to fail subtly. Feel free to try :-). */
- /* I think the problem was in qc_command, not here -- bls */
- qc_command (q, 0xb);
- qc_command (q, q->brightness);
-
- val = q->height / q->transfer_scale;
- qc_command (q, 0x11);
- qc_command (q, val);
- if ((q->port_mode & QC_MODE_MASK) == QC_UNIDIR && q->bpp == 6) {
- /* The normal "transfers per line" calculation doesn't seem to work
- as expected here (and yet it works fine in qc_scan). No idea
- why this case is the odd man out. Fortunately, Laird's original
- working version gives me a good way to guess at working values.
- -- bls */
- val = q->width;
- val2 = q->transfer_scale * 4;
- } else {
- val = q->width * q->bpp;
- val2 = (((q->port_mode & QC_MODE_MASK) == QC_BIDIR) ? 24 : 8) *
- q->transfer_scale;
- }
- val = (val + val2 - 1) / val2;
- qc_command (q, 0x13);
- qc_command (q, val);
-
- /* I still don't know what these do! */
- /* They're setting top and left -- bls */
- qc_command (q, 0xd);
- qc_command (q, q->top);
- qc_command (q, 0xf);
- qc_command (q, q->left / 2);
-
- qc_command (q, 0x19);
- qc_command (q, q->contrast);
- qc_command (q, 0x1f);
- qc_command (q, q->whitebal);
-}
-
-
-/* Qc_readbytes reads some bytes from the QC and puts them in
- the supplied buffer. It returns the number of bytes read,
- or -1 on error. */
-
-static int __inline__
-qc_readbytes (const struct qcam *q, char buffer[])
-{
- int ret;
- unsigned int hi, lo;
- unsigned int hi2, lo2;
- static unsigned int saved_bits;
- static int state = 0;
-
- if (buffer == NULL) {
- state = 0;
- return 0;
- }
-
- switch (q->port_mode & QC_MODE_MASK) {
- case QC_BIDIR: /* Bi-directional Port */
- write_lpcontrol (q, 0x26);
- lo = (qc_waithand2 (q, 1) >> 1);
- hi = (read_lpstatus (q) >> 3) & 0x1f;
- write_lpcontrol (q, 0x2e);
- lo2 = (qc_waithand2 (q, 0) >> 1);
- hi2 = (read_lpstatus (q) >> 3) & 0x1f;
- switch (q->bpp) {
- case 4:
- buffer[0] = lo & 0xf;
- buffer[1] = ((lo & 0x70) >> 4) | ((hi & 1) << 3);
- buffer[2] = (hi & 0x1e) >> 1;
- buffer[3] = lo2 & 0xf;
- buffer[4] = ((lo2 & 0x70) >> 4) | ((hi2 & 1) << 3);
- buffer[5] = (hi2 & 0x1e) >> 1;
- ret = 6;
- break;
- case 6:
- buffer[0] = lo & 0x3f;
- buffer[1] = ((lo & 0x40) >> 6) | (hi << 1);
- buffer[2] = lo2 & 0x3f;
- buffer[3] = ((lo2 & 0x40) >> 6) | (hi2 << 1);
- ret = 4;
- break;
- default:
- fprintf (stderr, "Bad bidir pixel depth %d\n", q->bpp);
- ret = -1;
- break;
- }
- break;
-
- case QC_UNIDIR: /* Unidirectional Port */
- write_lpcontrol (q, 6);
- lo = (qc_waithand (q, 1) & 0xf0) >> 4;
- write_lpcontrol (q, 0xe);
- hi = (qc_waithand (q, 0) & 0xf0) >> 4;
-
- switch (q->bpp) {
- case 4:
- buffer[0] = lo;
- buffer[1] = hi;
- ret = 2;
- break;
- case 6:
- switch (state) {
- case 0:
- buffer[0] = (lo << 2) | ((hi & 0xc) >> 2);
- saved_bits = (hi & 3) << 4;
- state = 1;
- ret = 1;
- break;
- case 1:
- buffer[0] = lo | saved_bits;
- saved_bits = hi << 2;
- state = 2;
- ret = 1;
- break;
- case 2:
- buffer[0] = ((lo & 0xc) >> 2) | saved_bits;
- buffer[1] = ((lo & 3) << 4) | hi;
- state = 0;
- ret = 2;
- break;
- default:
- fprintf (stderr, "Unidir 6-bit state %d?\n", state);
- ret = -1;
- break;
- }
- break;
- default:
- fprintf (stderr, "Bad unidir pixel depth %d\n", q->bpp);
- ret = -1;
- break;
- }
- break;
- case QC_SERIAL: /* Serial Interface. Just in case. */
- default:
- fprintf (stderr, "Mode %x not supported\n", q->port_mode);
- ret = -1;
- break;
- }
- return ret;
-}
-
-/* Read a scan from the QC. This takes the qcam structure and
- * requests a scan from the camera. It sends the correct instructions
- * to the camera and then reads back the correct number of bytes. In
- * previous versions of this routine the return structure contained
- * the raw output from the camera, and there was a 'qc_convertscan'
- * function that converted that to a useful format. In version 0.3 I
- * rolled qc_convertscan into qc_scan and now I only return the
- * converted scan. The format is just an one-dimensional array of
- * characters, one for each pixel, with 0=black up to n=white, where
- * n=2^(bit depth)-1. Ask me for more details if you don't understand
- * this. */
-
-scanbuf *
-qc_scan (const struct qcam * q)
-{
- unsigned char *ret;
- int i, j, k;
- int bytes;
- int linestotrans, transperline;
- int divisor;
- int pixels_per_line;
- int pixels_read;
- char buffer[6];
- char invert;
-
- if (q->mode != -1) {
- qc_command (q, 0x7);
- qc_command (q, q->mode);
- } else {
- struct qcam bogus_cam;
-
- /* We're going through these odd hoops to retain the "const"
- qualification on q. We can't do a qc_setscanmode directly on q,
- so we copy it, do a setscanmode on that, and pass in the newly
- computed mode. -- bls 11/21/96
- */
-
-#ifdef DEBUG
- fprintf (stderr, "Warning! qc->mode not set!\n");
-#endif
- bogus_cam = *q;
- (void) qc_setscanmode (&bogus_cam);
- qc_command (q, 0x7);
- qc_command (q, bogus_cam.mode);
- }
-
- if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) {
- write_lpcontrol (q, 0x2e); /* turn port around */
- write_lpcontrol (q, 0x26);
- (void) qc_waithand (q, 1);
- write_lpcontrol (q, 0x2e);
- (void) qc_waithand (q, 0);
- }
-
- /* strange -- should be 15:63 below, but 4bpp is odd */
- invert = (q->bpp == 4) ? 16 : 63;
-
- linestotrans = q->height / q->transfer_scale;
- pixels_per_line = q->width / q->transfer_scale;
- transperline = q->width * q->bpp;
- divisor = (((q->port_mode & QC_MODE_MASK) == QC_BIDIR) ? 24 : 8) *
- q->transfer_scale;
- transperline = (transperline + divisor - 1) / divisor;
-
- ret = malloc (linestotrans * pixels_per_line);
- assert (ret);
-
-#ifdef DEBUG
- fprintf (stderr, "%s %d bpp\n%d lines of %d transfers each\n",
- ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) ? "Bidir" : "Unidir",
- q->bpp, linestotrans, transperline);
-#endif
-
- for (i = 0; i < linestotrans; i++) {
- for (pixels_read = j = 0; j < transperline; j++) {
- bytes = qc_readbytes (q, buffer);
- assert (bytes > 0);
- for (k = 0; k < bytes && (pixels_read + k) < pixels_per_line; k++) {
- assert (buffer[k] <= invert);
- assert (buffer[k] >= 0);
- if (buffer[k] == 0 && invert == 16) {
- /* 4bpp is odd (again) -- inverter is 16, not 15, but output
- must be 0-15 -- bls */
- buffer[k] = 16;
- }
- ret[i * pixels_per_line + pixels_read + k] = invert - buffer[k];
- }
- pixels_read += bytes;
- }
- (void) qc_readbytes (q, 0); /* reset state machine */
- }
-
- if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) {
- write_lpcontrol (q, 2);
- write_lpcontrol (q, 6);
- usleep (3);
- write_lpcontrol (q, 0xe);
- }
-
- return ret;
-}
-
-
-void
-qc_dump (const struct qcam *q, char *fname)
-{
- FILE *fp;
- time_t t;
-
- if ((fp = fopen (fname, "w")) == 0) {
- fprintf (stderr, "Error: cannot open %s\n", fname);
- return;
- }
-
- fprintf (fp, "# Version 0.9\n");
- time (&t);
- fprintf (fp, "# Created %s", ctime (&t));
- fprintf (fp, "Width %d\nHeight %d\n", q->width, q->height);
- fprintf (fp, "Top %d\nLeft %d\n", q->top, q->left);
- fprintf (fp, "Bpp %d\nContrast %d\n", q->bpp, q->contrast);
- fprintf (fp, "Brightness %d\nWhitebal %d\n", q->brightness, q->whitebal);
- fprintf (fp, "Port 0x%x\nScale %d\n", q->port, q->transfer_scale);
- fclose (fp);
-}
diff --git a/sys/qcam/qcam-os.c b/sys/qcam/qcam-os.c
deleted file mode 100644
index 5a8f12591..000000000
--- a/sys/qcam/qcam-os.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/* qcam-Linux.c -- Linux-specific routines for accessing QuickCam */
-
-/* Version 0.1, January 2, 1996 */
-/* Version 0.5, August 24, 1996 */
-
-#define LOCALSTATEDIR ""
-//#define LOCALSTATEDIR "/var/run"
-
-/******************************************************************
-
-Copyright (C) 1996 by Scott Laird
-
-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 SCOTT LAIRD 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.
-
-******************************************************************/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <unistd.h>
-#ifdef TESTING
-#include <errno.h>
-#endif
-#include <sys/io.h>
-
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include "qcam.h"
-#include "qcam-Linux.h"
-
-int __inline__
-read_lpstatus (const struct qcam *q)
-{
- return inb (q->port + 1);
-}
-
-int
-read_lpcontrol (const struct qcam *q)
-{
- return inb (q->port + 2);
-}
-
-int
-read_lpdata (const struct qcam *q)
-{
- return inb (q->port);
-}
-
-void
-write_lpdata (const struct qcam *q, int d)
-{
- outb (d, q->port);
-}
-
-void
-write_lpcontrol (const struct qcam *q, int d)
-{
- outb (d, q->port + 2);
-}
-
-int
-enable_ports (const struct qcam *q)
-{
- if (q->port < 0x278)
- return 1; /* Better safe than sorry */
- if (q->port > 0x3bc)
- return 1;
- return (ioperm (q->port, 3, 1));
-}
-
-int
-disable_ports (const struct qcam *q)
-{
- return (ioperm (q->port, 3, 0));
-}
-
-/* Lock port. This is currently sub-optimal, and is begging to be
- fixed. It should check for dead locks. Any takers? */
-
-/* qc_lock_wait
- * This function uses POSIX fcntl-style locking on a file created in the
- * /tmp directory. Because it uses the Unix record locking facility, locks
- * are relinquished automatically on process termination, so "dead locks"
- * are not a problem. (FYI, the lock file will remain after process
- * termination, but this is actually desired so that the next process need
- * not re-creat(2)e it... just lock it.)
- * The wait argument indicates whether or not this funciton should "block"
- * waiting for the previous lock to be relinquished. This is ideal so that
- * multiple processes (eg. qcam) taking "snapshots" can peacefully coexist.
- * - Dave Plonka (plonka@carroll1.cc.edu)
- */
-int
-qc_lock_wait (struct qcam *q, int wait)
-{
-#if 1
- static struct flock sfl;
-
- if (-1 == q->fd) { /* we've yet to open the lock file */
- static char lockfile[128];
-
- sprintf (lockfile, LOCALSTATEDIR "LOCK.qcam.0x%x", q->port);
- if (-1 == (q->fd = open (lockfile, O_WRONLY | O_CREAT, 0666))) {
- perror ("open");
- return 1;
- }
-#ifdef TESTING
- fprintf (stderr, "%s - %d: %s open(2)ed\n", __FILE__, __LINE__, lockfile);
-#endif
-
- /* initialize the l_type memver to lock the file exclusively */
- sfl.l_type = F_WRLCK;
- }
-#ifdef TESTING
- if (0 != fcntl (q->fd, F_SETLK, &sfl)) /* non-blocking set lock */
-#else
- if (0 != fcntl (q->fd, wait ? F_SETLKW : F_SETLK, &sfl))
-#endif
- {
-#ifdef TESTING
- perror ("fcntl");
- if (EAGAIN != errno || !wait)
- return 1;
-
- fprintf (stderr, "%s - %d: waiting for exclusive lock on fd %d...\n",
- __FILE__, __LINE__, q->fd);
-
- if (0 != fcntl (q->fd, F_SETLKW, &sfl)) /* "blocking" set lock */
-#endif
- {
- perror ("fcntl");
- return 1;
- }
- }
-#ifdef TESTING
- fprintf (stderr, "%s - %d: fd %d locked exclusively\n", __FILE__, __LINE__,
- q->fd);
-#endif
-
-#else
- char lockfile[128], tmp[128];
- struct stat statbuf;
-
- sprintf (lockfile, LOCALSTATEDIR "/LOCK.qcam.0x%x", q->port);
- sprintf (tmp, "%s-%d", lockfile, getpid ());
-
- if ((creat (tmp, 0) == -1) ||
- (link (tmp, lockfile) == -1) ||
- (stat (tmp, &statbuf) == -1) || (statbuf.st_nlink == 1)) {
-#ifdef DEBUGQC
- perror ("QuickCam Locked");
- if (unlink (tmp) == -1)
- perror ("Error unlinking temp file.");
-#else
- unlink (tmp);
-#endif
- return 1;
- }
-
- unlink (tmp);
- if (chown (lockfile, getuid (), getgid ()) == -1)
- perror ("Chown problems");
-#endif
-
- return 0;
-}
-
-int
-qc_lock (struct qcam *q)
-{
-#if 1
- return qc_lock_wait (q, 1 /*wait */ );
-#else
- return qc_lock_wait (q, 0 /*don't wait */ );
-#endif
-}
-
-/* Unlock port */
-
-int
-qc_unlock (struct qcam *q)
-{
- static struct flock sfl;
-
-#if 1
- if (-1 == q->fd) { /* port was not locked */
- return 1;
- }
-
- /* clear the exclusive lock */
- sfl.l_type = F_UNLCK;
- if (0 != fcntl (q->fd, F_SETLK, &sfl)) {
- perror ("fcntl");
- return 1;
- }
-#ifdef TESTING
- fprintf (stderr, "%s - %d: fd %d unlocked\n", __FILE__, __LINE__, q->fd);
-#endif
-
-#else
- char lockfile[128];
-
- sprintf (lockfile, LOCALSTATEDIR "/LOCK.qcam.0x%x", q->port);
- unlink (lockfile); /* What would I do with an error? */
-#endif
-
- return 0;
-}
-
-
-/* Probe for camera. Returns 0 if found, 1 if not found, sets
- q->port.*/
-
-int
-qc_probe (struct qcam *q)
-{
- int ioports[] = { 0x378, 0x278, 0x3bc, 0 };
- int i = 0;
-
- /* Attempt to get permission to access IO ports. Must be root */
-
- while (ioports[i] != 0) {
- q->port = ioports[i++];
-
- if (qc_open (q)) {
- perror ("Can't get I/O permission");
- exit (1);
- }
-
- if (qc_detect (q)) {
- fprintf (stderr, "QuickCam detected at 0x%x\n", q->port);
- qc_close (q);
- return (0);
- } else
- qc_close (q);
- }
-
- return 1;
-}
-
-
-/* THIS IS UGLY. I need a short delay loop -- somthing well under a
-millisecond. Unfortunately, adding 2 usleep(1)'s to qc_command slowed
-it down by a factor of over 1000 over the same loop with 2
-usleep(0)'s, and that's too slow -- qc_start was taking over a second
-to run. This seems to help, but if anyone has a good
-speed-independent pause routine, please tell me. -- Scott */
-
-void
-qc_wait (int val)
-{
- int i;
-
- while (val--)
- for (i = 0; i < 50000; i++);
-}
diff --git a/sys/qcam/qcam-os.h b/sys/qcam/qcam-os.h
deleted file mode 100644
index 46dcbe519..000000000
--- a/sys/qcam/qcam-os.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* qcam-linux.h -- Linux-specific routines for accessing QuickCam */
-
-/* Version 0.1, January 2, 1996 */
-/* Version 0.5, August 24, 1996 */
-
-
-/******************************************************************
-
-Copyright (C) 1996 by Scott Laird
-
-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 SCOTT LAIRD 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.
-
-******************************************************************/
-
-
diff --git a/sys/qcam/qcam.h b/sys/qcam/qcam.h
deleted file mode 100644
index 35b2dc267..000000000
--- a/sys/qcam/qcam.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* qcam.h -- routines for accessing the Connectix QuickCam */
-
-/* Version 0.1, January 2, 1996 */
-/* Version 0.5, August 24, 1996 */
-/* Version 0.7, August 26, 1996 */
-
-
-/******************************************************************
-
-Copyright (C) 1996 by Scott Laird
-
-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 SCOTT LAIRD 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 _QCAM_H
-#define _QCAM_H
-
-#define QC_VERSION "0.91"
-
-/* One from column A... */
-#define QC_NOTSET 0
-#define QC_UNIDIR 1
-#define QC_BIDIR 2
-#define QC_SERIAL 3
-
-/* ... and one from column B */
-#define QC_ANY 0x00
-#define QC_FORCE_UNIDIR 0x10
-#define QC_FORCE_BIDIR 0x20
-#define QC_FORCE_SERIAL 0x30
-/* in the port_mode member */
-
-#define QC_MODE_MASK 0x07
-#define QC_FORCE_MASK 0x70
-
-#define MAX_HEIGHT 243
-#define MAX_WIDTH 336
-
-struct qcam {
- int width, height;
- int bpp;
- int mode;
- int contrast, brightness, whitebal;
- int port;
- int port_mode;
- int transfer_scale;
- int top, left;
- int fd; /* lock file descriptor
- * It was, unfortunately, necessary to add this member to the
- * struct qcam to conveniently implement POSIX fcntl-style locking.
- * We need a seperate lock file for each struct qcam, for instance,
- * if the same process (using qcam-lib) is accessing multiple
- * QuickCams on (of course) multiple ports.
- * - Dave Plonka (plonka@carroll1.cc.edu)
- */
-};
-
-typedef unsigned char scanbuf;
-
-/* General QuickCam handling routines */
-
-int qc_getbrightness(const struct qcam *q);
-int qc_setbrightness(struct qcam *q, int val);
-int qc_getcontrast(const struct qcam *q);
-int qc_setcontrast(struct qcam *q, int val);
-int qc_getwhitebal(const struct qcam *q);
-int qc_setwhitebal(struct qcam *q, int val);
-void qc_getresolution(const struct qcam *q, int *x, int *y);
-int qc_setresolution(struct qcam *q, int x, int y);
-int qc_getbitdepth(const struct qcam *q);
-int qc_setbitdepth(struct qcam *q, int val);
-int qc_getheight(const struct qcam *q);
-int qc_setheight(struct qcam *q, int y);
-int qc_getwidth(const struct qcam *q);
-int qc_setwidth(struct qcam *q, int x);
-int qc_gettop(const struct qcam *q);
-int qc_settop(struct qcam *q, int val);
-int qc_getleft(const struct qcam *q);
-int qc_setleft(struct qcam *q, int val);
-int qc_gettransfer_scale(const struct qcam *q);
-int qc_settransfer_scale(struct qcam *q, int val);
-int qc_calibrate(struct qcam *q);
-int qc_forceunidir(struct qcam *q);
-void qc_dump(const struct qcam *q, char *file);
-
-struct qcam *qc_init(void);
-int qc_initfile(struct qcam *q, char *fname);
-int qc_open(struct qcam *q);
-int qc_close(struct qcam *q);
-int qc_detect(const struct qcam *q);
-void qc_reset(struct qcam *q);
-void qc_set(struct qcam *q);
-scanbuf *qc_scan(const struct qcam *q);
-scanbuf *qc_convertscan(struct qcam *q, scanbuf *scan);
-void qc_writepgm(const struct qcam *q, FILE *f, scanbuf *scan);
-void qc_wait(int val);
-
-/* OS/hardware specific routines */
-
-int read_lpstatus(const struct qcam *q);
-int read_lpcontrol(const struct qcam *q);
-int read_lpdata(const struct qcam *q);
-void write_lpdata(const struct qcam *q, int d);
-void write_lpcontrol(const struct qcam *q, int d);
-int enable_ports(const struct qcam *q);
-int disable_ports(const struct qcam *q);
-int qc_unlock(struct qcam *q);
-int qc_lock(struct qcam *q);
-void qc_wait(int val);
-int qc_probe(struct qcam *q);
-
-/* Image processing routines */
-int fixdark(const struct qcam *q, scanbuf *scan);
-int qc_edge_detect(const struct qcam *q, scanbuf *scan, int tolerance);
-
-#endif /*! _QCAM_H*/
diff --git a/sys/qcam/qcamip.h b/sys/qcam/qcamip.h
deleted file mode 100644
index 3bab6fafb..000000000
--- a/sys/qcam/qcamip.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * qcamip.h - Connectix QuickCam Image Processing routines
- *
- * Time-stamp: <02 Sep 96 11:19:27 HST edo@eosys.com>
- *
- * Version 0.2
- */
-
-/******************************************************************
-
-Copyright (C) 1996 by Ed Orcutt Systems
-
-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, and/or distribute copies of the
-Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-1. The above copyright notice and this permission notice shall
- be included in all copies or substantial portions of the
- Software.
-
-2. Redistribution for profit requires the express, written
- permission of the author.
-
-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 ED ORCUTT SYSTEMS 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 _QCAMIP_H
-#define _QCAMIP_H
-#include "qcam.h"
-
-/* Auto exposure modes */
-
-#define AE_ALL_AVG 0
-#define AE_CTR_AVG 1
-#define AE_STD_AVG 2
-
-/* Return value of image processing routines */
-
-#define QCIP_XPSR_OK 0
-#define QCIP_XPSR_RSCN 1
-#define QCIP_XPSR_ERR 2
-#define QCIP_XPSR_LUM_INVLD 3
-
-/* Prototypes for image processing routines */
-
-int qcip_autoexposure(struct qcam *q, scanbuf *scan);
-int qcip_set_luminance_target(struct qcam *q, int val);
-int qcip_set_luminance_tolerance(struct qcam *q, int val);
-int qcip_set_luminance_std_target(struct qcam *q, int val);
-int qcip_set_luminance_std_tolerance(struct qcam *q, int val);
-int qcip_set_autoexposure_mode(int val);
-void qcip_histogram(struct qcam *q, scanbuf *scan, int *histogram);
-void qcip_display_histogram(struct qcam *q, scanbuf *scan);
-
-#endif /*! _QCAMIP_H*/
diff --git a/sys/wininet/Makefile.am b/sys/wininet/Makefile.am
deleted file mode 100644
index 816d868f9..000000000
--- a/sys/wininet/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-plugin_LTLIBRARIES = libgstwininet.la
-
-libgstwininet_la_SOURCES = gstwininetsrc.c
-
-libgstwininet_la_CFLAGS = $(GST_BASE_CFLAGS) $(GST_CFLAGS)
-libgstwininet_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) -lwininet
-libgstwininet_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-libgstwininet_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
-
-noinst_HEADERS = gstwininetsrc.h
-
diff --git a/sys/wininet/gstwininetsrc.c b/sys/wininet/gstwininetsrc.c
deleted file mode 100644
index 60d29446a..000000000
--- a/sys/wininet/gstwininetsrc.c
+++ /dev/null
@@ -1,450 +0,0 @@
-/* GStreamer Windows network source
- * Copyright (C) 2008 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-/**
- * SECTION:element-wininetsrc
- *
- * <refsect2>
- * <title>Example launch line</title>
- * |[
- * gst-launch-1.0 -v wininetsrc location="http://71.83.57.210:9000" ! application/x-icy,metadata-interval=0 ! icydemux ! mad ! audioconvert ! directsoundsink
- * ]| receive mp3 audio over http and play it back.
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "gstwininetsrc.h"
-
-#include <string.h>
-
-#define DEFAULT_LOCATION "http://localhost/"
-#define DEFAULT_POLL_MODE FALSE
-#define DEFAULT_IRADIO_MODE TRUE
-
-enum
-{
- PROP_0,
- PROP_LOCATION,
- PROP_POLL_MODE,
- PROP_IRADIO_MODE
-};
-
-GST_DEBUG_CATEGORY_STATIC (gst_win_inet_src_debug);
-#define GST_CAT_DEFAULT gst_win_inet_src_debug
-
-static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-static void gst_win_inet_src_init_interfaces (GType type);
-static void gst_win_inet_src_uri_handler_init (gpointer g_iface,
- gpointer iface_data);
-
-static void gst_win_inet_src_dispose (GObject * object);
-static void gst_win_inet_src_finalize (GObject * object);
-static void gst_win_inet_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-static void gst_win_inet_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-
-static gboolean gst_win_inet_src_start (GstBaseSrc * basesrc);
-static gboolean gst_win_inet_src_stop (GstBaseSrc * basesrc);
-
-static GstFlowReturn gst_win_inet_src_create (GstPushSrc * pushsrc,
- GstBuffer ** buffer);
-
-static void gst_win_inet_src_reset (GstWinInetSrc * self);
-
-GST_BOILERPLATE_FULL (GstWinInetSrc, gst_win_inet_src, GstPushSrc,
- GST_TYPE_PUSH_SRC, gst_win_inet_src_init_interfaces);
-
-static void
-gst_win_inet_src_base_init (gpointer gclass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
- gst_element_class_add_static_pad_template (element_class, &src_template);
-
- gst_element_class_set_static_metadata (element_class,
- "Windows Network Source", "Source/Network",
- "Receive data as a client over the network via HTTP or FTP",
- "Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>");
-}
-
-static void
-gst_win_inet_src_class_init (GstWinInetSrcClass * klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GstBaseSrcClass *gstbasesrc_class = GST_BASE_SRC_CLASS (klass);
- GstPushSrcClass *gstpushsrc_class = GST_PUSH_SRC_CLASS (klass);
-
- gobject_class->dispose = gst_win_inet_src_dispose;
- gobject_class->finalize = gst_win_inet_src_finalize;
- gobject_class->get_property = gst_win_inet_src_get_property;
- gobject_class->set_property = gst_win_inet_src_set_property;
-
- gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_win_inet_src_start);
- gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_win_inet_src_stop);
- gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_win_inet_src_create);
-
- g_object_class_install_property (gobject_class,
- PROP_LOCATION, g_param_spec_string ("location", "Location",
- "Location to read from", DEFAULT_LOCATION, G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class,
- PROP_POLL_MODE, g_param_spec_boolean ("poll-mode", "poll-mode",
- "Enable poll mode (keep re-issuing request)",
- DEFAULT_POLL_MODE, G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class,
- PROP_IRADIO_MODE, g_param_spec_boolean ("iradio-mode", "iradio-mode",
- "Enable Internet radio mode "
- "(extraction of shoutcast/icecast metadata)",
- DEFAULT_IRADIO_MODE, G_PARAM_READWRITE));
-}
-
-static void
-gst_win_inet_src_init_interfaces (GType type)
-{
- static const GInterfaceInfo uri_handler_info = {
- gst_win_inet_src_uri_handler_init,
- NULL,
- NULL
- };
-
- g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &uri_handler_info);
-
- GST_DEBUG_CATEGORY_INIT (gst_win_inet_src_debug, "wininetsrc",
- 0, "Wininet source");
-}
-
-static void
-gst_win_inet_src_init (GstWinInetSrc * self, GstWinInetSrcClass * gclass)
-{
- self->location = g_strdup (DEFAULT_LOCATION);
- self->poll_mode = DEFAULT_POLL_MODE;
- self->iradio_mode = DEFAULT_IRADIO_MODE;
-
- self->inet = NULL;
- self->url = NULL;
- self->cur_offset = 0;
- self->icy_caps = NULL;
-}
-
-static void
-gst_win_inet_src_dispose (GObject * object)
-{
- GstWinInetSrc *self = GST_WIN_INET_SRC (object);
-
- gst_win_inet_src_reset (self);
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-gst_win_inet_src_finalize (GObject * object)
-{
- GstWinInetSrc *self = GST_WIN_INET_SRC (object);
-
- g_free (self->location);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_win_inet_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstWinInetSrc *self = GST_WIN_INET_SRC (object);
-
- switch (prop_id) {
- case PROP_LOCATION:
- g_value_set_string (value, self->location);
- break;
-
- case PROP_POLL_MODE:
- g_value_set_boolean (value, self->poll_mode);
- break;
-
- case PROP_IRADIO_MODE:
- g_value_set_boolean (value, self->iradio_mode);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_win_inet_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstWinInetSrc *self = GST_WIN_INET_SRC (object);
-
- switch (prop_id) {
- case PROP_LOCATION:
- if (GST_STATE (self) == GST_STATE_PLAYING ||
- GST_STATE (self) == GST_STATE_PAUSED) {
- GST_WARNING_OBJECT (self, "element must be in stopped or paused state "
- "in order to change location");
- break;
- }
-
- g_free (self->location);
- self->location = g_value_dup_string (value);
- break;
-
- case PROP_POLL_MODE:
- self->poll_mode = g_value_get_boolean (value);
- break;
-
- case PROP_IRADIO_MODE:
- self->iradio_mode = g_value_get_boolean (value);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_win_inet_src_reset (GstWinInetSrc * self)
-{
- if (self->url != NULL) {
- InternetCloseHandle (self->url);
- self->url = NULL;
- }
-
- if (self->inet != NULL) {
- InternetCloseHandle (self->inet);
- self->inet = NULL;
- }
-
- if (self->icy_caps != NULL) {
- gst_caps_unref (self->icy_caps);
- self->icy_caps = NULL;
- }
-
- self->cur_offset = 0;
-}
-
-static gboolean
-gst_win_inet_src_get_header_value_as_int (GstWinInetSrc * self,
- const gchar * header_name, gint * header_value, gboolean log_failure)
-{
- gchar buf[16] = { 0, };
- DWORD buf_size = sizeof (buf);
- gint *value = (gint *) buf;
-
- strcpy (buf, header_name);
-
- if (!HttpQueryInfo (self->url, HTTP_QUERY_CUSTOM | HTTP_QUERY_FLAG_NUMBER,
- buf, &buf_size, NULL)) {
- if (log_failure) {
- DWORD error_code = GetLastError ();
- const gchar *error_str = "unknown error";
-
- if (error_code == ERROR_HTTP_HEADER_NOT_FOUND)
- error_str = "ERROR_HTTP_HEADER_NOT_FOUND";
-
- GST_WARNING_OBJECT (self, "HttpQueryInfo for header '%s' failed: %s "
- "(0x%08lx)", header_name, error_str, error_code);
- }
-
- return FALSE;
- }
-
- *header_value = *value;
- return TRUE;
-}
-
-static gboolean
-gst_win_inet_src_open (GstWinInetSrc * self)
-{
- const gchar *extra_headers = NULL;
-
- gst_win_inet_src_reset (self);
-
- self->inet = InternetOpen (NULL, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
- if (self->inet == NULL)
- goto error;
-
- if (self->iradio_mode)
- extra_headers = "Icy-MetaData:1"; /* exactly as sent by WinAmp, no space */
-
- self->url = InternetOpenUrl (self->inet, self->location, extra_headers,
- (extra_headers != NULL) ? -1 : 0, INTERNET_FLAG_NO_UI, (DWORD_PTR) self);
- if (self->url == NULL)
- goto error;
-
- if (self->iradio_mode) {
- gint value;
-
- if (gst_win_inet_src_get_header_value_as_int (self, "icy-metaint", &value,
- TRUE)) {
- self->icy_caps = gst_caps_new_simple ("application/x-icy",
- "metadata-interval", G_TYPE_INT, value, NULL);
- }
- }
-
- return TRUE;
-
-error:
- GST_ELEMENT_ERROR (self, RESOURCE, NOT_FOUND, (NULL),
- ("Could not open location \"%s\" for reading: 0x%08lx",
- self->location, GetLastError ()));
- gst_win_inet_src_reset (self);
-
- return FALSE;
-}
-
-static gboolean
-gst_win_inet_src_start (GstBaseSrc * basesrc)
-{
- GstWinInetSrc *self = GST_WIN_INET_SRC (basesrc);
-
- return gst_win_inet_src_open (self);
-}
-
-static gboolean
-gst_win_inet_src_stop (GstBaseSrc * basesrc)
-{
- gst_win_inet_src_reset (GST_WIN_INET_SRC (basesrc));
-
- return TRUE;
-}
-
-static GstFlowReturn
-gst_win_inet_src_create (GstPushSrc * pushsrc, GstBuffer ** buffer)
-{
- GstWinInetSrc *self = GST_WIN_INET_SRC (pushsrc);
- GstBaseSrc *basesrc = GST_BASE_SRC (pushsrc);
- GstBuffer *buf = NULL;
- GstFlowReturn ret = GST_FLOW_OK;
- DWORD bytes_read = 0;
-
- do {
- GstCaps *caps = GST_PAD_CAPS (GST_BASE_SRC_PAD (self));
-
- if (self->icy_caps != NULL)
- caps = self->icy_caps;
-
- ret = gst_pad_alloc_buffer (GST_BASE_SRC_PAD (basesrc),
- self->cur_offset, basesrc->blocksize, caps, &buf);
-
- if (G_LIKELY (ret == GST_FLOW_OK)) {
- if (InternetReadFile (self->url, GST_BUFFER_DATA (buf),
- basesrc->blocksize, &bytes_read)) {
- if (bytes_read == 0) {
- if (self->poll_mode) {
- if (gst_win_inet_src_open (self)) {
- gst_buffer_unref (buf);
- buf = NULL;
- } else {
- ret = GST_FLOW_ERROR;
- }
- } else {
- GST_ERROR_OBJECT (self, "short read (eof?)");
- ret = GST_FLOW_UNEXPECTED;
- }
- }
- } else {
- GST_ERROR_OBJECT (self, "InternetReadFile failed: 0x%08lx",
- GetLastError ());
-
- ret = GST_FLOW_ERROR;
- }
- }
- }
- while (bytes_read == 0 && ret == GST_FLOW_OK);
-
- if (ret == GST_FLOW_OK) {
- GST_BUFFER_SIZE (buf) = bytes_read;
- self->cur_offset += bytes_read;
-
- *buffer = buf;
- } else {
- if (buf != NULL)
- gst_buffer_unref (buf);
- }
-
- return ret;
-}
-
-static GstURIType
-gst_win_inet_src_uri_get_type (void)
-{
- return GST_URI_SRC;
-}
-
-static gchar **
-gst_win_inet_src_uri_get_protocols (void)
-{
- static const gchar *protocols[] = { "http", "https", "ftp", NULL };
-
- return (gchar **) protocols;
-}
-
-static const gchar *
-gst_win_inet_src_uri_get_uri (GstURIHandler * handler)
-{
- GstWinInetSrc *src = GST_WIN_INET_SRC (handler);
-
- return src->location;
-}
-
-static gboolean
-gst_win_inet_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
-{
- GstWinInetSrc *src = GST_WIN_INET_SRC (handler);
-
- g_free (src->location);
- src->location = g_strdup (uri);
- return TRUE;
-}
-
-static void
-gst_win_inet_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
-{
- GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
-
- iface->get_type = gst_win_inet_src_uri_get_type;
- iface->get_protocols = gst_win_inet_src_uri_get_protocols;
- iface->get_uri = gst_win_inet_src_uri_get_uri;
- iface->set_uri = gst_win_inet_src_uri_set_uri;
-}
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- return gst_element_register (plugin, "wininetsrc",
- GST_RANK_NONE, GST_TYPE_WIN_INET_SRC);
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- wininet,
- "Windows network plugins",
- plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/sys/wininet/gstwininetsrc.h b/sys/wininet/gstwininetsrc.h
deleted file mode 100644
index 0803d9ec3..000000000
--- a/sys/wininet/gstwininetsrc.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* GStreamer Windows network source
- * Copyright (C) 2008 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef __GST_WIN_INET_SRC_H__
-#define __GST_WIN_INET_SRC_H__
-
-#include <windows.h>
-#include <wininet.h>
-#include <gst/base/gstpushsrc.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_WIN_INET_SRC \
- (gst_win_inet_src_get_type ())
-#define GST_WIN_INET_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WIN_INET_SRC, GstWinInetSrc))
-#define GST_WIN_INET_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WIN_INET_SRC, GstWinInetSrcClass))
-#define GST_IS_WIN_INET_SRC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WIN_INET_SRC))
-#define GST_IS_WIN_INET_SRC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WIN_INET_SRC))
-
-typedef struct _GstWinInetSrc GstWinInetSrc;
-typedef struct _GstWinInetSrcClass GstWinInetSrcClass;
-
-struct _GstWinInetSrc
-{
- GstPushSrc push_src;
-
- /* property storage */
- gchar * location;
- gboolean poll_mode;
- gboolean iradio_mode;
-
- /* state */
- HINTERNET inet;
- HINTERNET url;
- guint64 cur_offset;
- GstCaps * icy_caps;
-};
-
-struct _GstWinInetSrcClass
-{
- GstPushSrcClass parent_class;
-};
-
-GType gst_win_inet_src_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_WIN_INET_SRC_H__ */
-
diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am
index 21c411069..508b3b56f 100644
--- a/tests/check/Makefile.am
+++ b/tests/check/Makefile.am
@@ -14,11 +14,11 @@ AM_TESTS_ENVIRONMENT += \
GST_PLUGIN_SYSTEM_PATH_1_0= \
GST_PLUGIN_PATH_1_0=$(top_builddir)/gst:$(top_builddir)/sys:$(top_builddir)/ext:$(GST_PLUGINS_LIBAV_DIR):$(GST_PLUGINS_UGLY_DIR):$(GST_PLUGINS_GOOD_DIR):$(GST_PLUGINS_BASE_DIR):$(GST_PLUGINS_DIR) \
GST_PLUGIN_LOADING_WHITELIST="gstreamer@$(GST_PLUGINS_DIR):gst-plugins-base@$(GSTPB_PLUGINS_DIR):gst-plugins-good:gst-plugins-ugly:gst-libav:gst-plugins-bad@$(top_builddir)" \
- GST_STATE_IGNORE_ELEMENTS="apexsink avdtpsrc camerabin dc1394src \
- dccpclientsrc dccpclientsink dccpserversrc dccpserversink decklinksrc \
+ GST_STATE_IGNORE_ELEMENTS="avdtpsrc camerabin dc1394src \
+ decklinksrc \
decklinksink dtlssrtpdec dtlssrtpenc dvbsrc dvbbasebin dfbvideosink festival fluidsynth \
- linsyssdisrc linsyssdisink nassink kmssink \
- rsndvdbin sdlaudiosink sdlvideosink vcdsrc rfbsrc vdpauyuvvideo vdpauvideoyuv \
+ kmssink \
+ rsndvdbin vcdsrc rfbsrc vdpauyuvvideo vdpauvideoyuv \
vdpaumpegdec vdpaumpeg4dec vdpauh264dec vdpauvideopostprocess vdpausink neonhttpsrc"
plugindir = $(libdir)/gstreamer-@GST_API_VERSION@
@@ -120,12 +120,6 @@ else
check_x265enc=
endif
-if USE_TIMIDITY
-check_timidity=elements/timidity
-else
-check_timidity=
-endif
-
if USE_KATE
check_kate=elements/kate
else
@@ -247,7 +241,6 @@ check_PROGRAMS = \
$(check_mplex) \
$(check_mssdemux) \
$(check_ofa) \
- $(check_timidity) \
$(check_kate) \
$(check_opencv) \
$(check_curl) \
@@ -446,9 +439,6 @@ elements_jifmux_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(EXIF_CFLAGS) $(AM_CFLAGS)
elements_jifmux_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgsttag-$(GST_API_VERSION) $(GST_CHECK_LIBS) $(EXIF_LIBS) $(LDADD)
elements_jifmux_SOURCES = elements/jifmux.c
-elements_timidity_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS)
-elements_timidity_LDADD = $(GST_BASE_LIBS) $(LDADD)
-
elements_kate_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS)
elements_kate_LDADD = $(GST_BASE_LIBS) $(LDADD)
diff --git a/tests/check/elements/timidity.c b/tests/check/elements/timidity.c
deleted file mode 100644
index 5c85b6567..000000000
--- a/tests/check/elements/timidity.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* GStreamer
- *
- * unit test for timidity/wildmidi
- *
- * Copyright (C) <2007> 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., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <unistd.h>
-
-#include <gst/check/gstcheck.h>
-#include <gst/base/gsttypefindhelper.h>
-
-
-GST_START_TEST (test_midi_typefind)
-{
- const guint8 midi_header[] = {
- 0x4d, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06,
- 0x00, 0x00, 0x00, 0x01, 0x00, 0x60, 0x4d, 0x54,
- 0x72, 0x6b, 0x00, 0x00
- };
- GstTypeFindProbability prob;
- const gchar *type;
- GstBuffer *buf;
- GstCaps *caps = NULL;
-
- buf = gst_buffer_new ();
- GST_BUFFER_DATA (buf) = (guint8 *) midi_header;
- GST_BUFFER_SIZE (buf) = sizeof (midi_header);
- 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/midi");
- 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 *
-timidity_suite (void)
-{
- Suite *s = suite_create ("timidity");
- TCase *tc_chain = tcase_create ("general");
-
- suite_add_tcase (s, tc_chain);
- tcase_add_test (tc_chain, test_midi_typefind);
-
- return s;
-}
-
-GST_CHECK_MAIN (timidity);
diff --git a/tests/icles/dccp/README b/tests/icles/dccp/README
deleted file mode 100644
index e76ead5e5..000000000
--- a/tests/icles/dccp/README
+++ /dev/null
@@ -1,52 +0,0 @@
-Applications
-
-If you want to compile the applications you will need to run this command-line:
-gcc -Wall $(pkg-config --cflags --libs gstreamer-0.10) <applicationName>.c -o <applicationName>
-
-To run:
-./<applicationName>
-
-
-Command-line
-
-###### Pipe to transmit a file #
-
-* Server:
-gst-launch -v filesrc location=file ! dccpserversink port=9011 ccid=2
-
-* Client:
-gst-launch -v dccpclientsrc host=localhost port=9011 ccid=2 ! filesink location=fileDist
-
-###### Pipe to transmit from the microphone #
-
-* Server:
-gst-launch -v alsasrc ! dccpserversink port=9011 ccid=2
-
-* Client:
-gst-launch -v dccpclientsrc host=localhost port=9011 ccid=2 caps="audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)32, depth=(int)32, rate=(int)44100, channels=(int)2" ! alsasink
-
-###### Pipe to transmit a MP3 #
-
-* Server:
-gst-launch -v filesrc location=music.mp3 ! mad ! dccpserversink port=9011 ccid=2
-
-* Client:
-gst-launch -v dccpclientsrc host=localhost port=9011 ccid=2 caps="audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)32, depth=(int)32, rate=(int)44100, channels=(int)2" ! alsasink
-
-###### Pipe to stream a MP3 #
-
-* Server:
-gst-launch -v filesrc location=music.mp3 ! mp3parse ! dccpserversink port=9011 ccid=2
-
-* Client:
-gst-launch -v dccpclientsrc host=localhost port=9011 ccid=2 ! decodebin ! alsasink
--- We also tested with mpg123, to use it: mpg123 dccp://localhost:9011
-
-###### Pipe to transmit a MP3 with dccp, speex and rtp #
-
-* Server:
-gst-launch -v filesrc location=music.mp3 ! mad ! audioconvert ! capsfilter caps="audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)44100, channels=(int)1" ! speexenc ! rtpspeexpay ! dccpserversink port=9011 ccid=2
-
-* Client:
-gst-launch -v dccpclientsrc host=localhost port=9011 ccid=2 caps="application/x-rtp, media=(string)audio, payload=(int)110, clock-rate=(int)44100, encoding-name=(string)SPEEX, ssrc=(guint)152981653, clock-base=(guint)1553719649, seqnum-base=(guint)3680, encoding-params=(string)1" ! rtpspeexdepay ! speexdec ! alsasink
-
diff --git a/tests/icles/dccp/call/DCCPClient.c b/tests/icles/dccp/call/DCCPClient.c
deleted file mode 100644
index 5f7eb019c..000000000
--- a/tests/icles/dccp/call/DCCPClient.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gst/gst.h>
-
-static gboolean
-bus_call (GstBus * bus, GstMessage * msg, gpointer data)
-{
-
- GMainLoop *loop = (GMainLoop *) data;
-
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_EOS:
- g_print ("End-of-stream\n");
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_ERROR:{
- gchar *debug;
- GError *err;
-
- gst_message_parse_error (msg, &err, &debug);
- g_free (debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-void
-start_dccpserversink_pipe (GstElement * object, gint socket, gpointer data)
-{
- GstElement *dccpserversink = (GstElement *) data;
- g_object_set (G_OBJECT (dccpserversink), "sockfd", socket, NULL);
-
- g_print ("Setting pipelinesink to PLAYING\n");
- GstElement *pipelinesink =
- (GstElement *) gst_element_get_parent (dccpserversink);
- gst_element_set_state (pipelinesink, GST_STATE_PLAYING);
- gst_object_unref (pipelinesink);
-}
-
-
-int
-main (int argc, char *argv[])
-{
-
- GstElement *pipelinesink, *alsasrc, *dccpserversink;
- GstElement *pipelinesrc, *alsasink, *dccpclientsrc;
- GMainLoop *loop;
- GstBus *bus;
- GstCaps *caps;
-
-
- /* initialize GStreamer */
- gst_init (&argc, &argv);
- loop = g_main_loop_new (NULL, FALSE);
-
- /* check input arguments */
- if (argc != 2) {
- g_print ("%s\n", "see usage: serverHost");
- return -1;
- }
-
- /* create elements */
- pipelinesink = gst_pipeline_new ("audio-sender");
- alsasrc = gst_element_factory_make ("alsasrc", "alsa-source");
- dccpserversink = gst_element_factory_make ("dccpserversink", "server-sink");
- pipelinesrc = gst_pipeline_new ("audio-receiver");
- alsasink = gst_element_factory_make ("alsasink", "alsa-sink");
- dccpclientsrc = gst_element_factory_make ("dccpclientsrc", "client-source");
-
-
- if (!pipelinesink || !alsasrc || !dccpserversink || !pipelinesrc || !alsasink
- || !dccpclientsrc) {
- g_print ("One element could not be created\n");
- return -1;
- }
-
- caps =
- gst_caps_from_string
- ("audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)32, depth=(int)32, rate=(int)44100, channels=(int)2");
- g_object_set (G_OBJECT (dccpclientsrc), "caps", caps, NULL);
-
- g_object_set (G_OBJECT (dccpclientsrc), "host", argv[1], NULL);
- /*g_object_set (G_OBJECT (dccpclientsrc), "ccid", 3, NULL);
- g_object_set (G_OBJECT (dccpserversink), "ccid", 3, NULL); */
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipelinesink));
- gst_bus_add_watch (bus, bus_call, loop);
- gst_object_unref (bus);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipelinesrc));
- gst_bus_add_watch (bus, bus_call, loop);
- gst_object_unref (bus);
-
-
- /* put all elements in a bin */
- gst_bin_add_many (GST_BIN (pipelinesink), alsasrc, dccpserversink, NULL);
- gst_element_link_many (alsasrc, dccpserversink, NULL);
-
- gst_bin_add_many (GST_BIN (pipelinesrc), dccpclientsrc, alsasink, NULL);
- gst_element_link (dccpclientsrc, alsasink);
-
- g_signal_connect (dccpclientsrc, "connected",
- (GCallback) start_dccpserversink_pipe, dccpserversink);
-
- /* Now set to playing and iterate. */
- g_print ("Setting pipelinesrc to PLAYING\n");
- gst_element_set_state (pipelinesrc, GST_STATE_PLAYING);
- g_print ("Running\n");
- g_main_loop_run (loop);
-
- /* clean up nicely */
- g_print ("Returned, stopping playback\n");
- gst_element_set_state (pipelinesink, GST_STATE_NULL);
- g_print ("Deleting pipelinesink\n");
- gst_object_unref (GST_OBJECT (pipelinesink));
-
- g_print ("Returned, stopping playback\n");
- gst_element_set_state (pipelinesrc, GST_STATE_NULL);
- g_print ("Deleting pipelinesrc\n");
- gst_object_unref (GST_OBJECT (pipelinesrc));
-
-
- return 0;
-}
diff --git a/tests/icles/dccp/call/DCCPServer.c b/tests/icles/dccp/call/DCCPServer.c
deleted file mode 100644
index fe0e34fa2..000000000
--- a/tests/icles/dccp/call/DCCPServer.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gst/gst.h>
-
-static gboolean
-bus_call (GstBus * bus, GstMessage * msg, gpointer data)
-{
-
- GMainLoop *loop = (GMainLoop *) data;
-
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_EOS:
- g_print ("End-of-stream\n");
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_ERROR:{
- gchar *debug;
- GError *err;
-
- gst_message_parse_error (msg, &err, &debug);
- g_free (debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-void
-start_dccpclientsrc_pipe (GstElement * object, gint socket, gpointer data)
-{
- GstElement *dccpclientsrc = (GstElement *) data;
- g_object_set (G_OBJECT (dccpclientsrc), "sockfd", socket, NULL);
-
- g_print ("Setting pipelinesrc to PLAYING\n");
- GstElement *pipelinesrc =
- (GstElement *) gst_element_get_parent (dccpclientsrc);
- gst_element_set_state (pipelinesrc, GST_STATE_PLAYING);
- gst_object_unref (pipelinesrc);
-}
-
-
-int
-main (int argc, char *argv[])
-{
-
- GstElement *pipelinesink, *alsasrc, *dccpserversink;
- GstElement *pipelinesrc, *alsasink, *dccpclientsrc;
- GMainLoop *loop;
- GstBus *bus;
- GstCaps *caps;
-
-
- /* initialize GStreamer */
- gst_init (&argc, &argv);
- loop = g_main_loop_new (NULL, FALSE);
-
- /* create elements */
- pipelinesink = gst_pipeline_new ("audio-sender");
- alsasrc = gst_element_factory_make ("alsasrc", "alsa-source");
- dccpserversink = gst_element_factory_make ("dccpserversink", "server-sink");
- pipelinesrc = gst_pipeline_new ("audio-receiver");
- alsasink = gst_element_factory_make ("alsasink", "alsa-sink");
- dccpclientsrc = gst_element_factory_make ("dccpclientsrc", "client-source");
-
-
- if (!pipelinesink || !alsasrc || !dccpserversink || !pipelinesrc || !alsasink
- || !dccpclientsrc) {
- g_print ("One element could not be created\n");
- return -1;
- }
-
- caps =
- gst_caps_from_string
- ("audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)32, depth=(int)32, rate=(int)44100, channels=(int)2");
- g_object_set (G_OBJECT (dccpclientsrc), "caps", caps, NULL);
-
- /*g_object_set (G_OBJECT (dccpclientsrc), "ccid", 3, NULL);
- g_object_set (G_OBJECT (dccpserversink), "ccid", 3, NULL); */
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipelinesink));
- gst_bus_add_watch (bus, bus_call, loop);
- gst_object_unref (bus);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipelinesrc));
- gst_bus_add_watch (bus, bus_call, loop);
- gst_object_unref (bus);
-
-
- /* put all elements in a bin */
- gst_bin_add_many (GST_BIN (pipelinesink), alsasrc, dccpserversink, NULL);
- gst_element_link_many (alsasrc, dccpserversink, NULL);
-
- gst_bin_add_many (GST_BIN (pipelinesrc), dccpclientsrc, alsasink, NULL);
- gst_element_link (dccpclientsrc, alsasink);
-
- g_signal_connect (dccpserversink, "connected",
- (GCallback) start_dccpclientsrc_pipe, dccpclientsrc);
-
- /* Now set to playing and iterate. */
- g_print ("Setting pipelinesink to PLAYING\n");
- gst_element_set_state (pipelinesink, GST_STATE_PLAYING);
- g_print ("Running\n");
- g_main_loop_run (loop);
-
- /* clean up nicely */
- g_print ("Returned, stopping playback\n");
- gst_element_set_state (pipelinesink, GST_STATE_NULL);
- g_print ("Deleting pipelinesink\n");
- gst_object_unref (GST_OBJECT (pipelinesink));
-
- g_print ("Returned, stopping playback\n");
- gst_element_set_state (pipelinesrc, GST_STATE_NULL);
- g_print ("Deleting pipelinesrc\n");
- gst_object_unref (GST_OBJECT (pipelinesrc));
-
-
- return 0;
-}
diff --git a/tests/icles/dccp/call/README b/tests/icles/dccp/call/README
deleted file mode 100644
index ed53abd65..000000000
--- a/tests/icles/dccp/call/README
+++ /dev/null
@@ -1 +0,0 @@
-This application tests the socket sharing.
diff --git a/tests/icles/dccp/file/DCCPClientSaveFile.c b/tests/icles/dccp/file/DCCPClientSaveFile.c
deleted file mode 100644
index cdd7fe29e..000000000
--- a/tests/icles/dccp/file/DCCPClientSaveFile.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gst/gst.h>
-
-static gboolean
-bus_call (GstBus * bus, GstMessage * msg, gpointer data)
-{
-
- GMainLoop *loop = (GMainLoop *) data;
-
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_EOS:
- g_print ("End-of-stream\n");
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_ERROR:{
- gchar *debug;
- GError *err;
-
- gst_message_parse_error (msg, &err, &debug);
- g_free (debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-
-int
-main (int argc, char *argv[])
-{
-
- GMainLoop *loop;
- GstBus *bus;
- GstElement *pipeline, *filesink, *dccpclientsrc;
-
- /* initialize GStreamer */
- gst_init (&argc, &argv);
- loop = g_main_loop_new (NULL, FALSE);
-
- /* check input arguments */
- if (argc != 4) {
- g_print ("%s\n", "see usage: serverHost serverPort location");
- return -1;
- }
-
- /* create elements */
- pipeline = gst_pipeline_new ("audio-sender");
- filesink = gst_element_factory_make ("filesink", "file-sink");
- dccpclientsrc = gst_element_factory_make ("dccpclientsrc", "client-source");
-
-
- if (!pipeline || !filesink || !dccpclientsrc) {
- g_print ("One element could not be created\n");
- return -1;
- }
-
- g_object_set (G_OBJECT (dccpclientsrc), "host", argv[1], NULL);
- g_object_set (G_OBJECT (dccpclientsrc), "port", atoi (argv[2]), NULL);
- /*g_object_set (G_OBJECT (dccpclientsrc), "ccid", 3, NULL); */
- g_object_set (G_OBJECT (filesink), "location", argv[3], NULL);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_watch (bus, bus_call, loop);
- gst_object_unref (bus);
-
- /* put all elements in a bin */
- gst_bin_add_many (GST_BIN (pipeline), dccpclientsrc, filesink, NULL);
-
- gst_element_link (dccpclientsrc, filesink);
-
-
- /* Now set to playing and iterate. */
- g_print ("Setting to PLAYING\n");
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("Running\n");
- g_main_loop_run (loop);
-
- /* clean up nicely */
- g_print ("Returned, stopping playback\n");
- gst_element_set_state (pipeline, GST_STATE_NULL);
- g_print ("Deleting pipeline\n");
- gst_object_unref (GST_OBJECT (pipeline));
-
- return 0;
-}
diff --git a/tests/icles/dccp/file/DCCPServerSendFile.c b/tests/icles/dccp/file/DCCPServerSendFile.c
deleted file mode 100644
index 768381fe0..000000000
--- a/tests/icles/dccp/file/DCCPServerSendFile.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gst/gst.h>
-
-static gboolean
-bus_call (GstBus * bus, GstMessage * msg, gpointer data)
-{
-
- GMainLoop *loop = (GMainLoop *) data;
-
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_EOS:
- g_print ("End-of-stream\n");
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_ERROR:{
- gchar *debug;
- GError *err;
-
- gst_message_parse_error (msg, &err, &debug);
- g_free (debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-
-int
-main (int argc, char *argv[])
-{
-
- GMainLoop *loop;
- GstBus *bus;
- GstElement *pipeline, *filesrc, *dccpserversink;
-
- /* initialize GStreamer */
- gst_init (&argc, &argv);
- loop = g_main_loop_new (NULL, FALSE);
-
- /* check input arguments */
- if (argc != 3) {
- g_print ("%s\n", "see usage: port mp3Location");
- return -1;
- }
-
- /* create elements */
- pipeline = gst_pipeline_new ("audio-sender");
- filesrc = gst_element_factory_make ("filesrc", "file-source");
- dccpserversink = gst_element_factory_make ("dccpserversink", "server-sink");
-
-
- if (!pipeline || !filesrc || !dccpserversink) {
- g_print ("One element could not be created\n");
- return -1;
- }
-
- g_object_set (G_OBJECT (dccpserversink), "port", atoi (argv[1]), NULL);
- /*g_object_set (G_OBJECT (dccpserversink), "ccid", 3, NULL); */
- g_object_set (G_OBJECT (filesrc), "location", argv[2], NULL);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_watch (bus, bus_call, loop);
- gst_object_unref (bus);
-
- /* put all elements in a bin */
- gst_bin_add_many (GST_BIN (pipeline), filesrc, dccpserversink, NULL);
-
- gst_element_link_many (filesrc, dccpserversink, NULL);
-
-
- /* Now set to playing and iterate. */
- g_print ("Setting to PLAYING\n");
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("Running\n");
- g_main_loop_run (loop);
-
- /* clean up nicely */
- g_print ("Returned, stopping playback\n");
- gst_element_set_state (pipeline, GST_STATE_NULL);
- g_print ("Deleting pipeline\n");
- gst_object_unref (GST_OBJECT (pipeline));
-
- return 0;
-}
diff --git a/tests/icles/dccp/mic/DCCPClientPlayMic.c b/tests/icles/dccp/mic/DCCPClientPlayMic.c
deleted file mode 100644
index 4cd0c3b52..000000000
--- a/tests/icles/dccp/mic/DCCPClientPlayMic.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gst/gst.h>
-
-static gboolean
-bus_call (GstBus * bus, GstMessage * msg, gpointer data)
-{
-
- GMainLoop *loop = (GMainLoop *) data;
-
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_EOS:
- g_print ("End-of-stream\n");
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_ERROR:{
- gchar *debug;
- GError *err;
-
- gst_message_parse_error (msg, &err, &debug);
- g_free (debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-
-int
-main (int argc, char *argv[])
-{
-
- GMainLoop *loop;
- GstBus *bus;
- GstElement *pipeline, *alsasink, *dccpclientsrc;
- GstCaps *caps;
-
- /* initialize GStreamer */
- gst_init (&argc, &argv);
- loop = g_main_loop_new (NULL, FALSE);
-
- /* check input arguments */
- if (argc != 3) {
- g_print ("%s\n", "see usage: serverHost serverPort");
- return -1;
- }
-
- /* create elements */
- pipeline = gst_pipeline_new ("audio-receiver");
- alsasink = gst_element_factory_make ("alsasink", "alsa-sink");
- dccpclientsrc = gst_element_factory_make ("dccpclientsrc", "client-source");
-
- if (!pipeline || !alsasink || !dccpclientsrc) {
- g_print ("One element could not be created\n");
- return -1;
- }
-
- caps =
- gst_caps_from_string
- ("audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)32, depth=(int)32, rate=(int)44100, channels=(int)2");
-
- g_object_set (G_OBJECT (dccpclientsrc), "caps", caps, NULL);
- g_object_set (G_OBJECT (dccpclientsrc), "host", argv[1], NULL);
- g_object_set (G_OBJECT (dccpclientsrc), "port", atoi (argv[2]), NULL);
- /*g_object_set (G_OBJECT (dccpclientsrc), "ccid", 3, NULL); */
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_watch (bus, bus_call, loop);
- gst_object_unref (bus);
-
- /* put all elements in a bin */
- gst_bin_add_many (GST_BIN (pipeline), dccpclientsrc, alsasink, NULL);
-
- gst_element_link (dccpclientsrc, alsasink);
-
- /* Now set to playing and iterate. */
- g_print ("Setting to PLAYING\n");
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("Running\n");
- g_main_loop_run (loop);
-
- /* clean up nicely */
- g_print ("Returned, stopping playback\n");
- gst_element_set_state (pipeline, GST_STATE_NULL);
- g_print ("Deleting pipeline\n");
- gst_object_unref (GST_OBJECT (pipeline));
-
- return 0;
-}
diff --git a/tests/icles/dccp/mic/DCCPServerMic.c b/tests/icles/dccp/mic/DCCPServerMic.c
deleted file mode 100644
index d40119802..000000000
--- a/tests/icles/dccp/mic/DCCPServerMic.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gst/gst.h>
-
-static gboolean
-bus_call (GstBus * bus, GstMessage * msg, gpointer data)
-{
-
- GMainLoop *loop = (GMainLoop *) data;
-
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_EOS:
- g_print ("End-of-stream\n");
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_ERROR:{
- gchar *debug;
- GError *err;
-
- gst_message_parse_error (msg, &err, &debug);
- g_free (debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-
-int
-main (int argc, char *argv[])
-{
-
- GMainLoop *loop;
- GstBus *bus;
- GstElement *pipeline, *alsasrc, *dccpserversink;
-
- /* initialize GStreamer */
- gst_init (&argc, &argv);
- loop = g_main_loop_new (NULL, FALSE);
-
- /* check input arguments */
- if (argc != 2) {
- g_print ("%s\n", "see usage: port");
- return -1;
- }
-
- /* create elements */
- pipeline = gst_pipeline_new ("audio-sender");
- alsasrc = gst_element_factory_make ("alsasrc", "alsa-source");
- dccpserversink = gst_element_factory_make ("dccpserversink", "server-sink");
-
-
- if (!pipeline || !alsasrc || !dccpserversink) {
- g_print ("One element could not be created\n");
- return -1;
- }
-
- g_object_set (G_OBJECT (dccpserversink), "port", atoi (argv[1]), NULL);
- /*g_object_set (G_OBJECT (dccpserversink), "ccid", 3, NULL); */
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_watch (bus, bus_call, loop);
- gst_object_unref (bus);
-
- /* put all elements in a bin */
- gst_bin_add_many (GST_BIN (pipeline), alsasrc, dccpserversink, NULL);
-
- gst_element_link_many (alsasrc, dccpserversink, NULL);
-
-
- /* Now set to playing and iterate. */
- g_print ("Setting to PLAYING\n");
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("Running\n");
- g_main_loop_run (loop);
-
- /* clean up nicely */
- g_print ("Returned, stopping playback\n");
- gst_element_set_state (pipeline, GST_STATE_NULL);
- g_print ("Deleting pipeline\n");
- gst_object_unref (GST_OBJECT (pipeline));
-
- return 0;
-}
diff --git a/tests/icles/dccp/mp3/DCCPClientPlayMP3.c b/tests/icles/dccp/mp3/DCCPClientPlayMP3.c
deleted file mode 100644
index ac55d25d0..000000000
--- a/tests/icles/dccp/mp3/DCCPClientPlayMP3.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gst/gst.h>
-
-static gboolean
-bus_call (GstBus * bus, GstMessage * msg, gpointer data)
-{
-
- GMainLoop *loop = (GMainLoop *) data;
-
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_EOS:
- g_print ("End-of-stream\n");
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_ERROR:{
- gchar *debug;
- GError *err;
-
- gst_message_parse_error (msg, &err, &debug);
- g_free (debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-
-int
-main (int argc, char *argv[])
-{
-
- GMainLoop *loop;
- GstBus *bus;
- GstElement *pipeline, *alsasink, *dccpclientsrc;
- GstCaps *caps;
-
- /* initialize GStreamer */
- gst_init (&argc, &argv);
- loop = g_main_loop_new (NULL, FALSE);
-
- /* check input arguments */
- if (argc != 3) {
- g_print ("%s\n", "see usage: serverHost serverPort");
- return -1;
- }
-
- /* create elements */
- pipeline = gst_pipeline_new ("audio-sender");
- alsasink = gst_element_factory_make ("alsasink", "alsa-sink");
- dccpclientsrc = gst_element_factory_make ("dccpclientsrc", "client-source");
-
- if (!pipeline || !alsasink || !dccpclientsrc) {
- g_print ("One element could not be created\n");
- return -1;
- }
-
- caps =
- gst_caps_from_string
- ("audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)32, depth=(int)32, rate=(int)44100, channels=(int)2");
- g_object_set (G_OBJECT (dccpclientsrc), "caps", caps, NULL);
- gst_object_unref (caps);
-
- g_object_set (G_OBJECT (dccpclientsrc), "host", argv[1], NULL);
- g_object_set (G_OBJECT (dccpclientsrc), "port", atoi (argv[2]), NULL);
- /*g_object_set (G_OBJECT (dccpclientsrc), "ccid", 2, NULL); */
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_watch (bus, bus_call, loop);
- gst_object_unref (bus);
-
- /* put all elements in a bin */
- gst_bin_add_many (GST_BIN (pipeline), dccpclientsrc, alsasink, NULL);
-
- gst_element_link_many (dccpclientsrc, alsasink, NULL);
-
- /* Now set to playing and iterate. */
- g_print ("Setting to PLAYING\n");
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("Running\n");
- g_main_loop_run (loop);
-
- /* clean up nicely */
- g_print ("Returned, stopping playback\n");
- gst_element_set_state (pipeline, GST_STATE_NULL);
- g_print ("Deleting pipeline\n");
- gst_object_unref (GST_OBJECT (pipeline));
-
- return 0;
-}
diff --git a/tests/icles/dccp/mp3/DCCPServerSendMP3.c b/tests/icles/dccp/mp3/DCCPServerSendMP3.c
deleted file mode 100644
index a7d9d5da6..000000000
--- a/tests/icles/dccp/mp3/DCCPServerSendMP3.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gst/gst.h>
-
-static gboolean
-bus_call (GstBus * bus, GstMessage * msg, gpointer data)
-{
-
- GMainLoop *loop = (GMainLoop *) data;
-
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_EOS:
- g_print ("End-of-stream\n");
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_ERROR:{
- gchar *debug;
- GError *err;
-
- gst_message_parse_error (msg, &err, &debug);
- g_free (debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-
-int
-main (int argc, char *argv[])
-{
-
- GMainLoop *loop;
- GstBus *bus;
- GstElement *pipeline, *filesrc, *dccpserversink, *mad;
-
- /* initialize GStreamer */
- gst_init (&argc, &argv);
- loop = g_main_loop_new (NULL, FALSE);
-
- /* check input arguments */
- if (argc != 3) {
- g_print ("%s\n", "see usage: port mp3Location");
- return -1;
- }
-
- /* create elements */
- pipeline = gst_pipeline_new ("audio-sender");
- filesrc = gst_element_factory_make ("filesrc", "file-source");
- mad = gst_element_factory_make ("mad", "mad");
- dccpserversink = gst_element_factory_make ("dccpserversink", "server-sink");
-
-
- if (!pipeline || !filesrc || !dccpserversink || !mad) {
- g_print ("One element could not be created\n");
- return -1;
- }
-
- g_object_set (G_OBJECT (dccpserversink), "port", atoi (argv[1]), NULL);
- /*g_object_set (G_OBJECT (dccpserversink), "ccid", 2, NULL); */
- g_object_set (G_OBJECT (filesrc), "location", argv[2], NULL);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_watch (bus, bus_call, loop);
- gst_object_unref (bus);
-
- /* put all elements in a bin */
- gst_bin_add_many (GST_BIN (pipeline), filesrc, mad, dccpserversink, NULL);
-
- gst_element_link_many (filesrc, mad, dccpserversink, NULL);
-
-
- /* Now set to playing and iterate. */
- g_print ("Setting to PLAYING\n");
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("Running\n");
- g_main_loop_run (loop);
-
- /* clean up nicely */
- g_print ("Returned, stopping playback\n");
- gst_element_set_state (pipeline, GST_STATE_NULL);
- g_print ("Deleting pipeline\n");
- gst_object_unref (GST_OBJECT (pipeline));
-
- return 0;
-}
diff --git a/tests/icles/dccp/mp3Speex/DCCPClientPlaySpeexMP3.c b/tests/icles/dccp/mp3Speex/DCCPClientPlaySpeexMP3.c
deleted file mode 100644
index 4d260f2a6..000000000
--- a/tests/icles/dccp/mp3Speex/DCCPClientPlaySpeexMP3.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gst/gst.h>
-
-static gboolean
-bus_call (GstBus * bus, GstMessage * msg, gpointer data)
-{
-
- GMainLoop *loop = (GMainLoop *) data;
-
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_EOS:
- g_print ("End-of-stream\n");
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_ERROR:{
- gchar *debug;
- GError *err;
-
- gst_message_parse_error (msg, &err, &debug);
- g_free (debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-
-int
-main (int argc, char *argv[])
-{
-
- GMainLoop *loop;
- GstBus *bus;
- GstElement *pipeline, *alsasink, *rtpspeexdepay, *speexdec, *dccpclientsrc;
- GstCaps *caps;
-
- /* initialize GStreamer */
- gst_init (&argc, &argv);
- loop = g_main_loop_new (NULL, FALSE);
-
- /* check input arguments */
- if (argc != 3) {
- g_print ("%s\n", "see usage: serverHost serverPort");
- return -1;
- }
-
- /* create elements */
- pipeline = gst_pipeline_new ("audio-sender");
- alsasink = gst_element_factory_make ("alsasink", "alsa-sink");
- rtpspeexdepay = gst_element_factory_make ("rtpspeexdepay", "rtpspeexdepay");
- speexdec = gst_element_factory_make ("speexdec", "speexdec");
- dccpclientsrc = gst_element_factory_make ("dccpclientsrc", "client-source");
-
- if (!pipeline || !alsasink || !rtpspeexdepay || !speexdec || !dccpclientsrc) {
- g_print ("One element could not be created\n");
- return -1;
- }
-
- caps =
- gst_caps_from_string
- ("application/x-rtp, media=(string)audio, payload=(int)110, clock-rate=(int)44100, encoding-name=(string)SPEEX, ssrc=(guint)152981653, clock-base=(guint)1553719649, seqnum-base=(guint)3680, encoding-params=(string)1");
- g_object_set (G_OBJECT (dccpclientsrc), "caps", caps, NULL);
- gst_object_unref (caps);
-
- g_object_set (G_OBJECT (dccpclientsrc), "host", argv[1], NULL);
- g_object_set (G_OBJECT (dccpclientsrc), "port", atoi (argv[2]), NULL);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_watch (bus, bus_call, loop);
- gst_object_unref (bus);
-
- /* put all elements in a bin */
- gst_bin_add_many (GST_BIN (pipeline), dccpclientsrc, rtpspeexdepay, speexdec,
- alsasink, NULL);
-
- gst_element_link_many (dccpclientsrc, rtpspeexdepay, speexdec, alsasink,
- NULL);
-
- /* Now set to playing and iterate. */
- g_print ("Setting to PLAYING\n");
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("Running\n");
- g_main_loop_run (loop);
-
- /* clean up nicely */
- g_print ("Returned, stopping playback\n");
- gst_element_set_state (pipeline, GST_STATE_NULL);
- g_print ("Deleting pipeline\n");
- gst_object_unref (GST_OBJECT (pipeline));
-
- return 0;
-}
diff --git a/tests/icles/dccp/mp3Speex/DCCPServerSendSpeexMP3.c b/tests/icles/dccp/mp3Speex/DCCPServerSendSpeexMP3.c
deleted file mode 100644
index a5d9e0d7d..000000000
--- a/tests/icles/dccp/mp3Speex/DCCPServerSendSpeexMP3.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gst/gst.h>
-
-static gboolean
-bus_call (GstBus * bus, GstMessage * msg, gpointer data)
-{
-
- GMainLoop *loop = (GMainLoop *) data;
-
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_EOS:
- g_print ("End-of-stream\n");
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_ERROR:{
- gchar *debug;
- GError *err;
-
- gst_message_parse_error (msg, &err, &debug);
- g_free (debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-
-int
-main (int argc, char *argv[])
-{
-
- GMainLoop *loop;
- GstBus *bus;
- GstElement *pipeline, *filesrc, *mad, *audioconvert, *capsfilter, *speexenc,
- *rtpspeexpay, *dccpserversink;
- GstCaps *caps;
-
- /* initialize GStreamer */
- gst_init (&argc, &argv);
- loop = g_main_loop_new (NULL, FALSE);
-
- /* check input arguments */
- if (argc != 3) {
- g_print ("%s\n", "see usage: port mp3Location");
- return -1;
- }
-
- /* create elements */
- pipeline = gst_pipeline_new ("audio-sender");
- filesrc = gst_element_factory_make ("filesrc", "file-source");
- mad = gst_element_factory_make ("mad", "mad");
- audioconvert = gst_element_factory_make ("audioconvert", "audioconvert");
- capsfilter = gst_element_factory_make ("capsfilter", "capsfilter");
- speexenc = gst_element_factory_make ("speexenc", "speexenc");
- rtpspeexpay = gst_element_factory_make ("rtpspeexpay", "rtpspeexpay");
- dccpserversink = gst_element_factory_make ("dccpserversink", "server-sink");
-
-
- if (!pipeline || !filesrc || !dccpserversink || !mad || !audioconvert
- || !capsfilter || !speexenc || !rtpspeexpay) {
- g_print ("One element could not be created\n");
- return -1;
- }
-
- g_object_set (G_OBJECT (dccpserversink), "port", atoi (argv[1]), NULL);
- g_object_set (G_OBJECT (filesrc), "location", argv[2], NULL);
-
- caps =
- gst_caps_from_string
- ("audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)44100, channels=(int)1");
- g_object_set (G_OBJECT (capsfilter), "caps", caps, NULL);
- gst_object_unref (caps);
-
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_watch (bus, bus_call, loop);
- gst_object_unref (bus);
-
- /* put all elements in a bin */
- gst_bin_add_many (GST_BIN (pipeline), filesrc, mad, audioconvert, capsfilter,
- speexenc, rtpspeexpay, dccpserversink, NULL);
-
- gst_element_link_many (filesrc, mad, audioconvert, capsfilter, speexenc,
- rtpspeexpay, dccpserversink, NULL);
-
-
- /* Now set to playing and iterate. */
- g_print ("Setting to PLAYING\n");
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("Running\n");
- g_main_loop_run (loop);
-
- /* clean up nicely */
- g_print ("Returned, stopping playback\n");
- gst_element_set_state (pipeline, GST_STATE_NULL);
- g_print ("Deleting pipeline\n");
- gst_object_unref (GST_OBJECT (pipeline));
-
- return 0;
-}
diff --git a/tests/icles/dccp/mp3Stream/DCCPClientPlayMP3Stream.c b/tests/icles/dccp/mp3Stream/DCCPClientPlayMP3Stream.c
deleted file mode 100644
index fb09e4ba3..000000000
--- a/tests/icles/dccp/mp3Stream/DCCPClientPlayMP3Stream.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gst/gst.h>
-
-static gboolean
-bus_call (GstBus * bus, GstMessage * msg, gpointer data)
-{
-
- GMainLoop *loop = (GMainLoop *) data;
-
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_EOS:
- g_print ("End-of-stream\n");
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_ERROR:{
- gchar *debug;
- GError *err;
-
- gst_message_parse_error (msg, &err, &debug);
- g_free (debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-
-int
-main (int argc, char *argv[])
-{
-
- GMainLoop *loop;
- GstBus *bus;
- GstElement *pipeline, *alsasink, *mad, *audioconvert, *dccpclientsrc;
-
- /* initialize GStreamer */
- gst_init (&argc, &argv);
- loop = g_main_loop_new (NULL, FALSE);
-
- /* check input arguments */
- if (argc != 3) {
- g_print ("%s\n", "see usage: serverHost serverPort");
- return -1;
- }
-
- /* create elements */
- pipeline = gst_pipeline_new ("audio-sender");
- dccpclientsrc = gst_element_factory_make ("dccpclientsrc", "client-source");
- mad = gst_element_factory_make ("mad", "mad");
- audioconvert = gst_element_factory_make ("audioconvert", "audioconvert");
- alsasink = gst_element_factory_make ("alsasink", "alsa-sink");
-
- if (!pipeline || !alsasink || !mad || !audioconvert || !dccpclientsrc) {
- g_print ("One element could not be created\n");
- return -1;
- }
-
- g_object_set (G_OBJECT (dccpclientsrc), "host", argv[1], NULL);
- g_object_set (G_OBJECT (dccpclientsrc), "port", atoi (argv[2]), NULL);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_watch (bus, bus_call, loop);
- gst_object_unref (bus);
-
- /* put all elements in a bin */
- gst_bin_add_many (GST_BIN (pipeline), dccpclientsrc, mad, audioconvert,
- alsasink, NULL);
-
- gst_element_link_many (dccpclientsrc, mad, audioconvert, alsasink, NULL);
-
-
- /* Now set to playing and iterate. */
- g_print ("Setting to PLAYING\n");
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("Running\n");
- g_main_loop_run (loop);
-
- /* clean up nicely */
- g_print ("Returned, stopping playback\n");
- gst_element_set_state (pipeline, GST_STATE_NULL);
- g_print ("Deleting pipeline\n");
- gst_object_unref (GST_OBJECT (pipeline));
-
- return 0;
-}
diff --git a/tests/icles/dccp/mp3Stream/DCCPServerSendMP3Stream.c b/tests/icles/dccp/mp3Stream/DCCPServerSendMP3Stream.c
deleted file mode 100644
index 2b090a200..000000000
--- a/tests/icles/dccp/mp3Stream/DCCPServerSendMP3Stream.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* GStreamer
- * Copyright (C) <2007> Leandro Melo de Sales <leandroal@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gst/gst.h>
-
-static gboolean
-bus_call (GstBus * bus, GstMessage * msg, gpointer data)
-{
-
- GMainLoop *loop = (GMainLoop *) data;
-
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_EOS:
- g_print ("End-of-stream\n");
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_ERROR:{
- gchar *debug;
- GError *err;
-
- gst_message_parse_error (msg, &err, &debug);
- g_free (debug);
-
- g_print ("Error: %s\n", err->message);
- g_error_free (err);
-
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-
-int
-main (int argc, char *argv[])
-{
-
- GMainLoop *loop;
- GstBus *bus;
- GstElement *pipeline, *filesrc, *mp3parse, *dccpserversink;
-
- /* initialize GStreamer */
- gst_init (&argc, &argv);
- loop = g_main_loop_new (NULL, FALSE);
-
- /* check input arguments */
- if (argc != 3) {
- g_print ("%s\n", "see usage: port mp3Location");
- return -1;
- }
-
- /* create elements */
- pipeline = gst_pipeline_new ("audio-sender"); /* create pipeline with the name audio-sender */
- filesrc = gst_element_factory_make ("filesrc", "file-source"); /* create filesrc element with the name file-source */
- mp3parse = gst_element_factory_make ("mp3parse", "mp3parse");
- dccpserversink = gst_element_factory_make ("dccpserversink", "server-sink");
-
-
- if (!pipeline || !filesrc || !mp3parse || !dccpserversink) {
- g_print ("One element could not be created\n");
- return -1;
- }
-
- g_object_set (G_OBJECT (dccpserversink), "port", atoi (argv[1]), NULL);
- g_object_set (G_OBJECT (filesrc), "location", argv[2], NULL);
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_watch (bus, bus_call, loop);
- gst_object_unref (bus);
-
- /* put all elements in a bin */
- gst_bin_add_many (GST_BIN (pipeline), filesrc, mp3parse, dccpserversink,
- NULL);
- /* Link the elements at the pipeline */
- gst_element_link_many (filesrc, mp3parse, dccpserversink, NULL);
-
-
- /* Now set to playing and iterate. */
- g_print ("Setting to PLAYING\n");
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("Running\n");
- g_main_loop_run (loop);
-
- /* clean up nicely */
- g_print ("Returned, stopping playback\n");
- gst_element_set_state (pipeline, GST_STATE_NULL);
- g_print ("Deleting pipeline\n");
- gst_object_unref (GST_OBJECT (pipeline));
-
- return 0;
-}