diff --git a/Android.mk b/Android.mk index 5aad2a5b33..fb349cf057 100644 --- a/Android.mk +++ b/Android.mk @@ -1,13 +1,165 @@ LOCAL_PATH := $(call my-dir) - -GSTREAMER_TOP := $(LOCAL_PATH) - include $(CLEAR_VARS) -include $(GSTREAMER_TOP)/android/h264parse.mk -include $(GSTREAMER_TOP)/android/sdpelem.mk -include $(GSTREAMER_TOP)/android/metadata.mk -include $(GSTREAMER_TOP)/android/qtmux.mk -include $(GSTREAMER_TOP)/android/aacparse.mk -include $(GSTREAMER_TOP)/android/amrparse.mk -include $(GSTREAMER_TOP)/sys/audioflingersink/Android.mk +GST_PLUGINS_BAD_TOP := $(LOCAL_PATH) + +GST_PLUGINS_BAD_BUILT_SOURCES := \ + pkgconfig/gstreamer-plugins-bad-0.10-uninstalled.pc \ + pkgconfig/gstreamer-plugins-bad-0.10.pc \ + gst-libs/gst/baseparse/Android.mk \ + gst-libs/gst/basecamerabinsrc/Android.mk \ + gst-libs/gst/interfaces/Android.mk \ + gst/h264parse/Android.mk \ + gst/videoparsers/Android.mk \ + gst/audiobuffer/Android.mk \ + gst/autoconvert/Android.mk \ + gst/bayer/Android.mk \ + gst/camerabin2/Android.mk \ + gst/adpcmdec/Android.mk \ + gst/adpcmenc/Android.mk \ + gst/aiff/Android.mk \ + gst/asfmux/Android.mk \ + gst/sdp/Android.mk \ + gst/hls/Android.mk \ + gst/jp2kdecimator/Android.mk \ + gst/segmentclip/Android.mk \ + gst/dtmf/Android.mk \ + gst/mpeg4videoparse/Android.mk \ + gst/siren/Android.mk \ + gst/dataurisrc/Android.mk \ + gst/rawparse/Android.mk \ + gst/videomaxrate/Android.mk \ + gst/tta/Android.mk \ + gst/videosignal/Android.mk \ + gst/coloreffects/Android.mk \ + gst/scaletempo/Android.mk \ + gst/jpegformat/Android.mk \ + gst/freeze/Android.mk \ + gst/geometrictransform/Android.mk \ + gst/librfb/Android.mk \ + gst/vmnc/Android.mk \ + gst/interlace/Android.mk \ + gst/mxf/Android.mk \ + gst/cdxaparse/Android.mk \ + gst/mpegpsmux/Android.mk \ + gst/legacyresample/Android.mk \ + gst/gaudieffects/Android.mk \ + gst/liveadder/Android.mk \ + gst/nsf/Android.mk \ + gst/dvdspu/Android.mk \ + gst/mpegvideoparse/Android.mk \ + gst/mpegtsdemux/Android.mk \ + gst/debugutils/Android.mk \ + gst/subenc/Android.mk \ + gst/id3tag/Android.mk \ + gst/frei0r/Android.mk \ + gst/patchdetect/Android.mk \ + gst/speed/Android.mk \ + gst/sdi/Android.mk \ + gst/festival/Android.mk \ + gst/y4m/Android.mk \ + gst/rtpmux/Android.mk \ + gst/pcapparse/Android.mk \ + gst/nuvdemux/Android.mk \ + gst/colorspace/Android.mk \ + gst/pnm/Android.mk \ + gst/mve/Android.mk \ + gst/videomeasure/Android.mk \ + gst/invtelecine/Android.mk \ + gst/hdvparse/Android.mk \ + gst/stereo/Android.mk \ + gst/rtpvp8/Android.mk \ + gst/mpegdemux/Android.mk \ + gst/ivfparse/Android.mk \ + ext/faad/Android.mk + +GST_PLUGINS_BAD_BUILT_SOURCES := $(patsubst %, $(abspath $(GST_PLUGINS_BAD_TOP))/%, $(GST_PLUGINS_BAD_BUILT_SOURCES)) + + +.PHONY: gst-plugins-bad-configure gst-plugins-bad-configure-real +gst-plugins-bad-configure: + cd $(GST_PLUGINS_BAD_TOP) ; \ + CC="$(CONFIGURE_CC)" \ + CFLAGS="$(CONFIGURE_CFLAGS)" \ + LD=$(TARGET_LD) \ + LDFLAGS="$(CONFIGURE_LDFLAGS)" \ + CPP=$(CONFIGURE_CPP) \ + CPPFLAGS="$(CONFIGURE_CPPFLAGS)" \ + PKG_CONFIG_LIBDIR="$(CONFIGURE_PKG_CONFIG_LIBDIR)" \ + PKG_CONFIG_TOP_BUILD_DIR=/ \ + $(abspath $(GST_PLUGINS_BAD_TOP))/$(CONFIGURE) \ + --prefix=/system --host=arm-linux-androideabi --disable-gtk-doc \ + --disable-valgrind && \ + for file in $(GST_PLUGINS_BAD_BUILT_SOURCES); do \ + rm -f $$file && \ + make -C $$(dirname $$file) $$(basename $$file) ; \ + done + +CONFIGURE_TARGETS += gst-plugins-bad-configure + +-include $(GST_PLUGINS_BAD_TOP)/gst-libs/gst/baseparse/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst-libs/gst/basecamerabinsrc/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst-libs/gst/interfaces/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/h264parse/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/audiobuffer/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/autoconvert/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/bayer/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/camerabin2/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/adpcmdec/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/adpcmenc/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/aiff/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/asfmux/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/videoparsers/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/ext/faad/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/sdp/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/hls/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/jp2kdecimator/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/segmentclip/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/dtmf/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/mpeg4videoparse/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/siren/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/dataurisrc/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/rawparse/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/videomaxrate/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/tta/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/videosignal/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/coloreffects/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/scaletempo/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/jpegformat/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/freeze/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/geometrictransform/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/librfb/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/vmnc/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/interlace/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/mxf/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/cdxaparse/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/mpegpsmux/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/legacyresample/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/gaudieffects/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/liveadder/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/nsf/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/dvdspu/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/mpegvideoparse/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/mpegtsdemux/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/debugutils/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/subenc/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/id3tag/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/frei0r/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/patchdetect/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/speed/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/sdi/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/festival/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/y4m/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/rtpmux/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/pcapparse/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/nuvdemux/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/colorspace/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/pnm/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/mve/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/videomeasure/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/invtelecine/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/hdvparse/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/stereo/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/rtpvp8/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/mpegdemux/Android.mk +-include $(GST_PLUGINS_BAD_TOP)/gst/ivfparse/Android.mk diff --git a/ChangeLog b/ChangeLog index 2a4d89805c..e5cca4e6e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,3939 @@ -=== release 0.10.21 === +=== release 0.10.22 === -2011-01-21 Tim-Philipp Müller +2011-05-10 Tim-Philipp Müller * configure.ac: - releasing 0.10.21, "Pink Noise" + releasing 0.10.22, "Toy Piano" + +2011-05-05 09:54:33 -0300 Thiago Santos + + * gst/camerabin/camerabinvideo.c: + * gst/camerabin/camerabinvideo.h: + camerabin: Use running time for muxing + This patch removes the audio source buffer probe that was used + to re-timestamp buffers to make them start from 0. As muxers + have been fixed to use running time instead of timestamps, this + is not needed anymore. + Fixes bug #646211 + +2011-04-21 19:58:03 -0300 Thiago Santos + + * gst/camerabin/camerabinimage.c: + camerabin: Fix typo + +2011-05-04 12:36:01 +0200 Mark Nauwelaerts + + * ext/xvid/gstxvidenc.c: + xvidenc: do not leak peer pad reference + +2011-05-03 15:47:02 +0100 Sjoerd Simons + + * ext/xvid/gstxvidenc.c: + xvidenc: Always return reffed caps from _getcaps + Not returning ref caps will leads to crashes and refcounting issues in + upstream elements + +2011-04-14 13:34:53 +0200 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + * gst/hls/m3u8.c: + * gst/hls/m3u8.h: + hlsdemux: set duration in outgoing buffers + Currently we push each fragment as a single buffer. + +2011-05-03 12:01:25 +0100 Tim-Philipp Müller + + * gst/hls/gsthlsdemux.c: + hlsdemux: fix DURATION query handling + Only answer duration queries in TIME format with a duration + in seconds. Make sure we don't return GST_CLOCK_TIME_NONE as + duration (which is non-0, but still invalid/useless). + +2011-05-03 11:51:44 +0100 Tim-Philipp Müller + + * gst/hls/gsthlsdemux.c: + hlsdemux: implement SEEKING query + +2011-04-30 19:47:47 +0100 Tim-Philipp Müller + + * configure.ac: + * docs/plugins/gst-plugins-bad-plugins.args: + * docs/plugins/gst-plugins-bad-plugins.hierarchy: + * docs/plugins/gst-plugins-bad-plugins.interfaces: + * docs/plugins/inspect/plugin-adpcmdec.xml: + * docs/plugins/inspect/plugin-adpcmenc.xml: + * docs/plugins/inspect/plugin-aiff.xml: + * docs/plugins/inspect/plugin-amrwbenc.xml: + * docs/plugins/inspect/plugin-asfmux.xml: + * docs/plugins/inspect/plugin-assrender.xml: + * docs/plugins/inspect/plugin-autoconvert.xml: + * docs/plugins/inspect/plugin-bayer.xml: + * docs/plugins/inspect/plugin-bz2.xml: + * docs/plugins/inspect/plugin-camerabin.xml: + * docs/plugins/inspect/plugin-cdaudio.xml: + * docs/plugins/inspect/plugin-cdxaparse.xml: + * docs/plugins/inspect/plugin-celt.xml: + * docs/plugins/inspect/plugin-cog.xml: + * docs/plugins/inspect/plugin-coloreffects.xml: + * docs/plugins/inspect/plugin-colorspace.xml: + * docs/plugins/inspect/plugin-curl.xml: + * docs/plugins/inspect/plugin-dataurisrc.xml: + * docs/plugins/inspect/plugin-dc1394.xml: + * docs/plugins/inspect/plugin-dccp.xml: + * docs/plugins/inspect/plugin-debugutilsbad.xml: + * docs/plugins/inspect/plugin-dfbvideosink.xml: + * docs/plugins/inspect/plugin-dirac.xml: + * docs/plugins/inspect/plugin-dtmf.xml: + * docs/plugins/inspect/plugin-dtsdec.xml: + * docs/plugins/inspect/plugin-dvb.xml: + * docs/plugins/inspect/plugin-dvbsuboverlay.xml: + * docs/plugins/inspect/plugin-dvdspu.xml: + * docs/plugins/inspect/plugin-faac.xml: + * docs/plugins/inspect/plugin-faad.xml: + * docs/plugins/inspect/plugin-fbdevsink.xml: + * docs/plugins/inspect/plugin-festival.xml: + * docs/plugins/inspect/plugin-freeze.xml: + * docs/plugins/inspect/plugin-frei0r.xml: + * docs/plugins/inspect/plugin-gaudieffects.xml: + * docs/plugins/inspect/plugin-geometrictransform.xml: + * docs/plugins/inspect/plugin-gsettings.xml: + * docs/plugins/inspect/plugin-gsm.xml: + * docs/plugins/inspect/plugin-gstsiren.xml: + * docs/plugins/inspect/plugin-h264parse.xml: + * docs/plugins/inspect/plugin-hdvparse.xml: + * docs/plugins/inspect/plugin-id3tag.xml: + * docs/plugins/inspect/plugin-interlace.xml: + * docs/plugins/inspect/plugin-invtelecine.xml: + * docs/plugins/inspect/plugin-ivfparse.xml: + * docs/plugins/inspect/plugin-jp2kdecimator.xml: + * docs/plugins/inspect/plugin-jpegformat.xml: + * docs/plugins/inspect/plugin-kate.xml: + * docs/plugins/inspect/plugin-ladspa.xml: + * docs/plugins/inspect/plugin-legacyresample.xml: + * docs/plugins/inspect/plugin-liveadder.xml: + * docs/plugins/inspect/plugin-mimic.xml: + * docs/plugins/inspect/plugin-mms.xml: + * docs/plugins/inspect/plugin-modplug.xml: + * docs/plugins/inspect/plugin-mpeg2enc.xml: + * docs/plugins/inspect/plugin-mpeg4videoparse.xml: + * docs/plugins/inspect/plugin-mpegdemux2.xml: + * docs/plugins/inspect/plugin-mpegpsmux.xml: + * docs/plugins/inspect/plugin-mpegtsdemux.xml: + * docs/plugins/inspect/plugin-mpegtsmux.xml: + * docs/plugins/inspect/plugin-mpegvideoparse.xml: + * docs/plugins/inspect/plugin-mplex.xml: + * docs/plugins/inspect/plugin-musepack.xml: + * docs/plugins/inspect/plugin-musicbrainz.xml: + * docs/plugins/inspect/plugin-mve.xml: + * docs/plugins/inspect/plugin-mxf.xml: + * docs/plugins/inspect/plugin-mythtv.xml: + * docs/plugins/inspect/plugin-nas.xml: + * docs/plugins/inspect/plugin-neon.xml: + * docs/plugins/inspect/plugin-nsf.xml: + * docs/plugins/inspect/plugin-nuvdemux.xml: + * docs/plugins/inspect/plugin-ofa.xml: + * docs/plugins/inspect/plugin-opencv.xml: + * docs/plugins/inspect/plugin-pcapparse.xml: + * docs/plugins/inspect/plugin-pnm.xml: + * docs/plugins/inspect/plugin-rawparse.xml: + * docs/plugins/inspect/plugin-real.xml: + * docs/plugins/inspect/plugin-resindvd.xml: + * docs/plugins/inspect/plugin-rfbsrc.xml: + * docs/plugins/inspect/plugin-rsvg.xml: + * docs/plugins/inspect/plugin-rtmpsrc.xml: + * docs/plugins/inspect/plugin-rtpmux.xml: + * docs/plugins/inspect/plugin-rtpvp8.xml: + * docs/plugins/inspect/plugin-scaletempo.xml: + * docs/plugins/inspect/plugin-schro.xml: + * docs/plugins/inspect/plugin-sdl.xml: + * docs/plugins/inspect/plugin-sdp.xml: + * docs/plugins/inspect/plugin-segmentclip.xml: + * docs/plugins/inspect/plugin-shm.xml: + * docs/plugins/inspect/plugin-sndfile.xml: + * docs/plugins/inspect/plugin-soundtouch.xml: + * docs/plugins/inspect/plugin-speed.xml: + * docs/plugins/inspect/plugin-stereo.xml: + * docs/plugins/inspect/plugin-subenc.xml: + * docs/plugins/inspect/plugin-tta.xml: + * docs/plugins/inspect/plugin-vcdsrc.xml: + * docs/plugins/inspect/plugin-vdpau.xml: + * docs/plugins/inspect/plugin-videomaxrate.xml: + * docs/plugins/inspect/plugin-videomeasure.xml: + * docs/plugins/inspect/plugin-videoparsersbad.xml: + * docs/plugins/inspect/plugin-videosignal.xml: + * docs/plugins/inspect/plugin-vmnc.xml: + * docs/plugins/inspect/plugin-vp8.xml: + * docs/plugins/inspect/plugin-wildmidi.xml: + * docs/plugins/inspect/plugin-xvid.xml: + * docs/plugins/inspect/plugin-y4mdec.xml: + * docs/plugins/inspect/plugin-zbar.xml: + * po/da.po: + * po/de.po: + * po/fr.po: + * po/uk.po: + * win32/common/config.h: + 0.10.21.4 pre-release + +2011-04-30 19:46:40 +0100 Tim-Philipp Müller + + * ext/cog/gstcogorc-dist.c: + * gst/colorspace/gstcolorspaceorc-dist.c: + Update orc-generated disted C backup code to orc 0.4.14 + +2011-04-30 19:15:11 +0100 Tim-Philipp Müller + + * gst/debugutils/gstchopmydata.c: + chopmydata: don't push buffers smaller than min-size on eos + When pushing the remaining data on EOS, don't just push whatever + data is left in the adapter, but only push data that's at least + of min-size. + +2011-04-30 19:08:25 +0100 Tim-Philipp Müller + + * gst/debugutils/gstchopmydata.c: + chopmydata: don't mess with adapter from non-streaming thread on FLUSH_START + Don't try to push remaining data in the adapter on receiving a FLUSH event, + just flush the adapter. Do this on FLUSH_STOP, however, which is serialized, + unlike FLUSH_START, so we don't mess with the adapter at the same time as + the streaming thread. + +2011-04-30 11:28:03 +0200 Philip Jägenstedt + + * gst/y4m/gsty4mdec.c: + y4mdec: add plugin description + https://bugzilla.gnome.org/show_bug.cgi?id=649005 + +2011-04-29 12:39:38 +0200 Edward Hervey + + * gst/mpegtsdemux/tsdemux.c: + tsdemux: Don't leak bufferlist on streams without pads + https://bugzilla.gnome.org/show_bug.cgi?id=648929 + +2011-04-29 12:38:31 +0200 Edward Hervey + + * gst/mpegtsdemux/mpegtsbase.c: + mpegtsbase: Unref buffers we don't use. + Avoids a massive leak :) + https://bugzilla.gnome.org/show_bug.cgi?id=648929 + +2011-04-29 12:08:38 +0200 Edward Hervey + + * gst/mpegtsdemux/mpegtsbase.c: + mpegtsbase: Don't forget to free the program streams array + https://bugzilla.gnome.org/show_bug.cgi?id=648929 + +2011-04-29 12:08:04 +0200 Edward Hervey + + * gst/mpegtsdemux/tsdemux.c: + tsdemux: Free packet buffer even if it doesn't have a payload + This can happen with AFC-only packets. Avoids leaking buffers. + https://bugzilla.gnome.org/show_bug.cgi?id=648929 + +2011-04-28 10:07:04 +0200 Sebastian Dröge + + * configure.ac: + decklink: Check for pthread.h and link with -lpthread + +2011-04-28 10:04:18 +0200 Sebastian Dröge + + * sys/Makefile.am: + decklink: Add to SUBDIRS + +2011-04-28 00:00:09 +0100 Tim-Philipp Müller + + * configure.ac: + * docs/plugins/gst-plugins-bad-plugins.args: + * docs/plugins/gst-plugins-bad-plugins.hierarchy: + * docs/plugins/gst-plugins-bad-plugins.interfaces: + * docs/plugins/inspect/plugin-adpcmdec.xml: + * docs/plugins/inspect/plugin-adpcmenc.xml: + * docs/plugins/inspect/plugin-aiff.xml: + * docs/plugins/inspect/plugin-amrwbenc.xml: + * docs/plugins/inspect/plugin-asfmux.xml: + * docs/plugins/inspect/plugin-assrender.xml: + * docs/plugins/inspect/plugin-autoconvert.xml: + * docs/plugins/inspect/plugin-bayer.xml: + * docs/plugins/inspect/plugin-bz2.xml: + * docs/plugins/inspect/plugin-camerabin.xml: + * docs/plugins/inspect/plugin-cdaudio.xml: + * docs/plugins/inspect/plugin-cdxaparse.xml: + * docs/plugins/inspect/plugin-celt.xml: + * docs/plugins/inspect/plugin-cog.xml: + * docs/plugins/inspect/plugin-coloreffects.xml: + * docs/plugins/inspect/plugin-colorspace.xml: + * docs/plugins/inspect/plugin-curl.xml: + * docs/plugins/inspect/plugin-dataurisrc.xml: + * docs/plugins/inspect/plugin-dc1394.xml: + * docs/plugins/inspect/plugin-dccp.xml: + * docs/plugins/inspect/plugin-debugutilsbad.xml: + * docs/plugins/inspect/plugin-dfbvideosink.xml: + * docs/plugins/inspect/plugin-dirac.xml: + * docs/plugins/inspect/plugin-dtmf.xml: + * docs/plugins/inspect/plugin-dtsdec.xml: + * docs/plugins/inspect/plugin-dvb.xml: + * docs/plugins/inspect/plugin-dvbsuboverlay.xml: + * docs/plugins/inspect/plugin-dvdspu.xml: + * docs/plugins/inspect/plugin-faac.xml: + * docs/plugins/inspect/plugin-faad.xml: + * docs/plugins/inspect/plugin-fbdevsink.xml: + * docs/plugins/inspect/plugin-festival.xml: + * docs/plugins/inspect/plugin-freeze.xml: + * docs/plugins/inspect/plugin-frei0r.xml: + * docs/plugins/inspect/plugin-gaudieffects.xml: + * docs/plugins/inspect/plugin-geometrictransform.xml: + * docs/plugins/inspect/plugin-gsettings.xml: + * docs/plugins/inspect/plugin-gsm.xml: + * docs/plugins/inspect/plugin-gstsiren.xml: + * docs/plugins/inspect/plugin-h264parse.xml: + * docs/plugins/inspect/plugin-hdvparse.xml: + * docs/plugins/inspect/plugin-id3tag.xml: + * docs/plugins/inspect/plugin-interlace.xml: + * docs/plugins/inspect/plugin-invtelecine.xml: + * docs/plugins/inspect/plugin-ivfparse.xml: + * docs/plugins/inspect/plugin-jp2kdecimator.xml: + * docs/plugins/inspect/plugin-jpegformat.xml: + * docs/plugins/inspect/plugin-kate.xml: + * docs/plugins/inspect/plugin-ladspa.xml: + * docs/plugins/inspect/plugin-legacyresample.xml: + * docs/plugins/inspect/plugin-liveadder.xml: + * docs/plugins/inspect/plugin-mimic.xml: + * docs/plugins/inspect/plugin-mms.xml: + * docs/plugins/inspect/plugin-modplug.xml: + * docs/plugins/inspect/plugin-mpeg2enc.xml: + * docs/plugins/inspect/plugin-mpeg4videoparse.xml: + * docs/plugins/inspect/plugin-mpegdemux2.xml: + * docs/plugins/inspect/plugin-mpegpsmux.xml: + * docs/plugins/inspect/plugin-mpegtsdemux.xml: + * docs/plugins/inspect/plugin-mpegtsmux.xml: + * docs/plugins/inspect/plugin-mpegvideoparse.xml: + * docs/plugins/inspect/plugin-mplex.xml: + * docs/plugins/inspect/plugin-musepack.xml: + * docs/plugins/inspect/plugin-musicbrainz.xml: + * docs/plugins/inspect/plugin-mve.xml: + * docs/plugins/inspect/plugin-mxf.xml: + * docs/plugins/inspect/plugin-mythtv.xml: + * docs/plugins/inspect/plugin-nas.xml: + * docs/plugins/inspect/plugin-neon.xml: + * docs/plugins/inspect/plugin-nsf.xml: + * docs/plugins/inspect/plugin-nuvdemux.xml: + * docs/plugins/inspect/plugin-ofa.xml: + * docs/plugins/inspect/plugin-opencv.xml: + * docs/plugins/inspect/plugin-pcapparse.xml: + * docs/plugins/inspect/plugin-pnm.xml: + * docs/plugins/inspect/plugin-rawparse.xml: + * docs/plugins/inspect/plugin-real.xml: + * docs/plugins/inspect/plugin-resindvd.xml: + * docs/plugins/inspect/plugin-rfbsrc.xml: + * docs/plugins/inspect/plugin-rsvg.xml: + * docs/plugins/inspect/plugin-rtmpsrc.xml: + * docs/plugins/inspect/plugin-rtpmux.xml: + * docs/plugins/inspect/plugin-rtpvp8.xml: + * docs/plugins/inspect/plugin-scaletempo.xml: + * docs/plugins/inspect/plugin-schro.xml: + * docs/plugins/inspect/plugin-sdl.xml: + * docs/plugins/inspect/plugin-sdp.xml: + * docs/plugins/inspect/plugin-segmentclip.xml: + * docs/plugins/inspect/plugin-shm.xml: + * docs/plugins/inspect/plugin-sndfile.xml: + * docs/plugins/inspect/plugin-soundtouch.xml: + * docs/plugins/inspect/plugin-speed.xml: + * docs/plugins/inspect/plugin-stereo.xml: + * docs/plugins/inspect/plugin-subenc.xml: + * docs/plugins/inspect/plugin-tta.xml: + * docs/plugins/inspect/plugin-vcdsrc.xml: + * docs/plugins/inspect/plugin-vdpau.xml: + * docs/plugins/inspect/plugin-videomaxrate.xml: + * docs/plugins/inspect/plugin-videomeasure.xml: + * docs/plugins/inspect/plugin-videoparsersbad.xml: + * docs/plugins/inspect/plugin-videosignal.xml: + * docs/plugins/inspect/plugin-vmnc.xml: + * docs/plugins/inspect/plugin-vp8.xml: + * docs/plugins/inspect/plugin-wildmidi.xml: + * docs/plugins/inspect/plugin-xvid.xml: + * docs/plugins/inspect/plugin-y4mdec.xml: + * docs/plugins/inspect/plugin-zbar.xml: + * ext/cog/gstcogorc-dist.c: + * gst/colorspace/gstcolorspaceorc-dist.c: + * po/bg.po: + * po/ja.po: + * po/nl.po: + * po/pl.po: + * po/ru.po: + * po/sl.po: + * po/tr.po: + * win32/common/config.h: + 0.10.21.3 pre-release + +2011-04-27 23:43:03 +0100 Tim-Philipp Müller + + * tools/Makefile.am: + tools: disable new gst-element-maker test + It doesn't seem to work in an uninstalled setup, and + breaks make distcheck for me. + +2011-04-27 01:14:20 +0300 Stefan Kost + + * tools/Makefile.am: + element-maker: the broekn templates are not broekn, but dependencies + Rename the list and dist them. We need them for the actual templates. + +2011-04-26 15:13:55 +0300 Stefan Kost + + * tools/Makefile.am: + * tools/gst-element-maker: + element-maker: set CPPFLAGS to make templates using uninstalled headers work + +2011-04-26 14:21:25 +0300 Stefan Kost + + * tools/Makefile.am: + * tools/element-templates/gobject: + element-maker: fixup gobject template a bit but disable for now + The template contains things we already define by default. + +2011-04-26 14:10:05 +0300 Stefan Kost + + * tools/element-templates/audiofilter: + * tools/element-templates/basertpdepayload: + * tools/element-templates/basertppayload: + * tools/element-templates/cddabasesrc: + * tools/element-templates/tagdemux: + element-templates: fix templates + Use the object class and not the object in the init function. Set the vmethods. + Add default returns. + +2011-04-26 14:08:51 +0300 Stefan Kost + + * tools/Makefile.am: + element-maker: don't dist incomplete templates + Move not working templates to a separate variable to highlight the fact that + they need more work. These need at least the class and type fields filled. + +2011-04-26 13:44:04 +0300 Stefan Kost + + * tools/Makefile.am: + * tools/gst-element-maker-test.sh: + element-maker-test: try to run element-maker for all templates + Add an easy way to check the element-maker templates. + +2011-04-26 13:42:59 +0300 Stefan Kost + + * tools/gst-element-maker: + element-maker: make it fail, when compilation fails + +2011-04-19 15:09:54 -0400 Stefan Kost + + * tools/gst-element-maker: + element-maker: allow to run from a different working directory + Get the dirname for the script and use that to reference the templates. Use the + templatedir variable to check for templates. + +2011-04-16 19:42:48 -0700 David Schleef + + * tools/gst-element-maker: + element-maker: lowercasify input + This allows using capitalized acronyms in class names, so using + "AVC_src" on the command line will create filename gstavcsrc.c, + class name GstAVCSrc, and symbol names gst_avc_src_*. + +2011-04-24 16:42:03 -0700 David Schleef + + * gst/mpegdemux/gstmpegtsdemux.c: + * gst/mpegtsdemux/tsdemux.c: + mpegtsdemux,tsdemux: Add byte-stream to h264 caps + Fixes #606662. + +2011-04-24 16:00:00 -0700 David Schleef + + * gst-libs/gst/video/gstbasevideoencoder.c: + * gst-libs/gst/video/gstbasevideoencoder.h: + basevideoencoder: Don't allow buffers after EOS + Fixes #647852. + +2011-04-24 15:49:54 -0700 David Schleef + + * gst-libs/gst/video/gstbasevideoencoder.c: + basevideo: Don't duplicate code in basevideocodec + Both basevideoencoder and basevideocodec were setting + system_frame_number, leading to confusion. Fixes #647853. + +2011-04-14 16:21:15 -0700 David Schleef + + * gst-libs/gst/video/gstbasevideodecoder.c: + basevideo: Check if caps are set directly + Fixes #647854. + +2011-04-17 00:08:39 +0100 Mihai Draghicioiu + + * ext/gme/gstgme.c: + gme: fix infinite looping by fading out after two loops + https://bugzilla.gnome.org/show_bug.cgi?id=647364 + +2011-04-24 14:04:10 +0100 Tim-Philipp Müller + + * common: + Automatic update of common submodule + From c3cafe1 to 46dfcea + +2011-04-22 09:37:29 +0100 Fabrizio Milo + + * configure.ac: + * ext/opencv/gstfaceblur.c: + * ext/opencv/gstfaceblur.h: + * ext/opencv/gstfacedetect.c: + * ext/opencv/gstfacedetect.h: + * ext/opencv/gsttemplatematch.c: + * ext/opencv/gsttextoverlay.h: + opencv: make work with openCV 2.2 + https://bugzilla.gnome.org/show_bug.cgi?id=641796 + +2011-04-19 17:02:45 +0100 Christian Fredrik Kalager Schaller + + * gst-plugins-bad.spec.in: + Add latest plugins to spec file + +2011-04-15 22:25:27 -0700 David Schleef + + * gst/mpegtsmux/mpegtsmux.c: + mpegtsmux: Add byte-stream to h264 caps + +2011-04-18 12:01:07 +0200 Sebastian Dröge + + * tests/check/elements/mxfmux.c: + * tests/check/pipelines/mxf.c: + wavpack: Remove bus GSource to prevent a valgrind warning + +2011-04-18 11:57:15 +0200 Sebastian Dröge + + * tests/check/elements/ofa.c: + ofa: Remove bus GSource to prevent a valgrind warning + +2011-04-18 11:50:34 +0200 Sebastian Dröge + + * tests/check/elements/assrender.c: + assrender: Remove bus GSource to prevent a valgrind warning + +2011-04-18 11:46:23 +0200 Sebastian Dröge + + * sys/decklink/Makefile.am: + decklink: Remove unused/unneeded CFLAGS/LIBS and move $(LIBM) to LIBADD + +2011-04-18 11:43:03 +0200 Sebastian Dröge + + * sys/linsys/Makefile.am: + linsys: Link with libgstbase for basesink/basesrc + And remove empty and unused variables. + +2011-04-17 19:09:33 +0200 Sebastian Dröge + + * sys/decklink/Makefile.am: + decklink: Dist all headers and put them in noinst_HEADERS + +2011-04-17 19:09:15 +0200 Sebastian Dröge + + * sys/linsys/Makefile.am: + linsys: Dist all headers and put them in noinst_HEADERS + +2011-04-17 11:54:00 +0200 Sebastian Dröge + + * configure.ac: + configure: Fix linsys/decklink checks for Linux + +2011-04-17 01:10:14 +0100 Tim-Philipp Müller + + * configure.ac: + * win32/common/config.h: + 0.10.21.2 pre-release + +2011-04-17 01:09:33 +0100 Tim-Philipp Müller + + * ext/cog/gstcogorc-dist.c: + * ext/cog/gstcogorc-dist.h: + * gst/colorspace/gstcolorspaceorc-dist.c: + * gst/colorspace/gstcolorspaceorc-dist.h: + * gst/fieldanalysis/gstfieldanalysisorc-dist.c: + * gst/fieldanalysis/gstfieldanalysisorc-dist.h: + ext, gst: update disted orc backup files + +2011-04-17 00:54:50 +0100 Tim-Philipp Müller + + * docs/plugins/gst-plugins-bad-plugins.args: + * docs/plugins/gst-plugins-bad-plugins.hierarchy: + * docs/plugins/gst-plugins-bad-plugins.interfaces: + * docs/plugins/gst-plugins-bad-plugins.prerequisites: + * docs/plugins/gst-plugins-bad-plugins.signals: + * docs/plugins/inspect/plugin-adpcmdec.xml: + * docs/plugins/inspect/plugin-adpcmenc.xml: + * docs/plugins/inspect/plugin-aiff.xml: + * docs/plugins/inspect/plugin-amrwbenc.xml: + * docs/plugins/inspect/plugin-asfmux.xml: + * docs/plugins/inspect/plugin-assrender.xml: + * docs/plugins/inspect/plugin-autoconvert.xml: + * docs/plugins/inspect/plugin-bayer.xml: + * docs/plugins/inspect/plugin-bz2.xml: + * docs/plugins/inspect/plugin-camerabin.xml: + * docs/plugins/inspect/plugin-cdaudio.xml: + * docs/plugins/inspect/plugin-cdxaparse.xml: + * docs/plugins/inspect/plugin-celt.xml: + * docs/plugins/inspect/plugin-cog.xml: + * docs/plugins/inspect/plugin-coloreffects.xml: + * docs/plugins/inspect/plugin-colorspace.xml: + * docs/plugins/inspect/plugin-curl.xml: + * docs/plugins/inspect/plugin-dataurisrc.xml: + * docs/plugins/inspect/plugin-dc1394.xml: + * docs/plugins/inspect/plugin-dccp.xml: + * docs/plugins/inspect/plugin-debugutilsbad.xml: + * docs/plugins/inspect/plugin-dfbvideosink.xml: + * docs/plugins/inspect/plugin-dirac.xml: + * docs/plugins/inspect/plugin-dtmf.xml: + * docs/plugins/inspect/plugin-dtsdec.xml: + * docs/plugins/inspect/plugin-dvb.xml: + * docs/plugins/inspect/plugin-dvbsuboverlay.xml: + * docs/plugins/inspect/plugin-dvdspu.xml: + * docs/plugins/inspect/plugin-faac.xml: + * docs/plugins/inspect/plugin-faad.xml: + * docs/plugins/inspect/plugin-fbdevsink.xml: + * docs/plugins/inspect/plugin-festival.xml: + * docs/plugins/inspect/plugin-freeze.xml: + * docs/plugins/inspect/plugin-frei0r.xml: + * docs/plugins/inspect/plugin-gaudieffects.xml: + * docs/plugins/inspect/plugin-geometrictransform.xml: + * docs/plugins/inspect/plugin-gsettings.xml: + * docs/plugins/inspect/plugin-gsm.xml: + * docs/plugins/inspect/plugin-gstsiren.xml: + * docs/plugins/inspect/plugin-h264parse.xml: + * docs/plugins/inspect/plugin-hdvparse.xml: + * docs/plugins/inspect/plugin-id3tag.xml: + * docs/plugins/inspect/plugin-interlace.xml: + * docs/plugins/inspect/plugin-invtelecine.xml: + * docs/plugins/inspect/plugin-ivfparse.xml: + * docs/plugins/inspect/plugin-jp2kdecimator.xml: + * docs/plugins/inspect/plugin-jpegformat.xml: + * docs/plugins/inspect/plugin-kate.xml: + * docs/plugins/inspect/plugin-ladspa.xml: + * docs/plugins/inspect/plugin-legacyresample.xml: + * docs/plugins/inspect/plugin-liveadder.xml: + * docs/plugins/inspect/plugin-mimic.xml: + * docs/plugins/inspect/plugin-mms.xml: + * docs/plugins/inspect/plugin-mpeg4videoparse.xml: + * docs/plugins/inspect/plugin-mpegdemux2.xml: + * docs/plugins/inspect/plugin-mpegpsmux.xml: + * docs/plugins/inspect/plugin-mpegtsdemux.xml: + * docs/plugins/inspect/plugin-mpegtsmux.xml: + * docs/plugins/inspect/plugin-mpegvideoparse.xml: + * docs/plugins/inspect/plugin-musepack.xml: + * docs/plugins/inspect/plugin-musicbrainz.xml: + * docs/plugins/inspect/plugin-mve.xml: + * docs/plugins/inspect/plugin-mxf.xml: + * docs/plugins/inspect/plugin-mythtv.xml: + * docs/plugins/inspect/plugin-nas.xml: + * docs/plugins/inspect/plugin-neon.xml: + * docs/plugins/inspect/plugin-nsf.xml: + * docs/plugins/inspect/plugin-nuvdemux.xml: + * docs/plugins/inspect/plugin-ofa.xml: + * docs/plugins/inspect/plugin-opencv.xml: + * docs/plugins/inspect/plugin-pcapparse.xml: + * docs/plugins/inspect/plugin-pnm.xml: + * docs/plugins/inspect/plugin-rawparse.xml: + * docs/plugins/inspect/plugin-real.xml: + * docs/plugins/inspect/plugin-resindvd.xml: + * docs/plugins/inspect/plugin-rfbsrc.xml: + * docs/plugins/inspect/plugin-rsvg.xml: + * docs/plugins/inspect/plugin-rtmpsrc.xml: + * docs/plugins/inspect/plugin-rtpmux.xml: + * docs/plugins/inspect/plugin-rtpvp8.xml: + * docs/plugins/inspect/plugin-scaletempo.xml: + * docs/plugins/inspect/plugin-schro.xml: + * docs/plugins/inspect/plugin-sdl.xml: + * docs/plugins/inspect/plugin-sdp.xml: + * docs/plugins/inspect/plugin-segmentclip.xml: + * docs/plugins/inspect/plugin-shm.xml: + * docs/plugins/inspect/plugin-sndfile.xml: + * docs/plugins/inspect/plugin-speed.xml: + * docs/plugins/inspect/plugin-stereo.xml: + * docs/plugins/inspect/plugin-subenc.xml: + * docs/plugins/inspect/plugin-tta.xml: + * docs/plugins/inspect/plugin-vcdsrc.xml: + * docs/plugins/inspect/plugin-vdpau.xml: + * docs/plugins/inspect/plugin-videomaxrate.xml: + * docs/plugins/inspect/plugin-videomeasure.xml: + * docs/plugins/inspect/plugin-videoparsersbad.xml: + * docs/plugins/inspect/plugin-videosignal.xml: + * docs/plugins/inspect/plugin-vmnc.xml: + * docs/plugins/inspect/plugin-vp8.xml: + * docs/plugins/inspect/plugin-wildmidi.xml: + * docs/plugins/inspect/plugin-xvid.xml: + * docs/plugins/inspect/plugin-y4mdec.xml: + * docs/plugins/inspect/plugin-zbar.xml: + docs: update docs for pre-release + +2011-04-16 16:36:06 +0100 Tim-Philipp Müller + + * configure.ac: + configure: fix --disable-external + +2011-04-14 20:46:52 -0700 David Schleef + + * ext/assrender/gstassrender.c: + assrender: refactor blitting, avoid writing past end of buffer + Previous blitting code could potentially write past the + end of the buffer if the x or y position was odd, and for + the same underlying reason, didn't get the chroma registration + correct in the odd position case. + https://bugzilla.gnome.org/show_bug.cgi?id=647830 + +2011-04-16 11:18:44 +0200 Edward Hervey + + * gst/jpegformat/gstjpegparse.c: + jpegformat: Fix unitialized variable on macosx + +2011-04-14 20:39:38 -0300 Thiago Santos + + * gst/camerabin/camerabinimage.c: + camerabin: Do not forget to unref the ffmpegcolorspace + Do not leak the ffmpegcolorspace by unrefing it at dispose + +2011-04-14 16:48:27 -0300 Thiago Santos + + * tests/check/elements/camerabin.c: + test: camerabin: More leak fixes + +2011-04-15 10:41:55 +0200 Sebastian Dröge + + * m4/gsettings.m4: + m4: Update gsettings m4 macros + +2011-04-14 16:24:47 -0700 David Schleef + + * configure.ac: + Bump orc requirement to 0.4.11 + +2011-04-15 00:09:14 +0100 Tim-Philipp Müller + + * ext/gsm/gstgsmdec.c: + * ext/gsm/gstgsmenc.c: + * ext/musicbrainz/gsttrm.c: + * ext/resindvd/resindvdbin.c: + * ext/resindvd/rsnparsetter.c: + * gst/aiff/aiffparse.c: + * gst/colorspace/gstcolorspace.c: + * gst/debugutils/gstchecksumsink.c: + * gst/debugutils/gstchopmydata.c: + * gst/geometrictransform/gstfisheye.c: + * gst/h264parse/gsth264parse.c: + * gst/hls/m3u8.c: + * gst/mpegdemux/gstmpegdemux.c: + * gst/mpegtsdemux/mpegtsbase.c: + Fix some unused-but-set-variable warnings with gcc 4.6 + +2011-04-14 19:53:16 +0100 Tim-Philipp Müller + + * tools/element-templates/gobject: + element-templates: clean up gobject template a bit + Remove pointless g_return_if_fail (G_IS_FOO (obj)) checks in + vfunc implementations. Comment out unused variables to avoid + warnings with gcc 4.6. + +2011-04-14 18:36:16 +0100 Tim-Philipp Müller + + * gst/asfmux/gstasfmux.c: + * gst/asfmux/gstasfobjects.c: + * gst/asfmux/gstasfparse.c: + * gst/asfmux/gstrtpasfpay.c: + asfmux: fix unused-but-set-variable warnings with gcc 4.6 + +2011-04-14 18:36:02 +0100 Tim-Philipp Müller + + * gst/bayer/gstrgb2bayer.c: + bayer: fix unused-but-set-variable warnings with gcc 4.6 + +2011-04-14 14:32:02 -0300 Thiago Santos + + * tests/check/elements/camerabin2.c: + tests: camerabin2: Leak fixes for the unit tests + Leak fixes related to not removing the source returned from + gst_bus_add_watch + +2011-04-14 13:27:20 -0300 Thiago Santos + + * tests/check/elements/camerabin.c: + tests: camerabin: Some leak fixes + Leak fixes related to removing the source returned from + gst_bus_add_watch + +2011-04-13 15:05:15 -0400 Reynaldo H. Verdejo Pinochet + + * Android.mk: + * sys/audioflingersink/Android.mk: + * sys/audioflingersink/GstAndroid.cpp: + * sys/audioflingersink/audioflinger_wrapper.cpp: + * sys/audioflingersink/audioflinger_wrapper.h: + * sys/audioflingersink/gstaudioflingerringbuffer.h: + * sys/audioflingersink/gstaudioflingersink.c: + * sys/audioflingersink/gstaudioflingersink.h: + Remove audioflingersink + Remove audioflingersink, it's in gst-android now. + +2011-04-14 16:49:18 +0100 Tim-Philipp Müller + + * gst-libs/gst/video/gstbasevideocodec.c: + * gst-libs/gst/video/gstbasevideodecoder.c: + * gst-libs/gst/video/gstbasevideoencoder.c: + basevideo: fix unused-but-set-variable warnings with gcc 4.6 + +2011-04-14 16:14:57 +0100 Tim-Philipp Müller + + * gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.h: + * gst-libs/gst/basecamerabinsrc/gstcamerabin-enum.h: + * gst-libs/gst/basecamerabinsrc/gstcamerabinpreview.h: + basecamerasrc: add unstable-API warnings if GST_USE_UNSTABLE_API is not defined + So people know this is unstable API even if it ends up right next + to our other API. + +2011-04-14 16:11:53 +0100 Tim-Philipp Müller + + * gst-libs/gst/media-info/.gitignore: + libs: remove leftover media-info directory + +2011-04-13 22:48:28 +0200 Andoni Morales Alastruey + + * gst/hls/m3u8.c: + hlsdemux: m3u8: return duration in nanoseconds + +2011-04-13 23:35:50 +0200 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: fix handling of end of playlist + Don't send the EOS event until we reached the end of the playlist + and the queue is really empty. + +2011-04-13 22:25:57 +0200 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: fix example pipeline + +2011-04-13 23:06:18 +0200 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: ignore seek events until it's implemented + +2011-04-13 22:17:05 +0200 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: dispose the fetcher from the same thread it's created + +2011-04-14 11:28:58 +0100 Tim-Philipp Müller + + * gst/debugutils/fpsdisplaysink.c: + fpsdisplaysink:: fix compilation with older GLib + g_object_notify_by_pspec() is new in GLib 2.26, but we only require 2.22. + +2011-04-14 07:21:50 +0100 Christian Fredrik Kalager Schaller + + * gst-plugins-bad.spec.in: + Update spec file with a lot of new plugins + +2011-04-13 23:59:40 -0300 Thiago Santos + + * tests/check/elements/jifmux.c: + tests: jifmux: Adds test for new exposure compensation tag + Adds a test for GST_TAG_CAPTURING_EXPOSURE_COMPENSATION on + jifmux check tests. + +2011-04-13 21:58:36 -0400 Olivier Crête + + * gst/dtmf/Makefile.am: + * gst/dtmf/gstdtmfcommon.h: + * gst/dtmf/gstdtmfsrc.c: + * gst/dtmf/gstrtpdtmfcommon.h: + * gst/dtmf/gstrtpdtmfdepay.c: + * gst/dtmf/gstrtpdtmfdepay.h: + * gst/dtmf/gstrtpdtmfsrc.c: + * gst/dtmf/gstrtpdtmfsrc.h: + dtmf: Move duplicate #defines into a common include + Centralize duplicated constants so they have the same value. + Also standardise minimum tone duration to 250ms and minimum inter-tone + interval to 100ms. + +2011-04-13 22:33:37 -0300 Lasse Laukkanen + + * gst/camerabin/gstcamerabin.c: + camerabin: Preserve unused imagebin or videobin on NULL + If video or image mode is never selected then respective bin is in NULL state. + Preserve this state when resetting camerabin from PAUSED to READY. + +2011-04-13 22:07:58 +0300 Stefan Kost + + * gst/pnm/Makefile.am: + pnm: add LIBTOOLFLAGS = --tag=disable-static + +2011-04-13 20:26:11 +0200 Sebastian Dröge + + * ext/xvid/gstxvidenc.c: + xvidenc: Implement getcaps function + This allows to set width/height/etc restrictions to be set downstream. + Fixes bug #647498. + +2011-04-12 21:47:14 +0100 Tim-Philipp Müller + + * Android.mk: + * Makefile.am: + * configure.ac: + * docs/plugins/Makefile.am: + * docs/plugins/gst-plugins-bad-plugins-docs.sgml: + * docs/plugins/gst-plugins-bad-plugins-sections.txt: + * docs/plugins/inspect/plugin-qtmux.xml: + * gst-plugins-bad.spec.in: + * gst/qtmux/Makefile.am: + * gst/qtmux/atoms.c: + * gst/qtmux/atoms.h: + * gst/qtmux/atomsrecovery.c: + * gst/qtmux/atomsrecovery.h: + * gst/qtmux/descriptors.c: + * gst/qtmux/descriptors.h: + * gst/qtmux/fourcc.h: + * gst/qtmux/ftypcc.h: + * gst/qtmux/gstqtmoovrecover.c: + * gst/qtmux/gstqtmoovrecover.h: + * gst/qtmux/gstqtmux.c: + * gst/qtmux/gstqtmux.h: + * gst/qtmux/gstqtmuxmap.c: + * gst/qtmux/gstqtmuxmap.h: + * gst/qtmux/gstqtmuxplugin.c: + * gst/qtmux/properties.c: + * gst/qtmux/properties.h: + * tests/check/Makefile.am: + * tests/check/elements/.gitignore: + * tests/check/elements/qtmux.c: + * tests/check/pipelines/tagschecking.c: + qtmux: remove qtmux plugin, it has moved to -good + https://bugzilla.gnome.org/show_bug.cgi?id=636699 + +2011-04-13 16:31:12 +0200 Sebastian Dröge + + * configure.ac: + configure: Fix libexif pkg-config check + There's no exif plugin so don't use AG_GST_CHECK_FEATURE. + Fixes bug #647564. + +2011-04-12 16:42:17 -0400 Olivier Crête + + * gst/dtmf/gstdtmfsrc.c: + * gst/dtmf/gstrtpdtmfsrc.c: + dtmf: Remove leftover MAEMO_BROKEN defines + Remove defines to work around bugs in old Maemo releases + +2011-04-11 14:44:17 -0300 Lasse Laukkanen + + * gst/camerabin/gstcamerabin.c: + camerabin: Fix corner case for preview posting + Fix corner case where video preview image is not posted if stopping + video capture immediately after capture start. + +2011-04-11 18:31:45 +0300 Stefan Kost + + * gst/jpegformat/gstjpegparse.c: + jpegparse: subtract id-str size from the remaining read + Fixes a regression from the patches in bug #626618. + +2011-04-11 18:30:17 +0300 Stefan Kost + + * gst/jpegformat/gstjpegparse.c: + * tests/check/elements/camerabin2.c: + jpeg: set tags to NULL at init time and after freeing them + +2011-04-11 18:29:28 +0300 Stefan Kost + + * gst/jpegformat/gstjifmux.c: + * gst/jpegformat/gstjpegparse.c: + * tests/check/elements/camerabin2.c: + jpeg: comment and logging changes + +2011-04-10 19:53:35 +0200 Víctor Manuel Jáquez Leal + + * gst/jpegformat/gstjpegparse.c: + jpegparse: add gst_jpeg_parse_remove_marker() + This function will remove the whole marker from the buffer. + Also we set it as the default behavior for marker JPG{0-13}? in order to avoid + a useless #if + https://bugzilla.gnome.org/show_bug.cgi?id=626618 + +2010-08-13 12:38:02 +0200 Víctor Manuel Jáquez Leal + + * gst/jpegformat/gstjpegparse.c: + jpegparse: refactor COM parsing + add gst_jpeg_parse_com () and get_utf8_from_data () to extract and + validate comment format + https://bugzilla.gnome.org/show_bug.cgi?id=626618 + +2010-11-16 18:22:07 +0100 Víctor Manuel Jáquez Leal + + * gst/jpegformat/gstjpegparse.c: + jpegparse: refactor APP1 parsing + add gst_jpeg_parse_app1 () and extract_and_queue_tags () + https://bugzilla.gnome.org/show_bug.cgi?id=626618 + +2010-11-21 15:05:43 +0100 Víctor Manuel Jáquez Leal + + * gst/jpegformat/gstjpegparse.c: + jpegparse: log id when skipping an unhandled APP marker + https://bugzilla.gnome.org/show_bug.cgi?id=626618 + +2010-11-16 17:47:17 +0100 Víctor Manuel Jáquez Leal + + * gst/jpegformat/gstjpegparse.c: + jpegparse: skip all APP markers, excepting APP1 + https://bugzilla.gnome.org/show_bug.cgi?id=626618 + +2010-11-21 15:09:17 +0100 Víctor Manuel Jáquez Leal + + * gst/jpegformat/gstjpegparse.c: + jpegparse: add get_tag_list () + https://bugzilla.gnome.org/show_bug.cgi?id=626618 + +2011-04-11 00:36:35 -0400 Thibault Saunier + + * Android.mk: + * android/NOTICE: + * android/h264parse.mk: + * android/metadata.mk: + * android/qtmux.mk: + * android/sdpelem.mk: + * ext/faad/Makefile.am: + * gst-libs/gst/basecamerabinsrc/Makefile.am: + * gst-libs/gst/interfaces/Makefile.am: + * gst/adpcmdec/Makefile.am: + * gst/adpcmenc/Makefile.am: + * gst/aiff/Makefile.am: + * gst/asfmux/Makefile.am: + * gst/audiobuffer/Makefile.am: + * gst/autoconvert/Makefile.am: + * gst/bayer/Makefile.am: + * gst/camerabin/Makefile.am: + * gst/camerabin2/Makefile.am: + * gst/cdxaparse/Makefile.am: + * gst/coloreffects/Makefile.am: + * gst/colorspace/Makefile.am: + * gst/dataurisrc/Makefile.am: + * gst/debugutils/Makefile.am: + * gst/dtmf/Makefile.am: + * gst/dvbsuboverlay/Makefile.am: + * gst/dvdspu/Makefile.am: + * gst/festival/Makefile.am: + * gst/freeze/Makefile.am: + * gst/frei0r/Makefile.am: + * gst/gaudieffects/Makefile.am: + * gst/geometrictransform/Makefile.am: + * gst/h264parse/Makefile.am: + * gst/hdvparse/Makefile.am: + * gst/hls/Makefile.am: + * gst/id3tag/Makefile.am: + * gst/interlace/Makefile.am: + * gst/invtelecine/Makefile.am: + * gst/ivfparse/Makefile.am: + * gst/jp2kdecimator/Makefile.am: + * gst/jpegformat/Makefile.am: + * gst/legacyresample/Makefile.am: + * gst/librfb/Makefile.am: + * gst/liveadder/Makefile.am: + * gst/mpeg4videoparse/Makefile.am: + * gst/mpegdemux/Makefile.am: + * gst/mpegpsmux/Makefile.am: + * gst/mpegtsdemux/Makefile.am: + * gst/mpegvideoparse/Makefile.am: + * gst/mve/Makefile.am: + * gst/mxf/Makefile.am: + * gst/nsf/Makefile.am: + * gst/nuvdemux/Makefile.am: + * gst/patchdetect/Makefile.am: + * gst/pcapparse/Makefile.am: + * gst/pnm/Makefile.am: + * gst/qtmux/Makefile.am: + * gst/rawparse/Makefile.am: + * gst/rtpmux/Makefile.am: + * gst/rtpvp8/Makefile.am: + * gst/scaletempo/Makefile.am: + * gst/sdi/Makefile.am: + * gst/sdp/Makefile.am: + * gst/segmentclip/Makefile.am: + * gst/siren/Makefile.am: + * gst/speed/Makefile.am: + * gst/stereo/Makefile.am: + * gst/subenc/Makefile.am: + * gst/tta/Makefile.am: + * gst/videofilters/Makefile.am: + * gst/videomaxrate/Makefile.am: + * gst/videomeasure/Makefile.am: + * gst/videoparsers/Makefile.am: + * gst/videosignal/Makefile.am: + * gst/vmnc/Makefile.am: + * gst/y4m/Makefile.am: + * sys/audioflingersink/Android.mk: + android: make it ready for androgenizer + Remove the android/ top dir + Fixe the Makefile.am to be androgenized + To build gstreamer for android we are now using androgenizer which generates the needed Android.mk files. + Androgenizer can be found here: http://git.collabora.co.uk/?p=user/derek/androgenizer.git + +2011-04-10 00:22:37 +0100 Tim-Philipp Müller + + * tools/Makefile.am: + element-maker: dist new videofilter2 template + +2011-04-09 13:40:37 +0200 Sebastian Dröge + + * sys/vdpau/h264/gstvdph264dec.c: + vdpau: Fix uninitialized variable compiler warning + +2011-04-09 10:03:00 +0200 Sebastian Dröge + + * gst/debugutils/fpsdisplaysink.c: + * gst/debugutils/fpsdisplaysink.h: + fpsdisplaysink: Add last-message property and never print anything to stdout + Instead everything will be put into the last-message property and + gst-launch -v will print all changes of the property. This makes + the behaviour of fpsdisplay consistent with the fakesink/identity/etc + behaviour. + +2011-04-09 09:50:23 +0200 Sebastian Dröge + + * gst/debugutils/fpsdisplaysink.c: + * gst/debugutils/fpsdisplaysink.h: + fpsdisplaysink: Rename verbose property to silent for consistency + +2011-04-09 00:37:25 +0100 Tim-Philipp Müller + + * Makefile.am: + * configure.ac: + * gst-libs/gst/Makefile.am: + * gst-libs/gst/baseparse/Makefile.am: + * gst-libs/gst/baseparse/gstbaseparse.c: + * gst-libs/gst/baseparse/gstbaseparse.h: + * tools/element-templates/baseparse: + baseparse: remove -bad version of baseparse library, now in core + +2011-04-02 18:30:22 +0100 Tim-Philipp Müller + + * gst/videoparsers/Makefile.am: + * gst/videoparsers/gstdiracparse.c: + * gst/videoparsers/gstdiracparse.h: + * gst/videoparsers/gsth263parse.c: + * gst/videoparsers/gsth263parse.h: + * gst/videoparsers/gsth264parse.c: + * gst/videoparsers/gsth264parse.h: + * gst/videoparsers/h263parse.h: + videoparsers: port to baseparse, which is now in libgstbase in core + +2011-04-08 12:11:07 -0700 David Schleef + + * gst/videofilters/Makefile.am: + * gst/videofilters/gstscenechange.c: + * gst/videofilters/gstscenechange.h: + * gst/videofilters/gstvideofilter2.c: + * gst/videofilters/gstvideofiltersbad.c: + scenechange: new scene change detection element + +2011-04-08 10:26:42 -0700 David Schleef + + * tools/element-templates/videofilter2: + element-maker: Add videofilter2 template + +2011-04-08 19:32:31 +0100 Tim-Philipp Müller + + * Makefile.am: + * android/aacparse.mk: + * android/amrparse.mk: + * configure.ac: + * docs/plugins/Makefile.am: + * docs/plugins/gst-plugins-bad-plugins-docs.sgml: + * docs/plugins/gst-plugins-bad-plugins-sections.txt: + * docs/plugins/inspect/plugin-audioparsersbad.xml: + * gst/audioparsers/Makefile.am: + * gst/audioparsers/gstaacparse.c: + * gst/audioparsers/gstaacparse.h: + * gst/audioparsers/gstac3parse.c: + * gst/audioparsers/gstac3parse.h: + * gst/audioparsers/gstamrparse.c: + * gst/audioparsers/gstamrparse.h: + * gst/audioparsers/gstdcaparse.c: + * gst/audioparsers/gstdcaparse.h: + * gst/audioparsers/gstflacparse.c: + * gst/audioparsers/gstflacparse.h: + * gst/audioparsers/gstmpegaudioparse.c: + * gst/audioparsers/gstmpegaudioparse.h: + * gst/audioparsers/plugin.c: + * tests/check/Makefile.am: + * tests/check/elements/.gitignore: + * tests/check/elements/aacparse.c: + * tests/check/elements/ac3parse.c: + * tests/check/elements/amrparse.c: + * tests/check/elements/flacparse.c: + * tests/check/elements/mpegaudioparse.c: + Remove audioparsers plugin, it has been moved to -good + +2011-04-08 14:08:10 +0200 Sebastian Dröge + + * gst/debugutils/fpsdisplaysink.c: + fpsdisplay: Use PROP_ instead of ARG_ for the property enums + +2011-04-07 15:15:57 +0200 Philippe Normand + + * gst/debugutils/fpsdisplaysink.c: + * gst/debugutils/fpsdisplaysink.h: + fpsdisplay: Add verbose property + When this property is set to TRUE the element will display statistics + on stdout. + Fixes https://bugzilla.gnome.org/show_bug.cgi?id=647030 + +2011-04-05 21:04:54 +0200 Haakon Sporsheim + + * sys/dshowvideosink/dshowvideosink.cpp: + dshowvideosink: update for latest GstXOverlay changes + From xwindow_id to window_handle. + https://bugzilla.gnome.org/show_bug.cgi?id=646955 + +2011-04-07 18:30:49 +0200 Mark Nauwelaerts + + * gst/audioparsers/gstmpegaudioparse.c: + mpegaudioparse: relax sync match a bit when draining + ... to at least allow initial caps change (but no further caps jitter). + +2011-04-06 15:58:07 +0200 Robert Swain + + * gst/fieldanalysis/gstfieldanalysis.c: + * gst/fieldanalysis/gstfieldanalysis.h: + fieldanalysis: Use RFF flag to indicate buffers to drop downstream + Use of the GAP flag is not really correct here and makes it difficult to + handle real GAP buffers in deinterlace. The RFF flag is unused and can + be reused with similar semantics - the buffers marked with RFF that are + in a telecine state contain only unneeded repeated fields and so can be + dropped. + +2011-04-05 19:26:15 +0300 Vincent Penquerc'h + + * sys/shm/gstshmsink.c: + shmsink: ensure gst_poll_wait is called first on descriptors + We need to call gst_poll_wait before calling gst_poll_* status + functions on that new descriptor, so restart the loop, so _wait + will have been called on all elements of self->poll, whether + they have just been added or not. */ + +2011-04-06 20:40:40 -0400 Olivier Crête + + * configure.ac: + shm: Fix MSG_NOSIGNAL check + Include sys/socket.h before checking for MSG_NOSIGNAL, also + check that sys/socket.h before doing any other checks for shm + +2010-12-15 10:39:24 +0000 Tim-Philipp Müller + + * gst/camerabin/gstcamerabin.c: + camerabin: don't rely on the application running the default GLib main loop + Don't use g_idle_add() and friends to schedule things we can't do from the + streaming thread in another thread. The app may not be running the default + GLib main loop. Instead, just spawn a thread. + Also, we need to care for when acessing a pad variable, as another thread + might have taken camerabin to NULL while this gst_camerabin_imgbin_finished + didn't run. + https://bugzilla.gnome.org/show_bug.cgi?id=615655 + +2011-04-04 20:55:39 +0200 Mark Nauwelaerts + + * gst/audioparsers/gstmpegaudioparse.c: + mpegaudioparse: require tighter sync match when draining + +2011-04-04 15:57:36 +0300 Stefan Kost + + * common: + Automatic update of common submodule + From 1ccbe09 to c3cafe1 + +2011-04-04 12:21:23 +0200 Mark Nauwelaerts + + * gst/qtmux/gstqtmux.c: + qtmux: more helpful debug error message when no needed duration on input buffers + Fixes #646256. + +2011-04-02 01:21:34 +0200 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: validate properly utf-8 playlist + +2011-04-02 01:10:37 +0200 Andoni Morales Alastruey + + * gst/hls/m3u8.c: + hlsdemux: m3u8: clear the list of media files before updating the playlist + +2011-04-02 01:08:02 +0200 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + * gst/hls/gsthlsdemux.h: + hlsdemux: use and adapter instead of costful buffer joins + +2011-04-01 13:53:28 -0700 David Schleef + + * ext/dc1394/Makefile.am: + * ext/directfb/Makefile.am: + * gst/hls/Makefile.am: + Remove setting of plugindir from Makefiles + +2011-03-26 17:55:31 -0700 David Schleef + + * gst-libs/gst/video/gstbasevideodecoder.c: + basevideo: Fix negotiation errors + +2011-03-26 17:43:54 -0700 David Schleef + + * ext/schroedinger/gstschrodec.c: + * gst-libs/gst/video/gstbasevideodecoder.c: + * gst-libs/gst/video/gstbasevideodecoder.h: + basevideo: Add function to allocate src buffer + +2011-04-01 16:52:48 -0300 Thiago Santos + + * gst/hls/gsthlsdemux.c: + hlsdemux: Another windows build fix + Replace %lld with %u as GST_BUFFER_SIZE is a guint + +2011-04-01 16:12:50 -0300 Thiago Santos + + * gst/hls/m3u8.c: + hls: Fix compilation on windows + Use string literal on printing format + +2011-04-01 13:39:50 -0300 Thiago Santos + + * gst/camerabin/gstcamerabin.c: + camerabin: Processing should stop on READY + The videobin and imagebin from camerabin have their states + locked and aren't put to READY when all the rest of camerabin + is set to it. + This might cause one of them to be still processing and post + an EOS after camerabin isn't expecting it anymore, this causes + an assertion as the processing counter would already be 0 and + would be decremented. + +2011-04-01 15:00:32 +0200 Sebastian Dröge + + * gst/segmentclip/gstsegmentclip.c: + segmentclip: Keep a reference of events until the event is parsed + +2011-04-01 14:47:43 +0200 Sebastian Dröge + + * gst/audioparsers/gstmpegaudioparse.c: + * gst/audioparsers/gstmpegaudioparse.h: + mpegaudioparse: Parse encoder delay and encoder padding from the LAME header if present + +2011-03-31 16:21:11 -0400 Olivier Crête + + * sys/shm/gstshmsink.c: + shm: Make default perm u+rw g+r for shm area + +2011-03-30 15:53:12 +0100 Tim-Philipp Müller + + * gst/hls/gsthlsdemux.c: + hlsdemux: update for media type was renaming from playlist/m3u8 to application/x-hls + +2011-03-30 11:33:09 +0200 Sebastian Dröge + + * configure.ac: + configure.ac: Add hls plugin + +2011-03-30 10:11:24 +0200 Sebastian Dröge + + * gst/hls/gsthlsdemux.c: + hlsdemux: Some minor cleanup + Use GST_DEBUG_FUNCPTR and G_PARAM_STATIC_STRINGS + +2011-03-30 03:34:39 +0200 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: fix indentation and docs sections + +2011-03-29 23:18:24 +0200 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: don't leek the query + +2011-03-29 23:06:14 +0200 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: check if the task's cond was signaled because it's the end of playlist + +2011-03-12 13:32:57 +0100 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: post a message in the bus when the playlist changes + +2011-03-12 13:15:52 +0100 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: don't update the playlist if we stay in the same bitrate + +2011-03-12 13:00:06 +0100 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: Add support for URI queries + +2011-03-12 12:50:25 +0100 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: Add support for duration queries + +2011-03-12 12:28:42 +0100 Andoni Morales Alastruey + + * gst/hls/m3u8.c: + * gst/hls/m3u8.h: + hlsdemux: m3u8: protect public methods properly + +2011-03-12 12:20:32 +0100 Andoni Morales Alastruey + + * gst/hls/m3u8.c: + * gst/hls/m3u8.h: + hlsdemux: m3u8: add support to get the duration from a playlist + +2011-02-16 03:51:08 +0100 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: don't print an error if the download was cancelled + +2011-02-16 03:49:49 +0100 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: make sure the fetcher state change is complete before continuing + +2011-02-16 01:19:45 +0100 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: don't leak the first buffer + +2011-02-16 00:55:30 +0100 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: clean up code a little bit + +2011-02-16 00:53:48 +0100 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: only check for the end of playlist when the queue is empty + +2011-02-15 22:40:21 +0100 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + * gst/hls/gsthlsdemux.h: + hlsdemux: make sure to stop fragments cache if something cancelled it + +2011-02-15 21:55:26 +0100 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: reuse the code in reset() to free resources in dispose() + +2011-02-15 21:49:20 +0100 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + * gst/hls/gsthlsdemux.h: + hlsdemux: use a typefinder to set the caps in the source pad + +2011-02-15 04:39:34 +0100 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: add more comments and document better all the threads involved + +2011-02-15 03:42:29 +0100 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: handle 404 from the source element + +2011-02-15 03:41:43 +0100 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: stop the fetcher in the PAUSED_TO_READY transition, not when disposing() + +2011-02-15 03:41:01 +0100 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + * gst/hls/gsthlsdemux.h: + hlsdemux: make sure we don't stop the fetcher twice from different threads + +2011-02-15 02:13:56 +0100 Andoni Morales Alastruey + + * gst/hls/gsthlsdemux.c: + hlsdemux: query the uri upstream before updating the playlist + +2011-02-14 18:51:32 +0100 Andoni Morales Alastruey + + * configure.ac: + * gst/hls/Makefile.am: + * gst/hls/gstfragmented.h: + * gst/hls/gstfragmentedplugin.c: + * gst/hls/gsthlsdemux.c: + * gst/hls/gsthlsdemux.h: + * gst/hls/m3u8.c: + * gst/hls/m3u8.h: + hlsdemux: Add HTTP live streaming demuxer element + Based on previous work by Marc-André Lureau + +2011-03-21 10:57:05 -0300 Thiago Santos + + * gst/jpegformat/Makefile.am: + * gst/jpegformat/gstjifmux.c: + jifmux: Add GstTagXmpWriter support + Adds GstTagXmpWriter interface to jifmux element + +2011-03-21 10:56:51 -0300 Thiago Santos + + * gst/qtmux/Makefile.am: + * gst/qtmux/atoms.c: + * gst/qtmux/atoms.h: + * gst/qtmux/gstqtmux.c: + qtmux: Adding GstTagXmpWriter interface + Adds GstTagXmpWriter interface support to qtmux + +2011-03-27 23:50:24 +0300 Sreerenj Balachandran + + * docs/plugins/Makefile.am: + * docs/plugins/gst-plugins-bad-plugins-docs.sgml: + * docs/plugins/gst-plugins-bad-plugins-sections.txt: + * ext/opencv/Makefile.am: + * ext/opencv/gstopencv.c: + * ext/opencv/gsttextoverlay.c: + * ext/opencv/gsttextoverlay.h: + * ext/opencv/gsttextwrite.c: + * ext/opencv/gsttextwrite.h: + opencv text overlay: rename and docuemnt + Rename the element textwrite to opencvtextoverlay. Add proper structuring to + opencv textoverlay element. + Fixes: #640561 + +2011-03-27 13:57:05 -0700 David Schleef + + * gst/mpegtsmux/mpegtsmux.c: + mpegtsmux: Fix 64-bit printf format problem + +2011-03-27 20:09:52 +0200 Carl-Anton Ingmarsson + + * sys/vdpau/gstvdpsink.c: + vdpausink: fix bug where we didn't setup vdpau on a user set window + +2011-03-27 19:47:43 +0200 Carl-Anton Ingmarsson + + * sys/vdpau/basevideodecoder/gstbasevideodecoder.c: + * sys/vdpau/basevideodecoder/gstbasevideodecoder.h: + * sys/vdpau/gstvdp/gstvdpdecoder.c: + * sys/vdpau/gstvdpvideopostprocess.c: + * sys/vdpau/h264/gsth264dpb.c: + * sys/vdpau/h264/gsth264dpb.h: + * sys/vdpau/h264/gstvdph264dec.c: + * sys/vdpau/mpeg/gstvdpmpegdec.c: + * sys/vdpau/mpeg4/gstvdpmpeg4dec.c: + vdpau: fixup GstFlowReturn handling + Previously the different decoders would discard errounous GstFlowReturns coming + from downstream. Now we properly return these further upstream so that we + properly error out on eg. negotiation problems. + +2011-03-27 19:40:48 +0200 Carl-Anton Ingmarsson + + * sys/vdpau/gstvdpau.c: + vdpau: small indentation fix + +2010-09-06 17:42:15 +0200 Carl-Anton Ingmarsson + + * sys/vdpau/mpeg/gstvdpmpegdec.c: + vdpaumpegdec: don't ignore return value of gst_base_video_decoder_finish_frame + +2011-03-27 17:42:56 +0100 Tim-Philipp Müller + + * sys/dshowsrcwrapper/gstdshow.cpp: + dshow: fix list iteration code + +2011-03-27 17:22:52 +0100 Tim-Philipp Müller + + * gst/dccp/gstdccpserversink.c: + dccpserversink: fix list iteration code + Fix suboptimal list iteration code, and add some FIXMEs. + +2011-03-26 12:45:24 +0000 Tim-Philipp Müller + + * gst/patchdetect/Makefile.am: + patchdetect: link against libm + Link against libm. Include math-compat.h header. Don't link against + orc, since it's not actually used. + https://bugzilla.gnome.org/show_bug.cgi?id=645711 + +2011-03-26 16:12:18 +1100 Jan Schmidt + + * gst/mpegtsmux/tsmux/tsmux.c: + Use correct clock when checking whether to write a new PCR + The PCR clocks against the 27MHz SCR clock, so check it correctly + to avoid writing the PCR too often. + Partially fixes: #611046 + +2011-03-26 15:58:21 +1100 Jan Schmidt + + * gst/mpegtsmux/mpegtsmux.c: + * gst/mpegtsmux/mpegtsmux.h: + Rewrite M2TS packet output + Make sure we only write the bottom 30 bits of the PCR to the m2ts header. + Don't use floating point computation for it, and remove weird bit fiddling + that messes up the PCR in a way I can't find any + justification/documentation for. + Don't accidentally lose PCR packets from the output. + Fix the description for the m2ts-mode property so it's clear it's a flag, + and which setting does what. + Fixes: #611061 #644429 + Partially fixes: #645006 + +2011-03-26 11:14:01 +1100 Jan Schmidt + + * gst/mpegtsmux/mpegtsmux.c: + Fix a FIXME, and some whitespace/code style bits. + Also, add a new copyright notice for me. + +2011-03-25 22:33:05 +0100 Sebastian Dröge + + * common: + Automatic update of common submodule + From 193b717 to 1ccbe09 + +2011-03-25 14:56:43 +0200 Stefan Kost + + * common: + Automatic update of common submodule + From b77e2bf to 193b717 + +2011-03-25 09:32:30 +0100 Sebastian Dröge + + * common: + Automatic update of common submodule + From d8814b6 to b77e2bf + +2011-03-25 09:08:49 +0100 Sebastian Dröge + + * common: + Automatic update of common submodule + From 6aaa286 to d8814b6 + +2011-03-25 08:33:37 +0100 Sebastian Dröge + + * gst/aiff/aiffparse.c: + aiffparse: Add float caps to the template caps + +2011-03-24 16:16:20 -0700 David Schleef + + * configure.ac: + * sys/decklink/gstdecklinksrc.cpp: + decklink: Fix win32 build + +2011-03-24 22:32:42 +0200 René Stadler + + * gst/mpegdemux/gstmpegtsdemux.c: + mpegtsdemux: ensure cleanup of pes/section filter helper structures + In particular, the section_filter would not be cleared for a private section + stream, leaking a GstAdapter. Seen on bug #645502. + +2011-03-24 22:10:43 +0200 René Stadler + + * gst/mpegdemux/gstmpegtsdemux.c: + mpegtsdemux: don't leak pad name + As seen on bug #645502. + +2011-03-24 21:46:09 +0200 René Stadler + + * gst/videoparsers/h264parse.c: + h264parse: free PPS NAL buffers on cleanup + Obviously a typo. Fixes bug #645502. + +2011-03-24 21:44:07 +0200 René Stadler + + * gst/videoparsers/h264parse.c: + h264parse: don't leak all NAL buffers + gst_buffer_replace() doesn't steal the ref. Partial fix for bug #645502. + +2011-03-24 18:49:54 +0200 Stefan Kost + + * common: + Automatic update of common submodule + From 6aec6b9 to 6aaa286 + +2011-03-24 14:51:12 +0100 Janne Grunau + + * gst/mpegtsdemux/mpegtsbase.c: + mpegtsdemux: fix stream_info descriptor parsing + +2011-03-09 23:06:14 +0530 Arun Raghavan + + * gst/audioparsers/plugin.c: + dcaparse: Bump rank to primary+1 + Seems to work fine with a reasonably wide range of media, so bumping + rank. + +2011-03-24 10:08:59 +0100 Sebastian Dröge + + * gst/aiff/aiffparse.c: + * gst/aiff/aiffparse.h: + aiffparse: Add support for 32 bit and 64 bit floating point formats + +2011-03-24 09:58:45 +0100 Sebastian Dröge + + * gst/aiff/aiffparse.c: + aiffparse: The SSND header is 16 bytes large, not 8 + 16 bytes + Fixes bug #645568 and playback in pull mode for sample widths > 8 that + are not a multiple of 2 bytes (e.g. 24 bit samples). + +2011-03-24 09:29:06 +0100 Sebastian Dröge + + * gst/aiff/aiffparse.c: + aiffparse: Use gst_util_uint64_scale_ceil() instead of a custom function + +2011-03-24 13:43:01 +0530 Arun Raghavan + + * ext/dts/gstdtsdec.c: + dtsdec: Don't export bitrate if open/variable/lossless + libdca returns the bitrate as 1/2/3 for open/variable/lossless files + respectively. This makes sure we don't emit these values. + +2011-03-24 09:22:56 +0100 Sebastian Dröge + + * ext/celt/gstceltdec.c: + celtdec: Read the additional, optional extra headers from the caps too + +2011-03-24 09:14:10 +0100 Sebastian Dröge + + * ext/celt/gstceltdec.c: + * ext/celt/gstceltdec.h: + celtdec: Get and use streamheaders from the caps if possible + This allows playback of files where the streamheader buffers were + dropped for some reason and also sets the srcpad caps earlier. + +2011-03-23 22:53:56 -0700 David Schleef + + * ext/schroedinger/gstschroenc.c: + schroenc: Revert previous commit + It appears the patch, which I've been carrying around forever, + had been already applied. + +2011-02-20 14:16:18 -0800 David Schleef + + * ext/vp8/gstvp8dec.h: + * ext/vp8/gstvp8enc.h: + * gst-libs/gst/video/Makefile.am: + * gst-libs/gst/video/gstbasevideocodec.h: + * gst-libs/gst/video/gstbasevideoencoder.c: + * gst-libs/gst/video/gstbasevideoencoder.h: + * gst-libs/gst/video/gstbasevideoutils.c: + * gst-libs/gst/video/gstbasevideoutils.h: + basevideo: merge utils header into basevideocodec + +2010-12-30 18:25:04 -0800 David Schleef + + * ext/schroedinger/gstschroenc.c: + schroenc: Output element message with frame stats + +2011-02-26 00:28:32 -0800 David Schleef + + * configure.ac: + * gst/patchdetect/Makefile.am: + * gst/patchdetect/gstpatchdetect.c: + * gst/patchdetect/gstpatchdetect.h: + patchdetect: new element + Detects Munsell ColorChecker in a video image and automatically + white balances and color corrects based on the detected values. + This element is only a demonstration at this stage, it needs to + be separated into two elements. + +2011-02-27 00:48:19 -0800 David Schleef + + * configure.ac: + * sys/Makefile.am: + * sys/decklink/DeckLinkAPI.h: + * sys/decklink/DeckLinkAPIDispatch.cpp: + * sys/decklink/LinuxCOM.h: + * sys/decklink/Makefile.am: + * sys/decklink/capture.cpp: + * sys/decklink/capture.h: + * sys/decklink/gstdecklink.cpp: + * sys/decklink/gstdecklinksink.cpp: + * sys/decklink/gstdecklinksink.h: + * sys/decklink/gstdecklinksrc.cpp: + * sys/decklink/gstdecklinksrc.h: + decklink: Add decklink plugin + Source and sink elements for BlackMagic DeckLink SDI cards. + +2011-03-17 17:38:58 -0700 David Schleef + + * configure.ac: + * sys/Makefile.am: + * sys/linsys/Makefile.am: + * sys/linsys/gstlinsys.c: + * sys/linsys/gstlinsyssdisink.c: + * sys/linsys/gstlinsyssdisink.h: + * sys/linsys/gstlinsyssdisrc.c: + * sys/linsys/gstlinsyssdisrc.h: + * sys/linsys/include/asi.h: + * sys/linsys/include/master.h: + * sys/linsys/include/sdi.h: + * sys/linsys/include/sdiaudio.h: + * sys/linsys/include/sdivideo.h: + linsys: Add plugin for Linear Systems SDI boards + +2010-09-14 11:30:33 -0700 David Schleef + + * configure.ac: + * gst/sdi/Makefile.am: + * gst/sdi/gstsdi.c: + * gst/sdi/gstsdidemux.c: + * gst/sdi/gstsdidemux.h: + * gst/sdi/gstsdimux.c: + * gst/sdi/gstsdimux.h: + sdi: Add raw SDI muxing/demuxing elements + +2011-03-17 19:03:29 -0700 David Schleef + + * ext/cog/gstlogoinsert.c: + * tests/check/Makefile.am: + * tests/check/elements/logoinsert.c: + logoinsert: Fix memleaks, add test + +2010-11-15 11:37:12 -0800 David Schleef + + * ext/cog/gstlogoinsert.c: + logoinsert: Add data property + +2011-03-23 15:49:18 +0100 Robert Swain + + * tests/examples/camerabin2/gst-camerabin2-test.c: + gst-camerabin2-test: Fix premature shutdown + We must wait for camerabin2's stop-capture procedures to finish before quitting + the main loop or firing off the next capture. If we get stuck waiting for + camerabin2 to become idle, this is a bug that needs fixing. + +2011-03-23 16:32:19 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + camerabin2: Only mark video capture as finished after EOS + Instead of probing the videosink sinkpad for passing EOS, better + to wait for EOS from the bus. + This makes sure the filesink has already processed it and is + ready to close the file. This is used to notify applications + that camerabin2 is idle and can be shut down. + +2011-03-18 15:49:12 +0100 Robert Swain + + * gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c: + * gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.h: + * gst/camerabin2/gstcamerabin2.c: + * gst/camerabin2/gstcamerabin2.h: + * gst/camerabin2/gstwrappercamerabinsrc.c: + basecamerasrc: camerabin2: wrappercamerabinsrc: Add read-only max-zoom prop + This is not implemented in any of our real sources to which wrappercamerabinsrc + might connect but this is optional and can be implemented at any time. A + limit on the software zoom level using video{crop,scale} would be arbitrary. + +2011-03-23 12:38:36 -0300 Thiago Santos + + * gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c: + * gst/camerabin2/gstcamerabin2.c: + * tests/check/elements/camerabin2.c: + camerabin2: Improve idle property usage + Use resource warning messages to notify camerabin2 that a capture + as aborted or couldn't be started, making it decrement the + processing counter and making the idle property more reliable. + +2011-03-22 12:04:20 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + camerabin2: No need to force audiosrc to null on stop_capture + Setting the audio source to null isn't needed and it could + make the EOS that is still flowing be dropped if autoaudiosrc + is used because its pads go flushing before the EOS gets pushed + from the real source. + +2011-03-22 08:32:48 -0300 Lauri Lehtinen + + * gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c: + basecamerabinsrc: Check if set preview caps are the same + Checks if the new received preview-caps are equal to what is + already in use, skips the preview-caps setting logic in case + new caps are same as current ones. + +2011-03-15 15:47:21 -0300 Thiago Santos + + * tests/check/elements/camerabin2.c: + tests: camerabin2: Adds another 'idle' test + Adds another test that checks that the idle property works + correctly when bogus start-capture calls are made. + This fails currently, but should remind us of fixing it in + the future by defining a proper error reporting from camera + sources to camerabin2 + +2011-03-15 15:34:31 -0300 Thiago Santos + + * tests/check/elements/camerabin2.c: + tests: camerabin2: Sprinkle some 'idle' property checks + Adds some checks for 'idle' property in camerabin2 tests + +2011-03-15 15:11:01 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + * gst/camerabin2/gstcamerabin2.h: + camerabin2: Adds new idle property + Adds idle property (just like camerabin1), a boolean that + is true when camerabin2 isn't processing and can be shut down + without losing data. + +2011-03-15 10:50:54 -0300 Thiago Santos + + * tests/check/elements/camerabin2.c: + tests: camerabin2: Adds tests for new image capture properties + Adds tests to check that changing encoder/muxer for image capture + works + +2011-03-15 10:11:43 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + camerabin2: Adding properties for image capture settings + Adds properties for selecting image encoder and muxer for + image capture + +2011-03-14 14:33:57 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + camerabin2: More debug log + Small refactoring and adding more debug log to encodebin related + paths + +2011-03-14 14:30:36 -0300 Thiago Santos + + * gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c: + basecamerasrc: Set preview pipeline NULL + Set preview pipeline to NULL when freed to be able to + recreate it on the following lines + +2011-03-23 22:02:37 +0530 Arun Raghavan + + * gst/audioparsers/gstdcaparse.c: + * gst/audioparsers/gstdcaparse.h: + dcaparse: Expose frame size in caps + This exports the size of the frame (number of bytes from one sync point + to the next) as the "frame_size" field in caps. + +2011-03-09 23:03:10 +0530 Arun Raghavan + + * gst/audioparsers/gstdcaparse.c: + * gst/audioparsers/gstdcaparse.h: + dcaparse: Expose block size in caps + This sets the "block_size" field on caps as the number of samples + encoded in one frame. + +2011-03-22 20:53:08 +0100 Mark Nauwelaerts + + * gst/qtmux/gstqtmux.c: + qtmux: use running time for synchronization + See also #432612. + +2011-03-22 13:18:03 +0100 Mark Nauwelaerts + + * gst/videoparsers/gsth264parse.c: + h264parse: chain up to parent finalize + +2011-03-22 13:46:42 +0100 Chris E Jones + + * gst/scaletempo/gstscaletempo.c: + scaletempo: Correctly handle newsegment events with stop==-1 + Fixes bug #645420. + +2011-03-22 12:34:20 +0100 Luis de Bethencourt + + * configure.ac: + configure.ac: redundant uses of AC_MSG_RESULT() + cleaned the redundant uses of AC_MSG_RESULT() in configure.ac + +2011-03-18 19:34:57 +0100 Luis de Bethencourt + + * autogen.sh: + autogen: wingo signed comment + +2011-03-21 13:31:15 -0700 David Schleef + + * gst/videofilters/Makefile.am: + * gst/videofilters/gstvideofilter2.c: + * gst/videofilters/gstvideofilter2.h: + * gst/videofilters/gstzebrastripe.c: + * gst/videofilters/gstzebrastripe.h: + zebrastripe: Add new GstVideoFilter2 base class + An experiment. Not completely happy with it. + +2011-03-21 20:40:14 +0200 Mart Raudsepp + + * gst/mpegdemux/mpegtspacketizer.c: + * gst/mpegtsdemux/mpegtspacketizer.c: + mpegtspacketizer: Handle all ISO8859-x encodings in get_encoding() + ... according to ETSI EN 300 468, "Selection of character table" + +2011-02-21 11:44:01 +0100 Janne Grunau + + * gst/mpegtsdemux/mpegtsbase.c: + * gst/mpegtsdemux/tsdemux.c: + mpegtsdemux: do not try to parse packets containing section data as PES + +2011-02-21 11:42:54 +0100 Janne Grunau + + * gst/mpegtsdemux/gstmpegdefs.h: + * gst/mpegtsdemux/tsdemux.c: + mpegtsdemux: add stream types for DSM CC A, B, C, D + +2011-03-21 18:54:46 +0100 Janne Grunau + + * gst/mpegtsdemux/mpegtsbase.c: + mpegtsdemux: fix playback if PMT is seen before PAT + The stream for the PMT pid has to be cleared since the version checking + in the packetizer won't emit the same PMT again otherwise. + +2011-03-21 16:51:16 +0100 Andreas Frisch + + * gst/videoparsers/gsth264parse.c: + h264parse: Set parsed=true in the srcpad caps + Fixes bug #645412. + +2011-03-21 10:38:58 +0100 Edward Hervey + + * ext/mpeg2enc/gstmpeg2enc.cc: + mpeg2enc: Lower the rank to MARGINAL + The rationale is that it can't be properly used right now when using + it to encode mpeg2video because of the needs-to-be-rewritten properties + and format negotiation. Other encoders will negotiate in a much saner + fashion. + One such example is that when you pick mpeg2enc for mpeg2video, the + default value for the 'format' property is "Generic MPEG-1", which is + completely wrong if downstream caps are mpeg2. The whole negotiation + code needs some serious loving before this plugin can be bumped back + up to a higher rank. + +2011-03-16 09:50:34 +0100 Benjamin Gaignard + + * gst/debugutils/fpsdisplaysink.c: + * gst/debugutils/fpsdisplaysink.h: + fpsdisplaysink: add "frames-dropped" and "frames-rendered" properties + https://bugzilla.gnome.org/show_bug.cgi?id=643469 + +2011-03-18 09:33:26 +0100 Sebastian Dröge + + * gst/dvbsuboverlay/gstdvbsuboverlay.c: + dvbsuboverlay: Remove some unused variables in the I420 blending function + +2011-03-17 20:19:27 +0200 Raimo Järvi + + * gst/dvbsuboverlay/gstdvbsuboverlay.c: + dvbsuboverlay: Fix using alpha values in blitting. + Use each pixel's own alpha value instead of average alpha value when + calculating color components. Fixes bug #639763. + +2011-03-17 16:34:02 +0000 Tim-Philipp Müller + + * ext/vp8/Makefile.am: + vp8: fix LIBADD order in Makefile.am + +2011-03-16 15:53:13 +0000 Tim-Philipp Müller + + * gst/audioparsers/gstmpegaudioparse.c: + mpegaudioparse: add FIXME for making the base class use xing seek tables better + +2011-03-17 16:41:52 -0400 Olivier Crête + + * sys/shm/shmpipe.c: + shm: Don't use "sun" as a variable name, breaks on Solaris + Seems like the Solaris compiler has -Dsun=1, so don't use + sun as a variable name + Patch by Tim Mooney + https://bugzilla.gnome.org/show_bug.cgi?id=645053 + +2011-03-17 15:27:39 -0400 Olivier Crête + + * configure.ac: + shm: Check for MSG_NOSIGNAL macro + Don't build the plugin is MSG_NOSIGNAL is not defined + https://bugzilla.gnome.org/show_bug.cgi?id=645053 + +2011-03-16 18:52:24 +0000 Sjoerd Simons + + * sys/shm/gstshmsink.c: + shmsink: Keep shmsink referenced while there are still buffers around + +2011-03-16 18:51:50 +0000 Sjoerd Simons + + * sys/shm/shmpipe.c: + * sys/shm/shmpipe.h: + shm: Allow ShmPipe to save a data pointer for applications + +2011-03-16 18:51:02 +0000 Sjoerd Simons + + * sys/shm/shmpipe.c: + shm: Keep the ShmPipe alive as long as there are blocks left + +2011-03-09 19:34:39 -0500 Olivier Crête + + * sys/shm/gstshmsrc.c: + shmsrc: Only connect to sink in PLAYING in live mode + +2011-03-09 19:34:25 -0500 Olivier Crête + + * sys/shm/gstshmsrc.c: + shmsrc: Keep GstPoll for whole src lifetime + +2011-03-15 09:15:35 -0300 Lasse Laukkanen + + * gst/camerabin/camerabinpreview.c: + * gst/camerabin/gstcamerabin.c: + camerabin: Add an assertion to preview pipeline generation + Adds an assertion in case the preview pipeline is NULL and also + explicitly initializes preview caps to NULL for clarity. + +2011-03-14 18:25:25 +0100 Sebastian Dröge + + * gst/audioparsers/gstdcaparse.c: + * gst/audioparsers/gstdcaparse.h: + dcaparse: Add depth and endianness to the caps + Some decoders can only handle specific endianness or a fixed + depth and this allows better negotiation. + Fixes bug #644208. + +2011-03-14 12:39:23 +0000 Tim-Philipp Müller + + * gst/mpegtsmux/mpegtsmux.c: + mpegtsmux: fix broken pad caps refcount handling + gst_caps_make_writable() takes ownership of the caps passed in, but + the caller doesn't own a ref to the caps here, because GST_PAD_CAPS + doesn't return a ref. Looks like the code relied on a caps leak + elsewhere for this to work properly. + +2011-03-14 12:33:29 +0000 Tim-Philipp Müller + + * gst/mpegtsmux/mpegtsmux.c: + mpegtsmux: don't error out if downstream fails to handle the newsegment event + If downstream doesn't handle the newsegment event, don't error out (esp. + not without posting a proper error message on the bus), but just continue. + If there's a problem, we'll find out when we start pushing buffers. + https://bugzilla.gnome.org/show_bug.cgi?id=644395 + +2011-03-11 14:40:44 +0000 Andreas Frisch + + * gst/mpegtsmux/mpegtsmux.c: + mpegtsmux: remove unused variable + +2011-03-11 18:23:22 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + camerabin2: Set queues to silent + Optimize a little by setting queues to silent + +2011-03-11 16:20:52 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + * gst/camerabin2/gstcamerabin2.h: + camerabin2: Refactoring encodebin usage + Refactor some common code regarding encodebin usage in camerabin2 + +2011-03-11 17:07:03 -0300 Thiago Santos + + * tests/check/elements/camerabin2.c: + tests: camerabin2: Fix number of iteration of tests + There are 3 taglist tests, not 2 + +2011-03-11 10:32:35 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + * gst/camerabin2/gstwrappercamerabinsrc.c: + camerabin2: Some memleak fixes + +2011-03-08 09:43:58 +0100 Robert Swain + + * gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c: + * gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.h: + * gst/camerabin2/gstcamerabin2.c: + * gst/camerabin2/gstcamerabin2.h: + * gst/camerabin2/gstwrappercamerabinsrc.c: + * tests/examples/camerabin2/gst-camerabin2-test.c: + basecamerasrc: wrappercamerabinsrc: camerabin2: Expose/add floating point zoom property + +2011-03-04 15:53:42 +0100 Robert Swain + + * gst/camerabin2/gstwrappercamerabinsrc.c: + wrappercamerabinsrc: Remove dead definition + This definition is unused in this code. + +2011-03-10 11:38:18 -0300 Thiago Santos + + * gst/camerabin2/gstwrappercamerabinsrc.c: + wrappercamerabinsrc: Avoid clearing recording caps + When recording 2 videos in sequence with the same video-capture-caps, + the second video would get a not-negotiated error because the + src caps were being cleared without any intention of + renegotiating it back to the requested capture caps. + This patch avoids this caps reset procedure unless a new + caps was set. + +2011-03-11 14:37:06 +0100 Sebastian Dröge + + * gst/videoparsers/gstdiracparse.c: + diracparse: Add correct template caps and element details + +2011-03-11 10:40:40 +0000 Tim-Philipp Müller + + * tests/examples/camerabin2/Makefile.am: + examples: fix LDADD/LIBS path order for camerabin2 example + +2011-03-11 10:34:23 +0000 Tim-Philipp Müller + + * gst/camerabin2/gstcamerabin2.c: + camerabin2: don't leak element name strings + Don't leak string copy returned by gst_element_get_name(). Also, check + for certain elements by checking the plugin feature / factory name, not + the assigned object name. + +2011-03-11 10:26:01 +0000 Tim-Philipp Müller + + * Makefile.am: + * configure.ac: + * docs/plugins/Makefile.am: + * docs/plugins/gst-plugins-bad-plugins-docs.sgml: + * docs/plugins/gst-plugins-bad-plugins-sections.txt: + * ext/Makefile.am: + * gst/vmnc/Makefile.am: + build: remove more tarkin/theoraexp build cruft + +2011-03-10 13:39:40 -0800 David Schleef + + * configure.ac: + * ext/Makefile.am: + * ext/tarkin/Makefile.am: + * ext/tarkin/README: + * ext/tarkin/TODO: + * ext/tarkin/WHAT_THE_HECK_IS_THIS_CODE_DOING: + * ext/tarkin/bitcoder.h: + * ext/tarkin/golomb.h: + * ext/tarkin/gsttarkin.c: + * ext/tarkin/gsttarkindec.c: + * ext/tarkin/gsttarkindec.h: + * ext/tarkin/gsttarkinenc.c: + * ext/tarkin/gsttarkinenc.h: + * ext/tarkin/info.c: + * ext/tarkin/mem.c: + * ext/tarkin/mem.h: + * ext/tarkin/rle.h: + * ext/tarkin/tarkin.c: + * ext/tarkin/tarkin.h: + * ext/tarkin/wavelet.c: + * ext/tarkin/wavelet.h: + * ext/tarkin/wavelet_coeff.c: + * ext/tarkin/wavelet_xform.c: + * ext/tarkin/yuv.c: + * ext/tarkin/yuv.h: + * ext/theora/Makefile.am: + * ext/theora/theoradec.c: + * ext/theora/theoradec.h: + * gst/videofilters/gstzebrastripe.h: + theora,tarkin: Remove ancient unused code + +2011-03-10 16:03:58 +0100 Mark Nauwelaerts + + * gst/qtmux/gstqtmux.c: + qtmux: provide for PTS metadata when so configured + ... and not only when sort-of feeling like it. + In any case, if it turns out all really is in order, + and presumably DTS == PTS, then no ctts will be produced anyway. + +2011-03-10 16:02:42 +0100 Mark Nauwelaerts + + * gst/qtmux/gstqtmux.c: + qtmux: also track original PTS buffer timestamp in reorder dts-method + +2011-03-09 14:53:26 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + camerabin2: Force EOS on audio src + We can't rely on audio sources pushing EOS when going PAUSED->READY + because this is a basesrc bahavior and when used inside autoaudiosrc + the ghostpad goes flushing before the real source pushes the EOS, + so it is dropped. + +2011-03-04 06:06:16 -0300 Thiago Santos + + * gst/camerabin2/gstwrappercamerabinsrc.c: + wrappercamerabinsrc: No need for starting segment + +2011-03-04 06:09:43 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + * gst/camerabin2/gstcamerabin2.h: + gstcamerabin2: Set encodebin's videorate and audiorate properties + Listen to encodebin's element-added signal to be able to set + skip-to-first on both audiorates and videorates. + +2011-02-15 14:58:28 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + camerabin2: Handle audio elements states + Audio elements are put into bin only when needed, so we need + to be careful with their states as camerabin2 won't manage + them if they are outside the bin. + Also we should reset their pad's flushing status before + starting a new capture. + +2011-01-21 12:47:57 -0300 Thiago Santos + + * tests/check/elements/camerabin2.c: + camerabin2: tests: Update tests to check for audio streams + Add a check that resulting recorded video files have audio streams. + +2011-01-21 10:56:52 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + * gst/camerabin2/gstcamerabin2.h: + camerabin: adding audio related properties + Adds 4 audio properties related to audio recording + * audio-src + * mute + * audio-supported-capture-caps + * audio-capture-caps + +2011-01-20 09:34:39 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + * gst/camerabin2/gstcamerabin2.h: + camerabin2: Adding audio support for video recordings + Adds an audio source and audio capsfilter/queue/convert, creating + a new branch on camerabin2 that is used to feed encodebin with + audio buffers for video recording. + +2011-02-28 15:43:46 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + camerabin2: Add logging for stop-capture signal + +2011-02-24 18:28:28 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + camerabin2: Add viewfinder caps related properties + Adds properties to check what caps are supported on the + viewfinder (from the camerasrc viewfinder pad) and another + one to set a caps for the viewfinder. + +2011-02-24 17:42:21 -0300 Lauri Lehtinen + + * gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c: + * gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.h: + basecamerasrc: add virtual function to notify subclass of changing preview caps + Adds a virtual function to basecamerasrc in case subclasses want to be + notified of changing preview caps. This is useful if the subclass wants + to post the preview itself or if it wants to provide a preview buffer + as close to as possible to the user's requested resolution to the + preview generation pipeline. + +2011-02-22 13:10:15 +0200 Teemu Katajisto + + * tests/examples/camerabin2/gst-camerabin2-test.c: + examples: camerabin2: add option for setting the wrapper camera source + +2011-02-21 17:04:06 +0200 Teemu Katajisto + + * tests/examples/camerabin2/Makefile.am: + * tests/examples/camerabin2/gst-camerabin2-test.c: + examples: camerabin2: add encoding profile loading + +2011-02-17 14:51:16 -0300 Thiago Santos + + * gst/camerabin2/gstwrappercamerabinsrc.c: + wrappercamerabinsrc: Fix newsegment pushing + Send update newsegments instead of non-update ones + for the video branch when starting recordings + +2011-02-15 14:59:32 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + camerabin2: Set some queue's properties + Sets viewfinder queue to leaky and tell image branch + queue to don't care about durations + +2011-02-10 11:50:27 -0300 Thiago Santos + + * gst/camerabin2/gstwrappercamerabinsrc.c: + wrappercamerabinsrc: Ready is enough for forcing a caps change + +2011-02-09 19:14:13 -0300 Thiago Santos + + * gst/camerabin2/gstwrappercamerabinsrc.c: + wrappercamerabinsrc: Check for downstream caps on first captures + Use video_renegotiate and image_renegotiate booleans to make + the videosrc negotiate the capture caps on the first capture because + the caps might be set before wrappercamerabinsrc goes into PLAYING + and pads drop the internal renegotiate event. + This is required as the output-selector is using the 'none' negotiation + mode. + +2011-02-09 19:09:24 -0300 Thiago Santos + + * gst/camerabin2/gstwrappercamerabinsrc.c: + wrappercamerabinsrc: Avoid fixating capture caps + When setting the internal capsfilter caps for capture we should put + the full caps instead of trying to fixate it ourselves. This way we let + the elements (and mostly the source) select the best format instead + of defaulting to what the pad fixation function picks. + +2011-02-09 08:27:59 -0300 Thiago Santos + + * tests/examples/camerabin2/gst-camerabin2-test.c: + camerabin2: examples: Allow free image dimensions + Changes the default width/height of captures so that it will + be autopicked by camerabin2 instead of hardcoding an option + +2011-02-09 08:15:08 -0300 Thiago Santos + + * tests/examples/camerabin2/gst-camerabin2-test.c: + camerabin2: examples: Backport fix from camerabin example + We should only check if the xwindow should be created if we already + parsed the arguments of the program + +2011-02-04 14:53:49 -0300 Thiago Santos + + * gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c: + * gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.h: + * gst/camerabin2/gstwrappercamerabinsrc.c: + * gst/camerabin2/gstwrappercamerabinsrc.h: + camerabin2: Moving preview image properties to basecamerasrc + Moves preview image related properties to basecamerasrc as that + should be present on all camerasrcs + +2011-02-08 15:51:42 +0200 Lasse Laukkanen + + * gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c: + basecamerasrc: Fix getting element implementing photography iface + +2011-02-03 12:02:14 -0300 Thiago Santos + + * gst-libs/gst/basecamerabinsrc/Makefile.am: + * gst-libs/gst/basecamerabinsrc/gstcamerabinpreview.c: + * gst-libs/gst/basecamerabinsrc/gstcamerabinpreview.h: + * gst/camerabin2/camerabingeneral.c: + * gst/camerabin2/camerabingeneral.h: + * gst/camerabin2/gstwrappercamerabinsrc.h: + camerabin2: Move preview helper functions to basecamerabinsrc + Move preview helper functions to baseacamerabinsrc so they can + be reused by multiple camerabin2 sources. + +2011-02-03 16:58:37 -0300 Thiago Santos + + * tests/examples/camerabin2/.gitignore: + * tests/examples/camerabin2/Makefile.am: + * tests/examples/camerabin2/gst-camerabin2-test.c: + camerabin2: examples: Add gst-camerabin2-test + Adds gst-camerabin2-test example application, similar to + gst-camerabin-test for camerabin. + It is useful for taking pictures and recording videos using + camerabin2 and providing arguments for most of camerabin2 + properties + +2011-02-04 12:36:14 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + camerabin2: Add viewfinder-sink property + Adds a property to set the viewfinder's sink of camerabin2 + +2011-03-09 13:19:50 +0200 René Stadler + + * gst/fieldanalysis/gstfieldanalysis.c: + fieldanalysis: fix double free() crashes + +2011-03-08 11:19:41 +0000 Byeong-ryeol Kim + + * gst/videofilters/Makefile.am: + videofilters: link to libm + https://bugzilla.gnome.org/show_bug.cgi?id=644176 + +2011-03-07 22:41:30 +0200 Stefan Kost + + * ext/lv2/gstlv2.c: + lv2: update url for port-groups extension + +2011-03-07 10:36:46 +0100 Sebastian Dröge + + * configure.ac: + soundtouch: The pkg-config file in version 1.5 is called soundtouch + +2011-02-26 16:20:52 -0800 David Schleef + + * configure.ac: + * gst/videofilters/Makefile.am: + * gst/videofilters/gstvideofiltersbad.c: + * gst/videofilters/gstzebrastripe.c: + * gst/videofilters/gstzebrastripe.h: + zebrastripe: New element + Adds zebra stripes to overexposed video. + +2011-03-04 17:37:04 +0100 Edward Hervey + + * ext/Makefile.am: + ext: Always dist the curl directory + Event if we can't build it. Fixes make dist + +2011-03-04 12:11:12 +0100 Edward Hervey + + * gst/videoparsers/gstdiracparse.c: + * gst/videoparsers/h263parse.c: + videoparsers: Fix unitialized variables + Makes macosx compiler happy + +2011-03-04 12:10:25 +0100 Edward Hervey + + * ext/curl/gstcurlsink.c: + curlsink: Fix print-related issues + +2011-03-04 11:59:44 +0100 Edward Hervey + + * gst/rtpvp8/gstrtpvp8pay.c: + rtpvp8: Fix unitialized variable + Makes macosx compiler happy. + +2011-03-04 09:25:49 +0000 Tim-Philipp Müller + + * gst/fieldanalysis/gstfieldanalysisorc-dist.c: + * gst/fieldanalysis/gstfieldanalysisorc-dist.h: + fieldanalysis: add backup files for compiling without orc + +2011-03-03 00:57:09 +0000 Tim-Philipp Müller + + * gst/videoparsers/gsth263parse.c: + * gst/videoparsers/h263parse.c: + * gst/videoparsers/h263parse.h: + h263parse: allocate H263Params struct on the stack + It's flat and not kept around for longer. + +2011-03-03 00:45:11 +0000 Tim-Philipp Müller + + * gst/videoparsers/h263parse.c: + * gst/videoparsers/h263parse.h: + h263parse: minor clean-ups + const-ify some arguments and re-indent header a little. + +2011-02-28 11:51:54 +0100 benjamin gaignard + + * gst/debugutils/fpsdisplaysink.c: + fpsdisplay: fix sync property default value + +2011-03-02 23:43:42 +0100 Sebastian Dröge + + * configure.ac: + * ext/celt/gstceltdec.c: + * ext/celt/gstceltenc.c: + celtenc: Fix compilation with celt >= 0.11.0 + Fixes bug #643607. + +2010-09-15 17:32:09 +0200 Robert Swain + + * configure.ac: + * gst/fieldanalysis/Makefile.am: + * gst/fieldanalysis/gstfieldanalysis.c: + * gst/fieldanalysis/gstfieldanalysis.h: + * gst/fieldanalysis/gstfieldanalysisorc.orc: + fieldanalysis: Add fieldanalysis element + This element analyses video buffers to identify if they are progressive, + interlaced or telecined and outputs buffers with appropriate flags for a + downstream element (which will be the deinterlace element, after some + forthcoming modifications) to be able to output progressive frames and + adjust timestamps resulting in a progressive stream. + +2011-03-01 11:23:49 +0000 Tim-Philipp Müller + + * docs/plugins/gst-plugins-bad-plugins.args: + * docs/plugins/gst-plugins-bad-plugins.hierarchy: + * docs/plugins/gst-plugins-bad-plugins.interfaces: + * docs/plugins/inspect/plugin-colorspace.xml: + * docs/plugins/inspect/plugin-h264parse.xml: + * docs/plugins/inspect/plugin-mpegtsdemux.xml: + * docs/plugins/inspect/plugin-rtmpsrc.xml: + * docs/plugins/inspect/plugin-rtpvp8.xml: + * docs/plugins/inspect/plugin-schro.xml: + * docs/plugins/inspect/plugin-videoparsersbad.xml: + docs: update docs for recent changes in git + +2011-03-01 11:16:56 +0000 Tim-Philipp Müller + + * docs/plugins/Makefile.am: + * docs/plugins/gst-plugins-bad-plugins-docs.sgml: + * docs/plugins/gst-plugins-bad-plugins-sections.txt: + * docs/plugins/inspect/plugin-curl.xml: + * ext/curl/gstcurlsink.c: + docs: add new curl plugin and curlsink element to docs + +2011-03-01 10:49:57 +0000 Tim-Philipp Müller + + * configure.ac: + configure: also check for platform socket headers needed by curlsink element + +2011-03-01 10:03:07 +0000 Tim-Philipp Müller + + * ext/curl/gstcurlsink.c: + * ext/curl/gstcurlsink.h: + curlsink: no need for a private instance structure + The entire instance structure is private anyway. + +2011-03-01 09:56:51 +0000 Tim-Philipp Müller + + * ext/curl/gstcurlsink.c: + curlsink: clean up property registration code + Fix some typos, use same style as in all other plugins, avoiding + unnecessary temporary GParamSpec variables; use G_PARAM_SPEC_STATIC_STRINGS. + +2011-02-26 20:21:25 +0000 Tim-Philipp Müller + + * configure.ac: + * ext/Makefile.am: + curl: add configure check and hook up to build system + +2011-02-26 20:20:33 +0000 Patricia Muscalu + + * ext/curl/Makefile.am: + * ext/curl/gstcurl.c: + * ext/curl/gstcurlsink.c: + * ext/curl/gstcurlsink.h: + curl: add libcurl-based sink element + Sink acts as a client and can connect to servers to + upload media. + https://bugzilla.gnome.org/show_bug.cgi?id=641496 + +2011-02-25 14:24:17 +0000 Tim-Philipp Müller + + * ext/jp2k/gstjasperdec.c: + jp2kdec: post proper error when the image's colour space is not supported + https://bugzilla.gnome.org/show_bug.cgi?id=643115 + +2011-02-28 20:19:53 +0100 Mark Nauwelaerts + + * configure.ac: + configure.ac: cygwin/mingw; enable plugin linking to static lib + Useful for DirectX plugin(s). + Fixes #642507. + +2011-02-28 19:58:41 +0100 Mark Nauwelaerts + + * configure.ac: + configure.ac: export plugin description more platform independent + Fixes #642504. + +2011-02-28 18:33:13 +0100 Mark Nauwelaerts + + * common: + Automatic update of common submodule + From 1de7f6a to 6aec6b9 + +2011-02-26 13:53:44 -0800 David Schleef + + * gst/audioparsers/gstaacparse.c: + Revert "aacparse: allow parsed frames on sink pad" + This reverts commit e49b89d5c5a1244fa0dcb8bb4996e38fb9bff9e5. + +2011-02-25 19:59:05 -0800 David Schleef + + * gst/colorspace/gstcolorspace.c: + colorspace: set dithering enum directly + +2011-02-25 19:57:47 -0800 David Schleef + + * gst/colorspace/colorspace.c: + * gst/colorspace/gstcolorspace.c: + colorspace: Add support for r210 + +2011-02-23 17:25:03 -0800 David Schleef + + * gst/audioparsers/gstaacparse.c: + aacparse: allow parsed frames on sink pad + +2011-02-23 17:24:14 -0800 David Schleef + + * gst-libs/gst/baseparse/gstbaseparse.c: + baseparse: make_metadata_writable() fix + +2011-02-24 09:29:51 -0300 Thiago Santos + + * tests/check/elements/jifmux.c: + jifmux: tests: Increase bus waiting timeout + Double bus waiting timeout as sometimes the test would fail + because it would timeout and get no messages from the bus. + +2011-02-21 13:24:03 +0000 Tim-Philipp Müller + + * gst-libs/gst/baseparse/gstbaseparse.c: + baseparse: rename GType from GstAudioBaseParseBad to GstBaseParseBad + We use it for video as well now. + +2011-02-21 12:14:59 +0100 Edward Hervey + + * gst/mpegpsmux/mpegpsmux.c: + * gst/qtmux/gstqtmux.c: + * gst/videomeasure/gstvideomeasure_ssim.c: + Revert "Check that collectpads exists before removing pad" + This reverts commit 6d8740476ccd3a3498dc4f18c19733643825c7b8. + Depends on a core commit that was reverted + +2011-02-20 23:57:19 -0800 David Schleef + + * gst/mpegpsmux/mpegpsmux.c: + * gst/qtmux/gstqtmux.c: + * gst/videomeasure/gstvideomeasure_ssim.c: + Check that collectpads exists before removing pad + The core now calls release pad from finalize, at which point + the collectpads might have already been freed. + +2011-02-20 23:01:30 -0800 David Schleef + + * gst/colorspace/colorspace.c: + colorspace: Fix YUV->RGB matrixing + +2011-02-20 22:43:56 -0800 David Schleef + + * gst/colorspace/colorspace.c: + * gst/colorspace/colorspace.h: + * gst/colorspace/gstcolorspace.c: + * gst/colorspace/gstcolorspace.h: + colorspace: Add dithering + Dithering only happens when a 16-bit-per-channel format is + involved. + +2011-01-11 10:32:47 +0000 Vincent Penquerc'h + + * ext/xvid/gstxviddec.c: + xviddec: bodge to avoid crashes + It seems xvidcore overreads its input buffer, so a nasty workaround + is to allocate some more memory (16 bytes seem to be enough). + There is no apparent image corruption with these extra bytes set to 0, + valgrind is much happier, and the crashes go away. + It is ugly, and slower though. But then, xviddec is currently + not autoplugged for playback anyway. + https://bugzilla.gnome.org/show_bug.cgi?id=334107 + +2011-02-20 14:14:27 -0800 David Schleef + + * gst/colorspace/colorspace.c: + * gst/colorspace/gstcolorspace.c: + * gst/colorspace/gstcolorspaceorc.orc: + colorspace: fix a few formats + +2011-02-19 13:12:41 -0800 David Schleef + + * configure.ac: + * gst/colorspace/colorspace.c: + * gst/colorspace/colorspace.h: + * gst/colorspace/gstcolorspace.c: + colorspace: Add 16-bit-per-channel handling + +2011-02-19 13:13:13 -0800 David Schleef + + * gst/colorspace/gstcolorspace.c: + colorspace: Fix memleak + +2011-02-19 13:07:39 -0800 David Schleef + + * ext/schroedinger/Makefile.am: + * ext/schroedinger/gstschro.c: + * ext/schroedinger/gstschroparse.c: + * gst-libs/gst/video/Makefile.am: + * gst-libs/gst/video/gstbasevideoparse.c: + * gst-libs/gst/video/gstbasevideoparse.h: + basevideocodec: remove parser in favor of baseparse + +2011-02-18 15:24:54 +0000 Tim-Philipp Müller + + * Makefile.am: + * gst/videoparsers/Makefile.am: + videoparsers: change plugin filename from libgsth263parse* to libgstvideoparsersbad* + Due to a registry bug you may need to manually remove your + registry file to make the new plugin appear with >0 features. + +2011-02-18 15:17:17 +0000 Tim-Philipp Müller + + * gst/mpegtsdemux/mpegtspacketizer.c: + mpegtspacketizer: fix log message printf format + +2011-02-18 15:05:31 +0200 Stefan Kost + + * gst-libs/gst/baseparse/gstbaseparse.c: + baseparse: trim trailing whitespace + +2011-02-18 15:05:03 +0200 Stefan Kost + + * gst-libs/gst/baseparse/gstbaseparse.c: + baseparse: use delta-unit flags instead of none + +2011-02-18 15:00:05 +0200 Stefan Kost + + * tests/examples/indexing/indexmpeg.c: + indexing-example: use proper signal names + +2011-02-18 09:40:00 +0100 Olivier Aubert + + * ext/rsvg/gstrsvgoverlay.c: + rsvgoverlay: allow negative values for x/y/width/height + +2011-02-18 12:39:08 +0000 Tim-Philipp Müller + + * gst/videoparsers/Makefile.am: + videoparsers: fix build + Add includes and link against new libgstbaseparse in the + build tree. + +2011-02-17 14:32:46 -0800 David Schleef + + * gst/mpegtsdemux/Makefile.am: + mpegtsdemux: Fix disting of headers + +2011-02-17 13:22:28 -0800 David Schleef + + * gst-libs/gst/baseparse/gstbaseparse.h: + baseparse: update documentation for API changes + +2010-10-13 16:12:02 -0700 David Schleef + + * tests/check/Makefile.am: + * tests/check/elements/parser.c: + tests: fix baseparse test + +2010-10-09 15:08:39 -0700 David Schleef + + * gst/videoparsers/Makefile.am: + * gst/videoparsers/dirac_parse.c: + * gst/videoparsers/dirac_parse.h: + * gst/videoparsers/gstdiracparse.c: + * gst/videoparsers/gstdiracparse.h: + * gst/videoparsers/plugin.c: + videoparsers: Add dirac parser + +2011-02-17 13:20:46 -0800 David Schleef + + * tools/gst-element-maker: + element-maker: do test build with -fPIC + +2010-10-09 15:06:12 -0700 David Schleef + + * tools/element-templates/baseparse: + element-maker: Add baseparse template + +2010-10-13 15:39:55 -0700 David Schleef + + * configure.ac: + * gst-libs/gst/Makefile.am: + * gst-libs/gst/baseparse/Makefile.am: + * gst-libs/gst/baseparse/gstbaseparse.c: + * gst-libs/gst/baseparse/gstbaseparse.h: + * gst/audioparsers/Makefile.am: + * gst/audioparsers/gstaacparse.h: + * gst/audioparsers/gstac3parse.h: + * gst/audioparsers/gstamrparse.h: + * gst/audioparsers/gstbaseparse.c: + * gst/audioparsers/gstbaseparse.h: + * gst/audioparsers/gstdcaparse.h: + * gst/audioparsers/gstflacparse.h: + * gst/audioparsers/gstmpegaudioparse.h: + * gst/videoparsers/Makefile.am: + * gst/videoparsers/gstbaseparse.c: + * gst/videoparsers/gstbaseparse.h: + * gst/videoparsers/gsth263parse.h: + * gst/videoparsers/gsth264parse.h: + * gst/videoparsers/h263parse.h: + baseparse: Create baseparse library + +2011-02-16 21:17:57 -0800 David Schleef + + * gst/dvdspu/gstspu-vobsub-render.c: + dvdsubdec: make up clut values if they weren't set + +2010-12-04 19:55:32 -0800 David Schleef + + * gst/mpegtsmux/mpegtsmux.c: + mpegtsmux: fix release_pad + Remove bogus freeing of pad element_private data that we + never set (collectpads uses it, which causes confusion here). + Also, check that our collectpads instance exists before using + it. Partial fix for #636011. + +2011-02-17 21:33:56 +0100 Janne Grunau + + * gst/mpegtsdemux/mpegtsbase.c: + mpegtsdemux: use G_GUINT64_FORMAT as format specifier for guint64 + fixes compilation on 32bit + +2011-02-15 18:12:02 -0800 David Schleef + + * gst/colorspace/gstcolorspace.c: + colorspace: Fix memory leak + +2011-02-10 12:35:47 +0100 Janne Grunau + + * gst/mpegtsdemux/gstmpegdefs.h: + * gst/mpegtsdemux/gstmpegdesc.c: + * gst/mpegtsdemux/gstmpegdesc.h: + mpegtsdemux: relicense gstmpegdefs.h, gstmpegdesc.h and gstmpegdesc.c to LGPL only + with permission from the license header: + """ + This library is licensed under 2 different licenses and you + can choose to use it under the terms of either one of them. The + two licenses are the MPL 1.1 and the LGPL. + """ + +2011-02-16 17:57:42 +0100 Janne Grunau + + * configure.ac: + * gst-plugins-bad.spec.in: + * gst/mpegtsdemux/Makefile.am: + * gst/mpegtsdemux/TODO: + * gst/mpegtsdemux/gstmpegdefs.h: + * gst/mpegtsdemux/gstmpegdesc.c: + * gst/mpegtsdemux/gstmpegdesc.h: + * gst/mpegtsdemux/gsttsdemux.c: + * gst/mpegtsdemux/mpegtsbase.c: + * gst/mpegtsdemux/mpegtsbase.h: + * gst/mpegtsdemux/mpegtspacketizer.c: + * gst/mpegtsdemux/mpegtspacketizer.h: + * gst/mpegtsdemux/mpegtsparse.c: + * gst/mpegtsdemux/mpegtsparse.h: + * gst/mpegtsdemux/tsdemux.c: + * gst/mpegtsdemux/tsdemux.h: + mpegtsdemux: add MPEG TS demuxer rewrite from Edward Hervey + with contributions from Miquel Angel Farre Guiu and Zaheer Abbas Merali + +2011-02-17 14:12:43 +0100 Mark Nauwelaerts + + * gst/videoparsers/gstbaseparse.c: + baseparse: tune QUERY_SEEKING response + Even if we currently do not have a duration yet, assume seekable if + it looks like we'll likely be able to determine it later on + (which coincides with needed information to perform seeking). + +2011-02-07 14:46:57 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.c: + baseparse: tune QUERY_SEEKING response + Even if we currently do not have a duration yet, assume seekable if + it looks like we'll likely be able to determine it later on + (which coincides with needed information to perform seeking). + Fixes #641047. + +2011-02-17 12:28:56 +0100 Mark Nauwelaerts + + * ext/faac/gstfaac.c: + faac: remove extraneous buffer unref + +2011-02-16 15:29:29 +0100 Sebastian Dröge + + * Makefile.am: + * tests/icles/Makefile.am: + * tests/icles/equalizer-test.c: + icles: Completely remove equalizer-test from -bad, it's in -good now + +2011-02-16 15:23:50 +0100 Sebastian Dröge + + * tests/icles/equalizer-test.c: + equalizer-test: Initialize debug category after gst_init() to fix segfault + +2011-02-14 12:53:49 +0200 Stefan Kost + + * common: + Automatic update of common submodule + From f94d739 to 1de7f6a + +2011-02-14 12:14:12 +0200 Stefan Kost + + * docs/plugins/Makefile.am: + docs: remove duplicated rule from Makefile.am + This causes a make warning and might even cause dist-failure. Other modules + don't need to override the target either and if we can fi it in + common/gtk-doc-plugins.mak. + +2011-02-14 11:48:34 +0200 Stefan Kost + + * docs/plugins/Makefile.am: + * docs/plugins/gst-plugins-bad-plugins-docs.sgml: + * docs/plugins/gst-plugins-bad-plugins-sections.txt: + docs: add rsvg plugin to the docs + +2011-02-14 11:42:52 +0200 Stefan Kost + + * ext/rsvg/gstrsvgdec.c: + rsvgdec: add basic doc-blob + +2011-02-11 17:59:31 +0100 Olivier Aubert + + * ext/rsvg/gstrsvgoverlay.c: + * ext/rsvg/gstrsvgoverlay.h: + rsvgoverlay: implement x/y/width/height (absolute and relative) positioning and dimensioning + Signed-off-by: Olivier Aubert + +2011-02-10 16:00:03 +0200 Teemu Katajisto + + * gst/camerabin/camerabinimage.c: + * gst/camerabin/camerabinvideo.c: + camerabin: application element memory leak fixes + If videobin/imagebin was never set to READY state the ownership + of elements created and set by application were never taken by + bin and therefore gst_object_sink is called for these elements + before unreffing (they may still be in floating state and not + unreffed properly without sinking first) + +2011-02-10 10:35:18 +0800 Hu Gang + + * gst-libs/gst/interfaces/photography.c: + * gst-libs/gst/interfaces/photography.h: + photography interface: update the noise_reduction type from guint to GstPhotographyNoiseReduction + https://bugzilla.gnome.org/show_bug.cgi?id=616814 + +2011-02-08 23:39:24 +0530 Arun Raghavan + + * gst/audioparsers/gstbaseparse.c: + * gst/videoparsers/gstbaseparse.c: + baseparse: Update min/max bitrate before first posting them + This avoids posting an initial min-bitrate of G_UINTMAX and max-bitrate + of 0. + https://bugzilla.gnome.org/show_bug.cgi?id=641857 + +2011-02-08 23:50:13 +0530 Arun Raghavan + + * gst/audioparsers/gstmpegaudioparse.c: + * gst/audioparsers/gstmpegaudioparse.h: + mpegaudioparse: Post CBR bitrate as nominal bitrate + Even if VBR headers are missing, we can't guarantee that a stream is in + fact a CBR stream, so it's safer to let baseparse calculate the average + bitrate rather than assume a CBR stream. However, in order to make + /some/ metadata available before the requisite number of frames have + been parsed, this posts the bitrate from the non-VBR headers as the + nominal bitrate. + https://bugzilla.gnome.org/show_bug.cgi?id=641858 + +2011-02-04 01:00:55 -0200 Luciana Fujii Pontello + + * gst/camerabin/gstcamerabin.c: + camerabin: Always take photo when preview-caps is set + When filename is not set, but preview-caps is set, take the photo and + send its preview. + +2011-01-26 11:49:48 -0200 Luciana Fujii Pontello + + * gst/camerabin/gstinputselector.c: + camerabin: Events with select-all in input-selector + When select-all was set, input-selector wasn't handling upstream events. + Now input-selector forwards the event to all of its sink pads. This + changes the input-selector internal to camerabin until it is replaced + with a better solution. + +2011-02-07 23:17:55 +0100 Mark Nauwelaerts + + * sys/directdraw/gstdirectdrawsink.c: + directdrawsink: avoid aspect-ratio borders overlying other windows + Fixes #632056. + +2011-02-07 22:47:34 +0100 Mark Nauwelaerts + + * sys/directdraw/gstdirectdrawsink.c: + directdrawsink: avoid rendering to invalid area + Based on patch by Havard Graff + Fixes #594280. + +2011-02-08 11:24:59 -0300 Thiago Santos + + * gst/camerabin2/gstwrappercamerabinsrc.c: + wrappercamerabinsrc: Do not re-set the clock if it is null + Avoids not needed work and doesn't assert when trying to + unref the null reference + +2011-02-07 09:50:22 +0200 Teemu Katajisto + + * tests/examples/camerabin/gst-camerabin-test.c: + examples: camerabin: fix --no-xwindow option handling in gst-camerabin-test + --no-window flag is false by default and selection based on the option whether + to create XWindow is done before options are parsed. Therefore XWindow is never + created. + https://bugzilla.gnome.org/show_bug.cgi?id=641712 + +2010-09-06 14:10:11 +0200 Mark Nauwelaerts + + * gst/audioparsers/gstamrparse.c: + amrparse: a valid amr-wb frame should not have reserved frame type index + See #639715. + +2011-02-07 14:05:34 +0100 Mark Nauwelaerts + + * configure.ac: + configure.ac: set GST_LIB_LDFLAGS + Aligns GST_LIB_LDFLAGS with e.g. -base to arrange for proper exports in libs. + +2011-01-12 17:13:07 +0200 Stefan Kost + + * tests/examples/camerabin/Makefile.am: + * tests/examples/camerabin/gst-camera.c: + * tests/examples/camerabin2/Makefile.am: + * tests/examples/camerabin2/gst-camera2.c: + camerabin-tests: fix lookup of UI files + These are uninstalled examples. Pass $srcdir to cpp to build the correct + location for the UI file. + +2011-02-04 09:08:26 +0100 Alexey Fisher + + * ext/vp8/gstvp8enc.c: + vp8enc: Add description for bitrate units. + +2011-02-03 15:22:51 -0300 Thiago Santos + + * gst/camerabin2/gstimagecapturebin.c: + imagecapturebin: Fix property setting + Set the property on the child and not on itself causing infinite + looping + +2011-02-01 11:20:25 -0300 Thiago Santos + + * tests/check/elements/camerabin2.c: + tests: camerabin2: Improve preview checking + +2011-02-01 11:19:53 -0300 Thiago Santos + + * gst/camerabin2/camerabingeneral.c: + * gst/camerabin2/gstwrappercamerabinsrc.c: + wrappercamerabinsrc: Fix preview messages + Image previews where being posted in sync with the buffers + timestamps, this makes no sense as previews should be posted ASAP. + Also adds some debugging messages. + +2011-02-01 11:19:29 -0300 Thiago Santos + + * gst/camerabin2/gstwrappercamerabinsrc.c: + * gst/camerabin2/gstwrappercamerabinsrc.h: + wrappercamerabinsrc: Handle src state change to avoid losing timestamps + Camerabin2 uses state changes to force the source to renegotiate its + caps to the capture formats. The state changes makes the source lose + its clock and base_time, causing it to stop timestamping the buffers. + We still need a proper way to make sources renegotiate its caps, so this + patch is a hack to make the source continue timestamping buffers even + after changing state. The patch works by getting the clock and base + time before doing the state change to NULL and setting them back + after putting it to PLAYING again. It also cares to drop the first + new segment after this state change. + +2011-01-27 15:35:14 -0300 Thiago Santos + + * tests/check/elements/camerabin2.c: + tests: camerabin2: preview filter tests + Adds tests to the preview-filter property of camerabin2 + +2011-01-27 14:39:19 -0300 Thiago Santos + + * gst/camerabin2/camerabingeneral.c: + * gst/camerabin2/camerabingeneral.h: + * gst/camerabin2/gstcamerabin2.c: + * gst/camerabin2/gstcamerabin2.h: + * gst/camerabin2/gstwrappercamerabinsrc.c: + * gst/camerabin2/gstwrappercamerabinsrc.h: + camerabin2: Add preview-filter property + Adds a property to select a custom element for preview pipeline + buffers processing + +2011-01-27 10:19:42 -0300 Thiago Santos + + * tests/check/elements/camerabin2.c: + tests: camerabin2: Add tests for custom filters + Adds tests to check that custom filters elements receive buffers + +2011-01-26 15:27:19 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + * gst/camerabin2/gstcamerabin2.h: + camerabin2: Add custom filter properties + Adds custom filter properties for camerabin2. Custom filters + can be added to video/image/preview branches. + +2011-02-03 16:24:24 +0100 Edward Hervey + + * gst/camerabin/camerabinpreview.c: + camerabin: Initialize variables + Makes compilers happy + +2011-02-02 18:41:39 +0000 Tim-Philipp Müller + + * sys/dvb/gstdvbsrc.c: + dvbsrc: fix up enum nick names + https://bugzilla.gnome.org/show_bug.cgi?id=591651 + +2011-01-31 17:24:24 +0100 Mark Nauwelaerts + + * gst/dccp/gstdccp.c: + * gst/dccp/gstdccp_common.h: + dccp: use socklen_t where appropriate rather than specific type + In particular, fixes Cygwin build where socklen_t is defined as int + in line with native win32 api definition. + +2011-02-01 20:01:13 +0000 Tim-Philipp Müller + + * gst/rtpvp8/Makefile.am: + rtpvp8: also link against libgstbase-0.10 for adapter and bit reader API + https://bugzilla.gnome.org/show_bug.cgi?id=641178 + +2011-02-01 14:40:54 +0000 Tim-Philipp Müller + + * configure.ac: + * gst/id3tag/id3tag.c: + id3mux: map new GST_TAG_ENCODED_BY to ID3v2 TENC frame + https://bugzilla.gnome.org/show_bug.cgi?id=627268 + +2011-01-31 17:45:19 +0000 Tim-Philipp Müller + + * gst/videoparsers/Makefile.am: + videoparsers: dist h264parse.h, fixing make distcheck + Spotted by Nathanael D. Noblet + +2011-01-14 10:19:28 +0200 Teemu Katajisto + + * gst/camerabin/camerabinpreview.c: + * gst/camerabin/camerabinpreview.h: + * gst/camerabin/gstcamerabin.c: + * gst/camerabin/gstcamerabin.h: + camerabin: optimize setting new caps for preview image pipeline + Avoid re-creating and linking of preview image pipeline when + setting new preview image caps. Backported from camerabin2. + https://bugzilla.gnome.org/show_bug.cgi?id=639502 + +2011-01-30 17:08:11 +0000 Tim-Philipp Müller + + * gst/rtpvp8/Makefile.am: + rtpvp8: fix LIBS and CFLAGS order in Makefile.am + +2011-01-23 17:02:38 +0000 Sjoerd Simons + + * gst/rtpvp8/gstrtpvp8depay.c: + rtpvp8depay: Accept packets with only one byte of data + When fragmenting partions it can happen that an RTP packet only caries 1 + byte of RTP data. + +2011-01-23 16:42:17 +0000 Sjoerd Simons + + * gst/rtpvp8/gstrtpvp8pay.c: + * gst/rtpvp8/gstrtpvp8pay.h: + rtpvp8pay: Treat the frame header just like any other partition + When setting up the initial mapping just act as if the global frame + information is another partition. This saves special-casing it later in + the actual packetizing code. + +2010-05-16 17:23:17 +0100 Sjoerd Simons + + * configure.ac: + * gst/rtpvp8/Makefile.am: + * gst/rtpvp8/gstrtpvp8.c: + * gst/rtpvp8/gstrtpvp8depay.c: + * gst/rtpvp8/gstrtpvp8depay.h: + * gst/rtpvp8/gstrtpvp8pay.c: + * gst/rtpvp8/gstrtpvp8pay.h: + rtpvp8: Add simple payloaders and depayloaders for VP8 + Minimal implementation of http://www.webmproject.org/code/specs/rtp/, + version 0.3.2 + +2011-01-28 12:38:19 +0100 Mark Nauwelaerts + + * gst/videoparsers/Makefile.am: + * gst/videoparsers/gsth264parse.c: + * gst/videoparsers/gsth264parse.h: + * gst/videoparsers/h264parse.c: + * gst/videoparsers/h264parse.h: + * gst/videoparsers/plugin.c: + videoparsers: add h264parse + Functionally equivalent to (legacy)h264parse and re-uses the latter's low + level NAL parsing, but otherwise based on GstBaseParse, and replacing + some property configuration with caps negotiation. + +2011-01-27 18:20:13 +0100 Mark Nauwelaerts + + * gst/h264parse/gsth264parse.c: + h264parse: rename to legacyh264parse + +2011-01-27 18:16:14 +0100 Mark Nauwelaerts + + * configure.ac: + * gst/h263parse/Makefile.am: + * gst/h263parse/gstbaseparse.c: + * gst/h263parse/gstbaseparse.h: + * gst/h263parse/gsth263parse.c: + * gst/h263parse/gsth263parse.h: + * gst/h263parse/h263parse.c: + * gst/h263parse/h263parse.h: + * gst/videoparsers/Makefile.am: + * gst/videoparsers/gstbaseparse.c: + * gst/videoparsers/gstbaseparse.h: + * gst/videoparsers/gsth263parse.c: + * gst/videoparsers/gsth263parse.h: + * gst/videoparsers/h263parse.c: + * gst/videoparsers/h263parse.h: + * gst/videoparsers/plugin.c: + h263parse: move to videoparsers and separate plugin registration + +2011-01-27 18:03:50 +0100 Mark Nauwelaerts + + * gst/h263parse/gstbaseparse.c: + * gst/h263parse/gstbaseparse.h: + * gst/h263parse/gsth263parse.c: + h263parse: update to latest baseparse + +2011-01-06 12:29:34 +0100 Mark Nauwelaerts + + * gst/h263parse/Makefile.am: + * gst/h263parse/gsth263parse.c: + * gst/h263parse/gsth263parse.h: + * gst/h263parse/h263parse.c: + * gst/h263parse/h263parse.h: + h263parse: shuffle code to untangle h263parse and parameter parsing + +2011-01-06 12:34:12 +0100 Mark Nauwelaerts + + * gst/h263parse/gsth263parse.c: + * gst/h263parse/gsth263parse.h: + * gst/h263parse/h263parse.c: + h263parse: provide for proper debug category, min frame size and code style + +2010-12-10 16:40:44 +0100 Mark Nauwelaerts + + * gst/h263parse/gsth263parse.c: + h263parse: remove redundant get_caps + .. as src pad already set to use fixed_caps + +2010-12-10 16:26:27 +0100 Mark Nauwelaerts + + * gst/h263parse/gsth263parse.c: + * gst/h263parse/gsth263parse.h: + h263parse: simplify valid_frame parsing + ... considering that baseparse takes care of skipping etc + +2010-05-14 02:08:03 +0530 Arun Raghavan + + * configure.ac: + * gst/h263parse/Makefile.am: + * gst/h263parse/gstbaseparse.c: + * gst/h263parse/gstbaseparse.h: + * gst/h263parse/gsth263parse.c: + * gst/h263parse/gsth263parse.h: + * gst/h263parse/h263parse.c: + h263parse: Add an h263parse element + This adds an h263parse element for parsing H.263 streams, breaking them + up into frame-sized buffers, and exporting metadata such as profile and + level. + https://bugzilla.gnome.org/show_bug.cgi?id=622276 + +2011-01-27 16:52:34 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstac3parse.c: + ac3parse: improve handling of dependent substream frames + In particular, timestamps of these should track main-stream timestamps. + +2011-01-21 14:53:39 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.c: + baseparse: tune default duration estimate update interval + Rather than a fixed default frame count, estimate frame count to aim for + an interval duration depending on fps if available, otherwise use old + fixed default. + +2011-01-14 15:16:04 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.c: + baseparse: reverse playback; mind keyframes for fragment boundary + +2011-01-13 15:26:21 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstamrparse.c: + amrparse: properly check for sufficient available data prior to access + +2011-01-12 14:40:37 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.c: + baseparse: ensure non-empty candidate frames + +2011-01-11 15:24:23 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.c: + baseparse: clarify some debug statements + +2011-01-11 15:24:02 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.c: + baseparse: properly track upstream timestamps + ... rather than with a delay. + +2011-01-11 15:23:29 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.c: + baseparse: need proper frame duration to obtain sensible frame bitrate + +2011-01-11 15:22:51 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.c: + baseparse: proper initial values for index tracking variables + +2011-01-11 12:05:13 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.c: + baseparse: arrange for consistent event handling + +2011-01-10 16:59:59 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.h: + baseparse: header style cleaning + +2011-01-10 17:07:38 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.c: + baseparse: provide some more initial frame metadata in parse_frame + ... and document accordingly. + +2011-01-10 16:56:36 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstaacparse.c: + * gst/audioparsers/gstbaseparse.c: + * gst/audioparsers/gstbaseparse.h: + * gst/audioparsers/gstflacparse.c: + baseparse: refactor passthrough into format flags + Also add a format flag to signal baseparse that subclass/format can provide + (parsed) timestamp rather than an estimated one. In particular, such "strong" + timestamp then allows to e.g. determine duration. + +2011-01-10 15:34:48 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstaacparse.c: + * gst/audioparsers/gstac3parse.c: + * gst/audioparsers/gstamrparse.c: + * gst/audioparsers/gstbaseparse.c: + * gst/audioparsers/gstbaseparse.h: + * gst/audioparsers/gstdcaparse.c: + * gst/audioparsers/gstflacparse.c: + * gst/audioparsers/gstmpegaudioparse.c: + baseparse: introduce a baseparse frame to serve as context + ... and adjust subclass parsers accordingly + +2011-01-07 16:39:51 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.c: + * gst/audioparsers/gstbaseparse.h: + baseparse: restrict duration scanning to pull mode and avoid extra set_caps call + +2011-01-07 15:58:49 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.c: + * gst/audioparsers/gstbaseparse.h: + baseparse: update some documentation + Also add some more debug. + +2011-01-06 11:41:44 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.c: + baseparse: allow increasing min_size for current frame parsing only + Also check that subclass actually either directs to skip bytes or + increases expected frame size to avoid going nowhere in bogus + indefinite looping. + +2011-01-14 15:26:37 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.c: + baesparse: fix refactor regression in loop based parsing + +2011-01-06 11:16:56 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.c: + baseparse: pass all available data to subclass rather than minimum + Also reduce some adapter calls and add a few debug statements. + +2010-12-10 15:59:49 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.c: + baseparse: fix reverse playback handling + +2010-12-10 14:56:13 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.c: + baseparse: minor typo and debug statement cleanup + +2010-12-10 14:40:05 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.c: + * gst/audioparsers/gstbaseparse.h: + baseparse: reduce locking + ... which is either already mute and/or implicitly handled by STREAM_LOCK. + +2011-01-27 17:32:49 +0100 Sebastian Dröge + + * sys/vdpau/gstvdpvideopostprocess.c: + * sys/vdpau/h264/gstvdph264dec.c: + vdpau: Initialize some variables to make gcc 4.6 happy + +2011-01-27 17:29:12 +0100 Sebastian Dröge + + * gst-libs/gst/video/gstbasevideodecoder.c: + basevideodecoder: Initialize some variables to make gcc 4.6 happy + +2011-01-26 18:45:56 +0000 Tim-Philipp Müller + + * ext/jp2k/gstjasperdec.c: + * ext/jp2k/gstjasperenc.c: + jp2kdec, jp2kenc: add support v308 (4:4:4 YUV) + Because we can. + +2011-01-26 14:27:21 -0300 Thiago Santos + + * tests/check/elements/camerabin2.c: + tests: camerabin2: Use the correct for limit + There are 3 taglists to be tested, not 2 + +2011-01-26 11:40:43 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + * gst/camerabin2/gstwrappercamerabinsrc.c: + camerabin2: Do not forget to unref some stuff + Cleanup properly by unrefing the encoding profile and preview caps + +2011-01-26 10:54:53 -0300 Thiago Santos + + * gst/camerabin2/camerabingeneral.c: + * gst/camerabin2/camerabingeneral.h: + * gst/camerabin2/gstimagecapturebin.c: + * gst/camerabin2/gstwrappercamerabinsrc.c: + camerabin2: Add names to some elements + Adds names to instances of some elements to make debugging easier + +2011-01-25 18:10:18 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + camerabin2: Handle videosink states more carefully + When going to ready, camerabin2 could create an empty file + if the videosink was put to ready. This patch only puts videosink + to ready on the PAUSED_TO_READY state change if it is on PAUSED + or PLAYING. + +2011-01-14 14:08:38 +0100 Mark Nauwelaerts + + * gst/audioparsers/gstbaseparse.c: + baseparse: avoid loop in frame locating interpolation + +2011-01-24 23:32:30 -0300 Thiago Santos + + * ext/rsvg/gstrsvgoverlay.c: + rsvgoverlay: Do not segfault on unexistent files + When passing an unexistent file to rsvgoverlay it would + crash because the svg loading would fail without setting + an error. + This patch makes it check if the handle was actually created + and logs an error in case it didn't. Maybe it should post an + error to the bus, but the previous error handling didn't, so + I just followed the same logic. + +2011-01-24 18:37:12 -0300 Thiago Santos + + * tests/examples/camerabin/gst-camerabin-test.c: + examples: camerabin: add timing printing for preview image + Measure and print the time taken to generate preview image. And + fix a typo + +2011-01-24 18:36:58 -0300 Thiago Santos + + * gst/camerabin2/gstwrappercamerabinsrc.c: + wrappercamerabinsrc: Remove unused macro + +2011-01-12 16:26:19 +0200 Lasse Laukkanen + + * tests/examples/camerabin/gst-camerabin-test.c: + examples: camerabin: Don't set default values for GstPhotography interface settings + Don't set any default values for source element GstPhotography interface + settings, source elements should have sane defaults themselves. + Also, setting scene-mode is tricky as it is a superset of other GstPhotography + settings. This might cause problem with defaults e.g. setting scene-mode to + 'night' may configure flash-mode as 'on' by definition, and after that + we don't want to override this flash-mode setting with gst-camerabin-test default + value. Moreover, user needs have an option to set scene mode first and then force + some individual setting to a different value from the scene-mode definition. + https://bugzilla.gnome.org/show_bug.cgi?id=639841 + +2011-01-24 17:46:49 -0300 Thiago Santos + + * gst/camerabin2/gstwrappercamerabinsrc.c: + wrappercamerabinsrc: Check the start time of buffers + Be careful when trying to create a newsegment event to avoid + start times of -1 from invalid buffer timestamps + +2011-01-11 15:52:03 +0000 Vincent Penquerc'h + + * gst/dvdspu/gstspu-vobsub-render.c: + dvdspu: don't write clipped lines to the output buffer + We may not increment the output pointer, but it'll still be just + off the end of the allocated area. + https://bugzilla.gnome.org/show_bug.cgi?id=602847 + +2011-01-19 15:07:25 -0300 Thiago Santos + + * gst/camerabin2/PORTING: + camerabin2: Update porting file + Adds porting information about using encodebin on camerabin2 + +2011-01-14 08:12:25 -0300 Thiago Santos + + * gst/camerabin2/PORTING: + * gst/camerabin2/gstcamerabin2.c: + * gst/camerabin2/gstimagecapturebin.c: + camerabin2: Add image-done message + Post an image-done message when a new image is saved to disk + +2011-01-11 14:50:48 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + * tests/check/Makefile.am: + * tests/check/elements/camerabin2.c: + camerabin2: Implement tagsetter interface + +2011-01-11 10:29:48 -0300 Thiago Santos + + * tests/check/elements/camerabin2.c: + tests: camerabin2: Add preview image to tests + Adds tests for checking that preview images are posted with + the correct caps on tests + +2011-01-11 09:12:24 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + * gst/camerabin2/gstcamerabin2.h: + camerabin2: Add a property to select the encoding profile + Adds a video-profile to allow selecting which encoding profile + to use for video recordings + +2011-01-11 08:44:41 -0300 Thiago Santos + + * gst/camerabin2/Makefile.am: + * gst/camerabin2/gstplugin.c: + * gst/camerabin2/gstvideorecordingbin.c: + * gst/camerabin2/gstvideorecordingbin.h: + * tests/check/Makefile.am: + * tests/check/elements/videorecordingbin.c: + camerabin2: Removing videorecordingbin + Removing videorecordingbin as we now use encodebin for it + +2010-12-27 11:29:42 -0300 Thiago Santos + + * gst/camerabin2/Makefile.am: + * gst/camerabin2/gstcamerabin2.c: + * gst/camerabin2/gstcamerabin2.h: + camerabin2: Move to encodebin + +2011-01-10 15:19:52 -0300 Thiago Santos + + * gst/camerabin2/gstwrappercamerabinsrc.c: + wrappercamerabinsrc: Set output-selector pad-negotiation-mode to none + Use output-selector none negotiation mode as it was the default before + the last changes. This likely needs to be fixed to use 'active' on + camerabin2 + +2011-01-10 15:19:04 -0300 Thiago Santos + + * gst/camerabin2/gstwrappercamerabinsrc.c: + wrappercamerabinsrc: Handle state change failures + When its internal element fails to change state, don't act as + if succeeded. + +2010-12-30 00:27:03 -0300 Thiago Santos + + * gst/camerabin2/gstcamerabin2.c: + * gst/camerabin2/gstcamerabin2.h: + * gst/camerabin2/gstwrappercamerabinsrc.c: + * gst/camerabin2/gstwrappercamerabinsrc.h: + camerabin2: Implement previewing + Implement previewing functionality using 2 properties. A boolean + (post-previews) that indicates if previews should be posted, and a + GstCaps (preview-caps) to provide the desired preview caps. + wrappercamerabinsrc implements previewing by supplying the captured + image to a pipeline to adapt it to the required caps before posting. + +2010-12-30 00:26:07 -0300 Thiago Santos + + * gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.h: + * gst/camerabin2/Makefile.am: + * gst/camerabin2/camerabingeneral.c: + * gst/camerabin2/camerabingeneral.h: + camerabin2: Add methods for preview image message posting + Adds a helper struct and functions for implementing a preview message + in camerabin2. + +2010-12-29 23:48:31 -0300 Thiago Santos + + * tests/check/elements/camerabin2.c: + camerabin2: tests: Use mainloops + Use mainloops instead of sleeps to read bus messages and catch + errors. + +2010-12-29 14:12:06 -0300 Thiago Santos + + * gst/camerabin2/gstwrappercamerabinsrc.c: + wrappercamerabinsrc: Use drop_eos function from camerabingeneral + There was already a event probe function for dropping EOS on + camerabingenereal, so use that instead of replicating the code + +2011-01-24 11:55:41 -0300 Thiago Santos + + * tests/check/elements/camerabin2.c: + * tests/check/elements/imagecapturebin.c: + tests: camerabin2: imagecapturebin2: fix warnings + Warnings passed me by on the last commits to camerabin2 tests, + fixing them. + +2011-01-24 11:05:41 -0300 Thiago Santos + + * tests/check/elements/camerabin2.c: + tests: camerabin2: Only run a test if -good 0.10.27 is present + A camerabin2 tests depends on the commit + dcbba0932dc579abd6aab4460fa1a416374eda1b for jpegenc on -good + that was released on 0.10.27. + This patch makes it check for this version before running the + test. + +2011-01-24 10:08:17 -0300 Thiago Santos + + * tests/check/elements/imagecapturebin.c: + tests: imagecapturebin: Only run a test if -good is 0.10.27 or newer + One test on imagecapturebin requires dcbba0932dc579abd6aab4460fa1a416374eda1b + on good that was released on 0.10.27. + https://bugzilla.gnome.org/show_bug.cgi?id=640286 + +2011-01-18 17:31:06 -0300 Thiago Santos + + * gst/camerabin/camerabingeneral.c: + * gst/camerabin/camerabingeneral.h: + * gst/camerabin/camerabinvideo.c: + * gst/camerabin/gstcamerabin.c: + camerabin: add names for more elements + +2011-01-24 11:18:29 +0000 Tim-Philipp Müller + + * configure.ac: + * docs/plugins/gst-plugins-bad-plugins.args: + * docs/plugins/gst-plugins-bad-plugins.hierarchy: + * docs/plugins/inspect/plugin-adpcmdec.xml: + * docs/plugins/inspect/plugin-adpcmenc.xml: + * docs/plugins/inspect/plugin-aiff.xml: + * docs/plugins/inspect/plugin-amrwbenc.xml: + * docs/plugins/inspect/plugin-apexsink.xml: + * docs/plugins/inspect/plugin-asfmux.xml: + * docs/plugins/inspect/plugin-assrender.xml: + * docs/plugins/inspect/plugin-audioparsersbad.xml: + * docs/plugins/inspect/plugin-autoconvert.xml: + * docs/plugins/inspect/plugin-bayer.xml: + * docs/plugins/inspect/plugin-bz2.xml: + * docs/plugins/inspect/plugin-camerabin.xml: + * docs/plugins/inspect/plugin-cdaudio.xml: + * docs/plugins/inspect/plugin-cdxaparse.xml: + * docs/plugins/inspect/plugin-celt.xml: + * docs/plugins/inspect/plugin-cog.xml: + * docs/plugins/inspect/plugin-coloreffects.xml: + * docs/plugins/inspect/plugin-colorspace.xml: + * docs/plugins/inspect/plugin-dataurisrc.xml: + * docs/plugins/inspect/plugin-dc1394.xml: + * docs/plugins/inspect/plugin-dccp.xml: + * docs/plugins/inspect/plugin-debugutilsbad.xml: + * docs/plugins/inspect/plugin-dfbvideosink.xml: + * docs/plugins/inspect/plugin-dirac.xml: + * docs/plugins/inspect/plugin-dtmf.xml: + * docs/plugins/inspect/plugin-dtsdec.xml: + * docs/plugins/inspect/plugin-dvb.xml: + * docs/plugins/inspect/plugin-dvbsuboverlay.xml: + * docs/plugins/inspect/plugin-dvdspu.xml: + * docs/plugins/inspect/plugin-faac.xml: + * docs/plugins/inspect/plugin-faad.xml: + * docs/plugins/inspect/plugin-fbdevsink.xml: + * docs/plugins/inspect/plugin-festival.xml: + * docs/plugins/inspect/plugin-freeze.xml: + * docs/plugins/inspect/plugin-frei0r.xml: + * docs/plugins/inspect/plugin-gaudieffects.xml: + * docs/plugins/inspect/plugin-geometrictransform.xml: + * docs/plugins/inspect/plugin-gsettings.xml: + * docs/plugins/inspect/plugin-gsm.xml: + * docs/plugins/inspect/plugin-gstsiren.xml: + * docs/plugins/inspect/plugin-h264parse.xml: + * docs/plugins/inspect/plugin-hdvparse.xml: + * docs/plugins/inspect/plugin-id3tag.xml: + * docs/plugins/inspect/plugin-interlace.xml: + * docs/plugins/inspect/plugin-invtelecine.xml: + * docs/plugins/inspect/plugin-ivfparse.xml: + * docs/plugins/inspect/plugin-jp2kdecimator.xml: + * docs/plugins/inspect/plugin-jpegformat.xml: + * docs/plugins/inspect/plugin-kate.xml: + * docs/plugins/inspect/plugin-ladspa.xml: + * docs/plugins/inspect/plugin-legacyresample.xml: + * docs/plugins/inspect/plugin-liveadder.xml: + * docs/plugins/inspect/plugin-mimic.xml: + * docs/plugins/inspect/plugin-mms.xml: + * docs/plugins/inspect/plugin-modplug.xml: + * docs/plugins/inspect/plugin-mpeg2enc.xml: + * docs/plugins/inspect/plugin-mpeg4videoparse.xml: + * docs/plugins/inspect/plugin-mpegdemux2.xml: + * docs/plugins/inspect/plugin-mpegpsmux.xml: + * docs/plugins/inspect/plugin-mpegtsmux.xml: + * docs/plugins/inspect/plugin-mpegvideoparse.xml: + * docs/plugins/inspect/plugin-mplex.xml: + * docs/plugins/inspect/plugin-musepack.xml: + * docs/plugins/inspect/plugin-musicbrainz.xml: + * docs/plugins/inspect/plugin-mve.xml: + * docs/plugins/inspect/plugin-mxf.xml: + * docs/plugins/inspect/plugin-mythtv.xml: + * docs/plugins/inspect/plugin-nas.xml: + * docs/plugins/inspect/plugin-neon.xml: + * docs/plugins/inspect/plugin-nsf.xml: + * docs/plugins/inspect/plugin-nuvdemux.xml: + * docs/plugins/inspect/plugin-ofa.xml: + * docs/plugins/inspect/plugin-opencv.xml: + * docs/plugins/inspect/plugin-pcapparse.xml: + * docs/plugins/inspect/plugin-pnm.xml: + * docs/plugins/inspect/plugin-qtmux.xml: + * docs/plugins/inspect/plugin-rawparse.xml: + * docs/plugins/inspect/plugin-real.xml: + * docs/plugins/inspect/plugin-resindvd.xml: + * docs/plugins/inspect/plugin-rfbsrc.xml: + * docs/plugins/inspect/plugin-rsvg.xml: + * docs/plugins/inspect/plugin-rtpmux.xml: + * docs/plugins/inspect/plugin-scaletempo.xml: + * docs/plugins/inspect/plugin-schro.xml: + * docs/plugins/inspect/plugin-sdl.xml: + * docs/plugins/inspect/plugin-sdp.xml: + * docs/plugins/inspect/plugin-segmentclip.xml: + * docs/plugins/inspect/plugin-shm.xml: + * docs/plugins/inspect/plugin-sndfile.xml: + * docs/plugins/inspect/plugin-soundtouch.xml: + * docs/plugins/inspect/plugin-speed.xml: + * docs/plugins/inspect/plugin-stereo.xml: + * docs/plugins/inspect/plugin-subenc.xml: + * docs/plugins/inspect/plugin-tta.xml: + * docs/plugins/inspect/plugin-vcdsrc.xml: + * docs/plugins/inspect/plugin-vdpau.xml: + * docs/plugins/inspect/plugin-videomaxrate.xml: + * docs/plugins/inspect/plugin-videomeasure.xml: + * docs/plugins/inspect/plugin-videosignal.xml: + * docs/plugins/inspect/plugin-vmnc.xml: + * docs/plugins/inspect/plugin-vp8.xml: + * docs/plugins/inspect/plugin-wildmidi.xml: + * docs/plugins/inspect/plugin-xvid.xml: + * docs/plugins/inspect/plugin-y4mdec.xml: + * docs/plugins/inspect/plugin-zbar.xml: + * win32/common/config.h: + Back to development + +=== release 0.10.21 === + +2011-01-21 21:13:22 +0000 Tim-Philipp Müller + + * ChangeLog: + * NEWS: + * RELEASE: + * configure.ac: + * docs/plugins/gst-plugins-bad-plugins.args: + * docs/plugins/inspect/plugin-adpcmdec.xml: + * docs/plugins/inspect/plugin-adpcmenc.xml: + * docs/plugins/inspect/plugin-aiff.xml: + * docs/plugins/inspect/plugin-amrwbenc.xml: + * docs/plugins/inspect/plugin-apexsink.xml: + * docs/plugins/inspect/plugin-asfmux.xml: + * docs/plugins/inspect/plugin-assrender.xml: + * docs/plugins/inspect/plugin-audioparsersbad.xml: + * docs/plugins/inspect/plugin-autoconvert.xml: + * docs/plugins/inspect/plugin-bayer.xml: + * docs/plugins/inspect/plugin-bz2.xml: + * docs/plugins/inspect/plugin-camerabin.xml: + * docs/plugins/inspect/plugin-cdaudio.xml: + * docs/plugins/inspect/plugin-cdxaparse.xml: + * docs/plugins/inspect/plugin-celt.xml: + * docs/plugins/inspect/plugin-cog.xml: + * docs/plugins/inspect/plugin-coloreffects.xml: + * docs/plugins/inspect/plugin-colorspace.xml: + * docs/plugins/inspect/plugin-dataurisrc.xml: + * docs/plugins/inspect/plugin-dc1394.xml: + * docs/plugins/inspect/plugin-dccp.xml: + * docs/plugins/inspect/plugin-debugutilsbad.xml: + * docs/plugins/inspect/plugin-dfbvideosink.xml: + * docs/plugins/inspect/plugin-dirac.xml: + * docs/plugins/inspect/plugin-dtmf.xml: + * docs/plugins/inspect/plugin-dtsdec.xml: + * docs/plugins/inspect/plugin-dvb.xml: + * docs/plugins/inspect/plugin-dvbsuboverlay.xml: + * docs/plugins/inspect/plugin-dvdspu.xml: + * docs/plugins/inspect/plugin-faac.xml: + * docs/plugins/inspect/plugin-faad.xml: + * docs/plugins/inspect/plugin-fbdevsink.xml: + * docs/plugins/inspect/plugin-festival.xml: + * docs/plugins/inspect/plugin-freeze.xml: + * docs/plugins/inspect/plugin-frei0r.xml: + * docs/plugins/inspect/plugin-gaudieffects.xml: + * docs/plugins/inspect/plugin-geometrictransform.xml: + * docs/plugins/inspect/plugin-gsettings.xml: + * docs/plugins/inspect/plugin-gsm.xml: + * docs/plugins/inspect/plugin-gstsiren.xml: + * docs/plugins/inspect/plugin-h264parse.xml: + * docs/plugins/inspect/plugin-hdvparse.xml: + * docs/plugins/inspect/plugin-id3tag.xml: + * docs/plugins/inspect/plugin-interlace.xml: + * docs/plugins/inspect/plugin-invtelecine.xml: + * docs/plugins/inspect/plugin-ivfparse.xml: + * docs/plugins/inspect/plugin-jp2kdecimator.xml: + * docs/plugins/inspect/plugin-jpegformat.xml: + * docs/plugins/inspect/plugin-kate.xml: + * docs/plugins/inspect/plugin-ladspa.xml: + * docs/plugins/inspect/plugin-legacyresample.xml: + * docs/plugins/inspect/plugin-liveadder.xml: + * docs/plugins/inspect/plugin-mimic.xml: + * docs/plugins/inspect/plugin-mms.xml: + * docs/plugins/inspect/plugin-modplug.xml: + * docs/plugins/inspect/plugin-mpeg2enc.xml: + * docs/plugins/inspect/plugin-mpeg4videoparse.xml: + * docs/plugins/inspect/plugin-mpegdemux2.xml: + * docs/plugins/inspect/plugin-mpegpsmux.xml: + * docs/plugins/inspect/plugin-mpegtsmux.xml: + * docs/plugins/inspect/plugin-mpegvideoparse.xml: + * docs/plugins/inspect/plugin-mplex.xml: + * docs/plugins/inspect/plugin-musepack.xml: + * docs/plugins/inspect/plugin-musicbrainz.xml: + * docs/plugins/inspect/plugin-mve.xml: + * docs/plugins/inspect/plugin-mxf.xml: + * docs/plugins/inspect/plugin-mythtv.xml: + * docs/plugins/inspect/plugin-nas.xml: + * docs/plugins/inspect/plugin-neon.xml: + * docs/plugins/inspect/plugin-nsf.xml: + * docs/plugins/inspect/plugin-nuvdemux.xml: + * docs/plugins/inspect/plugin-ofa.xml: + * docs/plugins/inspect/plugin-opencv.xml: + * docs/plugins/inspect/plugin-pcapparse.xml: + * docs/plugins/inspect/plugin-pnm.xml: + * docs/plugins/inspect/plugin-qtmux.xml: + * docs/plugins/inspect/plugin-rawparse.xml: + * docs/plugins/inspect/plugin-real.xml: + * docs/plugins/inspect/plugin-resindvd.xml: + * docs/plugins/inspect/plugin-rfbsrc.xml: + * docs/plugins/inspect/plugin-rsvg.xml: + * docs/plugins/inspect/plugin-rtpmux.xml: + * docs/plugins/inspect/plugin-scaletempo.xml: + * docs/plugins/inspect/plugin-schro.xml: + * docs/plugins/inspect/plugin-sdl.xml: + * docs/plugins/inspect/plugin-sdp.xml: + * docs/plugins/inspect/plugin-segmentclip.xml: + * docs/plugins/inspect/plugin-shm.xml: + * docs/plugins/inspect/plugin-sndfile.xml: + * docs/plugins/inspect/plugin-soundtouch.xml: + * docs/plugins/inspect/plugin-speed.xml: + * docs/plugins/inspect/plugin-stereo.xml: + * docs/plugins/inspect/plugin-subenc.xml: + * docs/plugins/inspect/plugin-tta.xml: + * docs/plugins/inspect/plugin-vcdsrc.xml: + * docs/plugins/inspect/plugin-vdpau.xml: + * docs/plugins/inspect/plugin-videomaxrate.xml: + * docs/plugins/inspect/plugin-videomeasure.xml: + * docs/plugins/inspect/plugin-videosignal.xml: + * docs/plugins/inspect/plugin-vmnc.xml: + * docs/plugins/inspect/plugin-vp8.xml: + * docs/plugins/inspect/plugin-wildmidi.xml: + * docs/plugins/inspect/plugin-xvid.xml: + * docs/plugins/inspect/plugin-y4mdec.xml: + * docs/plugins/inspect/plugin-zbar.xml: + * gst-plugins-bad.doap: + * win32/common/config.h: + Release 0.10.21 2011-01-19 20:00:13 -0800 David Schleef diff --git a/Makefile.am b/Makefile.am index aaa72137dc..55670a3ddb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -49,16 +49,21 @@ CRUFT_FILES = \ $(top_builddir)/ext/jack/.libs/*.{so,dll,DLL,dylib} \ $(top_builddir)/gst/aacparse/.libs/*.{so,dll,DLL,dylib} \ $(top_builddir)/gst/amrparse/.libs/*.{so,dll,DLL,dylib} \ + $(top_builddir)/gst/audioparsers/.libs/*.{so,dll,DLL,dylib} \ $(top_builddir)/gst/flacparse/.libs/*.{so,dll,DLL,dylib} \ $(top_builddir)/gst/imagefreeze/.libs/*.{so,dll,DLL,dylib} \ + $(top_builddir)/gst/qtmux/.libs/*.{so,dll,DLL,dylib} \ $(top_builddir)/gst/selector/.libs/*.{so,dll,DLL,dylib} \ $(top_builddir)/gst/shapewipe/.libs/*.{so,dll,DLL,dylib} \ $(top_builddir)/gst/valve/.libs/*.{so,dll,DLL,dylib} \ $(top_builddir)/gst/videoparsers/.libs/libgsth263parse* \ + $(top_builddir)/gst-libs/gst/baseparse/.libs/libgstbaseparse* \ $(top_builddir)/sys/oss4/.libs/*.{so,dll,DLL,dylib} \ + $(top_builddir)/tests/check/elements/{aac,ac3,amr,flac,mpegaudio,dca}parse \ $(top_builddir)/tests/check/elements/autocolorspace \ $(top_builddir)/tests/check/elements/capssetter \ $(top_builddir)/tests/check/elements/imagefreeze \ + $(top_builddir)/tests/check/elements/qtmux \ $(top_builddir)/tests/check/elements/selector \ $(top_builddir)/tests/check/elements/valve \ $(top_builddir)/tests/check/pipelines/metadata \ @@ -73,16 +78,22 @@ CRUFT_DIRS = \ $(top_srcdir)/gst/amrparse \ $(top_srcdir)/gst/flacparse \ $(top_srcdir)/gst/imagefreeze \ + $(top_srcdir)/gst/invtelecine \ + $(top_srcdir)/gst/qtmux \ $(top_srcdir)/gst/selector \ $(top_srcdir)/gst/shapewipe \ $(top_srcdir)/gst/valve \ + $(top_srcdir)/gst-libs/gst/baseparse \ $(top_srcdir)/tests/examples/shapewipe \ $(top_srcdir)/tests/examples/switch \ $(top_srcdir)/tests/examples/jack \ $(top_srcdir)/ext/alsaspdif \ + $(top_srcdir)/ext/amrwbenc \ $(top_srcdir)/ext/ivorbis \ $(top_srcdir)/ext/jack \ - $(top_srcdir)/ext/metadata + $(top_srcdir)/ext/metadata \ + $(top_srcdir)/ext/tarkin \ + $(top_srcdir)/ext/theora include $(top_srcdir)/common/cruft.mak diff --git a/NEWS b/NEWS index 65ed416fde..eb2c12f23c 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,149 @@ -This is GStreamer Bad Plug-ins 0.10.21, "Pink Noise" +This is GStreamer Bad Plug-ins 0.10.22, "Toy Piano" + +Changes since 0.10.21: + + * aiffparse: add support for 32 bit and 64 bit floating point formats + * aiffparse: the SSND header is 16 bytes large, not 8 + 16 bytes + * assrender: refactor blitting, avoid writing past end of buffer + * camerabin2: Add a property to select the encoding profile + * camerabin2: Add custom filter properties + * camerabin2: Add image-done message + * camerabin2: Adding audio support for video recordings + * camerabin2: Adding properties for image capture settings + * camerabin2: Add methods for preview image message posting + * camerabin2: Add preview-filter property + * camerabin2: Adds new idle property + * camerabin2: Add viewfinder caps related properties + * camerabin2: Add viewfinder-sink property + * camerabin2: Implement previewing + * camerabin2: Implement tagsetter interface + * camerabin2: Move preview helper functions to basecamerabinsrc + * camerabin2: Move to encodebin + * camerabin2: Moving preview image properties to basecamerasrc + * camerabin: adding audio related properties + * camerabin: Always take photo when preview-caps is set + * camerabin: don't rely on the application running the default GLib main loop + * camerabin: Events with select-all in input-selector + * camerabin: Fix corner case for preview posting + * camerabin: Use running time for muxing + * celtenc: Fix compilation with celt >= 0.11.0 + * colorspace: add 16-bit-per-channel handling + * colorspace: add dithering, add support for r210 and fix YUV->RGB matrixing + * curlsink: add libcurl-based sink element + * decklink: Add decklink plugin + * directdrawsink: avoid aspect-ratio borders overlying other windows + * directdrawsink: avoid rendering to invalid area + * dshowvideosink: update for latest GstXOverlay changes + * dvbsuboverlay: Fix using alpha values in blitting + * dvdspu: don't write clipped lines to the output buffer + * dvdsubdec: make up clut values if they weren't set + * fieldanalysis: new fieldanalysis element + * fpsdisplaysink: add "silent" property, fix "sync" property default value + * fpsdisplaysink: add "frames-dropped" and "frames-rendered" properties + * fpsdisplaysink: add "last-message" property and never print anything to stdout + * gme: fix infinite looping by fading out after two loops + * h263parse: add an h263parse element + * hlsdemux: Add HTTP live streaming parser/demuxer element + * id3mux: map new GST_TAG_ENCODED_BY to ID3v2 TENC frame + * jifmux: Add GstTagXmpWriter support + * jp2kdec, jp2kenc: add support v308 (4:4:4 YUV) + * jp2kdec: post proper error when the image's colour space is not supported + * jpegparse: misc. fixes + * linsys: Add plugin for Linear Systems SDI boards + * logoinsert: add "data" property; fix memleaks + * mpegtsdemux: new (not-yet autoplugged) MPEG TS demuxer rewrite + * mpegtsmux: add byte-stream to h264 template pad caps + * mpegtsmux: don't error out if downstream fails to handle the newsegment event + * mpegtspacketizer: Handle all ISO8859-x encodings in get_encoding() + * opencv: make work with openCV 2.2 + * patchdetect: new element + * rsvgoverlay: allow negative values for x/y/width/height + * rsvgoverlay: implement x/y/width/height (absolute and relative) positioning and dimensioning + * rtpvp8: Add simple payloaders and depayloaders for VP8 + * scenechange: new scene change detection element + * sdi: Add raw SDI muxing/demuxing elements + * shm: Allow ShmPipe to save a data pointer for applications + * shm: Keep the ShmPipe alive as long as there are blocks left + * shm: Make default perm u+rw g+r for shm area + * shmsink: ensure gst_poll_wait is called first on descriptors + * shmsink: Keep shmsink referenced while there are still buffers around + * shmsrc: Keep GstPoll for whole src lifetime + * shmsrc: Only connect to sink in PLAYING in live mode + * vdpau: fixup GstFlowReturn handling + * vdpausink: fix bug where we didn't setup vdpau on a user set window + * videoparsers: new h263parse element + * videoparsers: baseparse-based dirac parser, new baseparse-based h264parse + * xvidenc: proxy downstream caps restrictions upstream via get_caps() + * zebrastripe: New element + +Bugs fixed since 0.10.21: + + * 646211 : [camerabin] state changes need to be made when recording a video + * 608786 : [mpegtsmux] Internal H.264 byte-stream wrapping isn't working correctly + * 334107 : xviddec: segmentation fault after a few frames + * 582167 : jacksink does not flush the jack port when going to READY + * 586848 : qtmux, asfmux: remuxing streams with different start times + * 591651 : dvbsrc: use better nicks for GstDvbSrcModulation and other enums + * 594035 : [hlsdemux] Add HTTP Live Streaming playback support + * 594280 : directdrawsink: avoid rendering to invalid area + * 602847 : [dvdspu] Segfaults on seeking in matroska file + * 611061 : [mpegtsmux] some buffers are forgotten to push in m2ts_mode + * 615655 : [camerabin] shouldn't rely on running GLib main loop + * 616814 : Photography interface extension: colour tone mode and noise reduction settings + * 617532 : [qtmux] Take into account new-segments for incoming streams + * 622276 : Add an h263parse element + * 626618 : jpegparse doesn't handle APP12 marker + * 632056 : Directdrawsink draws black stripes over the overlying dialog windows. + * 639502 : [camerabin] should not re-create preview pipeline when setting new preview caps + * 639763 : [dvbsuboverlay] Green borders around subtitles + * 639841 : examples: camerabin: Don't set default values for GstPhotography interface settings + * 640286 : elements/imagecapturebin check fails + * 640287 : camerabin2 checks fail + * 640327 : Add VP8 RTP payloaders and depayloaders + * 640561 : opencv textwrite element renaming and proper structuring: + * 640637 : Camerabin has warning: Internal GStreamer error: clock problem. + * 640885 : Permission problems building bad + * 641047 : [mpegaudioparse] Multiple issues with new mpegaudioparse element from -bad, lower rank? + * 641178 : rtpvp8: build problem, needs to link with libgstbase-0.10 + * 641496 : New plugin: curlsink + * 641530 : Camerabin should capture image if preview_caps is set even if filename is not set + * 641712 : XWindow is never created in gst-camerabin-test example application + * 641796 : opencv: make plugin work with opencv 2.2.0 release + * 641857 : baseparse: Update min/max bitrate before first posting them + * 641858 : mpegaudioparse: Post CBR bitrate as nominal bitrate + * 642116 : rsvgoverlay: add position/dimension parameters + * 642658 : rsvgoverlay: allow negative values for position/dimension parameters + * 642671 : fieldanalysis: New element for analysing video input to produce progressive output + * 643469 : fpsdisplaysink: add frames-dropped and frames-rendered properties + * 643471 : fpsdisplaysink: fix default sync property value + * 643607 : [celt] Doesn't compile with celt 0.11.1 + * 644176 : videofilters: needs to link against libm + * 644208 : dcaparse: add depth and endianness to dts caps to allow elements to negotiate on these certain stream format requirements + * 644429 : [mpegtsmux] in m2ts-mode, the tp_extra_header is incorrect + * 645006 : [mpegtsmux] in m2ts-mode, PAT is written only once + * 645053 : shm: multiple compile failures on Solaris 10 + * 645412 : [h264parse] h264parse doesn't set framed=True on src caps + * 645420 : [scaletempo] Incorrectly handles new segments with stop == -1 + * 645502 : [h264parse] leaks fatally on certain streams + * 645568 : aiffparse: doesn't play 24-bit AIFF properly + * 645711 : patchdetect: link error while using gcc-4.52 + * 646256 : qtmux " buffer without timestamp/duration " error message could be more helpful + * 646495 : hlsdemux: Add missing patches from my local branch + * 646840 : shmsink: ensure gst_poll_wait is the first gst_poll function called on a descriptor + * 646955 : dshowvideosink: Update to reflect latest GstXOverlay changes + * 647030 : [fpsdisplaysink] " silent " property + * 647364 : VGM files loop indefinately + * 647498 : xvidenc not forwarding caps + * 647564 : gst-plugins-bad configure.ac summary wrongly claims an exif plugin + * 647830 : assrender: crashes with very large subtitles + * 647852 : [schroenc] Crashes after some time when getting buffers after EOS + * 647853 : [schrodec] Impossible to play very short files + * 647854 : [schrodec] Allocates buffers with NULL caps from downstream + * 648001 : configure: Fix linsys/decklink checks for Linux + * 648929 : [tsdemux] Memory leaks everywhere + * 649005 : y4mdec: add plugin description + * 647751 : [hlsdemux] Fix usage of the element in players + * 621027 : mpegtsparse problem when parsing EIT and obtaining Transport Stream packet size Changes since 0.10.20: diff --git a/RELEASE b/RELEASE index f35e3d6374..32685ce52a 100644 --- a/RELEASE +++ b/RELEASE @@ -1,5 +1,5 @@ -Release notes for GStreamer Bad Plug-ins 0.10.21 "Pink Noise" +Release notes for GStreamer Bad Plug-ins 0.10.22 "Toy Piano" @@ -60,195 +60,148 @@ contains a set of well-supported plug-ins, but might pose problems for Features of this release - * alsaspdif: removed alsaspdifsink element (replaced by alsasink device=spdif) - * metadata: remove metadata plugin - * jack: jack plugin has moved to gst-plugins-good (0.10.27) - * selector: input-selector and output-selector have moved to GStreamer core (0.10.32) - * valve: has moved to gstreamer core (0.10.32) - * applemedia: new plugin for Apple multimedia APIs (avfvideosrc, celvideosrc, qtkitvideosrc, miovideosrc, vth264decbin, vth264encbin, vtdec, vtenc) - * applemedia: new iOS video source based on AVFoundation - * y4mdec: new y4mdec element - * dcaparse: new dts/dca audio parser - * camerabin2: new camerabin element (work-in-progress, experimental) - * opencv: new plugin with elements facedetect, faceblur, edgedetect, cvsobel, cvsmooth, cvlaplace, cverode, cvequalizehist, cvdilate, textwrite, templatematch, pyramidsegment - * interlace: new element - * geometrictransform: new rotate element - * jp2kdecimator: add a JPEG2000 decimator element (drop details without reencoding) - * audioparsers: add dcaparse, a dts/dca parser, and mpegaudioparse (mp3parse replacement) - * autoconvert: add autovideoconvert, an autoconvert based video format converter - * checksumsink, chopmydata: new debug elements - * dvbsuboverlay: new element to overlay DVB subtitle - * rsvgoverlay: new element for scalable and relative svg overlay with cairo - * qtmux: add new ismlmux element, for fragmented isml major brand - * ac3parse: properly parse E-AC3 frame header and use proper EAC-3 caps - * ac3parse: relax BSID checking, performance improvements - * applemedia mtapi: update to reflect new API on iOS 4.x - * applemedia vtenc: bump H.264 level from 1.3 to 3.0 - * applemedia vtenc: remove keyframe enforcement workaround - * applemedia celapi: update to reflect new API on iOS 4.x - * applemedia cvapi: add wrapper for IO surface access - * audioparse: add support for setting the channel-positions - * audioparsers: increase ranks to enable auto-plugging (incl. new mp3 parser) - * baseparse: enhancements for timestamp marked framed formats - * baseparse: increase keyframe awareness - * baseparse: perform bitrate handling and posting after newsegment sending - * baseparse: post duration message if average bitrates is updated - * baseparse: prevent indefinite resyncing - * baseparse: add index support, seek table and accurate seek support - * baseparse: support reverse playback - * baseparse: use determined seekability in answering SEEKING query - * basevideo: Add handling of GstForceKeyUnit events - * basevideodecoder: add capture pattern handling; don't blow away field information - * bayer2rgb: add format=bggr/etc. to caps, add framerate to the sink caps - * camerabin: add "preview-source-filter","ready-for-capture", "idle" properties - * camerabin: change "zoom" property from int to float - * camerabin: enable all conversion flags by default to make it work out-of-the-box everywhere - * coloreffects: Add chromahold effect - * cog: improvements in colorspace and scaler; add fast paths for colorspace conversion - * colorspace: revive element and add support for many more pixellayouts/colorspaces - * colorspace: add support for SDTV/HDTV YUV conversions - * dtmfsrc: Make the dtmfsrc accept events sent with gst_element_send_event - * tools: misc. improvements to element-maker tool - * faac: handle trailing encoder output - * faad: support reverse playback; cater for decoder delay and renegotiation - * faad: tweak output buffer timestamping - * flacparse: don't drop the last frame if it is followed by garbage - * flacparse: don't parse the complete FLAC frames but only look for valid frame headers (for performance) - * flacparse: fix picture parsing, fix parsing with unknown framesizes - * flacparse: parse seektable - * frei0r: add support for the FREI0R_PATH environment variable - * frei0r: fix crashes if plugins don't provide correct property information - * frei0r: fix scanning of plugin subdirectories and support different vendors - * frei0r: update frei0r interface specification to 1.2 - * gaudieffects: avoid divide by 0 in burn element, make filter parameters dynamic and controllable - * id3mux: map GST_TAG_ALBUM_ARTIST, give PRIMARY rank - * invtelecine: Fix name of 30p/60i pattern - * jasperdec: don't fail hard on decoding error - * jifmux: detect EOI correctly; do not limit the size of the image on 16bits - * jp2kenc: Emit SOP markers in every codestream packet - * jpegparse: avoid infinite loop when resyncing; discard incomplete image - * kate: add segment tracking, and various other improvements - * kate: ensure the kate pad does not shoot ahead of the video pad - * mpegtsdemux: extract language for DVB subtitle streams - * mpegtsdemux: enable gather_pes only for DVB subtitle private streams - * mpegtsdemux: fix re-syncing on invalid data after seek - * mpegtsmux: Initialize PES packet before getting the header size - * mpegtsmux: Set adaptation flag when appropriate - * mpegtsmux: Set random_access_indicator for keyframes - * mpegtsparse: send TDT tables messages in a serialized event downstream - * ofa: Call g_object_notify() after the fingerprint was created - * pcapparse: Add support for Linux Cooked Capture (SLL) frames - * photography: add missing property and cabability flag for noise reduction - * photography: Add "zoom" and "image-preview-supported-caps" interface properties - * photography: add gst_photography_{set,get}_noise_reduction() and CAPS_NOISE_REDUCTION flag - * qtmux: add support for fragmented mp4 - * qtmux: add "streamable" property to avoid building fragmented mfra index - * qtmux: timestamp tracking fixes and many other fixes - * resindvd: attempt to use glib language setting for DVD menus/audio - * resindvd: improve error messages on read errors; button state tracking fixes - * rfbsrc: fail more gracefully if source gets disconnected or geometry changes - * sdlvideosink: re-enable YVYU and UYVY support - * sdpdemux: error out if no streams found in sdp message - * sdpdemux: redirect SDP with an rtsp control URL and add property to disable redirect - * ssim: add I420 support - * tiger: outline text by default, to make it easier to read - * winks: add property probing support; fix framerate fraction range mapping - * winks: ignore unsupported formats; work around shutdown deadlock - * winks: performance improvements - * zbar: make scanner cache optional, disable it by default - * zbar: use correct strides, support more formats + * aiffparse: add support for 32 bit and 64 bit floating point formats + * aiffparse: the SSND header is 16 bytes large, not 8 + 16 bytes + * assrender: refactor blitting, avoid writing past end of buffer + * camerabin2: Add a property to select the encoding profile + * camerabin2: Add custom filter properties + * camerabin2: Add image-done message + * camerabin2: Adding audio support for video recordings + * camerabin2: Adding properties for image capture settings + * camerabin2: Add methods for preview image message posting + * camerabin2: Add preview-filter property + * camerabin2: Adds new idle property + * camerabin2: Add viewfinder caps related properties + * camerabin2: Add viewfinder-sink property + * camerabin2: Implement previewing + * camerabin2: Implement tagsetter interface + * camerabin2: Move preview helper functions to basecamerabinsrc + * camerabin2: Move to encodebin + * camerabin2: Moving preview image properties to basecamerasrc + * camerabin: adding audio related properties + * camerabin: Always take photo when preview-caps is set + * camerabin: don't rely on the application running the default GLib main loop + * camerabin: Events with select-all in input-selector + * camerabin: Fix corner case for preview posting + * camerabin: Use running time for muxing + * celtenc: Fix compilation with celt >= 0.11.0 + * colorspace: add 16-bit-per-channel handling + * colorspace: add dithering, add support for r210 and fix YUV->RGB matrixing + * curlsink: add libcurl-based sink element + * decklink: Add decklink plugin + * directdrawsink: avoid aspect-ratio borders overlying other windows + * directdrawsink: avoid rendering to invalid area + * dshowvideosink: update for latest GstXOverlay changes + * dvbsuboverlay: Fix using alpha values in blitting + * dvdspu: don't write clipped lines to the output buffer + * dvdsubdec: make up clut values if they weren't set + * fieldanalysis: new fieldanalysis element + * fpsdisplaysink: add "silent" property, fix "sync" property default value + * fpsdisplaysink: add "frames-dropped" and "frames-rendered" properties + * fpsdisplaysink: add "last-message" property and never print anything to stdout + * gme: fix infinite looping by fading out after two loops + * h263parse: add an h263parse element + * hlsdemux: Add HTTP live streaming parser/demuxer element + * id3mux: map new GST_TAG_ENCODED_BY to ID3v2 TENC frame + * jifmux: Add GstTagXmpWriter support + * jp2kdec, jp2kenc: add support v308 (4:4:4 YUV) + * jp2kdec: post proper error when the image's colour space is not supported + * jpegparse: misc. fixes + * linsys: Add plugin for Linear Systems SDI boards + * logoinsert: add "data" property; fix memleaks + * mpegtsdemux: new (not-yet autoplugged) MPEG TS demuxer rewrite + * mpegtsmux: add byte-stream to h264 template pad caps + * mpegtsmux: don't error out if downstream fails to handle the newsegment event + * mpegtspacketizer: Handle all ISO8859-x encodings in get_encoding() + * opencv: make work with openCV 2.2 + * patchdetect: new element + * rsvgoverlay: allow negative values for x/y/width/height + * rsvgoverlay: implement x/y/width/height (absolute and relative) positioning and dimensioning + * rtpvp8: Add simple payloaders and depayloaders for VP8 + * scenechange: new scene change detection element + * sdi: Add raw SDI muxing/demuxing elements + * shm: Allow ShmPipe to save a data pointer for applications + * shm: Keep the ShmPipe alive as long as there are blocks left + * shm: Make default perm u+rw g+r for shm area + * shmsink: ensure gst_poll_wait is called first on descriptors + * shmsink: Keep shmsink referenced while there are still buffers around + * shmsrc: Keep GstPoll for whole src lifetime + * shmsrc: Only connect to sink in PLAYING in live mode + * vdpau: fixup GstFlowReturn handling + * vdpausink: fix bug where we didn't setup vdpau on a user set window + * videoparsers: new h263parse element + * videoparsers: baseparse-based dirac parser, new baseparse-based h264parse + * xvidenc: proxy downstream caps restrictions upstream via get_caps() + * zebrastripe: New element Bugs fixed in this release - * 628609 : The qtwrapperaudiodec_samr decoder doesn't handle buffers containing many AMR frames properly - * 639296 : [y4mdec] Doesn't handle files which don't specify a colorspace - * 613379 : camerabin: Do not use audio clock after stopping video capture - * 636279 : REGRESSION: Video often freezes during playback of mpeg2 files - * 630255 : [examples] camerabin example still uses old GstXOverlay interface - * 631232 : [colorspace] AYUV/ARGB handling broken on big endian systems - * 627229 : fpsdisplaysink should not measure fps relative to pipeline clock - * 435120 : cairosvgoverlay - * 486659 : xmp/exif metadata handling - * 578629 : libgstphotography missing exports for MSVC - * 587223 : mpegtsdemux seg.fault due to invalid PMT_pid - * 598078 : osxvideosrc doesn't build in snow leopard x86_64 - * 600929 : [kate] tiger element doesn't handle segments and text/video synchronization properly - * 603063 : camerabin example fails to start recording - * 611428 : [gdiscreencapsrc] leaks memory (ICONINFO) - * 613633 : [resindvd] scrambled DVDs yield useless generic error message if dvdcss is not available + * 646211 : [camerabin] state changes need to be made when recording a video + * 608786 : [mpegtsmux] Internal H.264 byte-stream wrapping isn't working correctly + * 334107 : xviddec: segmentation fault after a few frames + * 582167 : jacksink does not flush the jack port when going to READY + * 586848 : qtmux, asfmux: remuxing streams with different start times + * 591651 : dvbsrc: use better nicks for GstDvbSrcModulation and other enums + * 594035 : [hlsdemux] Add HTTP Live Streaming playback support + * 594280 : directdrawsink: avoid rendering to invalid area + * 602847 : [dvdspu] Segfaults on seeking in matroska file + * 611061 : [mpegtsmux] some buffers are forgotten to push in m2ts_mode + * 615655 : [camerabin] shouldn't rely on running GLib main loop * 616814 : Photography interface extension: colour tone mode and noise reduction settings - * 616923 : camerabin: remove photography interface implementation - * 618045 : [cogcolorspace] No Y41B support - * 618542 : DVB subtitles support - * 625558 : [basevideoencoder] [vp8] encoder timestamps are wrong when there are gaps - * 626425 : cog_virt_frame_new_convert_u8 has bogus source data - * 627134 : photography interface: add API for capture correction - * 627211 : jpegformat: Push tags after setting srcpad caps - * 627253 : [mpegtsparse] Post tags of channel and currently running event - * 627992 : dtmfsrc doesn't support gst_element_send_event - * 628326 : vdpau: don't change structure in setcaps function - * 628527 : videoanalyse: classificication is wrong - * 628548 : [mpegtsmux] Initialize PES packet before getting the header size - * 628570 : cogcolorspace: element classificication is wrong - * 629554 : dvbsrc: Fix example usage, bandwidth=8 not 8MHz - * 629897 : [cog] Ignores --disable-orc and always requires orc - * 629910 : jpegparse: properly clean up comment string - * 629917 : [output-selector] Recheck pending_pad after pushing a buffer - * 630046 : sdpdemux: Add optional support for rtspsrc as session element - * 630253 : [sdl] Still uses old GstXOverlay interface - * 630254 : [vdpau] Still uses old GstXOverlay interface - * 630783 : [frei0r] Crashes if broken plugins don't give correct property information - * 630808 : valve: move to core - * 631200 : flacparse: major performance improvements - * 631389 : [flacparse] backport/check corner case fixes done in flacdec - * 631449 : [audioparse] doest not support several channel numbers - * 631501 : [faad] failed to dynamically switch from 2 audio channels to 6 - * 631814 : [flacparse] unit test failures - * 631993 : [flacparse] imperfect timestamping - * 632070 : qtmux: infinite loop - * 632668 : Gaudi Effects [review] - * 632885 : Gaudi Effects dynamically controllable parameters [review] - * 632911 : qtmux: add fragmented mp4 support (isml brand) - * 633466 : [katedec] Pushes events before the final caps are known - * 633917 : [mpegtsparse] [PATCH] Send TDT messages in an serialized event downstream - * 635200 : [dvbbasebin] [PATCH] Add TDT to the initial pids filter for dvbsrc - * 635202 : mpeg4videoparse: Minor fixes - * 635204 : mpeg4videoparse: Set srcpad caps before forwarding newsegment - * 635205 : h264parse: Set srcpad caps before forwarding newsegment - * 635229 : celtenc: uninitialized tags variable can cause segfault - * 635304 : [opencv] fix caps issues and extend supported caps for some elements [PATCH] - * 635397 : rfbsrc: avoid infinite loop if source gets disconnected and don't crash if frame geometry changes - * 635529 : interlace: Add pattern offset and fix timestamps - * 635720 : vp8enc incorrectly sets timestamps based on theoretical framerate - * 635786 : [audioparse] Fix division-by-zero exception - * 635878 : [qtmux] gst_qtmux_check_difference subtract 2 unsigned numbers without taking care of the result sign - * 636106 : autocolorspace: new plugin for auto space convertor selection - * 636109 : [SSIM] klass should be Filter/Effect/Video - * 636185 : qtmux: msvc incompatibility - * 637062 : [ac3parse] parse problems on some MTS streams - * 637224 : [bayer2rgb] missing framerate in sink caps - * 637308 : gst-plugins-bad did not find xvidcore on my box - * 637359 : Internal GStreamer error, during pcap to mp4 conversion - * 637403 : qtmux do not store 1st TS when detect 1st buffer - * 637486 : qtmux: error if no buffers have arrived to one pad at EOS - * 637532 : applemedia: redundant declaration of 'parent_class' - * 637590 : [PATCH] fix gst-plugins-bad compile against latest gtk+ - * 637824 : mpeg4videoparse: gst_buffer_is_metadata_writable warning (regression) - * 637929 : mve: do not use the pad buffer allocation functions in demuxers - * 637931 : mpegdemux: do not use the pad buffer allocation functions in demuxers - * 638004 : tiger: fallback on headers in caps to initialize if headers are absent - * 638288 : qtmux: fails to handle out-of-order buffers without duration - * 638412 : kate: reenable the sending of a message for tags - * 638527 : tiger: outline text by default, to make it easier to read - * 638604 : basecamerasrc isn't build by default but camerabin2 is and requires it - * 639063 : mpegtsparse: fix (re)sync with invalid data at beginning - * 639338 : [qtmux] Protect against copying a null caps - * 639413 : Camerabin should use output-selector:pad-negotiation-mode=active - * 639456 : [camerabin] Should have all conversion flags enabled by default - * 639555 : [audioparsers] Be careful to not lose the event ref - * 639950 : flacparse: avoid unref'ing NULL buffer - * 630830 : zbar: Fixes, single frame scan and width/stride fix - * 635281 : [mpegtsparse] TDT packets are only parsed for odd hours + * 617532 : [qtmux] Take into account new-segments for incoming streams + * 622276 : Add an h263parse element + * 626618 : jpegparse doesn't handle APP12 marker + * 632056 : Directdrawsink draws black stripes over the overlying dialog windows. + * 639502 : [camerabin] should not re-create preview pipeline when setting new preview caps + * 639763 : [dvbsuboverlay] Green borders around subtitles + * 639841 : examples: camerabin: Don't set default values for GstPhotography interface settings + * 640286 : elements/imagecapturebin check fails + * 640287 : camerabin2 checks fail + * 640327 : Add VP8 RTP payloaders and depayloaders + * 640561 : opencv textwrite element renaming and proper structuring: + * 640637 : Camerabin has warning: Internal GStreamer error: clock problem. + * 640885 : Permission problems building bad + * 641047 : [mpegaudioparse] Multiple issues with new mpegaudioparse element from -bad, lower rank? + * 641178 : rtpvp8: build problem, needs to link with libgstbase-0.10 + * 641496 : New plugin: curlsink + * 641530 : Camerabin should capture image if preview_caps is set even if filename is not set + * 641712 : XWindow is never created in gst-camerabin-test example application + * 641796 : opencv: make plugin work with opencv 2.2.0 release + * 641857 : baseparse: Update min/max bitrate before first posting them + * 641858 : mpegaudioparse: Post CBR bitrate as nominal bitrate + * 642116 : rsvgoverlay: add position/dimension parameters + * 642658 : rsvgoverlay: allow negative values for position/dimension parameters + * 642671 : fieldanalysis: New element for analysing video input to produce progressive output + * 643469 : fpsdisplaysink: add frames-dropped and frames-rendered properties + * 643471 : fpsdisplaysink: fix default sync property value + * 643607 : [celt] Doesn't compile with celt 0.11.1 + * 644176 : videofilters: needs to link against libm + * 644208 : dcaparse: add depth and endianness to dts caps to allow elements to negotiate on these certain stream format requirements + * 644429 : [mpegtsmux] in m2ts-mode, the tp_extra_header is incorrect + * 645006 : [mpegtsmux] in m2ts-mode, PAT is written only once + * 645053 : shm: multiple compile failures on Solaris 10 + * 645412 : [h264parse] h264parse doesn't set framed=True on src caps + * 645420 : [scaletempo] Incorrectly handles new segments with stop == -1 + * 645502 : [h264parse] leaks fatally on certain streams + * 645568 : aiffparse: doesn't play 24-bit AIFF properly + * 645711 : patchdetect: link error while using gcc-4.52 + * 646256 : qtmux " buffer without timestamp/duration " error message could be more helpful + * 646495 : hlsdemux: Add missing patches from my local branch + * 646840 : shmsink: ensure gst_poll_wait is the first gst_poll function called on a descriptor + * 646955 : dshowvideosink: Update to reflect latest GstXOverlay changes + * 647030 : [fpsdisplaysink] " silent " property + * 647364 : VGM files loop indefinately + * 647498 : xvidenc not forwarding caps + * 647564 : gst-plugins-bad configure.ac summary wrongly claims an exif plugin + * 647830 : assrender: crashes with very large subtitles + * 647852 : [schroenc] Crashes after some time when getting buffers after EOS + * 647853 : [schrodec] Impossible to play very short files + * 647854 : [schrodec] Allocates buffers with NULL caps from downstream + * 648001 : configure: Fix linsys/decklink checks for Linux + * 648929 : [tsdemux] Memory leaks everywhere + * 649005 : y4mdec: add plugin description + * 647751 : [hlsdemux] Fix usage of the element in players + * 621027 : mpegtsparse problem when parsing EIT and obtaining Transport Stream packet size Download @@ -277,61 +230,47 @@ Applications Contributors to this release - * Alejandro Gonzalez - * Aleksey Lim - * Alessandro Decina + * Alexey Fisher * Andoni Morales Alastruey - * Andres Colubri - * André Dieb Martins + * Andreas Frisch * Arun Raghavan * Benjamin Gaignard + * Byeong-ryeol Kim * Carl-Anton Ingmarsson - * Christian Berentsen - * Damien Lespiau - * David Hoyt + * Chris E Jones + * Christian Fredrik Kalager Schaller * David Schleef * Edward Hervey - * Felipe Contreras - * Francis Rammeloo - * Hoseok Chang + * Fabrizio Milo + * Haakon Sporsheim * Hu Gang * Jan Schmidt * Janne Grunau - * Jonathan Rosser - * Josh Doe - * Kaj-Michael Lang - * Karol Sobczak - * Knut Inge Hvidsten * Lasse Laukkanen - * Leo Singer + * Lauri Lehtinen * Luciana Fujii Pontello * Luis de Bethencourt - * Marc-André Lureau * Mark Nauwelaerts * Mart Raudsepp - * Matthew Ife - * Mike Sheldon - * Noam - * Ole André Vadla Ravnås + * Mihai Draghicioiu * Olivier Aubert * Olivier Crête - * Rob Clark + * Patricia Muscalu + * Philip Jägenstedt + * Philippe Normand + * Raimo Järvi + * René Stadler + * Reynaldo H. Verdejo Pinochet * Robert Swain - * Saleem Abdulrasool * Sebastian Dröge - * Sebastian Pölsterl + * Sjoerd Simons * Sreerenj Balachandran * Stefan Kost * Teemu Katajisto * Thiago Santos * Thibault Saunier - * Thijs Vermeir * Tim-Philipp Müller - * Tristan Matthews * Vincent Penquerc'h * Víctor Manuel Jáquez Leal - * Wim Taymans - * Youness Alaoui * benjamin gaignard - * kapil   \ No newline at end of file diff --git a/android/NOTICE b/android/NOTICE deleted file mode 100644 index eb685a5ec9..0000000000 --- a/android/NOTICE +++ /dev/null @@ -1,481 +0,0 @@ - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. 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 not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library 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 -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (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., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/android/aacparse.mk b/android/aacparse.mk deleted file mode 100644 index c68adff44c..0000000000 --- a/android/aacparse.mk +++ /dev/null @@ -1,48 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_ARM_MODE := arm - -aacparse_LOCAL_SRC_FILES:= \ - gst/aacparse/gstaacparse.c \ - gst/aacparse/gstbaseparse.c - -LOCAL_SRC_FILES:= $(addprefix ../,$(aacparse_LOCAL_SRC_FILES)) - -LOCAL_SHARED_LIBRARIES := \ - libgstreamer-0.11 \ - libgstbase-0.11 \ - libglib-2.0 \ - libgthread-2.0 \ - libgmodule-2.0 \ - libgobject-2.0 \ - libgstinterfaces-0.11 - -LOCAL_MODULE:= libgstaacparse - -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH)/.. \ - $(LOCAL_PATH)/../gst-libs \ - $(LOCAL_PATH) \ - $(TARGET_OUT_HEADERS)/gstreamer-0.11 \ - $(TARGET_OUT_HEADERS)/glib-2.0 \ - $(TARGET_OUT_HEADERS)/glib-2.0/glib \ - external/libxml2/include - -ifeq ($(STECONF_ANDROID_VERSION),"FROYO") -LOCAL_SHARED_LIBRARIES += libicuuc -LOCAL_C_INCLUDES += external/icu4c/common -endif - - -LOCAL_CFLAGS := -DHAVE_CONFIG_H -# -# define LOCAL_PRELINK_MODULE to false to not use pre-link map -# -LOCAL_PRELINK_MODULE := false - -#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.11 -LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.11 - -include $(BUILD_SHARED_LIBRARY) diff --git a/android/amrparse.mk b/android/amrparse.mk deleted file mode 100644 index ba8c1f2905..0000000000 --- a/android/amrparse.mk +++ /dev/null @@ -1,48 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_ARM_MODE := arm - -amrparse_LOCAL_SRC_FILES:= \ - gst/amrparse/gstamrparse.c \ - gst/amrparse/gstbaseparse.c - -LOCAL_SRC_FILES:= $(addprefix ../,$(amrparse_LOCAL_SRC_FILES)) - -LOCAL_SHARED_LIBRARIES := \ - libgstreamer-0.11 \ - libgstbase-0.11 \ - libglib-2.0 \ - libgthread-2.0 \ - libgmodule-2.0 \ - libgobject-2.0 - -LOCAL_MODULE:= libgstamrparse - -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH)/../ext/amrwbenc \ - $(LOCAL_PATH)/.. \ - $(LOCAL_PATH)/../gst-libs \ - $(LOCAL_PATH) \ - $(TARGET_OUT_HEADERS)/gstreamer-0.11 \ - $(TARGET_OUT_HEADERS)/glib-2.0 \ - $(TARGET_OUT_HEADERS)/glib-2.0/glib \ - external/libxml2/include - -ifeq ($(STECONF_ANDROID_VERSION),"FROYO") -LOCAL_SHARED_LIBRARIES += libicuuc -LOCAL_C_INCLUDES += external/icu4c/common -endif - -LOCAL_CFLAGS := -DHAVE_CONFIG_H -# -# define LOCAL_PRELINK_MODULE to false to not use pre-link map -# -LOCAL_PRELINK_MODULE := false - -#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.11 -LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.11 - -include $(BUILD_SHARED_LIBRARY) - diff --git a/android/h264parse.mk b/android/h264parse.mk deleted file mode 100644 index 68e199cf63..0000000000 --- a/android/h264parse.mk +++ /dev/null @@ -1,46 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_ARM_MODE := arm - -h264parse_LOCAL_SRC_FILES:= \ - gst/h264parse/gsth264parse.c - -LOCAL_SRC_FILES:= $(addprefix ../,$(h264parse_LOCAL_SRC_FILES)) - -LOCAL_SHARED_LIBRARIES := \ - libgstreamer-0.11 \ - libgstbase-0.11 \ - libglib-2.0 \ - libgthread-2.0 \ - libgmodule-2.0 \ - libgobject-2.0 - -LOCAL_MODULE:= libgsth264parse - -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH)/../gst/h264parse \ - $(LOCAL_PATH)/.. \ - $(LOCAL_PATH)/../gst-libs \ - $(LOCAL_PATH) \ - $(TARGET_OUT_HEADERS)/gstreamer-0.11 \ - $(TARGET_OUT_HEADERS)/glib-2.0 \ - $(TARGET_OUT_HEADERS)/glib-2.0/glib \ - external/libxml2/include - -ifeq ($(STECONF_ANDROID_VERSION),"FROYO") -LOCAL_SHARED_LIBRARIES += libicuuc -LOCAL_C_INCLUDES += external/icu4c/common -endif - -LOCAL_CFLAGS := -DHAVE_CONFIG_H -# -# define LOCAL_PRELINK_MODULE to false to not use pre-link map -# -LOCAL_PRELINK_MODULE := false - -#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.11 -LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.11 - -include $(BUILD_SHARED_LIBRARY) diff --git a/android/metadata.mk b/android/metadata.mk deleted file mode 100644 index 976c636211..0000000000 --- a/android/metadata.mk +++ /dev/null @@ -1,61 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_ARM_MODE := arm - -metadata_LOCAL_SRC_FILES:= \ - ext/metadata/gstmetadata.c \ - ext/metadata/gstmetadatademux.c \ - ext/metadata/metadata.c \ - ext/metadata/metadataparsejpeg.c \ - ext/metadata/metadatamuxjpeg.c \ - ext/metadata/metadataparsepng.c \ - ext/metadata/metadatamuxpng.c \ - ext/metadata/metadataexif.c \ - ext/metadata/metadataiptc.c \ - ext/metadata/metadataxmp.c \ - ext/metadata/metadataparseutil.c \ - ext/metadata/metadatatypes.c \ - ext/metadata/gstmetadatamux.c \ - ext/metadata/metadatatags.c \ - ext/metadata/gstbasemetadata.c - -LOCAL_SRC_FILES:= $(addprefix ../,$(metadata_LOCAL_SRC_FILES)) - -LOCAL_SHARED_LIBRARIES := \ - libgstreamer-0.11 \ - libgstbase-0.11 \ - libglib-2.0 \ - libgthread-2.0 \ - libgmodule-2.0 \ - libgobject-2.0 \ - libgsttag-0.11 - -LOCAL_MODULE:= libgstmetadata - -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH)/../ext/metadata \ - $(LOCAL_PATH)/.. \ - $(LOCAL_PATH)/../gst-libs \ - $(LOCAL_PATH) \ - $(TARGET_OUT_HEADERS)/gstreamer-0.11 \ - $(TARGET_OUT_HEADERS)/glib-2.0 \ - $(TARGET_OUT_HEADERS)/glib-2.0/glib \ - external/libxml2/include - -ifeq ($(STECONF_ANDROID_VERSION),"FROYO") -LOCAL_SHARED_LIBRARIES += libicuuc -LOCAL_C_INCLUDES += external/icu4c/common -endif - -LOCAL_CFLAGS := -DHAVE_CONFIG_H -# -# define LOCAL_PRELINK_MODULE to false to not use pre-link map -# -LOCAL_PRELINK_MODULE := false - -#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.11 -LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.11 - -include $(BUILD_SHARED_LIBRARY) diff --git a/android/qtmux.mk b/android/qtmux.mk deleted file mode 100644 index 1c9e22aa63..0000000000 --- a/android/qtmux.mk +++ /dev/null @@ -1,50 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_ARM_MODE := arm - -qtmux_LOCAL_SRC_FILES:= \ - gst/qtmux/gstqtmux.c \ - gst/qtmux/atoms.c \ - gst/qtmux/descriptors.c \ - gst/qtmux/properties.c \ - gst/qtmux/gstqtmuxmap.c - -LOCAL_SRC_FILES:= $(addprefix ../,$(qtmux_LOCAL_SRC_FILES)) - -LOCAL_SHARED_LIBRARIES := \ - libgstreamer-0.11 \ - libgstbase-0.11 \ - libglib-2.0 \ - libgthread-2.0 \ - libgmodule-2.0 \ - libgobject-2.0 - -LOCAL_MODULE:= libgstqtmux - -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH)/../gst/qtmux \ - $(LOCAL_PATH)/.. \ - $(LOCAL_PATH)/../gst-libs \ - $(LOCAL_PATH) \ - $(TARGET_OUT_HEADERS)/gstreamer-0.11 \ - $(TARGET_OUT_HEADERS)/glib-2.0 \ - $(TARGET_OUT_HEADERS)/glib-2.0/glib \ - external/libxml2/include - -ifeq ($(STECONF_ANDROID_VERSION),"FROYO") -LOCAL_SHARED_LIBRARIES += libicuuc -LOCAL_C_INCLUDES += external/icu4c/common -endif - -LOCAL_CFLAGS := -DHAVE_CONFIG_H -# -# define LOCAL_PRELINK_MODULE to false to not use pre-link map -# -LOCAL_PRELINK_MODULE := false - -#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.11 -LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.11 - -include $(BUILD_SHARED_LIBRARY) diff --git a/android/sdpelem.mk b/android/sdpelem.mk deleted file mode 100644 index 6ea76eb14b..0000000000 --- a/android/sdpelem.mk +++ /dev/null @@ -1,50 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_ARM_MODE := arm - -sdpelem_LOCAL_SRC_FILES:= \ - gst/sdp/gstsdpelem.c \ - gst/sdp/gstsdpdemux.c - -LOCAL_SRC_FILES:= $(addprefix ../,$(sdpelem_LOCAL_SRC_FILES)) - -LOCAL_SHARED_LIBRARIES := \ - libgstreamer-0.11 \ - libgstbase-0.11 \ - libglib-2.0 \ - libgthread-2.0 \ - libgmodule-2.0 \ - libgobject-2.0 \ - libgstinterfaces-0.11 \ - libgstrtp-0.11 \ - libgstsdp-0.11 - -LOCAL_MODULE:= libgstsdpelem - -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH)/../gst/sdp \ - $(LOCAL_PATH)/.. \ - $(LOCAL_PATH)/../gst-libs \ - $(LOCAL_PATH) \ - $(TARGET_OUT_HEADERS)/gstreamer-0.11 \ - $(TARGET_OUT_HEADERS)/glib-2.0 \ - $(TARGET_OUT_HEADERS)/glib-2.0/glib \ - external/libxml2/include - -ifeq ($(STECONF_ANDROID_VERSION),"FROYO") -LOCAL_SHARED_LIBRARIES += libicuuc -LOCAL_C_INCLUDES += external/icu4c/common -endif - -LOCAL_CFLAGS := -DHAVE_CONFIG_H -DGSTREAMER_BUILT_FOR_ANDROID -# -# define LOCAL_PRELINK_MODULE to false to not use pre-link map -# -LOCAL_PRELINK_MODULE := false - -#It's a gstreamer plugins, and it must be installed on ..../lib/gstreamer-0.11 -LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.11 - -include $(BUILD_SHARED_LIBRARY) diff --git a/autogen.sh b/autogen.sh index 4ac0577d62..8a56c7acc1 100755 --- a/autogen.sh +++ b/autogen.sh @@ -79,7 +79,7 @@ tool_run "$libtoolize" "--copy --force" tool_run "$aclocal" "-I m4 -I common/m4 $ACLOCAL_FLAGS" tool_run "$autoheader" -# touch the stamp-h.in build stamp so we don't re-run autoheader in maintainer mode -- wingo +# touch the stamp-h.in build stamp so we don't re-run autoheader in maintainer mode echo timestamp > stamp-h.in 2> /dev/null tool_run "$autoconf" diff --git a/common b/common index 6aec6b9716..69b981f10c 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 6aec6b9716c184c60c4bc6a5916a2471cfa8c8cd +Subproject commit 69b981f10caa234ad0ff639179d0fda8505bd94b diff --git a/configure.ac b/configure.ac index a28aa27eb0..202657a2ab 100644 --- a/configure.ac +++ b/configure.ac @@ -180,7 +180,7 @@ AC_CHECK_FUNC(socket,,[AC_CHECK_LIB(socket,socket)]) AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)]) dnl GLib is required -AG_GST_GLIB_CHECK([2.22]) +AG_GST_GLIB_CHECK([2.24]) dnl checks for gstreamer dnl uninstalled is selected preferentially -- see pkg-config(1) @@ -243,8 +243,14 @@ if test "x$HAVE_X11" = "xyes"; then AC_DEFINE(HAVE_X11, 1, [Define if you have X11 library]) fi +dnl exif (used on jifmux tests) **** +PKG_CHECK_MODULES(EXIF, libexif >= 0.6.16, HAVE_EXIF="yes", HAVE_EXIF="no") +AC_SUBST(EXIF_LIBS) +AC_SUBST(EXIF_CFLAGS) +AM_CONDITIONAL(USE_EXIF, test "x$HAVE_EXIF" = "xyes") + dnl Orc -ORC_CHECK([0.4.7]) +ORC_CHECK([0.4.11]) dnl set license and copyright notice GST_LICENSE="LGPL" @@ -291,7 +297,7 @@ AG_GST_CHECK_PLUGIN(adpcmdec) AG_GST_CHECK_PLUGIN(adpcmenc) AG_GST_CHECK_PLUGIN(aiff) AG_GST_CHECK_PLUGIN(asfmux) -AG_GST_CHECK_PLUGIN(audioparsers) +AG_GST_CHECK_PLUGIN(audiovisualizers) AG_GST_CHECK_PLUGIN(autoconvert) AG_GST_CHECK_PLUGIN(bayer) AG_GST_CHECK_PLUGIN(camerabin) @@ -305,6 +311,7 @@ AG_GST_CHECK_PLUGIN(debugutils) AG_GST_CHECK_PLUGIN(dtmf) 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(freeze) @@ -313,9 +320,9 @@ AG_GST_CHECK_PLUGIN(gaudieffects) AG_GST_CHECK_PLUGIN(geometrictransform) AG_GST_CHECK_PLUGIN(h264parse) AG_GST_CHECK_PLUGIN(hdvparse) +AG_GST_CHECK_PLUGIN(hls) AG_GST_CHECK_PLUGIN(id3tag) AG_GST_CHECK_PLUGIN(interlace) -AG_GST_CHECK_PLUGIN(invtelecine) AG_GST_CHECK_PLUGIN(ivfparse) AG_GST_CHECK_PLUGIN(jp2kdecimator) AG_GST_CHECK_PLUGIN(jpegformat) @@ -332,14 +339,15 @@ AG_GST_CHECK_PLUGIN(mve) AG_GST_CHECK_PLUGIN(mxf) AG_GST_CHECK_PLUGIN(nsf) AG_GST_CHECK_PLUGIN(nuvdemux) +AG_GST_CHECK_PLUGIN(patchdetect) AG_GST_CHECK_PLUGIN(pcapparse) AG_GST_CHECK_PLUGIN(pnm) -AG_GST_CHECK_PLUGIN(qtmux) AG_GST_CHECK_PLUGIN(rawparse) AG_GST_CHECK_PLUGIN(real) AG_GST_CHECK_PLUGIN(rtpmux) AG_GST_CHECK_PLUGIN(rtpvp8) AG_GST_CHECK_PLUGIN(scaletempo) +AG_GST_CHECK_PLUGIN(sdi) AG_GST_CHECK_PLUGIN(sdp) AG_GST_CHECK_PLUGIN(segmentclip) AG_GST_CHECK_PLUGIN(siren) @@ -446,6 +454,44 @@ int main () AC_SUBST(HAVE_DIRECTSOUND) ]) +dnl Direct3D +translit(dnm, m, l) AM_CONDITIONAL(USE_DIRECT3D, true) +AG_GST_CHECK_FEATURE(DIRECT3D, [Direct3D plug-in], direct3dsink, [ + HAVE_DIRECT3D="no" + save_CFLAGS="$CFLAGS" + save_LDFLAGS="$LDFLAGS" + save_LIBS="$LIBS" + CFLAGS="$CFLAGS $DIRECTX_CFLAGS" + LDFLAGS="$LDFLAGS $DIRECTX_LDFLAGS" + LIBS="$LIBS -ld3d -lgdi32" + AC_MSG_CHECKING(for Direct3D LDFLAGS) + AC_LINK_IFELSE([ +#include +#include + +int main () +{ + GetStockObject(0); + Direct3DCreate(NULL, NULL, NULL); + + return 0; +} +], + [HAVE_DIRECT3D="yes"], + [HAVE_DIRECT3D="no"]) + AC_MSG_RESULT($HAVE_DIRECT3D) + CFLAGS=$save_CFLAGS + LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS + + if test "x$HAVE_DIRECT3D" = "xyes"; then + dnl this is much more than we want + DIRECT3D_LIBS="-ld3d -ldxguid -lgdi32" + AC_SUBST(DIRECT3D_LIBS) + fi + AC_SUBST(HAVE_DIRECT3D) +]) + dnl DirectDraw translit(dnm, m, l) AM_CONDITIONAL(USE_DIRECTDRAW, true) AG_GST_CHECK_FEATURE(DIRECTDRAW, [DirectDraw plug-in], directdrawsink, [ @@ -527,6 +573,29 @@ case "$host" in ;; esac +dnl *** OS/X AVCVideoServices *** +translit(dnm, m, l) AM_CONDITIONAL(USE_AVC, true) +HAVE_AVC="no" +AG_GST_CHECK_FEATURE(AVC, [AVC Video Services], avcsrc, [ + AC_LANG_PUSH([C++]) + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -framework AVCVideoServices -framework CoreFoundation" + save_LIBS="$LIBS" + LIBS="$LIBS -framework AVCVideoServices -framework CoreFoundation" + AC_TRY_LINK([], [], [HAVE_AVC=yes], [HAVE_AVC=no]) + LIBS=$save_LIBS + CPPFLAGS=$save_CPPFLAGS + AC_LANG_POP([C++]) +]) +dnl in case header AVCVideoServices/AVCVideoServices.h is found on other platforms +case "$host" in + *-*darwin*) + ;; + *) + HAVE_AVC="no" + ;; +esac + dnl check for QuickTime translit(dnm, m, l) AM_CONDITIONAL(USE_QUICKTIME, true) AG_GST_CHECK_FEATURE(QUICKTIME, [QuickTime wrapper], qtwrapper, [ @@ -537,7 +606,15 @@ AG_GST_CHECK_FEATURE(QUICKTIME, [QuickTime wrapper], qtwrapper, [ dnl check for shm_open (for shm plugin) translit(dnm, m, l) AM_CONDITIONAL(USE_SHM, true) AG_GST_CHECK_FEATURE(SHM, [POSIX shared memory source and sink], shm, [ - AC_CHECK_LIB(rt, shm_open, HAVE_SHM=yes, HAVE_SHM=no) + if test "x$HAVE_SYS_SOCKET_H" = "xyes"; then + AC_CHECK_LIB([rt], [shm_open], + AC_CHECK_DECL([MSG_NOSIGNAL], HAVE_SHM=yes, HAVE_SHM=no, [ +#include + ]), + HAVE_SHM=no) + else + HAVE_SHM=no + fi ]) dnl check for Video CD @@ -557,20 +634,21 @@ AG_GST_CHECK_FEATURE(ASSRENDER, [ASS/SSA renderer], assrender, [ PKG_CHECK_MODULES(ASSRENDER, libass >= 0.9.4, [ HAVE_ASSRENDER="yes" ], [ HAVE_ASSRENDER="no" - AC_MSG_RESULT(no) ]) ]) AC_SUBST(ASSRENDER_CFLAGS) AC_SUBST(ASSRENDER_LIBS) -dnl *** amrwb *** -translit(dnm, m, l) AM_CONDITIONAL(USE_AMRWB, true) -AG_GST_CHECK_FEATURE(AMRWB, [amrwb library], amrwbenc, [ - AG_GST_CHECK_LIBHEADER(AMRWB, amrwb, - GP3E_IF_encode, , - amrwb/enc.h, - AMRWB_LIBS="-lamrwb" - AC_SUBST(AMRWB_LIBS)) +dnl *** vo-amrwbenc *** +translit(dnm, m, l) AM_CONDITIONAL(USE_VOAMRWBENC, true) +AG_GST_CHECK_FEATURE(VOAMRWBENC, [vo-amrwbenc library], vo-amrwbenc, [ + AG_GST_PKG_CHECK_MODULES(VOAMRWBENC, vo-amrwbenc >= 0.1.0) +]) + +dnl *** vo-aacenc *** +translit(dnm, m, l) AM_CONDITIONAL(USE_VOAACENC, true) +AG_GST_CHECK_FEATURE(VOAACENC, [vo-aacenc library], vo-aacenc, [ + AG_GST_PKG_CHECK_MODULES(VOAACENC, vo-aacenc >= 0.1.0) ]) dnl *** apexsink *** @@ -603,7 +681,6 @@ AG_GST_CHECK_FEATURE(BZ2, [bz2 library], bz2, [ #AG_GST_CHECK_FEATURE(CAIRO, [cairo plug-in], cairo, [ # PKG_CHECK_MODULES(CAIRO, cairo >= 1.0 glitz-glx, HAVE_CAIRO=yes, [ # HAVE_CAIRO=no -# AC_MSG_RESULT(no) # ]) # AC_SUBST(CAIRO_CFLAGS) # AC_SUBST(CAIRO_LIBS) @@ -612,7 +689,11 @@ AG_GST_CHECK_FEATURE(BZ2, [bz2 library], bz2, [ dnl *** cdaudio *** translit(dnm, m, l) AM_CONDITIONAL(USE_CDAUDIO, true) AG_GST_CHECK_FEATURE(CDAUDIO, [cdaudio], cdaudio, [ - AG_GST_CHECK_CONFIGPROG(CDAUDIO, libcdaudio-config) + PKG_CHECK_MODULES(CDAUDIO, libcdaudio, [ + HAVE_CDAUDIO="yes" + ], [ + HAVE_CDAUDIO="no" + ]) AC_SUBST(CDAUDIO_CFLAGS) AC_SUBST(CDAUDIO_LIBS) ]) @@ -656,7 +737,6 @@ translit(dnm, m, l) AM_CONDITIONAL(USE_COG, true) AG_GST_CHECK_FEATURE(COG, [Cog plugin], cog, [ PKG_CHECK_MODULES(COG, libpng >= 1.2, HAVE_COG="yes", [ HAVE_COG="no" - AC_MSG_RESULT(no) ]) AC_SUBST(COG_CFLAGS) AC_SUBST(COG_LIBS) @@ -673,7 +753,6 @@ AG_GST_CHECK_FEATURE(CURL, [Curl plugin], curl, [ AC_MSG_RESULT($HAVE_CURL) ], [ HAVE_CURL="no" - AC_MSG_RESULT(no) ]) AC_SUBST(CURL_CFLAGS) AC_SUBST(CURL_LIBS) @@ -687,7 +766,6 @@ AG_GST_CHECK_FEATURE(DC1394, [libdc1394], dc1394, [ HAVE_DC1394="yes" else HAVE_DC1394="no" - AC_MSG_RESULT(no) fi ], [ HAVE_DC1394="no" @@ -697,13 +775,35 @@ AG_GST_CHECK_FEATURE(DC1394, [libdc1394], dc1394, [ AC_SUBST(LIBDC1394_LIBS) ]) +dnl *** decklink *** +translit(dnm, m, l) AM_CONDITIONAL(USE_DECKLINK, true) +AG_GST_CHECK_FEATURE(DECKLINK, [decklink], decklink, [ + HAVE_DECKLINK=no + case "$host" in + *-*linux*) + if test "x$HAVE_PTHREAD_H" = "xyes"; then + AC_CHECK_LIB(dl, dlopen, + [ + HAVE_DECKLINK=yes + DECKLINK_CXXFLAGS= + DECKLINK_LIBS="-lpthread -ldl" + ]) + fi + ;; + *) + HAVE_DECKLINK=no + ;; + esac + + AC_SUBST(DECKLINK_CXXFLAGS) + AC_SUBST(DECKLINK_LIBS) +]) dnl **** DirectFB **** translit(dnm, m, l) AM_CONDITIONAL(USE_DIRECTFB, true) AG_GST_CHECK_FEATURE(DIRECTFB, [directfb], dfbvideosink , [ PKG_CHECK_MODULES(DIRECTFB, directfb >= 0.9.24, HAVE_DIRECTFB="yes", [ HAVE_DIRECTFB="no" - AC_MSG_RESULT(no) ]) ]) @@ -712,7 +812,6 @@ translit(dnm, m, l) AM_CONDITIONAL(USE_DIRAC, true) AG_GST_CHECK_FEATURE(DIRAC, [dirac], dirac, [ PKG_CHECK_MODULES(DIRAC, dirac >= 0.10, HAVE_DIRAC="yes", [ HAVE_DIRAC="no" - AC_MSG_RESULT(no) ]) ]) @@ -750,10 +849,8 @@ AG_GST_CHECK_FEATURE(DIVX, [divx plugins], divx, [ return 0; ], [ HAVE_DIVX=yes - AC_MSG_RESULT(yes) ], [ HAVE_DIVX=no - AC_MSG_RESULT(no) AC_MSG_WARN([Wrong version of divx4linux installed]) ]) fi @@ -774,10 +871,8 @@ return 0; return 0; ], [ HAVE_DIVX=yes - AC_MSG_RESULT(yes) ], [ HAVE_DIVX=no - AC_MSG_RESULT(no) AC_MSG_WARN([Wrong version of divx4linux installed]) ]) fi @@ -807,16 +902,6 @@ translit(dnm, m, l) AM_CONDITIONAL(USE_RESINDVD, true) AG_GST_CHECK_FEATURE(RESINDVD, [resindvd plugin], resindvd, [ PKG_CHECK_MODULES(DVDNAV, dvdnav >= 4.1.2 dvdread >= 4.1.2, HAVE_RESINDVD="yes", [ HAVE_RESINDVD="no" - AC_MSG_RESULT(no) - ]) -]) - -dnl **** exif (used on jifmux tests) **** -translit(dnm, m, l) AM_CONDITIONAL(USE_EXIF, true) -AG_GST_CHECK_FEATURE(EXIF, [exif], exif, [ - PKG_CHECK_MODULES(EXIF, libexif >= 0.6.16, HAVE_EXIF="yes", [ - HAVE_EXIF="no" - AC_MSG_RESULT(no) ]) ]) @@ -859,7 +944,6 @@ AG_GST_CHECK_FEATURE(FAAD, [AAC decoder plug-in], faad, [ #endif ], [ HAVE_FAAD="yes" - AC_MSG_RESULT(yes) AC_MSG_CHECKING([Checking FAAD2 version in $faad_hdr]) for minor in 10 9 8 7 6 5 0; do @@ -880,7 +964,6 @@ AG_GST_CHECK_FEATURE(FAAD, [AAC decoder plug-in], faad, [ fi ], [ HAVE_FAAD="no" - AC_MSG_RESULT(no) ]) fi AS_SCRUB_INCLUDE(FAAD_CFLAGS) @@ -932,7 +1015,6 @@ translit(dnm, m, l) AM_CONDITIONAL(USE_KATE, true) AG_GST_CHECK_FEATURE(KATE, [Kate], kate, [ PKG_CHECK_MODULES(KATE, kate >= 0.1.7, HAVE_KATE="yes", [ HAVE_KATE="no" - AC_MSG_RESULT(no) ]) AC_SUBST(KATE_CFLAGS) AC_SUBST(KATE_LIBS) @@ -943,7 +1025,6 @@ AG_GST_CHECK_FEATURE(KATE, [Kate], kate, [ ], [ HAVE_TIGER="no" - AC_MSG_RESULT(no) ] ) AM_CONDITIONAL(USE_TIGER, test "x$HAVE_TIGER" = "xyes") @@ -955,7 +1036,7 @@ dnl *** ladspa *** translit(dnm, m, l) AM_CONDITIONAL(USE_LADSPA, true) AG_GST_CHECK_FEATURE(LADSPA, [ladspa], ladspa, [ AC_CHECK_HEADER(ladspa.h, HAVE_LADSPA="yes", HAVE_LADSPA="no") - + PKG_CHECK_MODULES(LRDF, lrdf, HAVE_LRDF=yes, HAVE_LRDF=no) if test $HAVE_LRDF = "yes"; then AC_DEFINE(HAVE_LRDF, 1, [Define if we have liblrdf]) @@ -978,11 +1059,23 @@ AG_GST_CHECK_FEATURE(LIBMMS, [mms protocol library], libmms, [ dnl check with pkg-config first PKG_CHECK_MODULES(LIBMMS, libmms >= 0.4, HAVE_LIBMMS="yes", [ HAVE_LIBMMS="no" - AC_MSG_RESULT(no) ]) ]) AC_SUBST(LIBMMS_LIBS) +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, [ @@ -1017,21 +1110,25 @@ PKG_CHECK_EXISTS(mjpegtools >= 1.6.1.93 mjpegtools < 1.8.0, [ PKG_CHECK_EXISTS(mjpegtools >= 1.8.0 mjpegtools < 1.9.0, [ mjpegtools_api=10800 ], [ - PKG_CHECK_MODULES(MJPEG, mjpegtools >= 1.9.0, [ - dnl logging API changed in release candidates - OLD_CFLAGS="$CFLAGS" - OLD_LIBS="$LIBS" - CFLAGS="$MJPEG_CFLAGS" - LIBS="$LIBS $MJPEG_LIBS -lmjpegutils $LIBM -lpthread" - AC_CHECK_FUNC(mjpeg_loglev_t, [ - mjpegtools_api=10903 - ], [ - mjpegtools_api=10900 - ]) - CFLAGS="$OLD_CFLAGS" - LIBS="$OLD_LIBS" + PKG_CHECK_EXISTS(mjpegtools >= 2.0.0, [ + mjpegtools_api=20000 ], [ - mjpegtools_api=0 + PKG_CHECK_MODULES(MJPEG, mjpegtools >= 1.9.0 mjpegtools < 2.0.0, [ + dnl logging API changed in release candidates + OLD_CFLAGS="$CFLAGS" + OLD_LIBS="$LIBS" + CFLAGS="$MJPEG_CFLAGS" + LIBS="$LIBS $MJPEG_LIBS -lmjpegutils $LIBM -lpthread" + AC_CHECK_FUNC(mjpeg_loglev_t, [ + mjpegtools_api=10903 + ], [ + mjpegtools_api=10900 + ]) + CFLAGS="$OLD_CFLAGS" + LIBS="$OLD_LIBS" + ], [ + mjpegtools_api=0 + ]) ]) ]) ]) @@ -1204,7 +1301,6 @@ translit(dnm, m, l) AM_CONDITIONAL(USE_MYTHTV, true) AG_GST_CHECK_FEATURE(MYTHTV, [MythTV client plugins], mythtvsrc, [ PKG_CHECK_MODULES(GMYTH, gmyth >= 0.4 gmyth <= 0.7.99, HAVE_MYTHTV="yes", [ HAVE_MYTHTV="no" - AC_MSG_RESULT(no) ]) AC_SUBST(GMYTH_CFLAGS) AC_SUBST(GMYTH_LIBS) @@ -1231,7 +1327,6 @@ translit(dnm, m, l) AM_CONDITIONAL(USE_NEON, true) AG_GST_CHECK_FEATURE(NEON, [neon http client plugins], neonhttpsrc, [ PKG_CHECK_MODULES(NEON, neon >= 0.27.0 neon <= 0.29.99, HAVE_NEON="yes", [ HAVE_NEON="no" - AC_MSG_RESULT(no) ]) AC_SUBST(NEON_CFLAGS) AC_SUBST(NEON_LIBS) @@ -1242,12 +1337,21 @@ translit(dnm, m, l) AM_CONDITIONAL(USE_OFA, true) AG_GST_CHECK_FEATURE(OFA, [ofa plugins], ofa, [ PKG_CHECK_MODULES(OFA, libofa >= 0.9.3, HAVE_OFA="yes", [ HAVE_OFA="no" - AC_MSG_RESULT(no) ]) AC_SUBST(OFA_CFLAGS) AC_SUBST(OFA_LIBS) ]) +dnl *** OpenAL *** +translit(dnm, m, l) AM_CONDITIONAL(USE_OPENAL, true) +AG_GST_CHECK_FEATURE(OPENAL, [OpenAL plugin], openal, [ + PKG_CHECK_MODULES(OPENAL, openal, HAVE_OPENAL="yes", [ + HAVE_OPENAL="no" + ]) + AC_SUBST(OPENAL_CFLAGS) + AC_SUBST(OPENAL_LIBS) +]) + dnl *** opencv *** translit(dnm, m, l) AM_CONDITIONAL(USE_OPENCV, true) AG_GST_CHECK_FEATURE(OPENCV, [opencv plugins], opencv, [ @@ -1257,7 +1361,7 @@ AG_GST_CHECK_FEATURE(OPENCV, [opencv plugins], opencv, [ dnl a new version and the no-backward-compatibility define. (There doesn't dnl seem to be a switch to suppress the warnings the cvcompat.h header dnl causes.) - PKG_CHECK_MODULES(OPENCV, opencv >= 2.0.0 opencv <= 2.1.0 , [ + PKG_CHECK_MODULES(OPENCV, opencv >= 2.0.0 opencv <= 2.2.0 , [ AC_PROG_CXX AC_LANG_CPLUSPLUS OLD_CPPFLAGS=$CPPFLAGS @@ -1277,7 +1381,6 @@ AG_GST_CHECK_FEATURE(OPENCV, [opencv plugins], opencv, [ fi ], [ HAVE_OPENCV="no" - AC_MSG_RESULT(no) ]) AC_SUBST(OPENCV_CFLAGS) AC_SUBST(OPENCV_LIBS) @@ -1288,7 +1391,6 @@ translit(dnm, m, l) AM_CONDITIONAL(USE_RSVG, true) AG_GST_CHECK_FEATURE(RSVG, [rsvg decoder], rsvg, [ PKG_CHECK_MODULES(RSVG, librsvg-2.0 >= 2.14 cairo, HAVE_RSVG="yes", [ HAVE_RSVG="no" - AC_MSG_RESULT(no) ]) AC_SUBST(RSVG_CFLAGS) AC_SUBST(RSVG_LIBS) @@ -1318,12 +1420,17 @@ AG_GST_CHECK_FEATURE(TIMIDITY, [timidity midi soft synth plugin], timidity, [ fi ], [ HAVE_TIMIDITY="no" - AC_MSG_RESULT(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, [ + AG_GST_PKG_CHECK_MODULES(TELETEXTDEC, zvbi-0.2) + ]) + dnl *** wildmidi *** translit(dnm, m, l) AM_CONDITIONAL(USE_WILDMIDI, true) AG_GST_CHECK_FEATURE(WILDMIDI, [wildmidi midi soft synth plugin], wildmidi, [ @@ -1374,7 +1481,7 @@ AG_GST_CHECK_FEATURE(SOUNDTOUCH, [soundtouch plug-in], soundtouch, [ [PKG_CHECK_MODULES(SOUNDTOUCH, soundtouch-1.0, [HAVE_SOUNDTOUCH=yes HAVE_SOUNDTOUCH_1_4=no - SOUNDTOUCH_LIBS="$SOUNDTOUCH_LIBS -lBPM"], + SOUNDTOUCH_LIBS="$SOUNDTOUCH_LIBS -lBPM"], [PKG_CHECK_MODULES(SOUNDTOUCH, libSoundTouch >= 1.4, [HAVE_SOUNDTOUCH=yes], [PKG_CHECK_MODULES(SOUNDTOUCH, libSoundTouch, @@ -1437,23 +1544,11 @@ translit(dnm, m, l) AM_CONDITIONAL(USE_SWFDEC, true) AG_GST_CHECK_FEATURE(SWFDEC, [swfdec plug-in], swfdec, [ PKG_CHECK_MODULES(SWFDEC, swfdec-0.3 >= 0.3.6, HAVE_SWFDEC=yes, [ HAVE_SWFDEC=no - AC_MSG_RESULT(no) ]) AC_SUBST(SWFDEC_CFLAGS) AC_SUBST(SWFDEC_LIBS) ]) -dnl *** theora *** -translit(dnm, m, l) AM_CONDITIONAL(USE_THEORADEC, true) -AG_GST_CHECK_FEATURE(THEORADEC, [ogg theora codec], theoraexpdec, [ - PKG_CHECK_MODULES(THEORADEC, theoradec, HAVE_THEORADEC="yes", [ - HAVE_THEORADEC="no" - AC_MSG_RESULT(no) - ]) - AC_SUBST(THEORADEC_LIBS) - AC_SUBST(THEORADEC_CFLAGS) -]) - dnl *** XVID *** translit(dnm, m, l) AM_CONDITIONAL(USE_XVID, true) AG_GST_CHECK_FEATURE(XVID, [xvid plugins], xvid, [ @@ -1521,7 +1616,7 @@ AG_GST_CHECK_FEATURE(VDPAU, [VDPAU], vdpau, [ if test "$HAVE_VDPAU" = "no"; then saved_CPPFLAGS="$CPPFLAGS" AC_CHECK_HEADER([vdpau/vdpau.h], [HAVE_VDPAU_H=yes]) - + if test -z "$HAVE_VDPAU_H"; then dnl Didn't find VDPAU header straight away. dnl Try /usr/include/nvidia. Need to clear caching vars first @@ -1533,9 +1628,9 @@ AG_GST_CHECK_FEATURE(VDPAU, [VDPAU], vdpau, [ CPPFLAGS="$VDPAU_CFLAGS $saved_CPPFLAGS" AC_CHECK_HEADER([vdpau/vdpau.h], [HAVE_VDPAU_H=yes]) fi - + AC_CHECK_HEADER([vdpau/vdpau_x11.h], [HAVE_VDPAU_X11_H=yes]) - + if test "x$HAVE_VDPAU_H" = "xyes" -a "x$HAVE_VDPAU_X11_H" = "xyes"; then dnl Found the headers - look for the lib AC_MSG_NOTICE([VDPAU headers found. Checking libraries]) @@ -1614,7 +1709,8 @@ dnl not building plugins with external dependencies, dnl but we still need to set the conditionals AM_CONDITIONAL(USE_ASSRENDER, false) -AM_CONDITIONAL(USE_AMRWB, false) +AM_CONDITIONAL(USE_VOAMRWBENC, false) +AM_CONDITIONAL(USE_VOAACENC, false) AM_CONDITIONAL(USE_APEXSINK, false) AM_CONDITIONAL(USE_BZ2, false) AM_CONDITIONAL(USE_CDAUDIO, false) @@ -1622,6 +1718,7 @@ AM_CONDITIONAL(USE_CELT, false) AM_CONDITIONAL(USE_COG, false) AM_CONDITIONAL(USE_CURL, false) AM_CONDITIONAL(USE_DC1394, false) +AM_CONDITIONAL(USE_DECKLINK, false) AM_CONDITIONAL(USE_DIRECTFB, false) AM_CONDITIONAL(USE_DIRAC, false) AM_CONDITIONAL(USE_DTS, false) @@ -1639,6 +1736,7 @@ AM_CONDITIONAL(USE_TIGER, false) AM_CONDITIONAL(USE_LADSPA, false) AM_CONDITIONAL(USE_LV2, false) AM_CONDITIONAL(USE_LIBMMS, false) +AM_CONDITIONAL(USE_LINSYS, false) AM_CONDITIONAL(USE_MODPLUG, false) AM_CONDITIONAL(USE_MIMIC, false) AM_CONDITIONAL(USE_MPEG2ENC, false) @@ -1649,6 +1747,7 @@ AM_CONDITIONAL(USE_MYTHTV, false) AM_CONDITIONAL(USE_NAS, false) AM_CONDITIONAL(USE_NEON, false) AM_CONDITIONAL(USE_OFA, false) +AM_CONDITIONAL(USE_OPENAL, false) AM_CONDITIONAL(USE_OPENCV, false) AM_CONDITIONAL(USE_RSVG, false) AM_CONDITIONAL(USE_TIMIDITY, false) @@ -1660,7 +1759,6 @@ AM_CONDITIONAL(USE_SPC, false) AM_CONDITIONAL(USE_GME, false) AM_CONDITIONAL(USE_GSETTINGS, false) AM_CONDITIONAL(USE_SWFDEC, false) -AM_CONDITIONAL(USE_THEORADEC, false) AM_CONDITIONAL(USE_XVID, false) AM_CONDITIONAL(USE_DVB, false) AM_CONDITIONAL(USE_WININET, false) @@ -1670,6 +1768,7 @@ AM_CONDITIONAL(USE_SCHRO, false) AM_CONDITIONAL(USE_ZBAR, false) AM_CONDITIONAL(USE_VP8, false) AM_CONDITIONAL(USE_RTMP, false) +AM_CONDITIONAL(USE_TELETEXTDEC, false) fi dnl of EXT plugins @@ -1749,7 +1848,7 @@ gst/adpcmdec/Makefile gst/adpcmenc/Makefile gst/aiff/Makefile gst/asfmux/Makefile -gst/audioparsers/Makefile +gst/audiovisualizers/Makefile gst/autoconvert/Makefile gst/bayer/Makefile gst/camerabin/Makefile @@ -1763,6 +1862,7 @@ gst/debugutils/Makefile gst/dtmf/Makefile gst/dvbsuboverlay/Makefile gst/dvdspu/Makefile +gst/faceoverlay/Makefile gst/festival/Makefile gst/fieldanalysis/Makefile gst/freeze/Makefile @@ -1771,9 +1871,9 @@ gst/gaudieffects/Makefile gst/geometrictransform/Makefile gst/h264parse/Makefile gst/hdvparse/Makefile +gst/hls/Makefile gst/id3tag/Makefile gst/interlace/Makefile -gst/invtelecine/Makefile gst/ivfparse/Makefile gst/jp2kdecimator/Makefile gst/jpegformat/Makefile @@ -1791,14 +1891,15 @@ gst/mve/Makefile gst/mxf/Makefile gst/nsf/Makefile gst/nuvdemux/Makefile +gst/patchdetect/Makefile gst/pcapparse/Makefile gst/pnm/Makefile -gst/qtmux/Makefile gst/rawparse/Makefile gst/real/Makefile gst/rtpmux/Makefile gst/rtpvp8/Makefile gst/scaletempo/Makefile +gst/sdi/Makefile gst/sdp/Makefile gst/segmentclip/Makefile gst/siren/Makefile @@ -1816,7 +1917,6 @@ gst/y4m/Makefile gst-libs/Makefile gst-libs/gst/Makefile gst-libs/gst/basecamerabinsrc/Makefile -gst-libs/gst/baseparse/Makefile gst-libs/gst/interfaces/Makefile gst-libs/gst/signalprocessor/Makefile gst-libs/gst/video/Makefile @@ -1825,12 +1925,16 @@ sys/dshowdecwrapper/Makefile sys/acmenc/Makefile sys/acmmp3dec/Makefile sys/applemedia/Makefile +sys/avc/Makefile +sys/d3dvideosink/Makefile +sys/decklink/Makefile sys/directdraw/Makefile sys/directsound/Makefile sys/dshowsrcwrapper/Makefile sys/dshowvideosink/Makefile sys/dvb/Makefile sys/fbdev/Makefile +sys/linsys/Makefile sys/osxvideo/Makefile sys/qtwrapper/Makefile sys/shm/Makefile @@ -1852,7 +1956,8 @@ tests/examples/directfb/Makefile tests/examples/mxf/Makefile tests/examples/scaletempo/Makefile tests/icles/Makefile -ext/amrwbenc/Makefile +ext/voamrwbenc/Makefile +ext/voaacenc/Makefile ext/assrender/Makefile ext/apexsink/Makefile ext/bz2/Makefile @@ -1885,6 +1990,7 @@ ext/mythtv/Makefile ext/nas/Makefile ext/neon/Makefile ext/ofa/Makefile +ext/openal/Makefile ext/opencv/Makefile ext/rsvg/Makefile ext/resindvd/Makefile @@ -1893,12 +1999,12 @@ ext/schroedinger/Makefile ext/sdl/Makefile ext/sndfile/Makefile ext/soundtouch/Makefile +ext/teletextdec/Makefile ext/gme/Makefile ext/gsettings/Makefile ext/gsettings/org.freedesktop.gstreamer.default-elements.gschema.xml ext/spc/Makefile ext/swfdec/Makefile -ext/theora/Makefile ext/timidity/Makefile ext/vp8/Makefile ext/xvid/Makefile diff --git a/docs/plugins/Makefile.am b/docs/plugins/Makefile.am index 0d124a74b6..e6bbb5c5fa 100644 --- a/docs/plugins/Makefile.am +++ b/docs/plugins/Makefile.am @@ -44,11 +44,6 @@ DOC_SOURCE_DIR = $(top_srcdir) # Extra options to supply to gtkdoc-scan. SCAN_OPTIONS= -# FIXME : -# there's something wrong with gstreamer-sections.txt not being in the dist -# maybe it doesn't resolve; we're adding it below for now -#EXTRA_DIST = gstreamer.types.in gstreamer.hierarchy $(DOC_MODULE)-sections.txt gstreamer-sections.txt $(DOC_MAIN_SGML_FILE) - # Extra options to supply to gtkdoc-mkdb. MKDB_OPTIONS=--sgml-mode --source-suffixes=c,h,cc,m @@ -91,7 +86,6 @@ EXAMPLE_CFILES = \ EXTRA_HFILES = \ $(top_srcdir)/ext/assrender/gstassrender.h \ - $(top_srcdir)/ext/amrwbenc/gstamrwbenc.h \ $(top_srcdir)/ext/celt/gstceltdec.h \ $(top_srcdir)/ext/celt/gstceltenc.h \ $(top_srcdir)/ext/curl/gstcurlsink.h \ @@ -124,26 +118,26 @@ EXTRA_HFILES = \ $(top_srcdir)/ext/opencv/gstfacedetect.h \ $(top_srcdir)/ext/opencv/gstpyramidsegment.h \ $(top_srcdir)/ext/opencv/gsttemplatematch.h \ - $(top_srcdir)/ext/opencv/gsttextwrite.h \ + $(top_srcdir)/ext/opencv/gsttextoverlay.h \ $(top_srcdir)/ext/rsvg/gstrsvgdec.h \ $(top_srcdir)/ext/rsvg/gstrsvgoverlay.h \ $(top_srcdir)/ext/sdl/sdlaudiosink.h \ $(top_srcdir)/ext/sdl/sdlvideosink.h \ - $(top_srcdir)/ext/theora/theoradec.h \ $(top_srcdir)/ext/timidity/gsttimidity.h \ $(top_srcdir)/ext/timidity/gstwildmidi.h \ + $(top_srcdir)/ext/voaacenc/gstvoaacenc.h \ + $(top_srcdir)/ext/voamrwbenc/gstvoamrwbenc.h \ $(top_srcdir)/ext/vp8/gstvp8enc.h \ $(top_srcdir)/ext/vp8/gstvp8dec.h \ $(top_srcdir)/ext/zbar/gstzbar.h \ $(top_srcdir)/gst/aiff/aiffparse.h \ $(top_srcdir)/gst/aiff/aiffmux.h \ - $(top_srcdir)/gst/audioparsers/gstaacparse.h \ - $(top_srcdir)/gst/audioparsers/gstac3parse.h \ - $(top_srcdir)/gst/audioparsers/gstamrparse.h \ - $(top_srcdir)/gst/audioparsers/gstflacparse.h \ - $(top_srcdir)/gst/audioparsers/gstdcaparse.h \ - $(top_srcdir)/gst/audioparsers/gstmpegaudioparse.h \ $(top_srcdir)/gst/autoconvert/gstautoconvert.h \ + $(top_srcdir)/gst/audiovisualizers/gstbaseaudiovisualizer.h \ + $(top_srcdir)/gst/audiovisualizers/gstspacescope.h \ + $(top_srcdir)/gst/audiovisualizers/gstspectrascope.h \ + $(top_srcdir)/gst/audiovisualizers/gstsynaescope.h \ + $(top_srcdir)/gst/audiovisualizers/gstwavescope.h \ $(top_srcdir)/gst/camerabin/gstcamerabin.h \ $(top_srcdir)/gst/coloreffects/gstcoloreffects.h \ $(top_srcdir)/gst/dataurisrc/gstdataurisrc.h \ @@ -189,7 +183,6 @@ EXTRA_HFILES = \ $(top_srcdir)/gst/mxf/mxfmux.h \ $(top_srcdir)/gst/nuvdemux/gstnuvdemux.h \ $(top_srcdir)/gst/pcapparse/gstpcapparse.h \ - $(top_srcdir)/gst/qtmux/gstqtmux.h \ $(top_srcdir)/gst/rawparse/gstaudioparse.h \ $(top_srcdir)/gst/rawparse/gstvideoparse.h \ $(top_srcdir)/gst/rtpmux/gstrtpmux.h \ diff --git a/docs/plugins/gst-plugins-bad-plugins-docs.sgml b/docs/plugins/gst-plugins-bad-plugins-docs.sgml index 8cbad1e7db..17acb5739b 100644 --- a/docs/plugins/gst-plugins-bad-plugins-docs.sgml +++ b/docs/plugins/gst-plugins-bad-plugins-docs.sgml @@ -17,12 +17,8 @@ gst-plugins-bad Elements - - - - @@ -42,7 +38,6 @@ - @@ -65,7 +60,6 @@ - @@ -84,7 +78,6 @@ - @@ -94,7 +87,6 @@ - @@ -108,14 +100,16 @@ + + + - - + @@ -129,17 +123,19 @@ + + + gst-plugins-bad Plugins - + - @@ -194,8 +190,8 @@ + - @@ -219,6 +215,8 @@ + + diff --git a/docs/plugins/gst-plugins-bad-plugins-sections.txt b/docs/plugins/gst-plugins-bad-plugins-sections.txt index 98e3264d69..5efe2c1166 100644 --- a/docs/plugins/gst-plugins-bad-plugins-sections.txt +++ b/docs/plugins/gst-plugins-bad-plugins-sections.txt @@ -1,31 +1,3 @@ -
-element-aacparse -aacparse -GstAacParse - -GstAacParseClass -GST_AACPARSE -GST_AACPARSE_CLASS -GST_IS_AACPARSE -GST_IS_AACPARSE_CLASS -GST_TYPE_AACPARSE -gst_aacparse_get_type -
- -
-element-ac3parse -ac3parse -GstAc3Parse - -GstAc3ParseClass -GST_AC3_PARSE -GST_AC3_PARSE_CLASS -GST_IS_AC3_PARSE -GST_IS_AC3_PARSE_CLASS -GST_TYPE_AC3_PARSE -gst_ac3_parse_get_type -
-
element-aiffmux aiffmux @@ -56,31 +28,31 @@ gst_aiff_parse_get_type
-element-amrparse -amrparse -GstAmrParse +element-voaacenc +voaacenc +GstVoAacEnc -GstAmrParseClass -GST_AMRPARSE -GST_AMRPARSE_CLASS -GST_IS_AMRPARSE -GST_IS_AMRPARSE_CLASS -GST_TYPE_AMRPARSE -gst_amrparse_get_type +GstVoAacEncClass +GST_VOAACENC +GST_VOAACENC_CLASS +GST_IS_VOAACENC +GST_IS_VOAACENC_CLASS +GST_TYPE_VOAACENC +gst_voaacenc_get_type
-element-amrwbenc -amrwbenc -GstAmrwbEnc +element-voamrwbenc +voamrwbenc +GstVoAmrwbEnc -GstAmrwbEncClass -GST_AMRWBENC -GST_AMRWBENC_CLASS -GST_IS_AMRWBENC -GST_IS_AMRWBENC_CLASS -GST_TYPE_AMRWBENC -gst_amrwbenc_get_type +GstVoAmrwbEncClass +GST_VOAMRWBENC +GST_VOAMRWBENC_CLASS +GST_IS_VOAMRWBENC +GST_IS_VOAMRWBENC_CLASS +GST_TYPE_VOAMRWBENC +gst_voamrwbenc_get_type
@@ -377,20 +349,6 @@ GST_TYPE_DC1394 gst_dc1394_get_type
-
-element-dcaparse -dcaparse -GstDCAParse - -GstDCAParseClass -GST_DCA_PARSE -GST_DCA_PARSE_CLASS -GST_IS_DCA_PARSE -GST_IS_DCA_PARSE_CLASS -GST_TYPE_DCA_PARSE -gst_dca_parse_get_type -
-
element-dccpclientsink dccpclientsink @@ -751,20 +709,6 @@ gst_fisheye_get_type gst_fisheye_plugin_init
-
-element-flacparse -flacparse -GstFlacParse - -GstFlacParseClass -GST_FLAC_PARSE -GST_FLAC_PARSE_CLASS -GST_IS_FLAC_PARSE -GST_IS_FLAC_PARSE_CLASS -GST_TYPE_FLAC_PARSE -gst_flac_parse_get_type -
-
element-fpsdisplaysink fpsdisplaysink @@ -1034,20 +978,6 @@ GST_TYPE_MODPLUG gst_modplug_get_type
-
-element-mpegaudioparse -mpegaudioparse -GstMpegAudioParse - -GstMpegAudioParseClass -GST_MPEG_AUDIO_PARSE -GST_MPEG_AUDIO_PARSE_CLASS -GST_IS_MPEG_AUDIO_PARSE -GST_IS_MPEG_AUDIO_PARSE_CLASS -GST_TYPE_MPEG_AUDIO_PARSE -gst_mpeg_audio_parse_get_type -
-
element-mpeg2enc mpeg2enc @@ -1143,6 +1073,20 @@ GST_TYPE_NUV_DEMUX gst_nuv_demux_get_type
+element-opencvtextoverlay +opencvtextoverlay +GstOpencvTextOverlay + +GstOpencvTextOverlayClass +GST_OPENCV_TEXT_OVERLAY +GST_OPENCV_TEXT_OVERLAY_CLASS +GST_TYPE_OPENCV_TEXT_OVERLAY +GST_IS_OPENCV_TEXT_OVERLAY +GST_IS_OPENCV_TEXT_OVERLAY_CLASS +gst_opencv_text_overlay_get_type +gst_opencv_text_overlay_plugin_init + +
element-pcapparse pcapparse @@ -1188,20 +1132,6 @@ gst_pyramidsegment_get_type gst_pyramidsegment_plugin_init
-
-element-qtmux -qtmux -GstQTMux - -GstQTMuxClass -GST_QT_MUX -GST_QT_MUX_CLASS -GST_IS_QT_MUX -GST_IS_QT_MUX_CLASS -GST_TYPE_QT_MUX -gst_qt_mux_get_type -
-
element-rsvgoverlay rsvgoverlay @@ -1402,6 +1332,34 @@ gst_solarize_get_type gst_solarize_plugin_init
+
+element-spacescope +spacescope +GstSpaceScope + +GstSpaceScopeClass +GST_SPACE_SCOPE +GST_SPACE_SCOPE_CLASS +GST_IS_SPACE_SCOPE +GST_IS_SPACE_SCOPE_CLASS +GST_TYPE_SPACE_SCOPE +gst_space_scope_get_type +
+ +
+element-spectrascope +spectrascope +GstSpectraScope + +GstSpectraScopeClass +GST_SPECTRA_SCOPE +GST_SPECTRA_SCOPE_CLASS +GST_IS_SPECTRA_SCOPE +GST_IS_SPECTRA_SCOPE_CLASS +GST_TYPE_SPECTRA_SCOPE +gst_spectra_scope_get_type +
+
element-speed speed @@ -1479,6 +1437,20 @@ gst_stretch_get_type gst_stretch_plugin_init
+
+element-synaescope +synaescope +GstSynaeScope + +GstSynaeScopeClass +GST_SYNAE_SCOPE +GST_SYNAE_SCOPE_CLASS +GST_IS_SYNAE_SCOPE +GST_IS_SYNAE_SCOPE_CLASS +GST_TYPE_SYNAE_SCOPE +gst_synae_scope_get_type +
+ element-templatematch templatematch GstTemplateMatch @@ -1493,33 +1465,6 @@ gst_templatematch_get_type gst_templatematch_plugin_init -element-textwrite -textwrite -Gsttextwrite - -GsttextwriteClass -GST_textwrite -GST_textwrite_CLASS -GST_TYPE_textwrite -GST_IS_textwrite -GST_IS_textwrite_CLASS -gst_textwrite_get_type -gst_textwrite_plugin_init - - -
-element-theoradecexp -theoradecexp -GstTheoraExpDec - -GstTheoraExpDecClass -GST_THEORA_DEC_EXP -GST_THEORA_DEC_EXP_CLASS -GST_IS_THEORA_DEC_EXP -GST_IS_THEORA_DEC_EXP_CLASS -GST_TYPE_THEORA_DEC_EXP -
-
element-timidity timidity @@ -1667,6 +1612,20 @@ gst_water_ripple_get_type gst_water_ripple_plugin_init
+
+element-wavescope +wavescope +GstWaveScope + +GstWaveScopeClass +GST_WAVE_SCOPE +GST_WAVE_SCOPE_CLASS +GST_IS_WAVE_SCOPE +GST_IS_WAVE_SCOPE_CLASS +GST_TYPE_WAVE_SCOPE +gst_wave_scope_get_type +
+
element-wildmidi wildmidi diff --git a/docs/plugins/gst-plugins-bad-plugins.args b/docs/plugins/gst-plugins-bad-plugins.args index a446e82c39..f0778aac54 100644 --- a/docs/plugins/gst-plugins-bad-plugins.args +++ b/docs/plugins/gst-plugins-bad-plugins.args @@ -41,7 +41,7 @@ GstXvidEnc::averaging-period gint -[G_MAXULONG,100] +[-1,100] rw Averaging Period [CBR] Number of frames for which XviD averages bitrate. @@ -91,7 +91,7 @@ GstXvidEnc::buffer gint ->= G_MAXULONG +>= -1 rw Buffer Size [CBR] Size of the video buffers. @@ -121,7 +121,7 @@ GstXvidEnc::container-frame-overhead gint -[G_MAXULONG,100] +[-1,100] rw Container Frame Overhead [PASS2] Average container overhead per frame. @@ -151,7 +151,7 @@ GstXvidEnc::flow-control-strength gint -[G_MAXULONG,100] +[-1,100] rw Flow Control Strength [PASS2] Overflow control strength per frame. @@ -211,7 +211,7 @@ GstXvidEnc::keyframe-reduction gint -[G_MAXULONG,100] +[-1,100] rw Keyframe Reduction [PASS2] Keyframe size reduction in % of those within threshold. @@ -221,7 +221,7 @@ GstXvidEnc::keyframe-threshold gint -[G_MAXULONG,100] +[-1,100] rw Keyframe Threshold [PASS2] Distance between keyframes not to be subject to reduction. @@ -281,7 +281,7 @@ GstXvidEnc::max-overflow-degradation gint -[G_MAXULONG,100] +[-1,100] rw Max Overflow Degradation [PASS2] Amount in % that flow control can decrease frame size compared to ideal curve. @@ -291,7 +291,7 @@ GstXvidEnc::max-overflow-improvement gint -[G_MAXULONG,100] +[-1,100] rw Max Overflow Improvement [PASS2] Amount in % that flow control can increase frame size compared to ideal curve. @@ -421,7 +421,7 @@ GstXvidEnc::reaction-delay-factor gint -[G_MAXULONG,100] +[-1,100] rw Reaction Delay Factor [CBR] Reaction delay factor. @@ -650,7 +650,7 @@ GstNeonhttpSrc::cookies -GStrv* +GStrv rw Cookies @@ -1701,7 +1701,7 @@ GstDvbSrc::diseqc-source gint -[G_MAXULONG,7] +[-1,7] rw diseqc source DISEqC selected source (-1 disabled) (DVB-S). @@ -1758,6 +1758,16 @@ 100 + +GstDvbSrc::timeout +guint64 + +rw +Timeout +Post a message after timeout microseconds (0 = disabled). +1000000 + + GstRfbSrc::host gchar* @@ -1935,7 +1945,7 @@ rwx damping damping. -0,75 +0.75 @@ -1945,17 +1955,17 @@ rwx volume volume. -0,5 +0.5 ladspa-Plate2x2::bandwidth gfloat -[0,005,0,999] +[0.005,0.999] rwx bandwidth bandwidth. -0,502 +0.502 @@ -1965,37 +1975,37 @@ rwx blend blend. -0,25 +0.25 ladspa-Plate2x2::damping gfloat -[0,0005,1] +[0.0005,1] rwx damping damping. -0,250375 +0.250375 ladspa-Plate2x2::tail gfloat -[0,0,749] +[0,0.749] rwx tail tail. -0,3745 +0.3745 ladspa-Plate::bandwidth gfloat -[0,005,0,999] +[0.005,0.999] rwx bandwidth bandwidth. -0,502 +0.502 @@ -2005,47 +2015,47 @@ rwx blend blend. -0,25 +0.25 ladspa-Plate::damping gfloat -[0,0005,1] +[0.0005,1] rwx damping damping. -0,250375 +0.250375 ladspa-Plate::tail gfloat -[0,0,749] +[0,0.749] rwx tail tail. -0,3745 +0.3745 ladspa-JVRev::blend gfloat -[0,0,28] +[0,0.28] rwx blend blend. -0,07 +0.07 ladspa-JVRev::t60 gfloat -[0,4,6] +[0,4.6] rwx t60 t60. -2,3 +2.3 @@ -2065,7 +2075,7 @@ rwx volume volume. -0,5 +0.5 @@ -2085,7 +2095,7 @@ rwx y y. -0,5 +0.5 @@ -2115,7 +2125,7 @@ rwx volume volume. -0,5 +0.5 @@ -2155,13 +2165,13 @@ rwx volume volume. -0,5 +0.5 ladspa-Sin::f gfloat -[0,0001,20000] +[0.0001,20000] rwx f f. @@ -2175,7 +2185,7 @@ rwx volume volume. -0,5 +0.5 @@ -2205,7 +2215,7 @@ rwx volume volume. -0,5 +0.5 @@ -2215,7 +2225,7 @@ rwx blend blend. -0,5 +0.5 @@ -2305,7 +2315,7 @@ rwx volume volume. -0,5 +0.5 @@ -2355,7 +2365,7 @@ rwx volume volume. -0,5 +0.5 @@ -2365,7 +2375,7 @@ rwx blend blend. -0,75 +0.75 @@ -2375,7 +2385,7 @@ rwx bpm bpm. -82,5 +82.5 @@ -2395,7 +2405,7 @@ rwx dry dry. -0,25 +0.25 @@ -2405,17 +2415,17 @@ rwx feedback feedback. -0,25 +0.25 ladspa-SweepVFII::Q gfloat -[0,001,0,999] +[0.001,0.999] rwx Q Q. -0,5 +0.5 @@ -2425,7 +2435,7 @@ rwx Q-depth-x Q-depth-x. -0,25 +0.25 @@ -2435,7 +2445,7 @@ rwx Q-depth-y Q-depth-y. -0,5 +0.5 @@ -2451,11 +2461,11 @@ ladspa-SweepVFII::Q-h gfloat -[0,001,1] +[0.001,1] rwx Q-h Q-h. -0,25075 +0.25075 @@ -2465,7 +2475,7 @@ rwx f f. -209,717 +209.717 @@ -2475,7 +2485,7 @@ rwx f-depth-x f-depth-x. -0,25 +0.25 @@ -2485,7 +2495,7 @@ rwx f-depth-y f-depth-y. -0,5 +0.5 @@ -2501,11 +2511,11 @@ ladspa-SweepVFII::f-h gfloat -[0,001,1] +[0.001,1] rwx f-h f-h. -0,25075 +0.25075 @@ -2521,11 +2531,11 @@ ladspa-SweepVFI::Q gfloat -[0,001,0,999] +[0.001,0.999] rwx Q Q. -0,5 +0.5 @@ -2535,7 +2545,7 @@ rwx depth-x depth-x. -0,25 +0.25 @@ -2545,7 +2555,7 @@ rwx depth-y depth-y. -0,5 +0.5 @@ -2565,17 +2575,17 @@ rwx f f. -209,717 +209.717 ladspa-SweepVFI::h gfloat -[0,001,1] +[0.001,1] rwx h h. -0,25075 +0.25075 @@ -2595,17 +2605,17 @@ rwx depth depth. -0,75 +0.75 ladspa-PhaserII::feedback gfloat -[0,0,999] +[0,0.999] rwx feedback feedback. -0,74925 +0.74925 @@ -2615,17 +2625,17 @@ rwx rate rate. -0,25 +0.25 ladspa-PhaserII::spread gfloat -[0,1,5708] +[0,1.5708] rwx spread spread. -0,392699 +0.392699 @@ -2635,17 +2645,17 @@ rwx depth depth. -0,75 +0.75 ladspa-PhaserI::feedback gfloat -[0,0,999] +[0,0.999] rwx feedback feedback. -0,74925 +0.74925 @@ -2661,11 +2671,11 @@ ladspa-PhaserI::spread gfloat -[0,3,14159] +[0,3.14159] rwx spread spread. -0,785398 +0.785398 @@ -2695,7 +2705,7 @@ rwx feedforward feedforward. -0,5 +0.5 @@ -2705,27 +2715,27 @@ rwx rate rate. -0,25 +0.25 ladspa-StereoChorusII::t gfloat -[2,5,40] +[2.5,40] rwx t t. -11,875 +11.875 ladspa-StereoChorusII::width gfloat -[0,5,10] +[0.5,10] rwx width width. -2,875 +2.875 @@ -2755,7 +2765,7 @@ rwx feedforward feedforward. -0,25 +0.25 @@ -2765,13 +2775,13 @@ rwx rate rate. -0,25 +0.25 ladspa-ChorusII::t gfloat -[2,5,40] +[2.5,40] rwx t t. @@ -2781,7 +2791,7 @@ ladspa-ChorusII::width gfloat -[0,5,10] +[0.5,10] rwx width width. @@ -2815,7 +2825,7 @@ rwx feedforward feedforward. -0,25 +0.25 @@ -2835,23 +2845,23 @@ rwx rate rate. -1,25 +1.25 ladspa-StereoChorusI::t gfloat -[2,5,40] +[2.5,40] rwx t t. -2,5 +2.5 ladspa-StereoChorusI::width gfloat -[0,5,10] +[0.5,10] rwx width width. @@ -2885,7 +2895,7 @@ rwx feedforward feedforward. -0,25 +0.25 @@ -2895,13 +2905,13 @@ rwx rate rate. -1,25 +1.25 ladspa-ChorusI::t gfloat -[2,5,40] +[2.5,40] rwx t t. @@ -2911,7 +2921,7 @@ ladspa-ChorusI::width gfloat -[0,5,10] +[0.5,10] rwx width width. @@ -2935,7 +2945,7 @@ r latency latency. --3,40282e+38 +-3.40282e+38 @@ -2951,7 +2961,7 @@ ladspa-CabinetII::model gint -[0,5] +[0,7] rwx model model. @@ -2991,11 +3001,11 @@ ladspa-AmpV::drive gfloat -[0,0001,1] +[0.0001,1] rwx drive drive. -0,750025 +0.750025 @@ -3015,7 +3025,7 @@ r latency latency. --3,40282e+38 +-3.40282e+38 @@ -3035,7 +3045,7 @@ rwx watts watts. -77,5 +77.5 @@ -3051,7 +3061,7 @@ ladspa-AmpIV::drive gfloat -[0,0001,1] +[0.0001,1] rwx drive drive. @@ -3085,7 +3095,7 @@ r latency latency. --3,40282e+38 +-3.40282e+38 @@ -3101,11 +3111,11 @@ ladspa-AmpIV::temperature gfloat -[0,005,1] +[0.005,1] rwx temperature temperature. -0,5025 +0.5025 @@ -3121,7 +3131,7 @@ ladspa-AmpIII::drive gfloat -[0,0001,1] +[0.0001,1] rwx drive drive. @@ -3145,17 +3155,17 @@ r latency latency. --3,40282e+38 +-3.40282e+38 ladspa-AmpIII::temperature gfloat -[0,005,1] +[0.005,1] rwx temperature temperature. -0,5025 +0.5025 @@ -3195,7 +3205,7 @@ r latency latency. --3,40282e+38 +-3.40282e+38 @@ -3211,11 +3221,11 @@ ladspa-PreampIV::temperature gfloat -[0,005,1] +[0.005,1] rwx temperature temperature. -0,5025 +0.5025 @@ -3245,17 +3255,17 @@ r latency latency. --3,40282e+38 +-3.40282e+38 ladspa-PreampIII::temperature gfloat -[0,005,1] +[0.005,1] rwx temperature temperature. -0,25375 +0.25375 @@ -3281,11 +3291,11 @@ ladspa-Pan::t gfloat -[0,1,40] +[0.1,40] rwx t t. -10,075 +10.075 @@ -3301,11 +3311,11 @@ ladspa-Compress::attack gfloat -[0,001,1] +[0.001,1] rwx attack attack. -0,001 +0.001 @@ -3325,7 +3335,7 @@ rwx knee-radius knee-radius. -3,25 +3.25 @@ -3341,11 +3351,11 @@ ladspa-Compress::release gfloat -[0,001,1] +[0.001,1] rwx release release. -0,5005 +0.5005 @@ -3415,7 +3425,7 @@ rwx param-31-Hz param-31-Hz. --30 +0 @@ -3475,7 +3485,7 @@ rwx Slope Slope. -0,5 +0.5 @@ -3515,13 +3525,13 @@ rwx Slope Slope. -0,5 +0.5 ladspa-tracker-gaacdcia-oa::Attack-Rate gfloat -[0,91875,22050] +[0.91875,22050] rwx Attack-Rate Attack-Rate. @@ -3531,7 +3541,7 @@ ladspa-tracker-gaacdcia-oa::Attack-Rate-1 gfloat -[0,91875,22050] +[0.91875,22050] rwx Attack-Rate-1 Attack-Rate-1. @@ -3541,7 +3551,7 @@ ladspa-tracker-gaacdcia-oa::Decay-Rate gfloat -[0,91875,22050] +[0.91875,22050] rwx Decay-Rate Decay-Rate. @@ -3551,7 +3561,7 @@ ladspa-tracker-gaacdcia-oa::Decay-Rate-1 gfloat -[0,91875,22050] +[0.91875,22050] rwx Decay-Rate-1 Decay-Rate-1. @@ -3595,7 +3605,7 @@ rwx Closed-Gate-Value Closed-Gate-Value. --3,40282e+38 +-3.40282e+38 @@ -3625,7 +3635,7 @@ rwx Value-Step-0 Value-Step-0. --3,40282e+38 +-3.40282e+38 @@ -3635,7 +3645,7 @@ rwx Value-Step-1 Value-Step-1. --3,40282e+38 +-3.40282e+38 @@ -3645,7 +3655,7 @@ rwx Value-Step-10 Value-Step-10. --3,40282e+38 +-3.40282e+38 @@ -3655,7 +3665,7 @@ rwx Value-Step-11 Value-Step-11. --3,40282e+38 +-3.40282e+38 @@ -3665,7 +3675,7 @@ rwx Value-Step-12 Value-Step-12. --3,40282e+38 +-3.40282e+38 @@ -3675,7 +3685,7 @@ rwx Value-Step-13 Value-Step-13. --3,40282e+38 +-3.40282e+38 @@ -3685,7 +3695,7 @@ rwx Value-Step-14 Value-Step-14. --3,40282e+38 +-3.40282e+38 @@ -3695,7 +3705,7 @@ rwx Value-Step-15 Value-Step-15. --3,40282e+38 +-3.40282e+38 @@ -3705,7 +3715,7 @@ rwx Value-Step-2 Value-Step-2. --3,40282e+38 +-3.40282e+38 @@ -3715,7 +3725,7 @@ rwx Value-Step-3 Value-Step-3. --3,40282e+38 +-3.40282e+38 @@ -3725,7 +3735,7 @@ rwx Value-Step-4 Value-Step-4. --3,40282e+38 +-3.40282e+38 @@ -3735,7 +3745,7 @@ rwx Value-Step-5 Value-Step-5. --3,40282e+38 +-3.40282e+38 @@ -3745,7 +3755,7 @@ rwx Value-Step-6 Value-Step-6. --3,40282e+38 +-3.40282e+38 @@ -3755,7 +3765,7 @@ rwx Value-Step-7 Value-Step-7. --3,40282e+38 +-3.40282e+38 @@ -3765,7 +3775,7 @@ rwx Value-Step-8 Value-Step-8. --3,40282e+38 +-3.40282e+38 @@ -3775,7 +3785,7 @@ rwx Value-Step-9 Value-Step-9. --3,40282e+38 +-3.40282e+38 @@ -3785,7 +3795,7 @@ rwx Closed-Gate-Value Closed-Gate-Value. --3,40282e+38 +-3.40282e+38 @@ -3815,7 +3825,7 @@ rwx Value-Step-0 Value-Step-0. --3,40282e+38 +-3.40282e+38 @@ -3825,7 +3835,7 @@ rwx Value-Step-1 Value-Step-1. --3,40282e+38 +-3.40282e+38 @@ -3835,7 +3845,7 @@ rwx Value-Step-10 Value-Step-10. --3,40282e+38 +-3.40282e+38 @@ -3845,7 +3855,7 @@ rwx Value-Step-11 Value-Step-11. --3,40282e+38 +-3.40282e+38 @@ -3855,7 +3865,7 @@ rwx Value-Step-12 Value-Step-12. --3,40282e+38 +-3.40282e+38 @@ -3865,7 +3875,7 @@ rwx Value-Step-13 Value-Step-13. --3,40282e+38 +-3.40282e+38 @@ -3875,7 +3885,7 @@ rwx Value-Step-14 Value-Step-14. --3,40282e+38 +-3.40282e+38 @@ -3885,7 +3895,7 @@ rwx Value-Step-15 Value-Step-15. --3,40282e+38 +-3.40282e+38 @@ -3895,7 +3905,7 @@ rwx Value-Step-16 Value-Step-16. --3,40282e+38 +-3.40282e+38 @@ -3905,7 +3915,7 @@ rwx Value-Step-17 Value-Step-17. --3,40282e+38 +-3.40282e+38 @@ -3915,7 +3925,7 @@ rwx Value-Step-18 Value-Step-18. --3,40282e+38 +-3.40282e+38 @@ -3925,7 +3935,7 @@ rwx Value-Step-19 Value-Step-19. --3,40282e+38 +-3.40282e+38 @@ -3935,7 +3945,7 @@ rwx Value-Step-2 Value-Step-2. --3,40282e+38 +-3.40282e+38 @@ -3945,7 +3955,7 @@ rwx Value-Step-20 Value-Step-20. --3,40282e+38 +-3.40282e+38 @@ -3955,7 +3965,7 @@ rwx Value-Step-21 Value-Step-21. --3,40282e+38 +-3.40282e+38 @@ -3965,7 +3975,7 @@ rwx Value-Step-22 Value-Step-22. --3,40282e+38 +-3.40282e+38 @@ -3975,7 +3985,7 @@ rwx Value-Step-23 Value-Step-23. --3,40282e+38 +-3.40282e+38 @@ -3985,7 +3995,7 @@ rwx Value-Step-24 Value-Step-24. --3,40282e+38 +-3.40282e+38 @@ -3995,7 +4005,7 @@ rwx Value-Step-25 Value-Step-25. --3,40282e+38 +-3.40282e+38 @@ -4005,7 +4015,7 @@ rwx Value-Step-26 Value-Step-26. --3,40282e+38 +-3.40282e+38 @@ -4015,7 +4025,7 @@ rwx Value-Step-27 Value-Step-27. --3,40282e+38 +-3.40282e+38 @@ -4025,7 +4035,7 @@ rwx Value-Step-28 Value-Step-28. --3,40282e+38 +-3.40282e+38 @@ -4035,7 +4045,7 @@ rwx Value-Step-29 Value-Step-29. --3,40282e+38 +-3.40282e+38 @@ -4045,7 +4055,7 @@ rwx Value-Step-3 Value-Step-3. --3,40282e+38 +-3.40282e+38 @@ -4055,7 +4065,7 @@ rwx Value-Step-30 Value-Step-30. --3,40282e+38 +-3.40282e+38 @@ -4065,7 +4075,7 @@ rwx Value-Step-31 Value-Step-31. --3,40282e+38 +-3.40282e+38 @@ -4075,7 +4085,7 @@ rwx Value-Step-4 Value-Step-4. --3,40282e+38 +-3.40282e+38 @@ -4085,7 +4095,7 @@ rwx Value-Step-5 Value-Step-5. --3,40282e+38 +-3.40282e+38 @@ -4095,7 +4105,7 @@ rwx Value-Step-6 Value-Step-6. --3,40282e+38 +-3.40282e+38 @@ -4105,7 +4115,7 @@ rwx Value-Step-7 Value-Step-7. --3,40282e+38 +-3.40282e+38 @@ -4115,7 +4125,7 @@ rwx Value-Step-8 Value-Step-8. --3,40282e+38 +-3.40282e+38 @@ -4125,7 +4135,7 @@ rwx Value-Step-9 Value-Step-9. --3,40282e+38 +-3.40282e+38 @@ -4135,7 +4145,7 @@ rwx Closed-Gate-Value Closed-Gate-Value. --3,40282e+38 +-3.40282e+38 @@ -4165,7 +4175,7 @@ rwx Value-Step-0 Value-Step-0. --3,40282e+38 +-3.40282e+38 @@ -4175,7 +4185,7 @@ rwx Value-Step-1 Value-Step-1. --3,40282e+38 +-3.40282e+38 @@ -4185,7 +4195,7 @@ rwx Value-Step-10 Value-Step-10. --3,40282e+38 +-3.40282e+38 @@ -4195,7 +4205,7 @@ rwx Value-Step-11 Value-Step-11. --3,40282e+38 +-3.40282e+38 @@ -4205,7 +4215,7 @@ rwx Value-Step-12 Value-Step-12. --3,40282e+38 +-3.40282e+38 @@ -4215,7 +4225,7 @@ rwx Value-Step-13 Value-Step-13. --3,40282e+38 +-3.40282e+38 @@ -4225,7 +4235,7 @@ rwx Value-Step-14 Value-Step-14. --3,40282e+38 +-3.40282e+38 @@ -4235,7 +4245,7 @@ rwx Value-Step-15 Value-Step-15. --3,40282e+38 +-3.40282e+38 @@ -4245,7 +4255,7 @@ rwx Value-Step-16 Value-Step-16. --3,40282e+38 +-3.40282e+38 @@ -4255,7 +4265,7 @@ rwx Value-Step-17 Value-Step-17. --3,40282e+38 +-3.40282e+38 @@ -4265,7 +4275,7 @@ rwx Value-Step-18 Value-Step-18. --3,40282e+38 +-3.40282e+38 @@ -4275,7 +4285,7 @@ rwx Value-Step-19 Value-Step-19. --3,40282e+38 +-3.40282e+38 @@ -4285,7 +4295,7 @@ rwx Value-Step-2 Value-Step-2. --3,40282e+38 +-3.40282e+38 @@ -4295,7 +4305,7 @@ rwx Value-Step-20 Value-Step-20. --3,40282e+38 +-3.40282e+38 @@ -4305,7 +4315,7 @@ rwx Value-Step-21 Value-Step-21. --3,40282e+38 +-3.40282e+38 @@ -4315,7 +4325,7 @@ rwx Value-Step-22 Value-Step-22. --3,40282e+38 +-3.40282e+38 @@ -4325,7 +4335,7 @@ rwx Value-Step-23 Value-Step-23. --3,40282e+38 +-3.40282e+38 @@ -4335,7 +4345,7 @@ rwx Value-Step-24 Value-Step-24. --3,40282e+38 +-3.40282e+38 @@ -4345,7 +4355,7 @@ rwx Value-Step-25 Value-Step-25. --3,40282e+38 +-3.40282e+38 @@ -4355,7 +4365,7 @@ rwx Value-Step-26 Value-Step-26. --3,40282e+38 +-3.40282e+38 @@ -4365,7 +4375,7 @@ rwx Value-Step-27 Value-Step-27. --3,40282e+38 +-3.40282e+38 @@ -4375,7 +4385,7 @@ rwx Value-Step-28 Value-Step-28. --3,40282e+38 +-3.40282e+38 @@ -4385,7 +4395,7 @@ rwx Value-Step-29 Value-Step-29. --3,40282e+38 +-3.40282e+38 @@ -4395,7 +4405,7 @@ rwx Value-Step-3 Value-Step-3. --3,40282e+38 +-3.40282e+38 @@ -4405,7 +4415,7 @@ rwx Value-Step-30 Value-Step-30. --3,40282e+38 +-3.40282e+38 @@ -4415,7 +4425,7 @@ rwx Value-Step-31 Value-Step-31. --3,40282e+38 +-3.40282e+38 @@ -4425,7 +4435,7 @@ rwx Value-Step-32 Value-Step-32. --3,40282e+38 +-3.40282e+38 @@ -4435,7 +4445,7 @@ rwx Value-Step-33 Value-Step-33. --3,40282e+38 +-3.40282e+38 @@ -4445,7 +4455,7 @@ rwx Value-Step-34 Value-Step-34. --3,40282e+38 +-3.40282e+38 @@ -4455,7 +4465,7 @@ rwx Value-Step-35 Value-Step-35. --3,40282e+38 +-3.40282e+38 @@ -4465,7 +4475,7 @@ rwx Value-Step-36 Value-Step-36. --3,40282e+38 +-3.40282e+38 @@ -4475,7 +4485,7 @@ rwx Value-Step-37 Value-Step-37. --3,40282e+38 +-3.40282e+38 @@ -4485,7 +4495,7 @@ rwx Value-Step-38 Value-Step-38. --3,40282e+38 +-3.40282e+38 @@ -4495,7 +4505,7 @@ rwx Value-Step-39 Value-Step-39. --3,40282e+38 +-3.40282e+38 @@ -4505,7 +4515,7 @@ rwx Value-Step-4 Value-Step-4. --3,40282e+38 +-3.40282e+38 @@ -4515,7 +4525,7 @@ rwx Value-Step-40 Value-Step-40. --3,40282e+38 +-3.40282e+38 @@ -4525,7 +4535,7 @@ rwx Value-Step-41 Value-Step-41. --3,40282e+38 +-3.40282e+38 @@ -4535,7 +4545,7 @@ rwx Value-Step-42 Value-Step-42. --3,40282e+38 +-3.40282e+38 @@ -4545,7 +4555,7 @@ rwx Value-Step-43 Value-Step-43. --3,40282e+38 +-3.40282e+38 @@ -4555,7 +4565,7 @@ rwx Value-Step-44 Value-Step-44. --3,40282e+38 +-3.40282e+38 @@ -4565,7 +4575,7 @@ rwx Value-Step-45 Value-Step-45. --3,40282e+38 +-3.40282e+38 @@ -4575,7 +4585,7 @@ rwx Value-Step-46 Value-Step-46. --3,40282e+38 +-3.40282e+38 @@ -4585,7 +4595,7 @@ rwx Value-Step-47 Value-Step-47. --3,40282e+38 +-3.40282e+38 @@ -4595,7 +4605,7 @@ rwx Value-Step-48 Value-Step-48. --3,40282e+38 +-3.40282e+38 @@ -4605,7 +4615,7 @@ rwx Value-Step-49 Value-Step-49. --3,40282e+38 +-3.40282e+38 @@ -4615,7 +4625,7 @@ rwx Value-Step-5 Value-Step-5. --3,40282e+38 +-3.40282e+38 @@ -4625,7 +4635,7 @@ rwx Value-Step-50 Value-Step-50. --3,40282e+38 +-3.40282e+38 @@ -4635,7 +4645,7 @@ rwx Value-Step-51 Value-Step-51. --3,40282e+38 +-3.40282e+38 @@ -4645,7 +4655,7 @@ rwx Value-Step-52 Value-Step-52. --3,40282e+38 +-3.40282e+38 @@ -4655,7 +4665,7 @@ rwx Value-Step-53 Value-Step-53. --3,40282e+38 +-3.40282e+38 @@ -4665,7 +4675,7 @@ rwx Value-Step-54 Value-Step-54. --3,40282e+38 +-3.40282e+38 @@ -4675,7 +4685,7 @@ rwx Value-Step-55 Value-Step-55. --3,40282e+38 +-3.40282e+38 @@ -4685,7 +4695,7 @@ rwx Value-Step-56 Value-Step-56. --3,40282e+38 +-3.40282e+38 @@ -4695,7 +4705,7 @@ rwx Value-Step-57 Value-Step-57. --3,40282e+38 +-3.40282e+38 @@ -4705,7 +4715,7 @@ rwx Value-Step-58 Value-Step-58. --3,40282e+38 +-3.40282e+38 @@ -4715,7 +4725,7 @@ rwx Value-Step-59 Value-Step-59. --3,40282e+38 +-3.40282e+38 @@ -4725,7 +4735,7 @@ rwx Value-Step-6 Value-Step-6. --3,40282e+38 +-3.40282e+38 @@ -4735,7 +4745,7 @@ rwx Value-Step-60 Value-Step-60. --3,40282e+38 +-3.40282e+38 @@ -4745,7 +4755,7 @@ rwx Value-Step-61 Value-Step-61. --3,40282e+38 +-3.40282e+38 @@ -4755,7 +4765,7 @@ rwx Value-Step-62 Value-Step-62. --3,40282e+38 +-3.40282e+38 @@ -4765,7 +4775,7 @@ rwx Value-Step-63 Value-Step-63. --3,40282e+38 +-3.40282e+38 @@ -4775,7 +4785,7 @@ rwx Value-Step-7 Value-Step-7. --3,40282e+38 +-3.40282e+38 @@ -4785,7 +4795,7 @@ rwx Value-Step-8 Value-Step-8. --3,40282e+38 +-3.40282e+38 @@ -4795,7 +4805,7 @@ rwx Value-Step-9 Value-Step-9. --3,40282e+38 +-3.40282e+38 @@ -4825,7 +4835,7 @@ rwx Denominator Denominator. --3,40282e+38 +-3.40282e+38 @@ -4835,7 +4845,7 @@ rwx Numerator Numerator. --3,40282e+38 +-3.40282e+38 @@ -4845,7 +4855,7 @@ r Ratio-Output Ratio-Output. --3,40282e+38 +-3.40282e+38 @@ -4855,7 +4865,7 @@ rwx Numerator Numerator. --3,40282e+38 +-3.40282e+38 @@ -4865,7 +4875,7 @@ rwx Denominator Denominator. --3,40282e+38 +-3.40282e+38 @@ -4955,7 +4965,7 @@ rwx Quantise-Range-Maximum Quantise-Range-Maximum. --3,40282e+38 +-3.40282e+38 @@ -4965,7 +4975,7 @@ rwx Quantise-Range-Minimum Quantise-Range-Minimum. --3,40282e+38 +-3.40282e+38 @@ -4985,7 +4995,7 @@ rwx Value-0 Value-0. --3,40282e+38 +-3.40282e+38 @@ -4995,7 +5005,7 @@ rwx Value-1 Value-1. --3,40282e+38 +-3.40282e+38 @@ -5005,7 +5015,7 @@ rwx Value-10 Value-10. --3,40282e+38 +-3.40282e+38 @@ -5015,7 +5025,7 @@ rwx Value-11 Value-11. --3,40282e+38 +-3.40282e+38 @@ -5025,7 +5035,7 @@ rwx Value-12 Value-12. --3,40282e+38 +-3.40282e+38 @@ -5035,7 +5045,7 @@ rwx Value-13 Value-13. --3,40282e+38 +-3.40282e+38 @@ -5045,7 +5055,7 @@ rwx Value-14 Value-14. --3,40282e+38 +-3.40282e+38 @@ -5055,7 +5065,7 @@ rwx Value-15 Value-15. --3,40282e+38 +-3.40282e+38 @@ -5065,7 +5075,7 @@ rwx Value-16 Value-16. --3,40282e+38 +-3.40282e+38 @@ -5075,7 +5085,7 @@ rwx Value-17 Value-17. --3,40282e+38 +-3.40282e+38 @@ -5085,7 +5095,7 @@ rwx Value-18 Value-18. --3,40282e+38 +-3.40282e+38 @@ -5095,7 +5105,7 @@ rwx Value-19 Value-19. --3,40282e+38 +-3.40282e+38 @@ -5105,7 +5115,7 @@ rwx Value-2 Value-2. --3,40282e+38 +-3.40282e+38 @@ -5115,7 +5125,7 @@ rwx Value-20 Value-20. --3,40282e+38 +-3.40282e+38 @@ -5125,7 +5135,7 @@ rwx Value-21 Value-21. --3,40282e+38 +-3.40282e+38 @@ -5135,7 +5145,7 @@ rwx Value-22 Value-22. --3,40282e+38 +-3.40282e+38 @@ -5145,7 +5155,7 @@ rwx Value-23 Value-23. --3,40282e+38 +-3.40282e+38 @@ -5155,7 +5165,7 @@ rwx Value-24 Value-24. --3,40282e+38 +-3.40282e+38 @@ -5165,7 +5175,7 @@ rwx Value-25 Value-25. --3,40282e+38 +-3.40282e+38 @@ -5175,7 +5185,7 @@ rwx Value-26 Value-26. --3,40282e+38 +-3.40282e+38 @@ -5185,7 +5195,7 @@ rwx Value-27 Value-27. --3,40282e+38 +-3.40282e+38 @@ -5195,7 +5205,7 @@ rwx Value-28 Value-28. --3,40282e+38 +-3.40282e+38 @@ -5205,7 +5215,7 @@ rwx Value-29 Value-29. --3,40282e+38 +-3.40282e+38 @@ -5215,7 +5225,7 @@ rwx Value-3 Value-3. --3,40282e+38 +-3.40282e+38 @@ -5225,7 +5235,7 @@ rwx Value-30 Value-30. --3,40282e+38 +-3.40282e+38 @@ -5235,7 +5245,7 @@ rwx Value-31 Value-31. --3,40282e+38 +-3.40282e+38 @@ -5245,7 +5255,7 @@ rwx Value-32 Value-32. --3,40282e+38 +-3.40282e+38 @@ -5255,7 +5265,7 @@ rwx Value-33 Value-33. --3,40282e+38 +-3.40282e+38 @@ -5265,7 +5275,7 @@ rwx Value-34 Value-34. --3,40282e+38 +-3.40282e+38 @@ -5275,7 +5285,7 @@ rwx Value-35 Value-35. --3,40282e+38 +-3.40282e+38 @@ -5285,7 +5295,7 @@ rwx Value-36 Value-36. --3,40282e+38 +-3.40282e+38 @@ -5295,7 +5305,7 @@ rwx Value-37 Value-37. --3,40282e+38 +-3.40282e+38 @@ -5305,7 +5315,7 @@ rwx Value-38 Value-38. --3,40282e+38 +-3.40282e+38 @@ -5315,7 +5325,7 @@ rwx Value-39 Value-39. --3,40282e+38 +-3.40282e+38 @@ -5325,7 +5335,7 @@ rwx Value-4 Value-4. --3,40282e+38 +-3.40282e+38 @@ -5335,7 +5345,7 @@ rwx Value-40 Value-40. --3,40282e+38 +-3.40282e+38 @@ -5345,7 +5355,7 @@ rwx Value-41 Value-41. --3,40282e+38 +-3.40282e+38 @@ -5355,7 +5365,7 @@ rwx Value-42 Value-42. --3,40282e+38 +-3.40282e+38 @@ -5365,7 +5375,7 @@ rwx Value-43 Value-43. --3,40282e+38 +-3.40282e+38 @@ -5375,7 +5385,7 @@ rwx Value-44 Value-44. --3,40282e+38 +-3.40282e+38 @@ -5385,7 +5395,7 @@ rwx Value-45 Value-45. --3,40282e+38 +-3.40282e+38 @@ -5395,7 +5405,7 @@ rwx Value-46 Value-46. --3,40282e+38 +-3.40282e+38 @@ -5405,7 +5415,7 @@ rwx Value-47 Value-47. --3,40282e+38 +-3.40282e+38 @@ -5415,7 +5425,7 @@ rwx Value-48 Value-48. --3,40282e+38 +-3.40282e+38 @@ -5425,7 +5435,7 @@ rwx Value-49 Value-49. --3,40282e+38 +-3.40282e+38 @@ -5435,7 +5445,7 @@ rwx Value-5 Value-5. --3,40282e+38 +-3.40282e+38 @@ -5445,7 +5455,7 @@ rwx Value-50 Value-50. --3,40282e+38 +-3.40282e+38 @@ -5455,7 +5465,7 @@ rwx Value-51 Value-51. --3,40282e+38 +-3.40282e+38 @@ -5465,7 +5475,7 @@ rwx Value-52 Value-52. --3,40282e+38 +-3.40282e+38 @@ -5475,7 +5485,7 @@ rwx Value-53 Value-53. --3,40282e+38 +-3.40282e+38 @@ -5485,7 +5495,7 @@ rwx Value-54 Value-54. --3,40282e+38 +-3.40282e+38 @@ -5495,7 +5505,7 @@ rwx Value-55 Value-55. --3,40282e+38 +-3.40282e+38 @@ -5505,7 +5515,7 @@ rwx Value-56 Value-56. --3,40282e+38 +-3.40282e+38 @@ -5515,7 +5525,7 @@ rwx Value-57 Value-57. --3,40282e+38 +-3.40282e+38 @@ -5525,7 +5535,7 @@ rwx Value-58 Value-58. --3,40282e+38 +-3.40282e+38 @@ -5535,7 +5545,7 @@ rwx Value-59 Value-59. --3,40282e+38 +-3.40282e+38 @@ -5545,7 +5555,7 @@ rwx Value-6 Value-6. --3,40282e+38 +-3.40282e+38 @@ -5555,7 +5565,7 @@ rwx Value-60 Value-60. --3,40282e+38 +-3.40282e+38 @@ -5565,7 +5575,7 @@ rwx Value-61 Value-61. --3,40282e+38 +-3.40282e+38 @@ -5575,7 +5585,7 @@ rwx Value-62 Value-62. --3,40282e+38 +-3.40282e+38 @@ -5585,7 +5595,7 @@ rwx Value-63 Value-63. --3,40282e+38 +-3.40282e+38 @@ -5595,7 +5605,7 @@ rwx Value-64 Value-64. --3,40282e+38 +-3.40282e+38 @@ -5605,7 +5615,7 @@ rwx Value-65 Value-65. --3,40282e+38 +-3.40282e+38 @@ -5615,7 +5625,7 @@ rwx Value-66 Value-66. --3,40282e+38 +-3.40282e+38 @@ -5625,7 +5635,7 @@ rwx Value-67 Value-67. --3,40282e+38 +-3.40282e+38 @@ -5635,7 +5645,7 @@ rwx Value-68 Value-68. --3,40282e+38 +-3.40282e+38 @@ -5645,7 +5655,7 @@ rwx Value-69 Value-69. --3,40282e+38 +-3.40282e+38 @@ -5655,7 +5665,7 @@ rwx Value-7 Value-7. --3,40282e+38 +-3.40282e+38 @@ -5665,7 +5675,7 @@ rwx Value-70 Value-70. --3,40282e+38 +-3.40282e+38 @@ -5675,7 +5685,7 @@ rwx Value-71 Value-71. --3,40282e+38 +-3.40282e+38 @@ -5685,7 +5695,7 @@ rwx Value-72 Value-72. --3,40282e+38 +-3.40282e+38 @@ -5695,7 +5705,7 @@ rwx Value-73 Value-73. --3,40282e+38 +-3.40282e+38 @@ -5705,7 +5715,7 @@ rwx Value-74 Value-74. --3,40282e+38 +-3.40282e+38 @@ -5715,7 +5725,7 @@ rwx Value-75 Value-75. --3,40282e+38 +-3.40282e+38 @@ -5725,7 +5735,7 @@ rwx Value-76 Value-76. --3,40282e+38 +-3.40282e+38 @@ -5735,7 +5745,7 @@ rwx Value-77 Value-77. --3,40282e+38 +-3.40282e+38 @@ -5745,7 +5755,7 @@ rwx Value-78 Value-78. --3,40282e+38 +-3.40282e+38 @@ -5755,7 +5765,7 @@ rwx Value-79 Value-79. --3,40282e+38 +-3.40282e+38 @@ -5765,7 +5775,7 @@ rwx Value-8 Value-8. --3,40282e+38 +-3.40282e+38 @@ -5775,7 +5785,7 @@ rwx Value-80 Value-80. --3,40282e+38 +-3.40282e+38 @@ -5785,7 +5795,7 @@ rwx Value-81 Value-81. --3,40282e+38 +-3.40282e+38 @@ -5795,7 +5805,7 @@ rwx Value-82 Value-82. --3,40282e+38 +-3.40282e+38 @@ -5805,7 +5815,7 @@ rwx Value-83 Value-83. --3,40282e+38 +-3.40282e+38 @@ -5815,7 +5825,7 @@ rwx Value-84 Value-84. --3,40282e+38 +-3.40282e+38 @@ -5825,7 +5835,7 @@ rwx Value-85 Value-85. --3,40282e+38 +-3.40282e+38 @@ -5835,7 +5845,7 @@ rwx Value-86 Value-86. --3,40282e+38 +-3.40282e+38 @@ -5845,7 +5855,7 @@ rwx Value-87 Value-87. --3,40282e+38 +-3.40282e+38 @@ -5855,7 +5865,7 @@ rwx Value-88 Value-88. --3,40282e+38 +-3.40282e+38 @@ -5865,7 +5875,7 @@ rwx Value-89 Value-89. --3,40282e+38 +-3.40282e+38 @@ -5875,7 +5885,7 @@ rwx Value-9 Value-9. --3,40282e+38 +-3.40282e+38 @@ -5885,7 +5895,7 @@ rwx Value-90 Value-90. --3,40282e+38 +-3.40282e+38 @@ -5895,7 +5905,7 @@ rwx Value-91 Value-91. --3,40282e+38 +-3.40282e+38 @@ -5905,7 +5915,7 @@ rwx Value-92 Value-92. --3,40282e+38 +-3.40282e+38 @@ -5915,7 +5925,7 @@ rwx Value-93 Value-93. --3,40282e+38 +-3.40282e+38 @@ -5925,7 +5935,7 @@ rwx Value-94 Value-94. --3,40282e+38 +-3.40282e+38 @@ -5935,7 +5945,7 @@ rwx Value-95 Value-95. --3,40282e+38 +-3.40282e+38 @@ -5945,7 +5955,7 @@ rwx Value-96 Value-96. --3,40282e+38 +-3.40282e+38 @@ -5955,7 +5965,7 @@ rwx Value-97 Value-97. --3,40282e+38 +-3.40282e+38 @@ -5965,7 +5975,7 @@ rwx Value-98 Value-98. --3,40282e+38 +-3.40282e+38 @@ -5975,7 +5985,7 @@ rwx Value-99 Value-99. --3,40282e+38 +-3.40282e+38 @@ -6005,7 +6015,7 @@ rwx Quantise-Range-Maximum Quantise-Range-Maximum. --3,40282e+38 +-3.40282e+38 @@ -6015,7 +6025,7 @@ rwx Quantise-Range-Minimum Quantise-Range-Minimum. --3,40282e+38 +-3.40282e+38 @@ -6035,7 +6045,7 @@ rwx Value-0 Value-0. --3,40282e+38 +-3.40282e+38 @@ -6045,7 +6055,7 @@ rwx Value-1 Value-1. --3,40282e+38 +-3.40282e+38 @@ -6055,7 +6065,7 @@ rwx Value-10 Value-10. --3,40282e+38 +-3.40282e+38 @@ -6065,7 +6075,7 @@ rwx Value-11 Value-11. --3,40282e+38 +-3.40282e+38 @@ -6075,7 +6085,7 @@ rwx Value-12 Value-12. --3,40282e+38 +-3.40282e+38 @@ -6085,7 +6095,7 @@ rwx Value-13 Value-13. --3,40282e+38 +-3.40282e+38 @@ -6095,7 +6105,7 @@ rwx Value-14 Value-14. --3,40282e+38 +-3.40282e+38 @@ -6105,7 +6115,7 @@ rwx Value-15 Value-15. --3,40282e+38 +-3.40282e+38 @@ -6115,7 +6125,7 @@ rwx Value-16 Value-16. --3,40282e+38 +-3.40282e+38 @@ -6125,7 +6135,7 @@ rwx Value-17 Value-17. --3,40282e+38 +-3.40282e+38 @@ -6135,7 +6145,7 @@ rwx Value-18 Value-18. --3,40282e+38 +-3.40282e+38 @@ -6145,7 +6155,7 @@ rwx Value-19 Value-19. --3,40282e+38 +-3.40282e+38 @@ -6155,7 +6165,7 @@ rwx Value-2 Value-2. --3,40282e+38 +-3.40282e+38 @@ -6165,7 +6175,7 @@ rwx Value-20 Value-20. --3,40282e+38 +-3.40282e+38 @@ -6175,7 +6185,7 @@ rwx Value-21 Value-21. --3,40282e+38 +-3.40282e+38 @@ -6185,7 +6195,7 @@ rwx Value-22 Value-22. --3,40282e+38 +-3.40282e+38 @@ -6195,7 +6205,7 @@ rwx Value-23 Value-23. --3,40282e+38 +-3.40282e+38 @@ -6205,7 +6215,7 @@ rwx Value-24 Value-24. --3,40282e+38 +-3.40282e+38 @@ -6215,7 +6225,7 @@ rwx Value-25 Value-25. --3,40282e+38 +-3.40282e+38 @@ -6225,7 +6235,7 @@ rwx Value-26 Value-26. --3,40282e+38 +-3.40282e+38 @@ -6235,7 +6245,7 @@ rwx Value-27 Value-27. --3,40282e+38 +-3.40282e+38 @@ -6245,7 +6255,7 @@ rwx Value-28 Value-28. --3,40282e+38 +-3.40282e+38 @@ -6255,7 +6265,7 @@ rwx Value-29 Value-29. --3,40282e+38 +-3.40282e+38 @@ -6265,7 +6275,7 @@ rwx Value-3 Value-3. --3,40282e+38 +-3.40282e+38 @@ -6275,7 +6285,7 @@ rwx Value-30 Value-30. --3,40282e+38 +-3.40282e+38 @@ -6285,7 +6295,7 @@ rwx Value-31 Value-31. --3,40282e+38 +-3.40282e+38 @@ -6295,7 +6305,7 @@ rwx Value-32 Value-32. --3,40282e+38 +-3.40282e+38 @@ -6305,7 +6315,7 @@ rwx Value-33 Value-33. --3,40282e+38 +-3.40282e+38 @@ -6315,7 +6325,7 @@ rwx Value-34 Value-34. --3,40282e+38 +-3.40282e+38 @@ -6325,7 +6335,7 @@ rwx Value-35 Value-35. --3,40282e+38 +-3.40282e+38 @@ -6335,7 +6345,7 @@ rwx Value-36 Value-36. --3,40282e+38 +-3.40282e+38 @@ -6345,7 +6355,7 @@ rwx Value-37 Value-37. --3,40282e+38 +-3.40282e+38 @@ -6355,7 +6365,7 @@ rwx Value-38 Value-38. --3,40282e+38 +-3.40282e+38 @@ -6365,7 +6375,7 @@ rwx Value-39 Value-39. --3,40282e+38 +-3.40282e+38 @@ -6375,7 +6385,7 @@ rwx Value-4 Value-4. --3,40282e+38 +-3.40282e+38 @@ -6385,7 +6395,7 @@ rwx Value-40 Value-40. --3,40282e+38 +-3.40282e+38 @@ -6395,7 +6405,7 @@ rwx Value-41 Value-41. --3,40282e+38 +-3.40282e+38 @@ -6405,7 +6415,7 @@ rwx Value-42 Value-42. --3,40282e+38 +-3.40282e+38 @@ -6415,7 +6425,7 @@ rwx Value-43 Value-43. --3,40282e+38 +-3.40282e+38 @@ -6425,7 +6435,7 @@ rwx Value-44 Value-44. --3,40282e+38 +-3.40282e+38 @@ -6435,7 +6445,7 @@ rwx Value-45 Value-45. --3,40282e+38 +-3.40282e+38 @@ -6445,7 +6455,7 @@ rwx Value-46 Value-46. --3,40282e+38 +-3.40282e+38 @@ -6455,7 +6465,7 @@ rwx Value-47 Value-47. --3,40282e+38 +-3.40282e+38 @@ -6465,7 +6475,7 @@ rwx Value-48 Value-48. --3,40282e+38 +-3.40282e+38 @@ -6475,7 +6485,7 @@ rwx Value-49 Value-49. --3,40282e+38 +-3.40282e+38 @@ -6485,7 +6495,7 @@ rwx Value-5 Value-5. --3,40282e+38 +-3.40282e+38 @@ -6495,7 +6505,7 @@ rwx Value-6 Value-6. --3,40282e+38 +-3.40282e+38 @@ -6505,7 +6515,7 @@ rwx Value-7 Value-7. --3,40282e+38 +-3.40282e+38 @@ -6515,7 +6525,7 @@ rwx Value-8 Value-8. --3,40282e+38 +-3.40282e+38 @@ -6525,7 +6535,7 @@ rwx Value-9 Value-9. --3,40282e+38 +-3.40282e+38 @@ -6535,7 +6545,7 @@ rwx First-Input First-Input. --3,40282e+38 +-3.40282e+38 @@ -6545,7 +6555,7 @@ rwx Second-Input Second-Input. --3,40282e+38 +-3.40282e+38 @@ -6555,7 +6565,7 @@ r Summed-Output Summed-Output. --3,40282e+38 +-3.40282e+38 @@ -6565,7 +6575,7 @@ rwx Second-Input Second-Input. --3,40282e+38 +-3.40282e+38 @@ -6585,7 +6595,7 @@ rwx Pulse-Width Pulse-Width. -0,5 +0.5 @@ -6615,7 +6625,7 @@ rwx Pulse-Width Pulse-Width. -0,5 +0.5 @@ -6655,7 +6665,7 @@ rwx Pulse-Width Pulse-Width. -0,5 +0.5 @@ -6665,7 +6675,7 @@ rwx First-Input First-Input. --3,40282e+38 +-3.40282e+38 @@ -6675,7 +6685,7 @@ r Product-Output Product-Output. --3,40282e+38 +-3.40282e+38 @@ -6685,7 +6695,7 @@ rwx Second-Input Second-Input. --3,40282e+38 +-3.40282e+38 @@ -6695,13 +6705,13 @@ rwx Second-Input Second-Input. --3,40282e+38 +-3.40282e+38 ladspa-lp4pole-fcrcia-oa::Cutoff-Frequency gfloat -[0,91875,22050] +[0.91875,22050] rwx Cutoff-Frequency Cutoff-Frequency. @@ -6755,7 +6765,7 @@ rwx Quantise-Range-Maximum Quantise-Range-Maximum. --3,40282e+38 +-3.40282e+38 @@ -6765,7 +6775,7 @@ rwx Quantise-Range-Minimum Quantise-Range-Minimum. --3,40282e+38 +-3.40282e+38 @@ -6785,7 +6795,7 @@ rwx Value-0 Value-0. --3,40282e+38 +-3.40282e+38 @@ -6795,7 +6805,7 @@ rwx Value-1 Value-1. --3,40282e+38 +-3.40282e+38 @@ -6805,7 +6815,7 @@ rwx Value-10 Value-10. --3,40282e+38 +-3.40282e+38 @@ -6815,7 +6825,7 @@ rwx Value-11 Value-11. --3,40282e+38 +-3.40282e+38 @@ -6825,7 +6835,7 @@ rwx Value-12 Value-12. --3,40282e+38 +-3.40282e+38 @@ -6835,7 +6845,7 @@ rwx Value-13 Value-13. --3,40282e+38 +-3.40282e+38 @@ -6845,7 +6855,7 @@ rwx Value-14 Value-14. --3,40282e+38 +-3.40282e+38 @@ -6855,7 +6865,7 @@ rwx Value-15 Value-15. --3,40282e+38 +-3.40282e+38 @@ -6865,7 +6875,7 @@ rwx Value-16 Value-16. --3,40282e+38 +-3.40282e+38 @@ -6875,7 +6885,7 @@ rwx Value-17 Value-17. --3,40282e+38 +-3.40282e+38 @@ -6885,7 +6895,7 @@ rwx Value-18 Value-18. --3,40282e+38 +-3.40282e+38 @@ -6895,7 +6905,7 @@ rwx Value-19 Value-19. --3,40282e+38 +-3.40282e+38 @@ -6905,7 +6915,7 @@ rwx Value-2 Value-2. --3,40282e+38 +-3.40282e+38 @@ -6915,7 +6925,7 @@ rwx Value-3 Value-3. --3,40282e+38 +-3.40282e+38 @@ -6925,7 +6935,7 @@ rwx Value-4 Value-4. --3,40282e+38 +-3.40282e+38 @@ -6935,7 +6945,7 @@ rwx Value-5 Value-5. --3,40282e+38 +-3.40282e+38 @@ -6945,7 +6955,7 @@ rwx Value-6 Value-6. --3,40282e+38 +-3.40282e+38 @@ -6955,7 +6965,7 @@ rwx Value-7 Value-7. --3,40282e+38 +-3.40282e+38 @@ -6965,7 +6975,7 @@ rwx Value-8 Value-8. --3,40282e+38 +-3.40282e+38 @@ -6975,7 +6985,7 @@ rwx Value-9 Value-9. --3,40282e+38 +-3.40282e+38 @@ -7005,7 +7015,7 @@ rwx Modulation Modulation. --3,40282e+38 +-3.40282e+38 @@ -7055,7 +7065,7 @@ rwx Modulation Modulation. --3,40282e+38 +-3.40282e+38 @@ -7065,7 +7075,7 @@ rwx Control-Input Control-Input. --3,40282e+38 +-3.40282e+38 @@ -7355,7 +7365,7 @@ r First-Output First-Output. --3,40282e+38 +-3.40282e+38 @@ -7365,7 +7375,7 @@ rwx Input Input. --3,40282e+38 +-3.40282e+38 @@ -7375,7 +7385,7 @@ r Second-Output Second-Output. --3,40282e+38 +-3.40282e+38 @@ -7485,7 +7495,7 @@ r Difference-Output Difference-Output. --3,40282e+38 +-3.40282e+38 @@ -7495,7 +7505,7 @@ rwx Input Input. --3,40282e+38 +-3.40282e+38 @@ -7505,7 +7515,7 @@ rwx Input-to-Subtract Input-to-Subtract. --3,40282e+38 +-3.40282e+38 @@ -7515,7 +7525,7 @@ rwx Input Input. --3,40282e+38 +-3.40282e+38 @@ -7525,7 +7535,7 @@ rwx Input-to-Subtract Input-to-Subtract. --3,40282e+38 +-3.40282e+38 @@ -7535,7 +7545,7 @@ rwx B B. --3,40282e+38 +-3.40282e+38 @@ -7565,7 +7575,7 @@ rwx Threshold Threshold. --3,40282e+38 +-3.40282e+38 @@ -7595,7 +7605,7 @@ rwx Base Base. --3,40282e+38 +-3.40282e+38 @@ -7605,7 +7615,7 @@ rwx Exponent Exponent. --3,40282e+38 +-3.40282e+38 @@ -7615,7 +7625,7 @@ r Result Result. --3,40282e+38 +-3.40282e+38 @@ -7625,7 +7635,7 @@ rwx Off Off. --3,40282e+38 +-3.40282e+38 @@ -7635,7 +7645,7 @@ rwx On On. --3,40282e+38 +-3.40282e+38 @@ -7645,7 +7655,7 @@ r Output Output. --3,40282e+38 +-3.40282e+38 @@ -7671,11 +7681,11 @@ ladspa-wg-mesh-cr::Tension gfloat -[0,0001,0,22] +[0.0001,0.22] rwx Tension Tension. -0,11005 +0.11005 @@ -7711,11 +7721,11 @@ ladspa-vcf-hshelf::Resonance-Offset gfloat -[0,001,1] +[0.001,1] rwx Resonance-Offset Resonance-Offset. -0,001 +0.001 @@ -7761,11 +7771,11 @@ ladspa-vcf-lshelf::Resonance-Offset gfloat -[0,001,1] +[0.001,1] rwx Resonance-Offset Resonance-Offset. -0,001 +0.001 @@ -7811,11 +7821,11 @@ ladspa-vcf-peakeq::Resonance-Offset gfloat -[0,001,1] +[0.001,1] rwx Resonance-Offset Resonance-Offset. -0,001 +0.001 @@ -7861,11 +7871,11 @@ ladspa-vcf-notch::Resonance-Offset gfloat -[0,001,1] +[0.001,1] rwx Resonance-Offset Resonance-Offset. -0,001 +0.001 @@ -7901,11 +7911,11 @@ ladspa-vcf-bp2::Resonance-Offset gfloat -[0,001,1] +[0.001,1] rwx Resonance-Offset Resonance-Offset. -0,001 +0.001 @@ -7941,11 +7951,11 @@ ladspa-vcf-bp1::Resonance-Offset gfloat -[0,001,1] +[0.001,1] rwx Resonance-Offset Resonance-Offset. -0,001 +0.001 @@ -7981,11 +7991,11 @@ ladspa-vcf-hp::Resonance-Offset gfloat -[0,001,1] +[0.001,1] rwx Resonance-Offset Resonance-Offset. -0,001 +0.001 @@ -8021,11 +8031,11 @@ ladspa-vcf-lp::Resonance-Offset gfloat -[0,001,1] +[0.001,1] rwx Resonance-Offset Resonance-Offset. -0,001 +0.001 @@ -8061,11 +8071,11 @@ ladspa-vcf-reslp::Resonance-Offset gfloat -[0,001,1] +[0.001,1] rwx Resonance-Offset Resonance-Offset. -0,001 +0.001 @@ -8115,7 +8125,7 @@ rwx Trigger-Threshold Trigger-Threshold. --3,40282e+38 +-3.40282e+38 @@ -8165,7 +8175,7 @@ rwx Fall-time Fall-time. --3,40282e+38 +-3.40282e+38 @@ -8175,7 +8185,7 @@ rwx Rise-time Rise-time. --3,40282e+38 +-3.40282e+38 @@ -8195,7 +8205,7 @@ rwx Fall-rate Fall-rate. --3,40282e+38 +-3.40282e+38 @@ -8205,7 +8215,7 @@ rwx Rise-rate Rise-rate. --3,40282e+38 +-3.40282e+38 @@ -8455,7 +8465,7 @@ rwx Input Input. --3,40282e+38 +-3.40282e+38 @@ -8465,7 +8475,7 @@ r Output Output. --3,40282e+38 +-3.40282e+38 @@ -10155,7 +10165,7 @@ rwx Effect-cutoff-freq Effect-cutoff-freq. -32.6376 +32.6377 @@ -12081,7 +12091,7 @@ ladspa-gate::Output-select gint -[G_MAXULONG,1] +[-1,1] rwx Output-select Output-select. @@ -14701,11 +14711,11 @@ ladspa-syndrum::Resonance gfloat -[0,001,1] +[0.001,1] rwx Resonance Resonance. -0,001 +0.001 @@ -14735,7 +14745,7 @@ rwx Output-Envelope-Attack Output-Envelope-Attack. -3,40282e+38 +3.40282e+38 @@ -14745,7 +14755,7 @@ rwx Output-Envelope-Decay Output-Envelope-Decay. -3,40282e+38 +3.40282e+38 @@ -14765,7 +14775,7 @@ rwx Output-Envelope-Attack Output-Envelope-Attack. -3,40282e+38 +3.40282e+38 @@ -14775,7 +14785,7 @@ rwx Output-Envelope-Decay Output-Envelope-Decay. -3,40282e+38 +3.40282e+38 @@ -14795,7 +14805,7 @@ rwx Expansion-Ratio Expansion-Ratio. --1,70141e+38 +-1.70141e+38 @@ -14805,7 +14815,7 @@ rwx Output-Envelope-Attack Output-Envelope-Attack. -3,40282e+38 +3.40282e+38 @@ -14815,7 +14825,7 @@ rwx Output-Envelope-Decay Output-Envelope-Decay. -3,40282e+38 +3.40282e+38 @@ -14835,7 +14845,7 @@ rwx Expansion-Ratio Expansion-Ratio. --1,70141e+38 +-1.70141e+38 @@ -14845,7 +14855,7 @@ rwx Output-Envelope-Attack Output-Envelope-Attack. -3,40282e+38 +3.40282e+38 @@ -14855,7 +14865,7 @@ rwx Output-Envelope-Decay Output-Envelope-Decay. -3,40282e+38 +3.40282e+38 @@ -14875,7 +14885,7 @@ rwx Compression-Ratio Compression-Ratio. --1,70141e+38 +-1.70141e+38 @@ -14885,7 +14895,7 @@ rwx Output-Envelope-Attack Output-Envelope-Attack. -3,40282e+38 +3.40282e+38 @@ -14895,7 +14905,7 @@ rwx Output-Envelope-Decay Output-Envelope-Decay. -3,40282e+38 +3.40282e+38 @@ -14915,7 +14925,7 @@ rwx Compression-Ratio Compression-Ratio. --1,70141e+38 +-1.70141e+38 @@ -14925,7 +14935,7 @@ rwx Output-Envelope-Attack Output-Envelope-Attack. -3,40282e+38 +3.40282e+38 @@ -14935,7 +14945,7 @@ rwx Output-Envelope-Decay Output-Envelope-Decay. -3,40282e+38 +3.40282e+38 @@ -14971,21 +14981,21 @@ ladspa-phasemod::DCO1-Attack gfloat -[0,01,8] +[0.01,8] rwx DCO1-Attack DCO1-Attack. -0,01 +0.01 ladspa-phasemod::DCO1-Decay gfloat -[0,01,8] +[0.01,8] rwx DCO1-Decay DCO1-Decay. -0,01 +0.01 @@ -15011,11 +15021,11 @@ ladspa-phasemod::DCO1-Release gfloat -[0,01,8] +[0.01,8] rwx DCO1-Release DCO1-Release. -0,01 +0.01 @@ -15041,21 +15051,21 @@ ladspa-phasemod::DCO2-Attack gfloat -[0,01,8] +[0.01,8] rwx DCO2-Attack DCO2-Attack. -0,01 +0.01 ladspa-phasemod::DCO2-Decay gfloat -[0,01,8] +[0.01,8] rwx DCO2-Decay DCO2-Decay. -0,01 +0.01 @@ -15081,11 +15091,11 @@ ladspa-phasemod::DCO2-Release gfloat -[0,01,8] +[0.01,8] rwx DCO2-Release DCO2-Release. -0,01 +0.01 @@ -15111,21 +15121,21 @@ ladspa-phasemod::DCO3-Attack gfloat -[0,01,8] +[0.01,8] rwx DCO3-Attack DCO3-Attack. -0,01 +0.01 ladspa-phasemod::DCO3-Decay gfloat -[0,01,8] +[0.01,8] rwx DCO3-Decay DCO3-Decay. -0,01 +0.01 @@ -15151,11 +15161,11 @@ ladspa-phasemod::DCO3-Release gfloat -[0,01,8] +[0.01,8] rwx DCO3-Release DCO3-Release. -0,01 +0.01 @@ -15181,21 +15191,21 @@ ladspa-phasemod::DCO4-Attack gfloat -[0,01,8] +[0.01,8] rwx DCO4-Attack DCO4-Attack. -0,01 +0.01 ladspa-phasemod::DCO4-Decay gfloat -[0,01,8] +[0.01,8] rwx DCO4-Decay DCO4-Decay. -0,01 +0.01 @@ -15221,11 +15231,11 @@ ladspa-phasemod::DCO4-Release gfloat -[0,01,8] +[0.01,8] rwx DCO4-Release DCO4-Release. -0,01 +0.01 @@ -15251,21 +15261,21 @@ ladspa-phasemod::DCO5-Attack gfloat -[0,01,8] +[0.01,8] rwx DCO5-Attack DCO5-Attack. -0,01 +0.01 ladspa-phasemod::DCO5-Decay gfloat -[0,01,8] +[0.01,8] rwx DCO5-Decay DCO5-Decay. -0,01 +0.01 @@ -15291,11 +15301,11 @@ ladspa-phasemod::DCO5-Release gfloat -[0,01,8] +[0.01,8] rwx DCO5-Release DCO5-Release. -0,01 +0.01 @@ -15321,21 +15331,21 @@ ladspa-phasemod::DCO6-Attack gfloat -[0,01,8] +[0.01,8] rwx DCO6-Attack DCO6-Attack. -0,01 +0.01 ladspa-phasemod::DCO6-Decay gfloat -[0,01,8] +[0.01,8] rwx DCO6-Decay DCO6-Decay. -0,01 +0.01 @@ -15361,11 +15371,11 @@ ladspa-phasemod::DCO6-Release gfloat -[0,01,8] +[0.01,8] rwx DCO6-Release DCO6-Release. -0,01 +0.01 @@ -15431,21 +15441,21 @@ ladspa-organ::Attack-Hi gfloat -[0,01,1] +[0.01,1] rwx Attack-Hi Attack-Hi. -0,01 +0.01 ladspa-organ::Attack-Lo gfloat -[0,01,1] +[0.01,1] rwx Attack-Lo Attack-Lo. -0,01 +0.01 @@ -15461,21 +15471,21 @@ ladspa-organ::Decay-Hi gfloat -[0,01,1] +[0.01,1] rwx Decay-Hi Decay-Hi. -0,01 +0.01 ladspa-organ::Decay-Lo gfloat -[0,01,1] +[0.01,1] rwx Decay-Lo Decay-Lo. -0,01 +0.01 @@ -15521,21 +15531,21 @@ ladspa-organ::Release-Hi gfloat -[0,01,1] +[0.01,1] rwx Release-Hi Release-Hi. -0,01 +0.01 ladspa-organ::Release-Lo gfloat -[0,01,1] +[0.01,1] rwx Release-Lo Release-Lo. -0,01 +0.01 @@ -15635,7 +15645,7 @@ r Output Output. --3,40282e+38 +-3.40282e+38 @@ -15645,7 +15655,7 @@ rwx Input Input. --3,40282e+38 +-3.40282e+38 @@ -15661,21 +15671,21 @@ ladspa-logistic::Step-frequency gfloat -[0,44,1] +[0,44.1] rwx Step-frequency Step-frequency. -22,05 +22.05 ladspa-logistic::param--r--parameter gfloat -[2,9,3,9999] +[2.9,3.9999] rwx param--r--parameter param--r--parameter. -3,9999 +3.9999 @@ -15715,7 +15725,7 @@ rwx Input Input. --3,40282e+38 +-3.40282e+38 @@ -15725,7 +15735,7 @@ r Output Output. --3,40282e+38 +-3.40282e+38 @@ -15745,7 +15755,7 @@ rwx Density Density. -3,40282e+38 +3.40282e+38 @@ -15755,7 +15765,7 @@ rwx Grain-Attack Grain-Attack. -3,40282e+38 +3.40282e+38 @@ -15765,7 +15775,7 @@ rwx Grain-Length Grain-Length. -3,40282e+38 +3.40282e+38 @@ -15775,7 +15785,7 @@ rwx Scatter Scatter. -2,5 +2.5 @@ -15815,7 +15825,7 @@ rwx Room-Size Room-Size. -0,5 +0.5 @@ -15835,7 +15845,7 @@ rwx Width Width. -0,5 +0.5 @@ -15855,7 +15865,7 @@ rwx Dry-Wet-Balance Dry-Wet-Balance. -0,5 +0.5 @@ -15865,7 +15875,7 @@ rwx Feedback Feedback. -0,5 +0.5 @@ -15885,7 +15895,7 @@ rwx Dry-Wet-Balance Dry-Wet-Balance. -0,5 +0.5 @@ -15895,7 +15905,7 @@ rwx Feedback Feedback. -0,5 +0.5 @@ -15915,7 +15925,7 @@ rwx Dry-Wet-Balance Dry-Wet-Balance. -0,5 +0.5 @@ -15925,17 +15935,17 @@ rwx Feedback Feedback. -0,5 +0.5 ladspa-fbdelay-0-1s::Delay gfloat -[0,0,1] +[0,0.1] rwx Delay Delay. -0,1 +0.1 @@ -15945,7 +15955,7 @@ rwx Dry-Wet-Balance Dry-Wet-Balance. -0,5 +0.5 @@ -15955,17 +15965,17 @@ rwx Feedback Feedback. -0,5 +0.5 ladspa-fbdelay-0-01s::Delay gfloat -[0,0,01] +[0,0.01] rwx Delay Delay. -0,01 +0.01 @@ -15975,7 +15985,7 @@ rwx Dry-Wet-Balance Dry-Wet-Balance. -0,5 +0.5 @@ -15985,7 +15995,7 @@ rwx Feedback Feedback. -0,5 +0.5 @@ -16035,7 +16045,7 @@ rwx Envelope-Forgetting-Factor Envelope-Forgetting-Factor. -3,40282e+38 +3.40282e+38 @@ -16055,7 +16065,7 @@ rwx Envelope-Forgetting-Factor Envelope-Forgetting-Factor. -3,40282e+38 +3.40282e+38 @@ -16085,7 +16095,7 @@ rwx Dry-Wet-Balance Dry-Wet-Balance. -0,5 +0.5 @@ -16105,17 +16115,17 @@ rwx Dry-Wet-Balance Dry-Wet-Balance. -0,5 +0.5 ladspa-delay-0-1s::Delay gfloat -[0,0,1] +[0,0.1] rwx Delay Delay. -0,1 +0.1 @@ -16125,17 +16135,17 @@ rwx Dry-Wet-Balance Dry-Wet-Balance. -0,5 +0.5 ladspa-delay-0-01s::Delay gfloat -[0,0,01] +[0,0.01] rwx Delay Delay. -0,01 +0.01 @@ -16145,7 +16155,7 @@ rwx Dry-Wet-Balance Dry-Wet-Balance. -0,5 +0.5 @@ -16171,11 +16181,11 @@ ladspa-sledgehammer::Rate gfloat -[1e-05,0,001] +[1e-05,0.001] rwx Rate Rate. -0,000505 +0.000505 @@ -16211,11 +16221,11 @@ ladspa-canyon-delay::Left-to-Right-Time gfloat -[0,01,0,99] +[0.01,0.99] rwx Left-to-Right-Time Left-to-Right-Time. -0,01 +0.01 @@ -16241,11 +16251,11 @@ ladspa-canyon-delay::Right-to-Left-Time gfloat -[0,01,0,99] +[0.01,0.99] rwx Right-to-Left-Time Right-to-Left-Time. -0,01 +0.01 @@ -16291,31 +16301,31 @@ ladspa-analogue::DCO1-Octave gfloat -[0,001,1] +[0.001,1] rwx DCO1-Octave DCO1-Octave. -0,001 +0.001 ladspa-analogue::DCO1-Release gfloat -[0,01,8] +[0.01,8] rwx DCO1-Release DCO1-Release. -0,01 +0.01 ladspa-analogue::DCO1-Sustain gfloat -[0,01,8] +[0.01,8] rwx DCO1-Sustain DCO1-Sustain. -0,01 +0.01 @@ -16381,31 +16391,31 @@ ladspa-analogue::DCO2-Release gfloat -[0,01,8] +[0.01,8] rwx DCO2-Release DCO2-Release. -0,01 +0.01 ladspa-analogue::DCO2-Sustain gfloat -[0,01,8] +[0.01,8] rwx DCO2-Sustain DCO2-Sustain. -0,01 +0.01 ladspa-analogue::DCO2-Waveform gfloat -[0,01,8] +[0.01,8] rwx DCO2-Waveform DCO2-Waveform. -0,01 +0.01 @@ -16441,21 +16451,21 @@ ladspa-analogue::Filter-LFO-Modulation gfloat -[0,01,8] +[0.01,8] rwx Filter-LFO-Modulation Filter-LFO-Modulation. -0,01 +0.01 ladspa-analogue::Filter-Release gfloat -[0,01,8] +[0.01,8] rwx Filter-Release Filter-Release. -0,01 +0.01 @@ -16471,11 +16481,11 @@ ladspa-analogue::Filter-Sustain gfloat -[0,01,8] +[0.01,8] rwx Filter-Sustain Filter-Sustain. -0,01 +0.01 @@ -16501,11 +16511,11 @@ ladspa-analogue::LFO-Fadein gfloat -[0,01,8] +[0.01,8] rwx LFO-Fadein LFO-Fadein. -0,01 +0.01 @@ -17145,7 +17155,7 @@ rw Path where to search for RealPlayer codecs Path where to search for RealPlayer codecs. -"/usr/lib64/win32:/usr/lib64/codecs:/usr/local/lib64/win32:/usr/local/lib64/codecs" +"/usr/lib/win32:/usr/lib/codecs:/usr/local/RealPlayer/codecs:/usr/local/lib/win32:/usr/local/lib/codecs" @@ -17185,7 +17195,7 @@ rw Path where to search for RealPlayer codecs Path where to search for RealPlayer codecs. -"/usr/lib64/win32:/usr/lib64/codecs:/usr/local/lib64/win32:/usr/local/lib64/codecs" +"/usr/lib/win32:/usr/lib/codecs:/usr/local/RealPlayer/codecs:/usr/local/lib/win32:/usr/local/lib/codecs" @@ -17841,7 +17851,7 @@ DvbBaseBin::diseqc-source gint -[G_MAXULONG,7] +[-1,7] rw diseqc source DISEqC selected source (-1 disabled) (DVB-S). @@ -19720,7 +19730,7 @@ rwx decay decay. -0,25 +0.25 @@ -19770,7 +19780,7 @@ rwx Initial-phase-for-stereo Initial-phase-for-stereo. --3,40282e+38 +-3.40282e+38 @@ -19806,11 +19816,11 @@ ladspa-alienwah-stereo::Initial-phase-for-stereo gfloat -[0,6,28319] +[0,6.28319] rwx Initial-phase-for-stereo Initial-phase-for-stereo. -6,28319 +6.28319 @@ -20020,7 +20030,7 @@ rwx LP-filter LP-filter. -0,5 +0.5 @@ -20070,7 +20080,7 @@ rwx LP-filter LP-filter. -0,5 +0.5 @@ -20140,7 +20150,7 @@ rwx LP-filter LP-filter. -0,5 +0.5 @@ -20276,7 +20286,7 @@ ladspa-SooperLooper::QuantizeMode gint -<= G_MININT +<= G_MINLONG rwx QuantizeMode QuantizeMode. @@ -20296,7 +20306,7 @@ ladspa-SooperLooper::RedoTapMode gint -<= G_MININT +<= G_MINLONG rwx RedoTapMode RedoTapMode. @@ -20306,7 +20316,7 @@ ladspa-SooperLooper::RoundMode gint -<= G_MININT +<= G_MINLONG rwx RoundMode RoundMode. @@ -20330,7 +20340,7 @@ r State-Output State-Output. --3,40282e+38 +-3.40282e+38 @@ -20390,7 +20400,7 @@ rwx Look-ahead Look-ahead. -2,5 +2.5 @@ -20410,7 +20420,7 @@ rwx Strength Strength. -0,75 +0.75 @@ -20450,7 +20460,7 @@ rwx Look-ahead Look-ahead. -2,5 +2.5 @@ -20470,7 +20480,7 @@ rwx Strength Strength. -0,75 +0.75 @@ -20620,7 +20630,7 @@ rwx Frequency Frequency. -2990,7 +2990.7 @@ -20630,7 +20640,7 @@ rwx Inertia Inertia. -22,3607 +22.3607 @@ -20646,11 +20656,11 @@ ladspa-Filter::Resonance gfloat -[0,707,32] +[0.707,32] rwx Resonance Resonance. -0,707 +0.707 @@ -20666,11 +20676,11 @@ ladspa-Flanger::Feedback gfloat -[-0,99,0,99] +[-0.99,0.99] rwx Feedback Feedback. -0,99 +0.99 @@ -20736,31 +20746,31 @@ ladspa-Flanger::Min-delay gfloat -[0,1,10] +[0.1,10] rwx Min-delay Min-delay. -0,1 +0.1 ladspa-Flanger::Mod-depth gfloat -[0,1,10] +[0.1,10] rwx Mod-depth Mod-depth. -0,316228 +0.316228 ladspa-Flanger::Mod-rate gfloat -[0,01,20] +[0.01,20] rwx Mod-rate Mod-rate. -0,447214 +0.447214 @@ -20776,11 +20786,11 @@ ladspa-Reverb::Decay-time gfloat -[0,4,15] +[0.4,15] rwx Decay-time Decay-time. -0,989846 +0.989846 @@ -20790,7 +20800,7 @@ rwx Diffusion Diffusion. -0,5 +0.5 @@ -20800,7 +20810,7 @@ rwx High-Frq-Damp High-Frq-Damp. -6324,56 +6324.56 @@ -20820,7 +20830,7 @@ rwx Bass-Cut Bass-Cut. -632,456 +632.456 @@ -20850,7 +20860,7 @@ rwx Treble-Cut Treble-Cut. -3556,56 +3556.56 @@ -20860,7 +20870,7 @@ rwx Wet-Amount Wet-Amount. -0,5 +0.5 @@ -20910,7 +20920,7 @@ rwx Feedback Feedback. -0,5 +0.5 @@ -20926,7 +20936,7 @@ ladspa-VintageDelay::Mix-mode gint -[0,1] +[0,3] rwx Mix-mode Mix-mode. @@ -20950,7 +20960,7 @@ rwx Tempo Tempo. -97,5 +97.5 @@ -20983,6 +20993,16 @@ 1 + +ladspa-VintageDelay::Stereo-Width +gfloat +[-1,1] +rwx +Stereo-Width +Stereo-Width. +1 + + ladspa-RotarySpeaker::Mod-Depth gfloat @@ -21010,7 +21030,7 @@ rwx Tap-Offset Tap-Offset. -0,5 +0.5 @@ -21020,7 +21040,7 @@ rwx Tap-Spacing Tap-Spacing. -0,5 +0.5 @@ -21030,7 +21050,7 @@ rwx Bass-Motor Bass-Motor. -27,8316 +27.8316 @@ -21040,7 +21060,7 @@ rwx Mic-Distance Mic-Distance. -0,75 +0.75 @@ -21050,7 +21070,7 @@ rwx Reflection Reflection. -0,25 +0.25 @@ -21060,7 +21080,7 @@ rwx Treble-Motor Treble-Motor. -27,8316 +27.8316 @@ -21083,6 +21103,36 @@ 0 + +ladspa-RotarySpeaker::AM-Depth +gfloat +[0,1] +rwx +AM-Depth +AM-Depth. +0.5 + + + +ladspa-RotarySpeaker::FM-Depth +gfloat +[0,1] +rwx +FM-Depth +FM-Depth. +0.5 + + + +ladspa-RotarySpeaker::Test +gfloat +[0,1] +rwx +Test +Test. +0 + + ladspa-Phaser::Amount gfloat @@ -21100,13 +21150,13 @@ rwx Center-Freq Center-Freq. -632,456 +632.456 ladspa-Phaser::Feedback gfloat -[-0,99,0,99] +[-0.99,0.99] rwx Feedback Feedback. @@ -21186,11 +21236,11 @@ ladspa-Phaser::Mod-rate gfloat -[0,01,20] +[0.01,20] rwx Mod-rate Mod-rate. -0,447214 +0.447214 @@ -21300,7 +21350,7 @@ rwx bass bass. -0,5 +0.5 @@ -21310,7 +21360,7 @@ rwx mid mid. -0,5 +0.5 @@ -21330,7 +21380,7 @@ rwx treble treble. -0,5 +0.5 @@ -21340,7 +21390,7 @@ rwx bass bass. -0,5 +0.5 @@ -21350,7 +21400,7 @@ rwx mid mid. -0,5 +0.5 @@ -21360,7 +21410,7 @@ rwx treble treble. -0,5 +0.5 @@ -21370,17 +21420,17 @@ rwx bass bass. -0,5 +0.5 ladspa-AmpVTS::drive gfloat -[0,0001,1] +[0.0001,1] rwx drive drive. -0,250075 +0.250075 @@ -21390,7 +21440,7 @@ rwx gain gain. -2,25 +2.25 @@ -21400,7 +21450,7 @@ r latency latency. --3,40282e+38 +-3.40282e+38 @@ -21430,27 +21480,27 @@ rwx treble treble. -0,75 +0.75 ladspa-AmpVTS::watts gfloat -[0,0001,1] +[0.0001,1] rwx watts watts. -0,750025 +0.750025 ladspa-AutoWah::Q gfloat -[0,001,0,999] +[0.001,0.999] rwx Q Q. -0,2505 +0.2505 @@ -21460,7 +21510,7 @@ rwx depth depth. -0,5 +0.5 @@ -21470,7 +21520,7 @@ rwx f f. -92,8051 +92.8051 @@ -21976,7 +22026,7 @@ GstDCCPClientSrc::sockfd gint ->= G_MAXULONG +>= -1 rw Socket fd The socket file descriptor. @@ -22016,7 +22066,7 @@ GstDCCPServerSink::sockfd gint ->= G_MAXULONG +>= -1 rw Socket fd The client socket file descriptor. @@ -22076,7 +22126,7 @@ GstDCCPClientSink::sockfd gint ->= G_MAXULONG +>= -1 rw Socket fd The socket file descriptor. @@ -22136,7 +22186,7 @@ GstDCCPServerSrc::sockfd gint ->= G_MAXULONG +>= -1 rw Socket fd The client socket file descriptor. @@ -22196,7 +22246,7 @@ GstMpegTSDemux::program-number gint ->= G_MAXULONG +>= -1 rw Program Number Program number to demux for (-1 to ignore). @@ -22256,7 +22306,7 @@ GstPcapParse::dst-port gint -[G_MAXULONG,65535] +[-1,65535] rw Destination port Destination port to restrict to. @@ -22276,7 +22326,7 @@ GstPcapParse::src-port gint -[G_MAXULONG,65535] +[-1,65535] rw Source port Source port to restrict to. @@ -22299,7 +22349,7 @@ rw M2TS(192 bytes) Mode -Defines what packet size to use, normal TS format ie .ts(188 bytes) or Blue-Ray disc ie .m2ts(192 bytes). +Set to TRUE to output Blu-Ray disc format with 192 byte packets. FALSE for standard TS format with 188 byte packets. FALSE @@ -22383,6 +22433,26 @@ 1 + +GstApExSink::generation +GstApExGeneration + +rw +Generation +AirPort device generation. +generation-one + + + +GstApExSink::transport-protocol +GstApExTransportProtocol + +rw +Transport Protocol +AirPort transport protocol. +tcp + + GstMJ2Mux::faststart gboolean @@ -23213,6 +23283,16 @@ TRUE + +GstCameraBin::image-formatter +GstElement* + +rw +Image formatter +Image formatter GStreamer element (default is jifmux). + + + GstDTMFSrc::interval guint @@ -23276,7 +23356,7 @@ GstRTPDTMFSrc::seqnum-offset gint ->= G_MAXULONG +>= -1 rw Sequence number Offset Offset to add to all outgoing seqnum (-1 = random). @@ -23306,7 +23386,7 @@ GstRTPDTMFSrc::timestamp-offset gint ->= G_MAXULONG +>= -1 rw Timestamp Offset Offset to add to all outgoing timestamps (-1 = random). @@ -23356,7 +23436,7 @@ GstRTPMux::seqnum-offset gint ->= G_MAXULONG +>= -1 rw Sequence number Offset Offset to add to all outgoing seqnum (-1 = random). @@ -23376,7 +23456,7 @@ GstRTPMux::timestamp-offset gint ->= G_MAXULONG +>= -1 rw Timestamp Offset Offset to add to all outgoing timestamps (-1 = random). @@ -23513,6 +23593,46 @@ FALSE + +GstFPSDisplaySink::frames-dropped +guint + +r +dropped frames +Number of frames dropped by the sink. +0 + + + +GstFPSDisplaySink::frames-rendered +guint + +r +rendered frames +Number of frames rendered. +0 + + + +GstFPSDisplaySink::last-message +gchar* + +r +Last Message +The message describing current status. +NULL + + + +GstFPSDisplaySink::silent +gboolean + +rw +enable stdout output +Don't produce last_message events. +FALSE + + GstId3Tag::v2-version gint @@ -23586,7 +23706,7 @@ ladspa-Filterclavier::Max--Resonance gfloat -[0,707,32] +[0.707,32] rwx Max--Resonance Max--Resonance. @@ -23610,7 +23730,7 @@ rwx Portamento-time Portamento-time. -44,7214 +44.7214 @@ -23650,7 +23770,7 @@ rwx Center-Frq-2 Center-Frq-2. -2990,7 +2990.7 @@ -23696,21 +23816,21 @@ ladspa-MultiChorus::Modulation-rate gfloat -[0,01,20] +[0.01,20] rwx Modulation-rate Modulation-rate. -0,447214 +0.447214 ladspa-MultiChorus::Q gfloat -[0,125,8] +[0.125,8] rwx Q Q. -0,125 +0.125 @@ -23746,17 +23866,17 @@ ladspa-MultiChorus::Min-delay gfloat -[0,1,10] +[0.1,10] rwx Min-delay Min-delay. -3,16228 +3.16228 ladspa-MultiChorus::Mod-depth gfloat -[0,1,10] +[0.1,10] rwx Mod-depth Mod-depth. @@ -23776,11 +23896,11 @@ ladspa-Compressor::Attack gfloat -[0,01,2000] +[0.01,2000] rwx Attack Attack. -4,47214 +4.47214 @@ -23820,7 +23940,7 @@ rwx Knee Knee. -2,75 +2.75 @@ -23856,11 +23976,11 @@ ladspa-Compressor::Release gfloat -[0,01,2000] +[0.01,2000] rwx Release Release. -94,5742 +94.5742 @@ -23876,11 +23996,11 @@ ladspa-Compressor::Threshold gfloat -[0,000976563,1] +[0.000976563,1] rwx Threshold Threshold. -0,250732 +0.250732 @@ -23936,11 +24056,11 @@ ladspa-Compressor::Reduction gfloat -[0,03125,1] +[0.03125,1] r Reduction Reduction. -0,03125 +0.03125 @@ -26510,7 +26630,7 @@ rw physics water density: from 1 to 4. -0 +-5.83036e+303 @@ -26550,7 +26670,7 @@ rw splash make a big splash in the center. -0 +4.77773e-299 @@ -26560,7 +26680,7 @@ rw splash make a big splash in the center. -0 +4.77773e-299 @@ -26590,7 +26710,7 @@ rw ratiox x-ratio. -3.81574e-236 +1.21136e-314 @@ -26600,7 +26720,7 @@ rw ratioy y-ratio. -2.58656e-231 +2.33156e-310 @@ -26610,7 +26730,7 @@ rw DelayTime the delay time. --6.17189e+303 +1.37974e-309 @@ -26640,7 +26760,7 @@ rw Color the color of the image. -7.05334e-30 +0 @@ -26650,7 +26770,7 @@ rw Color the color of the image. -7.05334e-30 +0 @@ -26990,7 +27110,7 @@ rw lredscale multiplier for downscaling non-edge brightness. -8.20251e-304 +0 @@ -27000,7 +27120,7 @@ rw lthresh threshold for edge lightening. -0 +6.9235e+228 @@ -27010,7 +27130,7 @@ rw lupscale multiplier for upscaling edge brightness. -7.74861e-304 +8.20074e-304 @@ -27180,7 +27300,7 @@ rw blend blend factor. -8.20251e-304 +7.75037e-304 @@ -27190,7 +27310,7 @@ rw fader the fader position. --5.83035e+303 +3.84008e-315 @@ -27370,7 +27490,7 @@ rw HSync the hsync offset. -1.86264e-09 +1 @@ -30903,6 +31023,16 @@ "" + +GstLogoinsert::data +GstBuffer* + +rw +data +Buffer containing PNG file to overlay. + + + GstMSE::chroma-psnr gdouble @@ -40730,7 +40860,7 @@ rwx Freq-1 Freq-1. -66,874 +66.874 @@ -40740,7 +40870,7 @@ rwx Freq-2 Freq-2. -66,874 +66.874 @@ -40750,7 +40880,7 @@ rwx Freq-3 Freq-3. -447,214 +447.214 @@ -40760,7 +40890,7 @@ rwx Freq-4 Freq-4. -447,214 +447.214 @@ -40770,7 +40900,7 @@ rwx Freq-5 Freq-5. -447,214 +447.214 @@ -40780,7 +40910,7 @@ rwx Freq-6 Freq-6. -2990,7 +2990.7 @@ -40790,7 +40920,7 @@ rwx Freq-7 Freq-7. -2990,7 +2990.7 @@ -40800,7 +40930,7 @@ rwx Freq-8 Freq-8. -2990,7 +2990.7 @@ -40810,7 +40940,7 @@ rwx Freq-H Freq-H. -2990,7 +2990.7 @@ -40820,7 +40950,7 @@ rwx Freq-L Freq-L. -447,214 +447.214 @@ -40840,7 +40970,7 @@ rwx HP-Freq HP-Freq. -66,874 +66.874 @@ -40916,7 +41046,7 @@ ladspa-Equalizer12Band::Level-1 gfloat -[0,015625,64] +[0.015625,64] rwx Level-1 Level-1. @@ -40926,7 +41056,7 @@ ladspa-Equalizer12Band::Level-2 gfloat -[0,015625,64] +[0.015625,64] rwx Level-2 Level-2. @@ -40936,7 +41066,7 @@ ladspa-Equalizer12Band::Level-3 gfloat -[0,015625,64] +[0.015625,64] rwx Level-3 Level-3. @@ -40946,7 +41076,7 @@ ladspa-Equalizer12Band::Level-4 gfloat -[0,015625,64] +[0.015625,64] rwx Level-4 Level-4. @@ -40956,7 +41086,7 @@ ladspa-Equalizer12Band::Level-5 gfloat -[0,015625,64] +[0.015625,64] rwx Level-5 Level-5. @@ -40966,7 +41096,7 @@ ladspa-Equalizer12Band::Level-6 gfloat -[0,015625,64] +[0.015625,64] rwx Level-6 Level-6. @@ -40976,7 +41106,7 @@ ladspa-Equalizer12Band::Level-7 gfloat -[0,015625,64] +[0.015625,64] rwx Level-7 Level-7. @@ -40986,7 +41116,7 @@ ladspa-Equalizer12Band::Level-8 gfloat -[0,015625,64] +[0.015625,64] rwx Level-8 Level-8. @@ -40996,7 +41126,7 @@ ladspa-Equalizer12Band::Level-H gfloat -[0,015625,64] +[0.015625,64] rwx Level-H Level-H. @@ -41006,7 +41136,7 @@ ladspa-Equalizer12Band::Level-L gfloat -[0,015625,64] +[0.015625,64] rwx Level-L Level-L. @@ -41066,7 +41196,7 @@ ladspa-Equalizer12Band::Q-1 gfloat -[0,1,100] +[0.1,100] rwx Q-1 Q-1. @@ -41076,7 +41206,7 @@ ladspa-Equalizer12Band::Q-2 gfloat -[0,1,100] +[0.1,100] rwx Q-2 Q-2. @@ -41086,7 +41216,7 @@ ladspa-Equalizer12Band::Q-3 gfloat -[0,1,100] +[0.1,100] rwx Q-3 Q-3. @@ -41096,7 +41226,7 @@ ladspa-Equalizer12Band::Q-4 gfloat -[0,1,100] +[0.1,100] rwx Q-4 Q-4. @@ -41106,7 +41236,7 @@ ladspa-Equalizer12Band::Q-5 gfloat -[0,1,100] +[0.1,100] rwx Q-5 Q-5. @@ -41116,7 +41246,7 @@ ladspa-Equalizer12Band::Q-6 gfloat -[0,1,100] +[0.1,100] rwx Q-6 Q-6. @@ -41126,7 +41256,7 @@ ladspa-Equalizer12Band::Q-7 gfloat -[0,1,100] +[0.1,100] rwx Q-7 Q-7. @@ -41136,7 +41266,7 @@ ladspa-Equalizer12Band::Q-8 gfloat -[0,1,100] +[0.1,100] rwx Q-8 Q-8. @@ -41240,7 +41370,7 @@ rwx Freq-1 Freq-1. -447,214 +447.214 @@ -41250,7 +41380,7 @@ rwx Freq-2 Freq-2. -447,214 +447.214 @@ -41260,7 +41390,7 @@ rwx Freq-3 Freq-3. -2990,7 +2990.7 @@ -41270,7 +41400,7 @@ rwx Freq-4 Freq-4. -2990,7 +2990.7 @@ -41280,7 +41410,7 @@ rwx Freq-H Freq-H. -2990,7 +2990.7 @@ -41290,7 +41420,7 @@ rwx Freq-L Freq-L. -447,214 +447.214 @@ -41310,7 +41440,7 @@ rwx HP-Freq HP-Freq. -66,874 +66.874 @@ -41386,7 +41516,7 @@ ladspa-Equalizer8Band::Level-1 gfloat -[0,015625,64] +[0.015625,64] rwx Level-1 Level-1. @@ -41396,7 +41526,7 @@ ladspa-Equalizer8Band::Level-2 gfloat -[0,015625,64] +[0.015625,64] rwx Level-2 Level-2. @@ -41406,7 +41536,7 @@ ladspa-Equalizer8Band::Level-3 gfloat -[0,015625,64] +[0.015625,64] rwx Level-3 Level-3. @@ -41416,7 +41546,7 @@ ladspa-Equalizer8Band::Level-4 gfloat -[0,015625,64] +[0.015625,64] rwx Level-4 Level-4. @@ -41426,7 +41556,7 @@ ladspa-Equalizer8Band::Level-H gfloat -[0,015625,64] +[0.015625,64] rwx Level-H Level-H. @@ -41436,7 +41566,7 @@ ladspa-Equalizer8Band::Level-L gfloat -[0,015625,64] +[0.015625,64] rwx Level-L Level-L. @@ -41496,7 +41626,7 @@ ladspa-Equalizer8Band::Q-1 gfloat -[0,1,100] +[0.1,100] rwx Q-1 Q-1. @@ -41506,7 +41636,7 @@ ladspa-Equalizer8Band::Q-2 gfloat -[0,1,100] +[0.1,100] rwx Q-2 Q-2. @@ -41516,7 +41646,7 @@ ladspa-Equalizer8Band::Q-3 gfloat -[0,1,100] +[0.1,100] rwx Q-3 Q-3. @@ -41526,7 +41656,7 @@ ladspa-Equalizer8Band::Q-4 gfloat -[0,1,100] +[0.1,100] rwx Q-4 Q-4. @@ -41620,7 +41750,7 @@ rwx Freq-1 Freq-1. -447,214 +447.214 @@ -41630,7 +41760,7 @@ rwx Freq-2 Freq-2. -447,214 +447.214 @@ -41640,7 +41770,7 @@ rwx Freq-3 Freq-3. -2990,7 +2990.7 @@ -41650,7 +41780,7 @@ rwx Freq-H Freq-H. -2990,7 +2990.7 @@ -41660,7 +41790,7 @@ rwx Freq-L Freq-L. -447,214 +447.214 @@ -41696,7 +41826,7 @@ ladspa-Equalizer5Band::Level-1 gfloat -[0,015625,64] +[0.015625,64] rwx Level-1 Level-1. @@ -41706,7 +41836,7 @@ ladspa-Equalizer5Band::Level-2 gfloat -[0,015625,64] +[0.015625,64] rwx Level-2 Level-2. @@ -41716,7 +41846,7 @@ ladspa-Equalizer5Band::Level-3 gfloat -[0,015625,64] +[0.015625,64] rwx Level-3 Level-3. @@ -41726,7 +41856,7 @@ ladspa-Equalizer5Band::Level-H gfloat -[0,015625,64] +[0.015625,64] rwx Level-H Level-H. @@ -41736,7 +41866,7 @@ ladspa-Equalizer5Band::Level-L gfloat -[0,015625,64] +[0.015625,64] rwx Level-L Level-L. @@ -41796,7 +41926,7 @@ ladspa-Equalizer5Band::Q-1 gfloat -[0,1,100] +[0.1,100] rwx Q-1 Q-1. @@ -41806,7 +41936,7 @@ ladspa-Equalizer5Band::Q-2 gfloat -[0,1,100] +[0.1,100] rwx Q-2 Q-2. @@ -41816,7 +41946,7 @@ ladspa-Equalizer5Band::Q-3 gfloat -[0,1,100] +[0.1,100] rwx Q-3 Q-3. @@ -41876,7 +42006,7 @@ ladspa-Pulsator::Frequency gfloat -[0,01,100] +[0.01,100] rwx Frequency Frequency. @@ -41970,7 +42100,7 @@ rwx Offset-L-R Offset-L-R. -0,5 +0.5 @@ -42076,7 +42206,7 @@ ladspa-Deesser::Gain gfloat -[0,0625,16] +[0.0625,16] rwx Gain Gain. @@ -42086,11 +42216,11 @@ ladspa-Deesser::Gain-Reduction gfloat -[0,03125,1] +[0.03125,1] r Gain-Reduction Gain-Reduction. -0,03125 +0.03125 @@ -42106,11 +42236,11 @@ ladspa-Deesser::Level gfloat -[0,0625,16] +[0.0625,16] rwx Level Level. -4,04688 +4.04688 @@ -42150,13 +42280,13 @@ rwx Peak Peak. -2763,47 +2763.47 ladspa-Deesser::Peak-Q gfloat -[0,1,100] +[0.1,100] rwx Peak-Q Peak-Q. @@ -42190,57 +42320,57 @@ rwx Split Split. -2763,47 +2763.47 ladspa-Deesser::Threshold gfloat -[0,000976563,1] +[0.000976563,1] rwx Threshold Threshold. -0,250732 +0.250732 ladspa-Multibandcompressor::Attack-1 gfloat -[0,01,2000] +[0.01,2000] rwx Attack-1 Attack-1. -94,5742 +94.5742 ladspa-Multibandcompressor::Attack-2 gfloat -[0,01,2000] +[0.01,2000] rwx Attack-2 Attack-2. -94,5742 +94.5742 ladspa-Multibandcompressor::Attack-3 gfloat -[0,01,2000] +[0.01,2000] rwx Attack-3 Attack-3. -4,47214 +4.47214 ladspa-Multibandcompressor::Attack-4 gfloat -[0,01,2000] +[0.01,2000] rwx Attack-4 Attack-4. -4,47214 +4.47214 @@ -42336,7 +42466,7 @@ ladspa-Multibandcompressor::Gain-Reduction-1 gfloat -[0,03125,1] +[0.03125,1] r Gain-Reduction-1 Gain-Reduction-1. @@ -42346,7 +42476,7 @@ ladspa-Multibandcompressor::Gain-Reduction-2 gfloat -[0,03125,1] +[0.03125,1] r Gain-Reduction-2 Gain-Reduction-2. @@ -42356,7 +42486,7 @@ ladspa-Multibandcompressor::Gain-Reduction-3 gfloat -[0,03125,1] +[0.03125,1] r Gain-Reduction-3 Gain-Reduction-3. @@ -42366,7 +42496,7 @@ ladspa-Multibandcompressor::Gain-Reduction-4 gfloat -[0,03125,1] +[0.03125,1] r Gain-Reduction-4 Gain-Reduction-4. @@ -42410,7 +42540,7 @@ rwx Knee-1 Knee-1. -2,75 +2.75 @@ -42420,7 +42550,7 @@ rwx Knee-2 Knee-2. -2,75 +2.75 @@ -42430,7 +42560,7 @@ rwx Knee-3 Knee-3. -2,75 +2.75 @@ -42440,7 +42570,7 @@ rwx Knee-4 Knee-4. -2,75 +2.75 @@ -42596,31 +42726,31 @@ ladspa-Multibandcompressor::Q1 gfloat -[0,25,4] +[0.25,4] rwx Q1 Q1. -1,1875 +1.1875 ladspa-Multibandcompressor::Q2 gfloat -[0,25,4] +[0.25,4] rwx Q2 Q2. -1,1875 +1.1875 ladspa-Multibandcompressor::Q3 gfloat -[0,25,4] +[0.25,4] rwx Q3 Q3. -1,1875 +1.1875 @@ -42666,7 +42796,7 @@ ladspa-Multibandcompressor::Release-1 gfloat -[0,01,2000] +[0.01,2000] rwx Release-1 Release-1. @@ -42676,61 +42806,61 @@ ladspa-Multibandcompressor::Release-2 gfloat -[0,01,2000] +[0.01,2000] rwx Release-2 Release-2. -94,5742 +94.5742 ladspa-Multibandcompressor::Release-3 gfloat -[0,01,2000] +[0.01,2000] rwx Release-3 Release-3. -94,5742 +94.5742 ladspa-Multibandcompressor::Release-4 gfloat -[0,01,2000] +[0.01,2000] rwx Release-4 Release-4. -4,47214 +4.47214 ladspa-Multibandcompressor::S1 gfloat -[-0,5,0,5] +[-0.5,0.5] rwx S1 S1. --0,25 +-0.25 ladspa-Multibandcompressor::S2 gfloat -[-0,5,0,5] +[-0.5,0.5] rwx S2 S2. --0,25 +-0.25 ladspa-Multibandcompressor::S3 gfloat -[-0,5,0,5] +[-0.5,0.5] rwx S3 S3. --0,25 +-0.25 @@ -42750,7 +42880,7 @@ rwx Split-2-3 Split-2-3. -447,214 +447.214 @@ -42760,47 +42890,47 @@ rwx Split-3-4 Split-3-4. -2990,7 +2990.7 ladspa-Multibandcompressor::Threshold-1 gfloat -[0,000976563,1] +[0.000976563,1] rwx Threshold-1 Threshold-1. -0,000976563 +0.000976563 ladspa-Multibandcompressor::Threshold-2 gfloat -[0,000976563,1] +[0.000976563,1] rwx Threshold-2 Threshold-2. -0,000976563 +0.000976563 ladspa-Multibandcompressor::Threshold-3 gfloat -[0,000976563,1] +[0.000976563,1] rwx Threshold-3 Threshold-3. -0,000976563 +0.000976563 ladspa-Multibandcompressor::Threshold-4 gfloat -[0,000976563,1] +[0.000976563,1] rwx Threshold-4 Threshold-4. -0,000976563 +0.000976563 @@ -42846,11 +42976,11 @@ ladspa-Sidechaincompressor::Attack gfloat -[0,01,2000] +[0.01,2000] rwx Attack Attack. -4,47214 +4.47214 @@ -42890,13 +43020,13 @@ rwx F1-Freq F1-Freq. -424,264 +424.264 ladspa-Sidechaincompressor::F1-Level gfloat -[0,0625,16] +[0.0625,16] rwx F1-Level F1-Level. @@ -42920,13 +43050,13 @@ rwx F2-Freq F2-Freq. -2763,47 +2763.47 ladspa-Sidechaincompressor::F2-Level gfloat -[0,0625,16] +[0.0625,16] rwx F2-Level F2-Level. @@ -42936,11 +43066,11 @@ ladspa-Sidechaincompressor::Gain-Reduction gfloat -[0,03125,1] +[0.03125,1] r Gain-Reduction Gain-Reduction. -0,03125 +0.03125 @@ -42970,7 +43100,7 @@ rwx Knee Knee. -2,75 +2.75 @@ -43006,11 +43136,11 @@ ladspa-Sidechaincompressor::Release gfloat -[0,01,2000] +[0.01,2000] rwx Release Release. -94,5742 +94.5742 @@ -43046,11 +43176,11 @@ ladspa-Sidechaincompressor::Threshold gfloat -[0,000976563,1] +[0.000976563,1] rwx Threshold Threshold. -0,250732 +0.250732 @@ -45549,7 +45679,7 @@ [0,10] rw Quality -Quality. +Quality. This parameter sets a constant quantizer. 5 @@ -45603,6 +45733,26 @@ FALSE + +GstVP8Enc::max-quantizer +gint +[0,63] +rw +Maximum quantizer +Maximum (worst) quantizer. +63 + + + +GstVP8Enc::min-quantizer +gint +[0,63] +rw +Minimum quantizer +Minimum (best) quantizer. +0 + + GstPhotography::aperture guint @@ -45946,7 +46096,7 @@ GstVideoMaxRate::average-period guint64 -[1,G_MAXLONG] +[1,G_MAXINT64] rw Period over which to average Period over which to average the framerate (in ns). @@ -45980,7 +46130,7 @@ rw Permissions on the shm area Permissions to set on the shm area. -504 +416 @@ -46706,7 +46856,7 @@ GstCvSobel::x-order gint ->= G_MAXULONG +>= -1 rw x order Order of the derivative x. @@ -46716,7 +46866,7 @@ GstCvSobel::y-order gint ->= G_MAXULONG +>= -1 rw y order Order of the derivative y. @@ -46796,7 +46946,7 @@ GstJP2kDecimator::max-decomposition-levels gint -[G_MAXULONG,32] +[-1,32] rw Maximum Number of Decomposition Levels Maximum number of decomposition levels to keep (-1 == all). @@ -47186,7 +47336,7 @@ GstTSDemux::program-number gint ->= G_MAXULONG +>= -1 rw Program number Program Number to demux for (-1 to ignore). @@ -47323,3 +47473,10023 @@ NULL + +GstFieldAnalysis::block-height +guint64 + +rw +Block height +Block height for windowed comb detection. +16 + + + +GstFieldAnalysis::block-threshold +guint64 + +rw +Block threshold +Block threshold for windowed comb detection. +80 + + + +GstFieldAnalysis::block-width +guint64 + +rw +Block width +Block width for windowed comb detection. +16 + + + +GstFieldAnalysis::comb-method +FieldAnalysisCombMethod + +rw +Comb-detection Method +Metric to be used for identifying comb artifacts if using windowed comb detection. +5-tap [1,-3,4,-3,1] vertical filter result is larger than spatial threshold*6 + + + +GstFieldAnalysis::field-metric +GstFieldAnalysisFieldMetric + +rw +Field Metric +Metric to be used for comparing same parity fields to decide if they are a repeated field for telecine. +Sum of Squared Differences + + + +GstFieldAnalysis::field-threshold +gfloat +>= 0 +rw +Field Threshold +Threshold for field metric decisions. +0.08 + + + +GstFieldAnalysis::frame-metric +GstFieldAnalysisFrameMetric + +rw +Frame Metric +Metric to be used for comparing opposite parity fields to decide if they are a progressive frame. +5-tap [1,-3,4,-3,1] Vertical Filter + + + +GstFieldAnalysis::frame-threshold +gfloat +>= 0 +rw +Frame Threshold +Threshold for frame metric decisions. +0.002 + + + +GstFieldAnalysis::ignored-lines +guint64 +>= 2 +rw +Ignored lines +Ignore this many lines from the top and bottom for windowed comb detection. +2 + + + +GstFieldAnalysis::noise-floor +guint + +rw +Noise Floor +Noise floor for appropriate metrics (per-pixel metric values with a score less than this will be ignored). +16 + + + +GstFieldAnalysis::spatial-threshold +gint64 +>= 0 +rw +Spatial Combing Threshold +Threshold for combing metric decisions. +9 + + + +GstHLSDemux::bitrate-switch-tolerance +gfloat +[0,1] +rw +Bitrate switch tolerance +Tolerance with respect of the fragment duration to switch to a different bitrate if the client is too slow/fast. +0.4 + + + +GstHLSDemux::fragments-cache +guint +>= 2 +rw +Fragments cache +Number of fragments needed to be cached to start playing. +3 + + + +GstWrapperCameraBinSrc::video-src +GstElement* + +rw +Video source +The video source element to be used. + + + + +GstWrapperCameraBinSrc::video-source +GstElement* + +rw +Video source +The video source element to be used. + + + + +GstWrapperCameraBinSrc::video-source-filter +GstElement* + +rw +Video source filter +Optional video source filter element. + + + + +GstViewfinderBin::video-sink +GstElement* + +rw +Video Sink +the video output element to use (NULL = default). + + + + +GstImageCaptureBin::image-encoder +GstElement* + +rw +Image encoder +Image encoder GStreamer element (default is jpegenc). + + + + +GstImageCaptureBin::image-muxer +GstElement* + +rw +Image muxer +Image muxer GStreamer element (default is jifmux). + + + + +GstImageCaptureBin::location +gchar* + +rw +Location +Location to save the captured files. A %%d can be used as a placeholder for a capture count. +"img_%d" + + + +GstCameraBin2::audio-capture-caps +GstCaps* + +rw +Audio capture caps +Format to capture audio for video recording represented as GstCaps. + + + + +GstCameraBin2::audio-capture-supported-caps +GstCaps* + +r +Audio capture supported caps +Formats supported for capturing audio represented as GstCaps. + + + + +GstCameraBin2::audio-src +GstElement* + +rw +Audio source +The audio source element to be used on video recordings. It is only taken into use on the next null to ready transition. + + + + +GstCameraBin2::camera-src +GstElement* + +rw +Camera source +The camera source element to be used. It is only taken into use on the next null to ready transition. + + + + +GstCameraBin2::idle +gboolean + +r +Idle +If camerabin2 is idle (not doing captures). +TRUE + + + +GstCameraBin2::image-capture-caps +GstCaps* + +rw +Image capture caps +Caps for image capture. + + + + +GstCameraBin2::image-capture-encoder +GstElement* + +rw +Image capture encoder +The image encoder element to be used on image captures. + + + + +GstCameraBin2::image-capture-muxer +GstElement* + +rw +Image capture encoder +The image encoder element to be used on image captures. + + + + +GstCameraBin2::image-capture-supported-caps +GstCaps* + +r +Image capture supported caps +Formats supported for capturing images represented as GstCaps. + + + + +GstCameraBin2::image-filter +GstElement* + +rw +Image filter +The element that will process captured image frames. (Should be set on NULL state). + + + + +GstCameraBin2::location +gchar* + +rw +Location +Location to save the captured files. A %d might be used on thefilename as a placeholder for a numeric index of the capture.Default for images is img_%d and vid_%d for videos. +"img_%d" + + + +GstCameraBin2::max-zoom +gfloat +>= 1 +r +Maximum zoom level (note: may change depending on resolution/implementation) +Digital zoom factor (e.g. 1.5 means 1.5x). +10 + + + +GstCameraBin2::mode +GstCameraBin2Mode + +rw +Mode +The capture mode (still image capture or video recording). +Still image capture (default) + + + +GstCameraBin2::mute +gboolean + +rw +Mute +If the audio recording should be muted. Note that this still saves audio data to the resulting file, but they are silent. Use a video-profile without audio to disable audio completely. +FALSE + + + +GstCameraBin2::post-previews +gboolean + +rw +Post Previews +If capture preview images should be posted to the bus. +TRUE + + + +GstCameraBin2::preview-caps +GstCaps* + +rw +Preview caps +The caps of the preview image to be posted. + + + + +GstCameraBin2::preview-filter +GstElement* + +rw +Preview filter +The element that will process preview buffers. (Should be set on NULL state). + + + + +GstCameraBin2::video-capture-caps +GstCaps* + +rw +Video capture caps +Caps for video capture. + + + + +GstCameraBin2::video-capture-supported-caps +GstCaps* + +r +Video capture supported caps +Formats supported for capturing videos represented as GstCaps. + + + + +GstCameraBin2::video-filter +GstElement* + +rw +Video filter +The element that will process captured video frames. (Should be set on NULL state). + + + + +GstCameraBin2::video-profile +GstEncodingProfile* + +rw +Video Profile +The GstEncodingProfile to use for video recording. Audio is enabled when this profile supports audio. + + + + +GstCameraBin2::viewfinder-caps +GstCaps* + +rw +Viewfinder caps +Restricts the caps that can be used on the viewfinder. + + + + +GstCameraBin2::viewfinder-filter +GstElement* + +rw +Viewfinder filter +The element that will process frames going to the viewfinder. (Should be set on NULL state). + + + + +GstCameraBin2::viewfinder-sink +GstElement* + +rw +Viewfinder sink +The video sink of the viewfinder. It is only taken into use on the next null to ready transition. + + + + +GstCameraBin2::viewfinder-supported-caps +GstCaps* + +r +Camera source Viewfinder pad supported caps +The caps that the camera source can produce on the viewfinder pad. + + + + +GstCameraBin2::zoom +gfloat +[1,10] +rw +Zoom +Digital zoom factor (e.g. 1.5 means 1.5x). +1 + + + +GstCameraBin2::image-profile +GstEncodingProfile* + +rw +Image Profile +The GstEncodingProfile to use for image captures. + + + + +GstCameraBin2::audio-source +GstElement* + +rw +Audio source +The audio source element to be used on video recordings. It is only taken into use on the next null to ready transition. + + + + +GstCameraBin2::camera-source +GstElement* + +rw +Camera source +The camera source element to be used. It is only taken into use on the next null to ready transition. + + + + +GstZebraStripe::threshold +gint +[0,100] +rwx +Threshold +Threshold above which the video is striped. +90 + + + +GstOpencvTextOverlay::colorB +gint +[0,255] +rw +color -Blue +Sets the color -B. +0 + + + +GstOpencvTextOverlay::colorG +gint +[0,255] +rw +color -Green +Sets the color -G. +0 + + + +GstOpencvTextOverlay::colorR +gint +[0,255] +rw +color -Red +Sets the color -R. +0 + + + +GstOpencvTextOverlay::height +gdouble +[1,5] +rw +Height +Sets the height of fonts. +1 + + + +GstOpencvTextOverlay::text +gchar* + +rw +text +Text to be display. +"" + + + +GstOpencvTextOverlay::thickness +gint +>= 0 +rw +font thickness +Sets the Thickness of Font. +2 + + + +GstOpencvTextOverlay::width +gdouble +[1,5] +rw +Width +Sets the width of fonts. +1 + + + +GstOpencvTextOverlay::xpos +gint +>= 0 +rw +horizontal position +Sets the Horizontal position. +50 + + + +GstOpencvTextOverlay::ypos +gint +>= 0 +rw +vertical position +Sets the Vertical position. +50 + + + +GstLinsysSdiSrc::device +gchar* + +rw +Device +device to transmit data on. +"/dev/sdirx0" + + + +GstLinsysSdiSink::device +gchar* + +rw +Device +device to transmit data on. +"/dev/sditx0" + + + +GstVideo3DPresent::mode +GstVideo3DPresentMode + +rw +Mode +Presentation mode. +Left/Right + + + +GstVideo3DMerge::mode +GstVideo3DLayout + +rw +Mode +Interleaving mode. +Memory Consecutive (top-bottom) + + + +GstVideo3DConvert::mode +GstVideo3DConvertMode + +rw +Mode +Convertion mode. +Unknown + + + +calf-sourceforge-net-plugins-Wavetable::adsr-a +gfloat +[1,20000] +rwx +EG1 Attack +EG1 Attack. +1 + + + +calf-sourceforge-net-plugins-Wavetable::adsr-d +gfloat +[10,20000] +rwx +EG1 Decay +EG1 Decay. +350 + + + +calf-sourceforge-net-plugins-Wavetable::adsr-f +gfloat +[-10000,10000] +rwx +EG1 Fade +EG1 Fade. +0 + + + +calf-sourceforge-net-plugins-Wavetable::adsr-r +gfloat +[10,20000] +rwx +EG1 Release +EG1 Release. +50 + + + +calf-sourceforge-net-plugins-Wavetable::adsr-s +gfloat +[0,1] +rwx +EG1 Sustain +EG1 Sustain. +0.5 + + + +calf-sourceforge-net-plugins-Wavetable::adsr-v +gfloat +[0,1] +rwx +EG1 VelMod +EG1 VelMod. +1 + + + +calf-sourceforge-net-plugins-Wavetable::adsr2-a +gfloat +[1,20000] +rwx +EG2 Attack +EG2 Attack. +1 + + + +calf-sourceforge-net-plugins-Wavetable::adsr2-d +gfloat +[10,20000] +rwx +EG2 Decay +EG2 Decay. +350 + + + +calf-sourceforge-net-plugins-Wavetable::adsr2-f +gfloat +[-10000,10000] +rwx +EG2 Fade +EG2 Fade. +0 + + + +calf-sourceforge-net-plugins-Wavetable::adsr2-r +gfloat +[10,20000] +rwx +EG2 Release +EG2 Release. +50 + + + +calf-sourceforge-net-plugins-Wavetable::adsr2-s +gfloat +[0,1] +rwx +EG2 Sustain +EG2 Sustain. +0.5 + + + +calf-sourceforge-net-plugins-Wavetable::adsr2-v +gfloat +[0,1] +rwx +EG2 VelMod +EG2 VelMod. +1 + + + +calf-sourceforge-net-plugins-Wavetable::adsr3-a +gfloat +[1,20000] +rwx +EG3 Attack +EG3 Attack. +1 + + + +calf-sourceforge-net-plugins-Wavetable::adsr3-d +gfloat +[10,20000] +rwx +EG3 Decay +EG3 Decay. +350 + + + +calf-sourceforge-net-plugins-Wavetable::adsr3-f +gfloat +[-10000,10000] +rwx +EG3 Fade +EG3 Fade. +0 + + + +calf-sourceforge-net-plugins-Wavetable::adsr3-r +gfloat +[10,20000] +rwx +EG3 Release +EG3 Release. +50 + + + +calf-sourceforge-net-plugins-Wavetable::adsr3-s +gfloat +[0,1] +rwx +EG3 Sustain +EG3 Sustain. +0.5 + + + +calf-sourceforge-net-plugins-Wavetable::adsr3-v +gfloat +[0,1] +rwx +EG3 VelMod +EG3 VelMod. +0 + + + +calf-sourceforge-net-plugins-Wavetable::o1detune +gint +[-100,100] +rwx +Osc1 Detune +Osc1 Detune. +6 + + + +calf-sourceforge-net-plugins-Wavetable::o1level +gfloat +[0,1] +rwx +Osc1 Level +Osc1 Level. +0.1 + + + +calf-sourceforge-net-plugins-Wavetable::o1offset +gfloat +[-1,1] +rwx +Osc1 Ctl +Osc1 Ctl. +0.2 + + + +calf-sourceforge-net-plugins-Wavetable::o1trans +gint +[-48,48] +rwx +Osc1 Transpose +Osc1 Transpose. +0 + + + +calf-sourceforge-net-plugins-Wavetable::o1wave +gint +[0,28] +rwx +Osc1 Wave +Osc1 Wave. +28 + + + +calf-sourceforge-net-plugins-Wavetable::o2detune +gint +[-100,100] +rwx +Osc2 Detune +Osc2 Detune. +-6 + + + +calf-sourceforge-net-plugins-Wavetable::o2level +gfloat +[0,1] +rwx +Osc2 Level +Osc2 Level. +0 + + + +calf-sourceforge-net-plugins-Wavetable::o2offset +gfloat +[-1,1] +rwx +Osc2 Ctl +Osc2 Ctl. +0.4 + + + +calf-sourceforge-net-plugins-Wavetable::o2trans +gint +[-48,48] +rwx +Osc2 Transpose +Osc2 Transpose. +0 + + + +calf-sourceforge-net-plugins-Wavetable::o2wave +gint +[0,28] +rwx +Osc2 Wave +Osc2 Wave. +0 + + + +calf-sourceforge-net-plugins-Wavetable::pbend-range +gfloat +[0,2400] +rwx +PBend Range +PBend Range. +200 + + + +calf-sourceforge-net-plugins-VintageDelay::amount +gfloat +[0,4] +rwx +Amount +Amount. +0.25 + + + +calf-sourceforge-net-plugins-VintageDelay::bpm +gfloat +[30,300] +rwx +Tempo +Tempo. +120 + + + +calf-sourceforge-net-plugins-VintageDelay::dry +gfloat +[0,4] +rwx +Dry Amount +Dry Amount. +1 + + + +calf-sourceforge-net-plugins-VintageDelay::feedback +gfloat +[0,1] +rwx +Feedback +Feedback. +0.5 + + + +calf-sourceforge-net-plugins-VintageDelay::medium +gint +[0,2] +rwx +Medium +Medium. +1 + + + +calf-sourceforge-net-plugins-VintageDelay::mix-mode +gint +[0,3] +rwx +Mix mode +Mix mode. +1 + + + +calf-sourceforge-net-plugins-VintageDelay::subdiv +gint +[1,16] +rwx +Subdivide +Subdivide. +4 + + + +calf-sourceforge-net-plugins-VintageDelay::time-l +gint +[1,16] +rwx +Time L +Time L. +3 + + + +calf-sourceforge-net-plugins-VintageDelay::time-r +gint +[1,16] +rwx +Time R +Time R. +5 + + + +calf-sourceforge-net-plugins-VintageDelay::width +gfloat +[-1,1] +rwx +Stereo Width +Stereo Width. +1 + + + +calf-sourceforge-net-plugins-Sidechaingate::attack +gfloat +[0.01,2000] +rwx +Attack +Attack. +20 + + + +calf-sourceforge-net-plugins-Sidechaingate::bypass +gboolean + +rwx +Bypass +Bypass. +FALSE + + + +calf-sourceforge-net-plugins-Sidechaingate::clip-in +gboolean + +r +0dB-In +0dB-In. +FALSE + + + +calf-sourceforge-net-plugins-Sidechaingate::clip-out +gboolean + +r +0dB-Out +0dB-Out. +FALSE + + + +calf-sourceforge-net-plugins-Sidechaingate::detection +gint +[0,1] +rwx +Detection +Detection. +0 + + + +calf-sourceforge-net-plugins-Sidechaingate::f1-active +gboolean + +r +F1 Active +F1 Active. +FALSE + + + +calf-sourceforge-net-plugins-Sidechaingate::f1-freq +gfloat +[10,18000] +rwx +F1 Freq +F1 Freq. +250 + + + +calf-sourceforge-net-plugins-Sidechaingate::f1-level +gfloat +[0.0625,16] +rwx +F1 Level +F1 Level. +1 + + + +calf-sourceforge-net-plugins-Sidechaingate::f2-active +gboolean + +r +F2 Active +F2 Active. +FALSE + + + +calf-sourceforge-net-plugins-Sidechaingate::f2-freq +gfloat +[10,18000] +rwx +F2 Freq +F2 Freq. +4500 + + + +calf-sourceforge-net-plugins-Sidechaingate::f2-level +gfloat +[0.0625,16] +rwx +F2 Level +F2 Level. +1 + + + +calf-sourceforge-net-plugins-Sidechaingate::gating +gfloat +[0,1] +r +Gating +Gating. +0 + + + +calf-sourceforge-net-plugins-Sidechaingate::knee +gfloat +[1,8] +rwx +Knee +Knee. +2.82843 + + + +calf-sourceforge-net-plugins-Sidechaingate::level-in +gfloat +[0,64] +rwx +Input +Input. +1 + + + +calf-sourceforge-net-plugins-Sidechaingate::makeup +gfloat +[1,64] +rwx +Makeup Gain +Makeup Gain. +1 + + + +calf-sourceforge-net-plugins-Sidechaingate::meter-in +gfloat +[0,1] +r +Input +Input. +0 + + + +calf-sourceforge-net-plugins-Sidechaingate::meter-out +gfloat +[0,1] +r +Output +Output. +0 + + + +calf-sourceforge-net-plugins-Sidechaingate::range +gfloat +[0,1] +rwx +Max Gain Reduction +Max Gain Reduction. +0.06125 + + + +calf-sourceforge-net-plugins-Sidechaingate::ratio +gfloat +[1,20] +rwx +Ratio +Ratio. +2 + + + +calf-sourceforge-net-plugins-Sidechaingate::release +gfloat +[0.01,2000] +rwx +Release +Release. +250 + + + +calf-sourceforge-net-plugins-Sidechaingate::sc-listen +gboolean + +rwx +S/C-Listen +S/C-Listen. +FALSE + + + +calf-sourceforge-net-plugins-Sidechaingate::sc-mode +gint +[0,9] +rwx +Sidechain Mode +Sidechain Mode. +0 + + + +calf-sourceforge-net-plugins-Sidechaingate::stereo-link +gint +[0,1] +rwx +Stereo Link +Stereo Link. +0 + + + +calf-sourceforge-net-plugins-Sidechaingate::threshold +gfloat +[0.000976563,1] +rwx +Threshold +Threshold. +0.125 + + + +calf-sourceforge-net-plugins-Sidechaincompressor::attack +gfloat +[0.01,2000] +rwx +Attack +Attack. +20 + + + +calf-sourceforge-net-plugins-Sidechaincompressor::bypass +gboolean + +rwx +Bypass +Bypass. +FALSE + + + +calf-sourceforge-net-plugins-Sidechaincompressor::clip-in +gboolean + +r +0dB-In +0dB-In. +FALSE + + + +calf-sourceforge-net-plugins-Sidechaincompressor::clip-out +gboolean + +r +0dB-Out +0dB-Out. +FALSE + + + +calf-sourceforge-net-plugins-Sidechaincompressor::compression +gfloat +[0,1] +r +Gain Reduction +Gain Reduction. +0 + + + +calf-sourceforge-net-plugins-Sidechaincompressor::detection +gint +[0,1] +rwx +Detection +Detection. +0 + + + +calf-sourceforge-net-plugins-Sidechaincompressor::f1-active +gboolean + +r +F1 Active +F1 Active. +FALSE + + + +calf-sourceforge-net-plugins-Sidechaincompressor::f1-freq +gfloat +[10,18000] +rwx +F1 Freq +F1 Freq. +250 + + + +calf-sourceforge-net-plugins-Sidechaincompressor::f1-level +gfloat +[0.0625,16] +rwx +F1 Level +F1 Level. +1 + + + +calf-sourceforge-net-plugins-Sidechaincompressor::f2-active +gboolean + +r +F2 Active +F2 Active. +FALSE + + + +calf-sourceforge-net-plugins-Sidechaincompressor::f2-freq +gfloat +[10,18000] +rwx +F2 Freq +F2 Freq. +4500 + + + +calf-sourceforge-net-plugins-Sidechaincompressor::f2-level +gfloat +[0.0625,16] +rwx +F2 Level +F2 Level. +1 + + + +calf-sourceforge-net-plugins-Sidechaincompressor::knee +gfloat +[1,8] +rwx +Knee +Knee. +2.82843 + + + +calf-sourceforge-net-plugins-Sidechaincompressor::level-in +gfloat +[0,64] +rwx +Input +Input. +1 + + + +calf-sourceforge-net-plugins-Sidechaincompressor::makeup +gfloat +[1,64] +rwx +Makeup Gain +Makeup Gain. +2 + + + +calf-sourceforge-net-plugins-Sidechaincompressor::meter-in +gfloat +[0,1] +r +Input +Input. +0 + + + +calf-sourceforge-net-plugins-Sidechaincompressor::meter-out +gfloat +[0,1] +r +Output +Output. +0 + + + +calf-sourceforge-net-plugins-Sidechaincompressor::ratio +gfloat +[1,20] +rwx +Ratio +Ratio. +2 + + + +calf-sourceforge-net-plugins-Sidechaincompressor::release +gfloat +[0.01,2000] +rwx +Release +Release. +250 + + + +calf-sourceforge-net-plugins-Sidechaincompressor::sc-listen +gboolean + +rwx +S/C-Listen +S/C-Listen. +FALSE + + + +calf-sourceforge-net-plugins-Sidechaincompressor::sc-mode +gint +[0,9] +rwx +Sidechain Mode +Sidechain Mode. +0 + + + +calf-sourceforge-net-plugins-Sidechaincompressor::stereo-link +gint +[0,1] +rwx +Stereo Link +Stereo Link. +0 + + + +calf-sourceforge-net-plugins-Sidechaincompressor::threshold +gfloat +[0.000976563,1] +rwx +Threshold +Threshold. +0.125 + + + +calf-sourceforge-net-plugins-Saturator::blend +gfloat +[-10,10] +rwx +Blend +Blend. +10 + + + +calf-sourceforge-net-plugins-Saturator::bypass +gboolean + +rwx +Bypass +Bypass. +FALSE + + + +calf-sourceforge-net-plugins-Saturator::clip-in +gfloat +[0,1] +r +0dB +0dB. +0 + + + +calf-sourceforge-net-plugins-Saturator::clip-out +gfloat +[0,1] +r +0dB +0dB. +0 + + + +calf-sourceforge-net-plugins-Saturator::drive +gfloat +[0.1,10] +rwx +Saturation +Saturation. +5 + + + +calf-sourceforge-net-plugins-Saturator::hp-post-freq +gfloat +[10,20000] +rwx +Highpass +Highpass. +10 + + + +calf-sourceforge-net-plugins-Saturator::hp-pre-freq +gfloat +[10,20000] +rwx +Highpass +Highpass. +10 + + + +calf-sourceforge-net-plugins-Saturator::level-in +gfloat +[1,64] +rwx +Activation +Activation. +1 + + + +calf-sourceforge-net-plugins-Saturator::level-out +gfloat +[0,64] +rwx +Master +Master. +1 + + + +calf-sourceforge-net-plugins-Saturator::lp-post-freq +gfloat +[10,20000] +rwx +Lowpass +Lowpass. +20000 + + + +calf-sourceforge-net-plugins-Saturator::lp-pre-freq +gfloat +[10,20000] +rwx +Lowpass +Lowpass. +20000 + + + +calf-sourceforge-net-plugins-Saturator::meter-drive +gfloat +[0,1] +r +Drive +Drive. +0 + + + +calf-sourceforge-net-plugins-Saturator::meter-in +gfloat +[0,1] +r +Input +Input. +0 + + + +calf-sourceforge-net-plugins-Saturator::meter-out +gfloat +[0,1] +r +Output +Output. +0 + + + +calf-sourceforge-net-plugins-Saturator::mix +gfloat +[0,1] +rwx +Mix +Mix. +1 + + + +calf-sourceforge-net-plugins-Saturator::p-freq +gfloat +[80,8000] +rwx +Tone +Tone. +2000 + + + +calf-sourceforge-net-plugins-Saturator::p-level +gfloat +[0.0625,16] +rwx +Amount +Amount. +1 + + + +calf-sourceforge-net-plugins-Saturator::p-q +gfloat +[0.1,10] +rwx +Gradient +Gradient. +1 + + + +calf-sourceforge-net-plugins-RotarySpeaker::bass-speed +gfloat +[10,600] +rwx +Bass Motor +Bass Motor. +30 + + + +calf-sourceforge-net-plugins-RotarySpeaker::meter-h +gfloat +[0,1] +r +High rotor +High rotor. +0 + + + +calf-sourceforge-net-plugins-RotarySpeaker::meter-l +gfloat +[0,1] +r +Low rotor +Low rotor. +0 + + + +calf-sourceforge-net-plugins-RotarySpeaker::mic-distance +gfloat +[0,1] +rwx +Mic Distance +Mic Distance. +0.7 + + + +calf-sourceforge-net-plugins-RotarySpeaker::mod-depth +gfloat +[0,1] +rwx +FM Depth +FM Depth. +0.45 + + + +calf-sourceforge-net-plugins-RotarySpeaker::reflection +gfloat +[0,1] +rwx +Reflection +Reflection. +0.3 + + + +calf-sourceforge-net-plugins-RotarySpeaker::shift +gfloat +[0,1] +rwx +Tap Offset +Tap Offset. +0.5 + + + +calf-sourceforge-net-plugins-RotarySpeaker::spacing +gfloat +[0,1] +rwx +Tap Spacing +Tap Spacing. +0.5 + + + +calf-sourceforge-net-plugins-RotarySpeaker::treble-speed +gfloat +[10,600] +rwx +Treble Motor +Treble Motor. +36 + + + +calf-sourceforge-net-plugins-RotarySpeaker::vib-speed +gint +[0,5] +rwx +Speed Mode +Speed Mode. +5 + + + +calf-sourceforge-net-plugins-RotarySpeaker::am-depth +gfloat +[0,1] +rwx +AM Depth +AM Depth. +0.45 + + + +calf-sourceforge-net-plugins-RotarySpeaker::test +gfloat +[0,1] +rwx +Test +Test. +0 + + + +calf-sourceforge-net-plugins-Reverb::amount +gfloat +[0,2] +rwx +Wet Amount +Wet Amount. +0.25 + + + +calf-sourceforge-net-plugins-Reverb::bass-cut +gfloat +[20,20000] +rwx +Bass Cut +Bass Cut. +300 + + + +calf-sourceforge-net-plugins-Reverb::clip +gfloat +[0,1] +r +0dB +0dB. +0 + + + +calf-sourceforge-net-plugins-Reverb::decay-time +gfloat +[0.4,15] +rwx +Decay time +Decay time. +1.5 + + + +calf-sourceforge-net-plugins-Reverb::diffusion +gfloat +[0,1] +rwx +Diffusion +Diffusion. +0.5 + + + +calf-sourceforge-net-plugins-Reverb::dry +gfloat +[0,2] +rwx +Dry Amount +Dry Amount. +1 + + + +calf-sourceforge-net-plugins-Reverb::hf-damp +gfloat +[2000,20000] +rwx +High Frq Damp +High Frq Damp. +5000 + + + +calf-sourceforge-net-plugins-Reverb::meter-out +gfloat +[0,1] +r +Output +Output. +0 + + + +calf-sourceforge-net-plugins-Reverb::meter-wet +gfloat +[0,1] +r +Wet amount +Wet amount. +0 + + + +calf-sourceforge-net-plugins-Reverb::predelay +gfloat +[0,50] +rwx +Pre Delay +Pre Delay. +0 + + + +calf-sourceforge-net-plugins-Reverb::room-size +gint +[0,5] +rwx +Room size +Room size. +2 + + + +calf-sourceforge-net-plugins-Reverb::treble-cut +gfloat +[20,20000] +rwx +Treble Cut +Treble Cut. +5000 + + + +calf-sourceforge-net-plugins-Pulsator::amount +gfloat +[0,1] +rwx +Modulation +Modulation. +1 + + + +calf-sourceforge-net-plugins-Pulsator::bypass +gboolean + +rwx +Bypass +Bypass. +FALSE + + + +calf-sourceforge-net-plugins-Pulsator::clip-inL +gfloat +[0,1] +r +0dB-InL +0dB-InL. +0 + + + +calf-sourceforge-net-plugins-Pulsator::clip-inR +gfloat +[0,1] +r +0dB-InR +0dB-InR. +0 + + + +calf-sourceforge-net-plugins-Pulsator::clip-outL +gfloat +[0,1] +r +0dB-OutL +0dB-OutL. +0 + + + +calf-sourceforge-net-plugins-Pulsator::clip-outR +gfloat +[0,1] +r +0dB-OutR +0dB-OutR. +0 + + + +calf-sourceforge-net-plugins-Pulsator::freq +gfloat +[0.01,100] +rwx +Frequency +Frequency. +1 + + + +calf-sourceforge-net-plugins-Pulsator::level-in +gfloat +[0,64] +rwx +Input Gain +Input Gain. +1 + + + +calf-sourceforge-net-plugins-Pulsator::level-out +gfloat +[0,64] +rwx +Output Gain +Output Gain. +1 + + + +calf-sourceforge-net-plugins-Pulsator::meter-inL +gfloat +[0,1] +r +Meter-InL +Meter-InL. +0 + + + +calf-sourceforge-net-plugins-Pulsator::meter-inR +gfloat +[0,1] +r +Meter-InR +Meter-InR. +0 + + + +calf-sourceforge-net-plugins-Pulsator::meter-outL +gfloat +[0,1] +r +Meter-OutL +Meter-OutL. +0 + + + +calf-sourceforge-net-plugins-Pulsator::meter-outR +gfloat +[0,1] +r +Meter-OutR +Meter-OutR. +0 + + + +calf-sourceforge-net-plugins-Pulsator::mode +gint +[0,4] +rwx +Mode +Mode. +0 + + + +calf-sourceforge-net-plugins-Pulsator::mono +gboolean + +rwx +Mono-in +Mono-in. +FALSE + + + +calf-sourceforge-net-plugins-Pulsator::offset +gfloat +[0,1] +rwx +Offset L/R +Offset L/R. +0.5 + + + +calf-sourceforge-net-plugins-Pulsator::reset +gboolean + +rwx +Reset +Reset. +FALSE + + + +calf-sourceforge-net-plugins-Phaser::amount +gfloat +[0,4] +rwx +Amount +Amount. +1 + + + +calf-sourceforge-net-plugins-Phaser::base-freq +gfloat +[20,20000] +rwx +Center Freq +Center Freq. +1000 + + + +calf-sourceforge-net-plugins-Phaser::dry +gfloat +[0,4] +rwx +Dry Amount +Dry Amount. +1 + + + +calf-sourceforge-net-plugins-Phaser::feedback +gfloat +[-0.99,0.99] +rwx +Feedback +Feedback. +0.25 + + + +calf-sourceforge-net-plugins-Phaser::mod-depth +gfloat +[0,10800] +rwx +Mod depth +Mod depth. +4000 + + + +calf-sourceforge-net-plugins-Phaser::mod-rate +gfloat +[0.01,20] +rwx +Mod rate +Mod rate. +0.25 + + + +calf-sourceforge-net-plugins-Phaser::reset +gboolean + +rwx +Reset +Reset. +FALSE + + + +calf-sourceforge-net-plugins-Phaser::stages +gint +[1,12] +rwx +# Stages +# Stages. +6 + + + +calf-sourceforge-net-plugins-Phaser::stereo +gfloat +[0,360] +rwx +Stereo phase +Stereo phase. +180 + + + +calf-sourceforge-net-plugins-Organ::adsr-a +gfloat +[1,20000] +rwx +EG1 Attack +EG1 Attack. +1 + + + +calf-sourceforge-net-plugins-Organ::adsr-d +gfloat +[10,20000] +rwx +EG1 Decay +EG1 Decay. +350 + + + +calf-sourceforge-net-plugins-Organ::adsr-r +gfloat +[10,20000] +rwx +EG1 Release +EG1 Release. +50 + + + +calf-sourceforge-net-plugins-Organ::adsr-s +gfloat +[0,1] +rwx +EG1 Sustain +EG1 Sustain. +0.5 + + + +calf-sourceforge-net-plugins-Organ::adsr-v +gfloat +[0,1] +rwx +EG1 VelMod +EG1 VelMod. +0 + + + +calf-sourceforge-net-plugins-Organ::adsr2-a +gfloat +[1,20000] +rwx +EG2 Attack +EG2 Attack. +1 + + + +calf-sourceforge-net-plugins-Organ::adsr2-d +gfloat +[10,20000] +rwx +EG2 Decay +EG2 Decay. +350 + + + +calf-sourceforge-net-plugins-Organ::adsr2-r +gfloat +[10,20000] +rwx +EG2 Release +EG2 Release. +50 + + + +calf-sourceforge-net-plugins-Organ::adsr2-s +gfloat +[0,1] +rwx +EG2 Sustain +EG2 Sustain. +0.5 + + + +calf-sourceforge-net-plugins-Organ::adsr2-v +gfloat +[0,1] +rwx +EG2 VelMod +EG2 VelMod. +0 + + + +calf-sourceforge-net-plugins-Organ::adsr3-a +gfloat +[1,20000] +rwx +EG3 Attack +EG3 Attack. +1 + + + +calf-sourceforge-net-plugins-Organ::adsr3-d +gfloat +[10,20000] +rwx +EG3 Decay +EG3 Decay. +350 + + + +calf-sourceforge-net-plugins-Organ::adsr3-r +gfloat +[10,20000] +rwx +EG3 Release +EG3 Release. +50 + + + +calf-sourceforge-net-plugins-Organ::adsr3-s +gfloat +[0,1] +rwx +EG3 Sustain +EG3 Sustain. +0.5 + + + +calf-sourceforge-net-plugins-Organ::adsr3-v +gfloat +[0,1] +rwx +EG3 VelMod +EG3 VelMod. +0 + + + +calf-sourceforge-net-plugins-Organ::bass-freq +gfloat +[20,20000] +rwx +Bass Freq +Bass Freq. +80 + + + +calf-sourceforge-net-plugins-Organ::bass-gain +gfloat +[0.1,10] +rwx +Bass Gain +Bass Gain. +1 + + + +calf-sourceforge-net-plugins-Organ::detune +gfloat +[-100,100] +rwx +Detune +Detune. +0 + + + +calf-sourceforge-net-plugins-Organ::detune1 +gfloat +[-100,100] +rwx +Detune 1 +Detune 1. +0 + + + +calf-sourceforge-net-plugins-Organ::detune2 +gfloat +[-100,100] +rwx +Detune 2 +Detune 2. +0 + + + +calf-sourceforge-net-plugins-Organ::detune3 +gfloat +[-100,100] +rwx +Detune 3 +Detune 3. +0 + + + +calf-sourceforge-net-plugins-Organ::detune4 +gfloat +[-100,100] +rwx +Detune 4 +Detune 4. +0 + + + +calf-sourceforge-net-plugins-Organ::detune5 +gfloat +[-100,100] +rwx +Detune 5 +Detune 5. +0 + + + +calf-sourceforge-net-plugins-Organ::detune6 +gfloat +[-100,100] +rwx +Detune 6 +Detune 6. +0 + + + +calf-sourceforge-net-plugins-Organ::detune7 +gfloat +[-100,100] +rwx +Detune 7 +Detune 7. +0 + + + +calf-sourceforge-net-plugins-Organ::detune8 +gfloat +[-100,100] +rwx +Detune 8 +Detune 8. +0 + + + +calf-sourceforge-net-plugins-Organ::detune9 +gfloat +[-100,100] +rwx +Detune 9 +Detune 9. +0 + + + +calf-sourceforge-net-plugins-Organ::eg1-amp-ctl +gint +[0,4] +rwx +EG1 To Amp +EG1 To Amp. +0 + + + +calf-sourceforge-net-plugins-Organ::eg2-amp-ctl +gint +[0,4] +rwx +EG2 To Amp +EG2 To Amp. +0 + + + +calf-sourceforge-net-plugins-Organ::eg3-amp-ctl +gint +[0,4] +rwx +EG3 To Amp +EG3 To Amp. +0 + + + +calf-sourceforge-net-plugins-Organ::f1 +gint +[1,32] +rwx +Freq 1 +Freq 1. +1 + + + +calf-sourceforge-net-plugins-Organ::f1-cutoff +gfloat +[20,20000] +rwx +F1 Cutoff +F1 Cutoff. +2000 + + + +calf-sourceforge-net-plugins-Organ::f1-env1 +gfloat +[-10800,10800] +rwx +F1 Env1 +F1 Env1. +8000 + + + +calf-sourceforge-net-plugins-Organ::f1-env2 +gfloat +[-10800,10800] +rwx +F1 Env2 +F1 Env2. +0 + + + +calf-sourceforge-net-plugins-Organ::f1-env3 +gfloat +[-10800,10800] +rwx +F1 Env3 +F1 Env3. +0 + + + +calf-sourceforge-net-plugins-Organ::f1-keyf +gfloat +[0,2] +rwx +F1 KeyFollow +F1 KeyFollow. +0 + + + +calf-sourceforge-net-plugins-Organ::f1-res +gfloat +[0.7,8] +rwx +F1 Res +F1 Res. +2 + + + +calf-sourceforge-net-plugins-Organ::f2 +gint +[1,32] +rwx +Freq 2 +Freq 2. +3 + + + +calf-sourceforge-net-plugins-Organ::f2-cutoff +gfloat +[20,20000] +rwx +F2 Cutoff +F2 Cutoff. +2000 + + + +calf-sourceforge-net-plugins-Organ::f2-env1 +gfloat +[-10800,10800] +rwx +F2 Env1 +F2 Env1. +0 + + + +calf-sourceforge-net-plugins-Organ::f2-env2 +gfloat +[-10800,10800] +rwx +F2 Env2 +F2 Env2. +8000 + + + +calf-sourceforge-net-plugins-Organ::f2-env3 +gfloat +[-10800,10800] +rwx +F2 Env3 +F2 Env3. +0 + + + +calf-sourceforge-net-plugins-Organ::f2-keyf +gfloat +[0,2] +rwx +F2 KeyFollow +F2 KeyFollow. +0 + + + +calf-sourceforge-net-plugins-Organ::f2-res +gfloat +[0.7,8] +rwx +F2 Res +F2 Res. +2 + + + +calf-sourceforge-net-plugins-Organ::f3 +gint +[1,32] +rwx +Freq 3 +Freq 3. +2 + + + +calf-sourceforge-net-plugins-Organ::f4 +gint +[1,32] +rwx +Freq 4 +Freq 4. +4 + + + +calf-sourceforge-net-plugins-Organ::f5 +gint +[1,32] +rwx +Freq 5 +Freq 5. +6 + + + +calf-sourceforge-net-plugins-Organ::f6 +gint +[1,32] +rwx +Freq 6 +Freq 6. +8 + + + +calf-sourceforge-net-plugins-Organ::f7 +gint +[1,32] +rwx +Freq 7 +Freq 7. +10 + + + +calf-sourceforge-net-plugins-Organ::f8 +gint +[1,32] +rwx +Freq 8 +Freq 8. +12 + + + +calf-sourceforge-net-plugins-Organ::f9 +gint +[1,32] +rwx +Freq 9 +Freq 9. +16 + + + +calf-sourceforge-net-plugins-Organ::filter-chain +gint +[0,1] +rwx +Filter 1 To +Filter 1 To. +0 + + + +calf-sourceforge-net-plugins-Organ::filter1-type +gint +[0,1] +rwx +Filter 1 Type +Filter 1 Type. +0 + + + +calf-sourceforge-net-plugins-Organ::foldnote +gint +[0,127] +rwx +Foldover +Foldover. +108 + + + +calf-sourceforge-net-plugins-Organ::l1 +gfloat +[0,8] +rwx +16' +16'. +8 + + + +calf-sourceforge-net-plugins-Organ::l2 +gfloat +[0,8] +rwx +5 1/3' +5 1/3'. +8 + + + +calf-sourceforge-net-plugins-Organ::l3 +gfloat +[0,8] +rwx +8' +8'. +8 + + + +calf-sourceforge-net-plugins-Organ::l4 +gfloat +[0,8] +rwx +4' +4'. +0 + + + +calf-sourceforge-net-plugins-Organ::l5 +gfloat +[0,8] +rwx +2 2/3' +2 2/3'. +0 + + + +calf-sourceforge-net-plugins-Organ::l6 +gfloat +[0,8] +rwx +2' +2'. +0 + + + +calf-sourceforge-net-plugins-Organ::l7 +gfloat +[0,8] +rwx +1 3/5' +1 3/5'. +0 + + + +calf-sourceforge-net-plugins-Organ::l8 +gfloat +[0,8] +rwx +1 1/3' +1 1/3'. +0 + + + +calf-sourceforge-net-plugins-Organ::l9 +gfloat +[0,8] +rwx +1' +1'. +8 + + + +calf-sourceforge-net-plugins-Organ::master +gfloat +[0,1] +rwx +Volume +Volume. +0.1 + + + +calf-sourceforge-net-plugins-Organ::pan1 +gfloat +[-1,1] +rwx +Pan 1 +Pan 1. +0 + + + +calf-sourceforge-net-plugins-Organ::pan2 +gfloat +[-1,1] +rwx +Pan 2 +Pan 2. +0 + + + +calf-sourceforge-net-plugins-Organ::pan3 +gfloat +[-1,1] +rwx +Pan 3 +Pan 3. +0 + + + +calf-sourceforge-net-plugins-Organ::pan4 +gfloat +[-1,1] +rwx +Pan 4 +Pan 4. +0 + + + +calf-sourceforge-net-plugins-Organ::pan5 +gfloat +[-1,1] +rwx +Pan 5 +Pan 5. +0 + + + +calf-sourceforge-net-plugins-Organ::pan6 +gfloat +[-1,1] +rwx +Pan 6 +Pan 6. +0 + + + +calf-sourceforge-net-plugins-Organ::pan7 +gfloat +[-1,1] +rwx +Pan 7 +Pan 7. +0 + + + +calf-sourceforge-net-plugins-Organ::pan8 +gfloat +[-1,1] +rwx +Pan 8 +Pan 8. +0 + + + +calf-sourceforge-net-plugins-Organ::pan9 +gfloat +[-1,1] +rwx +Pan 9 +Pan 9. +0 + + + +calf-sourceforge-net-plugins-Organ::pbend-range +gfloat +[0,2400] +rwx +PBend Range +PBend Range. +200 + + + +calf-sourceforge-net-plugins-Organ::perc-decay +gfloat +[10,3000] +rwx +P: Carrier Decay +P: Carrier Decay. +200 + + + +calf-sourceforge-net-plugins-Organ::perc-fm-decay +gfloat +[10,3000] +rwx +P: Modulator Decay +P: Modulator Decay. +200 + + + +calf-sourceforge-net-plugins-Organ::perc-fm-depth +gfloat +[0,4] +rwx +P: FM Depth +P: FM Depth. +0 + + + +calf-sourceforge-net-plugins-Organ::perc-fm-harmonic +gint +[1,32] +rwx +P: Modulator Frq +P: Modulator Frq. +6 + + + +calf-sourceforge-net-plugins-Organ::perc-fm-waveform +gint +[0,27] +rwx +P: Modulator Wave +P: Modulator Wave. +0 + + + +calf-sourceforge-net-plugins-Organ::perc-harmonic +gint +[1,32] +rwx +P: Carrier Frq +P: Carrier Frq. +6 + + + +calf-sourceforge-net-plugins-Organ::perc-level +gfloat +[0,1] +rwx +P: Level +P: Level. +0.25 + + + +calf-sourceforge-net-plugins-Organ::perc-stereo +gfloat +[0,360] +rwx +P: Stereo Phase +P: Stereo Phase. +90 + + + +calf-sourceforge-net-plugins-Organ::perc-trigger +gint +[0,3] +rwx +P: Trigger +P: Trigger. +0 + + + +calf-sourceforge-net-plugins-Organ::perc-vel2amp +gfloat +[0,1] +rwx +P: Vel->Amp +P: Vel->Amp. +0 + + + +calf-sourceforge-net-plugins-Organ::perc-vel2fm +gfloat +[0,1] +rwx +P: Vel->FM +P: Vel->FM. +0 + + + +calf-sourceforge-net-plugins-Organ::perc-waveform +gint +[0,27] +rwx +P: Carrier Wave +P: Carrier Wave. +0 + + + +calf-sourceforge-net-plugins-Organ::phase1 +gfloat +[0,360] +rwx +Phase 1 +Phase 1. +0 + + + +calf-sourceforge-net-plugins-Organ::phase2 +gfloat +[0,360] +rwx +Phase 2 +Phase 2. +0 + + + +calf-sourceforge-net-plugins-Organ::phase3 +gfloat +[0,360] +rwx +Phase 3 +Phase 3. +0 + + + +calf-sourceforge-net-plugins-Organ::phase4 +gfloat +[0,360] +rwx +Phase 4 +Phase 4. +0 + + + +calf-sourceforge-net-plugins-Organ::phase5 +gfloat +[0,360] +rwx +Phase 5 +Phase 5. +0 + + + +calf-sourceforge-net-plugins-Organ::phase6 +gfloat +[0,360] +rwx +Phase 6 +Phase 6. +0 + + + +calf-sourceforge-net-plugins-Organ::phase7 +gfloat +[0,360] +rwx +Phase 7 +Phase 7. +0 + + + +calf-sourceforge-net-plugins-Organ::phase8 +gfloat +[0,360] +rwx +Phase 8 +Phase 8. +0 + + + +calf-sourceforge-net-plugins-Organ::phase9 +gfloat +[0,360] +rwx +Phase 9 +Phase 9. +0 + + + +calf-sourceforge-net-plugins-Organ::polyphony +gint +[1,32] +rwx +Polyphony +Polyphony. +16 + + + +calf-sourceforge-net-plugins-Organ::quad-env +gboolean + +rwx +Quadratic AmpEnv +Quadratic AmpEnv. +FALSE + + + +calf-sourceforge-net-plugins-Organ::routing1 +gint +[0,2] +rwx +Routing 1 +Routing 1. +0 + + + +calf-sourceforge-net-plugins-Organ::routing2 +gint +[0,2] +rwx +Routing 2 +Routing 2. +0 + + + +calf-sourceforge-net-plugins-Organ::routing3 +gint +[0,2] +rwx +Routing 3 +Routing 3. +0 + + + +calf-sourceforge-net-plugins-Organ::routing4 +gint +[0,2] +rwx +Routing 4 +Routing 4. +0 + + + +calf-sourceforge-net-plugins-Organ::routing5 +gint +[0,2] +rwx +Routing 5 +Routing 5. +0 + + + +calf-sourceforge-net-plugins-Organ::routing6 +gint +[0,2] +rwx +Routing 6 +Routing 6. +0 + + + +calf-sourceforge-net-plugins-Organ::routing7 +gint +[0,2] +rwx +Routing 7 +Routing 7. +0 + + + +calf-sourceforge-net-plugins-Organ::routing8 +gint +[0,2] +rwx +Routing 8 +Routing 8. +0 + + + +calf-sourceforge-net-plugins-Organ::routing9 +gint +[0,2] +rwx +Routing 9 +Routing 9. +0 + + + +calf-sourceforge-net-plugins-Organ::transpose +gint +[-24,24] +rwx +Transpose +Transpose. +-12 + + + +calf-sourceforge-net-plugins-Organ::treble-freq +gfloat +[20,20000] +rwx +Treble Freq +Treble Freq. +12000 + + + +calf-sourceforge-net-plugins-Organ::treble-gain +gfloat +[0.1,10] +rwx +Treble Gain +Treble Gain. +1 + + + +calf-sourceforge-net-plugins-Organ::vib-amt +gfloat +[0,1] +rwx +Vib Mod Amt +Vib Mod Amt. +1 + + + +calf-sourceforge-net-plugins-Organ::vib-mode +gint +[0,5] +rwx +Vib Mode +Vib Mode. +5 + + + +calf-sourceforge-net-plugins-Organ::vib-phase +gfloat +[0,360] +rwx +Vib Stereo +Vib Stereo. +180 + + + +calf-sourceforge-net-plugins-Organ::vib-rate +gfloat +[0.01,240] +rwx +Vib Rate +Vib Rate. +6.6 + + + +calf-sourceforge-net-plugins-Organ::vib-wet +gfloat +[0,1] +rwx +Vib Wet +Vib Wet. +0.5 + + + +calf-sourceforge-net-plugins-Organ::w1 +gint +[0,35] +rwx +Wave 1 +Wave 1. +0 + + + +calf-sourceforge-net-plugins-Organ::w2 +gint +[0,35] +rwx +Wave 2 +Wave 2. +0 + + + +calf-sourceforge-net-plugins-Organ::w3 +gint +[0,35] +rwx +Wave 3 +Wave 3. +0 + + + +calf-sourceforge-net-plugins-Organ::w4 +gint +[0,35] +rwx +Wave 4 +Wave 4. +0 + + + +calf-sourceforge-net-plugins-Organ::w5 +gint +[0,35] +rwx +Wave 5 +Wave 5. +0 + + + +calf-sourceforge-net-plugins-Organ::w6 +gint +[0,35] +rwx +Wave 6 +Wave 6. +0 + + + +calf-sourceforge-net-plugins-Organ::w7 +gint +[0,35] +rwx +Wave 7 +Wave 7. +0 + + + +calf-sourceforge-net-plugins-Organ::w8 +gint +[0,35] +rwx +Wave 8 +Wave 8. +0 + + + +calf-sourceforge-net-plugins-Organ::w9 +gint +[0,35] +rwx +Wave 9 +Wave 9. +0 + + + +calf-sourceforge-net-plugins-Organ::vib-type +gint +[0,4] +rwx +Vib Type +Vib Type. +3 + + + +calf-sourceforge-net-plugins-Multibandcompressor::attack0 +gfloat +[0.01,2000] +rwx +Attack 1 +Attack 1. +50 + + + +calf-sourceforge-net-plugins-Multibandcompressor::attack1 +gfloat +[0.01,2000] +rwx +Attack 2 +Attack 2. +25 + + + +calf-sourceforge-net-plugins-Multibandcompressor::attack2 +gfloat +[0.01,2000] +rwx +Attack 3 +Attack 3. +12.5 + + + +calf-sourceforge-net-plugins-Multibandcompressor::attack3 +gfloat +[0.01,2000] +rwx +Attack 4 +Attack 4. +6.25 + + + +calf-sourceforge-net-plugins-Multibandcompressor::bypass +gboolean + +rwx +Bypass +Bypass. +FALSE + + + +calf-sourceforge-net-plugins-Multibandcompressor::bypass0 +gboolean + +rwx +Bypass 1 +Bypass 1. +FALSE + + + +calf-sourceforge-net-plugins-Multibandcompressor::bypass1 +gboolean + +rwx +Bypass 2 +Bypass 2. +FALSE + + + +calf-sourceforge-net-plugins-Multibandcompressor::bypass2 +gboolean + +rwx +Bypass 3 +Bypass 3. +FALSE + + + +calf-sourceforge-net-plugins-Multibandcompressor::bypass3 +gboolean + +rwx +Bypass 4 +Bypass 4. +FALSE + + + +calf-sourceforge-net-plugins-Multibandcompressor::clip-inL +gfloat +[0,1] +r +0dB-InL +0dB-InL. +0 + + + +calf-sourceforge-net-plugins-Multibandcompressor::clip-inR +gfloat +[0,1] +r +0dB-InR +0dB-InR. +0 + + + +calf-sourceforge-net-plugins-Multibandcompressor::clip-outL +gfloat +[0,1] +r +0dB-OutL +0dB-OutL. +0 + + + +calf-sourceforge-net-plugins-Multibandcompressor::clip-outR +gfloat +[0,1] +r +0dB-OutR +0dB-OutR. +0 + + + +calf-sourceforge-net-plugins-Multibandcompressor::compression0 +gfloat +[0,1] +r +Gain Reduction 1 +Gain Reduction 1. +0 + + + +calf-sourceforge-net-plugins-Multibandcompressor::compression1 +gfloat +[0,1] +r +Gain Reduction 2 +Gain Reduction 2. +0 + + + +calf-sourceforge-net-plugins-Multibandcompressor::compression2 +gfloat +[0,1] +r +Gain Reduction 3 +Gain Reduction 3. +0 + + + +calf-sourceforge-net-plugins-Multibandcompressor::compression3 +gfloat +[0,1] +r +Gain Reduction 4 +Gain Reduction 4. +0 + + + +calf-sourceforge-net-plugins-Multibandcompressor::detection0 +gint +[0,1] +rwx +Detection 1 +Detection 1. +1 + + + +calf-sourceforge-net-plugins-Multibandcompressor::detection1 +gint +[0,1] +rwx +Detection 2 +Detection 2. +1 + + + +calf-sourceforge-net-plugins-Multibandcompressor::detection2 +gint +[0,1] +rwx +Detection 3 +Detection 3. +1 + + + +calf-sourceforge-net-plugins-Multibandcompressor::detection3 +gint +[0,1] +rwx +Detection 4 +Detection 4. +1 + + + +calf-sourceforge-net-plugins-Multibandcompressor::freq0 +gfloat +[10,20000] +rwx +Split 1/2 +Split 1/2. +100 + + + +calf-sourceforge-net-plugins-Multibandcompressor::freq1 +gfloat +[10,20000] +rwx +Split 2/3 +Split 2/3. +1000 + + + +calf-sourceforge-net-plugins-Multibandcompressor::freq2 +gfloat +[10,20000] +rwx +Split 3/4 +Split 3/4. +6000 + + + +calf-sourceforge-net-plugins-Multibandcompressor::knee0 +gfloat +[1,8] +rwx +Knee 1 +Knee 1. +2.82843 + + + +calf-sourceforge-net-plugins-Multibandcompressor::knee1 +gfloat +[1,8] +rwx +Knee 2 +Knee 2. +2.82843 + + + +calf-sourceforge-net-plugins-Multibandcompressor::knee2 +gfloat +[1,8] +rwx +Knee 3 +Knee 3. +2.82843 + + + +calf-sourceforge-net-plugins-Multibandcompressor::knee3 +gfloat +[1,8] +rwx +Knee 4 +Knee 4. +2.82843 + + + +calf-sourceforge-net-plugins-Multibandcompressor::level-in +gfloat +[0,64] +rwx +Input +Input. +1 + + + +calf-sourceforge-net-plugins-Multibandcompressor::level-out +gfloat +[0,64] +rwx +Output +Output. +1 + + + +calf-sourceforge-net-plugins-Multibandcompressor::makeup0 +gfloat +[1,64] +rwx +Makeup 1 +Makeup 1. +2 + + + +calf-sourceforge-net-plugins-Multibandcompressor::makeup1 +gfloat +[1,64] +rwx +Makeup 2 +Makeup 2. +2 + + + +calf-sourceforge-net-plugins-Multibandcompressor::makeup2 +gfloat +[1,64] +rwx +Makeup 3 +Makeup 3. +2 + + + +calf-sourceforge-net-plugins-Multibandcompressor::makeup3 +gfloat +[1,64] +rwx +Makeup 4 +Makeup 4. +2 + + + +calf-sourceforge-net-plugins-Multibandcompressor::meter-inL +gfloat +[0,1] +r +Input L +Input L. +0 + + + +calf-sourceforge-net-plugins-Multibandcompressor::meter-inR +gfloat +[0,1] +r +Input R +Input R. +0 + + + +calf-sourceforge-net-plugins-Multibandcompressor::meter-outL +gfloat +[0,1] +r +Output L +Output L. +0 + + + +calf-sourceforge-net-plugins-Multibandcompressor::meter-outR +gfloat +[0,1] +r +Output R +Output R. +0 + + + +calf-sourceforge-net-plugins-Multibandcompressor::mute0 +gboolean + +rwx +Mute 1 +Mute 1. +FALSE + + + +calf-sourceforge-net-plugins-Multibandcompressor::mute1 +gboolean + +rwx +Mute 2 +Mute 2. +FALSE + + + +calf-sourceforge-net-plugins-Multibandcompressor::mute2 +gboolean + +rwx +Mute 3 +Mute 3. +FALSE + + + +calf-sourceforge-net-plugins-Multibandcompressor::mute3 +gboolean + +rwx +Mute 4 +Mute 4. +FALSE + + + +calf-sourceforge-net-plugins-Multibandcompressor::output0 +gfloat +[0,1] +r +Output 1 +Output 1. +0 + + + +calf-sourceforge-net-plugins-Multibandcompressor::output1 +gfloat +[0,1] +r +Output 2 +Output 2. +0 + + + +calf-sourceforge-net-plugins-Multibandcompressor::output2 +gfloat +[0,1] +r +Output 3 +Output 3. +0 + + + +calf-sourceforge-net-plugins-Multibandcompressor::output3 +gfloat +[0,1] +r +Output 4 +Output 4. +0 + + + +calf-sourceforge-net-plugins-Multibandcompressor::q0 +gfloat +[0.25,4] +rwx +Q1 +Q1. +0.895025 + + + +calf-sourceforge-net-plugins-Multibandcompressor::q1 +gfloat +[0.25,4] +rwx +Q2 +Q2. +0.895025 + + + +calf-sourceforge-net-plugins-Multibandcompressor::q2 +gfloat +[0.25,4] +rwx +Q3 +Q3. +0.895025 + + + +calf-sourceforge-net-plugins-Multibandcompressor::ratio0 +gfloat +[1,20] +rwx +Ratio 1 +Ratio 1. +3 + + + +calf-sourceforge-net-plugins-Multibandcompressor::ratio1 +gfloat +[1,20] +rwx +Ratio 2 +Ratio 2. +3 + + + +calf-sourceforge-net-plugins-Multibandcompressor::ratio2 +gfloat +[1,20] +rwx +Ratio 3 +Ratio 3. +3 + + + +calf-sourceforge-net-plugins-Multibandcompressor::ratio3 +gfloat +[1,20] +rwx +Ratio 4 +Ratio 4. +3 + + + +calf-sourceforge-net-plugins-Multibandcompressor::release0 +gfloat +[0.01,2000] +rwx +Release 1 +Release 1. +100 + + + +calf-sourceforge-net-plugins-Multibandcompressor::release1 +gfloat +[0.01,2000] +rwx +Release 2 +Release 2. +50 + + + +calf-sourceforge-net-plugins-Multibandcompressor::release2 +gfloat +[0.01,2000] +rwx +Release 3 +Release 3. +25 + + + +calf-sourceforge-net-plugins-Multibandcompressor::release3 +gfloat +[0.01,2000] +rwx +Release 4 +Release 4. +12.5 + + + +calf-sourceforge-net-plugins-Multibandcompressor::sep0 +gfloat +[-0.5,0.5] +rwx +S1 +S1. +-0.17 + + + +calf-sourceforge-net-plugins-Multibandcompressor::sep1 +gfloat +[-0.5,0.5] +rwx +S2 +S2. +-0.17 + + + +calf-sourceforge-net-plugins-Multibandcompressor::sep2 +gfloat +[-0.5,0.5] +rwx +S3 +S3. +-0.17 + + + +calf-sourceforge-net-plugins-Multibandcompressor::threshold0 +gfloat +[0.000976563,1] +rwx +Threshold 1 +Threshold 1. +0.0625 + + + +calf-sourceforge-net-plugins-Multibandcompressor::threshold1 +gfloat +[0.000976563,1] +rwx +Threshold 2 +Threshold 2. +0.03125 + + + +calf-sourceforge-net-plugins-Multibandcompressor::threshold2 +gfloat +[0.000976563,1] +rwx +Threshold 3 +Threshold 3. +0.015625 + + + +calf-sourceforge-net-plugins-Multibandcompressor::threshold3 +gfloat +[0.000976563,1] +rwx +Threshold 4 +Threshold 4. +0.0078125 + + + +calf-sourceforge-net-plugins-MultiChorus::amount +gfloat +[0,4] +rwx +Amount +Amount. +2 + + + +calf-sourceforge-net-plugins-MultiChorus::dry +gfloat +[0,4] +rwx +Dry Amount +Dry Amount. +1 + + + +calf-sourceforge-net-plugins-MultiChorus::freq +gfloat +[10,20000] +rwx +Center Frq 1 +Center Frq 1. +100 + + + +calf-sourceforge-net-plugins-MultiChorus::freq2 +gfloat +[10,20000] +rwx +Center Frq 2 +Center Frq 2. +5000 + + + +calf-sourceforge-net-plugins-MultiChorus::min-delay +gfloat +[0.1,10] +rwx +Min delay +Min delay. +5 + + + +calf-sourceforge-net-plugins-MultiChorus::mod-depth +gfloat +[0.1,10] +rwx +Mod depth +Mod depth. +6 + + + +calf-sourceforge-net-plugins-MultiChorus::mod-rate +gfloat +[0.01,20] +rwx +Modulation rate +Modulation rate. +0.5 + + + +calf-sourceforge-net-plugins-MultiChorus::overlap +gfloat +[0,1] +rwx +Overlap +Overlap. +1 + + + +calf-sourceforge-net-plugins-MultiChorus::q +gfloat +[0.125,8] +rwx +Q +Q. +0.125 + + + +calf-sourceforge-net-plugins-MultiChorus::stereo +gfloat +[0,360] +rwx +Stereo phase +Stereo phase. +180 + + + +calf-sourceforge-net-plugins-MultiChorus::voices +gint +[1,8] +rwx +Voices +Voices. +4 + + + +calf-sourceforge-net-plugins-MultiChorus::vphase +gfloat +[0,360] +rwx +Inter-voice phase +Inter-voice phase. +64 + + + +calf-sourceforge-net-plugins-Monosynth::adsr-a +gfloat +[1,20000] +rwx +EG1 Attack +EG1 Attack. +1 + + + +calf-sourceforge-net-plugins-Monosynth::adsr-d +gfloat +[10,20000] +rwx +EG1 Decay +EG1 Decay. +350 + + + +calf-sourceforge-net-plugins-Monosynth::adsr-f +gfloat +[-10000,10000] +rwx +EG1 Fade +EG1 Fade. +0 + + + +calf-sourceforge-net-plugins-Monosynth::adsr-r +gfloat +[10,20000] +rwx +EG1 Release +EG1 Release. +100 + + + +calf-sourceforge-net-plugins-Monosynth::adsr-s +gfloat +[0,1] +rwx +EG1 Sustain +EG1 Sustain. +0.5 + + + +calf-sourceforge-net-plugins-Monosynth::adsr2-a +gfloat +[1,20000] +rwx +EG2 Attack +EG2 Attack. +1 + + + +calf-sourceforge-net-plugins-Monosynth::adsr2-amp +gboolean + +rwx +EG2->Amp +EG2->Amp. +FALSE + + + +calf-sourceforge-net-plugins-Monosynth::adsr2-cutoff +gfloat +[-10800,10800] +rwx +EG2->Cutoff +EG2->Cutoff. +0 + + + +calf-sourceforge-net-plugins-Monosynth::adsr2-d +gfloat +[10,20000] +rwx +EG2 Decay +EG2 Decay. +100 + + + +calf-sourceforge-net-plugins-Monosynth::adsr2-f +gfloat +[-10000,10000] +rwx +EG2 Fade +EG2 Fade. +0 + + + +calf-sourceforge-net-plugins-Monosynth::adsr2-r +gfloat +[10,20000] +rwx +Release +Release. +50 + + + +calf-sourceforge-net-plugins-Monosynth::adsr2-res +gfloat +[0,1] +rwx +EG2->Res +EG2->Res. +0.3 + + + +calf-sourceforge-net-plugins-Monosynth::adsr2-s +gfloat +[0,1] +rwx +EG2 Sustain +EG2 Sustain. +0.5 + + + +calf-sourceforge-net-plugins-Monosynth::cutoff +gfloat +[10,16000] +rwx +Cutoff +Cutoff. +33 + + + +calf-sourceforge-net-plugins-Monosynth::env2amp +gboolean + +rwx +Env->Amp +Env->Amp. +FALSE + + + +calf-sourceforge-net-plugins-Monosynth::env2cutoff +gfloat +[-10800,10800] +rwx +Env->Cutoff +Env->Cutoff. +8000 + + + +calf-sourceforge-net-plugins-Monosynth::env2res +gfloat +[0,1] +rwx +Env->Res +Env->Res. +1 + + + +calf-sourceforge-net-plugins-Monosynth::filter +gint +[0,7] +rwx +Filter +Filter. +1 + + + +calf-sourceforge-net-plugins-Monosynth::filter-sep +gfloat +[-2400,2400] +rwx +Separation +Separation. +0 + + + +calf-sourceforge-net-plugins-Monosynth::key-follow +gfloat +[0,2] +rwx +Key Follow +Key Follow. +0 + + + +calf-sourceforge-net-plugins-Monosynth::legato +gint +[0,3] +rwx +Legato Mode +Legato Mode. +0 + + + +calf-sourceforge-net-plugins-Monosynth::lfo-delay +gfloat +[0,5] +rwx +LFO1 Delay +LFO1 Delay. +0.5 + + + +calf-sourceforge-net-plugins-Monosynth::lfo-rate +gfloat +[0.01,20] +rwx +LFO1 Rate +LFO1 Rate. +5 + + + +calf-sourceforge-net-plugins-Monosynth::lfo1-trig +gint +[0,1] +rwx +LFO1 Trigger Mode +LFO1 Trigger Mode. +0 + + + +calf-sourceforge-net-plugins-Monosynth::lfo2-delay +gfloat +[0.1,5] +rwx +LFO1 Delay +LFO1 Delay. +0.5 + + + +calf-sourceforge-net-plugins-Monosynth::lfo2-rate +gfloat +[0.01,20] +rwx +LFO1 Rate +LFO1 Rate. +5 + + + +calf-sourceforge-net-plugins-Monosynth::lfo2-trig +gint +[0,1] +rwx +LFO2 Trigger Mode +LFO2 Trigger Mode. +0 + + + +calf-sourceforge-net-plugins-Monosynth::lfo2filter +gfloat +[-4800,4800] +rwx +LFO1->Filter +LFO1->Filter. +0 + + + +calf-sourceforge-net-plugins-Monosynth::lfo2pitch +gfloat +[0,1200] +rwx +LFO1->Pitch +LFO1->Pitch. +100 + + + +calf-sourceforge-net-plugins-Monosynth::lfo2pw +gfloat +[0,1] +rwx +LFO1->PW +LFO1->PW. +0 + + + +calf-sourceforge-net-plugins-Monosynth::master +gfloat +[0,1] +rwx +Volume +Volume. +0.5 + + + +calf-sourceforge-net-plugins-Monosynth::mwhl2lfo +gfloat +[0,1] +rwx +ModWheel->LFO1 +ModWheel->LFO1. +1 + + + +calf-sourceforge-net-plugins-Monosynth::o1-pw +gfloat +[-1,1] +rwx +Osc1 PW +Osc1 PW. +0 + + + +calf-sourceforge-net-plugins-Monosynth::o1-stretch +gfloat +[1,16] +rwx +Osc1 Stretch +Osc1 Stretch. +1 + + + +calf-sourceforge-net-plugins-Monosynth::o1-wave +gint +[0,15] +rwx +Osc1 Wave +Osc1 Wave. +0 + + + +calf-sourceforge-net-plugins-Monosynth::o1-window +gfloat +[0,1] +rwx +Osc1 Window +Osc1 Window. +0 + + + +calf-sourceforge-net-plugins-Monosynth::o12-detune +gfloat +[0,100] +rwx +O1<>2 Detune +O1<>2 Detune. +10 + + + +calf-sourceforge-net-plugins-Monosynth::o12-mix +gfloat +[0,1] +rwx +O1<>2 Mix +O1<>2 Mix. +0.5 + + + +calf-sourceforge-net-plugins-Monosynth::o2-pw +gfloat +[-1,1] +rwx +Osc2 PW +Osc2 PW. +0 + + + +calf-sourceforge-net-plugins-Monosynth::o2-wave +gint +[0,15] +rwx +Osc2 Wave +Osc2 Wave. +1 + + + +calf-sourceforge-net-plugins-Monosynth::o2-xpose +gint +[-24,24] +rwx +Osc 2 transpose +Osc 2 transpose. +12 + + + +calf-sourceforge-net-plugins-Monosynth::pbend-range +gfloat +[0,2400] +rwx +PBend Range +PBend Range. +200 + + + +calf-sourceforge-net-plugins-Monosynth::phase-mode +gint +[0,5] +rwx +Phase mode +Phase mode. +0 + + + +calf-sourceforge-net-plugins-Monosynth::portamento +gfloat +[1,2000] +rwx +Portamento +Portamento. +1 + + + +calf-sourceforge-net-plugins-Monosynth::res +gfloat +[0.7,8] +rwx +Resonance +Resonance. +3 + + + +calf-sourceforge-net-plugins-Monosynth::scale-detune +gfloat +[0,1] +rwx +Scale Detune +Scale Detune. +1 + + + +calf-sourceforge-net-plugins-Monosynth::vel2amp +gfloat +[0,1] +rwx +Vel->Amp +Vel->Amp. +0 + + + +calf-sourceforge-net-plugins-Monosynth::vel2filter +gfloat +[0,1] +rwx +Vel->Filter +Vel->Filter. +0.5 + + + +calf-sourceforge-net-plugins-Gate::attack +gfloat +[0.01,2000] +rwx +Attack +Attack. +20 + + + +calf-sourceforge-net-plugins-Gate::bypass +gboolean + +rwx +Bypass +Bypass. +FALSE + + + +calf-sourceforge-net-plugins-Gate::clip-in +gboolean + +r +0dB-In +0dB-In. +FALSE + + + +calf-sourceforge-net-plugins-Gate::clip-out +gboolean + +r +0dB-Out +0dB-Out. +FALSE + + + +calf-sourceforge-net-plugins-Gate::detection +gint +[0,1] +rwx +Detection +Detection. +0 + + + +calf-sourceforge-net-plugins-Gate::gating +gfloat +[0,1] +r +Gating +Gating. +0 + + + +calf-sourceforge-net-plugins-Gate::knee +gfloat +[1,8] +rwx +Knee +Knee. +2.82843 + + + +calf-sourceforge-net-plugins-Gate::level-in +gfloat +[0,64] +rwx +Input +Input. +1 + + + +calf-sourceforge-net-plugins-Gate::makeup +gfloat +[1,64] +rwx +Makeup Gain +Makeup Gain. +1 + + + +calf-sourceforge-net-plugins-Gate::meter-in +gfloat +[0,1] +r +Input +Input. +0 + + + +calf-sourceforge-net-plugins-Gate::meter-out +gfloat +[0,1] +r +Output +Output. +0 + + + +calf-sourceforge-net-plugins-Gate::range +gfloat +[0,1] +rwx +Max Gain Reduction +Max Gain Reduction. +0.06125 + + + +calf-sourceforge-net-plugins-Gate::ratio +gfloat +[1,20] +rwx +Ratio +Ratio. +2 + + + +calf-sourceforge-net-plugins-Gate::release +gfloat +[0.01,2000] +rwx +Release +Release. +250 + + + +calf-sourceforge-net-plugins-Gate::stereo-link +gint +[0,1] +rwx +Stereo Link +Stereo Link. +0 + + + +calf-sourceforge-net-plugins-Gate::threshold +gfloat +[0.000976563,1] +rwx +Threshold +Threshold. +0.125 + + + +calf-sourceforge-net-plugins-Fluidsynth::chorus +gboolean + +rwx +Chorus +Chorus. +FALSE + + + +calf-sourceforge-net-plugins-Fluidsynth::interpolation +gint +[0,3] +rwx +Interpolation +Interpolation. +2 + + + +calf-sourceforge-net-plugins-Fluidsynth::master +gfloat +[0,1] +rwx +Volume +Volume. +0.5 + + + +calf-sourceforge-net-plugins-Fluidsynth::o1offset +gfloat +[-1,1] +rwx +Osc1 Ctl +Osc1 Ctl. +0.2 + + + +calf-sourceforge-net-plugins-Fluidsynth::o1wave +gint +[0,28] +rwx +Osc1 Wave +Osc1 Wave. +28 + + + +calf-sourceforge-net-plugins-Fluidsynth::reverb +gboolean + +rwx +Reverb +Reverb. +FALSE + + + +calf-sourceforge-net-plugins-Flanger::amount +gfloat +[0,4] +rwx +Amount +Amount. +1 + + + +calf-sourceforge-net-plugins-Flanger::dry +gfloat +[0,4] +rwx +Dry Amount +Dry Amount. +1 + + + +calf-sourceforge-net-plugins-Flanger::feedback +gfloat +[-0.99,0.99] +rwx +Feedback +Feedback. +0.9 + + + +calf-sourceforge-net-plugins-Flanger::min-delay +gfloat +[0.1,10] +rwx +Min delay +Min delay. +0.1 + + + +calf-sourceforge-net-plugins-Flanger::mod-depth +gfloat +[0.1,10] +rwx +Mod depth +Mod depth. +0.5 + + + +calf-sourceforge-net-plugins-Flanger::mod-rate +gfloat +[0.01,20] +rwx +Mod rate +Mod rate. +0.25 + + + +calf-sourceforge-net-plugins-Flanger::reset +gboolean + +rwx +Reset +Reset. +FALSE + + + +calf-sourceforge-net-plugins-Flanger::stereo +gfloat +[0,360] +rwx +Stereo phase +Stereo phase. +0 + + + +calf-sourceforge-net-plugins-Filterclavier::detune +gint +[-100,100] +rwx +Detune +Detune. +0 + + + +calf-sourceforge-net-plugins-Filterclavier::inertia +gfloat +[1,2000] +rwx +Portamento time +Portamento time. +20 + + + +calf-sourceforge-net-plugins-Filterclavier::maxres +gfloat +[0.707,32] +rwx +Max. Resonance +Max. Resonance. +32 + + + +calf-sourceforge-net-plugins-Filterclavier::mode +gint +[0,11] +rwx +Mode +Mode. +6 + + + +calf-sourceforge-net-plugins-Filterclavier::transpose +gint +[-48,48] +rwx +Transpose +Transpose. +0 + + + +calf-sourceforge-net-plugins-Filter::freq +gfloat +[10,20000] +rwx +Frequency +Frequency. +2000 + + + +calf-sourceforge-net-plugins-Filter::inertia +gfloat +[5,100] +rwx +Inertia +Inertia. +20 + + + +calf-sourceforge-net-plugins-Filter::mode +gint +[0,11] +rwx +Mode +Mode. +0 + + + +calf-sourceforge-net-plugins-Filter::res +gfloat +[0.707,32] +rwx +Resonance +Resonance. +0.707 + + + +calf-sourceforge-net-plugins-Exciter::amount +gfloat +[0,64] +rwx +Amount +Amount. +1 + + + +calf-sourceforge-net-plugins-Exciter::blend +gfloat +[-10,10] +rwx +Blend harmonics +Blend harmonics. +0 + + + +calf-sourceforge-net-plugins-Exciter::bypass +gboolean + +rwx +Bypass +Bypass. +FALSE + + + +calf-sourceforge-net-plugins-Exciter::clip-in +gfloat +[0,1] +r +0dB +0dB. +0 + + + +calf-sourceforge-net-plugins-Exciter::clip-out +gfloat +[0,1] +r +0dB +0dB. +0 + + + +calf-sourceforge-net-plugins-Exciter::drive +gfloat +[0.1,10] +rwx +Harmonics +Harmonics. +8.5 + + + +calf-sourceforge-net-plugins-Exciter::freq +gfloat +[2000,12000] +rwx +Scope +Scope. +6000 + + + +calf-sourceforge-net-plugins-Exciter::level-in +gfloat +[0,64] +rwx +Input +Input. +1 + + + +calf-sourceforge-net-plugins-Exciter::level-out +gfloat +[0,64] +rwx +Output +Output. +1 + + + +calf-sourceforge-net-plugins-Exciter::listen +gboolean + +rwx +Listen +Listen. +FALSE + + + +calf-sourceforge-net-plugins-Exciter::meter-drive +gfloat +[0,1] +r +Harmonics level +Harmonics level. +0 + + + +calf-sourceforge-net-plugins-Exciter::meter-in +gfloat +[0,1] +r +Input +Input. +0 + + + +calf-sourceforge-net-plugins-Exciter::meter-out +gfloat +[0,1] +r +Output +Output. +0 + + + +calf-sourceforge-net-plugins-Equalizer8Band::bypass +gboolean + +rwx +Bypass +Bypass. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer8Band::clip-inL +gfloat +[0,1] +r +0dB-InL +0dB-InL. +0 + + + +calf-sourceforge-net-plugins-Equalizer8Band::clip-inR +gfloat +[0,1] +r +0dB-InR +0dB-InR. +0 + + + +calf-sourceforge-net-plugins-Equalizer8Band::clip-outL +gfloat +[0,1] +r +0dB-OutL +0dB-OutL. +0 + + + +calf-sourceforge-net-plugins-Equalizer8Band::clip-outR +gfloat +[0,1] +r +0dB-OutR +0dB-OutR. +0 + + + +calf-sourceforge-net-plugins-Equalizer8Band::hp-active +gboolean + +rwx +HP Active +HP Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer8Band::hp-freq +gfloat +[10,20000] +rwx +HP Freq +HP Freq. +30 + + + +calf-sourceforge-net-plugins-Equalizer8Band::hp-mode +gint +[0,2] +rwx +HP Mode +HP Mode. +1 + + + +calf-sourceforge-net-plugins-Equalizer8Band::hs-active +gboolean + +rwx +HS Active +HS Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer8Band::hs-freq +gfloat +[10,20000] +rwx +Freq H +Freq H. +4000 + + + +calf-sourceforge-net-plugins-Equalizer8Band::hs-level +gfloat +[0.015625,64] +rwx +Level H +Level H. +1 + + + +calf-sourceforge-net-plugins-Equalizer8Band::level-in +gfloat +[0,64] +rwx +Input Gain +Input Gain. +1 + + + +calf-sourceforge-net-plugins-Equalizer8Band::level-out +gfloat +[0,64] +rwx +Output Gain +Output Gain. +1 + + + +calf-sourceforge-net-plugins-Equalizer8Band::lp-active +gboolean + +rwx +LP Active +LP Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer8Band::lp-freq +gfloat +[10,20000] +rwx +LP Freq +LP Freq. +18000 + + + +calf-sourceforge-net-plugins-Equalizer8Band::lp-mode +gint +[0,2] +rwx +LP Mode +LP Mode. +1 + + + +calf-sourceforge-net-plugins-Equalizer8Band::ls-active +gboolean + +rwx +LS Active +LS Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer8Band::ls-freq +gfloat +[10,20000] +rwx +Freq L +Freq L. +200 + + + +calf-sourceforge-net-plugins-Equalizer8Band::ls-level +gfloat +[0.015625,64] +rwx +Level L +Level L. +1 + + + +calf-sourceforge-net-plugins-Equalizer8Band::meter-inL +gfloat +[0,1] +r +Meter-InL +Meter-InL. +0 + + + +calf-sourceforge-net-plugins-Equalizer8Band::meter-inR +gfloat +[0,1] +r +Meter-InR +Meter-InR. +0 + + + +calf-sourceforge-net-plugins-Equalizer8Band::meter-outL +gfloat +[0,1] +r +Meter-OutL +Meter-OutL. +0 + + + +calf-sourceforge-net-plugins-Equalizer8Band::meter-outR +gfloat +[0,1] +r +Meter-OutR +Meter-OutR. +0 + + + +calf-sourceforge-net-plugins-Equalizer8Band::p1-active +gboolean + +rwx +F1 Active +F1 Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer8Band::p1-freq +gfloat +[10,20000] +rwx +Freq 1 +Freq 1. +250 + + + +calf-sourceforge-net-plugins-Equalizer8Band::p1-level +gfloat +[0.015625,64] +rwx +Level 1 +Level 1. +1 + + + +calf-sourceforge-net-plugins-Equalizer8Band::p1-q +gfloat +[0.1,100] +rwx +Q 1 +Q 1. +1 + + + +calf-sourceforge-net-plugins-Equalizer8Band::p2-active +gboolean + +rwx +F2 Active +F2 Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer8Band::p2-freq +gfloat +[10,20000] +rwx +Freq 2 +Freq 2. +1000 + + + +calf-sourceforge-net-plugins-Equalizer8Band::p2-level +gfloat +[0.015625,64] +rwx +Level 2 +Level 2. +1 + + + +calf-sourceforge-net-plugins-Equalizer8Band::p2-q +gfloat +[0.1,100] +rwx +Q 2 +Q 2. +1 + + + +calf-sourceforge-net-plugins-Equalizer8Band::p3-active +gboolean + +rwx +F3 Active +F3 Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer8Band::p3-freq +gfloat +[10,20000] +rwx +Freq 3 +Freq 3. +2500 + + + +calf-sourceforge-net-plugins-Equalizer8Band::p3-level +gfloat +[0.015625,64] +rwx +Level 3 +Level 3. +1 + + + +calf-sourceforge-net-plugins-Equalizer8Band::p3-q +gfloat +[0.1,100] +rwx +Q 3 +Q 3. +1 + + + +calf-sourceforge-net-plugins-Equalizer8Band::p4-active +gboolean + +rwx +F4 Active +F4 Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer8Band::p4-freq +gfloat +[10,20000] +rwx +Freq 4 +Freq 4. +5000 + + + +calf-sourceforge-net-plugins-Equalizer8Band::p4-level +gfloat +[0.015625,64] +rwx +Level 4 +Level 4. +1 + + + +calf-sourceforge-net-plugins-Equalizer8Band::p4-q +gfloat +[0.1,100] +rwx +Q 4 +Q 4. +1 + + + +calf-sourceforge-net-plugins-Equalizer5Band::bypass +gboolean + +rwx +Bypass +Bypass. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer5Band::clip-inL +gfloat +[0,1] +r +0dB-InL +0dB-InL. +0 + + + +calf-sourceforge-net-plugins-Equalizer5Band::clip-inR +gfloat +[0,1] +r +0dB-InR +0dB-InR. +0 + + + +calf-sourceforge-net-plugins-Equalizer5Band::clip-outL +gfloat +[0,1] +r +0dB-OutL +0dB-OutL. +0 + + + +calf-sourceforge-net-plugins-Equalizer5Band::clip-outR +gfloat +[0,1] +r +0dB-OutR +0dB-OutR. +0 + + + +calf-sourceforge-net-plugins-Equalizer5Band::hs-active +gboolean + +rwx +HS Active +HS Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer5Band::hs-freq +gfloat +[10,20000] +rwx +Freq H +Freq H. +4000 + + + +calf-sourceforge-net-plugins-Equalizer5Band::hs-level +gfloat +[0.015625,64] +rwx +Level H +Level H. +1 + + + +calf-sourceforge-net-plugins-Equalizer5Band::level-in +gfloat +[0,64] +rwx +Input Gain +Input Gain. +1 + + + +calf-sourceforge-net-plugins-Equalizer5Band::level-out +gfloat +[0,64] +rwx +Output Gain +Output Gain. +1 + + + +calf-sourceforge-net-plugins-Equalizer5Band::ls-active +gboolean + +rwx +LS Active +LS Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer5Band::ls-freq +gfloat +[10,20000] +rwx +Freq L +Freq L. +200 + + + +calf-sourceforge-net-plugins-Equalizer5Band::ls-level +gfloat +[0.015625,64] +rwx +Level L +Level L. +1 + + + +calf-sourceforge-net-plugins-Equalizer5Band::meter-inL +gfloat +[0,1] +r +Meter-InL +Meter-InL. +0 + + + +calf-sourceforge-net-plugins-Equalizer5Band::meter-inR +gfloat +[0,1] +r +Meter-InR +Meter-InR. +0 + + + +calf-sourceforge-net-plugins-Equalizer5Band::meter-outL +gfloat +[0,1] +r +Meter-OutL +Meter-OutL. +0 + + + +calf-sourceforge-net-plugins-Equalizer5Band::meter-outR +gfloat +[0,1] +r +Meter-OutR +Meter-OutR. +0 + + + +calf-sourceforge-net-plugins-Equalizer5Band::p1-active +gboolean + +rwx +F1 Active +F1 Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer5Band::p1-freq +gfloat +[10,20000] +rwx +Freq 1 +Freq 1. +250 + + + +calf-sourceforge-net-plugins-Equalizer5Band::p1-level +gfloat +[0.015625,64] +rwx +Level 1 +Level 1. +1 + + + +calf-sourceforge-net-plugins-Equalizer5Band::p1-q +gfloat +[0.1,100] +rwx +Q 1 +Q 1. +1 + + + +calf-sourceforge-net-plugins-Equalizer5Band::p2-active +gboolean + +rwx +F2 Active +F2 Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer5Band::p2-freq +gfloat +[10,20000] +rwx +Freq 2 +Freq 2. +1000 + + + +calf-sourceforge-net-plugins-Equalizer5Band::p2-level +gfloat +[0.015625,64] +rwx +Level 2 +Level 2. +1 + + + +calf-sourceforge-net-plugins-Equalizer5Band::p2-q +gfloat +[0.1,100] +rwx +Q 2 +Q 2. +1 + + + +calf-sourceforge-net-plugins-Equalizer5Band::p3-active +gboolean + +rwx +F3 Active +F3 Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer5Band::p3-freq +gfloat +[10,20000] +rwx +Freq 3 +Freq 3. +2500 + + + +calf-sourceforge-net-plugins-Equalizer5Band::p3-level +gfloat +[0.015625,64] +rwx +Level 3 +Level 3. +1 + + + +calf-sourceforge-net-plugins-Equalizer5Band::p3-q +gfloat +[0.1,100] +rwx +Q 3 +Q 3. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::bypass +gboolean + +rwx +Bypass +Bypass. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer12Band::clip-inL +gfloat +[0,1] +r +0dB-InL +0dB-InL. +0 + + + +calf-sourceforge-net-plugins-Equalizer12Band::clip-inR +gfloat +[0,1] +r +0dB-InR +0dB-InR. +0 + + + +calf-sourceforge-net-plugins-Equalizer12Band::clip-outL +gfloat +[0,1] +r +0dB-OutL +0dB-OutL. +0 + + + +calf-sourceforge-net-plugins-Equalizer12Band::clip-outR +gfloat +[0,1] +r +0dB-OutR +0dB-OutR. +0 + + + +calf-sourceforge-net-plugins-Equalizer12Band::hp-active +gboolean + +rwx +HP Active +HP Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer12Band::hp-freq +gfloat +[10,20000] +rwx +HP Freq +HP Freq. +30 + + + +calf-sourceforge-net-plugins-Equalizer12Band::hp-mode +gint +[0,2] +rwx +HP Mode +HP Mode. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::hs-active +gboolean + +rwx +HS Active +HS Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer12Band::hs-freq +gfloat +[10,20000] +rwx +Freq H +Freq H. +4000 + + + +calf-sourceforge-net-plugins-Equalizer12Band::hs-level +gfloat +[0.015625,64] +rwx +Level H +Level H. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::level-in +gfloat +[0,64] +rwx +Input Gain +Input Gain. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::level-out +gfloat +[0,64] +rwx +Output Gain +Output Gain. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::lp-active +gboolean + +rwx +LP Active +LP Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer12Band::lp-freq +gfloat +[10,20000] +rwx +LP Freq +LP Freq. +18000 + + + +calf-sourceforge-net-plugins-Equalizer12Band::lp-mode +gint +[0,2] +rwx +LP Mode +LP Mode. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::ls-active +gboolean + +rwx +LS Active +LS Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer12Band::ls-freq +gfloat +[10,20000] +rwx +Freq L +Freq L. +200 + + + +calf-sourceforge-net-plugins-Equalizer12Band::ls-level +gfloat +[0.015625,64] +rwx +Level L +Level L. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::meter-inL +gfloat +[0,1] +r +Meter-InL +Meter-InL. +0 + + + +calf-sourceforge-net-plugins-Equalizer12Band::meter-inR +gfloat +[0,1] +r +Meter-InR +Meter-InR. +0 + + + +calf-sourceforge-net-plugins-Equalizer12Band::meter-outL +gfloat +[0,1] +r +Meter-OutL +Meter-OutL. +0 + + + +calf-sourceforge-net-plugins-Equalizer12Band::meter-outR +gfloat +[0,1] +r +Meter-OutR +Meter-OutR. +0 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p1-active +gboolean + +rwx +F1 Active +F1 Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer12Band::p1-freq +gfloat +[10,20000] +rwx +Freq 1 +Freq 1. +60 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p1-level +gfloat +[0.015625,64] +rwx +Level 1 +Level 1. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p1-q +gfloat +[0.1,100] +rwx +Q 1 +Q 1. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p2-active +gboolean + +rwx +F2 Active +F2 Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer12Band::p2-freq +gfloat +[10,20000] +rwx +Freq 2 +Freq 2. +120 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p2-level +gfloat +[0.015625,64] +rwx +Level 2 +Level 2. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p2-q +gfloat +[0.1,100] +rwx +Q 2 +Q 2. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p3-active +gboolean + +rwx +F3 Active +F3 Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer12Band::p3-freq +gfloat +[10,20000] +rwx +Freq 3 +Freq 3. +250 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p3-level +gfloat +[0.015625,64] +rwx +Level 3 +Level 3. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p3-q +gfloat +[0.1,100] +rwx +Q 3 +Q 3. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p4-active +gboolean + +rwx +F4 Active +F4 Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer12Band::p4-freq +gfloat +[10,20000] +rwx +Freq 4 +Freq 4. +500 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p4-level +gfloat +[0.015625,64] +rwx +Level 4 +Level 4. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p4-q +gfloat +[0.1,100] +rwx +Q 4 +Q 4. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p5-active +gboolean + +rwx +F5 Active +F5 Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer12Band::p5-freq +gfloat +[10,20000] +rwx +Freq 5 +Freq 5. +1000 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p5-level +gfloat +[0.015625,64] +rwx +Level 5 +Level 5. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p5-q +gfloat +[0.1,100] +rwx +Q 5 +Q 5. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p6-active +gboolean + +rwx +F6 Active +F6 Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer12Band::p6-freq +gfloat +[10,20000] +rwx +Freq 6 +Freq 6. +2500 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p6-level +gfloat +[0.015625,64] +rwx +Level 6 +Level 6. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p6-q +gfloat +[0.1,100] +rwx +Q 6 +Q 6. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p7-active +gboolean + +rwx +F7 Active +F7 Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer12Band::p7-freq +gfloat +[10,20000] +rwx +Freq 7 +Freq 7. +4000 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p7-level +gfloat +[0.015625,64] +rwx +Level 7 +Level 7. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p7-q +gfloat +[0.1,100] +rwx +Q 7 +Q 7. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p8-active +gboolean + +rwx +F8 Active +F8 Active. +FALSE + + + +calf-sourceforge-net-plugins-Equalizer12Band::p8-freq +gfloat +[10,20000] +rwx +Freq 8 +Freq 8. +6000 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p8-level +gfloat +[0.015625,64] +rwx +Level 8 +Level 8. +1 + + + +calf-sourceforge-net-plugins-Equalizer12Band::p8-q +gfloat +[0.1,100] +rwx +Q 8 +Q 8. +1 + + + +calf-sourceforge-net-plugins-Deesser::bypass +gboolean + +rwx +Bypass +Bypass. +FALSE + + + +calf-sourceforge-net-plugins-Deesser::clip-out +gboolean + +r +Out +Out. +FALSE + + + +calf-sourceforge-net-plugins-Deesser::compression +gfloat +[0,1] +r +Gain Reduction +Gain Reduction. +0 + + + +calf-sourceforge-net-plugins-Deesser::detected +gfloat +[0,1] +r +Detected +Detected. +0 + + + +calf-sourceforge-net-plugins-Deesser::detected-led +gboolean + +r +Active +Active. +FALSE + + + +calf-sourceforge-net-plugins-Deesser::detection +gint +[0,1] +rwx +Detection +Detection. +0 + + + +calf-sourceforge-net-plugins-Deesser::f1-freq +gfloat +[10,18000] +rwx +Split +Split. +6000 + + + +calf-sourceforge-net-plugins-Deesser::f1-level +gfloat +[0.0625,16] +rwx +Gain +Gain. +1 + + + +calf-sourceforge-net-plugins-Deesser::f2-freq +gfloat +[10,18000] +rwx +Peak +Peak. +4500 + + + +calf-sourceforge-net-plugins-Deesser::f2-level +gfloat +[0.0625,16] +rwx +Level +Level. +4 + + + +calf-sourceforge-net-plugins-Deesser::f2-q +gfloat +[0.1,100] +rwx +Peak Q +Peak Q. +1 + + + +calf-sourceforge-net-plugins-Deesser::laxity +gint +[1,100] +rwx +Laxity +Laxity. +15 + + + +calf-sourceforge-net-plugins-Deesser::makeup +gfloat +[1,64] +rwx +Makeup +Makeup. +1 + + + +calf-sourceforge-net-plugins-Deesser::mode +gint +[0,1] +rwx +Mode +Mode. +0 + + + +calf-sourceforge-net-plugins-Deesser::ratio +gfloat +[1,20] +rwx +Ratio +Ratio. +3 + + + +calf-sourceforge-net-plugins-Deesser::sc-listen +gboolean + +rwx +S/C-Listen +S/C-Listen. +FALSE + + + +calf-sourceforge-net-plugins-Deesser::threshold +gfloat +[0.000976563,1] +rwx +Threshold +Threshold. +0.125 + + + +calf-sourceforge-net-plugins-Compressor::attack +gfloat +[0.01,2000] +rwx +Attack +Attack. +20 + + + +calf-sourceforge-net-plugins-Compressor::bypass +gboolean + +rwx +Bypass +Bypass. +FALSE + + + +calf-sourceforge-net-plugins-Compressor::clip-in +gboolean + +r +0dB-In +0dB-In. +FALSE + + + +calf-sourceforge-net-plugins-Compressor::clip-out +gboolean + +r +0dB-Out +0dB-Out. +FALSE + + + +calf-sourceforge-net-plugins-Compressor::compression +gfloat +[0,1] +r +Reduction +Reduction. +0 + + + +calf-sourceforge-net-plugins-Compressor::detection +gint +[0,1] +rwx +Detection +Detection. +0 + + + +calf-sourceforge-net-plugins-Compressor::knee +gfloat +[1,8] +rwx +Knee +Knee. +2.82843 + + + +calf-sourceforge-net-plugins-Compressor::level-in +gfloat +[0,64] +rwx +Input +Input. +1 + + + +calf-sourceforge-net-plugins-Compressor::makeup +gfloat +[1,64] +rwx +Makeup Gain +Makeup Gain. +2 + + + +calf-sourceforge-net-plugins-Compressor::meter-in +gfloat +[0,1] +r +Input +Input. +0 + + + +calf-sourceforge-net-plugins-Compressor::meter-out +gfloat +[0,1] +r +Output +Output. +0 + + + +calf-sourceforge-net-plugins-Compressor::ratio +gfloat +[1,20] +rwx +Ratio +Ratio. +2 + + + +calf-sourceforge-net-plugins-Compressor::release +gfloat +[0.01,2000] +rwx +Release +Release. +250 + + + +calf-sourceforge-net-plugins-Compressor::stereo-link +gint +[0,1] +rwx +Stereo Link +Stereo Link. +0 + + + +calf-sourceforge-net-plugins-Compressor::threshold +gfloat +[0.000976563,1] +rwx +Threshold +Threshold. +0.125 + + + +calf-sourceforge-net-plugins-BassEnhancer::amount +gfloat +[0,64] +rwx +Amount +Amount. +1 + + + +calf-sourceforge-net-plugins-BassEnhancer::blend +gfloat +[-10,10] +rwx +Blend harmonics +Blend harmonics. +0 + + + +calf-sourceforge-net-plugins-BassEnhancer::bypass +gboolean + +rwx +Bypass +Bypass. +FALSE + + + +calf-sourceforge-net-plugins-BassEnhancer::clip-in +gfloat +[0,1] +r +0dB +0dB. +0 + + + +calf-sourceforge-net-plugins-BassEnhancer::clip-out +gfloat +[0,1] +r +0dB +0dB. +0 + + + +calf-sourceforge-net-plugins-BassEnhancer::drive +gfloat +[0.1,10] +rwx +Harmonics +Harmonics. +8.5 + + + +calf-sourceforge-net-plugins-BassEnhancer::freq +gfloat +[10,250] +rwx +Scope +Scope. +120 + + + +calf-sourceforge-net-plugins-BassEnhancer::level-in +gfloat +[0,64] +rwx +Input +Input. +1 + + + +calf-sourceforge-net-plugins-BassEnhancer::level-out +gfloat +[0,64] +rwx +Output +Output. +1 + + + +calf-sourceforge-net-plugins-BassEnhancer::listen +gboolean + +rwx +Listen +Listen. +FALSE + + + +calf-sourceforge-net-plugins-BassEnhancer::meter-drive +gfloat +[0,1] +r +Harmonics level +Harmonics level. +0 + + + +calf-sourceforge-net-plugins-BassEnhancer::meter-in +gfloat +[0,1] +r +Input +Input. +0 + + + +calf-sourceforge-net-plugins-BassEnhancer::meter-out +gfloat +[0,1] +r +Output +Output. +0 + + + +ladspa-trigger::Mode +gint +[1,3] +rwx +Mode +Mode. +1 + + + +ladspa-trigger::Output-Gain +gfloat +>= 0 +rwx +Output-Gain +Output-Gain. +1 + + + +ladspa-trigger::Resolution +gfloat +[1,1000] +rwx +Resolution +Resolution. +1 + + + +ladspa-trigger::Sample +gint +[1,5] +rwx +Sample +Sample. +1 + + + +ladspa-trigger::Threshold +gfloat +[0,2] +rwx +Threshold +Threshold. +1 + + + +ladspa-rubberband-pitchshifter-stereo::Cents +gfloat +[-100,100] +rwx +Cents +Cents. +0 + + + +ladspa-rubberband-pitchshifter-stereo::Crispness +gint +[0,3] +rwx +Crispness +Crispness. +3 + + + +ladspa-rubberband-pitchshifter-stereo::Faster +gboolean + +rwx +Faster +Faster. +FALSE + + + +ladspa-rubberband-pitchshifter-stereo::Formant-Preserving +gboolean + +rwx +Formant-Preserving +Formant-Preserving. +FALSE + + + +ladspa-rubberband-pitchshifter-stereo::Octaves +gint +[-3,3] +rwx +Octaves +Octaves. +0 + + + +ladspa-rubberband-pitchshifter-stereo::Semitones +gint +[-12,12] +rwx +Semitones +Semitones. +0 + + + +ladspa-rubberband-pitchshifter-stereo::latency +gfloat + +r +latency +latency. +-3.40282e+38 + + + +ladspa-rubberband-pitchshifter-mono::Cents +gfloat +[-100,100] +rwx +Cents +Cents. +0 + + + +ladspa-rubberband-pitchshifter-mono::Crispness +gint +[0,3] +rwx +Crispness +Crispness. +3 + + + +ladspa-rubberband-pitchshifter-mono::Faster +gboolean + +rwx +Faster +Faster. +FALSE + + + +ladspa-rubberband-pitchshifter-mono::Formant-Preserving +gboolean + +rwx +Formant-Preserving +Formant-Preserving. +FALSE + + + +ladspa-rubberband-pitchshifter-mono::Octaves +gint +[-3,3] +rwx +Octaves +Octaves. +0 + + + +ladspa-rubberband-pitchshifter-mono::Semitones +gint +[-12,12] +rwx +Semitones +Semitones. +0 + + + +ladspa-rubberband-pitchshifter-mono::latency +gfloat + +r +latency +latency. +-3.40282e+38 + + + +ladspa-rissetScales::Core-Frequency +gfloat +[88.2,2205] +rwx +Core-Frequency +Core-Frequency. +1146.6 + + + +ladspa-rissetScales::Gain +gfloat +[-90,6] +rwx +Gain +Gain. +0 + + + +ladspa-rissetScales::Speed +gfloat +[-6,12] +rwx +Speed +Speed. +7.5 + + + +ladspa-leet-equalizer-bw2x2-1::Band-1-Bandwidth--octaves- +gfloat +[0.1,5] +rwx +Band-1-Bandwidth--octaves- +Band-1-Bandwidth--octaves-. +1 + + + +ladspa-leet-equalizer-bw2x2-1::Band-1-Freq--Hz- +gfloat +[20,22000] +rwx +Band-1-Freq--Hz- +Band-1-Freq--Hz-. +5515 + + + +ladspa-leet-equalizer-bw2x2-1::Band-1-Gain--dB- +gfloat +[-50,20] +rwx +Band-1-Gain--dB- +Band-1-Gain--dB-. +0 + + + +ladspa-leet-equalizer-bw2x2::Band-1-Bandwidth--octaves- +gfloat +[0.1,5] +rwx +Band-1-Bandwidth--octaves- +Band-1-Bandwidth--octaves-. +1 + + + +ladspa-leet-equalizer-bw2x2::Band-1-Freq--Hz- +gfloat +[40,280] +rwx +Band-1-Freq--Hz- +Band-1-Freq--Hz-. +100 + + + +ladspa-leet-equalizer-bw2x2::Band-1-Gain--dB- +gfloat +[-50,20] +rwx +Band-1-Gain--dB- +Band-1-Gain--dB-. +0 + + + +ladspa-leet-equalizer-bw2x2::Band-2-Bandwidth--octaves- +gfloat +[0.1,5] +rwx +Band-2-Bandwidth--octaves- +Band-2-Bandwidth--octaves-. +1 + + + +ladspa-leet-equalizer-bw2x2::Band-2-Freq--Hz- +gfloat +[100,500] +rwx +Band-2-Freq--Hz- +Band-2-Freq--Hz-. +200 + + + +ladspa-leet-equalizer-bw2x2::Band-2-Gain--dB- +gfloat +[-50,20] +rwx +Band-2-Gain--dB- +Band-2-Gain--dB-. +0 + + + +ladspa-leet-equalizer-bw2x2::Band-3-Bandwidth--octaves- +gfloat +[0.1,5] +rwx +Band-3-Bandwidth--octaves- +Band-3-Bandwidth--octaves-. +1 + + + +ladspa-leet-equalizer-bw2x2::Band-3-Freq--Hz- +gfloat +[200,1000] +rwx +Band-3-Freq--Hz- +Band-3-Freq--Hz-. +400 + + + +ladspa-leet-equalizer-bw2x2::Band-3-Gain--dB- +gfloat +[-50,20] +rwx +Band-3-Gain--dB- +Band-3-Gain--dB-. +0 + + + +ladspa-leet-equalizer-bw2x2::Band-4-Bandwidth--octaves- +gfloat +[0.1,5] +rwx +Band-4-Bandwidth--octaves- +Band-4-Bandwidth--octaves-. +1 + + + +ladspa-leet-equalizer-bw2x2::Band-4-Freq--Hz- +gfloat +[400,2800] +rwx +Band-4-Freq--Hz- +Band-4-Freq--Hz-. +1000 + + + +ladspa-leet-equalizer-bw2x2::Band-4-Gain--dB- +gfloat +[-50,20] +rwx +Band-4-Gain--dB- +Band-4-Gain--dB-. +0 + + + +ladspa-leet-equalizer-bw2x2::Band-5-Bandwidth--octaves- +gfloat +[0.1,5] +rwx +Band-5-Bandwidth--octaves- +Band-5-Bandwidth--octaves-. +1 + + + +ladspa-leet-equalizer-bw2x2::Band-5-Freq--Hz- +gfloat +[1000,5000] +rwx +Band-5-Freq--Hz- +Band-5-Freq--Hz-. +3000 + + + +ladspa-leet-equalizer-bw2x2::Band-5-Gain--dB- +gfloat +[-50,20] +rwx +Band-5-Gain--dB- +Band-5-Gain--dB-. +0 + + + +ladspa-leet-equalizer-bw2x2::Band-6-Bandwidth--octaves- +gfloat +[0.1,5] +rwx +Band-6-Bandwidth--octaves- +Band-6-Bandwidth--octaves-. +1 + + + +ladspa-leet-equalizer-bw2x2::Band-6-Freq--Hz- +gfloat +[3000,9000] +rwx +Band-6-Freq--Hz- +Band-6-Freq--Hz-. +6000 + + + +ladspa-leet-equalizer-bw2x2::Band-6-Gain--dB- +gfloat +[-50,20] +rwx +Band-6-Gain--dB- +Band-6-Gain--dB-. +0 + + + +ladspa-leet-equalizer-bw2x2::Band-7-Bandwidth--octaves- +gfloat +[0.1,5] +rwx +Band-7-Bandwidth--octaves- +Band-7-Bandwidth--octaves-. +1 + + + +ladspa-leet-equalizer-bw2x2::Band-7-Freq--Hz- +gfloat +[6000,18000] +rwx +Band-7-Freq--Hz- +Band-7-Freq--Hz-. +12000 + + + +ladspa-leet-equalizer-bw2x2::Band-7-Gain--dB- +gfloat +[-50,20] +rwx +Band-7-Gain--dB- +Band-7-Gain--dB-. +0 + + + +ladspa-leet-equalizer-bw2x2::Band-8-Bandwidth--octaves- +gfloat +[0.1,5] +rwx +Band-8-Bandwidth--octaves- +Band-8-Bandwidth--octaves-. +1 + + + +ladspa-leet-equalizer-bw2x2::Band-8-Freq--Hz- +gfloat +[10000,20000] +rwx +Band-8-Freq--Hz- +Band-8-Freq--Hz-. +15000 + + + +ladspa-leet-equalizer-bw2x2::Band-8-Gain--dB- +gfloat +[-50,20] +rwx +Band-8-Gain--dB- +Band-8-Gain--dB-. +0 + + + +ladspa-intNoise::Bits +gfloat +[1,24] +rwx +Bits +Bits. +24 + + + +ladspa-foo-transients-mono::Attack-gain +gfloat +[-30,30] +rwx +Attack-gain +Attack-gain. +0 + + + +ladspa-foo-transients-mono::Averaging-difference +gfloat +[0.01,0.1] +rwx +Averaging-difference +Averaging-difference. +0.0775 + + + +ladspa-foo-transients-mono::Current-attack-gain +gfloat +[-30,30] +r +Current-attack-gain +Current-attack-gain. +-30 + + + +ladspa-foo-transients-mono::Current-release-gain +gfloat +[-30,30] +r +Current-release-gain +Current-release-gain. +-30 + + + +ladspa-foo-transients-mono::Release-gain +gfloat +[-30,30] +rwx +Release-gain +Release-gain. +0 + + + +ladspa-foo-transients-mono::latency +gfloat + +r +latency +latency. +-3.40282e+38 + + + +ladspa-foo-transients::Attack-gain +gfloat +[-30,30] +rwx +Attack-gain +Attack-gain. +0 + + + +ladspa-foo-transients::Averaging-difference +gfloat +[0.01,0.1] +rwx +Averaging-difference +Averaging-difference. +0.0775 + + + +ladspa-foo-transients::Current-attack-gain +gfloat +[-30,30] +r +Current-attack-gain +Current-attack-gain. +-30 + + + +ladspa-foo-transients::Current-release-gain +gfloat +[-30,30] +r +Current-release-gain +Current-release-gain. +-30 + + + +ladspa-foo-transients::Release-gain +gfloat +[-30,30] +rwx +Release-gain +Release-gain. +0 + + + +ladspa-foo-transients::latency +gfloat + +r +latency +latency. +-3.40282e+38 + + + +ladspa-foo-saturator::Drive +gfloat +[1,6] +rwx +Drive +Drive. +1 + + + +ladspa-foo-saturator::Input-gain +gfloat +[-20,20] +rwx +Input-gain +Input-gain. +0 + + + +ladspa-foo-saturator::Max-level +gfloat +[-60,0] +rwx +Max-level +Max-level. +0 + + + +ladspa-foo-saturator::Square-waveness +gfloat +[0,1] +rwx +Square-waveness +Square-waveness. +0.5 + + + +ladspa-foo-saturator::latency +gfloat + +r +latency +latency. +-3.40282e+38 + + + +ladspa-foo-limiter-v2::Attack-time +gfloat +[1,10] +rwx +Attack-time +Attack-time. +5.5 + + + +ladspa-foo-limiter-v2::Attenuation +gfloat +[0,70] +r +Attenuation +Attenuation. +0 + + + +ladspa-foo-limiter-v2::Input-gain +gfloat +[-20,10] +rwx +Input-gain +Input-gain. +0 + + + +ladspa-foo-limiter-v2::Linear-log-release +gfloat +[0,1] +rwx +Linear-log-release +Linear-log-release. +0.75 + + + +ladspa-foo-limiter-v2::Max-level +gfloat +[-30,0] +rwx +Max-level +Max-level. +0 + + + +ladspa-foo-limiter-v2::Release-time +gfloat +[0.01,2] +rwx +Release-time +Release-time. +0.5075 + + + +ladspa-foo-limiter-v2::latency +gfloat + +r +latency +latency. +-3.40282e+38 + + + +ladspa-foo-limiter::Attenuation +gfloat +[0,70] +r +Attenuation +Attenuation. +0 + + + +ladspa-foo-limiter::Input-gain +gfloat +[-20,10] +rwx +Input-gain +Input-gain. +0 + + + +ladspa-foo-limiter::Linear-log-release +gfloat +[0,1] +rwx +Linear-log-release +Linear-log-release. +0.75 + + + +ladspa-foo-limiter::Max-level +gfloat +[-30,0] +rwx +Max-level +Max-level. +0 + + + +ladspa-foo-limiter::Release-time +gfloat +[0.01,2] +rwx +Release-time +Release-time. +0.5075 + + + +ladspa-foo-limiter::latency +gfloat + +r +latency +latency. +-3.40282e+38 + + + +ladspa-foo-driver::Drive +gfloat +[1,10] +rwx +Drive +Drive. +3.25 + + + +ladspa-foo-driver::Drive-offset +gfloat +[-2,2] +rwx +Drive-offset +Drive-offset. +0 + + + +ladspa-foo-driver::Input-gain +gfloat +[-30,30] +rwx +Input-gain +Input-gain. +0 + + + +ladspa-foo-driver::Web-dry-balance +gfloat +[0,1] +rwx +Web-dry-balance +Web-dry-balance. +0 + + + +ladspa-foo-driver::latency +gfloat + +r +latency +latency. +-3.40282e+38 + + + +ladspa-foo-chop-liver::Chop-window +gint +[2,32] +rwx +Chop-window +Chop-window. +2 + + + +ladspa-foo-chop-liver::Dry-signal +gfloat +[0,1] +rwx +Dry-signal +Dry-signal. +0 + + + +ladspa-foo-chop-liver::Wet-signal +gfloat +[0,1] +rwx +Wet-signal +Wet-signal. +1 + + + +ladspa-foo-chop-liver::latency +gfloat + +r +latency +latency. +-3.40282e+38 + + + +ladspa-eir::Exponent +gint +[1,8] +rwx +Exponent +Exponent. +8 + + + +ladspa-eir::Mantissa +gint +[0,23] +rwx +Mantissa +Mantissa. +23 + + + +ladspa-XShaperS::Amount +gfloat +[0,1] +rwx +Amount +Amount. +1 + + + +ladspa-XShaperS::Curve +gfloat +[0,1] +rwx +Curve +Curve. +0 + + + +ladspa-XShaperS::Gain +gfloat +[0,1] +rwx +Gain +Gain. +1 + + + +ladspa-XShaperS::LFO1-Form +gint +[1,5] +rwx +LFO1-Form +LFO1-Form. +1 + + + +ladspa-XShaperS::LFO1-Gain-Depth +gfloat +[-1,1] +rwx +LFO1-Gain-Depth +LFO1-Gain-Depth. +0 + + + +ladspa-XShaperS::LFO1-Rate +gfloat +[0,10] +rwx +LFO1-Rate +LFO1-Rate. +1 + + + +ladspa-XShaperS::LFO2-Curve-Depth +gfloat +[-1,1] +rwx +LFO2-Curve-Depth +LFO2-Curve-Depth. +0 + + + +ladspa-XShaperS::LFO2-Form +gint +[1,5] +rwx +LFO2-Form +LFO2-Form. +1 + + + +ladspa-XShaperS::LFO2-Rate +gfloat +[0,10] +rwx +LFO2-Rate +LFO2-Rate. +1 + + + +ladspa-XShaperS::Type +gint +[1,9] +rwx +Type +Type. +1 + + + +ladspa-XShaperM::Amount +gfloat +[0,1] +rwx +Amount +Amount. +1 + + + +ladspa-XShaperM::Curve +gfloat +[0,1] +rwx +Curve +Curve. +0 + + + +ladspa-XShaperM::Gain +gfloat +[0,1] +rwx +Gain +Gain. +1 + + + +ladspa-XShaperM::LFO1-Form +gint +[1,5] +rwx +LFO1-Form +LFO1-Form. +1 + + + +ladspa-XShaperM::LFO1-Gain-Depth +gfloat +[-1,1] +rwx +LFO1-Gain-Depth +LFO1-Gain-Depth. +0 + + + +ladspa-XShaperM::LFO1-Rate +gfloat +[0,10] +rwx +LFO1-Rate +LFO1-Rate. +1 + + + +ladspa-XShaperM::LFO2-Curve-Depth +gfloat +[-1,1] +rwx +LFO2-Curve-Depth +LFO2-Curve-Depth. +0 + + + +ladspa-XShaperM::LFO2-Form +gint +[1,5] +rwx +LFO2-Form +LFO2-Form. +1 + + + +ladspa-XShaperM::LFO2-Rate +gfloat +[0,10] +rwx +LFO2-Rate +LFO2-Rate. +1 + + + +ladspa-XShaperM::Type +gint +[1,9] +rwx +Type +Type. +1 + + + +ladspa-VariNoiseS::Density +gfloat +[0,1] +rwx +Density +Density. +1 + + + +ladspa-VariNoiseS::Noise-Type +gint +[1,2] +rwx +Noise-Type +Noise-Type. +1 + + + +ladspa-VariNoiseM::Density +gfloat +[0,1] +rwx +Density +Density. +1 + + + +ladspa-VariNoiseM::Noise-Type +gint +[1,2] +rwx +Noise-Type +Noise-Type. +1 + + + +ladspa-Sidechaingate::Attack +gfloat +[0.01,2000] +rwx +Attack +Attack. +4.47214 + + + +ladspa-Sidechaingate::Bypass +gboolean + +rwx +Bypass +Bypass. +FALSE + + + +ladspa-Sidechaingate::Detection +gint +[0,1] +rwx +Detection +Detection. +0 + + + +ladspa-Sidechaingate::F1-Active +gboolean + +r +F1-Active +F1-Active. +FALSE + + + +ladspa-Sidechaingate::F1-Freq +gfloat +[10,18000] +rwx +F1-Freq +F1-Freq. +424.264 + + + +ladspa-Sidechaingate::F1-Level +gfloat +[0.0625,16] +rwx +F1-Level +F1-Level. +1 + + + +ladspa-Sidechaingate::F2-Active +gboolean + +r +F2-Active +F2-Active. +FALSE + + + +ladspa-Sidechaingate::F2-Freq +gfloat +[10,18000] +rwx +F2-Freq +F2-Freq. +2763.47 + + + +ladspa-Sidechaingate::F2-Level +gfloat +[0.0625,16] +rwx +F2-Level +F2-Level. +1 + + + +ladspa-Sidechaingate::Gating +gfloat +[0.03125,1] +r +Gating +Gating. +0.03125 + + + +ladspa-Sidechaingate::Input +gfloat +[0,64] +rwx +Input +Input. +1 + + + +ladspa-Sidechaingate::Input-1 +gfloat +[0,1] +r +Input-1 +Input-1. +0 + + + +ladspa-Sidechaingate::Knee +gfloat +[1,8] +rwx +Knee +Knee. +2.75 + + + +ladspa-Sidechaingate::Makeup-Gain +gfloat +[1,64] +rwx +Makeup-Gain +Makeup-Gain. +1 + + + +ladspa-Sidechaingate::Max-Gain-Reduction +gfloat +[1.5849e-05,1] +rwx +Max-Gain-Reduction +Max-Gain-Reduction. +1.5849e-05 + + + +ladspa-Sidechaingate::Output +gfloat +[0,1] +r +Output +Output. +0 + + + +ladspa-Sidechaingate::Ratio +gfloat +[1,20] +rwx +Ratio +Ratio. +1 + + + +ladspa-Sidechaingate::Release +gfloat +[0.01,2000] +rwx +Release +Release. +94.5742 + + + +ladspa-Sidechaingate::S-C-Listen +gboolean + +rwx +S-C-Listen +S-C-Listen. +FALSE + + + +ladspa-Sidechaingate::Sidechain-Mode +gint +[0,9] +rwx +Sidechain-Mode +Sidechain-Mode. +0 + + + +ladspa-Sidechaingate::Stereo-Link +gint +[0,1] +rwx +Stereo-Link +Stereo-Link. +0 + + + +ladspa-Sidechaingate::Threshold +gfloat +[0.000976563,1] +rwx +Threshold +Threshold. +0.250732 + + + +ladspa-Sidechaingate::param-0dB-In +gboolean + +r +param-0dB-In +param-0dB-In. +FALSE + + + +ladspa-Sidechaingate::param-0dB-Out +gboolean + +r +param-0dB-Out +param-0dB-Out. +FALSE + + + +ladspa-Saturator::Activation +gfloat +[1,64] +rwx +Activation +Activation. +1 + + + +ladspa-Saturator::Amount +gfloat +[0.0625,16] +rwx +Amount +Amount. +1 + + + +ladspa-Saturator::Blend +gfloat +[-10,10] +rwx +Blend +Blend. +10 + + + +ladspa-Saturator::Bypass +gboolean + +rwx +Bypass +Bypass. +FALSE + + + +ladspa-Saturator::Drive +gfloat +[0,1] +r +Drive +Drive. +0 + + + +ladspa-Saturator::Gradient +gfloat +[0.1,10] +rwx +Gradient +Gradient. +1 + + + +ladspa-Saturator::Highpass +gfloat +[10,20000] +rwx +Highpass +Highpass. +10 + + + +ladspa-Saturator::Highpass-1 +gfloat +[10,20000] +rwx +Highpass-1 +Highpass-1. +10 + + + +ladspa-Saturator::Input +gfloat +[0,1] +r +Input +Input. +0 + + + +ladspa-Saturator::Lowpass +gfloat +[10,20000] +rwx +Lowpass +Lowpass. +20000 + + + +ladspa-Saturator::Lowpass-1 +gfloat +[10,20000] +rwx +Lowpass-1 +Lowpass-1. +20000 + + + +ladspa-Saturator::Master +gfloat +[0,64] +rwx +Master +Master. +1 + + + +ladspa-Saturator::Mix +gfloat +[0,1] +rwx +Mix +Mix. +1 + + + +ladspa-Saturator::Output +gfloat +[0,1] +r +Output +Output. +0 + + + +ladspa-Saturator::Saturation +gfloat +[0.1,10] +rwx +Saturation +Saturation. +5.05 + + + +ladspa-Saturator::Tone +gfloat +[80,8000] +rwx +Tone +Tone. +2529.82 + + + +ladspa-Saturator::param-0dB +gfloat +[0,1] +r +param-0dB +param-0dB. +0 + + + +ladspa-Saturator::param-0dB-1 +gfloat +[0,1] +r +param-0dB-1 +param-0dB-1. +0 + + + +ladspa-SID::Amplitude +gfloat +[0,15] +rwx +Amplitude +Amplitude. +0 + + + +ladspa-SID::ENV-A-1 +gfloat +[0,15] +rwx +ENV-A-1 +ENV-A-1. +0 + + + +ladspa-SID::ENV-A-2 +gfloat +[0,15] +rwx +ENV-A-2 +ENV-A-2. +0 + + + +ladspa-SID::ENV-A-3 +gfloat +[0,15] +rwx +ENV-A-3 +ENV-A-3. +0 + + + +ladspa-SID::ENV-D-1 +gfloat +[0,15] +rwx +ENV-D-1 +ENV-D-1. +0 + + + +ladspa-SID::ENV-D-2 +gfloat +[0,15] +rwx +ENV-D-2 +ENV-D-2. +0 + + + +ladspa-SID::ENV-D-3 +gfloat +[0,15] +rwx +ENV-D-3 +ENV-D-3. +0 + + + +ladspa-SID::ENV-R-1 +gfloat +[0,15] +rwx +ENV-R-1 +ENV-R-1. +0 + + + +ladspa-SID::ENV-R-2 +gfloat +[0,15] +rwx +ENV-R-2 +ENV-R-2. +0 + + + +ladspa-SID::ENV-R-3 +gfloat +[0,15] +rwx +ENV-R-3 +ENV-R-3. +0 + + + +ladspa-SID::ENV-S-1 +gfloat +[0,15] +rwx +ENV-S-1 +ENV-S-1. +0 + + + +ladspa-SID::ENV-S-2 +gfloat +[0,15] +rwx +ENV-S-2 +ENV-S-2. +0 + + + +ladspa-SID::ENV-S-3 +gfloat +[0,15] +rwx +ENV-S-3 +ENV-S-3. +0 + + + +ladspa-SID::Filter-BP +gboolean + +rwx +Filter-BP +Filter-BP. +FALSE + + + +ladspa-SID::Filter-Cutoff-Freq +gfloat +[0,2047] +rwx +Filter-Cutoff-Freq +Filter-Cutoff-Freq. +0 + + + +ladspa-SID::Filter-External-On +gboolean + +rwx +Filter-External-On +Filter-External-On. +FALSE + + + +ladspa-SID::Filter-HP +gboolean + +rwx +Filter-HP +Filter-HP. +FALSE + + + +ladspa-SID::Filter-LP +gboolean + +rwx +Filter-LP +Filter-LP. +FALSE + + + +ladspa-SID::Filter-On +gboolean + +rwx +Filter-On +Filter-On. +FALSE + + + +ladspa-SID::Filter-On-1 +gboolean + +rwx +Filter-On-1 +Filter-On-1. +FALSE + + + +ladspa-SID::Filter-On-2 +gboolean + +rwx +Filter-On-2 +Filter-On-2. +FALSE + + + +ladspa-SID::Filter-On-3 +gboolean + +rwx +Filter-On-3 +Filter-On-3. +FALSE + + + +ladspa-SID::Filter-Resonance +gfloat +[0,15] +rwx +Filter-Resonance +Filter-Resonance. +0 + + + +ladspa-SID::MOS8580 +gboolean + +rwx +MOS8580 +MOS8580. +FALSE + + + +ladspa-SID::Noise-1 +gboolean + +rwx +Noise-1 +Noise-1. +FALSE + + + +ladspa-SID::Noise-2 +gboolean + +rwx +Noise-2 +Noise-2. +FALSE + + + +ladspa-SID::Noise-3 +gboolean + +rwx +Noise-3 +Noise-3. +FALSE + + + +ladspa-SID::Pulse-1 +gboolean + +rwx +Pulse-1 +Pulse-1. +FALSE + + + +ladspa-SID::Pulse-2 +gboolean + +rwx +Pulse-2 +Pulse-2. +FALSE + + + +ladspa-SID::Pulse-3 +gboolean + +rwx +Pulse-3 +Pulse-3. +FALSE + + + +ladspa-SID::Pulse-Width-1 +gfloat +[0,4095] +rwx +Pulse-Width-1 +Pulse-Width-1. +0 + + + +ladspa-SID::Pulse-Width-2 +gfloat +[0,4095] +rwx +Pulse-Width-2 +Pulse-Width-2. +0 + + + +ladspa-SID::Pulse-Width-3 +gfloat +[0,4095] +rwx +Pulse-Width-3 +Pulse-Width-3. +0 + + + +ladspa-SID::Ringmod-1 +gboolean + +rwx +Ringmod-1 +Ringmod-1. +FALSE + + + +ladspa-SID::Ringmod-2 +gboolean + +rwx +Ringmod-2 +Ringmod-2. +FALSE + + + +ladspa-SID::Ringmod-3 +gboolean + +rwx +Ringmod-3 +Ringmod-3. +FALSE + + + +ladspa-SID::Saw-1 +gboolean + +rwx +Saw-1 +Saw-1. +FALSE + + + +ladspa-SID::Saw-2 +gboolean + +rwx +Saw-2 +Saw-2. +FALSE + + + +ladspa-SID::Saw-3 +gboolean + +rwx +Saw-3 +Saw-3. +FALSE + + + +ladspa-SID::Sync-1 +gboolean + +rwx +Sync-1 +Sync-1. +FALSE + + + +ladspa-SID::Sync-2 +gboolean + +rwx +Sync-2 +Sync-2. +FALSE + + + +ladspa-SID::Sync-3 +gboolean + +rwx +Sync-3 +Sync-3. +FALSE + + + +ladspa-SID::Tri-1 +gboolean + +rwx +Tri-1 +Tri-1. +FALSE + + + +ladspa-SID::Tri-2 +gboolean + +rwx +Tri-2 +Tri-2. +FALSE + + + +ladspa-SID::Tri-3 +gboolean + +rwx +Tri-3 +Tri-3. +FALSE + + + +ladspa-SID::param-3-Off +gboolean + +rwx +param-3-Off +param-3-Off. +FALSE + + + +ladspa-SCC::Amplitude +gfloat +>= 0 +rwx +Amplitude +Amplitude. +1 + + + +ladspa-SCC::Preset +gint +[0,341] +rwx +Preset +Preset. +0 + + + +ladspa-PSG::AM-Env-ALT +gboolean + +rwx +AM-Env-ALT +AM-Env-ALT. +FALSE + + + +ladspa-PSG::AM-Env-ATT +gboolean + +rwx +AM-Env-ATT +AM-Env-ATT. +FALSE + + + +ladspa-PSG::AM-Env-CONT +gboolean + +rwx +AM-Env-CONT +AM-Env-CONT. +FALSE + + + +ladspa-PSG::AM-Env-HOLD +gboolean + +rwx +AM-Env-HOLD +AM-Env-HOLD. +FALSE + + + +ladspa-PSG::AM-Freq +gfloat +[0.213361,13982.6] +rwx +AM-Freq +AM-Freq. +1 + + + +ladspa-PSG::AM-On +gboolean + +rwx +AM-On +AM-On. +FALSE + + + +ladspa-PSG::Amplitude +gfloat +[0,15] +rwx +Amplitude +Amplitude. +0 + + + +ladspa-PSG::Audio-On +gboolean + +rwx +Audio-On +Audio-On. +FALSE + + + +ladspa-PSG::Noise-Control +gfloat +[0,1] +rwx +Noise-Control +Noise-Control. +0 + + + +ladspa-PSG::Noise-On +gboolean + +rwx +Noise-On +Noise-On. +FALSE + + + +ladspa-NoisifierS::Balance +gfloat +[0,1] +rwx +Balance +Balance. +0 + + + +ladspa-NoisifierS::Noise-Density +gfloat +[0,1] +rwx +Noise-Density +Noise-Density. +1 + + + +ladspa-NoisifierS::Noise-Type +gint +[1,2] +rwx +Noise-Type +Noise-Type. +1 + + + +ladspa-NoisifierM::Balance +gfloat +[0,1] +rwx +Balance +Balance. +0 + + + +ladspa-NoisifierM::Noise-Density +gfloat +[0,1] +rwx +Noise-Density +Noise-Density. +1 + + + +ladspa-NoisifierM::Noise-Type +gint +[1,2] +rwx +Noise-Type +Noise-Type. +1 + + + +ladspa-MUSICDrum::Amplitude-BD +gfloat +[0,15] +rwx +Amplitude-BD +Amplitude-BD. +0 + + + +ladspa-MUSICDrum::Amplitude-SD-T-CY-HH +gfloat +[0,15] +rwx +Amplitude-SD-T-CY-HH +Amplitude-SD-T-CY-HH. +0 + + + +ladspa-MUSICDrum::Amplitude-TOM-T-CY-HH +gfloat +[0,15] +rwx +Amplitude-TOM-T-CY-HH +Amplitude-TOM-T-CY-HH. +0 + + + +ladspa-MUSICDrum::Freq +gfloat +[0,22050] +rwx +Freq +Freq. +440 + + + +ladspa-MUSICDrum::Freq-1 +gfloat +[0,22050] +rwx +Freq-1 +Freq-1. +440 + + + +ladspa-MUSICDrum::Freq-2 +gfloat +[0,22050] +rwx +Freq-2 +Freq-2. +440 + + + +ladspa-MUSIC::Amplitude +gint +[0,15] +rwx +Amplitude +Amplitude. +0 + + + +ladspa-MUSIC::Carrier-AM +gboolean + +rwx +Carrier-AM +Carrier-AM. +FALSE + + + +ladspa-MUSIC::Carrier-Distortion-Waveform +gboolean + +rwx +Carrier-Distortion-Waveform +Carrier-Distortion-Waveform. +FALSE + + + +ladspa-MUSIC::Carrier-Env-A +gint +[0,15] +rwx +Carrier-Env-A +Carrier-Env-A. +0 + + + +ladspa-MUSIC::Carrier-Env-D +gint +[0,15] +rwx +Carrier-Env-D +Carrier-Env-D. +0 + + + +ladspa-MUSIC::Carrier-Env-R +gint +[0,15] +rwx +Carrier-Env-R +Carrier-Env-R. +0 + + + +ladspa-MUSIC::Carrier-Env-S +gint +[0,15] +rwx +Carrier-Env-S +Carrier-Env-S. +0 + + + +ladspa-MUSIC::Carrier-Key-Scale-Level +gint +[0,3] +rwx +Carrier-Key-Scale-Level +Carrier-Key-Scale-Level. +0 + + + +ladspa-MUSIC::Carrier-Percussive +gboolean + +rwx +Carrier-Percussive +Carrier-Percussive. +FALSE + + + +ladspa-MUSIC::Carrier-Rate-Key-Scale +gboolean + +rwx +Carrier-Rate-Key-Scale +Carrier-Rate-Key-Scale. +FALSE + + + +ladspa-MUSIC::Carrier-Vibrato +gboolean + +rwx +Carrier-Vibrato +Carrier-Vibrato. +FALSE + + + +ladspa-MUSIC::Carrier-Wave-Multiply +gint +[0,15] +rwx +Carrier-Wave-Multiply +Carrier-Wave-Multiply. +0 + + + +ladspa-MUSIC::Modulator-AM +gboolean + +rwx +Modulator-AM +Modulator-AM. +FALSE + + + +ladspa-MUSIC::Modulator-Distortion-Waveform +gboolean + +rwx +Modulator-Distortion-Waveform +Modulator-Distortion-Waveform. +FALSE + + + +ladspa-MUSIC::Modulator-Env-A +gint +[0,15] +rwx +Modulator-Env-A +Modulator-Env-A. +0 + + + +ladspa-MUSIC::Modulator-Env-D +gint +[0,15] +rwx +Modulator-Env-D +Modulator-Env-D. +0 + + + +ladspa-MUSIC::Modulator-Env-R +gint +[0,15] +rwx +Modulator-Env-R +Modulator-Env-R. +0 + + + +ladspa-MUSIC::Modulator-Env-S +gint +[0,15] +rwx +Modulator-Env-S +Modulator-Env-S. +0 + + + +ladspa-MUSIC::Modulator-FM-feedback +gint +[0,7] +rwx +Modulator-FM-feedback +Modulator-FM-feedback. +0 + + + +ladspa-MUSIC::Modulator-Key-Scale-Level +gint +[0,3] +rwx +Modulator-Key-Scale-Level +Modulator-Key-Scale-Level. +0 + + + +ladspa-MUSIC::Modulator-Percussive +gboolean + +rwx +Modulator-Percussive +Modulator-Percussive. +FALSE + + + +ladspa-MUSIC::Modulator-Rate-Key-Scale +gboolean + +rwx +Modulator-Rate-Key-Scale +Modulator-Rate-Key-Scale. +FALSE + + + +ladspa-MUSIC::Modulator-Total-Level +gint +[0,63] +rwx +Modulator-Total-Level +Modulator-Total-Level. +0 + + + +ladspa-MUSIC::Modulator-Vibrato +gboolean + +rwx +Modulator-Vibrato +Modulator-Vibrato. +FALSE + + + +ladspa-MUSIC::Modulator-Wave-Multiply +gint +[0,15] +rwx +Modulator-Wave-Multiply +Modulator-Wave-Multiply. +0 + + + +ladspa-MUSIC::Preset +gint +[0,15] +rwx +Preset +Preset. +0 + + + +ladspa-MUSIC::Sustain +gboolean + +rwx +Sustain +Sustain. +FALSE + + + +ladspa-Gate::Attack +gfloat +[0.01,2000] +rwx +Attack +Attack. +4.47214 + + + +ladspa-Gate::Bypass +gboolean + +rwx +Bypass +Bypass. +FALSE + + + +ladspa-Gate::Detection +gint +[0,1] +rwx +Detection +Detection. +0 + + + +ladspa-Gate::Gating +gfloat +[0.03125,1] +r +Gating +Gating. +0.03125 + + + +ladspa-Gate::Input +gfloat +[0,64] +rwx +Input +Input. +1 + + + +ladspa-Gate::Input-1 +gfloat +[0,1] +r +Input-1 +Input-1. +0 + + + +ladspa-Gate::Knee +gfloat +[1,8] +rwx +Knee +Knee. +2.75 + + + +ladspa-Gate::Makeup-Gain +gfloat +[1,64] +rwx +Makeup-Gain +Makeup-Gain. +1 + + + +ladspa-Gate::Max-Gain-Reduction +gfloat +[1.5849e-05,1] +rwx +Max-Gain-Reduction +Max-Gain-Reduction. +1.5849e-05 + + + +ladspa-Gate::Output +gfloat +[0,1] +r +Output +Output. +0 + + + +ladspa-Gate::Ratio +gfloat +[1,20] +rwx +Ratio +Ratio. +1 + + + +ladspa-Gate::Release +gfloat +[0.01,2000] +rwx +Release +Release. +94.5742 + + + +ladspa-Gate::Stereo-Link +gint +[0,1] +rwx +Stereo-Link +Stereo-Link. +0 + + + +ladspa-Gate::Threshold +gfloat +[0.000976563,1] +rwx +Threshold +Threshold. +0.250732 + + + +ladspa-Gate::param-0dB-In +gboolean + +r +param-0dB-In +param-0dB-In. +FALSE + + + +ladspa-Gate::param-0dB-Out +gboolean + +r +param-0dB-Out +param-0dB-Out. +FALSE + + + +ladspa-Exciter::Amount +gfloat +[0,64] +rwx +Amount +Amount. +1 + + + +ladspa-Exciter::Blend-harmonics +gfloat +[-10,10] +rwx +Blend-harmonics +Blend-harmonics. +0 + + + +ladspa-Exciter::Bypass +gboolean + +rwx +Bypass +Bypass. +FALSE + + + +ladspa-Exciter::Harmonics +gfloat +[0.1,10] +rwx +Harmonics +Harmonics. +7.525 + + + +ladspa-Exciter::Harmonics-level +gfloat +[0,1] +r +Harmonics-level +Harmonics-level. +0 + + + +ladspa-Exciter::Input +gfloat +[0,64] +rwx +Input +Input. +1 + + + +ladspa-Exciter::Input-1 +gfloat +[0,1] +r +Input-1 +Input-1. +0 + + + +ladspa-Exciter::Listen +gboolean + +rwx +Listen +Listen. +FALSE + + + +ladspa-Exciter::Output +gfloat +[0,64] +rwx +Output +Output. +1 + + + +ladspa-Exciter::Output-1 +gfloat +[0,1] +r +Output-1 +Output-1. +0 + + + +ladspa-Exciter::Scope +gfloat +[2000,12000] +rwx +Scope +Scope. +4898.98 + + + +ladspa-Exciter::param-0dB +gfloat +[0,1] +r +param-0dB +param-0dB. +0 + + + +ladspa-Exciter::param-0dB-1 +gfloat +[0,1] +r +param-0dB-1 +param-0dB-1. +0 + + + +ladspa-Chorus1-2x2::Delay +gfloat +[0,30] +rwx +Delay +Delay. +0 + + + +ladspa-Chorus1-2x2::Mod-Amplitude-1 +gfloat +[0,10] +rwx +Mod-Amplitude-1 +Mod-Amplitude-1. +0 + + + +ladspa-Chorus1-2x2::Mod-Amplitude-2 +gfloat +[0,3] +rwx +Mod-Amplitude-2 +Mod-Amplitude-2. +0 + + + +ladspa-Chorus1-2x2::Mod-Frequency-1 +gfloat +[0.003,10] +rwx +Mod-Frequency-1 +Mod-Frequency-1. +0.003 + + + +ladspa-Chorus1-2x2::Mod-Frequency-2 +gfloat +[0.01,30] +rwx +Mod-Frequency-2 +Mod-Frequency-2. +0.01 + + + +ladspa-BoosterS::Clip +gfloat +[0,1] +rwx +Clip +Clip. +1 + + + +ladspa-BoosterS::Curve +gfloat +[0,1] +rwx +Curve +Curve. +0 + + + +ladspa-BoosterS::Gain +gint +[0,36] +rwx +Gain +Gain. +0 + + + +ladspa-BoosterM::Clip +gfloat +[0,1] +rwx +Clip +Clip. +1 + + + +ladspa-BoosterM::Curve +gfloat +[0,1] +rwx +Curve +Curve. +0 + + + +ladspa-BoosterM::Gain +gint +[0,36] +rwx +Gain +Gain. +0 + + + +ladspa-BassEnhancer::Amount +gfloat +[0,64] +rwx +Amount +Amount. +1 + + + +ladspa-BassEnhancer::Blend-harmonics +gfloat +[-10,10] +rwx +Blend-harmonics +Blend-harmonics. +0 + + + +ladspa-BassEnhancer::Bypass +gboolean + +rwx +Bypass +Bypass. +FALSE + + + +ladspa-BassEnhancer::Harmonics +gfloat +[0.1,10] +rwx +Harmonics +Harmonics. +7.525 + + + +ladspa-BassEnhancer::Harmonics-level +gfloat +[0,1] +r +Harmonics-level +Harmonics-level. +0 + + + +ladspa-BassEnhancer::Input +gfloat +[0,64] +rwx +Input +Input. +1 + + + +ladspa-BassEnhancer::Input-1 +gfloat +[0,1] +r +Input-1 +Input-1. +0 + + + +ladspa-BassEnhancer::Listen +gboolean + +rwx +Listen +Listen. +FALSE + + + +ladspa-BassEnhancer::Output +gfloat +[0,64] +rwx +Output +Output. +1 + + + +ladspa-BassEnhancer::Output-1 +gfloat +[0,1] +r +Output-1 +Output-1. +0 + + + +ladspa-BassEnhancer::Scope +gfloat +[10,250] +rwx +Scope +Scope. +111.803 + + + +ladspa-BassEnhancer::param-0dB +gfloat +[0,1] +r +param-0dB +param-0dB. +0 + + + +ladspa-BassEnhancer::param-0dB-1 +gfloat +[0,1] +r +param-0dB-1 +param-0dB-1. +0 + + + +GstMpegvParse::drop +gboolean + +rwx +drop +Drop data untill valid configuration data is received either in the stream or through caps. +TRUE + + + +GstMpegvParse::gop-split +gboolean + +rwx +gop-split +Split frame when encountering GOP. +FALSE + + + +GstFaceOverlay::h +gfloat +>= 0 +rw +face height percent +Specify image height relative to face height. +1 + + + +GstFaceOverlay::location +gchar* + +rw +Location +Location of SVG file to use for face overlay. +"" + + + +GstFaceOverlay::w +gfloat +>= 0 +rw +face width percent +Specify image width relative to face width. +1 + + + +GstFaceOverlay::x +gfloat + +rw +face x offset +Specify image x relative to detected face x. +0 + + + +GstFaceOverlay::y +gfloat + +rw +face y offset +Specify image y relative to detected face y. +0 + + + +GstDebugSpy::checksum-type +GChecksumType + +rw +Checksum TYpe +Checksum algorithm to use. +Use the SHA-1 hashing algorithm + + + +GstDebugSpy::silent +gboolean + +rw +Silent +Produce verbose output ?. +FALSE + + diff --git a/docs/plugins/gst-plugins-bad-plugins.hierarchy b/docs/plugins/gst-plugins-bad-plugins.hierarchy index 8c6f8579a6..b7e35c17ca 100644 --- a/docs/plugins/gst-plugins-bad-plugins.hierarchy +++ b/docs/plugins/gst-plugins-bad-plugins.hierarchy @@ -10,20 +10,20 @@ GObject ADPCMEnc GstAiffMux GstAiffParse - GstAmrWbEnc GstAsfMux GstAsfParse GstAssRender - GstBaseParseBad - GstAacParse - GstAc3Parse - GstAmrParse - GstDcaParse + GstBaseAudioVisualizer + GstSpaceScope + GstSpectraScope + GstSynaeScope + GstWaveScope + GstBaseParse GstDiracParse - GstFlacParse GstH263Parse GstH264Parse - GstMpegAudioParse + GstMpeg4VParse + GstMpegvParse GstBaseRTPDepayload GstRtpDTMFDepay GstRtpVP8Depay @@ -34,40 +34,33 @@ GObject GstBaseAudioSink GstAudioSink GstApExSink - GstNasSink GstSDLAudioSink GstChecksumSink GstCurlSink GstDCCPClientSink GstDCCPServerSink GstFBDEVSink + GstLinsysSdiSink GstSFSink GstShmSink GstVideoSink - GstDfbVideoSink GstSDLVideoSink VdpSink GstBaseSrc GstDTMFSrc GstDataURISrc + GstLinsysSdiSrc GstPushSrc GstDCCPClientSrc GstDCCPServerSrc GstDc1394 GstDvbSrc GstMMS - GstMythtvSrc GstNeonhttpSrc GstRTMPSrc GstRfbSrc GstShmSrc GstVCDSrc - frei0r-src-ising0r - frei0r-src-lissajous0r - frei0r-src-nois0r - frei0r-src-onecol0r - frei0r-src-partik0l - frei0r-src-plasma GstRTPDTMFSrc GstSFSrc GstBaseTransform @@ -80,11 +73,13 @@ GObject GstCogcolorspace GstCogdownsample GstColorconvert + GstDebugSpy GstDtmfDetect GstHDVParse GstLegacyresample GstLogoinsert GstMeasureCollector + GstPatchdetect GstRGB2Bayer GstScaletempo GstVideoFilter @@ -125,60 +120,15 @@ GObject Gstfacedetect GstRsvgOverlay GstSolarize + GstVideo3DConvert + GstVideo3DPresent GstVideoAnalyse GstVideoDetect GstVideoMark GstZBar - frei0r-filter-3-point-color-balance - frei0r-filter-3dflippo - frei0r-filter-b - frei0r-filter-baltan - frei0r-filter-bluescreen0r - frei0r-filter-brightness - frei0r-filter-bw0r - frei0r-filter-cartoon - frei0r-filter-color-distance - frei0r-filter-contrast0r - frei0r-filter-curves - frei0r-filter-dealygrab - frei0r-filter-delay0r - frei0r-filter-distort0r - frei0r-filter-edgeglow - frei0r-filter-equaliz0r - frei0r-filter-flippo - frei0r-filter-g - frei0r-filter-gamma - frei0r-filter-glow - frei0r-filter-hueshift0r - frei0r-filter-invert0r - frei0r-filter-k-means-clustering - frei0r-filter-lens-correction - frei0r-filter-letterb0xed - frei0r-filter-levels - frei0r-filter-luminance - frei0r-filter-mask0mate - frei0r-filter-nervous - frei0r-filter-nosync0r - frei0r-filter-perspective - frei0r-filter-pixeliz0r - frei0r-filter-primaries - frei0r-filter-r - frei0r-filter-rgb-parade - frei0r-filter-saturat0r - frei0r-filter-scale0tilt - frei0r-filter-scanline0r - frei0r-filter-sobel - frei0r-filter-squareblur - frei0r-filter-tehroxx0r - frei0r-filter-threelay0r - frei0r-filter-threshold0r - frei0r-filter-tint0r - frei0r-filter-transparency - frei0r-filter-twolay0r - frei0r-filter-vectorscope - frei0r-filter-vertigo - frei0r-filter-water - frei0r-filter-white-balance + GstVideoFilter2 + GstSceneChange + GstZebraStripe GstVideoMaxRate GstBaseVideoCodec GstBaseVideoDecoder @@ -192,7 +142,10 @@ GObject DvbBaseBin GstAutoConvert GstAutoVideoConvert + GstBaseCameraSrc + GstWrapperCameraBinSrc GstFPSDisplaySink + GstFaceOverlay GstGSettingsSwitchSink GstGSettingsAudioSink GstGSettingsVideoSink @@ -201,8 +154,9 @@ GObject GstGSettingsVideoSrc GstPipeline GstCameraBin - GstQTMoovRecover + GstCameraBin2 GstSDPDemux + GstViewfinderBin RsnDvdBin GstBz2dec GstBz2enc @@ -213,15 +167,18 @@ GObject GstChopMyData GstDVBSubOverlay GstDVDSpu + GstDecklinkSink + GstDecklinkSrc GstDtsDec GstFaac GstFaad GstFestival + GstFieldAnalysis GstFreeze - GstGPPMux GstGSMDec GstGSMEnc - GstISMLMux + GstGmeDec + GstHLSDemux GstId3BaseMux GstId3Mux GstInterlace @@ -234,19 +191,12 @@ GObject GstKateEnc GstKateParse GstKateTag - GstKateTiger GstLegacyH264Parse GstLiveAdder - GstMJ2Mux - GstMP4Mux GstMSE GstMXFDemux GstMXFMux - GstMimDec - GstMimEnc GstModPlug - GstMpeg2enc - GstMpeg4VParse GstMpegPSDemux GstMpegTSDemux GstMplex @@ -255,11 +205,11 @@ GObject GstMveMux GstNsfDec GstNuvDemux + GstOpencvTextOverlay GstPcapParse GstPitch GstPnmdec GstPnmenc - GstQTMux GstRTPMux GstRTPDTMFMux GstRawParse @@ -269,117 +219,396 @@ GObject GstRealVideoDec GstRsvgDec GstSSim + GstSdiDemux + GstSdiMux GstSegmentClip GstAudioSegmentClip GstVideoSegmentClip GstSignalProcessor + calf-sourceforge-net-plugins-BassEnhancer + calf-sourceforge-net-plugins-Compressor + calf-sourceforge-net-plugins-Deesser + calf-sourceforge-net-plugins-Equalizer12Band + calf-sourceforge-net-plugins-Equalizer5Band + calf-sourceforge-net-plugins-Equalizer8Band + calf-sourceforge-net-plugins-Exciter + calf-sourceforge-net-plugins-Filter + calf-sourceforge-net-plugins-Filterclavier + calf-sourceforge-net-plugins-Flanger + calf-sourceforge-net-plugins-Fluidsynth + calf-sourceforge-net-plugins-Gate + calf-sourceforge-net-plugins-Monosynth + calf-sourceforge-net-plugins-MultiChorus + calf-sourceforge-net-plugins-Multibandcompressor + calf-sourceforge-net-plugins-Organ + calf-sourceforge-net-plugins-Phaser + calf-sourceforge-net-plugins-Pulsator + calf-sourceforge-net-plugins-Reverb + calf-sourceforge-net-plugins-RotarySpeaker + calf-sourceforge-net-plugins-Saturator + calf-sourceforge-net-plugins-Sidechaincompressor + calf-sourceforge-net-plugins-Sidechaingate + calf-sourceforge-net-plugins-VintageDelay + calf-sourceforge-net-plugins-Wavetable + invadarecords-com-plugins-lv2-compressor-mono + invadarecords-com-plugins-lv2-compressor-stereo + invadarecords-com-plugins-lv2-delay-mono + invadarecords-com-plugins-lv2-delay-sum + invadarecords-com-plugins-lv2-erreverb-mono + invadarecords-com-plugins-lv2-erreverb-sum + invadarecords-com-plugins-lv2-filter-hpf-mono + invadarecords-com-plugins-lv2-filter-hpf-stereo + invadarecords-com-plugins-lv2-filter-lpf-mono + invadarecords-com-plugins-lv2-filter-lpf-stereo + invadarecords-com-plugins-lv2-input + invadarecords-com-plugins-lv2-meter + invadarecords-com-plugins-lv2-phaser-mono + invadarecords-com-plugins-lv2-phaser-stereo + invadarecords-com-plugins-lv2-phaser-sum + invadarecords-com-plugins-lv2-testtone + invadarecords-com-plugins-lv2-tube-mono + invadarecords-com-plugins-lv2-tube-stereo + ladspa-AWfilt + ladspa-Accumulate + ladspa-Ambisonics-11-cube-decoder + ladspa-Ambisonics-11-hexagon-decoder + ladspa-Ambisonics-11-mono-panner + ladspa-Ambisonics-11-rotator + ladspa-Ambisonics-11-square-decoder + ladspa-Ambisonics-11-stereo-panner + ladspa-Ambisonics-21-panner + ladspa-Ambisonics-21-rotator + ladspa-Ambisonics-22-panner + ladspa-Ambisonics-22-rotator + ladspa-Ambisonics-31-panner + ladspa-Ambisonics-31-rotator + ladspa-Ambisonics-33-panner + ladspa-Ambisonics-33-rotator + ladspa-AmpIII + ladspa-AmpIV + ladspa-AmpV + ladspa-AmpVTS + ladspa-AutoWah + ladspa-BassEnhancer + ladspa-BoosterM + ladspa-BoosterS + ladspa-CEO + ladspa-CVFreq + ladspa-CabinetI + ladspa-CabinetII ladspa-Chorus1 + ladspa-Chorus1-2x2 ladspa-Chorus2 + ladspa-ChorusI + ladspa-ChorusII + ladspa-Click + ladspa-Clip + ladspa-Compress + ladspa-Compressor + ladspa-Deesser + ladspa-Dirac + ladspa-Eq + ladspa-Eq2x2 + ladspa-Equalizer12Band + ladspa-Equalizer5Band + ladspa-Equalizer8Band + ladspa-Exaggerate + ladspa-Exciter + ladspa-Filter + ladspa-Filterclavier + ladspa-Flanger ladspa-G2reverb + ladspa-Gate + ladspa-HRTF + ladspa-JVRev + ladspa-Lorenz + ladspa-MUSIC + ladspa-MUSICDrum + ladspa-MultiChorus + ladspa-Multibandcompressor ladspa-Mvchpf-1 ladspa-Mvclpf-1 ladspa-Mvclpf-2 ladspa-Mvclpf-3 ladspa-Mvclpf-4 + ladspa-NoisifierM + ladspa-NoisifierS + ladspa-PSG + ladspa-Pan + ladspa-Parametric1 + ladspa-Phaser ladspa-Phaser1 ladspa-Phaser1+LFO + ladspa-PhaserI + ladspa-PhaserII + ladspa-Plate + ladspa-Plate2x2 + ladspa-PreampIII + ladspa-PreampIV + ladspa-Pulsator + ladspa-Pulse-VCO + ladspa-Rec-VCO + ladspa-Reverb + ladspa-Roessler + ladspa-RotarySpeaker + ladspa-SCC + ladspa-SID + ladspa-Saturator + ladspa-Saw-VCO + ladspa-Scape + ladspa-Sidechaincompressor + ladspa-Sidechaingate + ladspa-Sin + ladspa-SooperLooper + ladspa-StereoChorusI + ladspa-StereoChorusII + ladspa-SweepVFI + ladspa-SweepVFII + ladspa-Sync-Rect-VCO + ladspa-Sync-Saw-VCO + ladspa-Sync-Tri-VCO + ladspa-ToneStack + ladspa-ToneStackLT + ladspa-Transpose + ladspa-Tricardioid-to-AMB ladspa-TripleChorus + ladspa-VCOd + ladspa-VCOs + ladspa-VariNoiseM + ladspa-VariNoiseS + ladspa-VintageDelay + ladspa-Virtualmic + ladspa-White + ladspa-XShaperM + ladspa-XShaperS + ladspa-adenv + ladspa-adenv-lvl + ladspa-adsr + ladspa-adsr-g+t ladspa-alias + ladspa-alienwah-mono + ladspa-alienwah-stereo ladspa-allpass-c ladspa-allpass-l ladspa-allpass-n + ladspa-am ladspa-amPitchshift ladspa-amp + ladspa-amp-gaia-oa + ladspa-amp-gcia-oa ladspa-amp-mono ladspa-amp-stereo + ladspa-analogue ladspa-analogueOsc ladspa-artificialLatency ladspa-autoPhaser ladspa-bandpass-a-iir ladspa-bandpass-iir + ladspa-bf-rotate-z + ladspa-bf2cube + ladspa-bf2quad + ladspa-bf2stereo ladspa-bodeShifter ladspa-bodeShifterCV + ladspa-branch-ia-oaoa + ladspa-branch-ic-ococ ladspa-butthigh-iir ladspa-buttlow-iir ladspa-bwxover-iir + ladspa-canyon-delay ladspa-chebstortion + ladspa-clipper ladspa-comb ladspa-comb-c ladspa-comb-l ladspa-comb-n ladspa-combSplitter + ladspa-comp-aa + ladspa-comp-ac + ladspa-compress-peak + ladspa-compress-rms ladspa-const ladspa-crossoverDist + ladspa-dahdsr-cg+t-control + ladspa-dahdsr-fexp + ladspa-dahdsr-g+t-audio + ladspa-dahdsr-g+t-control + ladspa-dahdsr-hexp ladspa-dcRemove ladspa-decay ladspa-decimator ladspa-declip + ladspa-delay-0-01s + ladspa-delay-0-1s + ladspa-delay-1s ladspa-delay-5s + ladspa-delay-60s ladspa-delay-c ladspa-delay-l ladspa-delay-n ladspa-delayorama + ladspa-difference-iama-oa + ladspa-difference-iamc-oa + ladspa-difference-icma-oa + ladspa-difference-icmc-oc ladspa-diode + ladspa-disintegrator ladspa-divider ladspa-dj-eq ladspa-dj-eq-mono ladspa-djFlanger ladspa-dysonCompress + ladspa-eir + ladspa-encode-bformat + ladspa-encode-fmh + ladspa-expand-peak + ladspa-expand-rms ladspa-fadDelay + ladspa-fast-xfade ladspa-fastLookaheadLimiter + ladspa-fbdelay-0-01s + ladspa-fbdelay-0-1s + ladspa-fbdelay-1s + ladspa-fbdelay-5s + ladspa-fbdelay-60s ladspa-flanger + ladspa-floatNoise ladspa-fmOsc + ladspa-fmh-rotate-z + ladspa-fmh2bf + ladspa-fmh2oct + ladspa-fmod-fama-oa + ladspa-fmod-famc-oa + ladspa-fmod-fcma-oa + ladspa-fmod-fcmc-oc ladspa-foldover + ladspa-foo-chop-liver + ladspa-foo-driver + ladspa-foo-limiter + ladspa-foo-limiter-v2 + ladspa-foo-saturator + ladspa-foo-transients + ladspa-foo-transients-mono + ladspa-formant-vc ladspa-fourByFourPole ladspa-foverdrive + ladspa-freeverb3 ladspa-freqTracker ladspa-gate ladspa-giantFlange ladspa-gong ladspa-gongBeater + ladspa-grain-scatter ladspa-gsm ladspa-gverb + ladspa-hard-gate ladspa-hardLimiter ladspa-harmonicGen ladspa-hermesFilter ladspa-highpass-iir ladspa-hilbert ladspa-hpf + ladspa-hz-voct-ar + ladspa-hz-voct-cr + ladspa-identity-audio + ladspa-identity-control ladspa-imp ladspa-impulse-fc + ladspa-intNoise + ladspa-interpolator ladspa-inv ladspa-karaoke ladspa-lcrDelay + ladspa-leet-equalizer-bw2x2 + ladspa-leet-equalizer-bw2x2-1 ladspa-lfoPhaser + ladspa-limit-peak + ladspa-limit-rms + ladspa-lofi + ladspa-logistic ladspa-lowpass-iir + ladspa-lp4pole-faraia-oa + ladspa-lp4pole-fcrcia-oa ladspa-lpf ladspa-lsFilter + ladspa-matched ladspa-matrixMSSt ladspa-matrixSpatialiser ladspa-matrixStMS ladspa-mbeq + ladspa-mixer ladspa-modDelay ladspa-multivoiceChorus + ladspa-mux-ar + ladspa-mux-cr + ladspa-noise-source-white ladspa-noise-white ladspa-notch-iir + ladspa-null-ai + ladspa-null-ao + ladspa-null-ci + ladspa-null-co + ladspa-organ + ladspa-peak + ladspa-phasemod + ladspa-pink-full-frequency + ladspa-pink-interpolated-audio + ladspa-pink-sh ladspa-pitchScale ladspa-pitchScaleHQ ladspa-plate ladspa-pointerCastDistortion + ladspa-power + ladspa-power-cr + ladspa-preamp + ladspa-prob-switch-ar + ladspa-prob-switch-cr + ladspa-product-iaia-oa + ladspa-product-iaic-oa + ladspa-product-icic-oc + ladspa-pulse-fapa-oa + ladspa-pulse-fapc-oa + ladspa-pulse-fcpa-oa + ladspa-pulse-fcpc-oa + ladspa-quantiser100 + ladspa-quantiser20 + ladspa-quantiser50 + ladspa-random-fasa-oa + ladspa-random-fasc-oa + ladspa-random-fcsa-oa + ladspa-random-fcsc-oa + ladspa-range-trans-ar + ladspa-range-trans-cr ladspa-rateShifter + ladspa-ratio-nada-oa + ladspa-ratio-nadc-oa + ladspa-ratio-ncda-oa + ladspa-ratio-ncdc-oc ladspa-retroFlange ladspa-revdelay ladspa-ringmod-1i1o1l ladspa-ringmod-2i1o + ladspa-rissetScales + ladspa-rubberband-pitchshifter-mono + ladspa-rubberband-pitchshifter-stereo ladspa-satanMaximiser + ladspa-sawtooth-fa-oa + ladspa-sawtooth-fc-oa ladspa-sc1 ladspa-sc2 ladspa-sc3 ladspa-sc4 ladspa-sc4m ladspa-se4 + ladspa-sequencer16 + ladspa-sequencer32 + ladspa-sequencer64 + ladspa-sh-ar + ladspa-sh-cr ladspa-shaper ladspa-sifter + ladspa-signal-abs-ar + ladspa-signal-abs-cr ladspa-sinCos ladspa-sine-faaa ladspa-sine-faac @@ -387,11 +616,28 @@ GObject ladspa-sine-fcac ladspa-singlePara ladspa-sinusWavewrapper + ladspa-sledgehammer + ladspa-slew-limiter-ra + ladspa-slew-limiter-rc + ladspa-slide-ta + ladspa-slide-tc ladspa-smoothDecimate ladspa-split + ladspa-square-fa-oa + ladspa-square-fc-oa + ladspa-ssm-masher ladspa-stepMuxer + ladspa-sum-iaia-oa + ladspa-sum-iaic-oa + ladspa-sum-icic-oc + ladspa-super-60 ladspa-surroundEncoder ladspa-svf + ladspa-syncpulse-fapaga-oa + ladspa-syncpulse-fcpcga-oa + ladspa-syncsquare-faga-oa + ladspa-syncsquare-fcga-oa + ladspa-syndrum ladspa-tap-autopan ladspa-tap-chorusflanger ladspa-tap-deesser @@ -412,12 +658,39 @@ GObject ladspa-tap-tubewarmth ladspa-tap-vibrato ladspa-tapeDelay + ladspa-track-max-peak + ladspa-track-max-rms + ladspa-track-peak + ladspa-track-rms + ladspa-tracker-gaaadaia-oa + ladspa-tracker-gaacdcia-oa ladspa-transient + ladspa-triangle-fasa-oa + ladspa-triangle-fasc-oa + ladspa-triangle-fcsa-oa + ladspa-triangle-fcsc-oa + ladspa-trigger ladspa-triplePara + ladspa-unmatched ladspa-valve ladspa-valveRect + ladspa-vcf-bp1 + ladspa-vcf-bp2 + ladspa-vcf-hp + ladspa-vcf-hshelf + ladspa-vcf-lp + ladspa-vcf-lshelf + ladspa-vcf-notch + ladspa-vcf-peakeq + ladspa-vcf-reslp + ladspa-vcf303 + ladspa-vlevel-mono + ladspa-vlevel-stereo + ladspa-vocoder ladspa-vynil ladspa-waveTerrain + ladspa-wg-mesh-cr + ladspa-wshape-sine ladspa-xfade ladspa-xfade4 ladspa-zm1 @@ -427,19 +700,19 @@ GObject GstSrtEnc GstTRM GstTemplateMatch + GstTimidity GstTtaDec GstTtaParse GstVMncDec GstVcdParse GstVdpVideoPostProcess - GstWildmidi + GstVideo3DMerge GstXvidDec GstXvidEnc GstY4mDec Gstedgedetect Gstfaceblur Gstpyramidsegment - Gsttextwrite MpegPsMux MpegTSBase GstTSDemux @@ -452,36 +725,6 @@ GObject GstVdpH264Dec GstVdpMpeg4Dec GstVdpMpegDec - frei0r-mixer-addition - frei0r-mixer-alpha-injection - frei0r-mixer-alphaatop - frei0r-mixer-alphain - frei0r-mixer-alphaout - frei0r-mixer-alphaover - frei0r-mixer-alphaxor - frei0r-mixer-blend - frei0r-mixer-burn - frei0r-mixer-color-only - frei0r-mixer-composition - frei0r-mixer-darken - frei0r-mixer-difference - frei0r-mixer-divide - frei0r-mixer-dodge - frei0r-mixer-grain-extract - frei0r-mixer-grain-merge - frei0r-mixer-hardlight - frei0r-mixer-hue - frei0r-mixer-lighten - frei0r-mixer-multiply - frei0r-mixer-overlay - frei0r-mixer-rgb - frei0r-mixer-saturation - frei0r-mixer-screen - frei0r-mixer-softlight - frei0r-mixer-subtract - frei0r-mixer-uv-map - frei0r-mixer-value - frei0r-mixer-xfade0r GstPad GstVdpOutputSrcPad GstVdpVideoSrcPad @@ -511,6 +754,7 @@ GInterface GstPhotography GstPreset GstTagSetter + GstTagXmpWriter GstURIHandler GstXOverlay MXFDescriptiveMetadataFrameworkInterface diff --git a/docs/plugins/gst-plugins-bad-plugins.interfaces b/docs/plugins/gst-plugins-bad-plugins.interfaces index bec4fc6a63..7a3fcee6e9 100644 --- a/docs/plugins/gst-plugins-bad-plugins.interfaces +++ b/docs/plugins/gst-plugins-bad-plugins.interfaces @@ -1,45 +1,47 @@ -GstBin GstChildProxy -GstPipeline GstChildProxy -GstCameraBin GstChildProxy GstImplementsInterface GstColorBalance GstTagSetter -GstQTMoovRecover GstChildProxy -GstGSettingsSwitchSink GstChildProxy -GstGSettingsAudioSink GstChildProxy -GstGSettingsVideoSink GstChildProxy -GstGSettingsSwitchSrc GstChildProxy -GstGSettingsAudioSrc GstChildProxy -GstGSettingsVideoSrc GstChildProxy -RsnDvdBin GstChildProxy GstURIHandler DvbBaseBin GstChildProxy GstURIHandler +GstAmrWbEnc GstPreset +GstApExSink GstImplementsInterface GstMixer +GstAsfMux GstTagSetter GstAutoConvert GstChildProxy GstAutoVideoConvert GstChildProxy -GstSDPDemux GstChildProxy -GstFPSDisplaySink GstChildProxy -GstSDLVideoSink GstImplementsInterface GstXOverlay GstNavigation -GstDfbVideoSink GstImplementsInterface GstNavigation GstColorBalance -VdpSink GstImplementsInterface GstNavigation GstXOverlay -GstApExSink GstImplementsInterface GstMixer -GstMpeg2enc GstPreset -GstCeltEnc GstTagSetter GstPreset +GstBaseCameraSrc GstChildProxy +GstBaseVideoEncoder GstPreset +GstBin GstChildProxy GstCDAudio GstURIHandler -GstRTMPSrc GstURIHandler -GstMythtvSrc GstURIHandler -GstMMS GstURIHandler -GstNeonhttpSrc GstURIHandler -GstVCDSrc GstURIHandler +GstCameraBin GstChildProxy GstImplementsInterface GstColorBalance GstTagSetter +GstCameraBin2 GstChildProxy GstTagSetter +GstCeltEnc GstTagSetter GstPreset GstDataURISrc GstURIHandler -GstAmrWbEnc GstPreset -GstFaac GstPreset -GstXvidEnc GstPreset +GstDfbVideoSink GstImplementsInterface GstNavigation GstColorBalance GstDiracEnc GstPreset -GstVP8Enc GstTagSetter GstPreset -GstKateEnc GstTagSetter -GstKateTag GstTagSetter -GstJifMux GstTagSetter +GstFPSDisplaySink GstChildProxy +GstFaac GstPreset +GstFaceOverlay GstChildProxy +GstGSettingsAudioSink GstChildProxy +GstGSettingsAudioSrc GstChildProxy +GstGSettingsSwitchSink GstChildProxy +GstGSettingsSwitchSrc GstChildProxy +GstGSettingsVideoSink GstChildProxy +GstGSettingsVideoSrc GstChildProxy GstId3BaseMux GstTagSetter GstId3Mux GstTagSetter -GstQTMux GstTagSetter -GstMP4Mux GstTagSetter -GstISMLMux GstTagSetter -GstGPPMux GstTagSetter -GstMJ2Mux GstTagSetter -GstAsfMux GstTagSetter +GstJifMux GstTagSetter GstTagXmpWriter +GstKateEnc GstTagSetter +GstKateTag GstTagSetter +GstMMS GstURIHandler +GstMpeg2enc GstPreset +GstMythtvSrc GstURIHandler +GstNeonhttpSrc GstURIHandler +GstPipeline GstChildProxy +GstRTMPSrc GstURIHandler +GstSDLVideoSink GstImplementsInterface GstXOverlay GstNavigation +GstSDPDemux GstChildProxy +GstSchroEnc GstPreset +GstVCDSrc GstURIHandler +GstVP8Enc GstPreset GstTagSetter +GstVP8Enc GstTagSetter GstPreset +GstViewfinderBin GstChildProxy +GstWrapperCameraBinSrc GstChildProxy +GstXvidEnc GstPreset +RsnDvdBin GstChildProxy GstURIHandler +VdpSink GstImplementsInterface GstNavigation GstXOverlay diff --git a/docs/plugins/gst-plugins-bad-plugins.prerequisites b/docs/plugins/gst-plugins-bad-plugins.prerequisites index f55006018f..2fbd90b01f 100644 --- a/docs/plugins/gst-plugins-bad-plugins.prerequisites +++ b/docs/plugins/gst-plugins-bad-plugins.prerequisites @@ -1,8 +1,9 @@ GstChildProxy GstObject -GstImplementsInterface GstElement -GstXOverlay GstImplementsInterface GstElement -GstTagSetter GstElement GstColorBalance GstImplementsInterface GstElement +GstImplementsInterface GstElement GstMixer GstImplementsInterface GstElement -MXFDescriptiveMetadataFrameworkInterface MXFDescriptiveMetadata GstPhotography GstImplementsInterface GstElement +GstTagSetter GstElement +GstTagXmpWriter GstElement +GstXOverlay GstImplementsInterface GstElement +MXFDescriptiveMetadataFrameworkInterface MXFDescriptiveMetadata diff --git a/docs/plugins/gst-plugins-bad-plugins.signals b/docs/plugins/gst-plugins-bad-plugins.signals index 32fad94293..95a08076de 100644 --- a/docs/plugins/gst-plugins-bad-plugins.signals +++ b/docs/plugins/gst-plugins-bad-plugins.signals @@ -515,3 +515,17 @@ GstShmSink *gstshmsink gint arg1 + +GstCameraBin2::start-capture +void +la +GstCameraBin2 *gstcamerabin2 + + + +GstCameraBin2::stop-capture +void +la +GstCameraBin2 *gstcamerabin2 + + diff --git a/docs/plugins/inspect/plugin-adpcmdec.xml b/docs/plugins/inspect/plugin-adpcmdec.xml index fba62a5cf8..cfaf8767c3 100644 --- a/docs/plugins/inspect/plugin-adpcmdec.xml +++ b/docs/plugins/inspect/plugin-adpcmdec.xml @@ -3,7 +3,7 @@ ADPCM decoder ../../gst/adpcmdec/.libs/libgstadpcmdec.so libgstadpcmdec.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git @@ -14,7 +14,7 @@ ADPCM decoder Codec/Decoder/Audio Decode MS and IMA ADPCM audio - Pioneers of the Inevitable <songbird@songbirdnest.com + Pioneers of the Inevitable <songbird@songbirdnest.com> sink diff --git a/docs/plugins/inspect/plugin-adpcmenc.xml b/docs/plugins/inspect/plugin-adpcmenc.xml index acfa8c7c19..de83e4b7f1 100644 --- a/docs/plugins/inspect/plugin-adpcmenc.xml +++ b/docs/plugins/inspect/plugin-adpcmenc.xml @@ -3,7 +3,7 @@ ADPCM encoder ../../gst/adpcmenc/.libs/libgstadpcmenc.so libgstadpcmenc.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git @@ -14,7 +14,7 @@ ADPCM encoder Codec/Encoder/Audio Encode ADPCM audio - Pioneers of the Inevitable <songbird@songbirdnest.com + Pioneers of the Inevitable <songbird@songbirdnest.com> sink diff --git a/docs/plugins/inspect/plugin-aiff.xml b/docs/plugins/inspect/plugin-aiff.xml index f616fff130..e31c7d9714 100644 --- a/docs/plugins/inspect/plugin-aiff.xml +++ b/docs/plugins/inspect/plugin-aiff.xml @@ -3,7 +3,7 @@ Create and parse Audio Interchange File Format (AIFF) files ../../gst/aiff/.libs/libgstaiff.so libgstaiff.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git @@ -47,7 +47,7 @@ src source always -
audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int){ 1234, 4321 }, width=(int){ 8, 16, 24, 32 }, depth=(int)[ 1, 32 ], signed=(boolean){ true, false }
+
audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int){ 1234, 4321 }, width=(int){ 8, 16, 24, 32 }, depth=(int)[ 1, 32 ], signed=(boolean){ true, false }; audio/x-raw-float, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int){ 1234, 4321 }, width=(int){ 32, 64 }
diff --git a/docs/plugins/inspect/plugin-amrwbenc.xml b/docs/plugins/inspect/plugin-amrwbenc.xml deleted file mode 100644 index e70e68bdf6..0000000000 --- a/docs/plugins/inspect/plugin-amrwbenc.xml +++ /dev/null @@ -1,34 +0,0 @@ - - amrwbenc - Adaptive Multi-Rate Wide-Band Encoder - ../../ext/amrwbenc/.libs/libgstamrwbenc.so - libgstamrwbenc.so - 0.10.21.1 - unknown - gst-plugins-bad - GStreamer Bad Plug-ins git - Unknown package origin - - - amrwbenc - AMR-WB audio encoder - Codec/Encoder/Audio - Adaptive Multi-Rate Wideband audio encoder - Renato Araujo <renato.filho@indt.org.br> - - - sink - sink - always -
audio/x-raw-int, width=(int)16, depth=(int)16, signed=(boolean)true, endianness=(int)1234, rate=(int)16000, channels=(int)1
-
- - src - source - always -
audio/AMR-WB, rate=(int)16000, channels=(int)1
-
-
-
-
-
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-apexsink.xml b/docs/plugins/inspect/plugin-apexsink.xml index 95dcedc7da..2af03ecc17 100644 --- a/docs/plugins/inspect/plugin-apexsink.xml +++ b/docs/plugins/inspect/plugin-apexsink.xml @@ -3,7 +3,7 @@ Apple AirPort Express Plugin ../../ext/apexsink/.libs/libgstapexsink.so libgstapexsink.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-asfmux.xml b/docs/plugins/inspect/plugin-asfmux.xml index b9c21a78c9..5fd6129799 100644 --- a/docs/plugins/inspect/plugin-asfmux.xml +++ b/docs/plugins/inspect/plugin-asfmux.xml @@ -3,7 +3,7 @@ ASF Muxer Plugin ../../gst/asfmux/.libs/libgstasfmux.so libgstasfmux.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-assrender.xml b/docs/plugins/inspect/plugin-assrender.xml index 6786697f17..4e7fff501a 100644 --- a/docs/plugins/inspect/plugin-assrender.xml +++ b/docs/plugins/inspect/plugin-assrender.xml @@ -3,7 +3,7 @@ ASS/SSA subtitle renderer ../../ext/assrender/.libs/libgstassrender.so libgstassrender.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-audioparsersbad.xml b/docs/plugins/inspect/plugin-audioparsersbad.xml deleted file mode 100644 index eb908af26e..0000000000 --- a/docs/plugins/inspect/plugin-audioparsersbad.xml +++ /dev/null @@ -1,139 +0,0 @@ - - audioparsersbad - audioparsers - ../../gst/audioparsers/.libs/libgstaudioparsersbad.so - libgstaudioparsersbad.so - 0.10.21.1 - LGPL - gst-plugins-bad - GStreamer Bad Plug-ins git - Unknown package origin - - - aacparse - AAC audio stream parser - Codec/Parser/Audio - Advanced Audio Coding parser - Stefan Kost <stefan.kost@nokia.com> - - - sink - sink - always -
audio/mpeg, framed=(boolean)false, mpegversion=(int){ 2, 4 }
-
- - src - source - always -
audio/mpeg, framed=(boolean)true, mpegversion=(int){ 2, 4 }, stream-format=(string){ raw, adts, adif }
-
-
-
- - ac3parse - AC3 audio stream parser - Codec/Parser/Audio - AC3 parser - Tim-Philipp Müller <tim centricular net> - - - sink - sink - always -
audio/x-ac3, framed=(boolean)false; audio/x-eac3, framed=(boolean)false; audio/ac3, framed=(boolean)false
-
- - src - source - always -
audio/x-ac3, framed=(boolean)true, channels=(int)[ 1, 6 ], rate=(int)[ 32000, 48000 ]; audio/x-eac3, framed=(boolean)true, channels=(int)[ 1, 6 ], rate=(int)[ 32000, 48000 ]
-
-
-
- - amrparse - AMR audio stream parser - Codec/Parser/Audio - Adaptive Multi-Rate audio parser - Ronald Bultje <rbultje@ronald.bitfreak.net> - - - sink - sink - always -
audio/x-amr-nb-sh; audio/x-amr-wb-sh
-
- - src - source - always -
audio/AMR, rate=(int)8000, channels=(int)1; audio/AMR-WB, rate=(int)16000, channels=(int)1
-
-
-
- - dcaparse - DTS Coherent Acoustics audio stream parser - Codec/Parser/Audio - DCA parser - Tim-Philipp Müller <tim centricular net> - - - sink - sink - always -
audio/x-dts, framed=(boolean)false
-
- - src - source - always -
audio/x-dts, framed=(boolean)true, channels=(int)[ 1, 8 ], rate=(int)[ 8000, 192000 ]
-
-
-
- - flacparse - FLAC audio parser - Codec/Parser/Audio - Parses audio with the FLAC lossless audio codec - Sebastian Dröge <sebastian.droege@collabora.co.uk> - - - sink - sink - always -
audio/x-flac, framed=(boolean)false
-
- - src - source - always -
audio/x-flac, framed=(boolean)true, channels=(int)[ 1, 8 ], rate=(int)[ 1, 655350 ]
-
-
-
- - mpegaudioparse - MPEG1 Audio Parser - Codec/Parser/Audio - Parses and frames mpeg1 audio streams (levels 1-3), provides seek - Jan Schmidt <thaytan@mad.scientist.com>,Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> - - - sink - sink - always -
audio/mpeg, mpegversion=(int)1, parsed=(boolean)false
-
- - src - source - always -
audio/mpeg, mpegversion=(int)1, layer=(int)[ 1, 3 ], rate=(int)[ 8000, 48000 ], channels=(int)[ 1, 2 ], parsed=(boolean)true
-
-
-
-
-
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-audiovisualizers.xml b/docs/plugins/inspect/plugin-audiovisualizers.xml new file mode 100644 index 0000000000..8f8f2bcadc --- /dev/null +++ b/docs/plugins/inspect/plugin-audiovisualizers.xml @@ -0,0 +1,97 @@ + + audiovisualizers + Creates video visualizations of audio input + ../../gst/audiovisualizers/.libs/libgstaudiovisualizers.so + libgstaudiovisualizers.so + 0.10.22.1 + GPL + gst-plugins-bad + GStreamer Bad Plug-ins git + Unknown package origin + + + spacescope + Stereo visualizer + Visualization + Simple stereo visualizer + Stefan Kost <ensonic@users.sf.net> + + + sink + sink + always +
audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)2, endianness=(int)1234, width=(int)16, depth=(int)16, signed=(boolean)true
+
+ + src + source + always +
video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+
+
+ + spectrascope + Frequency spectrum scope + Visualization + Simple frequency spectrum scope + Stefan Kost <ensonic@users.sf.net> + + + sink + sink + always +
audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)2, endianness=(int)1234, width=(int)16, depth=(int)16, signed=(boolean)true
+
+ + src + source + always +
video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+
+
+ + synaescope + Synaescope + Visualization + Creates video visualizations of audio input, using stereo and pitch information + Stefan Kost <ensonic@users.sf.net> + + + sink + sink + always +
audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)2, endianness=(int)1234, width=(int)16, depth=(int)16, signed=(boolean)true
+
+ + src + source + always +
video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+
+
+ + wavescope + Waveform oscilloscope + Visualization + Simple waveform oscilloscope + Stefan Kost <ensonic@users.sf.net> + + + sink + sink + always +
audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)2, endianness=(int)1234, width=(int)16, depth=(int)16, signed=(boolean)true
+
+ + src + source + always +
video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+
+
+
+
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-autoconvert.xml b/docs/plugins/inspect/plugin-autoconvert.xml index 0dd7873c1b..648b34ae1d 100644 --- a/docs/plugins/inspect/plugin-autoconvert.xml +++ b/docs/plugins/inspect/plugin-autoconvert.xml @@ -3,7 +3,7 @@ Selects convertor element based on caps ../../gst/autoconvert/.libs/libgstautoconvert.so libgstautoconvert.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-bayer.xml b/docs/plugins/inspect/plugin-bayer.xml index 0bb15c67fb..bab7e6a5d8 100644 --- a/docs/plugins/inspect/plugin-bayer.xml +++ b/docs/plugins/inspect/plugin-bayer.xml @@ -3,7 +3,7 @@ Elements to convert Bayer images ../../gst/bayer/.libs/libgstbayer.so libgstbayer.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git @@ -26,7 +26,7 @@ src source always -
video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, alpha_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, alpha_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, alpha_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, alpha_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
diff --git a/docs/plugins/inspect/plugin-bz2.xml b/docs/plugins/inspect/plugin-bz2.xml index a5af38ea4b..d5588302f1 100644 --- a/docs/plugins/inspect/plugin-bz2.xml +++ b/docs/plugins/inspect/plugin-bz2.xml @@ -3,7 +3,7 @@ Compress or decompress streams ../../ext/bz2/.libs/libgstbz2.so libgstbz2.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-camerabin.xml b/docs/plugins/inspect/plugin-camerabin.xml index 91a386f105..4dd64ab3a9 100644 --- a/docs/plugins/inspect/plugin-camerabin.xml +++ b/docs/plugins/inspect/plugin-camerabin.xml @@ -3,7 +3,7 @@ High level api for DC (Digital Camera) application ../../gst/camerabin/.libs/libgstcamerabin.so libgstcamerabin.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-camerabin2.xml b/docs/plugins/inspect/plugin-camerabin2.xml new file mode 100644 index 0000000000..0814d04b2d --- /dev/null +++ b/docs/plugins/inspect/plugin-camerabin2.xml @@ -0,0 +1,64 @@ + + camerabin2 + camerabin2 + ../../gst/camerabin2/.libs/libgstcamerabin2.so + libgstcamerabin2.so + 0.10.22.1 + LGPL + gst-plugins-bad + GStreamer Bad Plug-ins git + Unknown package origin + + + camerabin2 + CameraBin2 + Generic/Bin/Camera + CameraBin2 + Thiago Santos <thiago.sousa.santos@collabora.co.uk> + + + + + viewfinderbin + Viewfinder Bin + Sink/Video + Viewfinder Bin used in camerabin2 + Thiago Santos <thiago.sousa.santos@collabora.co.uk> + + + sink + sink + always +
video/x-raw-yuv; video/x-raw-rgb
+
+
+
+ + wrappercamerabinsrc + V4l2 camera src element for camerabin + Source/Video + V4l2 camera src element for camerabin + Rob Clark <rob@ti.com> + + + imgsrc + source + always +
ANY
+
+ + vfsrc + source + always +
ANY
+
+ + vidsrc + source + always +
ANY
+
+
+
+
+
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-cdaudio.xml b/docs/plugins/inspect/plugin-cdaudio.xml index b28ef3498c..1b4e2d5651 100644 --- a/docs/plugins/inspect/plugin-cdaudio.xml +++ b/docs/plugins/inspect/plugin-cdaudio.xml @@ -3,7 +3,7 @@ Play CD audio through the CD Drive ../../ext/cdaudio/.libs/libgstcdaudio.so libgstcdaudio.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-cdxaparse.xml b/docs/plugins/inspect/plugin-cdxaparse.xml index a9480090e6..a0443a5afc 100644 --- a/docs/plugins/inspect/plugin-cdxaparse.xml +++ b/docs/plugins/inspect/plugin-cdxaparse.xml @@ -3,7 +3,7 @@ Parse a .dat file (VCD) into raw mpeg1 ../../gst/cdxaparse/.libs/libgstcdxaparse.so libgstcdxaparse.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-celt.xml b/docs/plugins/inspect/plugin-celt.xml index 8b359667ca..da3e8989f1 100644 --- a/docs/plugins/inspect/plugin-celt.xml +++ b/docs/plugins/inspect/plugin-celt.xml @@ -3,7 +3,7 @@ CELT plugin library ../../ext/celt/.libs/libgstcelt.so libgstcelt.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-cog.xml b/docs/plugins/inspect/plugin-cog.xml index bf0fd83dd5..51bbcd37b8 100644 --- a/docs/plugins/inspect/plugin-cog.xml +++ b/docs/plugins/inspect/plugin-cog.xml @@ -3,7 +3,7 @@ Cog plugin ../../ext/cog/.libs/libgstcog.so libgstcog.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-coloreffects.xml b/docs/plugins/inspect/plugin-coloreffects.xml index 99d3a37b25..7d2d235ccf 100644 --- a/docs/plugins/inspect/plugin-coloreffects.xml +++ b/docs/plugins/inspect/plugin-coloreffects.xml @@ -3,7 +3,7 @@ Color Look-up Table filters ../../gst/coloreffects/.libs/libgstcoloreffects.so libgstcoloreffects.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-colorspace.xml b/docs/plugins/inspect/plugin-colorspace.xml index 9cfedafffb..a5cf26c219 100644 --- a/docs/plugins/inspect/plugin-colorspace.xml +++ b/docs/plugins/inspect/plugin-colorspace.xml @@ -3,7 +3,7 @@ Colorspace conversion ../../gst/colorspace/.libs/libgstcolorspace.so libgstcolorspace.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad diff --git a/docs/plugins/inspect/plugin-curl.xml b/docs/plugins/inspect/plugin-curl.xml index 64e82c9546..4074b87cb1 100644 --- a/docs/plugins/inspect/plugin-curl.xml +++ b/docs/plugins/inspect/plugin-curl.xml @@ -3,7 +3,7 @@ libcurl-based elements ../../ext/curl/.libs/libgstcurl.so libgstcurl.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-dataurisrc.xml b/docs/plugins/inspect/plugin-dataurisrc.xml index 8945d1e048..3d8114206a 100644 --- a/docs/plugins/inspect/plugin-dataurisrc.xml +++ b/docs/plugins/inspect/plugin-dataurisrc.xml @@ -3,7 +3,7 @@ data: URI source ../../gst/dataurisrc/.libs/libgstdataurisrc.so libgstdataurisrc.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-dc1394.xml b/docs/plugins/inspect/plugin-dc1394.xml index c58f73244d..425a6237db 100644 --- a/docs/plugins/inspect/plugin-dc1394.xml +++ b/docs/plugins/inspect/plugin-dc1394.xml @@ -3,7 +3,7 @@ 1394 IIDC Video Source ../../ext/dc1394/.libs/libgstdc1394.so libgstdc1394.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-dccp.xml b/docs/plugins/inspect/plugin-dccp.xml index 3455b24633..8beb7089da 100644 --- a/docs/plugins/inspect/plugin-dccp.xml +++ b/docs/plugins/inspect/plugin-dccp.xml @@ -3,7 +3,7 @@ transfer data over the network via DCCP. ../../gst/dccp/.libs/libgstdccp.so libgstdccp.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad DCCP diff --git a/docs/plugins/inspect/plugin-debugutilsbad.xml b/docs/plugins/inspect/plugin-debugutilsbad.xml index f8e716df43..1a28a1460d 100644 --- a/docs/plugins/inspect/plugin-debugutilsbad.xml +++ b/docs/plugins/inspect/plugin-debugutilsbad.xml @@ -3,7 +3,7 @@ Collection of elements that may or may not be useful for debugging ../../gst/debugutils/.libs/libgstdebugutilsbad.so libgstdebugutilsbad.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git @@ -51,6 +51,27 @@ + + debugspy + DebugSpy + Filter/Analyzer/Debug + DebugSpy provides information on buffers with bus messages + Guillaume Emont <gemont@igalia.com> + + + sink + sink + always +
ANY
+
+ + src + source + always +
ANY
+
+
+
fpsdisplaysink Measure and show framerate on videosink diff --git a/docs/plugins/inspect/plugin-decklink.xml b/docs/plugins/inspect/plugin-decklink.xml new file mode 100644 index 0000000000..8d6937d75f --- /dev/null +++ b/docs/plugins/inspect/plugin-decklink.xml @@ -0,0 +1,55 @@ + + decklink + Blackmagic Decklink plugin + ../../sys/decklink/.libs/libgstdecklink.so + libgstdecklink.so + 0.10.22.1 + LGPL + gst-plugins-bad + GStreamer Bad Plug-ins + Unknown package origin + + + decklinksink + Decklink Sink + Video/Sink + Decklink Sink + David Schleef <ds@entropywave.com> + + + audiosink + sink + always +
audio/x-raw-int, width=(int)16, depth=(int)16, channels=(int)2, rate=(int)48000
+
+ + videosink + sink + always +
video/x-raw-yuv, format=(fourcc)UYVY, width=(int)720, height=(int)486, framerate=(fraction)30000/1001, interlaced=(boolean)true
+
+
+
+ + decklinksrc + Decklink source + Source/Video + DeckLink Source + David Schleef <ds@entropywave.com> + + + audiosrc + source + always +
audio/x-raw-int, width=(int)16, depth=(int)16, channels=(int)2, rate=(int)48000
+
+ + videosrc + source + always +
video/x-raw-yuv, format=(fourcc)UYVY, width=(int)720, height=(int)486, framerate=(fraction)30000/1001, interlaced=(boolean)true; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)720, height=(int)486, framerate=(fraction)24000/1001, interlaced=(boolean)true; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)720, height=(int)576, framerate=(fraction)25/1, interlaced=(boolean)true; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)24000/1001, interlaced=(boolean)false; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)24/1, interlaced=(boolean)false; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)25/1, interlaced=(boolean)false; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)30000/1001, interlaced=(boolean)false; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlaced=(boolean)false; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)25/1, interlaced=(boolean)true; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)30000/1001, interlaced=(boolean)true; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlaced=(boolean)true; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)1280, height=(int)720, framerate=(fraction)50/1, interlaced=(boolean)true; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)1280, height=(int)720, framerate=(fraction)60000/1001, interlaced=(boolean)true; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)1280, height=(int)720, framerate=(fraction)60/1, interlaced=(boolean)true
+
+
+
+
+
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-dfbvideosink.xml b/docs/plugins/inspect/plugin-dfbvideosink.xml index 390dfbe721..1469567b68 100644 --- a/docs/plugins/inspect/plugin-dfbvideosink.xml +++ b/docs/plugins/inspect/plugin-dfbvideosink.xml @@ -3,7 +3,7 @@ DirectFB video output plugin ../../ext/directfb/.libs/libgstdfbvideosink.so libgstdfbvideosink.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-dirac.xml b/docs/plugins/inspect/plugin-dirac.xml index 0fd1f0522e..6df76dcde6 100644 --- a/docs/plugins/inspect/plugin-dirac.xml +++ b/docs/plugins/inspect/plugin-dirac.xml @@ -3,7 +3,7 @@ Dirac plugin ../../ext/dirac/.libs/libgstdirac.so libgstdirac.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-divxdec.xml b/docs/plugins/inspect/plugin-divxdec.xml new file mode 100644 index 0000000000..d4aa087fe7 --- /dev/null +++ b/docs/plugins/inspect/plugin-divxdec.xml @@ -0,0 +1,34 @@ + + divxdec + DivX decoder + ../../ext/divx/.libs/libgstdivxdec.so + libgstdivxdec.so + 5.03 + unknown + gst-plugins-bad + divx4linux + http://www.divx.com/ + + + divxdec + Divx4linux video decoder + Codec/Decoder/Video + Divx decoder based on divxdecore + Ronald Bultje <rbultje@ronald.bitfreak.net> + + + sink + sink + always +
video/x-divx, divxversion=(int)[ 3, 5 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+ + src + source + always +
video/x-raw-yuv, format=(fourcc){ I420, YUY2, YV12, UYVY }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+
+
+
+
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-divxenc.xml b/docs/plugins/inspect/plugin-divxenc.xml new file mode 100644 index 0000000000..839fd1b83e --- /dev/null +++ b/docs/plugins/inspect/plugin-divxenc.xml @@ -0,0 +1,34 @@ + + divxenc + DivX encoder + ../../ext/divx/.libs/libgstdivxenc.so + libgstdivxenc.so + 5.03 + unknown + gst-plugins-bad + divx4linux + http://www.divx.com/ + + + divxenc + Divx4linux video encoder + Codec/Encoder/Video + Divx encoder based on divxencore + Ronald Bultje <rbultje@ronald.bitfreak.net> + + + sink + sink + always +
video/x-raw-yuv, format=(fourcc){ I420, YUY2, YV12, YVYU, UYVY }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+ + src + source + always +
video/x-divx, divxversion=(int)5, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+
+
+
+
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-dtmf.xml b/docs/plugins/inspect/plugin-dtmf.xml index f44eb4463a..a4d4b34aca 100644 --- a/docs/plugins/inspect/plugin-dtmf.xml +++ b/docs/plugins/inspect/plugin-dtmf.xml @@ -3,7 +3,7 @@ DTMF plugins ../../gst/dtmf/.libs/libgstdtmf.so libgstdtmf.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-dtsdec.xml b/docs/plugins/inspect/plugin-dtsdec.xml index 6b9fb5a00f..f0043c7881 100644 --- a/docs/plugins/inspect/plugin-dtsdec.xml +++ b/docs/plugins/inspect/plugin-dtsdec.xml @@ -3,7 +3,7 @@ Decodes DTS audio streams ../../ext/dts/.libs/libgstdtsdec.so libgstdtsdec.so - 0.10.21.1 + 0.10.19.1 GPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-dvb.xml b/docs/plugins/inspect/plugin-dvb.xml index ade2596295..3f74b7a032 100644 --- a/docs/plugins/inspect/plugin-dvb.xml +++ b/docs/plugins/inspect/plugin-dvb.xml @@ -3,7 +3,7 @@ DVB elements ../../sys/dvb/.libs/libgstdvb.so libgstdvb.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-dvbsuboverlay.xml b/docs/plugins/inspect/plugin-dvbsuboverlay.xml index 2341db7160..30a7068d31 100644 --- a/docs/plugins/inspect/plugin-dvbsuboverlay.xml +++ b/docs/plugins/inspect/plugin-dvbsuboverlay.xml @@ -3,7 +3,7 @@ DVB subtitle renderer ../../gst/dvbsuboverlay/.libs/libgstdvbsuboverlay.so libgstdvbsuboverlay.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-dvdspu.xml b/docs/plugins/inspect/plugin-dvdspu.xml index 17b178fce3..91afbdaaf1 100644 --- a/docs/plugins/inspect/plugin-dvdspu.xml +++ b/docs/plugins/inspect/plugin-dvdspu.xml @@ -3,7 +3,7 @@ DVD Sub-picture Overlay element ../../gst/dvdspu/.libs/libgstdvdspu.so libgstdvdspu.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-faad.xml b/docs/plugins/inspect/plugin-faad.xml index 2854eab4f4..c5d91e1329 100644 --- a/docs/plugins/inspect/plugin-faad.xml +++ b/docs/plugins/inspect/plugin-faad.xml @@ -3,7 +3,7 @@ Free AAC Decoder (FAAD) ../../ext/faad/.libs/libgstfaad.so libgstfaad.so - 0.10.21.1 + 0.10.22.1 GPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-faceoverlay.xml b/docs/plugins/inspect/plugin-faceoverlay.xml new file mode 100644 index 0000000000..cab7839aea --- /dev/null +++ b/docs/plugins/inspect/plugin-faceoverlay.xml @@ -0,0 +1,34 @@ + + faceoverlay + SVG Face Overlay + ../../gst/faceoverlay/.libs/libgstfaceoverlay.so + libgstfaceoverlay.so + 0.10.22.1 + LGPL + gst-plugins-bad + GStreamer + http://gstreamer.net/ + + + faceoverlay + faceoverlay + Filter/Editor/Video + Overlays SVG graphics over a detected face in a video stream + Laura Lucas Alday <lauralucas@gmail.com> + + + sink + sink + always +
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+ + src + source + always +
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+
+
+
+
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-fbdevsink.xml b/docs/plugins/inspect/plugin-fbdevsink.xml index 76ec0e3dff..6544ef5e04 100644 --- a/docs/plugins/inspect/plugin-fbdevsink.xml +++ b/docs/plugins/inspect/plugin-fbdevsink.xml @@ -3,7 +3,7 @@ linux framebuffer video sink ../../sys/fbdev/.libs/libgstfbdevsink.so libgstfbdevsink.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-festival.xml b/docs/plugins/inspect/plugin-festival.xml index 57f5814fde..f793f1315c 100644 --- a/docs/plugins/inspect/plugin-festival.xml +++ b/docs/plugins/inspect/plugin-festival.xml @@ -3,7 +3,7 @@ Synthesizes plain text into audio ../../gst/festival/.libs/libgstfestival.so libgstfestival.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-fieldanalysis.xml b/docs/plugins/inspect/plugin-fieldanalysis.xml new file mode 100644 index 0000000000..185a188813 --- /dev/null +++ b/docs/plugins/inspect/plugin-fieldanalysis.xml @@ -0,0 +1,34 @@ + + fieldanalysis + Video field analysis + ../../gst/fieldanalysis/.libs/libgstfieldanalysis.so + libgstfieldanalysis.so + 0.10.22.1 + LGPL + gst-plugins-bad + GStreamer + http://gstreamer.net/ + + + fieldanalysis + Video field analysis + Filter/Analysis/Video + Analyse fields from video frames to identify if they are progressive/telecined/interlaced + Robert Swain <robert.swain@collabora.co.uk> + + + sink + sink + always +
video/x-raw-yuv, format=(fourcc){ YUY2, UYVY, I420, YV12 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+ + src + source + always +
video/x-raw-yuv, format=(fourcc){ YUY2, UYVY, I420, YV12 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+
+
+
+
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-fragmented.xml b/docs/plugins/inspect/plugin-fragmented.xml new file mode 100644 index 0000000000..1103511e74 --- /dev/null +++ b/docs/plugins/inspect/plugin-fragmented.xml @@ -0,0 +1,35 @@ + + fragmented + Fragmented streaming plugins + ../../gst/hls/.libs/libgstfragmented.so + libgstfragmented.so + 0.10.22.1 + LGPL + gst-plugins-bad + GStreamer Bad Plug-ins + http://www.gstreamer.org/ + + + hlsdemux + HLS Demuxer + Demuxer/URIList + HTTP Live Streaming demuxer + Marc-Andre Lureau <marcandre.lureau@gmail.com> +Andoni Morales Alastruey <ylatuya@gmail.com> + + + sink + sink + always +
application/x-hls
+
+ + src + source + always +
ANY
+
+
+
+
+
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-freeze.xml b/docs/plugins/inspect/plugin-freeze.xml index 90462d08c1..0028326f59 100644 --- a/docs/plugins/inspect/plugin-freeze.xml +++ b/docs/plugins/inspect/plugin-freeze.xml @@ -3,7 +3,7 @@ Stream freezer ../../gst/freeze/.libs/libgstfreeze.so libgstfreeze.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-frei0r.xml b/docs/plugins/inspect/plugin-frei0r.xml index 94f516fb58..ca9f6fe57e 100644 --- a/docs/plugins/inspect/plugin-frei0r.xml +++ b/docs/plugins/inspect/plugin-frei0r.xml @@ -3,1971 +3,11 @@ frei0r plugin library ../../gst/frei0r/.libs/libgstfrei0r.so libgstfrei0r.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git Unknown package origin - - frei0r-filter-3-point-color-balance - 3 point color balance - Filter/Effect/Video - Adjust color balance with 3 color points - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Maksim Golovkin - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-3dflippo - 3dflippo - Filter/Effect/Video - Frame rotation in 3d-space - Sebastian Dröge <sebastian.droege@collabora.co.uk>, c.e. prelz AS FLUIDO <fluido@fluido.as> - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, alpha_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, alpha_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc)AYUV, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, alpha_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, alpha_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc)AYUV, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-b - B - Filter/Effect/Video - Extracts Blue from Image - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Richard Spindler - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-baltan - Baltan - Filter/Effect/Video - delayed alpha smoothed blit of time - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Kentaro, Jaromil - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-bluescreen0r - bluescreen0r - Filter/Effect/Video - Color to alpha (blit SRCALPHA) - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Hedde Bosman - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-brightness - Brightness - Filter/Effect/Video - Adjusts the brightness of a source image - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-bw0r - bw0r - Filter/Effect/Video - Turns image black/white. - Sebastian Dröge <sebastian.droege@collabora.co.uk>, coma@gephex.org - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-cartoon - Cartoon - Filter/Effect/Video - Cartoonify video, do a form of edge detect - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Dries Pruimboom, Jaromil - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-color-distance - Color Distance - Filter/Effect/Video - - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Richard Spindler - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-contrast0r - Contrast0r - Filter/Effect/Video - Adjusts the contrast of a source image - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-curves - Curves - Filter/Effect/Video - Adjust luminance or color channel intensity with curve level mapping - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Maksim Golovkin - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-dealygrab - Dealygrab - Filter/Effect/Video - delayed frame blitting mapped on a time bitmap - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Bill Spinhover, Andreas Schiffler, Jaromil - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-delay0r - delay0r - Filter/Effect/Video - video delay - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Martin Bayer - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-distort0r - Distort0r - Filter/Effect/Video - Plasma - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Gephex crew - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-edgeglow - Edgeglow - Filter/Effect/Video - Edgeglow filter - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Salsaman - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-equaliz0r - Equaliz0r - Filter/Effect/Video - Equalizes the intensity histograms - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal (Drone) - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-flippo - Flippo - Filter/Effect/Video - Flipping in x and y axis - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Carlo Emilio, Jean-Sebastien Senecal - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, alpha_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, alpha_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc)AYUV, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, alpha_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, alpha_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc)AYUV, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-g - G - Filter/Effect/Video - Extracts Green from Image - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Richard Spindler - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-gamma - Gamma - Filter/Effect/Video - Adjusts the gamma value of a source image - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-glow - Glow - Filter/Effect/Video - Creates a Glamorous Glow - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Richard Spindler - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-hueshift0r - Hueshift0r - Filter/Effect/Video - Shifts the hue of a source image - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-invert0r - Invert0r - Filter/Effect/Video - Inverts all colors of a source image - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Gephex crew - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-k-means-clustering - K-Means Clustering - Filter/Effect/Video - Clusters of a source image by color and spatial distance - Sebastian Dröge <sebastian.droege@collabora.co.uk>, binarymillenium - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-lens-correction - Lens Correction - Filter/Effect/Video - Allows compensation of lens distortion - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Richard Spindler - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-letterb0xed - LetterB0xed - Filter/Effect/Video - Adds Black Borders at top and bottom for Cinema Look - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Richard Spindler - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-levels - Levels - Filter/Effect/Video - Adjust luminance or color channel intensity - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Maksim Golovkin - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-luminance - Luminance - Filter/Effect/Video - Creates a luminance map of the image - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Richard Spindler - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-mask0mate - Mask0Mate - Filter/Effect/Video - Creates an square alpha-channel mask - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Richard Spindler - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-nervous - Nervous - Filter/Effect/Video - flushes frames in time in a nervous way - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Tannenbaum, Kentaro, Jaromil - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-nosync0r - nosync0r - Filter/Effect/Video - broken tv - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Martin Bayer - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-perspective - Perspective - Filter/Effect/Video - Distorts the image for a pseudo perspective - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Richard Spindler - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-pixeliz0r - pixeliz0r - Filter/Effect/Video - Pixelize input image. - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Gephex crew - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-primaries - primaries - Filter/Effect/Video - Reduce image to primary colors - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Hedde Bosman - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-r - R - Filter/Effect/Video - Extracts Red from Image - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Richard Spindler - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-rgb-parade - RGB-Parade - Filter/Effect/Video - Displays a histogram of R, G and B of the video-data - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Albert Frisch - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-saturat0r - Saturat0r - Filter/Effect/Video - Adjusts the saturation of a source image - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-scale0tilt - Scale0Tilt - Filter/Effect/Video - Scales, Tilts and Crops an Image - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Richard Spindler - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-scanline0r - scanline0r - Filter/Effect/Video - interlaced blak lines - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Martin Bayer - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-sobel - Sobel - Filter/Effect/Video - Sobel filter - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal (Drone) - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-squareblur - Squareblur - Filter/Effect/Video - Variable-size square blur - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Drone - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-tehroxx0r - TehRoxx0r - Filter/Effect/Video - Something videowall-ish - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Coma - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-threelay0r - threelay0r - Filter/Effect/Video - dynamic 3 level thresholding - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Hedde Bosman - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-threshold0r - Threshold0r - Filter/Effect/Video - Thresholds a source image - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-tint0r - Tint0r - Filter/Effect/Video - Tint a source image with specified color - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Maksim Golovkin - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-transparency - Transparency - Filter/Effect/Video - Tunes the alpha channel. - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Richard Spindler - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-twolay0r - Twolay0r - Filter/Effect/Video - dynamic thresholding - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Martin Bayer - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-vectorscope - Vectorscope - Filter/Effect/Video - Displays the vectorscope of the video-data - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Albert Frisch - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-vertigo - Vertigo - Filter/Effect/Video - alpha blending with zoomed and rotated images - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Fukuchi Kentarou - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-water - Water - Filter/Effect/Video - water drops on a video surface - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jaromil - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-filter-white-balance - White Balance - Filter/Effect/Video - Adjust the white balance / color temperature - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Dan Dennedy - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-addition - addition - Filter/Editor/Video - Perform an RGB[A] addition operation of the pixel sources. - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-alpha-injection - Alpha Injection - Filter/Editor/Video - Averages Input 1 and uses this as Alpha Channel on Input 2 - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Richard Spindler - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-alphaatop - alphaatop - Filter/Editor/Video - the alpha ATOP operation - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-alphain - alphain - Filter/Editor/Video - the alpha IN operation - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-alphaout - alphaout - Filter/Editor/Video - the alpha OUT operation - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-alphaover - alphaover - Filter/Editor/Video - the alpha OVER operation - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-alphaxor - alphaxor - Filter/Editor/Video - the alpha XOR operation - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-blend - blend - Filter/Editor/Video - Perform a blend operation between two sources - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-burn - burn - Filter/Editor/Video - Perform an RGB[A] dodge operation between the pixel sources, using the generalised algorithm: -D = saturation of 255 or depletion of 0, of ((255 - A) * 256) / (B + 1) - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-color-only - color_only - Filter/Editor/Video - Perform a conversion to color only of the source input1 using the hue and saturation values of input2. - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-composition - Composition - Filter/Editor/Video - Composites Image 2 onto Image 1 according to its Alpha Channel - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Richard Spindler - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-darken - darken - Filter/Editor/Video - Perform a darken operation between two sources (minimum value of both sources). - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-difference - difference - Filter/Editor/Video - Perform an RGB[A] difference operation between the pixel sources. - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-divide - divide - Filter/Editor/Video - Perform an RGB[A] divide operation between the pixel sources: input1 is the numerator, input2 the denominator - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-dodge - dodge - Filter/Editor/Video - Perform an RGB[A] dodge operation between the pixel sources, using the generalised algorithm: -D = saturation of 255 or (A * 256) / (256 - B) - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-grain-extract - grain_extract - Filter/Editor/Video - Perform an RGB[A] grain-extract operation between the pixel sources. - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-grain-merge - grain_merge - Filter/Editor/Video - Perform an RGB[A] grain-merge operation between the pixel sources. - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-hardlight - hardlight - Filter/Editor/Video - Perform an RGB[A] hardlight operation between the pixel sources - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-hue - hue - Filter/Editor/Video - Perform a conversion to hue only of the source input1 using the hue of input2. - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-lighten - lighten - Filter/Editor/Video - Perform a lighten operation between two sources (maximum value of both sources). - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-multiply - multiply - Filter/Editor/Video - Perform an RGB[A] multiply operation between the pixel sources. - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-overlay - overlay - Filter/Editor/Video - Perform an RGB[A] overlay operation between the pixel sources, using the generalised algorithm: -D = A * (B + (2 * B) * (255 - A)) - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-rgb - RGB - Filter/Editor/Video - Averages each Input and uses each as R, G or B channel of the Output - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Richard Spindler - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_2 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-saturation - saturation - Filter/Editor/Video - Perform a conversion to saturation only of the source input1 using the saturation level of input2. - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-screen - screen - Filter/Editor/Video - Perform an RGB[A] screen operation between the pixel sources, using the generalised algorithm: -D = 255 - (255 - A) * (255 - B) - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-softlight - softlight - Filter/Editor/Video - Perform an RGB[A] softlight operation between the pixel sources. - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-subtract - subtract - Filter/Editor/Video - Perform an RGB[A] subtract operation of the pixel source input2 from input1. - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-uv-map - UV Map - Filter/Editor/Video - Uses Input 1 as UV Map to distort Input 2 - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Richard Spindler - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-value - value - Filter/Editor/Video - Perform a conversion to value only of the source input1 using the value of input2. - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jean-Sebastien Senecal - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-mixer-xfade0r - xfade0r - Filter/Editor/Video - a simple xfader - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Martin Bayer - - - sink_0 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - sink_1 - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-src-ising0r - Ising0r - Src/Video - Generates ising noise - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Gephex crew - - - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-src-lissajous0r - Lissajous0r - Src/Video - Generates Lissajous0r images - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Martin Bayer - - - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-src-nois0r - Nois0r - Src/Video - Generates white noise images - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Martin Bayer - - - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-src-onecol0r - onecol0r - Src/Video - image with just one color - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Martin Bayer - - - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-src-partik0l - Partik0l - Src/Video - Particles generated on prime number sinusoidal blossoming - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jaromil - - - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
- - frei0r-src-plasma - Plasma - Src/Video - Demo scene 8bit plasma - Sebastian Dröge <sebastian.droege@collabora.co.uk>, Jaromil - - - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, alpha_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-gaudieffects.xml b/docs/plugins/inspect/plugin-gaudieffects.xml index a3c33a5a44..a46a4965f8 100644 --- a/docs/plugins/inspect/plugin-gaudieffects.xml +++ b/docs/plugins/inspect/plugin-gaudieffects.xml @@ -3,7 +3,7 @@ Gaudi video effects. ../../gst/gaudieffects/.libs/libgstgaudieffects.so libgstgaudieffects.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer diff --git a/docs/plugins/inspect/plugin-geometrictransform.xml b/docs/plugins/inspect/plugin-geometrictransform.xml index d03c3057ce..17528fc7fd 100644 --- a/docs/plugins/inspect/plugin-geometrictransform.xml +++ b/docs/plugins/inspect/plugin-geometrictransform.xml @@ -3,7 +3,7 @@ Various geometric image transform elements ../../gst/geometrictransform/.libs/libgstgeometrictransform.so libgstgeometrictransform.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git @@ -77,7 +77,7 @@ fisheye Transform/Effect/Video Split the image into two halves and reflect one over each other - Filippo Argiolas <filippo.argiolas@gmail.com + Filippo Argiolas <filippo.argiolas@gmail.com> sink @@ -140,7 +140,7 @@ mirror Transform/Effect/Video Split the image into two halves and reflect one over each other - Filippo Argiolas <filippo.argiolas@gmail.com + Filippo Argiolas <filippo.argiolas@gmail.com> sink @@ -224,7 +224,7 @@ square Transform/Effect/Video Distort center part of the image into a square - Filippo Argiolas <filippo.argiolas@gmail.com + Filippo Argiolas <filippo.argiolas@gmail.com> sink diff --git a/docs/plugins/inspect/plugin-gmedec.xml b/docs/plugins/inspect/plugin-gmedec.xml index 2d280c8156..38397e53c7 100644 --- a/docs/plugins/inspect/plugin-gmedec.xml +++ b/docs/plugins/inspect/plugin-gmedec.xml @@ -3,7 +3,7 @@ GME Audio Decoder ../../ext/gme/.libs/libgstgme.so libgstgme.so - 0.10.19.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-gsettings.xml b/docs/plugins/inspect/plugin-gsettings.xml index a009c25a28..a80d9b1bfd 100644 --- a/docs/plugins/inspect/plugin-gsettings.xml +++ b/docs/plugins/inspect/plugin-gsettings.xml @@ -3,7 +3,7 @@ GSettings plugin ../../ext/gsettings/.libs/libgstgsettingselements.so libgstgsettingselements.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-gsm.xml b/docs/plugins/inspect/plugin-gsm.xml index f89cfc2f78..209082e371 100644 --- a/docs/plugins/inspect/plugin-gsm.xml +++ b/docs/plugins/inspect/plugin-gsm.xml @@ -3,7 +3,7 @@ GSM encoder/decoder ../../ext/gsm/.libs/libgstgsm.so libgstgsm.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-gstsiren.xml b/docs/plugins/inspect/plugin-gstsiren.xml index bb15abe0f6..95b17fdb9c 100644 --- a/docs/plugins/inspect/plugin-gstsiren.xml +++ b/docs/plugins/inspect/plugin-gstsiren.xml @@ -3,7 +3,7 @@ Siren encoder/decoder/payloader/depayloader plugins ../../gst/siren/.libs/libgstsiren.so libgstsiren.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-h264parse.xml b/docs/plugins/inspect/plugin-h264parse.xml index 3862d7ee93..b3ceeb2c50 100644 --- a/docs/plugins/inspect/plugin-h264parse.xml +++ b/docs/plugins/inspect/plugin-h264parse.xml @@ -3,7 +3,7 @@ Element parsing raw h264 streams ../../gst/h264parse/.libs/libgsth264parse.so libgsth264parse.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-hdvparse.xml b/docs/plugins/inspect/plugin-hdvparse.xml index 2589fb6d9b..ade21ad226 100644 --- a/docs/plugins/inspect/plugin-hdvparse.xml +++ b/docs/plugins/inspect/plugin-hdvparse.xml @@ -3,7 +3,7 @@ HDV private stream parser ../../gst/hdvparse/.libs/libgsthdvparse.so libgsthdvparse.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer diff --git a/docs/plugins/inspect/plugin-id3tag.xml b/docs/plugins/inspect/plugin-id3tag.xml index ce7a2942ce..33f65587a1 100644 --- a/docs/plugins/inspect/plugin-id3tag.xml +++ b/docs/plugins/inspect/plugin-id3tag.xml @@ -3,7 +3,7 @@ ID3 v1 and v2 muxing plugin ../../gst/id3tag/.libs/libgstid3tag.so libgstid3tag.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-interlace.xml b/docs/plugins/inspect/plugin-interlace.xml index d9865ec080..caa1efeb7d 100644 --- a/docs/plugins/inspect/plugin-interlace.xml +++ b/docs/plugins/inspect/plugin-interlace.xml @@ -3,7 +3,7 @@ Create an interlaced video stream ../../gst/interlace/.libs/libgstinterlace.so libgstinterlace.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-invtelecine.xml b/docs/plugins/inspect/plugin-invtelecine.xml index 119cf474ce..7443b48e7a 100644 --- a/docs/plugins/inspect/plugin-invtelecine.xml +++ b/docs/plugins/inspect/plugin-invtelecine.xml @@ -3,7 +3,7 @@ Inverse Telecine ../../gst/invtelecine/.libs/libgstinvtelecine.so libgstinvtelecine.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-ivfparse.xml b/docs/plugins/inspect/plugin-ivfparse.xml index 181f384b4a..a524b5e011 100644 --- a/docs/plugins/inspect/plugin-ivfparse.xml +++ b/docs/plugins/inspect/plugin-ivfparse.xml @@ -3,7 +3,7 @@ IVF parser ../../gst/ivfparse/.libs/libgstivfparse.so libgstivfparse.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-jp2kdecimator.xml b/docs/plugins/inspect/plugin-jp2kdecimator.xml index 1f0e7fdc2c..b1fbd20d98 100644 --- a/docs/plugins/inspect/plugin-jp2kdecimator.xml +++ b/docs/plugins/inspect/plugin-jp2kdecimator.xml @@ -3,7 +3,7 @@ JPEG2000 decimator ../../gst/jp2kdecimator/.libs/libgstjp2kdecimator.so libgstjp2kdecimator.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-jpegformat.xml b/docs/plugins/inspect/plugin-jpegformat.xml index d802193df2..e995673317 100644 --- a/docs/plugins/inspect/plugin-jpegformat.xml +++ b/docs/plugins/inspect/plugin-jpegformat.xml @@ -3,7 +3,7 @@ JPEG interchange format plugin ../../gst/jpegformat/.libs/libgstjpegformat.so libgstjpegformat.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git @@ -12,7 +12,7 @@ jifmux JPEG stream muxer - Video/Muxer + Video/Formatter Remuxes JPEG images with markers and tags Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> diff --git a/docs/plugins/inspect/plugin-kate.xml b/docs/plugins/inspect/plugin-kate.xml index 60db3590f7..1ff9aabbf8 100644 --- a/docs/plugins/inspect/plugin-kate.xml +++ b/docs/plugins/inspect/plugin-kate.xml @@ -3,7 +3,7 @@ Kate plugin ../../ext/kate/.libs/libgstkate.so libgstkate.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git @@ -93,32 +93,5 @@
- - tiger - Kate stream renderer - Mixer/Video/Overlay/Subtitle - Decodes and renders Kate streams on top of a video - Vincent Penquerc'h <ogg.k.ogg.k@googlemail.com> - - - subtitle_sink - sink - always -
subtitle/x-kate; application/x-kate
-
- - video_sink - sink - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)1234, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)1234, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-ladspa.xml b/docs/plugins/inspect/plugin-ladspa.xml index c9511b7e07..1863ee22c2 100644 --- a/docs/plugins/inspect/plugin-ladspa.xml +++ b/docs/plugins/inspect/plugin-ladspa.xml @@ -3,12 +3,1470 @@ All LADSPA plugins ../../ext/ladspa/.libs/libgstladspa.so libgstladspa.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git Unknown package origin + + ladspa-AWfilt + A-weighting filter + Filter/Effect/Audio/LADSPA + A-weighting filter + Fons Adriaensen <fons.adriaensen@skynet.be> + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Accumulate + spectral accumulator + Filter/Effect/Audio/LADSPA + spectral accumulator + Richard Dobson, Trevor Wishart, Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Ambisonics-11-cube-decoder + AMB order 1,1 cube decoder + Filter/Effect/Audio/LADSPA + AMB order 1,1 cube decoder + Fons Adriaensen <fons@kokkinizita.net> + + + In-W + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-X + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Y + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Z + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-DLB + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-DLF + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-DRB + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-DRF + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-ULB + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-ULF + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-URB + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-URF + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Ambisonics-11-hexagon-decoder + AMB order 1,1 hexagon decoder + Filter/Effect/Audio/LADSPA + AMB order 1,1 hexagon decoder + Fons Adriaensen <fons@kokkinizita.net> + + + In-W + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-X + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Y + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Z + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-L-LF + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-LB-LB + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-LF-F + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-R-RB + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-RB-B + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-RF-RF + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Ambisonics-11-mono-panner + AMB order 1,1 mono panner + Filter/Effect/Audio/LADSPA + AMB order 1,1 mono panner + Fons Adriaensen <fons@kokkinizita.net> + + + In + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-W + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-X + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Y + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Z + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Ambisonics-11-rotator + AMB order 1,1 rotator + Filter/Effect/Audio/LADSPA + AMB order 1,1 rotator + Fons Adriaensen <fons@kokkinizita.net> + + + In-W + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-X + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Y + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Z + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-W + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-X + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Y + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Z + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Ambisonics-11-square-decoder + AMB order 1,1 square decoder + Filter/Effect/Audio/LADSPA + AMB order 1,1 square decoder + Fons Adriaensen <fons@kokkinizita.net> + + + In-W + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-X + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Y + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Z + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-LB-L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-LF-F + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-RB-B + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-RF-R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Ambisonics-11-stereo-panner + AMB order 1,1 stereo panner + Filter/Effect/Audio/LADSPA + AMB order 1,1 stereo panner + Fons Adriaensen <fons@kokkinizita.net> + + + In-L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-W + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-X + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Y + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Z + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Ambisonics-21-panner + AMB order 2,1 panner + Filter/Effect/Audio/LADSPA + AMB order 2,1 panner + Fons Adriaensen <fons@kokkinizita.net> + + + In + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-U + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-V + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-W + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-X + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Y + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Z + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Ambisonics-21-rotator + AMB order 2,1 rotator + Filter/Effect/Audio/LADSPA + AMB order 2,1 rotator + Fons Adriaensen <fons@kokkinizita.net> + + + In-U + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-V + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-W + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-X + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Y + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Z + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-U + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-V + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-W + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-X + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Y + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Z + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Ambisonics-22-panner + AMB order 2,2 panner + Filter/Effect/Audio/LADSPA + AMB order 2,2 panner + Fons Adriaensen <fons@kokkinizita.net> + + + In + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-S + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-T + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-U + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-V + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-W + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-X + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Y + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Z + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Ambisonics-22-rotator + AMB order 2,2 rotator + Filter/Effect/Audio/LADSPA + AMB order 2,2 rotator + Fons Adriaensen <fons@kokkinizita.net> + + + In-R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-S + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-T + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-U + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-V + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-W + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-X + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Y + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Z + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-S + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-T + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-U + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-V + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-W + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-X + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Y + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Z + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Ambisonics-31-panner + AMB order 3,1 panner + Filter/Effect/Audio/LADSPA + AMB order 3,1 panner + Joern Nettingsmeier <nettings@stackingdwarves.net> + + + In + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + OUT-P + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + OUT-Q + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-U + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-V + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-W + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-X + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Y + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Z + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Ambisonics-31-rotator + AMB order 3,1 rotator + Filter/Effect/Audio/LADSPA + AMB order 3,1 rotator + Joern Nettingsmeier <nettings@stackingdwarves.net> + + + In-P + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Q + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-U + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-V + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-W + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-X + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Y + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Z + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-P + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Q + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-U + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-V + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-W + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-X + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Y + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Z + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Ambisonics-33-panner + AMB order 3,3 panner + Filter/Effect/Audio/LADSPA + AMB order 3,3 panner + Joern Nettingsmeier <nettings@stackingdwarves.net> + + + In + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-K + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-M + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-N + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-O + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-P + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Q + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-S + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-T + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-U + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-V + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-W + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-X + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Y + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Z + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Ambisonics-33-rotator + AMB order 3,3 rotator + Filter/Effect/Audio/LADSPA + AMB order 3,3 rotator + Joern Nettingsmeier <nettings@stackingdwarves.net> + + + In-K + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-M + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-N + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-O + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-P + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Q + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-S + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-T + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-U + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-V + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-W + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-X + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Y + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Z + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-K + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-M + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-N + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-O + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-P + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Q + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-S + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-T + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-U + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-V + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-W + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-X + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Y + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Z + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-AmpIII + C* AmpIII - Tube amp + Filter/Effect/Audio/LADSPA + C* AmpIII - Tube amp + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-AmpIV + C* AmpIV - Tube amp + tone controls + Filter/Effect/Audio/LADSPA + C* AmpIV - Tube amp + tone controls + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-AmpV + C* AmpV - Tube amp + Filter/Effect/Audio/LADSPA + C* AmpV - Tube amp + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-AmpVTS + C* AmpVTS - Tube amp + Tone stack + Filter/Effect/Audio/LADSPA + C* AmpVTS - Tube amp + Tone stack + David Yeh <dtyeh@ccrma.stanford.edu> & Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-AutoWah + C* AutoWah - Resonant envelope-following filter + Filter/Effect/Audio/LADSPA + C* AutoWah - Resonant envelope-following filter + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-BassEnhancer + Calf Bass Enhancer LADSPA + Filter/Effect/Audio/LADSPA + Calf Bass Enhancer LADSPA + Markus Schmidt / Krzysztof Foltman + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-BoosterM + Clipping Booster (mono) + Filter/Effect/Audio/LADSPA + Clipping Booster (mono) + Artemiy Pavlov + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-BoosterS + Clipping Booster (stereo) + Filter/Effect/Audio/LADSPA + Clipping Booster (stereo) + Artemiy Pavlov + + + Input_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-CEO + C* CEO - Chief Executive Oscillator + Source/Audio/LADSPA + C* CEO - Chief Executive Oscillator + Tim Goetze <tim@quitte.de> + + + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-CVFreq + CV to Frequency convertor + Filter/Effect/Audio/LADSPA + CV to Frequency convertor + Joost Yervante Damad + + + Freq_-CV- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Freq_-Hz- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-CabinetI + C* CabinetI - Loudspeaker cabinet emulation + Filter/Effect/Audio/LADSPA + C* CabinetI - Loudspeaker cabinet emulation + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-CabinetII + C* CabinetII - Refined loudspeaker cabinet emulation + Filter/Effect/Audio/LADSPA + C* CabinetII - Refined loudspeaker cabinet emulation + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-Chorus1 Chorus1 - Based on CSound orchestra by Sean Costello @@ -30,6 +1488,39 @@ + + ladspa-Chorus1-2x2 + LEET Chorus1_2x2 - 2x2 by Dan Lyons - Based on MCP Chorus by F. Adriaensen + Filter/Effect/Audio/LADSPA + LEET Chorus1_2x2 - 2x2 by Dan Lyons - Based on MCP Chorus by F. Adriaensen + Dan Lyons <socal_dan2000@yahoo.com> + + + Input_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-Chorus2 Chorus2 - Based on CSound orchestra by Sean Costello @@ -51,6 +1542,492 @@ + + ladspa-ChorusI + C* ChorusI - Mono chorus/flanger + Filter/Effect/Audio/LADSPA + C* ChorusI - Mono chorus/flanger + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-ChorusII + C* ChorusII - Mono chorus/flanger modulated by a fractal + Filter/Effect/Audio/LADSPA + C* ChorusII - Mono chorus/flanger modulated by a fractal + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Click + C* Click - Metronome + Source/Audio/LADSPA + C* Click - Metronome + Tim Goetze <tim@quitte.de> + + + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Clip + C* Clip - Hard clipper, 8x oversampled + Filter/Effect/Audio/LADSPA + C* Clip - Hard clipper, 8x oversampled + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Compress + C* Compress - Mono compressor + Filter/Effect/Audio/LADSPA + C* Compress - Mono compressor + Tim Goetze <tim@quitte.de>, Steve Harris <steve@plugin.org.uk> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Compressor + Calf Compressor LADSPA + Filter/Effect/Audio/LADSPA + Calf Compressor LADSPA + Thor Harald Johansen + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Deesser + Calf Deesser LADSPA + Filter/Effect/Audio/LADSPA + Calf Deesser LADSPA + Markus Schmidt / Thor Harald Johansen + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Dirac + C* Dirac - One-sample impulse generator + Source/Audio/LADSPA + C* Dirac - One-sample impulse generator + Tim Goetze <tim@quitte.de> + + + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Eq + C* Eq - 10-band equalizer + Filter/Effect/Audio/LADSPA + C* Eq - 10-band equalizer + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Eq2x2 + C* Eq2x2 - stereo 10-band equalizer + Filter/Effect/Audio/LADSPA + C* Eq2x2 - stereo 10-band equalizer + Tim Goetze <tim@quitte.de> + + + in-l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in-r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out-l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out-r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Equalizer12Band + Calf Equalizer 12 Band LADSPA + Filter/Effect/Audio/LADSPA + Calf Equalizer 12 Band LADSPA + Markus Schmidt + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Equalizer5Band + Calf Equalizer 5 Band LADSPA + Filter/Effect/Audio/LADSPA + Calf Equalizer 5 Band LADSPA + Markus Schmidt + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Equalizer8Band + Calf Equalizer 8 Band LADSPA + Filter/Effect/Audio/LADSPA + Calf Equalizer 8 Band LADSPA + Markus Schmidt + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Exaggerate + spectral exaggerator + Filter/Effect/Audio/LADSPA + spectral exaggerator + Richard Dobson, Trevor Wishart, Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Exciter + Calf Exciter LADSPA + Filter/Effect/Audio/LADSPA + Calf Exciter LADSPA + Markus Schmidt / Krzysztof Foltman + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Filter + Calf Filter LADSPA + Filter/Effect/Audio/LADSPA + Calf Filter LADSPA + Krzysztof Foltman + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Filterclavier + Calf Filterclavier LADSPA + Filter/Effect/Audio/LADSPA + Calf Filterclavier LADSPA + Krzysztof Foltman / Hans Baier + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Flanger + Calf Flanger LADSPA + Filter/Effect/Audio/LADSPA + Calf Flanger LADSPA + Krzysztof Foltman + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-G2reverb Stereo reverb @@ -84,6 +2061,246 @@ + + ladspa-Gate + Calf Gate LADSPA + Filter/Effect/Audio/LADSPA + Calf Gate LADSPA + Damien Zammit / Thor Harald Johansen + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-HRTF + C* HRTF - Head-related transfer function at elevation 0 + Filter/Effect/Audio/LADSPA + C* HRTF - Head-related transfer function at elevation 0 + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out-l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out-r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-JVRev + C* JVRev - Stanford-style reverb from STK + Filter/Effect/Audio/LADSPA + C* JVRev - Stanford-style reverb from STK + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out-l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out-r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Lorenz + C* Lorenz - The sound of a Lorenz attractor + Source/Audio/LADSPA + C* Lorenz - The sound of a Lorenz attractor + Tim Goetze <tim@quitte.de> + + + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-MUSIC + MUSIC channel + Filter/Effect/Audio/LADSPA + MUSIC channel + Joost Yervante Damad + + + Freq_-Hz- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Gate + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-MUSICDrum + MUSIC Drum instruments + Filter/Effect/Audio/LADSPA + MUSIC Drum instruments + Joost Yervante Damad + + + Gate_Bass_Drum + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Gate_High-Hat + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Gate_Snare_Drum + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Gate_Tom-Tom + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Gate_Top_Cymbal + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-MultiChorus + Calf MultiChorus LADSPA + Filter/Effect/Audio/LADSPA + Calf MultiChorus LADSPA + Krzysztof Foltman + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Multibandcompressor + Calf Multiband Compressor LADSPA + Filter/Effect/Audio/LADSPA + Calf Multiband Compressor LADSPA + Markus Schmidt / Thor Harald Johansen + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-Mvchpf-1 Mvchpf-1 Digital implementation of the VC HP filter invented by R.A. Moog @@ -273,6 +2490,168 @@ + + ladspa-NoisifierM + Noisifier (mono) + Filter/Effect/Audio/LADSPA + Noisifier (mono) + Artemiy Pavlov + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-NoisifierS + Noisifier (stereo) + Filter/Effect/Audio/LADSPA + Noisifier (stereo) + Artemiy Pavlov + + + Input_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-PSG + PSG channel + Filter/Effect/Audio/LADSPA + PSG channel + Joost Yervante Damad + + + Freq_-Hz- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Gate + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Pan + C* Pan - Pan and width + Filter/Effect/Audio/LADSPA + C* Pan - Pan and width + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out-l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out-r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Parametric1 + 4-band parametric filter + Filter/Effect/Audio/LADSPA + 4-band parametric filter + Fons Adriaensen <fons@kokkinizita.net> + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Phaser + Calf Phaser LADSPA + Filter/Effect/Audio/LADSPA + Calf Phaser LADSPA + Krzysztof Foltman + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-Phaser1 Phaser1 - Similar to CSound's phaser1 by Sean Costello @@ -333,6 +2712,972 @@ + + ladspa-PhaserI + C* PhaserI - Mono phaser + Filter/Effect/Audio/LADSPA + C* PhaserI - Mono phaser + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-PhaserII + C* PhaserII - Mono phaser modulated by a Lorenz fractal + Filter/Effect/Audio/LADSPA + C* PhaserII - Mono phaser modulated by a Lorenz fractal + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Plate + C* Plate - Versatile plate reverb + Filter/Effect/Audio/LADSPA + C* Plate - Versatile plate reverb + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out-l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out-r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Plate2x2 + C* Plate2x2 - Versatile plate reverb, stereo inputs + Filter/Effect/Audio/LADSPA + C* Plate2x2 - Versatile plate reverb, stereo inputs + Tim Goetze <tim@quitte.de> + + + in-l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in-r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out-l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out-r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-PreampIII + C* PreampIII - Tube preamp emulation + Filter/Effect/Audio/LADSPA + C* PreampIII - Tube preamp emulation + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-PreampIV + C* PreampIV - Tube preamp emulation + tone controls + Filter/Effect/Audio/LADSPA + C* PreampIV - Tube preamp emulation + tone controls + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Pulsator + Calf Pulsator LADSPA + Filter/Effect/Audio/LADSPA + Calf Pulsator LADSPA + Markus Schmidt + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Pulse-VCO + Pulse-VCO -- Anti-aliased oscillator + Filter/Effect/Audio/LADSPA + Pulse-VCO -- Anti-aliased oscillator + Fons Adriaensen <fons.adriaensen@alcatel.be> + + + Exp_FM + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Frequency + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Lin_FM + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Rec-VCO + Rec-VCO -- Anti-aliased oscillator + Filter/Effect/Audio/LADSPA + Rec-VCO -- Anti-aliased oscillator + Fons Adriaensen <fons.adriaensen@alcatel.be> + + + Exp_FM + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Frequency + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Lin_FM + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Mod + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Sync + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Reverb + Calf Reverb LADSPA + Filter/Effect/Audio/LADSPA + Calf Reverb LADSPA + Krzysztof Foltman + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Roessler + C* Roessler - The sound of a Roessler attractor + Source/Audio/LADSPA + C* Roessler - The sound of a Roessler attractor + Tim Goetze <tim@quitte.de> + + + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-RotarySpeaker + Calf Rotary Speaker LADSPA + Filter/Effect/Audio/LADSPA + Calf Rotary Speaker LADSPA + Krzysztof Foltman + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-SCC + SCC channel + Filter/Effect/Audio/LADSPA + SCC channel + Joost Yervante Damad + + + Freq_-Hz- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-SID + SID chip + Filter/Effect/Audio/LADSPA + SID chip + Joost Yervante Damad + + + Freq_-Hz-_1 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Freq_-Hz-_2 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Freq_-Hz-_3 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Gate_1 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Gate_2 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Gate_3 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Saturator + Calf Saturator LADSPA + Filter/Effect/Audio/LADSPA + Calf Saturator LADSPA + Markus Schmidt / Krzysztof Foltman + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Saw-VCO + Saw-VCO -- Anti-aliased oscillator + Filter/Effect/Audio/LADSPA + Saw-VCO -- Anti-aliased oscillator + Fons Adriaensen <fons.adriaensen@alcatel.be> + + + Exp_FM + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Frequency + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Lin_FM + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Sync + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Scape + C* Scape - Stereo delay + Filters + Filter/Effect/Audio/LADSPA + C* Scape - Stereo delay + Filters + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out-l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out-r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Sidechaincompressor + Calf Sidechain Compressor LADSPA + Filter/Effect/Audio/LADSPA + Calf Sidechain Compressor LADSPA + Markus Schmidt / Thor Harald Johansen + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Sidechaingate + Calf Sidechain Gate LADSPA + Filter/Effect/Audio/LADSPA + Calf Sidechain Gate LADSPA + Markus Schmidt / Damien Zammit / Thor Harald Johansen + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Sin + C* Sin - Sine wave generator + Source/Audio/LADSPA + C* Sin - Sine wave generator + Tim Goetze <tim@quitte.de> + + + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-SooperLooper + SooperLooper + Filter/Effect/Audio/LADSPA + SooperLooper + Jesse Chappell + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-StereoChorusI + C* StereoChorusI - Stereo chorus/flanger + Filter/Effect/Audio/LADSPA + C* StereoChorusI - Stereo chorus/flanger + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out-l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out-r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-StereoChorusII + C* StereoChorusII - Stereo chorus/flanger modulated by a fractal + Filter/Effect/Audio/LADSPA + C* StereoChorusII - Stereo chorus/flanger modulated by a fractal + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out-l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out-r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-SweepVFI + C* SweepVFI - Resonant filter swept by a Lorenz fractal + Filter/Effect/Audio/LADSPA + C* SweepVFI - Resonant filter swept by a Lorenz fractal + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-SweepVFII + C* SweepVFII - Resonant filter, f and Q swept by a Lorenz fractal + Filter/Effect/Audio/LADSPA + C* SweepVFII - Resonant filter, f and Q swept by a Lorenz fractal + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Sync-Rect-VCO + Sync-Rect-VCO -- Hard-sync-capable anti-aliased oscillator + Filter/Effect/Audio/LADSPA + Sync-Rect-VCO -- Hard-sync-capable anti-aliased oscillator + Sean Bolton <musound AT jps DOT net> + + + Exp_FM + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Frequency + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Lin_FM + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Sync_In + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Wave_Mod + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Sync_Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Sync-Saw-VCO + Sync-Saw-VCO -- Hard-sync-capable anti-aliased oscillator + Filter/Effect/Audio/LADSPA + Sync-Saw-VCO -- Hard-sync-capable anti-aliased oscillator + Sean Bolton <musound AT jps DOT net> + + + Exp_FM + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Frequency + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Lin_FM + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Sync_In + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Sync_Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Sync-Tri-VCO + Sync-Tri-VCO -- Hard-sync-capable anti-aliased oscillator + Filter/Effect/Audio/LADSPA + Sync-Tri-VCO -- Hard-sync-capable anti-aliased oscillator + Sean Bolton <musound AT jps DOT net> + + + Exp_FM + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Frequency + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Lin_FM + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Sync_In + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Wave_Mod + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Sync_Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-ToneStack + C* ToneStack - Tone stack emulation + Filter/Effect/Audio/LADSPA + C* ToneStack - Tone stack emulation + David Yeh <dtyeh@ccrma.stanford.edu> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-ToneStackLT + C* ToneStackLT - Tone stack emulation, lattice filter 44.1 + Filter/Effect/Audio/LADSPA + C* ToneStackLT - Tone stack emulation, lattice filter 44.1 + David Yeh <dtyeh@ccrma.stanford.edu> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Transpose + phase-vocoder based pitch shifter + Filter/Effect/Audio/LADSPA + phase-vocoder based pitch shifter + Richard Dobson, Trevor Wishart, Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Tricardioid-to-AMB + Three cardioids to AMB matrix + Filter/Effect/Audio/LADSPA + Three cardioids to AMB matrix + Fons Adriaensen <fons@kokkinizita.net> + + + In-B + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-W + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-X + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Y + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-Z + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-TripleChorus Triple chorus @@ -366,6 +3711,327 @@ + + ladspa-VCOd + C* VCOd - Double VCO with detune and hard sync options + Source/Audio/LADSPA + C* VCOd - Double VCO with detune and hard sync options + Tim Goetze <tim@quitte.de> + + + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-VCOs + C* VCOs - Virtual 'analogue' oscillator + Source/Audio/LADSPA + C* VCOs - Virtual 'analogue' oscillator + Tim Goetze <tim@quitte.de> + + + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-VariNoiseM + Variable Noise (mono) + Source/Audio/LADSPA + Variable Noise (mono) + Artemiy Pavlov + + + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-VariNoiseS + Variable Noise (stereo) + Source/Audio/LADSPA + Variable Noise (stereo) + Artemiy Pavlov + + + Output_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-VintageDelay + Calf Vintage Delay LADSPA + Filter/Effect/Audio/LADSPA + Calf Vintage Delay LADSPA + Krzysztof Foltman + + + In_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-Virtualmic + Virtual stereo microphone + Filter/Effect/Audio/LADSPA + Virtual stereo microphone + Fons Adriaensen <fons@kokkinizita.net> + + + In-W + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-X + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Y + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In-Z + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out-R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-White + C* White - White noise generator + Source/Audio/LADSPA + C* White - White noise generator + Tim Goetze <tim@quitte.de> + + + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-XShaperM + X-Shaper (mono) + Filter/Effect/Audio/LADSPA + X-Shaper (mono) + Artemiy Pavlov + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-XShaperS + X-Shaper (stereo) + Filter/Effect/Audio/LADSPA + X-Shaper (stereo) + Artemiy Pavlov + + + Input_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-adenv + Percussive AD Envelope + Filter/Effect/Audio/LADSPA + Percussive AD Envelope + Loki Davison <ltdav1[at]student.monash.edu.au> + + + Gate + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Trigger + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Envelope_Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-adenv-lvl + Percussive AD Envelope with levels + Filter/Effect/Audio/LADSPA + Percussive AD Envelope with levels + Loki Davison <ltdav1[at]student.monash.edu.au> + + + Gate + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Reset_Level + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Trigger + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Envelope_Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-adsr + ADSR Envelope + Filter/Effect/Audio/LADSPA + ADSR Envelope + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Driving_Signal + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Envelope_Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-adsr-g+t + ADSR Envelope with Gate and Trigger + Filter/Effect/Audio/LADSPA + ADSR Envelope with Gate and Trigger + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Gate + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Trigger + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Envelope_Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-alias Aliasing @@ -387,6 +4053,60 @@ + + ladspa-alienwah-mono + AlienWah for mono + Filter/Effect/Audio/LADSPA + AlienWah for mono + Plugin: Paul<set@pobox.com> Effect: Nasca O. Paul<paulnasca@yahoo.com> + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-alienwah-stereo + AlienWah for stereo + Filter/Effect/Audio/LADSPA + AlienWah for stereo + Plugin: Paul<set@pobox.com> Effect: Nasca O. Paul<paulnasca@yahoo.com> + + + Input1 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input2 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output1 + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output2 + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-allpass-c Allpass delay line, cubic spline interpolation @@ -450,6 +4170,33 @@ + + ladspa-am + Amplitude Modulator + Filter/Effect/Audio/LADSPA + Amplitude Modulator + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input_1 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_2 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-amPitchshift AM pitchshifter @@ -493,11 +4240,59 @@ - ladspa-amp-mono - Mono Amplifier + ladspa-amp-gaia-oa + Amplifier (GAIA) Filter/Effect/Audio/LADSPA - Mono Amplifier - Richard Furse (LADSPA example plugins) + Amplifier (GAIA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Gain_-dB- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-amp-gcia-oa + Amplifier (GCIA) + Filter/Effect/Audio/LADSPA + Amplifier (GCIA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-amp-mono + Amplifier (Mono) + Filter/Effect/Audio/LADSPA + Amplifier (Mono) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) Input @@ -515,10 +4310,10 @@ ladspa-amp-stereo - Stereo Amplifier + Amplifier (Stereo) Filter/Effect/Audio/LADSPA - Stereo Amplifier - Richard Furse (LADSPA example plugins) + Amplifier (Stereo) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) Input_-Left- @@ -546,6 +4341,21 @@ + + ladspa-analogue + Analogue Voice + Source/Audio/LADSPA + Analogue Voice + CMT (http://www.ladspa.org/cmt, plugin by David A. Bartold) + + + Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-analogueOsc Analogue Oscillator @@ -645,6 +4455,246 @@ + + ladspa-bf-rotate-z + Ambisonic Rotation (B-Format, Horizontal) + Filter/Effect/Audio/LADSPA + Ambisonic Rotation (B-Format, Horizontal) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input_-W- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-X- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-Y- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-Z- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-W- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-X- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Y- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Z- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-bf2cube + Ambisonic Decoder (B-Format to Cube) + Filter/Effect/Audio/LADSPA + Ambisonic Decoder (B-Format to Cube) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input_-W- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-X- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-Y- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-Z- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Base_Back_Left- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Base_Back_Right- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Base_Front_Left- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Base_Front_Right- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Top_Back_Left- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Top_Back_Right- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Top_Front_Left- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Top_Front_Right- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-bf2quad + Ambisonic Decoder (B-Format to Quad) + Filter/Effect/Audio/LADSPA + Ambisonic Decoder (B-Format to Quad) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input_-W- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-X- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-Y- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-Z- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Back_Left- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Back_Right- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Front_Left- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Front_Right- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-bf2stereo + Ambisonic Decoder (B-Format to Stereo) + Filter/Effect/Audio/LADSPA + Ambisonic Decoder (B-Format to Stereo) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input_-W- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-X- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-Y- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-Z- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Left- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Right- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-bodeShifter Bode frequency shifter @@ -711,6 +4761,42 @@ + + ladspa-branch-ia-oaoa + Signal Branch (IA) + Filter/Effect/Audio/LADSPA + Signal Branch (IA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + First_Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Second_Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-branch-ic-ococ + Signal Branch (IC) + Source/Audio/LADSPA + Signal Branch (IC) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + ladspa-butthigh-iir GLAME Butterworth Highpass @@ -780,6 +4866,39 @@ + + ladspa-canyon-delay + Canyon Delay + Filter/Effect/Audio/LADSPA + Canyon Delay + CMT (http://www.ladspa.org/cmt, plugin by David A. Bartold) + + + In_-Left- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_-Right- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_-Left- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_-Right- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-chebstortion Chebyshev distortion @@ -801,6 +4920,27 @@ + + ladspa-clipper + hard clipper (no antialiasing) + Filter/Effect/Audio/LADSPA + hard clipper (no antialiasing) + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-comb Comb Filter @@ -912,6 +5052,132 @@ + + ladspa-comp-aa + Comparison (AA) + Filter/Effect/Audio/LADSPA + Comparison (AA) + Thorsten Wilms + + + A + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + B + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + A_=_B + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + A_>_B + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Larger + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Smaller + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-comp-ac + Comparison (AC) + Filter/Effect/Audio/LADSPA + Comparison (AC) + Thorsten Wilms + + + A + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + A_=_B + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + A_>_B + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Larger + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Smaller + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-compress-peak + Simple Compressor (Peak Envelope Tracking) + Filter/Effect/Audio/LADSPA + Simple Compressor (Peak Envelope Tracking) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-compress-rms + Simple Compressor (RMS Envelope Tracking) + Filter/Effect/Audio/LADSPA + Simple Compressor (RMS Envelope Tracking) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-const Constant Signal Generator @@ -954,6 +5220,165 @@ + + ladspa-dahdsr-cg+t-control + DAHDSR Envelope with Control Gate and Trigger (Control Inputs) + Source/Audio/LADSPA + DAHDSR Envelope with Control Gate and Trigger (Control Inputs) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Envelope_Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-dahdsr-fexp + DAHDSR Envelope full exp, adr + Filter/Effect/Audio/LADSPA + DAHDSR Envelope full exp, adr + Loki Davison <ltdav1[at]student.monash.edu.au> + + + Gate + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Trigger + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Envelope_Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-dahdsr-g+t-audio + DAHDSR Envelope with Gate and Trigger (Audio-Rate Inputs) + Filter/Effect/Audio/LADSPA + DAHDSR Envelope with Gate and Trigger (Audio-Rate Inputs) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Attack_Time_-s- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Decay_Time_-s- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Delay_Time_-s- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Gate + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Hold_Time_-s- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Release_Time_-s- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Sustain_Level + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Trigger + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Envelope_Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-dahdsr-g+t-control + DAHDSR Envelope with Gate and Trigger (Control Inputs) + Filter/Effect/Audio/LADSPA + DAHDSR Envelope with Gate and Trigger (Control Inputs) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Gate + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Trigger + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Envelope_Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-dahdsr-hexp + DAHDSR Envelope linear attack exp dr + Filter/Effect/Audio/LADSPA + DAHDSR Envelope linear attack exp dr + Loki Davison <ltdav1[at]student.monash.edu.au> + + + Gate + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Trigger + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Envelope_Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-dcRemove DC Offset Remover @@ -1038,6 +5463,69 @@ + + ladspa-delay-0-01s + Echo Delay Line (Maximum Delay 0.01s) + Filter/Effect/Audio/LADSPA + Echo Delay Line (Maximum Delay 0.01s) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-delay-0-1s + Echo Delay Line (Maximum Delay 0.1s) + Filter/Effect/Audio/LADSPA + Echo Delay Line (Maximum Delay 0.1s) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-delay-1s + Echo Delay Line (Maximum Delay 1s) + Filter/Effect/Audio/LADSPA + Echo Delay Line (Maximum Delay 1s) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-delay-5s Simple Delay Line @@ -1059,6 +5547,27 @@ + + ladspa-delay-60s + Echo Delay Line (Maximum Delay 60s) + Filter/Effect/Audio/LADSPA + Echo Delay Line (Maximum Delay 60s) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-delay-c Simple delay line, cubic spline interpolation @@ -1143,6 +5652,84 @@ + + ladspa-difference-iama-oa + Signal Difference (IAMA) + Filter/Effect/Audio/LADSPA + Signal Difference (IAMA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_to_Subtract + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Difference_Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-difference-iamc-oa + Signal Difference (IAMC) + Filter/Effect/Audio/LADSPA + Signal Difference (IAMC) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Difference_Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-difference-icma-oa + Signal Difference (ICMA) + Filter/Effect/Audio/LADSPA + Signal Difference (ICMA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Input_to_Subtract + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Difference_Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-difference-icmc-oc + Signal Difference (ICMC) + Source/Audio/LADSPA + Signal Difference (ICMC) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + ladspa-diode Diode Processor @@ -1164,6 +5751,27 @@ + + ladspa-disintegrator + Disintegrator + Filter/Effect/Audio/LADSPA + Disintegrator + CMT (http://www.ladspa.org/cmt, plugin by Nathaniel Virgo) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-divider Audio Divider (Suboctave Generator) @@ -1281,6 +5889,177 @@ + + ladspa-eir + Experiments in Representation + Filter/Effect/Audio/LADSPA + Experiments in Representation + Nick Lamb <njl195@zepler.org.uk> + + + Intput + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-encode-bformat + Ambisonic Encoder (B-Format) + Filter/Effect/Audio/LADSPA + Ambisonic Encoder (B-Format) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-W- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-X- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Y- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Z- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-encode-fmh + Ambisonic Encoder (FMH-Format) + Filter/Effect/Audio/LADSPA + Ambisonic Encoder (FMH-Format) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-R- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-S- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-T- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-U- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-V- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-W- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-X- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Y- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Z- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-expand-peak + Simple Expander (Peak Envelope Tracking) + Filter/Effect/Audio/LADSPA + Simple Expander (Peak Envelope Tracking) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-expand-rms + Simple Expander (RMS Envelope Tracking) + Filter/Effect/Audio/LADSPA + Simple Expander (RMS Envelope Tracking) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-fadDelay Fractionally Addressed Delay Line @@ -1302,6 +6081,39 @@ + + ladspa-fast-xfade + Fast Crossfade + Filter/Effect/Audio/LADSPA + Fast Crossfade + Thorsten Wilms + + + A + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + B + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Level + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-fastLookaheadLimiter Fast Lookahead limiter @@ -1335,6 +6147,111 @@ + + ladspa-fbdelay-0-01s + Feedback Delay Line (Maximum Delay 0.01s) + Filter/Effect/Audio/LADSPA + Feedback Delay Line (Maximum Delay 0.01s) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-fbdelay-0-1s + Feedback Delay Line (Maximum Delay 0.1s) + Filter/Effect/Audio/LADSPA + Feedback Delay Line (Maximum Delay 0.1s) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-fbdelay-1s + Feedback Delay Line (Maximum Delay 1s) + Filter/Effect/Audio/LADSPA + Feedback Delay Line (Maximum Delay 1s) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-fbdelay-5s + Feedback Delay Line (Maximum Delay 5s) + Filter/Effect/Audio/LADSPA + Feedback Delay Line (Maximum Delay 5s) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-fbdelay-60s + Feedback Delay Line (Maximum Delay 60s) + Filter/Effect/Audio/LADSPA + Feedback Delay Line (Maximum Delay 60s) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-flanger Flanger @@ -1356,6 +6273,21 @@ + + ladspa-floatNoise + IEEE Single Precision Noise + Source/Audio/LADSPA + IEEE Single Precision Noise + Nick Lamb <njl195@zepler.org.uk> + + + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-fmOsc FM Oscillator @@ -1377,6 +6309,399 @@ + + ladspa-fmh-rotate-z + Ambisonic Rotation (FMH-Format, Horizontal) + Filter/Effect/Audio/LADSPA + Ambisonic Rotation (FMH-Format, Horizontal) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input_-R- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-S- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-T- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-U- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-V- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-W- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-X- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-Y- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-Z- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-R- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-S- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-T- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-U- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-V- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-W- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-X- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Y- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Z- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-fmh2bf + FMH-Format to B-Format (Discards RSTUV Channels) + Filter/Effect/Audio/LADSPA + FMH-Format to B-Format (Discards RSTUV Channels) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input_-R- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-S- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-T- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-U- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-V- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-W- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-X- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-Y- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-Z- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-W- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-X- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Y- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Z- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-fmh2oct + Ambisonic Decoder (FMH-Format to Octagon) + Filter/Effect/Audio/LADSPA + Ambisonic Decoder (FMH-Format to Octagon) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input_-R- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-S- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-T- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-U- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-V- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-W- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-X- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-Y- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-Z- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Back_Back_Left- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Back_Back_Right- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Back_Left_Left- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Back_Right_Right- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Front_Front_Left- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Front_Front_Right- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Front_Left_Left- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Front_Right_Right- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-fmod-fama-oa + Frequency Modulator (FAMA) + Filter/Effect/Audio/LADSPA + Frequency Modulator (FAMA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Frequency_-Hz- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Modulation_-Octaves- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Modulated_Frequency_-Hz- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-fmod-famc-oa + Frequency Modulator (FAMC) + Filter/Effect/Audio/LADSPA + Frequency Modulator (FAMC) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Frequency_-Hz- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Modulated_Frequency_-Hz- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-fmod-fcma-oa + Frequency Modulator (FCMA) + Filter/Effect/Audio/LADSPA + Frequency Modulator (FCMA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Modulation_-Octaves- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Modulated_Frequency_-Hz- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-fmod-fcmc-oc + Frequency Modulator (FCMC) + Source/Audio/LADSPA + Frequency Modulator (FCMC) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + ladspa-foldover Foldover distortion @@ -1398,6 +6723,210 @@ + + ladspa-foo-chop-liver + Foo Chop Liver + Filter/Effect/Audio/LADSPA + Foo Chop Liver + Sampo Savolainen <v2@iki.fi> + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-foo-driver + Foo Driver + Filter/Effect/Audio/LADSPA + Foo Driver + Sampo Savolainen <v2@iki.fi> + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-foo-limiter + Foo Lookahead Limiter + Filter/Effect/Audio/LADSPA + Foo Lookahead Limiter + Sampo Savolainen <v2@iki.fi> + + + Input_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-foo-limiter-v2 + Foo Lookahead Limiter v2 + Filter/Effect/Audio/LADSPA + Foo Lookahead Limiter v2 + Sampo Savolainen <v2@iki.fi> + + + Input_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-foo-saturator + Foo Saturator + Filter/Effect/Audio/LADSPA + Foo Saturator + Sampo Savolainen <v2@iki.fi> + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-foo-transients + Foo Transient Architect + Filter/Effect/Audio/LADSPA + Foo Transient Architect + Sampo Savolainen <v2@iki.fi> + + + Input_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-foo-transients-mono + Foo Transient Architect (mono) + Filter/Effect/Audio/LADSPA + Foo Transient Architect (mono) + Sampo Savolainen <v2@iki.fi> + + + Input_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-formant-vc + Formant Filter (CR vowel) + Filter/Effect/Audio/LADSPA + Formant Filter (CR vowel) + Dave Robillard + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-fourByFourPole 4 x 4 pole allpass @@ -1440,6 +6969,39 @@ + + ladspa-freeverb3 + Freeverb (Version 3) + Filter/Effect/Audio/LADSPA + Freeverb (Version 3) + CMT (http://www.ladspa.org/cmt, plugin by Jezar at Dreampoint, ported by Richard W.E. Furse) + + + Input_-Left- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_-Right- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Left- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_-Right- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-freqTracker Frequency tracker @@ -1545,6 +7107,27 @@ + + ladspa-grain-scatter + Granular Scatter Processor + Filter/Effect/Audio/LADSPA + Granular Scatter Processor + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-gsm GSM simulator @@ -1593,6 +7176,27 @@ + + ladspa-hard-gate + Hard Gate + Filter/Effect/Audio/LADSPA + Hard Gate + CMT (http://www.ladspa.org/cmt, plugin by Nathaniel Virgo) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-hardLimiter Hard Limiter @@ -1706,10 +7310,10 @@ ladspa-hpf - Simple High Pass Filter + High Pass Filter (One Pole) Filter/Effect/Audio/LADSPA - Simple High Pass Filter - Richard Furse (LADSPA example plugins) + High Pass Filter (One Pole) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) Input @@ -1725,6 +7329,66 @@ + + ladspa-hz-voct-ar + Hz to V/Oct Converter (AR) + Filter/Effect/Audio/LADSPA + Hz to V/Oct Converter (AR) + Dave Robillard + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-hz-voct-cr + Hz to V/Oct Converter (CR) + Source/Audio/LADSPA + Hz to V/Oct Converter (CR) + Dave Robillard + + + + + ladspa-identity-audio + Identity (Audio) + Filter/Effect/Audio/LADSPA + Identity (Audio) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-identity-control + Identity (Control) + Source/Audio/LADSPA + Identity (Control) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + ladspa-imp Impulse convolver @@ -1761,6 +7425,36 @@ + + ladspa-intNoise + Integer Noise + Source/Audio/LADSPA + Integer Noise + Nick Lamb <njl195@zepler.org.uk> + + + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-interpolator + Control to Audio Interpolator + Source/Audio/LADSPA + Control to Audio Interpolator + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Interpolated_Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-inv Inverter @@ -1848,6 +7542,72 @@ + + ladspa-leet-equalizer-bw2x2 + LEET Equalizer/BW 2x2 8 Band + Filter/Effect/Audio/LADSPA + LEET Equalizer/BW 2x2 8 Band + Dan Lyons modded from TAP + + + Input_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-leet-equalizer-bw2x2-1 + LEET Equalizer/BW 2x2 1 band + Filter/Effect/Audio/LADSPA + LEET Equalizer/BW 2x2 1 band + Dan Lyons modded from TAP + + + Input_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-lfoPhaser LFO Phaser @@ -1869,6 +7629,96 @@ + + ladspa-limit-peak + Simple Limiter (Peak Envelope Tracking) + Filter/Effect/Audio/LADSPA + Simple Limiter (Peak Envelope Tracking) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-limit-rms + Simple Limiter (RMS Envelope Tracking) + Filter/Effect/Audio/LADSPA + Simple Limiter (RMS Envelope Tracking) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-lofi + Lo Fi + Filter/Effect/Audio/LADSPA + Lo Fi + CMT (http://www.ladspa.org/cmt, plugin by David A. Bartold) + + + In_-Left- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + In_-Right- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_-Left- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out_-Right- + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-logistic + Logistic Map Control Generator + Source/Audio/LADSPA + Logistic Map Control Generator + CMT (http://www.ladspa.org/cmt, plugin by Nathaniel Virgo) + + + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-lowpass-iir Glame Lowpass Filter @@ -1891,11 +7741,65 @@ - ladspa-lpf - Simple Low Pass Filter + ladspa-lp4pole-faraia-oa + 4 Pole Low-Pass Filter with Resonance (FARAIA) Filter/Effect/Audio/LADSPA - Simple Low Pass Filter - Richard Furse (LADSPA example plugins) + 4 Pole Low-Pass Filter with Resonance (FARAIA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Cutoff_Frequency + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Resonance + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-lp4pole-fcrcia-oa + 4 Pole Low-Pass Filter with Resonance (FCRCIA) + Filter/Effect/Audio/LADSPA + 4 Pole Low-Pass Filter with Resonance (FCRCIA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-lpf + Low Pass Filter (One Pole) + Filter/Effect/Audio/LADSPA + Low Pass Filter (One Pole) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) Input @@ -1932,6 +7836,27 @@ + + ladspa-matched + matched (amp tone) + Filter/Effect/Audio/LADSPA + matched (amp tone) + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-matrixMSSt Matrix: MS to Stereo @@ -2052,6 +7977,33 @@ + + ladspa-mixer + Mixer (Stereo to Mono) + Filter/Effect/Audio/LADSPA + Mixer (Stereo to Mono) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input_1 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_2 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-modDelay Modulatable delay @@ -2100,6 +8052,69 @@ + + ladspa-mux-ar + Multiplexer (AR) + Filter/Effect/Audio/LADSPA + Multiplexer (AR) + Thorsten Wilms + + + Gate + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Off + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + On + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-mux-cr + Multiplexer (CR) + Sink/Analyzer/Audio/LADSPA + Multiplexer (CR) + Thorsten Wilms + + + Gate + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-noise-source-white + Noise Source (White) + Source/Audio/LADSPA + Noise Source (White) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-noise-white White Noise Source @@ -2136,6 +8151,144 @@ + + ladspa-null-ai + Null (Audio Input) + Sink/Audio/LADSPA + Null (Audio Input) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-null-ao + Null (Audio Output) + Source/Audio/LADSPA + Null (Audio Output) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-null-ci + Null (Control Input) + Source/Audio/LADSPA + Null (Control Input) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + + + ladspa-null-co + Null (Control Output) + Source/Audio/LADSPA + Null (Control Output) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + + + ladspa-organ + Organ + Source/Audio/LADSPA + Organ + CMT (http://www.ladspa.org/cmt, plugin by David A. Bartold) + + + Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-peak + Peak Monitor + Sink/Analyzer/Audio/LADSPA + Peak Monitor + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-phasemod + Phase Modulated Voice + Source/Audio/LADSPA + Phase Modulated Voice + CMT (http://www.ladspa.org/cmt, plugin by David A. Bartold) + + + Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-pink-full-frequency + Pink Noise (full frequency range) + Source/Audio/LADSPA + Pink Noise (full frequency range) + CMT (http://www.ladspa.org/cmt, plugin by Nathaniel Virgo) + + + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-pink-interpolated-audio + Pink Noise (Interpolated) + Source/Audio/LADSPA + Pink Noise (Interpolated) + CMT (http://www.ladspa.org/cmt, plugin by Nathaniel Virgo) + + + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-pink-sh + Pink Noise (sample and hold) + Source/Audio/LADSPA + Pink Noise (sample and hold) + CMT (http://www.ladspa.org/cmt, plugin by Nathaniel Virgo) + + + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-pitchScale Pitch Scaler @@ -2226,6 +8379,495 @@ + + ladspa-power + Power (AR) + Filter/Effect/Audio/LADSPA + Power (AR) + Thorsten Wilms + + + Base + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Exponent + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Result + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-power-cr + Power (CR) + Source/Audio/LADSPA + Power (CR) + Thorsten Wilms + + + + + ladspa-preamp + valve preamplifier model + Filter/Effect/Audio/LADSPA + valve preamplifier model + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-prob-switch-ar + Probability Switch (AR Controls) + Filter/Effect/Audio/LADSPA + Probability Switch (AR Controls) + Loki Davison + + + Input_1 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_2 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Probability + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-prob-switch-cr + Probability Switch (CR Controls) + Filter/Effect/Audio/LADSPA + Probability Switch (CR Controls) + Loki Davison + + + Input_1 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_2 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-product-iaia-oa + Signal Product (IAIA) + Filter/Effect/Audio/LADSPA + Signal Product (IAIA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + First_Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Second_Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Product_Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-product-iaic-oa + Signal Product (IAIC) + Filter/Effect/Audio/LADSPA + Signal Product (IAIC) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + First_Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Product_Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-product-icic-oc + Signal Product (ICIC) + Source/Audio/LADSPA + Signal Product (ICIC) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + + + ladspa-pulse-fapa-oa + Bandlimited Variable Width Pulse Oscillator (FAPA) + Filter/Effect/Audio/LADSPA + Bandlimited Variable Width Pulse Oscillator (FAPA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Frequency + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Pulse_Width + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-pulse-fapc-oa + Bandlimited Variable Width Pulse Oscillator (FAPC) + Filter/Effect/Audio/LADSPA + Bandlimited Variable Width Pulse Oscillator (FAPC) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Frequency + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-pulse-fcpa-oa + Bandlimited Variable Width Pulse Oscillator (FCPA) + Filter/Effect/Audio/LADSPA + Bandlimited Variable Width Pulse Oscillator (FCPA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Pulse_Width + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-pulse-fcpc-oa + Bandlimited Variable Width Pulse Oscillator (FCPC) + Source/Audio/LADSPA + Bandlimited Variable Width Pulse Oscillator (FCPC) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-quantiser100 + Quantiser (100 Steps) + Filter/Effect/Audio/LADSPA + Quantiser (100 Steps) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_Changed + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Quantised_Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-quantiser20 + Quantiser (20 Steps) + Filter/Effect/Audio/LADSPA + Quantiser (20 Steps) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_Changed + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Quantised_Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-quantiser50 + Quantiser (50 Steps) + Filter/Effect/Audio/LADSPA + Quantiser (50 Steps) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_Changed + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Quantised_Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-random-fasa-oa + Random Wave Generator (FASA) + Filter/Effect/Audio/LADSPA + Random Wave Generator (FASA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Frequency_-Hz- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Wave_Smoothness + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-random-fasc-oa + Random Wave Generator (FASC) + Filter/Effect/Audio/LADSPA + Random Wave Generator (FASC) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Frequency_-Hz- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-random-fcsa-oa + Random Wave Generator (FCSA) + Filter/Effect/Audio/LADSPA + Random Wave Generator (FCSA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Wave_Smoothness + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-random-fcsc-oa + Random Wave Generator (FCSC) + Source/Audio/LADSPA + Random Wave Generator (FCSC) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-range-trans-ar + Range Translator (AR Controls) + Filter/Effect/Audio/LADSPA + Range Translator (AR Controls) + Dave Robillard + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_Max + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_Min + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_Max + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_Min + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-range-trans-cr + Range Translator (CR Controls) + Filter/Effect/Audio/LADSPA + Range Translator (CR Controls) + Dave Robillard + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-rateShifter Rate shifter @@ -2247,6 +8889,84 @@ + + ladspa-ratio-nada-oa + Signal Ratio (NADA) + Filter/Effect/Audio/LADSPA + Signal Ratio (NADA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Denominator + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Numerator + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Ratio_Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-ratio-nadc-oa + Signal Ratio (NADC) + Filter/Effect/Audio/LADSPA + Signal Ratio (NADC) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Numerator + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Ratio_Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-ratio-ncda-oa + Signal Ratio (NCDA) + Filter/Effect/Audio/LADSPA + Signal Ratio (NCDA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Denominator + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Ratio_Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-ratio-ncdc-oc + Signal Ratio (NCDC) + Source/Audio/LADSPA + Signal Ratio (NCDC) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + ladspa-retroFlange Retro Flanger @@ -2337,6 +9057,75 @@ + + ladspa-rissetScales + Continuous Risset Scales + Source/Audio/LADSPA + Continuous Risset Scales + Nick Lamb <njl195@zepler.org.uk> + + + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-rubberband-pitchshifter-mono + Rubber Band Mono Pitch Shifter + Filter/Effect/Audio/LADSPA + Rubber Band Mono Pitch Shifter + Breakfast Quay + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-rubberband-pitchshifter-stereo + Rubber Band Stereo Pitch Shifter + Filter/Effect/Audio/LADSPA + Rubber Band Stereo Pitch Shifter + Breakfast Quay + + + Input_L + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_R + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_L + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_R + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-satanMaximiser Barry's Satan Maximiser @@ -2358,6 +9147,42 @@ + + ladspa-sawtooth-fa-oa + Bandlimited Sawtooth Oscillator (FA) + Filter/Effect/Audio/LADSPA + Bandlimited Sawtooth Oscillator (FA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Frequency + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-sawtooth-fc-oa + Bandlimited Sawtooth Oscillator (FC) + Source/Audio/LADSPA + Bandlimited Sawtooth Oscillator (FC) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-sc1 SC1 @@ -2532,6 +9357,147 @@ + + ladspa-sequencer16 + Analogue Style 16 Step Sequencer + Filter/Effect/Audio/LADSPA + Analogue Style 16 Step Sequencer + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Gate_-Open_>_0- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Step_Trigger + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Value_Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-sequencer32 + Analogue Style 32 Step Sequencer + Filter/Effect/Audio/LADSPA + Analogue Style 32 Step Sequencer + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Gate_-Open_>_0- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Step_Trigger + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Value_Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-sequencer64 + Analogue Style 64 Step Sequencer + Filter/Effect/Audio/LADSPA + Analogue Style 64 Step Sequencer + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Gate_-Open_>_0- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Step_Trigger + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Value_Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-sh-ar + Sample and Hold (AR Threshold) + Filter/Effect/Audio/LADSPA + Sample and Hold (AR Threshold) + Thorsten Wilms + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Threshold + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Trigger + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-sh-cr + Sample and Hold (CR Threshold) + Filter/Effect/Audio/LADSPA + Sample and Hold (CR Threshold) + Thorsten Wilms + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Trigger + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-shaper Wave shaper @@ -2574,6 +9540,54 @@ + + ladspa-signal-abs-ar + Signal Absolute value, negative or positive (AR Controls) + Filter/Effect/Audio/LADSPA + Signal Absolute value, negative or positive (AR Controls) + Loki Davison + + + Input_1 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Sign + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-signal-abs-cr + Signal Absolute value, negative or positive (CR Controls) + Filter/Effect/Audio/LADSPA + Signal Absolute value, negative or positive (CR Controls) + Loki Davison + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-sinCos Sine + cosine oscillator @@ -2600,7 +9614,7 @@ Sine Oscillator (Freq:audio, Amp:audio) Filter/Effect/Audio/LADSPA Sine Oscillator (Freq:audio, Amp:audio) - Richard Furse (LADSPA example plugins) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) Amplitude @@ -2609,7 +9623,7 @@
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
- Frequency_-Hz- + Frequency sink always
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
@@ -2627,10 +9641,10 @@ Sine Oscillator (Freq:audio, Amp:control) Filter/Effect/Audio/LADSPA Sine Oscillator (Freq:audio, Amp:control) - Richard Furse (LADSPA example plugins) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) - Frequency_-Hz- + Frequency sink always
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
@@ -2648,7 +9662,7 @@ Sine Oscillator (Freq:control, Amp:audio) Filter/Effect/Audio/LADSPA Sine Oscillator (Freq:control, Amp:audio) - Richard Furse (LADSPA example plugins) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) Amplitude @@ -2669,7 +9683,7 @@ Sine Oscillator (Freq:control, Amp:control) Source/Audio/LADSPA Sine Oscillator (Freq:control, Amp:control) - Richard Furse (LADSPA example plugins) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) Output @@ -2721,6 +9735,141 @@
+ + ladspa-sledgehammer + Dynamic Sledgehammer + Filter/Effect/Audio/LADSPA + Dynamic Sledgehammer + CMT (http://www.ladspa.org/cmt, plugin by Nathaniel Virgo) + + + Carrier + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Modulator + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-slew-limiter-ra + Slew limiter (RA) + Filter/Effect/Audio/LADSPA + Slew limiter (RA) + Lars Luthman <larsl@users.sourceforge.net> + + + Fall_rate_-1-s- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Rise_rate_-1-s- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-slew-limiter-rc + Slew limiter (RC) + Filter/Effect/Audio/LADSPA + Slew limiter (RC) + Lars Luthman <larsl@users.sourceforge.net> + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-slide-ta + Slide (TA) + Filter/Effect/Audio/LADSPA + Slide (TA) + Lars Luthman <larsl@users.sourceforge.net> + + + Fall_time_-s- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Rise_time_-s- + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-slide-tc + Slide (TC) + Filter/Effect/Audio/LADSPA + Slide (TC) + Lars Luthman <larsl@users.sourceforge.net> + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-smoothDecimate Smooth Decimator @@ -2769,6 +9918,63 @@ + + ladspa-square-fa-oa + Bandlimited Square Oscillator (FA) + Filter/Effect/Audio/LADSPA + Bandlimited Square Oscillator (FA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Frequency + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-square-fc-oa + Bandlimited Square Oscillator (FC) + Source/Audio/LADSPA + Bandlimited Square Oscillator (FC) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-ssm-masher + Masher + Filter/Effect/Audio/LADSPA + Masher + Dave Griffiths + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-stepMuxer Step Demuxer @@ -2838,6 +10044,84 @@ + + ladspa-sum-iaia-oa + Signal Sum (IAIA) + Filter/Effect/Audio/LADSPA + Signal Sum (IAIA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + First_Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Second_Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Summed_Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-sum-iaic-oa + Signal Sum (IAIC) + Filter/Effect/Audio/LADSPA + Signal Sum (IAIC) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + First_Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Summed_Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-sum-icic-oc + Signal Sum (ICIC) + Source/Audio/LADSPA + Signal Sum (ICIC) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + + + ladspa-super-60 + super 60 (amp tone) + Filter/Effect/Audio/LADSPA + super 60 (amp tone) + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-surroundEncoder Surround matrix encoder @@ -2904,6 +10188,123 @@ + + ladspa-syncpulse-fapaga-oa + Clock Pulse Oscillator with Gate (FAPAGA) + Filter/Effect/Audio/LADSPA + Clock Pulse Oscillator with Gate (FAPAGA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Frequency + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Gate + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Pulse_Width + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-syncpulse-fcpcga-oa + Clock Pulse Oscillator with Gate (FCPCGA) + Filter/Effect/Audio/LADSPA + Clock Pulse Oscillator with Gate (FCPCGA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Gate + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-syncsquare-faga-oa + Clock Oscillator with Gate (FAGA) + Filter/Effect/Audio/LADSPA + Clock Oscillator with Gate (FAGA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Frequency + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Gate + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-syncsquare-fcga-oa + Clock Oscillator with Gate (FCGA) + Filter/Effect/Audio/LADSPA + Clock Oscillator with Gate (FCGA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Gate + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-syndrum + Syn Drum + Source/Audio/LADSPA + Syn Drum + CMT (http://www.ladspa.org/cmt, plugin by David A. Bartold) + + + Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-tap-autopan TAP AutoPanner @@ -3408,6 +10809,144 @@ + + ladspa-track-max-peak + Envelope Tracker (Maximum Peak) + Sink/Analyzer/Audio/LADSPA + Envelope Tracker (Maximum Peak) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-track-max-rms + Envelope Tracker (Maximum RMS) + Sink/Analyzer/Audio/LADSPA + Envelope Tracker (Maximum RMS) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-track-peak + Envelope Tracker (Peak) + Sink/Analyzer/Audio/LADSPA + Envelope Tracker (Peak) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-track-rms + Envelope Tracker (RMS) + Sink/Analyzer/Audio/LADSPA + Envelope Tracker (RMS) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-tracker-gaaadaia-oa + Signal Tracker (Audio Rates) + Filter/Effect/Audio/LADSPA + Signal Tracker (Audio Rates) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Attack_Rate_-Hz-_when_Gate_High + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Attack_Rate_-Hz-_when_Gate_Low + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Decay_Rate_-Hz-_when_Gate_High + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Decay_Rate_-Hz-_when_Gate_Low + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Gate + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-tracker-gaacdcia-oa + Signal Tracker (Control Rates) + Filter/Effect/Audio/LADSPA + Signal Tracker (Control Rates) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Gate + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-transient Transient mangler @@ -3429,6 +10968,111 @@ + + ladspa-triangle-fasa-oa + Bandlimited Variable Slope Triangle Oscillator (FASA) + Filter/Effect/Audio/LADSPA + Bandlimited Variable Slope Triangle Oscillator (FASA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Frequency + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Slope + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-triangle-fasc-oa + Bandlimited Variable Slope Triangle Oscillator (FASC) + Filter/Effect/Audio/LADSPA + Bandlimited Variable Slope Triangle Oscillator (FASC) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Frequency + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-triangle-fcsa-oa + Bandlimited Variable Slope Triangle Oscillator (FCSA) + Filter/Effect/Audio/LADSPA + Bandlimited Variable Slope Triangle Oscillator (FCSA) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Slope + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-triangle-fcsc-oa + Bandlimited Variable Slope Triangle Oscillator (FCSC) + Source/Audio/LADSPA + Bandlimited Variable Slope Triangle Oscillator (FCSC) + Mike Rawes <mike_rawes[at]yahoo.co.uk> + + + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-trigger + Trigger + Filter/Effect/Audio/LADSPA + Trigger + Thorsten Edelhaeusser + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-triplePara Triple band parametric with shelves @@ -3450,6 +11094,27 @@ + + ladspa-unmatched + unmatched (Amp Tone) + Filter/Effect/Audio/LADSPA + unmatched (Amp Tone) + Tim Goetze <tim@quitte.de> + + + in + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-valve Valve saturation @@ -3492,6 +11157,423 @@ + + ladspa-vcf-bp1 + Bandpass Filter I + Filter/Effect/Audio/LADSPA + Bandpass Filter I + LADSPA code by Matthias Nagorni, Filter formula by Robert Bristow-Johnson + + + Frequency_Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Resonance + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-vcf-bp2 + Bandpass Filter II + Filter/Effect/Audio/LADSPA + Bandpass Filter II + LADSPA code by Matthias Nagorni, Filter formula by Robert Bristow-Johnson + + + Frequency_Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Resonance + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-vcf-hp + Highpass Filter + Filter/Effect/Audio/LADSPA + Highpass Filter + LADSPA code by Matthias Nagorni, Filter formula by Robert Bristow-Johnson + + + Frequency_Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Resonance + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-vcf-hshelf + High Shelf Filter + Filter/Effect/Audio/LADSPA + High Shelf Filter + LADSPA code by Matthias Nagorni, Filter formula by Robert Bristow-Johnson + + + Frequency_Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Resonance + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + dBgain_Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-vcf-lp + Lowpass Filter + Filter/Effect/Audio/LADSPA + Lowpass Filter + LADSPA code by Matthias Nagorni, Filter formula by Robert Bristow-Johnson + + + Frequency_Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Resonance + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-vcf-lshelf + Low Shelf Filter + Filter/Effect/Audio/LADSPA + Low Shelf Filter + LADSPA code by Matthias Nagorni, Filter formula by Robert Bristow-Johnson + + + Frequency_Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Resonance + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + dBgain_Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-vcf-notch + Notch Filter + Filter/Effect/Audio/LADSPA + Notch Filter + LADSPA code by Matthias Nagorni, Filter formula by Robert Bristow-Johnson + + + Frequency_Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Resonance + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-vcf-peakeq + Peaking EQ Filter + Filter/Effect/Audio/LADSPA + Peaking EQ Filter + LADSPA code by Matthias Nagorni, Filter formula by Robert Bristow-Johnson + + + Frequency_Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Resonance + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + dBgain_Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-vcf-reslp + Resonant Lowpass Filter + Filter/Effect/Audio/LADSPA + Resonant Lowpass Filter + LADSPA code by Matthias Nagorni, Filter formula by Paul Kellett + + + Frequency_Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Resonance + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-vcf303 + VCF 303 + Filter/Effect/Audio/LADSPA + VCF 303 + CMT (http://www.ladspa.org/cmt, plugin by David A. Bartold) + + + In + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Out + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-vlevel-mono + VLevel (Mono) + Filter/Effect/Audio/LADSPA + VLevel (Mono) + Tom Felker + + + Input_1 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_1 + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-vlevel-stereo + VLevel (Stereo) + Filter/Effect/Audio/LADSPA + VLevel (Stereo) + Tom Felker + + + Input_1 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Input_2 + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_1 + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output_2 + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-vocoder + Vocoder + Filter/Effect/Audio/LADSPA + Vocoder + Achim Settelmeier (adapted to LADSPA by Josh Green) + + + Carrier + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Formant + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-vynil VyNil (Vinyl Effect) @@ -3552,6 +11634,54 @@ + + ladspa-wg-mesh-cr + Simple waveguide mesh (CR Controls) + Filter/Effect/Audio/LADSPA + Simple waveguide mesh (CR Controls) + Loki Davison + + + Power + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Trigger + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + ladspa-wshape-sine + Wave Shaper (Sine-Based) + Filter/Effect/Audio/LADSPA + Wave Shaper (Sine-Based) + CMT (http://www.ladspa.org/cmt, plugin by Richard W.E. Furse) + + + Input + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + Output + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
ladspa-xfade Crossfade diff --git a/docs/plugins/inspect/plugin-legacyresample.xml b/docs/plugins/inspect/plugin-legacyresample.xml index c3ae53dfc2..c098220643 100644 --- a/docs/plugins/inspect/plugin-legacyresample.xml +++ b/docs/plugins/inspect/plugin-legacyresample.xml @@ -3,7 +3,7 @@ Resamples audio ../../gst/legacyresample/.libs/libgstlegacyresample.so libgstlegacyresample.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-linsys.xml b/docs/plugins/inspect/plugin-linsys.xml new file mode 100644 index 0000000000..de4598dcdc --- /dev/null +++ b/docs/plugins/inspect/plugin-linsys.xml @@ -0,0 +1,43 @@ + + linsys + FIXME + ../../sys/linsys/.libs/libgstlinsys.so + libgstlinsys.so + 0.10.22.1 + LGPL + gst-plugins-bad + GStreamer Bad Plug-ins + http://FIXME.org/ + + + linsyssdisink + SDI video sink + Sink/Video + Writes video from SDI transmit device + David Schleef <ds@entropywave.com> + + + sink + sink + always +
video/x-raw-yuv, format=(fourcc)UYVY, width=(int)720, height=(int)480, pixel-aspect-ratio=(fraction)10/11, framerate=(fraction)30000/1001, interlaced=(boolean)true, colorspec=(string)sdtv, chroma-site=(string)mpeg2
+
+
+
+ + linsyssdisrc + SDI video source + Source/Video + Reads video from SDI capture device + David Schleef <ds@entropywave.com> + + + src + source + always +
video/x-raw-yuv, format=(fourcc)UYVY, width=(int)720, height=(int)480, pixel-aspect-ratio=(fraction)10/11, framerate=(fraction)30000/1001, interlaced=(boolean)true, colorspec=(string)sdtv, chroma-site=(string)mpeg2
+
+
+
+
+
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-liveadder.xml b/docs/plugins/inspect/plugin-liveadder.xml index 109a4762d8..169589bc5d 100644 --- a/docs/plugins/inspect/plugin-liveadder.xml +++ b/docs/plugins/inspect/plugin-liveadder.xml @@ -3,7 +3,7 @@ Adds multiple live discontinuous streams ../../gst/liveadder/.libs/libgstliveadder.so libgstliveadder.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-lv2.xml b/docs/plugins/inspect/plugin-lv2.xml index ff9a727752..ddfd1d8006 100644 --- a/docs/plugins/inspect/plugin-lv2.xml +++ b/docs/plugins/inspect/plugin-lv2.xml @@ -3,12 +3,789 @@ All LV2 plugins ../../ext/lv2/.libs/libgstlv2.so libgstlv2.so - 0.10.19.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git Unknown package origin + + calf-sourceforge-net-plugins-BassEnhancer + Calf Bass Enhancer + Filter/Effect/Audio/LV2 + Calf Bass Enhancer + Markus Schmidt / Krzysztof Foltman + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Compressor + Calf Compressor + Filter/Effect/Audio/LV2 + Calf Compressor + Thor Harald Johansen + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Deesser + Calf Deesser + Filter/Effect/Audio/LV2 + Calf Deesser + Markus Schmidt / Thor Harald Johansen + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Equalizer12Band + Calf Equalizer 12 Band + Filter/Effect/Audio/LV2 + Calf Equalizer 12 Band + Markus Schmidt + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Equalizer5Band + Calf Equalizer 5 Band + Filter/Effect/Audio/LV2 + Calf Equalizer 5 Band + Markus Schmidt + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Equalizer8Band + Calf Equalizer 8 Band + Filter/Effect/Audio/LV2 + Calf Equalizer 8 Band + Markus Schmidt + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Exciter + Calf Exciter + Filter/Effect/Audio/LV2 + Calf Exciter + Markus Schmidt / Krzysztof Foltman + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Filter + Calf Filter + Filter/Effect/Audio/LV2 + Calf Filter + Krzysztof Foltman + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Filterclavier + Calf Filterclavier + Filter/Effect/Audio/LV2 + Calf Filterclavier + Krzysztof Foltman / Hans Baier + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Flanger + Calf Flanger + Filter/Effect/Audio/LV2 + Calf Flanger + Krzysztof Foltman + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Fluidsynth + Calf Fluidsynth + Source/Audio/LV2 + Calf Fluidsynth + FluidSynth Team / Krzysztof Foltman + + + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Gate + Calf Gate + Filter/Effect/Audio/LV2 + Calf Gate + Damien Zammit / Thor Harald Johansen + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Monosynth + Calf Monosynth + Source/Audio/LV2 + Calf Monosynth + Krzysztof Foltman + + + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-MultiChorus + Calf MultiChorus + Filter/Effect/Audio/LV2 + Calf MultiChorus + Krzysztof Foltman + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Multibandcompressor + Calf Multiband Compressor + Filter/Effect/Audio/LV2 + Calf Multiband Compressor + Markus Schmidt / Thor Harald Johansen + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Organ + Calf Organ + Source/Audio/LV2 + Calf Organ + Krzysztof Foltman + + + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Phaser + Calf Phaser + Filter/Effect/Audio/LV2 + Calf Phaser + Krzysztof Foltman + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Pulsator + Calf Pulsator + Filter/Effect/Audio/LV2 + Calf Pulsator + Markus Schmidt + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Reverb + Calf Reverb + Filter/Effect/Audio/LV2 + Calf Reverb + Krzysztof Foltman + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-RotarySpeaker + Calf Rotary Speaker + Filter/Effect/Audio/LV2 + Calf Rotary Speaker + Krzysztof Foltman + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Saturator + Calf Saturator + Filter/Effect/Audio/LV2 + Calf Saturator + Markus Schmidt / Krzysztof Foltman + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Sidechaincompressor + Calf Sidechain Compressor + Filter/Effect/Audio/LV2 + Calf Sidechain Compressor + Markus Schmidt / Thor Harald Johansen + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Sidechaingate + Calf Sidechain Gate + Filter/Effect/Audio/LV2 + Calf Sidechain Gate + Markus Schmidt / Damien Zammit / Thor Harald Johansen + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-VintageDelay + Calf Vintage Delay + Filter/Effect/Audio/LV2 + Calf Vintage Delay + Krzysztof Foltman + + + in_l + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + in_r + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
+ + calf-sourceforge-net-plugins-Wavetable + Calf Wavetable + Source/Audio/LV2 + Calf Wavetable + Krzysztof Foltman + + + out_l + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + out_r + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+
+
invadarecords-com-plugins-lv2-compressor-mono Invada Compressor (mono) @@ -33,28 +810,40 @@ invadarecords-com-plugins-lv2-compressor-stereo Invada Compressor (stereo) - Source/Audio/LV2 + Filter/Effect/Audio/LV2 Invada Compressor (stereo) Invada - in + inL sink always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
- out + inR + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outL source always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outR + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
invadarecords-com-plugins-lv2-delay-mono Invada Delay Munge (mono in) - Sink/Analyzer/Audio/LV2 + Filter/Effect/Audio/LV2 Invada Delay Munge (mono in) Invada @@ -65,38 +854,56 @@
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
- out + outL source always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outR + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
invadarecords-com-plugins-lv2-delay-sum Invada Delay Munge (sum L+R in) - Source/Audio/LV2 + Filter/Effect/Audio/LV2 Invada Delay Munge (sum L+R in) Invada - in + inL sink always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
- out + inR + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outL source always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outR + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
invadarecords-com-plugins-lv2-erreverb-mono Invada Early Reflection Reverb (mono in) - Sink/Analyzer/Audio/LV2 + Filter/Effect/Audio/LV2 Invada Early Reflection Reverb (mono in) Invada @@ -107,31 +914,49 @@
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
- out + outL source always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outR + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
invadarecords-com-plugins-lv2-erreverb-sum Invada Early Reflection Reverb (sum L+R in) - Source/Audio/LV2 + Filter/Effect/Audio/LV2 Invada Early Reflection Reverb (sum L+R in) Invada - in + inL sink always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
- out + inR + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outL source always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outR + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
@@ -159,21 +984,33 @@ invadarecords-com-plugins-lv2-filter-hpf-stereo Invada High Pass Filter (stereo) - Source/Audio/LV2 + Filter/Effect/Audio/LV2 Invada High Pass Filter (stereo) Invada - in + inL sink always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
- out + inR + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outL source always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outR + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
@@ -201,42 +1038,66 @@ invadarecords-com-plugins-lv2-filter-lpf-stereo Invada Low Pass Filter (stereo) - Source/Audio/LV2 + Filter/Effect/Audio/LV2 Invada Low Pass Filter (stereo) Invada - in + inL sink always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
- out + inR + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outL source always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outR + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
invadarecords-com-plugins-lv2-input Invada Input Module - Source/Audio/LV2 + Filter/Effect/Audio/LV2 Invada Input Module Invada - in + inL sink always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
- out + inR + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outL source always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outR + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
@@ -276,7 +1137,7 @@ invadarecords-com-plugins-lv2-phaser-mono Invada Stereo Phaser (mono in) - Sink/Analyzer/Audio/LV2 + Filter/Effect/Audio/LV2 Invada Stereo Phaser (mono in) Invada @@ -287,17 +1148,23 @@
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
- out + outL source always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outR + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
invadarecords-com-plugins-lv2-phaser-stereo Invada Stereo Phaser (stereo in) - Sink/Analyzer/Audio/LV2 + Filter/Effect/Audio/LV2 Invada Stereo Phaser (stereo in) Invada @@ -314,31 +1181,49 @@
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
- out + outL source always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outR + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
invadarecords-com-plugins-lv2-phaser-sum Invada Stereo Phaser (sum L+R in) - Source/Audio/LV2 + Filter/Effect/Audio/LV2 Invada Stereo Phaser (sum L+R in) Invada - in + inL sink always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
- out + inR + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outL source always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outR + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
@@ -381,21 +1266,33 @@ invadarecords-com-plugins-lv2-tube-stereo Invada Tube Distortion (stereo) - Source/Audio/LV2 + Filter/Effect/Audio/LV2 Invada Tube Distortion (stereo) Invada - in + inL sink always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
- out + inR + sink + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outL source always -
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)2, rate=(int)[ 1, 2147483647 ]
+
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
+
+ + outR + source + always +
audio/x-raw-float, endianness=(int)1234, width=(int)32, channels=(int)1, rate=(int)[ 1, 2147483647 ]
diff --git a/docs/plugins/inspect/plugin-mimic.xml b/docs/plugins/inspect/plugin-mimic.xml index 202795df1e..4b23cbfd45 100644 --- a/docs/plugins/inspect/plugin-mimic.xml +++ b/docs/plugins/inspect/plugin-mimic.xml @@ -3,7 +3,7 @@ Mimic codec ../../ext/mimic/.libs/libgstmimic.so libgstmimic.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-mms.xml b/docs/plugins/inspect/plugin-mms.xml index fd3d4d8cc0..fc57de6c7b 100644 --- a/docs/plugins/inspect/plugin-mms.xml +++ b/docs/plugins/inspect/plugin-mms.xml @@ -3,7 +3,7 @@ Microsoft Multi Media Server streaming protocol support ../../ext/libmms/.libs/libgstmms.so libgstmms.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-modplug.xml b/docs/plugins/inspect/plugin-modplug.xml index 0e717bb86e..f9cac1f48f 100644 --- a/docs/plugins/inspect/plugin-modplug.xml +++ b/docs/plugins/inspect/plugin-modplug.xml @@ -1,12 +1,12 @@ modplug .MOD audio decoding - ../../ext/modplug/.libs/libgstmodplug.so + ../../gst/modplug/.libs/libgstmodplug.so libgstmodplug.so - 0.10.21.1 + 0.10.10.1 LGPL gst-plugins-bad - GStreamer Bad Plug-ins git + GStreamer Bad Plug-ins CVS/prerelease Unknown package origin @@ -26,7 +26,7 @@ src source always -
audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)32, depth=(int)32, rate=(int){ 8000, 11025, 22050, 44100 }, channels=(int)[ 1, 2 ]; audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int){ 8000, 11025, 22050, 44100 }, channels=(int)[ 1, 2 ]; audio/x-raw-int, endianness=(int)1234, signed=(boolean)false, width=(int)8, depth=(int)8, rate=(int){ 8000, 11025, 22050, 44100 }, channels=(int)[ 1, 2 ]
+
audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int){ 8000, 11025, 22050, 44100 }, channels=(int)2; audio/x-raw-int, endianness=(int)1234, signed=(boolean)false, width=(int)8, depth=(int)8, rate=(int){ 8000, 11025, 22050, 44100 }, channels=(int)[ 1, 2 ]
diff --git a/docs/plugins/inspect/plugin-mpeg2enc.xml b/docs/plugins/inspect/plugin-mpeg2enc.xml index 0797f9adff..fb4f7dc02c 100644 --- a/docs/plugins/inspect/plugin-mpeg2enc.xml +++ b/docs/plugins/inspect/plugin-mpeg2enc.xml @@ -3,7 +3,7 @@ High-quality MPEG-1/2 video encoder ../../ext/mpeg2enc/.libs/libgstmpeg2enc.so libgstmpeg2enc.so - 0.10.21.1 + 0.10.22.1 GPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-mpeg4videoparse.xml b/docs/plugins/inspect/plugin-mpeg4videoparse.xml index 5915e60fb1..3557a44b68 100644 --- a/docs/plugins/inspect/plugin-mpeg4videoparse.xml +++ b/docs/plugins/inspect/plugin-mpeg4videoparse.xml @@ -3,7 +3,7 @@ MPEG-4 video parser ../../gst/mpeg4videoparse/.libs/libgstmpeg4videoparse.so libgstmpeg4videoparse.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-mpegdemux2.xml b/docs/plugins/inspect/plugin-mpegdemux2.xml index 571a42f9be..40b0119aa0 100644 --- a/docs/plugins/inspect/plugin-mpegdemux2.xml +++ b/docs/plugins/inspect/plugin-mpegdemux2.xml @@ -3,7 +3,7 @@ MPEG demuxers ../../gst/mpegdemux/.libs/libgstmpegdemux.so libgstmpegdemux.so - 0.10.21.1 + 0.10.22.1 unknown gst-plugins-bad GStreamer Bad Plug-ins git @@ -83,7 +83,7 @@ video_%04x source sometimes -
video/mpeg, mpegversion=(int){ 1, 2, 4 }, systemstream=(boolean)false; video/x-h264; video/x-dirac; video/x-wmv, wmvversion=(int)3, format=(fourcc)WVC1
+
video/mpeg, mpegversion=(int){ 1, 2, 4 }, systemstream=(boolean)false; video/x-h264, stream-format=(string)byte-stream, alignment=(string)nal; video/x-dirac; video/x-wmv, wmvversion=(int)3, format=(fourcc)WVC1
diff --git a/docs/plugins/inspect/plugin-mpegpsmux.xml b/docs/plugins/inspect/plugin-mpegpsmux.xml index 65b5036b76..b9b38d3bab 100644 --- a/docs/plugins/inspect/plugin-mpegpsmux.xml +++ b/docs/plugins/inspect/plugin-mpegpsmux.xml @@ -3,7 +3,7 @@ MPEG-PS muxer ../../gst/mpegpsmux/.libs/libgstmpegpsmux.so libgstmpegpsmux.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-mpegtsdemux.xml b/docs/plugins/inspect/plugin-mpegtsdemux.xml index 6dbd0669f4..f9b860c701 100644 --- a/docs/plugins/inspect/plugin-mpegtsdemux.xml +++ b/docs/plugins/inspect/plugin-mpegtsdemux.xml @@ -3,7 +3,7 @@ MPEG TS demuxer ../../gst/mpegtsdemux/.libs/libgstmpegtsdemux.so libgstmpegtsdemux.so - 0.10.21.1 + 0.10.22.1 unknown gst-plugins-bad GStreamer Bad Plug-ins git @@ -14,7 +14,8 @@ MPEG transport stream demuxer Codec/Demuxer Demuxes MPEG2 transport streams - Zaheer Abbas Merali <zaheerabbas at merali dot org>; Edward Hervey <edward.hervey@collabora.co.uk> + Zaheer Abbas Merali <zaheerabbas at merali dot org> +Edward Hervey <edward.hervey@collabora.co.uk> sink @@ -44,7 +45,7 @@ video_%04x source sometimes -
video/mpeg, mpegversion=(int){ 1, 2, 4 }, systemstream=(boolean)false; video/x-h264; video/x-dirac; video/x-wmv, wmvversion=(int)3, format=(fourcc)WVC1
+
video/mpeg, mpegversion=(int){ 1, 2, 4 }, systemstream=(boolean)false; video/x-h264, stream-format=(string)byte-stream, alignment=(string)nal; video/x-dirac; video/x-wmv, wmvversion=(int)3, format=(fourcc)WVC1
diff --git a/docs/plugins/inspect/plugin-mpegtsmux.xml b/docs/plugins/inspect/plugin-mpegtsmux.xml index 291c001e69..9132feb080 100644 --- a/docs/plugins/inspect/plugin-mpegtsmux.xml +++ b/docs/plugins/inspect/plugin-mpegtsmux.xml @@ -3,7 +3,7 @@ MPEG-TS muxer ../../gst/mpegtsmux/.libs/libgstmpegtsmux.so libgstmpegtsmux.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git @@ -20,7 +20,7 @@ sink_%d sink request -
video/mpeg, mpegversion=(int){ 1, 2, 4 }, systemstream=(boolean)false; video/x-dirac; video/x-h264; audio/mpeg, mpegversion=(int){ 1, 2, 4 }; audio/x-lpcm, width=(int){ 16, 20, 24 }, rate=(int){ 48000, 96000 }, channels=(int)[ 1, 8 ], dynamic_range=(int)[ 0, 255 ], emphasis=(boolean){ false, true }, mute=(boolean){ false, true }; audio/x-ac3; audio/x-dts
+
video/mpeg, mpegversion=(int){ 1, 2, 4 }, systemstream=(boolean)false; video/x-dirac; video/x-h264, stream-format=(string)byte-stream; audio/mpeg, mpegversion=(int){ 1, 2, 4 }; audio/x-lpcm, width=(int){ 16, 20, 24 }, rate=(int){ 48000, 96000 }, channels=(int)[ 1, 8 ], dynamic_range=(int)[ 0, 255 ], emphasis=(boolean){ false, true }, mute=(boolean){ false, true }; audio/x-ac3; audio/x-dts
src diff --git a/docs/plugins/inspect/plugin-mpegvideoparse.xml b/docs/plugins/inspect/plugin-mpegvideoparse.xml index 2aa5386813..7166f3c0d4 100644 --- a/docs/plugins/inspect/plugin-mpegvideoparse.xml +++ b/docs/plugins/inspect/plugin-mpegvideoparse.xml @@ -3,14 +3,14 @@ MPEG-1 and MPEG-2 video parser ../../gst/mpegvideoparse/.libs/libgstmpegvideoparse.so libgstmpegvideoparse.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git Unknown package origin - mpegvideoparse + legacympegvideoparse MPEG video elementary stream parser Codec/Parser/Video Parses and frames MPEG-1 and MPEG-2 elementary video streams diff --git a/docs/plugins/inspect/plugin-musepack.xml b/docs/plugins/inspect/plugin-musepack.xml index 027cda9b81..63b1652288 100644 --- a/docs/plugins/inspect/plugin-musepack.xml +++ b/docs/plugins/inspect/plugin-musepack.xml @@ -3,7 +3,7 @@ Musepack decoder ../../ext/musepack/.libs/libgstmusepack.so libgstmusepack.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git @@ -20,7 +20,7 @@ sink sink always -
audio/x-musepack, streamversion=(int){ 7, 8 }
+
audio/x-musepack, streamversion=(int)7
src diff --git a/docs/plugins/inspect/plugin-musicbrainz.xml b/docs/plugins/inspect/plugin-musicbrainz.xml index c6a0668f9a..b783131a34 100644 --- a/docs/plugins/inspect/plugin-musicbrainz.xml +++ b/docs/plugins/inspect/plugin-musicbrainz.xml @@ -3,7 +3,7 @@ A TRM signature producer based on libmusicbrainz ../../ext/musicbrainz/.libs/libgsttrm.so libgsttrm.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-mve.xml b/docs/plugins/inspect/plugin-mve.xml index 82ead0da84..f4cdd70929 100644 --- a/docs/plugins/inspect/plugin-mve.xml +++ b/docs/plugins/inspect/plugin-mve.xml @@ -3,7 +3,7 @@ Interplay MVE movie format manipulation ../../gst/mve/.libs/libgstmve.so libgstmve.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-mxf.xml b/docs/plugins/inspect/plugin-mxf.xml index 4428508c59..62825ec4ae 100644 --- a/docs/plugins/inspect/plugin-mxf.xml +++ b/docs/plugins/inspect/plugin-mxf.xml @@ -3,7 +3,7 @@ MXF plugin library ../../gst/mxf/.libs/libgstmxf.so libgstmxf.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-mythtv.xml b/docs/plugins/inspect/plugin-mythtv.xml index c7c533fde7..ffc8eb7aa6 100644 --- a/docs/plugins/inspect/plugin-mythtv.xml +++ b/docs/plugins/inspect/plugin-mythtv.xml @@ -3,7 +3,7 @@ lib MythTV src ../../ext/mythtv/.libs/libgstmythtvsrc.so libgstmythtvsrc.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-nas.xml b/docs/plugins/inspect/plugin-nas.xml index 488c4b2848..babcc1754e 100644 --- a/docs/plugins/inspect/plugin-nas.xml +++ b/docs/plugins/inspect/plugin-nas.xml @@ -3,7 +3,7 @@ NAS (Network Audio System) support for GStreamer ../../ext/nas/.libs/libgstnassink.so libgstnassink.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-neon.xml b/docs/plugins/inspect/plugin-neon.xml index 2fae2b6898..33fa934a83 100644 --- a/docs/plugins/inspect/plugin-neon.xml +++ b/docs/plugins/inspect/plugin-neon.xml @@ -3,7 +3,7 @@ lib neon http client src ../../ext/neon/.libs/libgstneonhttpsrc.so libgstneonhttpsrc.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-nsf.xml b/docs/plugins/inspect/plugin-nsf.xml index 2020713746..5f9cfe8ff3 100644 --- a/docs/plugins/inspect/plugin-nsf.xml +++ b/docs/plugins/inspect/plugin-nsf.xml @@ -3,7 +3,7 @@ Uses nosefart to decode .nsf files ../../gst/nsf/.libs/libgstnsf.so libgstnsf.so - 0.10.21.1 + 0.10.22.1 GPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-nuvdemux.xml b/docs/plugins/inspect/plugin-nuvdemux.xml index ae15d8c7e7..9d3d67f4ee 100644 --- a/docs/plugins/inspect/plugin-nuvdemux.xml +++ b/docs/plugins/inspect/plugin-nuvdemux.xml @@ -3,7 +3,7 @@ Demuxes MythTV NuppelVideo files ../../gst/nuvdemux/.libs/libgstnuvdemux.so libgstnuvdemux.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-ofa.xml b/docs/plugins/inspect/plugin-ofa.xml index cdc9589ac8..2a5c80779d 100644 --- a/docs/plugins/inspect/plugin-ofa.xml +++ b/docs/plugins/inspect/plugin-ofa.xml @@ -3,7 +3,7 @@ Calculate MusicIP fingerprint from audio files ../../ext/ofa/.libs/libgstofa.so libgstofa.so - 0.10.21.1 + 0.10.22.1 GPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-opencv.xml b/docs/plugins/inspect/plugin-opencv.xml index 6270b768aa..f5a7b42838 100644 --- a/docs/plugins/inspect/plugin-opencv.xml +++ b/docs/plugins/inspect/plugin-opencv.xml @@ -3,7 +3,7 @@ GStreamer OpenCV Plugins ../../ext/opencv/.libs/libgstopencv.so libgstopencv.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git @@ -198,6 +198,27 @@ + + opencvtextoverlay + opencvtextoverlay + Filter/Effect/Video + Write text on the top of video + sreerenj<bsreerenj@gmail.com> + + + sink + sink + always +
video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+ + src + source + always +
video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+
+
pyramidsegment pyramidsegment @@ -240,26 +261,5 @@ - - textwrite - textwrite - Filter/Effect/Video - Performs text writing to the video - sreerenj<bsreerenj@gmail.com> - - - sink - sink - always -
video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
-
-
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-patchdetect.xml b/docs/plugins/inspect/plugin-patchdetect.xml new file mode 100644 index 0000000000..b9efcfadda --- /dev/null +++ b/docs/plugins/inspect/plugin-patchdetect.xml @@ -0,0 +1,34 @@ + + patchdetect + patchdetect element + ../../gst/patchdetect/.libs/libgstpatchdetect.so + libgstpatchdetect.so + 0.10.22.1 + LGPL + gst-plugins-bad + GStreamer Bad Plug-ins + Unknown package origin + + + patchdetect + Color Patch Detector + Video/Analysis + Detects color patches from a color calibration chart + David Schleef <ds@entropywave.com> + + + sink + sink + always +
video/x-raw-yuv, format=(fourcc)I420, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+ + src + source + always +
video/x-raw-yuv, format=(fourcc)I420, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+
+
+
+
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-pcapparse.xml b/docs/plugins/inspect/plugin-pcapparse.xml index ebf840750d..29d2bc3372 100644 --- a/docs/plugins/inspect/plugin-pcapparse.xml +++ b/docs/plugins/inspect/plugin-pcapparse.xml @@ -3,7 +3,7 @@ Element parsing raw pcap streams ../../gst/pcapparse/.libs/libgstpcapparse.so libgstpcapparse.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer diff --git a/docs/plugins/inspect/plugin-pnm.xml b/docs/plugins/inspect/plugin-pnm.xml index c2beb44845..25678072ec 100644 --- a/docs/plugins/inspect/plugin-pnm.xml +++ b/docs/plugins/inspect/plugin-pnm.xml @@ -3,7 +3,7 @@ PNM plugin ../../gst/pnm/.libs/libgstpnm.so libgstpnm.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-qtmux.xml b/docs/plugins/inspect/plugin-qtmux.xml deleted file mode 100644 index ea5a9ac81b..0000000000 --- a/docs/plugins/inspect/plugin-qtmux.xml +++ /dev/null @@ -1,157 +0,0 @@ - - qtmux - Quicktime Muxer plugin - ../../gst/qtmux/.libs/libgstqtmux.so - libgstqtmux.so - 0.10.21.1 - LGPL - gst-plugins-bad - GStreamer Bad Plug-ins git - Unknown package origin - - - gppmux - 3GPP Muxer - Codec/Muxer - Multiplex audio and video into a 3GPP file - Thiago Sousa Santos <thiagoss@embedded.ufcg.edu.br> - - - audio_%d - sink - request -
audio/AMR, rate=(int)8000, channels=(int)[ 1, 2 ]; audio/AMR-WB, rate=(int)16000, channels=(int)[ 1, 2 ]; audio/mpeg, mpegversion=(int)1, layer=(int)3, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]; audio/mpeg, mpegversion=(int)4, stream-format=(string)raw, channels=(int)[ 1, 8 ], rate=(int)[ 1, 2147483647 ]
-
- - video_%d - sink - request -
video/x-h263, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/mpeg, mpegversion=(int)4, systemstream=(boolean)false, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-divx, divxversion=(int)5, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-h264, stream-format=(string)avc, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/quicktime, variant=(string)3gpp
-
-
-
- - ismlmux - ISML Muxer - Codec/Muxer - Multiplex audio and video into a ISML file - Thiago Sousa Santos <thiagoss@embedded.ufcg.edu.br> - - - audio_%d - sink - request -
audio/mpeg, mpegversion=(int)1, layer=(int)3, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]; audio/mpeg, mpegversion=(int)4, stream-format=(string)raw, channels=(int)[ 1, 8 ], rate=(int)[ 1, 2147483647 ]
-
- - video_%d - sink - request -
video/mpeg, mpegversion=(int)4, systemstream=(boolean)false, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-divx, divxversion=(int)5, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-h264, stream-format=(string)avc, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/quicktime, variant=(string)iso
-
-
-
- - mj2mux - MJ2 Muxer - Codec/Muxer - Multiplex audio and video into a MJ2 file - Thiago Sousa Santos <thiagoss@embedded.ufcg.edu.br> - - - audio_%d - sink - request -
audio/x-raw-int, width=(int)8, depth=(int)8, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean){ true, false }; audio/x-raw-int, width=(int)16, depth=(int)16, endianness=(int){ 4321, 1234 }, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean)true
-
- - video_%d - sink - request -
image/x-j2c, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; image/x-jpc, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/mj2
-
-
-
- - mp4mux - MP4 Muxer - Codec/Muxer - Multiplex audio and video into a MP4 file - Thiago Sousa Santos <thiagoss@embedded.ufcg.edu.br> - - - audio_%d - sink - request -
audio/mpeg, mpegversion=(int)1, layer=(int)3, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]; audio/mpeg, mpegversion=(int)4, stream-format=(string)raw, channels=(int)[ 1, 8 ], rate=(int)[ 1, 2147483647 ]; audio/x-alac, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]
-
- - video_%d - sink - request -
video/mpeg, mpegversion=(int)4, systemstream=(boolean)false, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-divx, divxversion=(int)5, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-h264, stream-format=(string)avc, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-mp4-part, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/quicktime, variant=(string)iso
-
-
-
- - qtmoovrecover - QT Moov Recover - Util - Recovers unfinished qtmux files - Thiago Santos <thiago.sousa.santos@collabora.co.uk> - - - - - qtmux - QuickTime Muxer - Codec/Muxer - Multiplex audio and video into a QuickTime file - Thiago Sousa Santos <thiagoss@embedded.ufcg.edu.br> - - - audio_%d - sink - request -
audio/x-raw-int, width=(int)8, depth=(int)8, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean){ true, false }; audio/x-raw-int, width=(int)16, depth=(int)16, endianness=(int){ 4321, 1234 }, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean)true; audio/x-raw-int, width=(int)24, depth=(int)24, endianness=(int){ 4321, 1234 }, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean)true; audio/x-raw-int, width=(int)32, depth=(int)32, endianness=(int){ 4321, 1234 }, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ], signed=(boolean)true; audio/mpeg, mpegversion=(int)1, layer=(int)3, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]; audio/mpeg, mpegversion=(int)4, stream-format=(string)raw, channels=(int)[ 1, 8 ], rate=(int)[ 1, 2147483647 ]; audio/x-adpcm, layout=(string)dvi, block_align=(int)[ 64, 8096 ], channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]; audio/x-alaw, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]; audio/AMR, rate=(int)8000, channels=(int)[ 1, 2 ]; audio/AMR-WB, rate=(int)16000, channels=(int)[ 1, 2 ]; audio/x-alac, channels=(int)[ 1, 2 ], rate=(int)[ 1, 2147483647 ]
-
- - video_%d - sink - request -
video/x-raw-rgb, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/mpeg, mpegversion=(int)4, systemstream=(boolean)false, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-divx, divxversion=(int)5, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-h263, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-h264, stream-format=(string)avc, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-svq, svqversion=(int)3, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-dv, systemstream=(boolean)false, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; image/jpeg, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ]; video/x-vp8, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-qt-part, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
-
- - src - source - always -
video/quicktime, variant=(string)apple
-
-
-
-
-
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-rawparse.xml b/docs/plugins/inspect/plugin-rawparse.xml index 0cbe1ce654..aa943cf463 100644 --- a/docs/plugins/inspect/plugin-rawparse.xml +++ b/docs/plugins/inspect/plugin-rawparse.xml @@ -3,7 +3,7 @@ Parses byte streams into raw frames ../../gst/rawparse/.libs/libgstrawparse.so libgstrawparse.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-real.xml b/docs/plugins/inspect/plugin-real.xml index 44b59fe0a8..280285269a 100644 --- a/docs/plugins/inspect/plugin-real.xml +++ b/docs/plugins/inspect/plugin-real.xml @@ -3,7 +3,7 @@ Decode REAL streams ../../gst/real/.libs/libgstreal.so libgstreal.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-resindvd.xml b/docs/plugins/inspect/plugin-resindvd.xml index 5081bcfec8..bda861cefa 100644 --- a/docs/plugins/inspect/plugin-resindvd.xml +++ b/docs/plugins/inspect/plugin-resindvd.xml @@ -3,7 +3,7 @@ Resin DVD playback elements ../../ext/resindvd/.libs/libresindvd.so libresindvd.so - 0.10.21.1 + 0.10.22.1 GPL gst-plugins-bad GStreamer diff --git a/docs/plugins/inspect/plugin-rfbsrc.xml b/docs/plugins/inspect/plugin-rfbsrc.xml index 245aadf9bd..fe5aba0c45 100644 --- a/docs/plugins/inspect/plugin-rfbsrc.xml +++ b/docs/plugins/inspect/plugin-rfbsrc.xml @@ -3,7 +3,7 @@ Connects to a VNC server and decodes RFB stream ../../gst/librfb/.libs/libgstrfbsrc.so libgstrfbsrc.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-rsvg.xml b/docs/plugins/inspect/plugin-rsvg.xml index 3b94b9ea1c..4b0c0d0f8d 100644 --- a/docs/plugins/inspect/plugin-rsvg.xml +++ b/docs/plugins/inspect/plugin-rsvg.xml @@ -3,7 +3,7 @@ RSVG plugin library ../../ext/rsvg/.libs/libgstrsvg.so libgstrsvg.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-rtmpsrc.xml b/docs/plugins/inspect/plugin-rtmpsrc.xml index 007979cdcb..c85740938f 100644 --- a/docs/plugins/inspect/plugin-rtmpsrc.xml +++ b/docs/plugins/inspect/plugin-rtmpsrc.xml @@ -3,7 +3,7 @@ RTMP source ../../ext/rtmp/.libs/libgstrtmp.so libgstrtmp.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-rtpmux.xml b/docs/plugins/inspect/plugin-rtpmux.xml index 27351aff92..5197e06679 100644 --- a/docs/plugins/inspect/plugin-rtpmux.xml +++ b/docs/plugins/inspect/plugin-rtpmux.xml @@ -3,7 +3,7 @@ RTP Muxer plugins ../../gst/rtpmux/.libs/libgstrtpmux.so libgstrtpmux.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-rtpvp8.xml b/docs/plugins/inspect/plugin-rtpvp8.xml index db2051ec91..e86fbab2d3 100644 --- a/docs/plugins/inspect/plugin-rtpvp8.xml +++ b/docs/plugins/inspect/plugin-rtpvp8.xml @@ -3,7 +3,7 @@ rtpvp8 ../../gst/rtpvp8/.libs/libgstrtpvp8.so libgstrtpvp8.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-scaletempo.xml b/docs/plugins/inspect/plugin-scaletempo.xml index 347dd9c3c4..4e23f80b0d 100644 --- a/docs/plugins/inspect/plugin-scaletempo.xml +++ b/docs/plugins/inspect/plugin-scaletempo.xml @@ -3,7 +3,7 @@ Scale audio tempo in sync with playback rate ../../gst/scaletempo/.libs/libgstscaletempoplugin.so libgstscaletempoplugin.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer diff --git a/docs/plugins/inspect/plugin-schro.xml b/docs/plugins/inspect/plugin-schro.xml index 59e7549e68..0aa6248d01 100644 --- a/docs/plugins/inspect/plugin-schro.xml +++ b/docs/plugins/inspect/plugin-schro.xml @@ -3,7 +3,7 @@ Schroedinger plugin ../../ext/schroedinger/.libs/libgstschro.so libgstschro.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-sdi.xml b/docs/plugins/inspect/plugin-sdi.xml new file mode 100644 index 0000000000..36b1d3ed79 --- /dev/null +++ b/docs/plugins/inspect/plugin-sdi.xml @@ -0,0 +1,55 @@ + + sdi + SDI elements + ../../gst/sdi/.libs/libgstsdi.so + libgstsdi.so + 0.10.22.1 + LGPL + gst-plugins-bad + GStreamer Bad Plug-ins + Unknown package origin + + + sdidemux + SDI Demuxer + Demuxer + Demultiplex SDI streams into raw audio and video + David Schleef <ds@schleef.org> + + + sink + sink + always +
application/x-raw-sdi
+
+ + src + source + always +
video/x-raw-yuv, format=(fourcc)UYVY, width=(int)720, height=(int)480, framerate=(fraction)30000/1001, interlaced=(boolean)true, pixel-aspect-ratio=(fraction)10/11, chroma-site=(string)mpeg2, color-matrix=(string)sdtv; video/x-raw-yuv, format=(fourcc)UYVY, width=(int)720, height=(int)576, framerate=(fraction)25/1, interlaced=(boolean)true, pixel-aspect-ratio=(fraction)12/11, chroma-site=(string)mpeg2, color-matrix=(string)sdtv
+
+
+
+ + sdimux + SDI Muxer + Muxer + Multiplex raw audio and video into SDI + David Schleef <ds@schleef.org> + + + sink + sink + always +
video/x-raw-yuv, format=(fourcc){ UYVY, v210 }, width=(int)720, height=(int)480, framerate=(fraction)30000/1001, interlaced=(boolean)true, pixel-aspect-ratio=(fraction)10/11, chroma-site=(string)mpeg2, color-matrix=(string)sdtv; video/x-raw-yuv, format=(fourcc){ UYVY, v210 }, width=(int)720, height=(int)576, framerate=(fraction)25/1, interlaced=(boolean)true, pixel-aspect-ratio=(fraction)12/11, chroma-site=(string)mpeg2, color-matrix=(string)sdtv
+
+ + src + source + always +
application/x-raw-sdi, rate=(int)270, format=(fourcc){ UYVY, v210 }
+
+
+
+
+
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-sdl.xml b/docs/plugins/inspect/plugin-sdl.xml index b6a98cbc5f..0693f8a8df 100644 --- a/docs/plugins/inspect/plugin-sdl.xml +++ b/docs/plugins/inspect/plugin-sdl.xml @@ -3,7 +3,7 @@ SDL (Simple DirectMedia Layer) support for GStreamer ../../ext/sdl/.libs/libgstsdl.so libgstsdl.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-sdp.xml b/docs/plugins/inspect/plugin-sdp.xml index 77f4f631fb..3cd1321af0 100644 --- a/docs/plugins/inspect/plugin-sdp.xml +++ b/docs/plugins/inspect/plugin-sdp.xml @@ -3,7 +3,7 @@ configure streaming sessions using SDP ../../gst/sdp/.libs/libgstsdpelem.so libgstsdpelem.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-segmentclip.xml b/docs/plugins/inspect/plugin-segmentclip.xml index 3e2e837b60..95dd0013ed 100644 --- a/docs/plugins/inspect/plugin-segmentclip.xml +++ b/docs/plugins/inspect/plugin-segmentclip.xml @@ -3,7 +3,7 @@ Segment clip elements ../../gst/segmentclip/.libs/libgstsegmentclip.so libgstsegmentclip.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-shm.xml b/docs/plugins/inspect/plugin-shm.xml index bd2f46df01..364a0cece1 100644 --- a/docs/plugins/inspect/plugin-shm.xml +++ b/docs/plugins/inspect/plugin-shm.xml @@ -3,7 +3,7 @@ shared memory sink source ../../sys/shm/.libs/libgstshm.so libgstshm.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git @@ -29,7 +29,7 @@ Shared Memory Source Source Receive data from the sharem memory sink - Olivier Crete <olivier.crete@collabora.co.uk + Olivier Crete <olivier.crete@collabora.co.uk> src diff --git a/docs/plugins/inspect/plugin-sndfile.xml b/docs/plugins/inspect/plugin-sndfile.xml index bc014bd923..1b08aad05c 100644 --- a/docs/plugins/inspect/plugin-sndfile.xml +++ b/docs/plugins/inspect/plugin-sndfile.xml @@ -3,7 +3,7 @@ use libsndfile to read and write audio from and to files ../../ext/sndfile/.libs/libgstsndfile.so libgstsndfile.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-soundtouch.xml b/docs/plugins/inspect/plugin-soundtouch.xml index bc4817fac2..17797310d2 100644 --- a/docs/plugins/inspect/plugin-soundtouch.xml +++ b/docs/plugins/inspect/plugin-soundtouch.xml @@ -3,7 +3,7 @@ Audio Pitch Controller & BPM Detection ../../ext/soundtouch/.libs/libgstsoundtouch.so libgstsoundtouch.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-speed.xml b/docs/plugins/inspect/plugin-speed.xml index 487a7f9d7e..1408eebcc5 100644 --- a/docs/plugins/inspect/plugin-speed.xml +++ b/docs/plugins/inspect/plugin-speed.xml @@ -3,7 +3,7 @@ Set speed/pitch on audio/raw streams (resampler) ../../gst/speed/.libs/libgstspeed.so libgstspeed.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-stereo.xml b/docs/plugins/inspect/plugin-stereo.xml index fc7f5e2c32..89fd60d6ee 100644 --- a/docs/plugins/inspect/plugin-stereo.xml +++ b/docs/plugins/inspect/plugin-stereo.xml @@ -3,7 +3,7 @@ Muck with the stereo signal, enhance it's 'stereo-ness' ../../gst/stereo/.libs/libgststereo.so libgststereo.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-subenc.xml b/docs/plugins/inspect/plugin-subenc.xml index 9c37f4ca86..5e7de4de82 100644 --- a/docs/plugins/inspect/plugin-subenc.xml +++ b/docs/plugins/inspect/plugin-subenc.xml @@ -3,7 +3,7 @@ subtitle encoders ../../gst/subenc/.libs/libgstsubenc.so libgstsubenc.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-timidity.xml b/docs/plugins/inspect/plugin-timidity.xml index cfc6c12cfb..7b9b4540b4 100644 --- a/docs/plugins/inspect/plugin-timidity.xml +++ b/docs/plugins/inspect/plugin-timidity.xml @@ -3,11 +3,11 @@ Timidity Plugin ../../ext/timidity/.libs/libgsttimidity.so libgsttimidity.so - 0.10.14.1 + 0.10.22.1 GPL gst-plugins-bad - GStreamer Bad Plug-ins git/prerelease - http://gstreamer.freedesktop.org + GStreamer Bad Plug-ins git + Unknown package origin timidity diff --git a/docs/plugins/inspect/plugin-tta.xml b/docs/plugins/inspect/plugin-tta.xml index 46fa202bca..c40acd26c7 100644 --- a/docs/plugins/inspect/plugin-tta.xml +++ b/docs/plugins/inspect/plugin-tta.xml @@ -3,7 +3,7 @@ TTA lossless audio format handling ../../gst/tta/.libs/libgsttta.so libgsttta.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-vcdsrc.xml b/docs/plugins/inspect/plugin-vcdsrc.xml index 0a89e414da..1e71ecfc9f 100644 --- a/docs/plugins/inspect/plugin-vcdsrc.xml +++ b/docs/plugins/inspect/plugin-vcdsrc.xml @@ -3,7 +3,7 @@ Asynchronous read from VCD disk ../../sys/vcd/.libs/libgstvcdsrc.so libgstvcdsrc.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-video3d.xml b/docs/plugins/inspect/plugin-video3d.xml new file mode 100644 index 0000000000..ec7fdd76b8 --- /dev/null +++ b/docs/plugins/inspect/plugin-video3d.xml @@ -0,0 +1,82 @@ + + video3d + Video 3D handling + ../../gst/video3d/.libs/libgstvideo3d.so + libgstvideo3d.so + 0.10.19.1 + LGPL + gst-plugins-bad + GStreamer + http://gstreamer.net/ + + + video3dconvert + Video3DConvert + Generic/Video + Convert normal streams in 3D streams + Martin Bisson <martin.bisson@gmail.com> + + + sink + sink + always +
video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)16, endianness=(int)1234, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)15, endianness=(int)1234, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc){ YUY2, YVYU, UYVY, Y800, GREY, Y8 , Y16 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray, bpp=(int)8, depth=(int)8, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray, bpp=(int)16, depth=(int)16, endianness=(int){ 1234, 4321 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+ + src + source + always +
video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)16, depth=(int)16, endianness=(int)1234, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)16, depth=(int)15, endianness=(int)1234, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv-stereo, layout=(int){ 1122, 1212 }, format=(fourcc){ YUY2, YVYU, UYVY, Y800, GREY, Y8 , Y16 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray-stereo, bpp=(int)8, depth=(int)8, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray-stereo, bpp=(int)16, depth=(int)16, endianness=(int){ 1234, 4321 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+
+
+ + video3dmerge + Video3DMerge + Generic/Video + Merges left and right video stream into a 3D stream + Martin Bisson <martin.bisson@gmail.com> + + + left_sink + sink + always +
video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)16, endianness=(int)1234, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)15, endianness=(int)1234, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc){ YUY2, YVYU, UYVY, Y800, GREY, Y8 , Y16 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray, bpp=(int)8, depth=(int)8, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray, bpp=(int)16, depth=(int)16, endianness=(int){ 1234, 4321 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+ + right_sink + sink + always +
video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)16, endianness=(int)1234, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)15, endianness=(int)1234, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc){ YUY2, YVYU, UYVY, Y800, GREY, Y8 , Y16 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray, bpp=(int)8, depth=(int)8, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray, bpp=(int)16, depth=(int)16, endianness=(int){ 1234, 4321 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+ + src + source + always +
video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)16, depth=(int)16, endianness=(int)1234, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)16, depth=(int)15, endianness=(int)1234, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv-stereo, layout=(int){ 1122, 1212 }, format=(fourcc){ YUY2, YVYU, UYVY, Y800, GREY, Y8 , Y16 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray-stereo, bpp=(int)8, depth=(int)8, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray-stereo, bpp=(int)16, depth=(int)16, endianness=(int){ 1234, 4321 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+
+
+ + video3dpresent + Video3DPresent + Generic/Video + Presents 3D stream in various layouts and modes + Martin Bisson <martin.bisson@gmail.com> + + + sink + sink + always +
video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)16, depth=(int)16, endianness=(int)1234, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb-stereo, layout=(int){ 1122, 1212 }, bpp=(int)16, depth=(int)15, endianness=(int)1234, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv-stereo, layout=(int){ 1122, 1212 }, format=(fourcc){ YUY2, YVYU, UYVY, Y800, GREY, Y8 , Y16 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray-stereo, bpp=(int)8, depth=(int)8, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray-stereo, bpp=(int)16, depth=(int)16, endianness=(int){ 1234, 4321 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+ + src + source + always +
video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)-16777216, green_mask=(int)16711680, blue_mask=(int)65280, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)16711680, green_mask=(int)65280, blue_mask=(int)255, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)16, endianness=(int)1234, red_mask=(int)63488, green_mask=(int)2016, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-rgb, bpp=(int)16, depth=(int)15, endianness=(int)1234, red_mask=(int)31744, green_mask=(int)992, blue_mask=(int)31, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-yuv, format=(fourcc){ YUY2, YVYU, UYVY, Y800, GREY, Y8 , Y16 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray, bpp=(int)8, depth=(int)8, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/x-raw-gray, bpp=(int)16, depth=(int)16, endianness=(int){ 1234, 4321 }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
+
+
+
+
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-videofiltersbad.xml b/docs/plugins/inspect/plugin-videofiltersbad.xml new file mode 100644 index 0000000000..2d125eacfd --- /dev/null +++ b/docs/plugins/inspect/plugin-videofiltersbad.xml @@ -0,0 +1,55 @@ + + videofiltersbad + Video filters in gst-plugins-bad + ../../gst/videofilters/.libs/libgstvideofiltersbad.so + libgstvideofiltersbad.so + 0.10.22.1 + LGPL + gst-plugins-bad + GStreamer Bad Plug-ins + Unknown package origin + + + scenechange + Scene change detector + Video/Filter + Detects scene changes in video + David Schleef <ds@entropywave.com> + + + sink + sink + always +
video/x-raw-yuv, format=(fourcc)I420, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)[ 0/1, 2147483647/1 ], interlaced=(boolean){ true, false }
+
+ + src + source + always +
video/x-raw-yuv, format=(fourcc)I420, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)[ 0/1, 2147483647/1 ], interlaced=(boolean){ true, false }
+
+
+
+ + zebrastripe + Zebra stripe overlay + Filter/Analysis + Overlays zebra striping on overexposed areas of video + David Schleef <ds@entropywave.com> + + + sink + sink + always +
video/x-raw-yuv, format=(fourcc)I420, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)[ 0/1, 2147483647/1 ], interlaced=(boolean){ true, false }
+
+ + src + source + always +
video/x-raw-yuv, format=(fourcc)I420, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], pixel-aspect-ratio=(fraction)[ 0/1, 2147483647/1 ], interlaced=(boolean){ true, false }
+
+
+
+
+
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-videomaxrate.xml b/docs/plugins/inspect/plugin-videomaxrate.xml index aced0ff963..ca9ccb4ba7 100644 --- a/docs/plugins/inspect/plugin-videomaxrate.xml +++ b/docs/plugins/inspect/plugin-videomaxrate.xml @@ -3,7 +3,7 @@ Drop extra frames ../../gst/videomaxrate/.libs/libgstvideomaxrate.so libgstvideomaxrate.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-videomeasure.xml b/docs/plugins/inspect/plugin-videomeasure.xml index 6f6287d7ad..2ed7894936 100644 --- a/docs/plugins/inspect/plugin-videomeasure.xml +++ b/docs/plugins/inspect/plugin-videomeasure.xml @@ -3,7 +3,7 @@ Various video measurers ../../gst/videomeasure/.libs/libgstvideomeasure.so libgstvideomeasure.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-videoparsersbad.xml b/docs/plugins/inspect/plugin-videoparsersbad.xml index c961f44b89..58d93db214 100644 --- a/docs/plugins/inspect/plugin-videoparsersbad.xml +++ b/docs/plugins/inspect/plugin-videoparsersbad.xml @@ -3,7 +3,7 @@ videoparsers ../../gst/videoparsers/.libs/libgstvideoparsersbad.so libgstvideoparsersbad.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git @@ -11,22 +11,22 @@ diracparse - FIXME - Generic - FIXME + Dirac parser + Codec/Parser/Video + Parses Dirac streams David Schleef <ds@schleef.org> sink sink always -
application/unknown
+
video/x-dirac, parsed=(boolean)false
src source always -
application/unknown
+
video/x-dirac, parsed=(boolean)true
@@ -72,5 +72,26 @@
+ + mpegvideoparse + MPEG video elementary stream parser + Codec/Parser/Video + Parses and frames MPEG-1 and MPEG-2 elementary video streams + Wim Taymans <wim.taymans@ccollabora.co.uk>, Jan Schmidt <thaytan@mad.scientist.com>, Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> + + + sink + sink + always +
video/mpeg, mpegversion=(int)4, parsed=(boolean)false, systemstream=(boolean)false
+
+ + src + source + always +
video/mpeg, mpegversion=(int)[ 1, 2 ], parsed=(boolean)true, systemstream=(boolean)false
+
+
+
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-videosignal.xml b/docs/plugins/inspect/plugin-videosignal.xml index bed6211b1d..a3cfd021ec 100644 --- a/docs/plugins/inspect/plugin-videosignal.xml +++ b/docs/plugins/inspect/plugin-videosignal.xml @@ -3,7 +3,7 @@ Various video signal analysers ../../gst/videosignal/.libs/libgstvideosignal.so libgstvideosignal.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-vmnc.xml b/docs/plugins/inspect/plugin-vmnc.xml index 4297561031..97268e82f0 100644 --- a/docs/plugins/inspect/plugin-vmnc.xml +++ b/docs/plugins/inspect/plugin-vmnc.xml @@ -3,7 +3,7 @@ VmWare Video Codec plugins ../../gst/vmnc/.libs/libgstvmnc.so libgstvmnc.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-voaacenc.xml b/docs/plugins/inspect/plugin-voaacenc.xml new file mode 100644 index 0000000000..2f6baa356e --- /dev/null +++ b/docs/plugins/inspect/plugin-voaacenc.xml @@ -0,0 +1,34 @@ + + voaacenc + AAC audio encoder + ../../ext/voaacenc/.libs/libgstvoaacenc.so + libgstvoaacenc.so + 0.10.21.2 + LGPL + gst-plugins-bad + GStreamer Bad Plug-ins prerelease + Unknown package origin + + + voaacenc + AAC audio encoder + Codec/Encoder/Audio + AAC audio encoder + Kan Hu <kan.hu@linaro.org> + + + sink + sink + always +
audio/x-raw-int, width=(int)16, depth=(int)16, signed=(boolean)true, endianness=(int)1234, rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 6 ]
+
+ + src + source + always +
audio/mpeg, mpegversion=(int)4, rate=(int)[ 8000, 96000 ], channels=(int)[ 1, 6 ], stream-format=(string){ adts, raw }
+
+
+
+
+
\ No newline at end of file diff --git a/docs/plugins/inspect/plugin-vp8.xml b/docs/plugins/inspect/plugin-vp8.xml index ce75b4273c..30b7062519 100644 --- a/docs/plugins/inspect/plugin-vp8.xml +++ b/docs/plugins/inspect/plugin-vp8.xml @@ -3,7 +3,7 @@ VP8 plugin ../../ext/vp8/.libs/libgstvp8.so libgstvp8.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-wildmidi.xml b/docs/plugins/inspect/plugin-wildmidi.xml index 0de455b497..bc4fa9f77e 100644 --- a/docs/plugins/inspect/plugin-wildmidi.xml +++ b/docs/plugins/inspect/plugin-wildmidi.xml @@ -3,7 +3,7 @@ Wildmidi Plugin ../../ext/timidity/.libs/libgstwildmidi.so libgstwildmidi.so - 0.10.21.1 + 0.10.22.1 GPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/docs/plugins/inspect/plugin-xvid.xml b/docs/plugins/inspect/plugin-xvid.xml index 16a9fea272..eca1e9929f 100644 --- a/docs/plugins/inspect/plugin-xvid.xml +++ b/docs/plugins/inspect/plugin-xvid.xml @@ -3,7 +3,7 @@ XviD plugin library ../../ext/xvid/.libs/libgstxvid.so libgstxvid.so - 0.10.21.1 + 0.10.22.1 GPL gst-plugins-bad GStreamer Bad Plug-ins git @@ -20,7 +20,7 @@ sink sink always -
video/x-xvid, width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
+
video/x-xvid, width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]; video/mpeg, mpegversion=(int)4, systemstream=(boolean)false, width=(int)[ 0, 2147483647 ], height=(int)[ 0, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
src diff --git a/docs/plugins/inspect/plugin-y4mdec.xml b/docs/plugins/inspect/plugin-y4mdec.xml index ab20ae84ea..b45e2b2631 100644 --- a/docs/plugins/inspect/plugin-y4mdec.xml +++ b/docs/plugins/inspect/plugin-y4mdec.xml @@ -1,9 +1,9 @@ y4mdec - FIXME + Demuxes/decodes YUV4MPEG streams ../../gst/y4m/.libs/libgsty4mdec.so libgsty4mdec.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins diff --git a/docs/plugins/inspect/plugin-zbar.xml b/docs/plugins/inspect/plugin-zbar.xml index b160fe54b1..3e4abd6b1d 100644 --- a/docs/plugins/inspect/plugin-zbar.xml +++ b/docs/plugins/inspect/plugin-zbar.xml @@ -3,7 +3,7 @@ zbar barcode scanner ../../ext/zbar/.libs/libgstzbar.so libgstzbar.so - 0.10.21.1 + 0.10.22.1 LGPL gst-plugins-bad GStreamer Bad Plug-ins git diff --git a/ext/Makefile.am b/ext/Makefile.am index 142ce1d3a1..70d4c69c31 100644 --- a/ext/Makefile.am +++ b/ext/Makefile.am @@ -4,10 +4,10 @@ else ASSRENDER_DIR = endif -if USE_AMRWB -AMRWB_DIR = amrwbenc +if USE_VOAMRWBENC +VOAMRWBENC_DIR = voamrwbenc else -AMRWB_DIR = +VOAMRWBENC_DIR = endif if USE_APEXSINK @@ -118,6 +118,12 @@ else FAAD_DIR= endif +if USE_VOAACENC + VOAACENC_DIR=voaacenc +else + VOAACENC_DIR= +endif + if USE_FLITE FLITE_DIR=flite else @@ -244,6 +250,12 @@ else OFA_DIR= endif +if USE_OPENAL +OPENAL_DIR=openal +else +OPENAL_DIR= +endif + if USE_OPENCV OPENCV_DIR=opencv else @@ -324,18 +336,12 @@ else SWFDEC_DIR= endif -if USE_THEORADEC -#THEORA_DIR = theora +if USE_TELETEXTDEC +TELETEXT_DIR=teletextdec else -THEORA_DIR = +TELETEXT_DIR= endif -# if USE_TARKIN -# TARKIN_DIR=tarkin -# else -TARKIN_DIR= -# endif - if USE_VP8 VP8_DIR=vp8 else @@ -348,12 +354,6 @@ else GSETTINGS_DIR= endif -# if USE_XINE -# XINE_DIR=xine -# else -XINE_DIR= -# endif - if USE_XVID XVID_DIR=xvid else @@ -374,8 +374,9 @@ endif SUBDIRS=\ + $(VOAACENC_DIR) \ $(ASSRENDER_DIR) \ - $(AMRWB_DIR) \ + $(VOAMRWBENC_DIR) \ $(APEXSINK_DIR) \ $(ARTS_DIR) \ $(ARTSC_DIR) \ @@ -416,6 +417,7 @@ SUBDIRS=\ $(NAS_DIR) \ $(NEON_DIR) \ $(OFA_DIR) \ + $(OPENAL_DIR) \ $(OPENCV_DIR) \ $(RSVG_DIR) \ $(SCHRO_DIR) \ @@ -427,17 +429,14 @@ SUBDIRS=\ $(GME_DIR) \ $(SPC_DIR) \ $(SWFDEC_DIR) \ - $(TARKIN_DIR) \ - $(THEORA_DIR) \ + $(TELETEXTDEC_DIR) \ $(TIMIDITY_DIR) \ $(VP8_DIR) \ - $(XINE_DIR) \ $(XVID_DIR) \ $(ZBAR_DIR) \ $(RTMP_DIR) DIST_SUBDIRS = \ - amrwbenc \ assrender \ apexsink \ bz2 \ @@ -470,6 +469,7 @@ DIST_SUBDIRS = \ nas \ neon \ ofa \ + openal \ opencv \ rsvg \ resindvd \ @@ -480,8 +480,10 @@ DIST_SUBDIRS = \ spc \ gme \ swfdec \ - theora \ + teletextdec \ timidity \ + voaacenc \ + voamrwbenc \ vp8 \ xvid \ zbar \ diff --git a/ext/amrwbenc/Makefile.am b/ext/amrwbenc/Makefile.am deleted file mode 100644 index 4c4ea3b333..0000000000 --- a/ext/amrwbenc/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -plugin_LTLIBRARIES = libgstamrwbenc.la - -libgstamrwbenc_la_SOURCES = \ - gstamrwb.c \ - gstamrwbenc.c - -libgstamrwbenc_la_CFLAGS = $(GST_CFLAGS) $(AMRWB_CFLAGS) -libgstamrwbenc_la_LIBADD = $(GST_BASE_LIBS) $(AMRWB_LIBS) -libgstamrwbenc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -libgstamrwbenc_la_LIBTOOLFLAGS = --tag=disable-static - -noinst_HEADERS = \ - gstamrwbenc.h - -presetdir = $(datadir)/gstreamer-$(GST_MAJORMINOR)/presets -preset_DATA = GstAmrwbEnc.prs - -EXTRA_DIST = $(preset_DATA) - diff --git a/ext/amrwbenc/README b/ext/amrwbenc/README deleted file mode 100644 index 9d1587282e..0000000000 --- a/ext/amrwbenc/README +++ /dev/null @@ -1,12 +0,0 @@ -Compiling AMRWB encoder: -======================== - -To compile the amrwb encoder, you need to download the source code from -"http://www.3gpp.org/ftp/Specs/html-info/26204.htm" and uncompress the -files inside an amrwb-code directory; - -or execute this commands: -$cd amrwb-code -$sh ./run.sh - -and run the "autogen" script again. diff --git a/ext/apexsink/gstapexraop.c b/ext/apexsink/gstapexraop.c index 4d07674b0d..04c49a2b3d 100644 --- a/ext/apexsink/gstapexraop.c +++ b/ext/apexsink/gstapexraop.c @@ -52,14 +52,15 @@ 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[] = { +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; +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; @@ -121,6 +122,9 @@ typedef struct 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 */ @@ -130,12 +134,18 @@ typedef struct 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) +gst_apexraop_new (const gchar * host, + const guint16 port, + const GstApExGeneration generation, + const GstApExTransportProtocol transport_protocol) { _GstApExRAOP *apexraop; @@ -146,6 +156,10 @@ gst_apexraop_new (const gchar * host, const guint16 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; } @@ -311,7 +325,9 @@ gst_apexraop_connect (GstApExRAOP * con) conn->url_abspath, inaddr, conn->host, - GST_APEX_RAOP_SAMPLES_PER_FRAME, + 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); @@ -451,8 +467,14 @@ gst_apexraop_connect (GstApExRAOP * con) if (res != GST_RTSP_STS_OK) return res; - if ((conn->data_sd = socket (AF_INET, SOCK_STREAM, 0)) < 0) - return GST_RTSP_STS_DESTINATION_UNREACHABLE; + 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); @@ -495,6 +517,34 @@ gst_apexraop_get_jackstatus (GstApExRAOP * con) 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) @@ -628,25 +678,49 @@ gst_apexraop_write (GstApExRAOP * con, gpointer rawdata, guint length) gushort len; gint bit_offset, byte_offset, i, out_len, res; EVP_CIPHER_CTX aes_ctx; - _GstApExRAOP *conn; - - conn = (_GstApExRAOP *) con; + _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 (GST_APEX_RAOP_FRAME_HEADER_SIZE + + (guchar *) g_malloc0 (frame_header_size + GST_APEX_RAOP_ALAC_HEADER_SIZE + length); - memcpy (buffer, GST_APEX_RAOP_FRAME_HEADER, GST_APEX_RAOP_FRAME_HEADER_SIZE); + 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 + GST_APEX_RAOP_FRAME_HEADER_SIZE + - GST_APEX_RAOP_ALAC_HEADER_SIZE - 4; - buffer[2] = len >> 8; - buffer[3] = len & 0xff; + 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 + GST_APEX_RAOP_FRAME_HEADER_SIZE; + 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 */ @@ -673,16 +747,14 @@ gst_apexraop_write (GstApExRAOP * con, gpointer rawdata, guint length) res = gst_apexraop_send (conn->data_sd, buffer, - GST_APEX_RAOP_FRAME_HEADER_SIZE + GST_APEX_RAOP_ALAC_HEADER_SIZE + - length); + frame_header_size + GST_APEX_RAOP_ALAC_HEADER_SIZE + length); g_free (buffer); return (guint) ((res >= - (GST_APEX_RAOP_FRAME_HEADER_SIZE + + (frame_header_size + GST_APEX_RAOP_ALAC_HEADER_SIZE)) ? (res - - GST_APEX_RAOP_FRAME_HEADER_SIZE - - GST_APEX_RAOP_ALAC_HEADER_SIZE) : 0); + frame_header_size - GST_APEX_RAOP_ALAC_HEADER_SIZE) : 0); } /* raop apex buffer flush */ @@ -701,10 +773,13 @@ gst_apexraop_flush (GstApExRAOP * con) "Client-Instance: %s\r\n" "User-Agent: %s\r\n" "Session: %s\r\n" - "RTP-Info: seq=0;rtptime=0\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->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; diff --git a/ext/apexsink/gstapexraop.h b/ext/apexsink/gstapexraop.h index fe1ba41b7c..462118e231 100644 --- a/ext/apexsink/gstapexraop.h +++ b/ext/apexsink/gstapexraop.h @@ -48,7 +48,8 @@ G_BEGIN_DECLS /* raop fixed parameters */ #define GST_APEX_RAOP_BITRATE 44100 -#define GST_APEX_RAOP_SAMPLES_PER_FRAME 4096 +#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) @@ -78,13 +79,30 @@ typedef enum } 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); +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 */ @@ -118,6 +136,12 @@ GstRTSPStatusCode gst_apexraop_flush (GstApExRAOP * conn); 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 index 8daaa23fc3..fc64db83a4 100644 --- a/ext/apexsink/gstapexsink.c +++ b/ext/apexsink/gstapexsink.c @@ -59,6 +59,8 @@ enum APEX_PROP_VOLUME, APEX_PROP_JACK_TYPE, APEX_PROP_JACK_STATUS, + APEX_PROP_GENERATION, + APEX_PROP_TRANSPORT_PROTOCOL, }; #define DEFAULT_APEX_HOST "" @@ -66,6 +68,8 @@ enum #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 @@ -108,6 +112,43 @@ gst_apexsink_jacktype_get_type (void) return jacktype_type; } +GType +gst_apexsink_generation_get_type (void) +{ + static GType generation_type = 0; + static 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 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); @@ -124,6 +165,8 @@ 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); @@ -252,6 +295,9 @@ gst_apexsink_class_init (GstApExSinkClass * klass) ((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)); @@ -275,6 +321,17 @@ gst_apexsink_class_init (GstApExSinkClass * klass) "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 */ @@ -295,6 +352,8 @@ gst_apexsink_init (GstApExSink * apexsink, GstApExSinkClass * g_class) 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%%\"", @@ -343,6 +402,28 @@ gst_apexsink_set_property (GObject * object, guint prop_id, 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; @@ -373,6 +454,14 @@ gst_apexsink_get_property (GObject * object, guint prop_id, GValue * value, 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; @@ -391,6 +480,8 @@ gst_apexsink_finalise (GObject * object) sink->tracks = NULL; } + gst_object_unref (sink->clock); + g_free (sink->host); G_OBJECT_CLASS (parent_class)->finalize (object); @@ -403,7 +494,8 @@ gst_apexsink_open (GstAudioSink * asink) int res; GstApExSink *apexsink = (GstApExSink *) asink; - apexsink->gst_apexraop = gst_apexraop_new (apexsink->host, apexsink->port); + 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, @@ -460,12 +552,14 @@ 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 = - GST_APEX_RAOP_SAMPLES_PER_FRAME * GST_APEX_RAOP_BYTES_PER_SAMPLE; - spec->segtotal = 1; + 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)); @@ -481,17 +575,28 @@ gst_apexsink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec) static guint gst_apexsink_write (GstAudioSink * asink, gpointer data, guint length) { + guint written; GstApExSink *apexsink = (GstApExSink *) asink; - if (gst_apexraop_write (apexsink->gst_apexraop, data, length) != length) { + if ((written = + gst_apexraop_write (apexsink->gst_apexraop, data, + length)) != length) { GST_INFO_OBJECT (apexsink, - "WRITE : %d bytes not fully sended, skipping frame samples...", length); + "WRITE : %d of %d bytes sent, skipping frame samples...", written, + length); } else { GST_INFO_OBJECT (apexsink, "WRITE : %d bytes sent", length); - - /* FIXME, sleeping is ugly and not interruptible */ - usleep ((gulong) ((length * 1000000.) / (GST_APEX_RAOP_BITRATE * - GST_APEX_RAOP_BYTES_PER_SAMPLE) - apexsink->latency_time)); + /* 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; @@ -545,3 +650,16 @@ gst_apexsink_close (GstAudioSink * asink) 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 index 11d2f1ef91..ad2b299e35 100644 --- a/ext/apexsink/gstapexsink.h +++ b/ext/apexsink/gstapexsink.h @@ -46,6 +46,8 @@ G_BEGIN_DECLS #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; @@ -59,10 +61,19 @@ struct _GstApExSink gchar *host; guint port; guint volume; + GstApExGeneration generation; + GstApExTransportProtocol transport_protocol; - /* private attributes : latency time local copy, tracks list of the mixer interface */ + /* 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; @@ -73,9 +84,11 @@ struct _GstApExSinkClass GstAudioSinkClass parent_class; }; -/* genum jack access */ +/* 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); diff --git a/ext/assrender/gstassrender.c b/ext/assrender/gstassrender.c index 244e4d8e46..c5a8e1bcd2 100644 --- a/ext/assrender/gstassrender.c +++ b/ext/assrender/gstassrender.c @@ -618,101 +618,130 @@ blit_i420 (GstAssRender * render, ASS_Image * ass_image, GstBuffer * buffer) buffer->data + y_offset + ass_image->dst_y * y_stride + ass_image->dst_x; dst_u = - buffer->data + u_offset + ((ass_image->dst_y + 1) / 2) * u_stride + - (ass_image->dst_x + 1) / 2; + buffer->data + u_offset + (ass_image->dst_y / 2) * u_stride + + ass_image->dst_x / 2; dst_v = - buffer->data + v_offset + ((ass_image->dst_y + 1) / 2) * v_stride + - (ass_image->dst_x + 1) / 2; + buffer->data + v_offset + (ass_image->dst_y / 2) * v_stride + + ass_image->dst_x / 2; - for (y = 0; y < h - 1; y += 2) { - for (x = 0; x < w - 1; x += 2) { - k = src[0] * alpha / 255; - k2 = k; - dst_y[0] = (k * Y + (255 - k) * dst_y[0]) / 255; + for (y = 0; y < h; y++) { + dst_y = buffer->data + y_offset + (ass_image->dst_y + y) * y_stride + + ass_image->dst_x; + for (x = 0; x < w; x++) { + k = src[y * ass_image->w + x] * alpha / 255; + dst_y[x] = (k * Y + (255 - k) * dst_y[x]) / 255; + } + } - k = src[1] * alpha / 255; - k2 += k; - dst_y[1] = (k * Y + (255 - k) * dst_y[1]) / 255; - - src += src_stride; - dst_y += y_stride; - - k = src[0] * alpha / 255; - k2 += k; - dst_y[0] = (k * Y + (255 - k) * dst_y[0]) / 255; - - k = src[1] * alpha / 255; - k2 += k; - dst_y[1] = (k * Y + (255 - k) * dst_y[1]) / 255; - - k2 /= 4; + y = 0; + if (ass_image->dst_y & 1) { + dst_u = + buffer->data + u_offset + (ass_image->dst_y / 2) * u_stride + + ass_image->dst_x / 2; + dst_v = + buffer->data + v_offset + (ass_image->dst_y / 2) * v_stride + + ass_image->dst_x / 2; + x = 0; + if (ass_image->dst_x & 1) { + k2 = src[y * ass_image->w + x] * alpha / 255; + k2 = (k2 + 2) >> 2; + dst_u[0] = (k2 * U + (255 - k2) * dst_u[0]) / 255; + dst_v[0] = (k2 * V + (255 - k2) * dst_v[0]) / 255; + x++; + dst_u++; + dst_v++; + } + for (; x < w - 1; x += 2) { + k2 = src[y * ass_image->w + x] * alpha / 255; + k2 += src[y * ass_image->w + x + 1] * alpha / 255; + k2 = (k2 + 2) >> 2; dst_u[0] = (k2 * U + (255 - k2) * dst_u[0]) / 255; dst_v[0] = (k2 * V + (255 - k2) * dst_v[0]) / 255; dst_u++; dst_v++; - - src += -src_stride + 2; - dst_y += -y_stride + 2; } - if (x < w) { - k = src[0] * alpha / 255; - k2 = k; - dst_y[0] = (k * Y + (255 - k) * dst_y[0]) / 255; + k2 = src[y * ass_image->w + x] * alpha / 255; + k2 = (k2 + 2) >> 2; + dst_u[0] = (k2 * U + (255 - k2) * dst_u[0]) / 255; + dst_v[0] = (k2 * V + (255 - k2) * dst_v[0]) / 255; + } + } - src += src_stride; - dst_y += y_stride; - - k = src[0] * alpha / 255; - k2 += k; - dst_y[0] = (k * Y + (255 - k) * dst_y[0]) / 255; - - k2 /= 2; + for (; y < h - 1; y += 2) { + dst_u = + buffer->data + u_offset + ((ass_image->dst_y + y) / 2) * u_stride + + ass_image->dst_x / 2; + dst_v = + buffer->data + v_offset + ((ass_image->dst_y + y) / 2) * v_stride + + ass_image->dst_x / 2; + x = 0; + if (ass_image->dst_x & 1) { + k2 = src[y * ass_image->w + x] * alpha / 255; + k2 += src[(y + 1) * ass_image->w + x] * alpha / 255; + k2 = (k2 + 2) >> 2; + dst_u[0] = (k2 * U + (255 - k2) * dst_u[0]) / 255; + dst_v[0] = (k2 * V + (255 - k2) * dst_v[0]) / 255; + x++; + dst_u++; + dst_v++; + } + for (; x < w - 1; x += 2) { + k2 = src[y * ass_image->w + x] * alpha / 255; + k2 += src[y * ass_image->w + x + 1] * alpha / 255; + k2 += src[(y + 1) * ass_image->w + x] * alpha / 255; + k2 += src[(y + 1) * ass_image->w + x + 1] * alpha / 255; + k2 = (k2 + 2) >> 2; dst_u[0] = (k2 * U + (255 - k2) * dst_u[0]) / 255; dst_v[0] = (k2 * V + (255 - k2) * dst_v[0]) / 255; dst_u++; dst_v++; - - src += -src_stride + 1; - dst_y += -y_stride + 1; } - - src += src_stride + (src_stride - w); - dst_y += y_stride + (y_stride - w); - dst_u += u_stride - w2; - dst_v += v_stride - w2; + if (x < w) { + k2 = src[y * ass_image->w + x] * alpha / 255; + k2 += src[(y + 1) * ass_image->w + x] * alpha / 255; + k2 = (k2 + 2) >> 2; + dst_u[0] = (k2 * U + (255 - k2) * dst_u[0]) / 255; + dst_v[0] = (k2 * V + (255 - k2) * dst_v[0]) / 255; + } } if (y < h) { - for (x = 0; x < w - 1; x += 2) { - k = src[0] * alpha / 255; - k2 = k; - dst_y[0] = (k * Y + (255 - k) * dst_y[0]) / 255; - - k = src[1] * alpha / 255; - k2 += k; - dst_y[1] = (k * Y + (255 - k) * dst_y[1]) / 255; - - k2 /= 2; + dst_u = + buffer->data + u_offset + (ass_image->dst_y / 2) * u_stride + + ass_image->dst_x / 2; + dst_v = + buffer->data + v_offset + (ass_image->dst_y / 2) * v_stride + + ass_image->dst_x / 2; + x = 0; + if (ass_image->dst_x & 1) { + k2 = src[y * ass_image->w + x] * alpha / 255; + k2 = (k2 + 2) >> 2; + dst_u[0] = (k2 * U + (255 - k2) * dst_u[0]) / 255; + dst_v[0] = (k2 * V + (255 - k2) * dst_v[0]) / 255; + x++; + dst_u++; + dst_v++; + } + for (; x < w - 1; x += 2) { + k2 = src[y * ass_image->w + x] * alpha / 255; + k2 += src[y * ass_image->w + x + 1] * alpha / 255; + k2 = (k2 + 2) >> 2; dst_u[0] = (k2 * U + (255 - k2) * dst_u[0]) / 255; dst_v[0] = (k2 * V + (255 - k2) * dst_v[0]) / 255; dst_u++; dst_v++; - - src += 2; - dst_y += 2; } - if (x < w) { - k = src[0] * alpha / 255; - k2 = k; - dst_y[0] = (k * Y + (255 - k) * dst_y[0]) / 255; - + k2 = src[y * ass_image->w + x] * alpha / 255; + k2 = (k2 + 2) >> 2; dst_u[0] = (k2 * U + (255 - k2) * dst_u[0]) / 255; dst_v[0] = (k2 * V + (255 - k2) * dst_v[0]) / 255; } } + + next: counter++; ass_image = ass_image->next; diff --git a/ext/celt/gstceltdec.c b/ext/celt/gstceltdec.c index 66c829e4b6..e27c6a52c8 100644 --- a/ext/celt/gstceltdec.c +++ b/ext/celt/gstceltdec.c @@ -72,6 +72,7 @@ GST_BOILERPLATE (GstCeltDec, gst_celt_dec, GstElement, GST_TYPE_ELEMENT); static gboolean celt_dec_sink_event (GstPad * pad, GstEvent * event); static GstFlowReturn celt_dec_chain (GstPad * pad, GstBuffer * buf); +static gboolean celt_dec_sink_setcaps (GstPad * pad, GstCaps * caps); static GstStateChangeReturn celt_dec_change_state (GstElement * element, GstStateChange transition); @@ -86,6 +87,10 @@ static gboolean celt_dec_convert (GstPad * pad, static GstFlowReturn celt_dec_chain_parse_data (GstCeltDec * dec, GstBuffer * buf, GstClockTime timestamp, GstClockTime duration); +static GstFlowReturn celt_dec_chain_parse_header (GstCeltDec * dec, + GstBuffer * buf); +static GstFlowReturn celt_dec_chain_parse_comments (GstCeltDec * dec, + GstBuffer * buf); static void gst_celt_dec_base_init (gpointer g_class) @@ -133,6 +138,12 @@ gst_celt_dec_reset (GstCeltDec * dec) dec->mode = NULL; } + gst_buffer_replace (&dec->streamheader, NULL); + gst_buffer_replace (&dec->vorbiscomment, NULL); + g_list_foreach (dec->extra_headers, (GFunc) gst_mini_object_unref, NULL); + g_list_free (dec->extra_headers); + dec->extra_headers = NULL; + memset (&dec->header, 0, sizeof (dec->header)); } @@ -148,6 +159,8 @@ gst_celt_dec_init (GstCeltDec * dec, GstCeltDecClass * g_class) GST_DEBUG_FUNCPTR (celt_get_sink_query_types)); gst_pad_set_query_function (dec->sinkpad, GST_DEBUG_FUNCPTR (celt_dec_sink_query)); + gst_pad_set_setcaps_function (dec->sinkpad, + GST_DEBUG_FUNCPTR (celt_dec_sink_setcaps)); gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad); dec->srcpad = gst_pad_new_from_static_template (&celt_dec_src_factory, "src"); @@ -163,6 +176,62 @@ gst_celt_dec_init (GstCeltDec * dec, GstCeltDecClass * g_class) gst_celt_dec_reset (dec); } +static gboolean +celt_dec_sink_setcaps (GstPad * pad, GstCaps * caps) +{ + GstCeltDec *dec = GST_CELT_DEC (gst_pad_get_parent (pad)); + gboolean ret = TRUE; + GstStructure *s; + const GValue *streamheader; + + s = gst_caps_get_structure (caps, 0); + if ((streamheader = gst_structure_get_value (s, "streamheader")) && + G_VALUE_HOLDS (streamheader, GST_TYPE_ARRAY) && + gst_value_array_get_size (streamheader) >= 2) { + const GValue *header, *vorbiscomment; + GstBuffer *buf; + GstFlowReturn res = GST_FLOW_OK; + + header = gst_value_array_get_value (streamheader, 0); + if (header && G_VALUE_HOLDS (header, GST_TYPE_BUFFER)) { + buf = gst_value_get_buffer (header); + res = celt_dec_chain_parse_header (dec, buf); + if (res != GST_FLOW_OK) + goto done; + gst_buffer_replace (&dec->streamheader, buf); + } + + vorbiscomment = gst_value_array_get_value (streamheader, 1); + if (vorbiscomment && G_VALUE_HOLDS (vorbiscomment, GST_TYPE_BUFFER)) { + buf = gst_value_get_buffer (vorbiscomment); + res = celt_dec_chain_parse_comments (dec, buf); + if (res != GST_FLOW_OK) + goto done; + gst_buffer_replace (&dec->vorbiscomment, buf); + } + + g_list_foreach (dec->extra_headers, (GFunc) gst_mini_object_unref, NULL); + g_list_free (dec->extra_headers); + dec->extra_headers = NULL; + + if (gst_value_array_get_size (streamheader) > 2) { + gint i, n; + + n = gst_value_array_get_size (streamheader); + for (i = 2; i < n; i++) { + header = gst_value_array_get_value (streamheader, i); + buf = gst_value_get_buffer (header); + dec->extra_headers = + g_list_prepend (dec->extra_headers, gst_buffer_ref (buf)); + } + } + } + +done: + gst_object_unref (dec); + return ret; +} + static gboolean celt_dec_convert (GstPad * pad, GstFormat src_format, gint64 src_value, @@ -753,17 +822,48 @@ celt_dec_chain (GstPad * pad, GstBuffer * buf) dec->discont = TRUE; } - if (dec->packetno == 0) - res = celt_dec_chain_parse_header (dec, buf); - else if (dec->packetno == 1) - res = celt_dec_chain_parse_comments (dec, buf); - else if (dec->packetno <= 1 + dec->header.extra_headers) - res = GST_FLOW_OK; - else - res = - celt_dec_chain_parse_data (dec, buf, GST_BUFFER_TIMESTAMP (buf), - GST_BUFFER_DURATION (buf)); + /* If we have the streamheader and vorbiscomment from the caps already + * ignore them here */ + if (dec->streamheader && dec->vorbiscomment) { + if (GST_BUFFER_SIZE (dec->streamheader) == GST_BUFFER_SIZE (buf) + && memcmp (GST_BUFFER_DATA (dec->streamheader), GST_BUFFER_DATA (buf), + GST_BUFFER_SIZE (buf)) == 0) { + res = GST_FLOW_OK; + } else if (GST_BUFFER_SIZE (dec->vorbiscomment) == GST_BUFFER_SIZE (buf) + && memcmp (GST_BUFFER_DATA (dec->vorbiscomment), GST_BUFFER_DATA (buf), + GST_BUFFER_SIZE (buf)) == 0) { + res = GST_FLOW_OK; + } else { + GList *l; + for (l = dec->extra_headers; l; l = l->next) { + GstBuffer *header = l->data; + if (GST_BUFFER_SIZE (header) == GST_BUFFER_SIZE (buf) && + memcmp (GST_BUFFER_DATA (header), GST_BUFFER_DATA (buf), + GST_BUFFER_SIZE (buf)) == 0) { + res = GST_FLOW_OK; + goto done; + } + } + res = + celt_dec_chain_parse_data (dec, buf, GST_BUFFER_TIMESTAMP (buf), + GST_BUFFER_DURATION (buf)); + } + } else { + /* Otherwise fall back to packet counting and assume that the + * first two packets are the headers. */ + if (dec->packetno == 0) + res = celt_dec_chain_parse_header (dec, buf); + else if (dec->packetno == 1) + res = celt_dec_chain_parse_comments (dec, buf); + else if (dec->packetno <= 1 + dec->header.extra_headers) + res = GST_FLOW_OK; + else + res = celt_dec_chain_parse_data (dec, buf, GST_BUFFER_TIMESTAMP (buf), + GST_BUFFER_DURATION (buf)); + } + +done: dec->packetno++; gst_buffer_unref (buf); diff --git a/ext/celt/gstceltdec.h b/ext/celt/gstceltdec.h index 8d86290a6d..b6b49605df 100644 --- a/ext/celt/gstceltdec.h +++ b/ext/celt/gstceltdec.h @@ -59,6 +59,10 @@ struct _GstCeltDec { GstSegment segment; /* STREAM LOCK */ gint64 granulepos; /* -1 = needs to be set from current time */ gboolean discont; + + GstBuffer *streamheader; + GstBuffer *vorbiscomment; + GList *extra_headers; }; struct _GstCeltDecClass { diff --git a/ext/cog/gstcogdownsample.c b/ext/cog/gstcogdownsample.c index 8bec086c01..c929c12ec1 100644 --- a/ext/cog/gstcogdownsample.c +++ b/ext/cog/gstcogdownsample.c @@ -170,10 +170,7 @@ static void gst_cogdownsample_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { - GstCogdownsample *src; - g_return_if_fail (GST_IS_COGDOWNSAMPLE (object)); - src = GST_COGDOWNSAMPLE (object); GST_DEBUG ("gst_cogdownsample_set_property"); switch (prop_id) { @@ -186,10 +183,7 @@ static void gst_cogdownsample_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { - GstCogdownsample *src; - g_return_if_fail (GST_IS_COGDOWNSAMPLE (object)); - src = GST_COGDOWNSAMPLE (object); switch (prop_id) { default: @@ -308,14 +302,12 @@ static GstFlowReturn gst_cogdownsample_transform (GstBaseTransform * base_transform, GstBuffer * inbuf, GstBuffer * outbuf) { - GstCogdownsample *compress; CogFrame *outframe; int width, height; uint32_t format; CogFrame *frame; g_return_val_if_fail (GST_IS_COGDOWNSAMPLE (base_transform), GST_FLOW_ERROR); - compress = GST_COGDOWNSAMPLE (base_transform); gst_structure_get_fourcc (gst_caps_get_structure (inbuf->caps, 0), "format", &format); diff --git a/ext/cog/gstcogorc-dist.c b/ext/cog/gstcogorc-dist.c index 4cd43b5be3..e752c55c5f 100644 --- a/ext/cog/gstcogorc-dist.c +++ b/ext/cog/gstcogorc-dist.c @@ -4,9 +4,6 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#ifndef DISABLE_ORC -#include -#endif #include #ifndef _ORC_INTEGER_TYPEDEFS_ @@ -32,6 +29,7 @@ typedef unsigned __int16 orc_uint16; typedef unsigned __int32 orc_uint32; typedef unsigned __int64 orc_uint64; #define ORC_UINT64_C(x) (x##Ui64) +#define inline __inline #else #include typedef signed char orc_int8; @@ -71,165 +69,232 @@ typedef union orc_int16 x4[4]; } orc_union64; #endif +#ifndef ORC_RESTRICT +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#define ORC_RESTRICT restrict +#elif defined(__GNUC__) && __GNUC__ >= 4 +#define ORC_RESTRICT __restrict__ +#else +#define ORC_RESTRICT +#endif +#endif -void cogorc_memcpy_2d (orc_uint8 * d1, int d1_stride, const orc_uint8 * s1, - int s1_stride, int n, int m); -void cogorc_downsample_horiz_cosite_1tap (orc_uint8 * d1, const orc_uint16 * s1, +#ifndef DISABLE_ORC +#include +#endif +void cogorc_memcpy_2d (orc_uint8 * ORC_RESTRICT d1, int d1_stride, + const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_downsample_horiz_cosite_1tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint16 * ORC_RESTRICT s1, int n); +void cogorc_downsample_horiz_cosite_3tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * ORC_RESTRICT s2, int n); -void cogorc_downsample_horiz_cosite_3tap (orc_uint8 * d1, const orc_uint16 * s1, - const orc_uint16 * s2, int n); -void cogorc_downsample_420_jpeg (orc_uint8 * d1, const orc_uint16 * s1, - const orc_uint16 * s2, int n); -void cogorc_downsample_vert_halfsite_2tap (orc_uint8 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, int n); -void cogorc_downsample_vert_cosite_3tap (orc_uint8 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, const orc_uint8 * s3, int n); -void cogorc_downsample_vert_halfsite_4tap (orc_uint8 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, const orc_uint8 * s3, const orc_uint8 * s4, int n); -void cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const orc_uint8 * s1, +void cogorc_downsample_420_jpeg (orc_uint8 * ORC_RESTRICT d1, + const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * ORC_RESTRICT s2, int n); -void cogorc_upsample_horiz_cosite (guint8 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, int n); -void cogorc_upsample_vert_avgub (orc_uint8 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, int n); -void orc_unpack_yuyv_y (orc_uint8 * d1, const orc_uint16 * s1, int n); -void orc_unpack_yuyv_u (orc_uint8 * d1, const orc_uint32 * s1, int n); -void orc_unpack_yuyv_v (orc_uint8 * d1, const orc_uint32 * s1, int n); -void orc_pack_yuyv (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2, - const orc_uint8 * s3, int n); -void orc_unpack_uyvy_y (orc_uint8 * d1, const orc_uint16 * s1, int n); -void orc_unpack_uyvy_u (orc_uint8 * d1, const orc_uint32 * s1, int n); -void orc_unpack_uyvy_v (orc_uint8 * d1, const orc_uint32 * s1, int n); -void orc_pack_uyvy (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2, - const orc_uint8 * s3, int n); -void orc_addc_convert_u8_s16 (orc_uint8 * d1, const gint16 * s1, int n); -void orc_subc_convert_s16_u8 (gint16 * d1, const orc_uint8 * s1, int n); -void orc_splat_u8_ns (orc_uint8 * d1, int p1, int n); -void orc_splat_s16_ns (gint16 * d1, int p1, int n); -void orc_matrix2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, - int p2, int p3, int n); -void orc_matrix2_11_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - int p1, int p2, int n); -void orc_matrix2_12_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - int p1, int p2, int n); -void orc_matrix3_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int p4, int n); -void orc_matrix3_100_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int n); -void orc_matrix3_100_offset_u8 (guint8 * d1, const guint8 * s1, - const guint8 * s2, const guint8 * s3, int p1, int p2, int p3, int p4, - int p5, int n); -void orc_matrix3_000_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int p4, int p5, int n); -void orc_pack_123x (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, - const orc_uint8 * s3, int p1, int n); -void orc_pack_x123 (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, - const orc_uint8 * s3, int p1, int n); -void cogorc_combine2_u8 (orc_uint8 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, int p1, int p2, int n); -void cogorc_combine4_u8 (orc_uint8 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, const orc_uint8 * s3, const orc_uint8 * s4, int p1, +void cogorc_downsample_vert_halfsite_2tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + int n); +void cogorc_downsample_vert_cosite_3tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, int n); +void cogorc_downsample_vert_halfsite_4tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, + int n); +void cogorc_upsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, int n); +void cogorc_upsample_horiz_cosite (guint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + int n); +void cogorc_upsample_vert_avgub (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + int n); +void orc_unpack_yuyv_y (orc_uint8 * ORC_RESTRICT d1, + const orc_uint16 * ORC_RESTRICT s1, int n); +void orc_unpack_yuyv_u (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n); +void orc_unpack_yuyv_v (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n); +void orc_pack_yuyv (orc_uint32 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, int n); +void orc_unpack_uyvy_y (orc_uint8 * ORC_RESTRICT d1, + const orc_uint16 * ORC_RESTRICT s1, int n); +void orc_unpack_uyvy_u (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n); +void orc_unpack_uyvy_v (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n); +void orc_pack_uyvy (orc_uint32 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, int n); +void orc_addc_convert_u8_s16 (orc_uint8 * ORC_RESTRICT d1, + const gint16 * ORC_RESTRICT s1, int n); +void orc_subc_convert_s16_u8 (gint16 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, int n); +void orc_splat_u8_ns (orc_uint8 * ORC_RESTRICT d1, int p1, int n); +void orc_splat_s16_ns (gint16 * ORC_RESTRICT d1, int p1, int n); +void orc_matrix2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int p1, int p2, int p3, int n); +void orc_matrix2_11_u8 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, + int p2, int n); +void orc_matrix2_12_u8 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, + int p2, int n); +void orc_matrix3_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int n); -void cogorc_unpack_axyz_0 (orc_uint8 * d1, const orc_uint32 * s1, int n); -void cogorc_unpack_axyz_1 (orc_uint8 * d1, const orc_uint32 * s1, int n); -void cogorc_unpack_axyz_2 (orc_uint8 * d1, const orc_uint32 * s1, int n); -void cogorc_unpack_axyz_3 (orc_uint8 * d1, const orc_uint32 * s1, int n); -void cogorc_resample_horiz_1tap (orc_uint8 * d1, const orc_uint8 * s1, int p1, - int p2, int n); -void cogorc_resample_horiz_2tap (orc_uint8 * d1, const orc_uint8 * s1, int p1, - int p2, int n); -void cogorc_convert_I420_UYVY (orc_uint32 * d1, orc_uint32 * d2, - const orc_uint16 * s1, const orc_uint16 * s2, const orc_uint8 * s3, - const orc_uint8 * s4, int n); -void cogorc_convert_I420_YUY2 (orc_uint32 * d1, orc_uint32 * d2, - const orc_uint16 * s1, const orc_uint16 * s2, const orc_uint8 * s3, - const orc_uint8 * s4, int n); -void cogorc_convert_I420_AYUV (orc_uint32 * d1, orc_uint32 * d2, - const orc_uint8 * s1, const orc_uint8 * s2, const orc_uint8 * s3, - const orc_uint8 * s4, int n); -void cogorc_convert_YUY2_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3, - orc_uint8 * d4, const orc_uint32 * s1, const orc_uint32 * s2, int n); -void cogorc_convert_UYVY_YUY2 (orc_uint32 * d1, int d1_stride, - const orc_uint32 * s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_420_422 (orc_uint8 * d1, int d1_stride, - orc_uint8 * d2, int d2_stride, const orc_uint8 * s1, int s1_stride, int n, +void orc_matrix3_100_u8 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int n); +void orc_matrix3_100_offset_u8 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, + int n); +void orc_matrix3_000_u8 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, + int n); +void orc_pack_123x (guint32 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, int p1, int n); +void orc_pack_x123 (guint32 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, int p1, int n); +void cogorc_combine2_u8 (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + int p1, int p2, int n); +void cogorc_combine4_u8 (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, + int p1, int p2, int p3, int p4, int n); +void cogorc_unpack_axyz_0 (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n); +void cogorc_unpack_axyz_1 (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n); +void cogorc_unpack_axyz_2 (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n); +void cogorc_unpack_axyz_3 (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n); +void cogorc_resample_horiz_1tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, int p1, int p2, int n); +void cogorc_resample_horiz_2tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, int p1, int p2, int n); +void cogorc_convert_I420_UYVY (orc_uint32 * ORC_RESTRICT d1, + orc_uint32 * ORC_RESTRICT d2, const orc_uint16 * ORC_RESTRICT s1, + const orc_uint16 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, + const orc_uint8 * ORC_RESTRICT s4, int n); +void cogorc_convert_I420_YUY2 (orc_uint32 * ORC_RESTRICT d1, + orc_uint32 * ORC_RESTRICT d2, const orc_uint16 * ORC_RESTRICT s1, + const orc_uint16 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, + const orc_uint8 * ORC_RESTRICT s4, int n); +void cogorc_convert_I420_AYUV (orc_uint32 * ORC_RESTRICT d1, + orc_uint32 * ORC_RESTRICT d2, const orc_uint8 * ORC_RESTRICT s1, + const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, + const orc_uint8 * ORC_RESTRICT s4, int n); +void cogorc_convert_YUY2_I420 (orc_uint16 * ORC_RESTRICT d1, + orc_uint16 * ORC_RESTRICT d2, orc_uint8 * ORC_RESTRICT d3, + orc_uint8 * ORC_RESTRICT d4, const orc_uint32 * ORC_RESTRICT s1, + const orc_uint32 * ORC_RESTRICT s2, int n); +void cogorc_convert_UYVY_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_planar_chroma_420_422 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, + orc_uint8 * ORC_RESTRICT d2, int d2_stride, + const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_planar_chroma_420_444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint16 * ORC_RESTRICT d2, int d2_stride, + const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_planar_chroma_422_444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_planar_chroma_444_422 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_planar_chroma_444_420 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, + const orc_uint16 * ORC_RESTRICT s2, int s2_stride, int n, int m); +void cogorc_planar_chroma_422_420 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, + const orc_uint8 * ORC_RESTRICT s1, int s1_stride, + const orc_uint8 * ORC_RESTRICT s2, int s2_stride, int n, int m); +void cogorc_convert_YUY2_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_UYVY_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_YUY2_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, + int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_420_444 (orc_uint16 * d1, int d1_stride, - orc_uint16 * d2, int d2_stride, const orc_uint8 * s1, int s1_stride, int n, +void cogorc_convert_UYVY_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, + int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_422_444 (orc_uint16 * d1, int d1_stride, - const orc_uint8 * s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_444_422 (orc_uint8 * d1, int d1_stride, - const orc_uint16 * s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_444_420 (orc_uint8 * d1, int d1_stride, - const orc_uint16 * s1, int s1_stride, const orc_uint16 * s2, int s2_stride, - int n, int m); -void cogorc_planar_chroma_422_420 (orc_uint8 * d1, int d1_stride, - const orc_uint8 * s1, int s1_stride, const orc_uint8 * s2, int s2_stride, - int n, int m); -void cogorc_convert_YUY2_AYUV (orc_uint64 * d1, int d1_stride, - const orc_uint32 * s1, int s1_stride, int n, int m); -void cogorc_convert_UYVY_AYUV (orc_uint64 * d1, int d1_stride, - const orc_uint32 * s1, int s1_stride, int n, int m); -void cogorc_convert_YUY2_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, - int d2_stride, orc_uint8 * d3, int d3_stride, const orc_uint32 * s1, - int s1_stride, int n, int m); -void cogorc_convert_UYVY_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, - int d2_stride, orc_uint8 * d3, int d3_stride, const orc_uint32 * s1, - int s1_stride, int n, int m); -void cogorc_convert_YUY2_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, - int d2_stride, orc_uint16 * d3, int d3_stride, const orc_uint32 * s1, - int s1_stride, int n, int m); -void cogorc_convert_UYVY_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, - int d2_stride, orc_uint16 * d3, int d3_stride, const orc_uint32 * s1, - int s1_stride, int n, int m); -void cogorc_convert_UYVY_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3, - orc_uint8 * d4, const orc_uint32 * s1, const orc_uint32 * s2, int n); -void cogorc_convert_AYUV_I420 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, - int d2_stride, orc_uint8 * d3, int d3_stride, orc_uint8 * d4, int d4_stride, - const orc_uint64 * s1, int s1_stride, const orc_uint64 * s2, int s2_stride, - int n, int m); -void cogorc_convert_AYUV_YUY2 (orc_uint32 * d1, int d1_stride, - const orc_uint64 * s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_UYVY (orc_uint32 * d1, int d1_stride, - const orc_uint64 * s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, - int d2_stride, orc_uint8 * d3, int d3_stride, const orc_uint64 * s1, - int s1_stride, int n, int m); -void cogorc_convert_AYUV_Y444 (orc_uint8 * d1, int d1_stride, orc_uint8 * d2, - int d2_stride, orc_uint8 * d3, int d3_stride, const orc_uint32 * s1, - int s1_stride, int n, int m); -void cogorc_convert_Y42B_YUY2 (orc_uint32 * d1, int d1_stride, - const orc_uint16 * s1, int s1_stride, const orc_uint8 * s2, int s2_stride, - const orc_uint8 * s3, int s3_stride, int n, int m); -void cogorc_convert_Y42B_UYVY (orc_uint32 * d1, int d1_stride, - const orc_uint16 * s1, int s1_stride, const orc_uint8 * s2, int s2_stride, - const orc_uint8 * s3, int s3_stride, int n, int m); -void cogorc_convert_Y42B_AYUV (orc_uint64 * d1, int d1_stride, - const orc_uint16 * s1, int s1_stride, const orc_uint8 * s2, int s2_stride, - const orc_uint8 * s3, int s3_stride, int n, int m); -void cogorc_convert_Y444_YUY2 (orc_uint32 * d1, int d1_stride, - const orc_uint16 * s1, int s1_stride, const orc_uint16 * s2, int s2_stride, - const orc_uint16 * s3, int s3_stride, int n, int m); -void cogorc_convert_Y444_UYVY (orc_uint32 * d1, int d1_stride, - const orc_uint16 * s1, int s1_stride, const orc_uint16 * s2, int s2_stride, - const orc_uint16 * s3, int s3_stride, int n, int m); -void cogorc_convert_Y444_AYUV (orc_uint32 * d1, int d1_stride, - const orc_uint8 * s1, int s1_stride, const orc_uint8 * s2, int s2_stride, - const orc_uint8 * s3, int s3_stride, int n, int m); -void cogorc_convert_AYUV_ARGB (orc_uint32 * d1, int d1_stride, - const orc_uint32 * s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_BGRA (orc_uint32 * d1, int d1_stride, - const orc_uint32 * s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_ABGR (orc_uint32 * d1, int d1_stride, - const orc_uint32 * s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_RGBA (orc_uint32 * d1, int d1_stride, - const orc_uint32 * s1, int s1_stride, int n, int m); -void cogorc_convert_I420_BGRA (orc_uint32 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, const orc_uint8 * s3, int n); -void cogorc_convert_I420_BGRA_avg (orc_uint32 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, const orc_uint8 * s3, const orc_uint8 * s4, - const orc_uint8 * s5, int n); +void cogorc_convert_YUY2_Y444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint16 * ORC_RESTRICT d3, + int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, + int m); +void cogorc_convert_UYVY_Y444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint16 * ORC_RESTRICT d3, + int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, + int m); +void cogorc_convert_UYVY_I420 (orc_uint16 * ORC_RESTRICT d1, + orc_uint16 * ORC_RESTRICT d2, orc_uint8 * ORC_RESTRICT d3, + orc_uint8 * ORC_RESTRICT d4, const orc_uint32 * ORC_RESTRICT s1, + const orc_uint32 * ORC_RESTRICT s2, int n); +void cogorc_convert_AYUV_I420 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, + int d3_stride, orc_uint8 * ORC_RESTRICT d4, int d4_stride, + const orc_uint64 * ORC_RESTRICT s1, int s1_stride, + const orc_uint64 * ORC_RESTRICT s2, int s2_stride, int n, int m); +void cogorc_convert_AYUV_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, + int d3_stride, const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n, + int m); +void cogorc_convert_AYUV_Y444 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, + orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, + int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, + int m); +void cogorc_convert_Y42B_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, + const orc_uint8 * ORC_RESTRICT s2, int s2_stride, + const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y42B_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, + const orc_uint8 * ORC_RESTRICT s2, int s2_stride, + const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y42B_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, + const orc_uint8 * ORC_RESTRICT s2, int s2_stride, + const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y444_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, + const orc_uint16 * ORC_RESTRICT s2, int s2_stride, + const orc_uint16 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y444_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, + const orc_uint16 * ORC_RESTRICT s2, int s2_stride, + const orc_uint16 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y444_AYUV (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint8 * ORC_RESTRICT s1, int s1_stride, + const orc_uint8 * ORC_RESTRICT s2, int s2_stride, + const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_AYUV_ARGB (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_BGRA (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_ABGR (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_RGBA (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_I420_BGRA (orc_uint32 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, int n); +void cogorc_convert_I420_BGRA_avg (orc_uint32 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, + const orc_uint8 * ORC_RESTRICT s5, int n); /* begin Orc C target preamble */ @@ -263,6 +328,7 @@ void cogorc_convert_I420_BGRA_avg (orc_uint32 * d1, const orc_uint8 * s1, #define ORC_ISNAN(x) ((((x)&0x7f800000) == 0x7f800000) && (((x)&0x007fffff) != 0)) #define ORC_DENORMAL_DOUBLE(x) ((x) & ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == 0) ? ORC_UINT64_C(0xfff0000000000000) : ORC_UINT64_C(0xffffffffffffffff))) #define ORC_ISNAN_DOUBLE(x) ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == ORC_UINT64_C(0x7ff0000000000000)) && (((x)&ORC_UINT64_C(0x000fffffffffffff)) != 0)) +#ifndef ORC_RESTRICT #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define ORC_RESTRICT restrict #elif defined(__GNUC__) && __GNUC__ >= 4 @@ -270,6 +336,7 @@ void cogorc_convert_I420_BGRA_avg (orc_uint32 * d1, const orc_uint8 * s1, #else #define ORC_RESTRICT #endif +#endif /* end Orc C target preamble */ @@ -277,8 +344,8 @@ void cogorc_convert_I420_BGRA_avg (orc_uint32 * d1, const orc_uint8 * s1, /* cogorc_memcpy_2d */ #ifdef DISABLE_ORC void -cogorc_memcpy_2d (orc_uint8 * d1, int d1_stride, const orc_uint8 * s1, - int s1_stride, int n, int m) +cogorc_memcpy_2d (orc_uint8 * ORC_RESTRICT d1, int d1_stride, + const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -306,7 +373,7 @@ cogorc_memcpy_2d (orc_uint8 * d1, int d1_stride, const orc_uint8 * s1, #else static void -_backup_cogorc_memcpy_2d (OrcExecutor * ex) +_backup_cogorc_memcpy_2d (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -335,8 +402,8 @@ _backup_cogorc_memcpy_2d (OrcExecutor * ex) } void -cogorc_memcpy_2d (orc_uint8 * d1, int d1_stride, const orc_uint8 * s1, - int s1_stride, int n, int m) +cogorc_memcpy_2d (orc_uint8 * ORC_RESTRICT d1, int d1_stride, + const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -346,7 +413,6 @@ cogorc_memcpy_2d (orc_uint8 * d1, int d1_stride, const orc_uint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -358,7 +424,7 @@ cogorc_memcpy_2d (orc_uint8 * d1, int d1_stride, const orc_uint8 * s1, orc_program_append_2 (p, "copyb", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -381,8 +447,8 @@ cogorc_memcpy_2d (orc_uint8 * d1, int d1_stride, const orc_uint8 * s1, /* cogorc_downsample_horiz_cosite_1tap */ #ifdef DISABLE_ORC void -cogorc_downsample_horiz_cosite_1tap (orc_uint8 * d1, const orc_uint16 * s1, - int n) +cogorc_downsample_horiz_cosite_1tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint16 * ORC_RESTRICT s1, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -398,7 +464,11 @@ cogorc_downsample_horiz_cosite_1tap (orc_uint8 * d1, const orc_uint16 * s1, /* 0: loadw */ var32 = ptr4[i]; /* 1: select0wb */ - var33 = (orc_uint16) var32.i & 0xff; + { + orc_union16 _src; + _src.i = var32.i; + var33 = _src.x2[0]; + } /* 2: storeb */ ptr0[i] = var33; } @@ -407,7 +477,7 @@ cogorc_downsample_horiz_cosite_1tap (orc_uint8 * d1, const orc_uint16 * s1, #else static void -_backup_cogorc_downsample_horiz_cosite_1tap (OrcExecutor * ex) +_backup_cogorc_downsample_horiz_cosite_1tap (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -424,7 +494,11 @@ _backup_cogorc_downsample_horiz_cosite_1tap (OrcExecutor * ex) /* 0: loadw */ var32 = ptr4[i]; /* 1: select0wb */ - var33 = (orc_uint16) var32.i & 0xff; + { + orc_union16 _src; + _src.i = var32.i; + var33 = _src.x2[0]; + } /* 2: storeb */ ptr0[i] = var33; } @@ -432,8 +506,8 @@ _backup_cogorc_downsample_horiz_cosite_1tap (OrcExecutor * ex) } void -cogorc_downsample_horiz_cosite_1tap (orc_uint8 * d1, const orc_uint16 * s1, - int n) +cogorc_downsample_horiz_cosite_1tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint16 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -443,7 +517,6 @@ cogorc_downsample_horiz_cosite_1tap (orc_uint8 * d1, const orc_uint16 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_downsample_horiz_cosite_1tap"); @@ -455,7 +528,7 @@ cogorc_downsample_horiz_cosite_1tap (orc_uint8 * d1, const orc_uint16 * s1, orc_program_append_2 (p, "select0wb", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -475,8 +548,9 @@ cogorc_downsample_horiz_cosite_1tap (orc_uint8 * d1, const orc_uint16 * s1, /* cogorc_downsample_horiz_cosite_3tap */ #ifdef DISABLE_ORC void -cogorc_downsample_horiz_cosite_3tap (orc_uint8 * d1, const orc_uint16 * s1, - const orc_uint16 * s2, int n) +cogorc_downsample_horiz_cosite_3tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * ORC_RESTRICT s2, + int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -505,9 +579,9 @@ cogorc_downsample_horiz_cosite_3tap (orc_uint8 * d1, const orc_uint16 * s1, ptr5 = (orc_union16 *) s2; /* 9: loadpw */ - var40.i = 0x00000002; /* 2 or 9.88131e-324f */ + var40.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ /* 13: loadpw */ - var41.i = 0x00000002; /* 2 or 9.88131e-324f */ + var41.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ for (i = 0; i < n; i++) { /* 0: loadw */ @@ -515,13 +589,25 @@ cogorc_downsample_horiz_cosite_3tap (orc_uint8 * d1, const orc_uint16 * s1, /* 1: copyw */ var43.i = var38.i; /* 2: select0wb */ - var44 = (orc_uint16) var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var44 = _src.x2[0]; + } /* 3: select1wb */ - var45 = ((orc_uint16) var43.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var45 = _src.x2[1]; + } /* 4: loadw */ var39 = ptr5[i]; /* 5: select0wb */ - var46 = (orc_uint16) var39.i & 0xff; + { + orc_union16 _src; + _src.i = var39.i; + var46 = _src.x2[0]; + } /* 6: convubw */ var47.i = (orc_uint8) var44; /* 7: convubw */ @@ -548,7 +634,7 @@ cogorc_downsample_horiz_cosite_3tap (orc_uint8 * d1, const orc_uint16 * s1, #else static void -_backup_cogorc_downsample_horiz_cosite_3tap (OrcExecutor * ex) +_backup_cogorc_downsample_horiz_cosite_3tap (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -578,9 +664,9 @@ _backup_cogorc_downsample_horiz_cosite_3tap (OrcExecutor * ex) ptr5 = (orc_union16 *) ex->arrays[5]; /* 9: loadpw */ - var40.i = 0x00000002; /* 2 or 9.88131e-324f */ + var40.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ /* 13: loadpw */ - var41.i = 0x00000002; /* 2 or 9.88131e-324f */ + var41.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ for (i = 0; i < n; i++) { /* 0: loadw */ @@ -588,13 +674,25 @@ _backup_cogorc_downsample_horiz_cosite_3tap (OrcExecutor * ex) /* 1: copyw */ var43.i = var38.i; /* 2: select0wb */ - var44 = (orc_uint16) var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var44 = _src.x2[0]; + } /* 3: select1wb */ - var45 = ((orc_uint16) var43.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var45 = _src.x2[1]; + } /* 4: loadw */ var39 = ptr5[i]; /* 5: select0wb */ - var46 = (orc_uint16) var39.i & 0xff; + { + orc_union16 _src; + _src.i = var39.i; + var46 = _src.x2[0]; + } /* 6: convubw */ var47.i = (orc_uint8) var44; /* 7: convubw */ @@ -620,8 +718,9 @@ _backup_cogorc_downsample_horiz_cosite_3tap (OrcExecutor * ex) } void -cogorc_downsample_horiz_cosite_3tap (orc_uint8 * d1, const orc_uint16 * s1, - const orc_uint16 * s2, int n) +cogorc_downsample_horiz_cosite_3tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * ORC_RESTRICT s2, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -631,7 +730,6 @@ cogorc_downsample_horiz_cosite_3tap (orc_uint8 * d1, const orc_uint16 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_downsample_horiz_cosite_3tap"); @@ -675,7 +773,7 @@ cogorc_downsample_horiz_cosite_3tap (orc_uint8 * d1, const orc_uint16 * s1, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T4, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -696,8 +794,9 @@ cogorc_downsample_horiz_cosite_3tap (orc_uint8 * d1, const orc_uint16 * s1, /* cogorc_downsample_420_jpeg */ #ifdef DISABLE_ORC void -cogorc_downsample_420_jpeg (orc_uint8 * d1, const orc_uint16 * s1, - const orc_uint16 * s2, int n) +cogorc_downsample_420_jpeg (orc_uint8 * ORC_RESTRICT d1, + const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * ORC_RESTRICT s2, + int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -726,9 +825,17 @@ cogorc_downsample_420_jpeg (orc_uint8 * d1, const orc_uint16 * s1, /* 1: copyw */ var40.i = var37.i; /* 2: select0wb */ - var41 = (orc_uint16) var40.i & 0xff; + { + orc_union16 _src; + _src.i = var40.i; + var41 = _src.x2[0]; + } /* 3: select1wb */ - var42 = ((orc_uint16) var40.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.i; + var42 = _src.x2[1]; + } /* 4: avgub */ var43 = ((orc_uint8) var41 + (orc_uint8) var42 + 1) >> 1; /* 5: loadw */ @@ -736,9 +843,17 @@ cogorc_downsample_420_jpeg (orc_uint8 * d1, const orc_uint16 * s1, /* 6: copyw */ var44.i = var38.i; /* 7: select0wb */ - var45 = (orc_uint16) var44.i & 0xff; + { + orc_union16 _src; + _src.i = var44.i; + var45 = _src.x2[0]; + } /* 8: select1wb */ - var46 = ((orc_uint16) var44.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var44.i; + var46 = _src.x2[1]; + } /* 9: avgub */ var47 = ((orc_uint8) var45 + (orc_uint8) var46 + 1) >> 1; /* 10: avgub */ @@ -751,7 +866,7 @@ cogorc_downsample_420_jpeg (orc_uint8 * d1, const orc_uint16 * s1, #else static void -_backup_cogorc_downsample_420_jpeg (OrcExecutor * ex) +_backup_cogorc_downsample_420_jpeg (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -781,9 +896,17 @@ _backup_cogorc_downsample_420_jpeg (OrcExecutor * ex) /* 1: copyw */ var40.i = var37.i; /* 2: select0wb */ - var41 = (orc_uint16) var40.i & 0xff; + { + orc_union16 _src; + _src.i = var40.i; + var41 = _src.x2[0]; + } /* 3: select1wb */ - var42 = ((orc_uint16) var40.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.i; + var42 = _src.x2[1]; + } /* 4: avgub */ var43 = ((orc_uint8) var41 + (orc_uint8) var42 + 1) >> 1; /* 5: loadw */ @@ -791,9 +914,17 @@ _backup_cogorc_downsample_420_jpeg (OrcExecutor * ex) /* 6: copyw */ var44.i = var38.i; /* 7: select0wb */ - var45 = (orc_uint16) var44.i & 0xff; + { + orc_union16 _src; + _src.i = var44.i; + var45 = _src.x2[0]; + } /* 8: select1wb */ - var46 = ((orc_uint16) var44.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var44.i; + var46 = _src.x2[1]; + } /* 9: avgub */ var47 = ((orc_uint8) var45 + (orc_uint8) var46 + 1) >> 1; /* 10: avgub */ @@ -805,8 +936,9 @@ _backup_cogorc_downsample_420_jpeg (OrcExecutor * ex) } void -cogorc_downsample_420_jpeg (orc_uint8 * d1, const orc_uint16 * s1, - const orc_uint16 * s2, int n) +cogorc_downsample_420_jpeg (orc_uint8 * ORC_RESTRICT d1, + const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * ORC_RESTRICT s2, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -816,7 +948,6 @@ cogorc_downsample_420_jpeg (orc_uint8 * d1, const orc_uint16 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_downsample_420_jpeg"); @@ -849,7 +980,7 @@ cogorc_downsample_420_jpeg (orc_uint8 * d1, const orc_uint16 * s1, orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T4, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -870,8 +1001,8 @@ cogorc_downsample_420_jpeg (orc_uint8 * d1, const orc_uint16 * s1, /* cogorc_downsample_vert_halfsite_2tap */ #ifdef DISABLE_ORC void -cogorc_downsample_vert_halfsite_2tap (orc_uint8 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, int n) +cogorc_downsample_vert_halfsite_2tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -901,7 +1032,7 @@ cogorc_downsample_vert_halfsite_2tap (orc_uint8 * d1, const orc_uint8 * s1, #else static void -_backup_cogorc_downsample_vert_halfsite_2tap (OrcExecutor * ex) +_backup_cogorc_downsample_vert_halfsite_2tap (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -931,8 +1062,8 @@ _backup_cogorc_downsample_vert_halfsite_2tap (OrcExecutor * ex) } void -cogorc_downsample_vert_halfsite_2tap (orc_uint8 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, int n) +cogorc_downsample_vert_halfsite_2tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -942,7 +1073,6 @@ cogorc_downsample_vert_halfsite_2tap (orc_uint8 * d1, const orc_uint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_downsample_vert_halfsite_2tap"); @@ -955,7 +1085,7 @@ cogorc_downsample_vert_halfsite_2tap (orc_uint8 * d1, const orc_uint8 * s1, orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_S2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -976,8 +1106,9 @@ cogorc_downsample_vert_halfsite_2tap (orc_uint8 * d1, const orc_uint8 * s1, /* cogorc_downsample_vert_cosite_3tap */ #ifdef DISABLE_ORC void -cogorc_downsample_vert_cosite_3tap (orc_uint8 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, const orc_uint8 * s3, int n) +cogorc_downsample_vert_cosite_3tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -1005,9 +1136,9 @@ cogorc_downsample_vert_cosite_3tap (orc_uint8 * d1, const orc_uint8 * s1, ptr6 = (orc_int8 *) s3; /* 6: loadpw */ - var38.i = 0x00000002; /* 2 or 9.88131e-324f */ + var38.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ /* 10: loadpw */ - var39.i = 0x00000002; /* 2 or 9.88131e-324f */ + var39.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -1042,7 +1173,7 @@ cogorc_downsample_vert_cosite_3tap (orc_uint8 * d1, const orc_uint8 * s1, #else static void -_backup_cogorc_downsample_vert_cosite_3tap (OrcExecutor * ex) +_backup_cogorc_downsample_vert_cosite_3tap (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -1071,9 +1202,9 @@ _backup_cogorc_downsample_vert_cosite_3tap (OrcExecutor * ex) ptr6 = (orc_int8 *) ex->arrays[6]; /* 6: loadpw */ - var38.i = 0x00000002; /* 2 or 9.88131e-324f */ + var38.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ /* 10: loadpw */ - var39.i = 0x00000002; /* 2 or 9.88131e-324f */ + var39.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -1107,8 +1238,9 @@ _backup_cogorc_downsample_vert_cosite_3tap (OrcExecutor * ex) } void -cogorc_downsample_vert_cosite_3tap (orc_uint8 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, const orc_uint8 * s3, int n) +cogorc_downsample_vert_cosite_3tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -1118,7 +1250,6 @@ cogorc_downsample_vert_cosite_3tap (orc_uint8 * d1, const orc_uint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_downsample_vert_cosite_3tap"); @@ -1152,7 +1283,7 @@ cogorc_downsample_vert_cosite_3tap (orc_uint8 * d1, const orc_uint8 * s1, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -1174,8 +1305,9 @@ cogorc_downsample_vert_cosite_3tap (orc_uint8 * d1, const orc_uint8 * s1, /* cogorc_downsample_vert_halfsite_4tap */ #ifdef DISABLE_ORC void -cogorc_downsample_vert_halfsite_4tap (orc_uint8 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, const orc_uint8 * s3, const orc_uint8 * s4, int n) +cogorc_downsample_vert_halfsite_4tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -1210,11 +1342,11 @@ cogorc_downsample_vert_halfsite_4tap (orc_uint8 * d1, const orc_uint8 * s1, ptr7 = (orc_int8 *) s4; /* 9: loadpw */ - var40.i = 0x0000001a; /* 26 or 1.28457e-322f */ + var40.i = (int) 0x0000001a; /* 26 or 1.28457e-322f */ /* 12: loadpw */ - var41.i = 0x00000006; /* 6 or 2.96439e-323f */ + var41.i = (int) 0x00000006; /* 6 or 2.96439e-323f */ /* 15: loadpw */ - var42.i = 0x00000020; /* 32 or 1.58101e-322f */ + var42.i = (int) 0x00000020; /* 32 or 1.58101e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -1257,7 +1389,7 @@ cogorc_downsample_vert_halfsite_4tap (orc_uint8 * d1, const orc_uint8 * s1, #else static void -_backup_cogorc_downsample_vert_halfsite_4tap (OrcExecutor * ex) +_backup_cogorc_downsample_vert_halfsite_4tap (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -1293,11 +1425,11 @@ _backup_cogorc_downsample_vert_halfsite_4tap (OrcExecutor * ex) ptr7 = (orc_int8 *) ex->arrays[7]; /* 9: loadpw */ - var40.i = 0x0000001a; /* 26 or 1.28457e-322f */ + var40.i = (int) 0x0000001a; /* 26 or 1.28457e-322f */ /* 12: loadpw */ - var41.i = 0x00000006; /* 6 or 2.96439e-323f */ + var41.i = (int) 0x00000006; /* 6 or 2.96439e-323f */ /* 15: loadpw */ - var42.i = 0x00000020; /* 32 or 1.58101e-322f */ + var42.i = (int) 0x00000020; /* 32 or 1.58101e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -1339,8 +1471,9 @@ _backup_cogorc_downsample_vert_halfsite_4tap (OrcExecutor * ex) } void -cogorc_downsample_vert_halfsite_4tap (orc_uint8 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, const orc_uint8 * s3, const orc_uint8 * s4, int n) +cogorc_downsample_vert_halfsite_4tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -1350,7 +1483,6 @@ cogorc_downsample_vert_halfsite_4tap (orc_uint8 * d1, const orc_uint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_downsample_vert_halfsite_4tap"); @@ -1394,7 +1526,7 @@ cogorc_downsample_vert_halfsite_4tap (orc_uint8 * d1, const orc_uint8 * s1, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -1417,7 +1549,8 @@ cogorc_downsample_vert_halfsite_4tap (orc_uint8 * d1, const orc_uint8 * s1, /* cogorc_upsample_horiz_cosite_1tap */ #ifdef DISABLE_ORC void -cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const orc_uint8 * s1, int n) +cogorc_upsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, int n) { int i; orc_union16 *ORC_RESTRICT ptr0; @@ -1436,7 +1569,12 @@ cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const orc_uint8 * s1, int n) /* 1: copyb */ var35 = var33; /* 2: mergebw */ - var34.i = ((orc_uint8) var35 & 0x00ff) | ((orc_uint8) var35 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var35; + _dest.x2[1] = var35; + var34.i = _dest.i; + } /* 3: storew */ ptr0[i] = var34; } @@ -1445,7 +1583,7 @@ cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const orc_uint8 * s1, int n) #else static void -_backup_cogorc_upsample_horiz_cosite_1tap (OrcExecutor * ex) +_backup_cogorc_upsample_horiz_cosite_1tap (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -1465,7 +1603,12 @@ _backup_cogorc_upsample_horiz_cosite_1tap (OrcExecutor * ex) /* 1: copyb */ var35 = var33; /* 2: mergebw */ - var34.i = ((orc_uint8) var35 & 0x00ff) | ((orc_uint8) var35 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var35; + _dest.x2[1] = var35; + var34.i = _dest.i; + } /* 3: storew */ ptr0[i] = var34; } @@ -1473,7 +1616,8 @@ _backup_cogorc_upsample_horiz_cosite_1tap (OrcExecutor * ex) } void -cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const orc_uint8 * s1, int n) +cogorc_upsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -1483,7 +1627,6 @@ cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const orc_uint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_upsample_horiz_cosite_1tap"); @@ -1498,7 +1641,7 @@ cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const orc_uint8 * s1, int n) orc_program_append_2 (p, "mergebw", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -1518,8 +1661,8 @@ cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const orc_uint8 * s1, int n) /* cogorc_upsample_horiz_cosite */ #ifdef DISABLE_ORC void -cogorc_upsample_horiz_cosite (guint8 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, int n) +cogorc_upsample_horiz_cosite (guint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int n) { int i; orc_union16 *ORC_RESTRICT ptr0; @@ -1546,7 +1689,12 @@ cogorc_upsample_horiz_cosite (guint8 * d1, const orc_uint8 * s1, /* 3: avgub */ var38 = ((orc_uint8) var37 + (orc_uint8) var35 + 1) >> 1; /* 4: mergebw */ - var36.i = ((orc_uint8) var37 & 0x00ff) | ((orc_uint8) var38 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37; + _dest.x2[1] = var38; + var36.i = _dest.i; + } /* 5: storew */ ptr0[i] = var36; } @@ -1555,7 +1703,7 @@ cogorc_upsample_horiz_cosite (guint8 * d1, const orc_uint8 * s1, #else static void -_backup_cogorc_upsample_horiz_cosite (OrcExecutor * ex) +_backup_cogorc_upsample_horiz_cosite (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -1583,7 +1731,12 @@ _backup_cogorc_upsample_horiz_cosite (OrcExecutor * ex) /* 3: avgub */ var38 = ((orc_uint8) var37 + (orc_uint8) var35 + 1) >> 1; /* 4: mergebw */ - var36.i = ((orc_uint8) var37 & 0x00ff) | ((orc_uint8) var38 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37; + _dest.x2[1] = var38; + var36.i = _dest.i; + } /* 5: storew */ ptr0[i] = var36; } @@ -1591,8 +1744,8 @@ _backup_cogorc_upsample_horiz_cosite (OrcExecutor * ex) } void -cogorc_upsample_horiz_cosite (guint8 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, int n) +cogorc_upsample_horiz_cosite (guint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -1602,7 +1755,6 @@ cogorc_upsample_horiz_cosite (guint8 * d1, const orc_uint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_upsample_horiz_cosite"); @@ -1620,7 +1772,7 @@ cogorc_upsample_horiz_cosite (guint8 * d1, const orc_uint8 * s1, orc_program_append_2 (p, "mergebw", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -1641,8 +1793,8 @@ cogorc_upsample_horiz_cosite (guint8 * d1, const orc_uint8 * s1, /* cogorc_upsample_vert_avgub */ #ifdef DISABLE_ORC void -cogorc_upsample_vert_avgub (orc_uint8 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, int n) +cogorc_upsample_vert_avgub (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -1672,7 +1824,7 @@ cogorc_upsample_vert_avgub (orc_uint8 * d1, const orc_uint8 * s1, #else static void -_backup_cogorc_upsample_vert_avgub (OrcExecutor * ex) +_backup_cogorc_upsample_vert_avgub (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -1702,8 +1854,8 @@ _backup_cogorc_upsample_vert_avgub (OrcExecutor * ex) } void -cogorc_upsample_vert_avgub (orc_uint8 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, int n) +cogorc_upsample_vert_avgub (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -1713,7 +1865,6 @@ cogorc_upsample_vert_avgub (orc_uint8 * d1, const orc_uint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_upsample_vert_avgub"); @@ -1725,7 +1876,7 @@ cogorc_upsample_vert_avgub (orc_uint8 * d1, const orc_uint8 * s1, orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_S2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -1746,7 +1897,8 @@ cogorc_upsample_vert_avgub (orc_uint8 * d1, const orc_uint8 * s1, /* orc_unpack_yuyv_y */ #ifdef DISABLE_ORC void -orc_unpack_yuyv_y (orc_uint8 * d1, const orc_uint16 * s1, int n) +orc_unpack_yuyv_y (orc_uint8 * ORC_RESTRICT d1, + const orc_uint16 * ORC_RESTRICT s1, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -1762,7 +1914,11 @@ orc_unpack_yuyv_y (orc_uint8 * d1, const orc_uint16 * s1, int n) /* 0: loadw */ var32 = ptr4[i]; /* 1: select0wb */ - var33 = (orc_uint16) var32.i & 0xff; + { + orc_union16 _src; + _src.i = var32.i; + var33 = _src.x2[0]; + } /* 2: storeb */ ptr0[i] = var33; } @@ -1771,7 +1927,7 @@ orc_unpack_yuyv_y (orc_uint8 * d1, const orc_uint16 * s1, int n) #else static void -_backup_orc_unpack_yuyv_y (OrcExecutor * ex) +_backup_orc_unpack_yuyv_y (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -1788,7 +1944,11 @@ _backup_orc_unpack_yuyv_y (OrcExecutor * ex) /* 0: loadw */ var32 = ptr4[i]; /* 1: select0wb */ - var33 = (orc_uint16) var32.i & 0xff; + { + orc_union16 _src; + _src.i = var32.i; + var33 = _src.x2[0]; + } /* 2: storeb */ ptr0[i] = var33; } @@ -1796,7 +1956,8 @@ _backup_orc_unpack_yuyv_y (OrcExecutor * ex) } void -orc_unpack_yuyv_y (orc_uint8 * d1, const orc_uint16 * s1, int n) +orc_unpack_yuyv_y (orc_uint8 * ORC_RESTRICT d1, + const orc_uint16 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -1806,7 +1967,6 @@ orc_unpack_yuyv_y (orc_uint8 * d1, const orc_uint16 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_unpack_yuyv_y"); @@ -1817,7 +1977,7 @@ orc_unpack_yuyv_y (orc_uint8 * d1, const orc_uint16 * s1, int n) orc_program_append_2 (p, "select0wb", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -1837,7 +1997,8 @@ orc_unpack_yuyv_y (orc_uint8 * d1, const orc_uint16 * s1, int n) /* orc_unpack_yuyv_u */ #ifdef DISABLE_ORC void -orc_unpack_yuyv_u (orc_uint8 * d1, const orc_uint32 * s1, int n) +orc_unpack_yuyv_u (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -1854,9 +2015,17 @@ orc_unpack_yuyv_u (orc_uint8 * d1, const orc_uint32 * s1, int n) /* 0: loadl */ var33 = ptr4[i]; /* 1: select0lw */ - var35.i = (orc_uint32) var33.i & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[0]; + } /* 2: select1wb */ - var34 = ((orc_uint16) var35.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[1]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -1865,7 +2034,7 @@ orc_unpack_yuyv_u (orc_uint8 * d1, const orc_uint32 * s1, int n) #else static void -_backup_orc_unpack_yuyv_u (OrcExecutor * ex) +_backup_orc_unpack_yuyv_u (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -1883,9 +2052,17 @@ _backup_orc_unpack_yuyv_u (OrcExecutor * ex) /* 0: loadl */ var33 = ptr4[i]; /* 1: select0lw */ - var35.i = (orc_uint32) var33.i & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[0]; + } /* 2: select1wb */ - var34 = ((orc_uint16) var35.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[1]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -1893,7 +2070,8 @@ _backup_orc_unpack_yuyv_u (OrcExecutor * ex) } void -orc_unpack_yuyv_u (orc_uint8 * d1, const orc_uint32 * s1, int n) +orc_unpack_yuyv_u (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -1903,7 +2081,6 @@ orc_unpack_yuyv_u (orc_uint8 * d1, const orc_uint32 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_unpack_yuyv_u"); @@ -1917,7 +2094,7 @@ orc_unpack_yuyv_u (orc_uint8 * d1, const orc_uint32 * s1, int n) orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -1937,7 +2114,8 @@ orc_unpack_yuyv_u (orc_uint8 * d1, const orc_uint32 * s1, int n) /* orc_unpack_yuyv_v */ #ifdef DISABLE_ORC void -orc_unpack_yuyv_v (orc_uint8 * d1, const orc_uint32 * s1, int n) +orc_unpack_yuyv_v (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -1954,9 +2132,17 @@ orc_unpack_yuyv_v (orc_uint8 * d1, const orc_uint32 * s1, int n) /* 0: loadl */ var33 = ptr4[i]; /* 1: select1lw */ - var35.i = ((orc_uint32) var33.i >> 16) & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[1]; + } /* 2: select1wb */ - var34 = ((orc_uint16) var35.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[1]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -1965,7 +2151,7 @@ orc_unpack_yuyv_v (orc_uint8 * d1, const orc_uint32 * s1, int n) #else static void -_backup_orc_unpack_yuyv_v (OrcExecutor * ex) +_backup_orc_unpack_yuyv_v (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -1983,9 +2169,17 @@ _backup_orc_unpack_yuyv_v (OrcExecutor * ex) /* 0: loadl */ var33 = ptr4[i]; /* 1: select1lw */ - var35.i = ((orc_uint32) var33.i >> 16) & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[1]; + } /* 2: select1wb */ - var34 = ((orc_uint16) var35.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[1]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -1993,7 +2187,8 @@ _backup_orc_unpack_yuyv_v (OrcExecutor * ex) } void -orc_unpack_yuyv_v (orc_uint8 * d1, const orc_uint32 * s1, int n) +orc_unpack_yuyv_v (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -2003,7 +2198,6 @@ orc_unpack_yuyv_v (orc_uint8 * d1, const orc_uint32 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_unpack_yuyv_v"); @@ -2017,7 +2211,7 @@ orc_unpack_yuyv_v (orc_uint8 * d1, const orc_uint32 * s1, int n) orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -2037,8 +2231,8 @@ orc_unpack_yuyv_v (orc_uint8 * d1, const orc_uint32 * s1, int n) /* orc_pack_yuyv */ #ifdef DISABLE_ORC void -orc_pack_yuyv (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2, - const orc_uint8 * s3, int n) +orc_pack_yuyv (orc_uint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -2067,20 +2261,42 @@ orc_pack_yuyv (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2, /* 1: copyw */ var41.i = var37.i; /* 2: select0wb */ - var42 = (orc_uint16) var41.i & 0xff; + { + orc_union16 _src; + _src.i = var41.i; + var42 = _src.x2[0]; + } /* 3: select1wb */ - var43 = ((orc_uint16) var41.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var41.i; + var43 = _src.x2[1]; + } /* 4: loadb */ var38 = ptr5[i]; /* 5: mergebw */ - var44.i = ((orc_uint8) var42 & 0x00ff) | ((orc_uint8) var38 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var42; + _dest.x2[1] = var38; + var44.i = _dest.i; + } /* 6: loadb */ var39 = ptr6[i]; /* 7: mergebw */ - var45.i = ((orc_uint8) var43 & 0x00ff) | ((orc_uint8) var39 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var43; + _dest.x2[1] = var39; + var45.i = _dest.i; + } /* 8: mergewl */ - var40.i = - ((orc_uint16) var44.i & 0x0000ffff) | ((orc_uint16) var45.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var44.i; + _dest.x2[1] = var45.i; + var40.i = _dest.i; + } /* 9: storel */ ptr0[i] = var40; } @@ -2089,7 +2305,7 @@ orc_pack_yuyv (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2, #else static void -_backup_orc_pack_yuyv (OrcExecutor * ex) +_backup_orc_pack_yuyv (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -2119,20 +2335,42 @@ _backup_orc_pack_yuyv (OrcExecutor * ex) /* 1: copyw */ var41.i = var37.i; /* 2: select0wb */ - var42 = (orc_uint16) var41.i & 0xff; + { + orc_union16 _src; + _src.i = var41.i; + var42 = _src.x2[0]; + } /* 3: select1wb */ - var43 = ((orc_uint16) var41.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var41.i; + var43 = _src.x2[1]; + } /* 4: loadb */ var38 = ptr5[i]; /* 5: mergebw */ - var44.i = ((orc_uint8) var42 & 0x00ff) | ((orc_uint8) var38 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var42; + _dest.x2[1] = var38; + var44.i = _dest.i; + } /* 6: loadb */ var39 = ptr6[i]; /* 7: mergebw */ - var45.i = ((orc_uint8) var43 & 0x00ff) | ((orc_uint8) var39 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var43; + _dest.x2[1] = var39; + var45.i = _dest.i; + } /* 8: mergewl */ - var40.i = - ((orc_uint16) var44.i & 0x0000ffff) | ((orc_uint16) var45.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var44.i; + _dest.x2[1] = var45.i; + var40.i = _dest.i; + } /* 9: storel */ ptr0[i] = var40; } @@ -2140,8 +2378,8 @@ _backup_orc_pack_yuyv (OrcExecutor * ex) } void -orc_pack_yuyv (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2, - const orc_uint8 * s3, int n) +orc_pack_yuyv (orc_uint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -2151,7 +2389,6 @@ orc_pack_yuyv (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_pack_yuyv"); @@ -2179,7 +2416,7 @@ orc_pack_yuyv (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2, orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -2201,7 +2438,8 @@ orc_pack_yuyv (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2, /* orc_unpack_uyvy_y */ #ifdef DISABLE_ORC void -orc_unpack_uyvy_y (orc_uint8 * d1, const orc_uint16 * s1, int n) +orc_unpack_uyvy_y (orc_uint8 * ORC_RESTRICT d1, + const orc_uint16 * ORC_RESTRICT s1, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -2217,7 +2455,11 @@ orc_unpack_uyvy_y (orc_uint8 * d1, const orc_uint16 * s1, int n) /* 0: loadw */ var32 = ptr4[i]; /* 1: select1wb */ - var33 = ((orc_uint16) var32.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var32.i; + var33 = _src.x2[1]; + } /* 2: storeb */ ptr0[i] = var33; } @@ -2226,7 +2468,7 @@ orc_unpack_uyvy_y (orc_uint8 * d1, const orc_uint16 * s1, int n) #else static void -_backup_orc_unpack_uyvy_y (OrcExecutor * ex) +_backup_orc_unpack_uyvy_y (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -2243,7 +2485,11 @@ _backup_orc_unpack_uyvy_y (OrcExecutor * ex) /* 0: loadw */ var32 = ptr4[i]; /* 1: select1wb */ - var33 = ((orc_uint16) var32.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var32.i; + var33 = _src.x2[1]; + } /* 2: storeb */ ptr0[i] = var33; } @@ -2251,7 +2497,8 @@ _backup_orc_unpack_uyvy_y (OrcExecutor * ex) } void -orc_unpack_uyvy_y (orc_uint8 * d1, const orc_uint16 * s1, int n) +orc_unpack_uyvy_y (orc_uint8 * ORC_RESTRICT d1, + const orc_uint16 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -2261,7 +2508,6 @@ orc_unpack_uyvy_y (orc_uint8 * d1, const orc_uint16 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_unpack_uyvy_y"); @@ -2272,7 +2518,7 @@ orc_unpack_uyvy_y (orc_uint8 * d1, const orc_uint16 * s1, int n) orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -2292,7 +2538,8 @@ orc_unpack_uyvy_y (orc_uint8 * d1, const orc_uint16 * s1, int n) /* orc_unpack_uyvy_u */ #ifdef DISABLE_ORC void -orc_unpack_uyvy_u (orc_uint8 * d1, const orc_uint32 * s1, int n) +orc_unpack_uyvy_u (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -2309,9 +2556,17 @@ orc_unpack_uyvy_u (orc_uint8 * d1, const orc_uint32 * s1, int n) /* 0: loadl */ var33 = ptr4[i]; /* 1: select0lw */ - var35.i = (orc_uint32) var33.i & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[0]; + } /* 2: select0wb */ - var34 = (orc_uint16) var35.i & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[0]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -2320,7 +2575,7 @@ orc_unpack_uyvy_u (orc_uint8 * d1, const orc_uint32 * s1, int n) #else static void -_backup_orc_unpack_uyvy_u (OrcExecutor * ex) +_backup_orc_unpack_uyvy_u (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -2338,9 +2593,17 @@ _backup_orc_unpack_uyvy_u (OrcExecutor * ex) /* 0: loadl */ var33 = ptr4[i]; /* 1: select0lw */ - var35.i = (orc_uint32) var33.i & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[0]; + } /* 2: select0wb */ - var34 = (orc_uint16) var35.i & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[0]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -2348,7 +2611,8 @@ _backup_orc_unpack_uyvy_u (OrcExecutor * ex) } void -orc_unpack_uyvy_u (orc_uint8 * d1, const orc_uint32 * s1, int n) +orc_unpack_uyvy_u (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -2358,7 +2622,6 @@ orc_unpack_uyvy_u (orc_uint8 * d1, const orc_uint32 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_unpack_uyvy_u"); @@ -2372,7 +2635,7 @@ orc_unpack_uyvy_u (orc_uint8 * d1, const orc_uint32 * s1, int n) orc_program_append_2 (p, "select0wb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -2392,7 +2655,8 @@ orc_unpack_uyvy_u (orc_uint8 * d1, const orc_uint32 * s1, int n) /* orc_unpack_uyvy_v */ #ifdef DISABLE_ORC void -orc_unpack_uyvy_v (orc_uint8 * d1, const orc_uint32 * s1, int n) +orc_unpack_uyvy_v (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -2409,9 +2673,17 @@ orc_unpack_uyvy_v (orc_uint8 * d1, const orc_uint32 * s1, int n) /* 0: loadl */ var33 = ptr4[i]; /* 1: select1lw */ - var35.i = ((orc_uint32) var33.i >> 16) & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[1]; + } /* 2: select0wb */ - var34 = (orc_uint16) var35.i & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[0]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -2420,7 +2692,7 @@ orc_unpack_uyvy_v (orc_uint8 * d1, const orc_uint32 * s1, int n) #else static void -_backup_orc_unpack_uyvy_v (OrcExecutor * ex) +_backup_orc_unpack_uyvy_v (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -2438,9 +2710,17 @@ _backup_orc_unpack_uyvy_v (OrcExecutor * ex) /* 0: loadl */ var33 = ptr4[i]; /* 1: select1lw */ - var35.i = ((orc_uint32) var33.i >> 16) & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[1]; + } /* 2: select0wb */ - var34 = (orc_uint16) var35.i & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[0]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -2448,7 +2728,8 @@ _backup_orc_unpack_uyvy_v (OrcExecutor * ex) } void -orc_unpack_uyvy_v (orc_uint8 * d1, const orc_uint32 * s1, int n) +orc_unpack_uyvy_v (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -2458,7 +2739,6 @@ orc_unpack_uyvy_v (orc_uint8 * d1, const orc_uint32 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_unpack_uyvy_v"); @@ -2472,7 +2752,7 @@ orc_unpack_uyvy_v (orc_uint8 * d1, const orc_uint32 * s1, int n) orc_program_append_2 (p, "select0wb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -2492,8 +2772,8 @@ orc_unpack_uyvy_v (orc_uint8 * d1, const orc_uint32 * s1, int n) /* orc_pack_uyvy */ #ifdef DISABLE_ORC void -orc_pack_uyvy (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2, - const orc_uint8 * s3, int n) +orc_pack_uyvy (orc_uint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -2522,20 +2802,42 @@ orc_pack_uyvy (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2, /* 1: copyw */ var41.i = var37.i; /* 2: select0wb */ - var42 = (orc_uint16) var41.i & 0xff; + { + orc_union16 _src; + _src.i = var41.i; + var42 = _src.x2[0]; + } /* 3: select1wb */ - var43 = ((orc_uint16) var41.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var41.i; + var43 = _src.x2[1]; + } /* 4: loadb */ var38 = ptr5[i]; /* 5: mergebw */ - var44.i = ((orc_uint8) var38 & 0x00ff) | ((orc_uint8) var42 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var38; + _dest.x2[1] = var42; + var44.i = _dest.i; + } /* 6: loadb */ var39 = ptr6[i]; /* 7: mergebw */ - var45.i = ((orc_uint8) var39 & 0x00ff) | ((orc_uint8) var43 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39; + _dest.x2[1] = var43; + var45.i = _dest.i; + } /* 8: mergewl */ - var40.i = - ((orc_uint16) var44.i & 0x0000ffff) | ((orc_uint16) var45.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var44.i; + _dest.x2[1] = var45.i; + var40.i = _dest.i; + } /* 9: storel */ ptr0[i] = var40; } @@ -2544,7 +2846,7 @@ orc_pack_uyvy (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2, #else static void -_backup_orc_pack_uyvy (OrcExecutor * ex) +_backup_orc_pack_uyvy (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -2574,20 +2876,42 @@ _backup_orc_pack_uyvy (OrcExecutor * ex) /* 1: copyw */ var41.i = var37.i; /* 2: select0wb */ - var42 = (orc_uint16) var41.i & 0xff; + { + orc_union16 _src; + _src.i = var41.i; + var42 = _src.x2[0]; + } /* 3: select1wb */ - var43 = ((orc_uint16) var41.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var41.i; + var43 = _src.x2[1]; + } /* 4: loadb */ var38 = ptr5[i]; /* 5: mergebw */ - var44.i = ((orc_uint8) var38 & 0x00ff) | ((orc_uint8) var42 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var38; + _dest.x2[1] = var42; + var44.i = _dest.i; + } /* 6: loadb */ var39 = ptr6[i]; /* 7: mergebw */ - var45.i = ((orc_uint8) var39 & 0x00ff) | ((orc_uint8) var43 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39; + _dest.x2[1] = var43; + var45.i = _dest.i; + } /* 8: mergewl */ - var40.i = - ((orc_uint16) var44.i & 0x0000ffff) | ((orc_uint16) var45.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var44.i; + _dest.x2[1] = var45.i; + var40.i = _dest.i; + } /* 9: storel */ ptr0[i] = var40; } @@ -2595,8 +2919,8 @@ _backup_orc_pack_uyvy (OrcExecutor * ex) } void -orc_pack_uyvy (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2, - const orc_uint8 * s3, int n) +orc_pack_uyvy (orc_uint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -2606,7 +2930,6 @@ orc_pack_uyvy (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_pack_uyvy"); @@ -2634,7 +2957,7 @@ orc_pack_uyvy (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2, orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -2656,7 +2979,8 @@ orc_pack_uyvy (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2, /* orc_addc_convert_u8_s16 */ #ifdef DISABLE_ORC void -orc_addc_convert_u8_s16 (orc_uint8 * d1, const gint16 * s1, int n) +orc_addc_convert_u8_s16 (orc_uint8 * ORC_RESTRICT d1, + const gint16 * ORC_RESTRICT s1, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -2670,7 +2994,7 @@ orc_addc_convert_u8_s16 (orc_uint8 * d1, const gint16 * s1, int n) ptr4 = (orc_union16 *) s1; /* 1: loadpw */ - var34.i = 0x00000080; /* 128 or 6.32404e-322f */ + var34.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadw */ @@ -2687,7 +3011,7 @@ orc_addc_convert_u8_s16 (orc_uint8 * d1, const gint16 * s1, int n) #else static void -_backup_orc_addc_convert_u8_s16 (OrcExecutor * ex) +_backup_orc_addc_convert_u8_s16 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -2702,7 +3026,7 @@ _backup_orc_addc_convert_u8_s16 (OrcExecutor * ex) ptr4 = (orc_union16 *) ex->arrays[4]; /* 1: loadpw */ - var34.i = 0x00000080; /* 128 or 6.32404e-322f */ + var34.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadw */ @@ -2718,7 +3042,8 @@ _backup_orc_addc_convert_u8_s16 (OrcExecutor * ex) } void -orc_addc_convert_u8_s16 (orc_uint8 * d1, const gint16 * s1, int n) +orc_addc_convert_u8_s16 (orc_uint8 * ORC_RESTRICT d1, + const gint16 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -2728,7 +3053,6 @@ orc_addc_convert_u8_s16 (orc_uint8 * d1, const gint16 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_addc_convert_u8_s16"); @@ -2743,7 +3067,7 @@ orc_addc_convert_u8_s16 (orc_uint8 * d1, const gint16 * s1, int n) orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -2763,7 +3087,8 @@ orc_addc_convert_u8_s16 (orc_uint8 * d1, const gint16 * s1, int n) /* orc_subc_convert_s16_u8 */ #ifdef DISABLE_ORC void -orc_subc_convert_s16_u8 (gint16 * d1, const orc_uint8 * s1, int n) +orc_subc_convert_s16_u8 (gint16 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, int n) { int i; orc_union16 *ORC_RESTRICT ptr0; @@ -2777,7 +3102,7 @@ orc_subc_convert_s16_u8 (gint16 * d1, const orc_uint8 * s1, int n) ptr4 = (orc_int8 *) s1; /* 2: loadpw */ - var34.i = 0x00000080; /* 128 or 6.32404e-322f */ + var34.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -2794,7 +3119,7 @@ orc_subc_convert_s16_u8 (gint16 * d1, const orc_uint8 * s1, int n) #else static void -_backup_orc_subc_convert_s16_u8 (OrcExecutor * ex) +_backup_orc_subc_convert_s16_u8 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -2809,7 +3134,7 @@ _backup_orc_subc_convert_s16_u8 (OrcExecutor * ex) ptr4 = (orc_int8 *) ex->arrays[4]; /* 2: loadpw */ - var34.i = 0x00000080; /* 128 or 6.32404e-322f */ + var34.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -2825,7 +3150,8 @@ _backup_orc_subc_convert_s16_u8 (OrcExecutor * ex) } void -orc_subc_convert_s16_u8 (gint16 * d1, const orc_uint8 * s1, int n) +orc_subc_convert_s16_u8 (gint16 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -2835,7 +3161,6 @@ orc_subc_convert_s16_u8 (gint16 * d1, const orc_uint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_subc_convert_s16_u8"); @@ -2850,7 +3175,7 @@ orc_subc_convert_s16_u8 (gint16 * d1, const orc_uint8 * s1, int n) orc_program_append_2 (p, "subw", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_C1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -2870,7 +3195,7 @@ orc_subc_convert_s16_u8 (gint16 * d1, const orc_uint8 * s1, int n) /* orc_splat_u8_ns */ #ifdef DISABLE_ORC void -orc_splat_u8_ns (orc_uint8 * d1, int p1, int n) +orc_splat_u8_ns (orc_uint8 * ORC_RESTRICT d1, int p1, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -2893,7 +3218,7 @@ orc_splat_u8_ns (orc_uint8 * d1, int p1, int n) #else static void -_backup_orc_splat_u8_ns (OrcExecutor * ex) +_backup_orc_splat_u8_ns (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -2916,7 +3241,7 @@ _backup_orc_splat_u8_ns (OrcExecutor * ex) } void -orc_splat_u8_ns (orc_uint8 * d1, int p1, int n) +orc_splat_u8_ns (orc_uint8 * ORC_RESTRICT d1, int p1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -2926,7 +3251,6 @@ orc_splat_u8_ns (orc_uint8 * d1, int p1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_splat_u8_ns"); @@ -2937,7 +3261,7 @@ orc_splat_u8_ns (orc_uint8 * d1, int p1, int n) orc_program_append_2 (p, "copyb", 0, ORC_VAR_D1, ORC_VAR_P1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -2957,7 +3281,7 @@ orc_splat_u8_ns (orc_uint8 * d1, int p1, int n) /* orc_splat_s16_ns */ #ifdef DISABLE_ORC void -orc_splat_s16_ns (gint16 * d1, int p1, int n) +orc_splat_s16_ns (gint16 * ORC_RESTRICT d1, int p1, int n) { int i; orc_union16 *ORC_RESTRICT ptr0; @@ -2980,7 +3304,7 @@ orc_splat_s16_ns (gint16 * d1, int p1, int n) #else static void -_backup_orc_splat_s16_ns (OrcExecutor * ex) +_backup_orc_splat_s16_ns (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -3003,7 +3327,7 @@ _backup_orc_splat_s16_ns (OrcExecutor * ex) } void -orc_splat_s16_ns (gint16 * d1, int p1, int n) +orc_splat_s16_ns (gint16 * ORC_RESTRICT d1, int p1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -3013,7 +3337,6 @@ orc_splat_s16_ns (gint16 * d1, int p1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_splat_s16_ns"); @@ -3024,7 +3347,7 @@ orc_splat_s16_ns (gint16 * d1, int p1, int n) orc_program_append_2 (p, "copyw", 0, ORC_VAR_D1, ORC_VAR_P1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -3044,8 +3367,8 @@ orc_splat_s16_ns (gint16 * d1, int p1, int n) /* orc_matrix2_u8 */ #ifdef DISABLE_ORC void -orc_matrix2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, - int p2, int p3, int n) +orc_matrix2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int p1, int p2, int p3, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -3105,7 +3428,7 @@ orc_matrix2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, #else static void -_backup_orc_matrix2_u8 (OrcExecutor * ex) +_backup_orc_matrix2_u8 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -3165,8 +3488,8 @@ _backup_orc_matrix2_u8 (OrcExecutor * ex) } void -orc_matrix2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, - int p2, int p3, int n) +orc_matrix2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int p1, int p2, int p3, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -3176,7 +3499,6 @@ orc_matrix2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_matrix2_u8"); @@ -3208,7 +3530,7 @@ orc_matrix2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -3232,8 +3554,8 @@ orc_matrix2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, /* orc_matrix2_11_u8 */ #ifdef DISABLE_ORC void -orc_matrix2_11_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, - int p2, int n) +orc_matrix2_11_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int p1, int p2, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -3264,15 +3586,15 @@ orc_matrix2_11_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, ptr5 = (orc_int8 *) s2; /* 2: loadpw */ - var37.i = 0x00000010; /* 16 or 7.90505e-323f */ + var37.i = (int) 0x00000010; /* 16 or 7.90505e-323f */ /* 4: loadpw */ var38.i = p1; /* 8: loadpw */ - var40.i = 0x00000080; /* 128 or 6.32404e-322f */ + var40.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 10: loadpw */ var41.i = p2; /* 13: loadpw */ - var42.i = 0x00000080; /* 128 or 6.32404e-322f */ + var42.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -3311,7 +3633,7 @@ orc_matrix2_11_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, #else static void -_backup_orc_matrix2_11_u8 (OrcExecutor * ex) +_backup_orc_matrix2_11_u8 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -3343,15 +3665,15 @@ _backup_orc_matrix2_11_u8 (OrcExecutor * ex) ptr5 = (orc_int8 *) ex->arrays[5]; /* 2: loadpw */ - var37.i = 0x00000010; /* 16 or 7.90505e-323f */ + var37.i = (int) 0x00000010; /* 16 or 7.90505e-323f */ /* 4: loadpw */ var38.i = ex->params[24]; /* 8: loadpw */ - var40.i = 0x00000080; /* 128 or 6.32404e-322f */ + var40.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 10: loadpw */ var41.i = ex->params[25]; /* 13: loadpw */ - var42.i = 0x00000080; /* 128 or 6.32404e-322f */ + var42.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -3389,8 +3711,8 @@ _backup_orc_matrix2_11_u8 (OrcExecutor * ex) } void -orc_matrix2_11_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, - int p2, int n) +orc_matrix2_11_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int p1, int p2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -3400,7 +3722,6 @@ orc_matrix2_11_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_matrix2_11_u8"); @@ -3443,7 +3764,7 @@ orc_matrix2_11_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -3466,8 +3787,8 @@ orc_matrix2_11_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, /* orc_matrix2_12_u8 */ #ifdef DISABLE_ORC void -orc_matrix2_12_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, - int p2, int n) +orc_matrix2_12_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int p1, int p2, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -3499,15 +3820,15 @@ orc_matrix2_12_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, ptr5 = (orc_int8 *) s2; /* 2: loadpw */ - var37.i = 0x00000010; /* 16 or 7.90505e-323f */ + var37.i = (int) 0x00000010; /* 16 or 7.90505e-323f */ /* 4: loadpw */ var38.i = p1; /* 8: loadpw */ - var40.i = 0x00000080; /* 128 or 6.32404e-322f */ + var40.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 10: loadpw */ var41.i = p2; /* 13: loadpw */ - var42.i = 0x00000080; /* 128 or 6.32404e-322f */ + var42.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -3548,7 +3869,7 @@ orc_matrix2_12_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, #else static void -_backup_orc_matrix2_12_u8 (OrcExecutor * ex) +_backup_orc_matrix2_12_u8 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -3581,15 +3902,15 @@ _backup_orc_matrix2_12_u8 (OrcExecutor * ex) ptr5 = (orc_int8 *) ex->arrays[5]; /* 2: loadpw */ - var37.i = 0x00000010; /* 16 or 7.90505e-323f */ + var37.i = (int) 0x00000010; /* 16 or 7.90505e-323f */ /* 4: loadpw */ var38.i = ex->params[24]; /* 8: loadpw */ - var40.i = 0x00000080; /* 128 or 6.32404e-322f */ + var40.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 10: loadpw */ var41.i = ex->params[25]; /* 13: loadpw */ - var42.i = 0x00000080; /* 128 or 6.32404e-322f */ + var42.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -3629,8 +3950,8 @@ _backup_orc_matrix2_12_u8 (OrcExecutor * ex) } void -orc_matrix2_12_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, - int p2, int n) +orc_matrix2_12_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int p1, int p2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -3640,7 +3961,6 @@ orc_matrix2_12_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_matrix2_12_u8"); @@ -3685,7 +4005,7 @@ orc_matrix2_12_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -3708,8 +4028,9 @@ orc_matrix2_12_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, /* orc_matrix3_u8 */ #ifdef DISABLE_ORC void -orc_matrix3_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int p4, int n) +orc_matrix3_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, + int p2, int p3, int p4, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -3786,7 +4107,7 @@ orc_matrix3_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_orc_matrix3_u8 (OrcExecutor * ex) +_backup_orc_matrix3_u8 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -3863,8 +4184,9 @@ _backup_orc_matrix3_u8 (OrcExecutor * ex) } void -orc_matrix3_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int p4, int n) +orc_matrix3_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, + int p2, int p3, int p4, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -3874,7 +4196,6 @@ orc_matrix3_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_matrix3_u8"); @@ -3914,7 +4235,7 @@ orc_matrix3_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -3940,8 +4261,9 @@ orc_matrix3_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, /* orc_matrix3_100_u8 */ #ifdef DISABLE_ORC void -orc_matrix3_100_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int n) +orc_matrix3_100_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, + int p2, int p3, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -3980,19 +4302,19 @@ orc_matrix3_100_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, ptr6 = (orc_int8 *) s3; /* 2: loadpw */ - var36.i = 0x00000010; /* 16 or 7.90505e-323f */ + var36.i = (int) 0x00000010; /* 16 or 7.90505e-323f */ /* 4: loadpw */ var37.i = p1; /* 8: loadpw */ - var39.i = 0x00000080; /* 128 or 6.32404e-322f */ + var39.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 10: loadpw */ var40.i = p2; /* 15: loadpw */ - var42.i = 0x00000080; /* 128 or 6.32404e-322f */ + var42.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 17: loadpw */ var43.i = p3; /* 20: loadpw */ - var44.i = 0x00000080; /* 128 or 6.32404e-322f */ + var44.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -4039,7 +4361,7 @@ orc_matrix3_100_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_orc_matrix3_100_u8 (OrcExecutor * ex) +_backup_orc_matrix3_100_u8 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -4079,19 +4401,19 @@ _backup_orc_matrix3_100_u8 (OrcExecutor * ex) ptr6 = (orc_int8 *) ex->arrays[6]; /* 2: loadpw */ - var36.i = 0x00000010; /* 16 or 7.90505e-323f */ + var36.i = (int) 0x00000010; /* 16 or 7.90505e-323f */ /* 4: loadpw */ var37.i = ex->params[24]; /* 8: loadpw */ - var39.i = 0x00000080; /* 128 or 6.32404e-322f */ + var39.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 10: loadpw */ var40.i = ex->params[25]; /* 15: loadpw */ - var42.i = 0x00000080; /* 128 or 6.32404e-322f */ + var42.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 17: loadpw */ var43.i = ex->params[26]; /* 20: loadpw */ - var44.i = 0x00000080; /* 128 or 6.32404e-322f */ + var44.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -4137,8 +4459,9 @@ _backup_orc_matrix3_100_u8 (OrcExecutor * ex) } void -orc_matrix3_100_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int n) +orc_matrix3_100_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, + int p2, int p3, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -4148,7 +4471,6 @@ orc_matrix3_100_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_matrix3_100_u8"); @@ -4198,7 +4520,7 @@ orc_matrix3_100_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -4223,8 +4545,10 @@ orc_matrix3_100_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, /* orc_matrix3_100_offset_u8 */ #ifdef DISABLE_ORC void -orc_matrix3_100_offset_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int p4, int p5, int n) +orc_matrix3_100_offset_u8 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, + int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -4304,7 +4628,7 @@ orc_matrix3_100_offset_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_orc_matrix3_100_offset_u8 (OrcExecutor * ex) +_backup_orc_matrix3_100_offset_u8 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -4384,8 +4708,10 @@ _backup_orc_matrix3_100_offset_u8 (OrcExecutor * ex) } void -orc_matrix3_100_offset_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int p4, int p5, int n) +orc_matrix3_100_offset_u8 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -4395,7 +4721,6 @@ orc_matrix3_100_offset_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_matrix3_100_offset_u8"); @@ -4438,7 +4763,7 @@ orc_matrix3_100_offset_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -4465,8 +4790,9 @@ orc_matrix3_100_offset_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, /* orc_matrix3_000_u8 */ #ifdef DISABLE_ORC void -orc_matrix3_000_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int p4, int p5, int n) +orc_matrix3_000_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, + int p2, int p3, int p4, int p5, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -4543,7 +4869,7 @@ orc_matrix3_000_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_orc_matrix3_000_u8 (OrcExecutor * ex) +_backup_orc_matrix3_000_u8 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -4620,8 +4946,9 @@ _backup_orc_matrix3_000_u8 (OrcExecutor * ex) } void -orc_matrix3_000_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int p4, int p5, int n) +orc_matrix3_000_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, + int p2, int p3, int p4, int p5, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -4631,7 +4958,6 @@ orc_matrix3_000_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_matrix3_000_u8"); @@ -4671,7 +4997,7 @@ orc_matrix3_000_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "convwb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -4698,8 +5024,9 @@ orc_matrix3_000_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, /* orc_pack_123x */ #ifdef DISABLE_ORC void -orc_pack_123x (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, - const orc_uint8 * s3, int p1, int n) +orc_pack_123x (guint32 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, + const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, + int p1, int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -4728,14 +5055,28 @@ orc_pack_123x (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, /* 1: loadb */ var35 = ptr5[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var34; + _dest.x2[1] = var35; + var39.i = _dest.i; + } /* 3: loadb */ var36 = ptr6[i]; /* 5: mergebw */ - var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var40.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var40.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var39.i; + _dest.x2[1] = var40.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -4744,7 +5085,7 @@ orc_pack_123x (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, #else static void -_backup_orc_pack_123x (OrcExecutor * ex) +_backup_orc_pack_123x (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -4774,14 +5115,28 @@ _backup_orc_pack_123x (OrcExecutor * ex) /* 1: loadb */ var35 = ptr5[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var34; + _dest.x2[1] = var35; + var39.i = _dest.i; + } /* 3: loadb */ var36 = ptr6[i]; /* 5: mergebw */ - var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var40.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var40.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var39.i; + _dest.x2[1] = var40.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -4789,8 +5144,9 @@ _backup_orc_pack_123x (OrcExecutor * ex) } void -orc_pack_123x (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, - const orc_uint8 * s3, int p1, int n) +orc_pack_123x (guint32 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, + const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, + int p1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -4800,7 +5156,6 @@ orc_pack_123x (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_pack_123x"); @@ -4820,7 +5175,7 @@ orc_pack_123x (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -4843,8 +5198,9 @@ orc_pack_123x (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, /* orc_pack_x123 */ #ifdef DISABLE_ORC void -orc_pack_x123 (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, - const orc_uint8 * s3, int p1, int n) +orc_pack_x123 (guint32 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, + const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, + int p1, int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -4871,16 +5227,30 @@ orc_pack_x123 (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, /* 1: loadb */ var35 = ptr4[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var34; + _dest.x2[1] = var35; + var39.i = _dest.i; + } /* 3: loadb */ var36 = ptr5[i]; /* 4: loadb */ var37 = ptr6[i]; /* 5: mergebw */ - var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var40.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var40.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var39.i; + _dest.x2[1] = var40.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -4889,7 +5259,7 @@ orc_pack_x123 (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, #else static void -_backup_orc_pack_x123 (OrcExecutor * ex) +_backup_orc_pack_x123 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -4917,16 +5287,30 @@ _backup_orc_pack_x123 (OrcExecutor * ex) /* 1: loadb */ var35 = ptr4[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var34; + _dest.x2[1] = var35; + var39.i = _dest.i; + } /* 3: loadb */ var36 = ptr5[i]; /* 4: loadb */ var37 = ptr6[i]; /* 5: mergebw */ - var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var40.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var40.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var39.i; + _dest.x2[1] = var40.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -4934,8 +5318,9 @@ _backup_orc_pack_x123 (OrcExecutor * ex) } void -orc_pack_x123 (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, - const orc_uint8 * s3, int p1, int n) +orc_pack_x123 (guint32 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, + const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, + int p1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -4945,7 +5330,6 @@ orc_pack_x123 (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_pack_x123"); @@ -4965,7 +5349,7 @@ orc_pack_x123 (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -4988,7 +5372,8 @@ orc_pack_x123 (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, /* cogorc_combine2_u8 */ #ifdef DISABLE_ORC void -cogorc_combine2_u8 (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, +cogorc_combine2_u8 (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int p1, int p2, int n) { int i; @@ -5043,7 +5428,7 @@ cogorc_combine2_u8 (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, #else static void -_backup_cogorc_combine2_u8 (OrcExecutor * ex) +_backup_cogorc_combine2_u8 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -5097,7 +5482,8 @@ _backup_cogorc_combine2_u8 (OrcExecutor * ex) } void -cogorc_combine2_u8 (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, +cogorc_combine2_u8 (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int p1, int p2, int n) { OrcExecutor _ex, *ex = &_ex; @@ -5108,7 +5494,6 @@ cogorc_combine2_u8 (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_combine2_u8"); @@ -5137,7 +5522,7 @@ cogorc_combine2_u8 (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -5160,9 +5545,10 @@ cogorc_combine2_u8 (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, /* cogorc_combine4_u8 */ #ifdef DISABLE_ORC void -cogorc_combine4_u8 (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, - const orc_uint8 * s3, const orc_uint8 * s4, int p1, int p2, int p3, int p4, - int n) +cogorc_combine4_u8 (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, + int p1, int p2, int p3, int p4, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -5209,7 +5595,7 @@ cogorc_combine4_u8 (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, /* 16: loadpw */ var41.i = p4; /* 19: loadpw */ - var42.i = 0x00000020; /* 32 or 1.58101e-322f */ + var42.i = (int) 0x00000020; /* 32 or 1.58101e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -5256,7 +5642,7 @@ cogorc_combine4_u8 (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, #else static void -_backup_cogorc_combine4_u8 (OrcExecutor * ex) +_backup_cogorc_combine4_u8 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -5304,7 +5690,7 @@ _backup_cogorc_combine4_u8 (OrcExecutor * ex) /* 16: loadpw */ var41.i = ex->params[27]; /* 19: loadpw */ - var42.i = 0x00000020; /* 32 or 1.58101e-322f */ + var42.i = (int) 0x00000020; /* 32 or 1.58101e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -5350,9 +5736,10 @@ _backup_cogorc_combine4_u8 (OrcExecutor * ex) } void -cogorc_combine4_u8 (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, - const orc_uint8 * s3, const orc_uint8 * s4, int p1, int p2, int p3, int p4, - int n) +cogorc_combine4_u8 (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, + int p1, int p2, int p3, int p4, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -5362,7 +5749,6 @@ cogorc_combine4_u8 (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_combine4_u8"); @@ -5410,7 +5796,7 @@ cogorc_combine4_u8 (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -5437,7 +5823,8 @@ cogorc_combine4_u8 (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, /* cogorc_unpack_axyz_0 */ #ifdef DISABLE_ORC void -cogorc_unpack_axyz_0 (orc_uint8 * d1, const orc_uint32 * s1, int n) +cogorc_unpack_axyz_0 (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -5454,9 +5841,17 @@ cogorc_unpack_axyz_0 (orc_uint8 * d1, const orc_uint32 * s1, int n) /* 0: loadl */ var33 = ptr4[i]; /* 1: select0lw */ - var35.i = (orc_uint32) var33.i & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[0]; + } /* 2: select0wb */ - var34 = (orc_uint16) var35.i & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[0]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -5465,7 +5860,7 @@ cogorc_unpack_axyz_0 (orc_uint8 * d1, const orc_uint32 * s1, int n) #else static void -_backup_cogorc_unpack_axyz_0 (OrcExecutor * ex) +_backup_cogorc_unpack_axyz_0 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -5483,9 +5878,17 @@ _backup_cogorc_unpack_axyz_0 (OrcExecutor * ex) /* 0: loadl */ var33 = ptr4[i]; /* 1: select0lw */ - var35.i = (orc_uint32) var33.i & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[0]; + } /* 2: select0wb */ - var34 = (orc_uint16) var35.i & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[0]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -5493,7 +5896,8 @@ _backup_cogorc_unpack_axyz_0 (OrcExecutor * ex) } void -cogorc_unpack_axyz_0 (orc_uint8 * d1, const orc_uint32 * s1, int n) +cogorc_unpack_axyz_0 (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -5503,7 +5907,6 @@ cogorc_unpack_axyz_0 (orc_uint8 * d1, const orc_uint32 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_unpack_axyz_0"); @@ -5517,7 +5920,7 @@ cogorc_unpack_axyz_0 (orc_uint8 * d1, const orc_uint32 * s1, int n) orc_program_append_2 (p, "select0wb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -5537,7 +5940,8 @@ cogorc_unpack_axyz_0 (orc_uint8 * d1, const orc_uint32 * s1, int n) /* cogorc_unpack_axyz_1 */ #ifdef DISABLE_ORC void -cogorc_unpack_axyz_1 (orc_uint8 * d1, const orc_uint32 * s1, int n) +cogorc_unpack_axyz_1 (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -5554,9 +5958,17 @@ cogorc_unpack_axyz_1 (orc_uint8 * d1, const orc_uint32 * s1, int n) /* 0: loadl */ var33 = ptr4[i]; /* 1: select0lw */ - var35.i = (orc_uint32) var33.i & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[0]; + } /* 2: select1wb */ - var34 = ((orc_uint16) var35.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[1]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -5565,7 +5977,7 @@ cogorc_unpack_axyz_1 (orc_uint8 * d1, const orc_uint32 * s1, int n) #else static void -_backup_cogorc_unpack_axyz_1 (OrcExecutor * ex) +_backup_cogorc_unpack_axyz_1 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -5583,9 +5995,17 @@ _backup_cogorc_unpack_axyz_1 (OrcExecutor * ex) /* 0: loadl */ var33 = ptr4[i]; /* 1: select0lw */ - var35.i = (orc_uint32) var33.i & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[0]; + } /* 2: select1wb */ - var34 = ((orc_uint16) var35.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[1]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -5593,7 +6013,8 @@ _backup_cogorc_unpack_axyz_1 (OrcExecutor * ex) } void -cogorc_unpack_axyz_1 (orc_uint8 * d1, const orc_uint32 * s1, int n) +cogorc_unpack_axyz_1 (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -5603,7 +6024,6 @@ cogorc_unpack_axyz_1 (orc_uint8 * d1, const orc_uint32 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_unpack_axyz_1"); @@ -5617,7 +6037,7 @@ cogorc_unpack_axyz_1 (orc_uint8 * d1, const orc_uint32 * s1, int n) orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -5637,7 +6057,8 @@ cogorc_unpack_axyz_1 (orc_uint8 * d1, const orc_uint32 * s1, int n) /* cogorc_unpack_axyz_2 */ #ifdef DISABLE_ORC void -cogorc_unpack_axyz_2 (orc_uint8 * d1, const orc_uint32 * s1, int n) +cogorc_unpack_axyz_2 (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -5654,9 +6075,17 @@ cogorc_unpack_axyz_2 (orc_uint8 * d1, const orc_uint32 * s1, int n) /* 0: loadl */ var33 = ptr4[i]; /* 1: select1lw */ - var35.i = ((orc_uint32) var33.i >> 16) & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[1]; + } /* 2: select0wb */ - var34 = (orc_uint16) var35.i & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[0]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -5665,7 +6094,7 @@ cogorc_unpack_axyz_2 (orc_uint8 * d1, const orc_uint32 * s1, int n) #else static void -_backup_cogorc_unpack_axyz_2 (OrcExecutor * ex) +_backup_cogorc_unpack_axyz_2 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -5683,9 +6112,17 @@ _backup_cogorc_unpack_axyz_2 (OrcExecutor * ex) /* 0: loadl */ var33 = ptr4[i]; /* 1: select1lw */ - var35.i = ((orc_uint32) var33.i >> 16) & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[1]; + } /* 2: select0wb */ - var34 = (orc_uint16) var35.i & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[0]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -5693,7 +6130,8 @@ _backup_cogorc_unpack_axyz_2 (OrcExecutor * ex) } void -cogorc_unpack_axyz_2 (orc_uint8 * d1, const orc_uint32 * s1, int n) +cogorc_unpack_axyz_2 (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -5703,7 +6141,6 @@ cogorc_unpack_axyz_2 (orc_uint8 * d1, const orc_uint32 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_unpack_axyz_2"); @@ -5717,7 +6154,7 @@ cogorc_unpack_axyz_2 (orc_uint8 * d1, const orc_uint32 * s1, int n) orc_program_append_2 (p, "select0wb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -5737,7 +6174,8 @@ cogorc_unpack_axyz_2 (orc_uint8 * d1, const orc_uint32 * s1, int n) /* cogorc_unpack_axyz_3 */ #ifdef DISABLE_ORC void -cogorc_unpack_axyz_3 (orc_uint8 * d1, const orc_uint32 * s1, int n) +cogorc_unpack_axyz_3 (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -5754,9 +6192,17 @@ cogorc_unpack_axyz_3 (orc_uint8 * d1, const orc_uint32 * s1, int n) /* 0: loadl */ var33 = ptr4[i]; /* 1: select1lw */ - var35.i = ((orc_uint32) var33.i >> 16) & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[1]; + } /* 2: select1wb */ - var34 = ((orc_uint16) var35.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[1]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -5765,7 +6211,7 @@ cogorc_unpack_axyz_3 (orc_uint8 * d1, const orc_uint32 * s1, int n) #else static void -_backup_cogorc_unpack_axyz_3 (OrcExecutor * ex) +_backup_cogorc_unpack_axyz_3 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -5783,9 +6229,17 @@ _backup_cogorc_unpack_axyz_3 (OrcExecutor * ex) /* 0: loadl */ var33 = ptr4[i]; /* 1: select1lw */ - var35.i = ((orc_uint32) var33.i >> 16) & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[1]; + } /* 2: select1wb */ - var34 = ((orc_uint16) var35.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[1]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -5793,7 +6247,8 @@ _backup_cogorc_unpack_axyz_3 (OrcExecutor * ex) } void -cogorc_unpack_axyz_3 (orc_uint8 * d1, const orc_uint32 * s1, int n) +cogorc_unpack_axyz_3 (orc_uint8 * ORC_RESTRICT d1, + const orc_uint32 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -5803,7 +6258,6 @@ cogorc_unpack_axyz_3 (orc_uint8 * d1, const orc_uint32 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_unpack_axyz_3"); @@ -5817,7 +6271,7 @@ cogorc_unpack_axyz_3 (orc_uint8 * d1, const orc_uint32 * s1, int n) orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -5837,8 +6291,8 @@ cogorc_unpack_axyz_3 (orc_uint8 * d1, const orc_uint32 * s1, int n) /* cogorc_resample_horiz_1tap */ #ifdef DISABLE_ORC void -cogorc_resample_horiz_1tap (orc_uint8 * d1, const orc_uint8 * s1, int p1, - int p2, int n) +cogorc_resample_horiz_1tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, int p1, int p2, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -5860,7 +6314,7 @@ cogorc_resample_horiz_1tap (orc_uint8 * d1, const orc_uint8 * s1, int p1, #else static void -_backup_cogorc_resample_horiz_1tap (OrcExecutor * ex) +_backup_cogorc_resample_horiz_1tap (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -5882,8 +6336,8 @@ _backup_cogorc_resample_horiz_1tap (OrcExecutor * ex) } void -cogorc_resample_horiz_1tap (orc_uint8 * d1, const orc_uint8 * s1, int p1, - int p2, int n) +cogorc_resample_horiz_1tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, int p1, int p2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -5893,7 +6347,6 @@ cogorc_resample_horiz_1tap (orc_uint8 * d1, const orc_uint8 * s1, int p1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_resample_horiz_1tap"); @@ -5906,7 +6359,7 @@ cogorc_resample_horiz_1tap (orc_uint8 * d1, const orc_uint8 * s1, int p1, orc_program_append_2 (p, "ldresnearb", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_P1, ORC_VAR_P2); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -5928,8 +6381,8 @@ cogorc_resample_horiz_1tap (orc_uint8 * d1, const orc_uint8 * s1, int p1, /* cogorc_resample_horiz_2tap */ #ifdef DISABLE_ORC void -cogorc_resample_horiz_2tap (orc_uint8 * d1, const orc_uint8 * s1, int p1, - int p2, int n) +cogorc_resample_horiz_2tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, int p1, int p2, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -5956,7 +6409,7 @@ cogorc_resample_horiz_2tap (orc_uint8 * d1, const orc_uint8 * s1, int p1, #else static void -_backup_cogorc_resample_horiz_2tap (OrcExecutor * ex) +_backup_cogorc_resample_horiz_2tap (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -5983,8 +6436,8 @@ _backup_cogorc_resample_horiz_2tap (OrcExecutor * ex) } void -cogorc_resample_horiz_2tap (orc_uint8 * d1, const orc_uint8 * s1, int p1, - int p2, int n) +cogorc_resample_horiz_2tap (orc_uint8 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, int p1, int p2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -5994,7 +6447,6 @@ cogorc_resample_horiz_2tap (orc_uint8 * d1, const orc_uint8 * s1, int p1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_resample_horiz_2tap"); @@ -6007,7 +6459,7 @@ cogorc_resample_horiz_2tap (orc_uint8 * d1, const orc_uint8 * s1, int p1, orc_program_append_2 (p, "ldreslinb", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_P1, ORC_VAR_P2); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -6029,9 +6481,10 @@ cogorc_resample_horiz_2tap (orc_uint8 * d1, const orc_uint8 * s1, int p1, /* cogorc_convert_I420_UYVY */ #ifdef DISABLE_ORC void -cogorc_convert_I420_UYVY (orc_uint32 * d1, orc_uint32 * d2, - const orc_uint16 * s1, const orc_uint16 * s2, const orc_uint8 * s3, - const orc_uint8 * s4, int n) +cogorc_convert_I420_UYVY (orc_uint32 * ORC_RESTRICT d1, + orc_uint32 * ORC_RESTRICT d2, const orc_uint16 * ORC_RESTRICT s1, + const orc_uint16 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, + const orc_uint8 * ORC_RESTRICT s4, int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -6062,23 +6515,44 @@ cogorc_convert_I420_UYVY (orc_uint32 * d1, orc_uint32 * d2, /* 1: loadb */ var34 = ptr7[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var39.i = _dest.i; + } /* 3: loadw */ var35 = ptr4[i]; /* 4: mergebw */ - var36.x2[0] = - ((orc_uint8) var39.x2[0] & 0x00ff) | ((orc_uint8) var35.x2[0] << 8); - var36.x2[1] = - ((orc_uint8) var39.x2[1] & 0x00ff) | ((orc_uint8) var35.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39.x2[0]; + _dest.x2[1] = var35.x2[0]; + var36.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var39.x2[1]; + _dest.x2[1] = var35.x2[1]; + var36.x2[1] = _dest.i; + } /* 5: storel */ ptr0[i] = var36; /* 6: loadw */ var37 = ptr5[i]; /* 7: mergebw */ - var38.x2[0] = - ((orc_uint8) var39.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var39.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39.x2[0]; + _dest.x2[1] = var37.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var39.x2[1]; + _dest.x2[1] = var37.x2[1]; + var38.x2[1] = _dest.i; + } /* 8: storel */ ptr1[i] = var38; } @@ -6087,7 +6561,7 @@ cogorc_convert_I420_UYVY (orc_uint32 * d1, orc_uint32 * d2, #else static void -_backup_cogorc_convert_I420_UYVY (OrcExecutor * ex) +_backup_cogorc_convert_I420_UYVY (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -6119,23 +6593,44 @@ _backup_cogorc_convert_I420_UYVY (OrcExecutor * ex) /* 1: loadb */ var34 = ptr7[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var39.i = _dest.i; + } /* 3: loadw */ var35 = ptr4[i]; /* 4: mergebw */ - var36.x2[0] = - ((orc_uint8) var39.x2[0] & 0x00ff) | ((orc_uint8) var35.x2[0] << 8); - var36.x2[1] = - ((orc_uint8) var39.x2[1] & 0x00ff) | ((orc_uint8) var35.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39.x2[0]; + _dest.x2[1] = var35.x2[0]; + var36.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var39.x2[1]; + _dest.x2[1] = var35.x2[1]; + var36.x2[1] = _dest.i; + } /* 5: storel */ ptr0[i] = var36; /* 6: loadw */ var37 = ptr5[i]; /* 7: mergebw */ - var38.x2[0] = - ((orc_uint8) var39.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var39.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39.x2[0]; + _dest.x2[1] = var37.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var39.x2[1]; + _dest.x2[1] = var37.x2[1]; + var38.x2[1] = _dest.i; + } /* 8: storel */ ptr1[i] = var38; } @@ -6143,9 +6638,10 @@ _backup_cogorc_convert_I420_UYVY (OrcExecutor * ex) } void -cogorc_convert_I420_UYVY (orc_uint32 * d1, orc_uint32 * d2, - const orc_uint16 * s1, const orc_uint16 * s2, const orc_uint8 * s3, - const orc_uint8 * s4, int n) +cogorc_convert_I420_UYVY (orc_uint32 * ORC_RESTRICT d1, + orc_uint32 * ORC_RESTRICT d2, const orc_uint16 * ORC_RESTRICT s1, + const orc_uint16 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, + const orc_uint8 * ORC_RESTRICT s4, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -6155,7 +6651,6 @@ cogorc_convert_I420_UYVY (orc_uint32 * d1, orc_uint32 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_convert_I420_UYVY"); @@ -6175,7 +6670,7 @@ cogorc_convert_I420_UYVY (orc_uint32 * d1, orc_uint32 * d2, orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D2, ORC_VAR_T1, ORC_VAR_S2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -6199,9 +6694,10 @@ cogorc_convert_I420_UYVY (orc_uint32 * d1, orc_uint32 * d2, /* cogorc_convert_I420_YUY2 */ #ifdef DISABLE_ORC void -cogorc_convert_I420_YUY2 (orc_uint32 * d1, orc_uint32 * d2, - const orc_uint16 * s1, const orc_uint16 * s2, const orc_uint8 * s3, - const orc_uint8 * s4, int n) +cogorc_convert_I420_YUY2 (orc_uint32 * ORC_RESTRICT d1, + orc_uint32 * ORC_RESTRICT d2, const orc_uint16 * ORC_RESTRICT s1, + const orc_uint16 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, + const orc_uint8 * ORC_RESTRICT s4, int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -6232,23 +6728,44 @@ cogorc_convert_I420_YUY2 (orc_uint32 * d1, orc_uint32 * d2, /* 1: loadb */ var34 = ptr7[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var39.i = _dest.i; + } /* 3: loadw */ var35 = ptr4[i]; /* 4: mergebw */ - var36.x2[0] = - ((orc_uint8) var35.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var36.x2[1] = - ((orc_uint8) var35.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var35.x2[0]; + _dest.x2[1] = var39.x2[0]; + var36.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var35.x2[1]; + _dest.x2[1] = var39.x2[1]; + var36.x2[1] = _dest.i; + } /* 5: storel */ ptr0[i] = var36; /* 6: loadw */ var37 = ptr5[i]; /* 7: mergebw */ - var38.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var39.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var39.x2[1]; + var38.x2[1] = _dest.i; + } /* 8: storel */ ptr1[i] = var38; } @@ -6257,7 +6774,7 @@ cogorc_convert_I420_YUY2 (orc_uint32 * d1, orc_uint32 * d2, #else static void -_backup_cogorc_convert_I420_YUY2 (OrcExecutor * ex) +_backup_cogorc_convert_I420_YUY2 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -6289,23 +6806,44 @@ _backup_cogorc_convert_I420_YUY2 (OrcExecutor * ex) /* 1: loadb */ var34 = ptr7[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var39.i = _dest.i; + } /* 3: loadw */ var35 = ptr4[i]; /* 4: mergebw */ - var36.x2[0] = - ((orc_uint8) var35.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var36.x2[1] = - ((orc_uint8) var35.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var35.x2[0]; + _dest.x2[1] = var39.x2[0]; + var36.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var35.x2[1]; + _dest.x2[1] = var39.x2[1]; + var36.x2[1] = _dest.i; + } /* 5: storel */ ptr0[i] = var36; /* 6: loadw */ var37 = ptr5[i]; /* 7: mergebw */ - var38.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var39.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var39.x2[1]; + var38.x2[1] = _dest.i; + } /* 8: storel */ ptr1[i] = var38; } @@ -6313,9 +6851,10 @@ _backup_cogorc_convert_I420_YUY2 (OrcExecutor * ex) } void -cogorc_convert_I420_YUY2 (orc_uint32 * d1, orc_uint32 * d2, - const orc_uint16 * s1, const orc_uint16 * s2, const orc_uint8 * s3, - const orc_uint8 * s4, int n) +cogorc_convert_I420_YUY2 (orc_uint32 * ORC_RESTRICT d1, + orc_uint32 * ORC_RESTRICT d2, const orc_uint16 * ORC_RESTRICT s1, + const orc_uint16 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, + const orc_uint8 * ORC_RESTRICT s4, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -6325,7 +6864,6 @@ cogorc_convert_I420_YUY2 (orc_uint32 * d1, orc_uint32 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_convert_I420_YUY2"); @@ -6345,7 +6883,7 @@ cogorc_convert_I420_YUY2 (orc_uint32 * d1, orc_uint32 * d2, orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D2, ORC_VAR_S2, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -6369,9 +6907,10 @@ cogorc_convert_I420_YUY2 (orc_uint32 * d1, orc_uint32 * d2, /* cogorc_convert_I420_AYUV */ #ifdef DISABLE_ORC void -cogorc_convert_I420_AYUV (orc_uint32 * d1, orc_uint32 * d2, - const orc_uint8 * s1, const orc_uint8 * s2, const orc_uint8 * s3, - const orc_uint8 * s4, int n) +cogorc_convert_I420_AYUV (orc_uint32 * ORC_RESTRICT d1, + orc_uint32 * ORC_RESTRICT d2, const orc_uint8 * ORC_RESTRICT s1, + const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, + const orc_uint8 * ORC_RESTRICT s4, int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -6400,9 +6939,9 @@ cogorc_convert_I420_AYUV (orc_uint32 * d1, orc_uint32 * d2, ptr7 = (orc_int8 *) s4; /* 3: loadpb */ - var36 = 0x000000ff; /* 255 or 1.25987e-321f */ + var36 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ /* 8: loadpb */ - var39 = 0x000000ff; /* 255 or 1.25987e-321f */ + var39 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadupdb */ @@ -6410,23 +6949,46 @@ cogorc_convert_I420_AYUV (orc_uint32 * d1, orc_uint32 * d2, /* 1: loadupdb */ var43 = ptr7[i >> 1]; /* 2: mergebw */ - var44.i = ((orc_uint8) var42 & 0x00ff) | ((orc_uint8) var43 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var42; + _dest.x2[1] = var43; + var44.i = _dest.i; + } /* 4: loadb */ var37 = ptr4[i]; /* 5: mergebw */ - var45.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var45.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var45.i & 0x0000ffff) | ((orc_uint16) var44.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var45.i; + _dest.x2[1] = var44.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; /* 9: loadb */ var40 = ptr5[i]; /* 10: mergebw */ - var46.i = ((orc_uint8) var39 & 0x00ff) | ((orc_uint8) var40 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39; + _dest.x2[1] = var40; + var46.i = _dest.i; + } /* 11: mergewl */ - var41.i = - ((orc_uint16) var46.i & 0x0000ffff) | ((orc_uint16) var44.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var46.i; + _dest.x2[1] = var44.i; + var41.i = _dest.i; + } /* 12: storel */ ptr1[i] = var41; } @@ -6435,7 +6997,7 @@ cogorc_convert_I420_AYUV (orc_uint32 * d1, orc_uint32 * d2, #else static void -_backup_cogorc_convert_I420_AYUV (OrcExecutor * ex) +_backup_cogorc_convert_I420_AYUV (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -6465,9 +7027,9 @@ _backup_cogorc_convert_I420_AYUV (OrcExecutor * ex) ptr7 = (orc_int8 *) ex->arrays[7]; /* 3: loadpb */ - var36 = 0x000000ff; /* 255 or 1.25987e-321f */ + var36 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ /* 8: loadpb */ - var39 = 0x000000ff; /* 255 or 1.25987e-321f */ + var39 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadupdb */ @@ -6475,23 +7037,46 @@ _backup_cogorc_convert_I420_AYUV (OrcExecutor * ex) /* 1: loadupdb */ var43 = ptr7[i >> 1]; /* 2: mergebw */ - var44.i = ((orc_uint8) var42 & 0x00ff) | ((orc_uint8) var43 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var42; + _dest.x2[1] = var43; + var44.i = _dest.i; + } /* 4: loadb */ var37 = ptr4[i]; /* 5: mergebw */ - var45.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var45.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var45.i & 0x0000ffff) | ((orc_uint16) var44.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var45.i; + _dest.x2[1] = var44.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; /* 9: loadb */ var40 = ptr5[i]; /* 10: mergebw */ - var46.i = ((orc_uint8) var39 & 0x00ff) | ((orc_uint8) var40 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39; + _dest.x2[1] = var40; + var46.i = _dest.i; + } /* 11: mergewl */ - var41.i = - ((orc_uint16) var46.i & 0x0000ffff) | ((orc_uint16) var44.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var46.i; + _dest.x2[1] = var44.i; + var41.i = _dest.i; + } /* 12: storel */ ptr1[i] = var41; } @@ -6499,9 +7084,10 @@ _backup_cogorc_convert_I420_AYUV (OrcExecutor * ex) } void -cogorc_convert_I420_AYUV (orc_uint32 * d1, orc_uint32 * d2, - const orc_uint8 * s1, const orc_uint8 * s2, const orc_uint8 * s3, - const orc_uint8 * s4, int n) +cogorc_convert_I420_AYUV (orc_uint32 * ORC_RESTRICT d1, + orc_uint32 * ORC_RESTRICT d2, const orc_uint8 * ORC_RESTRICT s1, + const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, + const orc_uint8 * ORC_RESTRICT s4, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -6511,7 +7097,6 @@ cogorc_convert_I420_AYUV (orc_uint32 * d1, orc_uint32 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_convert_I420_AYUV"); @@ -6543,7 +7128,7 @@ cogorc_convert_I420_AYUV (orc_uint32 * d1, orc_uint32 * d2, orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D2, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -6567,8 +7152,10 @@ cogorc_convert_I420_AYUV (orc_uint32 * d1, orc_uint32 * d2, /* cogorc_convert_YUY2_I420 */ #ifdef DISABLE_ORC void -cogorc_convert_YUY2_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3, - orc_uint8 * d4, const orc_uint32 * s1, const orc_uint32 * s2, int n) +cogorc_convert_YUY2_I420 (orc_uint16 * ORC_RESTRICT d1, + orc_uint16 * ORC_RESTRICT d2, orc_uint8 * ORC_RESTRICT d3, + orc_uint8 * ORC_RESTRICT d4, const orc_uint32 * ORC_RESTRICT s1, + const orc_uint32 * ORC_RESTRICT s2, int n) { int i; orc_union16 *ORC_RESTRICT ptr0; @@ -6599,27 +7186,47 @@ cogorc_convert_YUY2_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3, /* 0: loadl */ var35 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var35.x2[0] >> 8) & 0xff; - var40.x2[0] = var35.x2[0] & 0xff; - var39.x2[1] = (var35.x2[1] >> 8) & 0xff; - var40.x2[1] = var35.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var35.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var35.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var40; /* 3: loadl */ var36 = ptr5[i]; /* 4: splitwb */ - var41.x2[0] = (var36.x2[0] >> 8) & 0xff; - var42.x2[0] = var36.x2[0] & 0xff; - var41.x2[1] = (var36.x2[1] >> 8) & 0xff; - var42.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var41.x2[0] = _src.x2[1]; + var42.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var41.x2[1] = _src.x2[1]; + var42.x2[1] = _src.x2[0]; + } /* 5: storew */ ptr1[i] = var42; /* 6: avgub */ var43.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var41.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var41.x2[1] + 1) >> 1; /* 7: splitwb */ - var37 = (var43.i >> 8) & 0xff; - var38 = var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var37 = _src.x2[1]; + var38 = _src.x2[0]; + } /* 8: storeb */ ptr3[i] = var37; /* 9: storeb */ @@ -6630,7 +7237,7 @@ cogorc_convert_YUY2_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3, #else static void -_backup_cogorc_convert_YUY2_I420 (OrcExecutor * ex) +_backup_cogorc_convert_YUY2_I420 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -6662,27 +7269,47 @@ _backup_cogorc_convert_YUY2_I420 (OrcExecutor * ex) /* 0: loadl */ var35 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var35.x2[0] >> 8) & 0xff; - var40.x2[0] = var35.x2[0] & 0xff; - var39.x2[1] = (var35.x2[1] >> 8) & 0xff; - var40.x2[1] = var35.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var35.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var35.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var40; /* 3: loadl */ var36 = ptr5[i]; /* 4: splitwb */ - var41.x2[0] = (var36.x2[0] >> 8) & 0xff; - var42.x2[0] = var36.x2[0] & 0xff; - var41.x2[1] = (var36.x2[1] >> 8) & 0xff; - var42.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var41.x2[0] = _src.x2[1]; + var42.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var41.x2[1] = _src.x2[1]; + var42.x2[1] = _src.x2[0]; + } /* 5: storew */ ptr1[i] = var42; /* 6: avgub */ var43.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var41.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var41.x2[1] + 1) >> 1; /* 7: splitwb */ - var37 = (var43.i >> 8) & 0xff; - var38 = var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var37 = _src.x2[1]; + var38 = _src.x2[0]; + } /* 8: storeb */ ptr3[i] = var37; /* 9: storeb */ @@ -6692,8 +7319,10 @@ _backup_cogorc_convert_YUY2_I420 (OrcExecutor * ex) } void -cogorc_convert_YUY2_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3, - orc_uint8 * d4, const orc_uint32 * s1, const orc_uint32 * s2, int n) +cogorc_convert_YUY2_I420 (orc_uint16 * ORC_RESTRICT d1, + orc_uint16 * ORC_RESTRICT d2, orc_uint8 * ORC_RESTRICT d3, + orc_uint8 * ORC_RESTRICT d4, const orc_uint32 * ORC_RESTRICT s1, + const orc_uint32 * ORC_RESTRICT s2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -6703,7 +7332,6 @@ cogorc_convert_YUY2_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_convert_YUY2_I420"); @@ -6731,7 +7359,7 @@ cogorc_convert_YUY2_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3, orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D4, ORC_VAR_D3, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -6755,8 +7383,8 @@ cogorc_convert_YUY2_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3, /* cogorc_convert_UYVY_YUY2 */ #ifdef DISABLE_ORC void -cogorc_convert_UYVY_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_UYVY_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -6785,7 +7413,7 @@ cogorc_convert_UYVY_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, #else static void -_backup_cogorc_convert_UYVY_YUY2 (OrcExecutor * ex) +_backup_cogorc_convert_UYVY_YUY2 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -6815,8 +7443,8 @@ _backup_cogorc_convert_UYVY_YUY2 (OrcExecutor * ex) } void -cogorc_convert_UYVY_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_UYVY_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -6826,7 +7454,6 @@ cogorc_convert_UYVY_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -6838,7 +7465,7 @@ cogorc_convert_UYVY_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, orc_program_append_2 (p, "swapw", 1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -6861,8 +7488,9 @@ cogorc_convert_UYVY_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, /* cogorc_planar_chroma_420_422 */ #ifdef DISABLE_ORC void -cogorc_planar_chroma_420_422 (orc_uint8 * d1, int d1_stride, orc_uint8 * d2, - int d2_stride, const orc_uint8 * s1, int s1_stride, int n, int m) +cogorc_planar_chroma_420_422 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, + orc_uint8 * ORC_RESTRICT d2, int d2_stride, + const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -6900,7 +7528,7 @@ cogorc_planar_chroma_420_422 (orc_uint8 * d1, int d1_stride, orc_uint8 * d2, #else static void -_backup_cogorc_planar_chroma_420_422 (OrcExecutor * ex) +_backup_cogorc_planar_chroma_420_422 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -6939,8 +7567,9 @@ _backup_cogorc_planar_chroma_420_422 (OrcExecutor * ex) } void -cogorc_planar_chroma_420_422 (orc_uint8 * d1, int d1_stride, orc_uint8 * d2, - int d2_stride, const orc_uint8 * s1, int s1_stride, int n, int m) +cogorc_planar_chroma_420_422 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, + orc_uint8 * ORC_RESTRICT d2, int d2_stride, + const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -6950,7 +7579,6 @@ cogorc_planar_chroma_420_422 (orc_uint8 * d1, int d1_stride, orc_uint8 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -6965,7 +7593,7 @@ cogorc_planar_chroma_420_422 (orc_uint8 * d1, int d1_stride, orc_uint8 * d2, orc_program_append_2 (p, "copyb", 0, ORC_VAR_D2, ORC_VAR_S1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -6990,8 +7618,9 @@ cogorc_planar_chroma_420_422 (orc_uint8 * d1, int d1_stride, orc_uint8 * d2, /* cogorc_planar_chroma_420_444 */ #ifdef DISABLE_ORC void -cogorc_planar_chroma_420_444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, - int d2_stride, const orc_uint8 * s1, int s1_stride, int n, int m) +cogorc_planar_chroma_420_444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint16 * ORC_RESTRICT d2, int d2_stride, + const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -7023,7 +7652,7 @@ cogorc_planar_chroma_420_444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, #else static void -_backup_cogorc_planar_chroma_420_444 (OrcExecutor * ex) +_backup_cogorc_planar_chroma_420_444 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -7056,8 +7685,9 @@ _backup_cogorc_planar_chroma_420_444 (OrcExecutor * ex) } void -cogorc_planar_chroma_420_444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, - int d2_stride, const orc_uint8 * s1, int s1_stride, int n, int m) +cogorc_planar_chroma_420_444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint16 * ORC_RESTRICT d2, int d2_stride, + const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -7067,7 +7697,6 @@ cogorc_planar_chroma_420_444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -7085,7 +7714,7 @@ cogorc_planar_chroma_420_444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, orc_program_append_2 (p, "storew", 0, ORC_VAR_D2, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -7110,8 +7739,8 @@ cogorc_planar_chroma_420_444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, /* cogorc_planar_chroma_422_444 */ #ifdef DISABLE_ORC void -cogorc_planar_chroma_422_444 (orc_uint16 * d1, int d1_stride, - const orc_uint8 * s1, int s1_stride, int n, int m) +cogorc_planar_chroma_422_444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -7139,7 +7768,7 @@ cogorc_planar_chroma_422_444 (orc_uint16 * d1, int d1_stride, #else static void -_backup_cogorc_planar_chroma_422_444 (OrcExecutor * ex) +_backup_cogorc_planar_chroma_422_444 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -7168,8 +7797,8 @@ _backup_cogorc_planar_chroma_422_444 (OrcExecutor * ex) } void -cogorc_planar_chroma_422_444 (orc_uint16 * d1, int d1_stride, - const orc_uint8 * s1, int s1_stride, int n, int m) +cogorc_planar_chroma_422_444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -7179,7 +7808,6 @@ cogorc_planar_chroma_422_444 (orc_uint16 * d1, int d1_stride, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -7194,7 +7822,7 @@ cogorc_planar_chroma_422_444 (orc_uint16 * d1, int d1_stride, orc_program_append_2 (p, "storew", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -7217,8 +7845,8 @@ cogorc_planar_chroma_422_444 (orc_uint16 * d1, int d1_stride, /* cogorc_planar_chroma_444_422 */ #ifdef DISABLE_ORC void -cogorc_planar_chroma_444_422 (orc_uint8 * d1, int d1_stride, - const orc_uint16 * s1, int s1_stride, int n, int m) +cogorc_planar_chroma_444_422 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -7238,8 +7866,12 @@ cogorc_planar_chroma_444_422 (orc_uint8 * d1, int d1_stride, /* 0: loadw */ var34 = ptr4[i]; /* 1: splitwb */ - var36 = (var34.i >> 8) & 0xff; - var37 = var34.i & 0xff; + { + orc_union16 _src; + _src.i = var34.i; + var36 = _src.x2[1]; + var37 = _src.x2[0]; + } /* 2: avgub */ var35 = ((orc_uint8) var36 + (orc_uint8) var37 + 1) >> 1; /* 3: storeb */ @@ -7251,7 +7883,7 @@ cogorc_planar_chroma_444_422 (orc_uint8 * d1, int d1_stride, #else static void -_backup_cogorc_planar_chroma_444_422 (OrcExecutor * ex) +_backup_cogorc_planar_chroma_444_422 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -7273,8 +7905,12 @@ _backup_cogorc_planar_chroma_444_422 (OrcExecutor * ex) /* 0: loadw */ var34 = ptr4[i]; /* 1: splitwb */ - var36 = (var34.i >> 8) & 0xff; - var37 = var34.i & 0xff; + { + orc_union16 _src; + _src.i = var34.i; + var36 = _src.x2[1]; + var37 = _src.x2[0]; + } /* 2: avgub */ var35 = ((orc_uint8) var36 + (orc_uint8) var37 + 1) >> 1; /* 3: storeb */ @@ -7285,8 +7921,8 @@ _backup_cogorc_planar_chroma_444_422 (OrcExecutor * ex) } void -cogorc_planar_chroma_444_422 (orc_uint8 * d1, int d1_stride, - const orc_uint16 * s1, int s1_stride, int n, int m) +cogorc_planar_chroma_444_422 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -7296,7 +7932,6 @@ cogorc_planar_chroma_444_422 (orc_uint8 * d1, int d1_stride, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -7312,7 +7947,7 @@ cogorc_planar_chroma_444_422 (orc_uint8 * d1, int d1_stride, orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -7335,9 +7970,9 @@ cogorc_planar_chroma_444_422 (orc_uint8 * d1, int d1_stride, /* cogorc_planar_chroma_444_420 */ #ifdef DISABLE_ORC void -cogorc_planar_chroma_444_420 (orc_uint8 * d1, int d1_stride, - const orc_uint16 * s1, int s1_stride, const orc_uint16 * s2, int s2_stride, - int n, int m) +cogorc_planar_chroma_444_420 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, + const orc_uint16 * ORC_RESTRICT s2, int s2_stride, int n, int m) { int i; int j; @@ -7368,8 +8003,12 @@ cogorc_planar_chroma_444_420 (orc_uint8 * d1, int d1_stride, var38.x2[1] = ((orc_uint8) var35.x2[1] + (orc_uint8) var36.x2[1] + 1) >> 1; /* 3: splitwb */ - var39 = (var38.i >> 8) & 0xff; - var40 = var38.i & 0xff; + { + orc_union16 _src; + _src.i = var38.i; + var39 = _src.x2[1]; + var40 = _src.x2[0]; + } /* 4: avgub */ var37 = ((orc_uint8) var39 + (orc_uint8) var40 + 1) >> 1; /* 5: storeb */ @@ -7381,7 +8020,7 @@ cogorc_planar_chroma_444_420 (orc_uint8 * d1, int d1_stride, #else static void -_backup_cogorc_planar_chroma_444_420 (OrcExecutor * ex) +_backup_cogorc_planar_chroma_444_420 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -7414,8 +8053,12 @@ _backup_cogorc_planar_chroma_444_420 (OrcExecutor * ex) var38.x2[1] = ((orc_uint8) var35.x2[1] + (orc_uint8) var36.x2[1] + 1) >> 1; /* 3: splitwb */ - var39 = (var38.i >> 8) & 0xff; - var40 = var38.i & 0xff; + { + orc_union16 _src; + _src.i = var38.i; + var39 = _src.x2[1]; + var40 = _src.x2[0]; + } /* 4: avgub */ var37 = ((orc_uint8) var39 + (orc_uint8) var40 + 1) >> 1; /* 5: storeb */ @@ -7426,9 +8069,9 @@ _backup_cogorc_planar_chroma_444_420 (OrcExecutor * ex) } void -cogorc_planar_chroma_444_420 (orc_uint8 * d1, int d1_stride, - const orc_uint16 * s1, int s1_stride, const orc_uint16 * s2, int s2_stride, - int n, int m) +cogorc_planar_chroma_444_420 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, + const orc_uint16 * ORC_RESTRICT s2, int s2_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -7438,7 +8081,6 @@ cogorc_planar_chroma_444_420 (orc_uint8 * d1, int d1_stride, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -7458,7 +8100,7 @@ cogorc_planar_chroma_444_420 (orc_uint8 * d1, int d1_stride, orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -7483,9 +8125,9 @@ cogorc_planar_chroma_444_420 (orc_uint8 * d1, int d1_stride, /* cogorc_planar_chroma_422_420 */ #ifdef DISABLE_ORC void -cogorc_planar_chroma_422_420 (orc_uint8 * d1, int d1_stride, - const orc_uint8 * s1, int s1_stride, const orc_uint8 * s2, int s2_stride, - int n, int m) +cogorc_planar_chroma_422_420 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, + const orc_uint8 * ORC_RESTRICT s1, int s1_stride, + const orc_uint8 * ORC_RESTRICT s2, int s2_stride, int n, int m) { int i; int j; @@ -7518,7 +8160,7 @@ cogorc_planar_chroma_422_420 (orc_uint8 * d1, int d1_stride, #else static void -_backup_cogorc_planar_chroma_422_420 (OrcExecutor * ex) +_backup_cogorc_planar_chroma_422_420 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -7552,9 +8194,9 @@ _backup_cogorc_planar_chroma_422_420 (OrcExecutor * ex) } void -cogorc_planar_chroma_422_420 (orc_uint8 * d1, int d1_stride, - const orc_uint8 * s1, int s1_stride, const orc_uint8 * s2, int s2_stride, - int n, int m) +cogorc_planar_chroma_422_420 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, + const orc_uint8 * ORC_RESTRICT s1, int s1_stride, + const orc_uint8 * ORC_RESTRICT s2, int s2_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -7564,7 +8206,6 @@ cogorc_planar_chroma_422_420 (orc_uint8 * d1, int d1_stride, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -7577,7 +8218,7 @@ cogorc_planar_chroma_422_420 (orc_uint8 * d1, int d1_stride, orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_S2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -7602,8 +8243,8 @@ cogorc_planar_chroma_422_420 (orc_uint8 * d1, int d1_stride, /* cogorc_convert_YUY2_AYUV */ #ifdef DISABLE_ORC void -cogorc_convert_YUY2_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_YUY2_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -7622,32 +8263,58 @@ cogorc_convert_YUY2_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1, ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); /* 2: loadpb */ - var37.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var37.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadl */ var36 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var36.x2[0] >> 8) & 0xff; - var40.x2[0] = var36.x2[0] & 0xff; - var39.x2[1] = (var36.x2[1] >> 8) & 0xff; - var40.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 3: mergebw */ - var41.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var40.x2[0] << 8); - var41.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var40.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var40.x2[0]; + var41.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var40.x2[1]; + var41.x2[1] = _dest.i; + } /* 4: mergewl */ - var42.i = - ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var39.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var39.i; + _dest.x2[1] = var39.i; + var42.i = _dest.i; + } /* 5: mergewl */ - var38.x2[0] = - ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var42. - x2[0] << 16); - var38.x2[1] = - ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var42. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[0]; + _dest.x2[1] = var42.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[1]; + _dest.x2[1] = var42.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storeq */ ptr0[i] = var38; } @@ -7657,7 +8324,7 @@ cogorc_convert_YUY2_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1, #else static void -_backup_cogorc_convert_YUY2_AYUV (OrcExecutor * ex) +_backup_cogorc_convert_YUY2_AYUV (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -7678,32 +8345,58 @@ _backup_cogorc_convert_YUY2_AYUV (OrcExecutor * ex) ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); /* 2: loadpb */ - var37.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var37.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadl */ var36 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var36.x2[0] >> 8) & 0xff; - var40.x2[0] = var36.x2[0] & 0xff; - var39.x2[1] = (var36.x2[1] >> 8) & 0xff; - var40.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 3: mergebw */ - var41.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var40.x2[0] << 8); - var41.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var40.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var40.x2[0]; + var41.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var40.x2[1]; + var41.x2[1] = _dest.i; + } /* 4: mergewl */ - var42.i = - ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var39.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var39.i; + _dest.x2[1] = var39.i; + var42.i = _dest.i; + } /* 5: mergewl */ - var38.x2[0] = - ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var42. - x2[0] << 16); - var38.x2[1] = - ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var42. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[0]; + _dest.x2[1] = var42.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[1]; + _dest.x2[1] = var42.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storeq */ ptr0[i] = var38; } @@ -7712,8 +8405,8 @@ _backup_cogorc_convert_YUY2_AYUV (OrcExecutor * ex) } void -cogorc_convert_YUY2_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_YUY2_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -7723,7 +8416,6 @@ cogorc_convert_YUY2_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -7746,7 +8438,7 @@ cogorc_convert_YUY2_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1, orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -7769,8 +8461,8 @@ cogorc_convert_YUY2_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1, /* cogorc_convert_UYVY_AYUV */ #ifdef DISABLE_ORC void -cogorc_convert_UYVY_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_UYVY_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -7789,32 +8481,58 @@ cogorc_convert_UYVY_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1, ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); /* 2: loadpb */ - var37.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var37.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadl */ var36 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var36.x2[0] >> 8) & 0xff; - var40.x2[0] = var36.x2[0] & 0xff; - var39.x2[1] = (var36.x2[1] >> 8) & 0xff; - var40.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 3: mergebw */ - var41.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var41.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var39.x2[0]; + var41.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var39.x2[1]; + var41.x2[1] = _dest.i; + } /* 4: mergewl */ - var42.i = - ((orc_uint16) var40.i & 0x0000ffff) | ((orc_uint16) var40.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var40.i; + _dest.x2[1] = var40.i; + var42.i = _dest.i; + } /* 5: mergewl */ - var38.x2[0] = - ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var42. - x2[0] << 16); - var38.x2[1] = - ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var42. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[0]; + _dest.x2[1] = var42.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[1]; + _dest.x2[1] = var42.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storeq */ ptr0[i] = var38; } @@ -7824,7 +8542,7 @@ cogorc_convert_UYVY_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1, #else static void -_backup_cogorc_convert_UYVY_AYUV (OrcExecutor * ex) +_backup_cogorc_convert_UYVY_AYUV (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -7845,32 +8563,58 @@ _backup_cogorc_convert_UYVY_AYUV (OrcExecutor * ex) ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); /* 2: loadpb */ - var37.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var37.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadl */ var36 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var36.x2[0] >> 8) & 0xff; - var40.x2[0] = var36.x2[0] & 0xff; - var39.x2[1] = (var36.x2[1] >> 8) & 0xff; - var40.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 3: mergebw */ - var41.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var41.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var39.x2[0]; + var41.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var39.x2[1]; + var41.x2[1] = _dest.i; + } /* 4: mergewl */ - var42.i = - ((orc_uint16) var40.i & 0x0000ffff) | ((orc_uint16) var40.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var40.i; + _dest.x2[1] = var40.i; + var42.i = _dest.i; + } /* 5: mergewl */ - var38.x2[0] = - ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var42. - x2[0] << 16); - var38.x2[1] = - ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var42. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[0]; + _dest.x2[1] = var42.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[1]; + _dest.x2[1] = var42.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storeq */ ptr0[i] = var38; } @@ -7879,8 +8623,8 @@ _backup_cogorc_convert_UYVY_AYUV (OrcExecutor * ex) } void -cogorc_convert_UYVY_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_UYVY_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -7890,7 +8634,6 @@ cogorc_convert_UYVY_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -7913,7 +8656,7 @@ cogorc_convert_UYVY_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1, orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -7936,9 +8679,10 @@ cogorc_convert_UYVY_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1, /* cogorc_convert_YUY2_Y42B */ #ifdef DISABLE_ORC void -cogorc_convert_YUY2_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, - int d2_stride, orc_uint8 * d3, int d3_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_YUY2_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, + int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, + int m) { int i; int j; @@ -7963,15 +8707,27 @@ cogorc_convert_YUY2_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, /* 0: loadl */ var33 = ptr4[i]; /* 1: splitwb */ - var37.x2[0] = (var33.x2[0] >> 8) & 0xff; - var34.x2[0] = var33.x2[0] & 0xff; - var37.x2[1] = (var33.x2[1] >> 8) & 0xff; - var34.x2[1] = var33.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var33.x2[0]; + var37.x2[0] = _src.x2[1]; + var34.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var33.x2[1]; + var37.x2[1] = _src.x2[1]; + var34.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var34; /* 3: splitwb */ - var35 = (var37.i >> 8) & 0xff; - var36 = var37.i & 0xff; + { + orc_union16 _src; + _src.i = var37.i; + var35 = _src.x2[1]; + var36 = _src.x2[0]; + } /* 4: storeb */ ptr2[i] = var35; /* 5: storeb */ @@ -7983,7 +8739,7 @@ cogorc_convert_YUY2_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, #else static void -_backup_cogorc_convert_YUY2_Y42B (OrcExecutor * ex) +_backup_cogorc_convert_YUY2_Y42B (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -8010,15 +8766,27 @@ _backup_cogorc_convert_YUY2_Y42B (OrcExecutor * ex) /* 0: loadl */ var33 = ptr4[i]; /* 1: splitwb */ - var37.x2[0] = (var33.x2[0] >> 8) & 0xff; - var34.x2[0] = var33.x2[0] & 0xff; - var37.x2[1] = (var33.x2[1] >> 8) & 0xff; - var34.x2[1] = var33.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var33.x2[0]; + var37.x2[0] = _src.x2[1]; + var34.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var33.x2[1]; + var37.x2[1] = _src.x2[1]; + var34.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var34; /* 3: splitwb */ - var35 = (var37.i >> 8) & 0xff; - var36 = var37.i & 0xff; + { + orc_union16 _src; + _src.i = var37.i; + var35 = _src.x2[1]; + var36 = _src.x2[0]; + } /* 4: storeb */ ptr2[i] = var35; /* 5: storeb */ @@ -8029,9 +8797,10 @@ _backup_cogorc_convert_YUY2_Y42B (OrcExecutor * ex) } void -cogorc_convert_YUY2_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, - int d2_stride, orc_uint8 * d3, int d3_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_YUY2_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, + int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, + int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -8041,7 +8810,6 @@ cogorc_convert_YUY2_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -8058,7 +8826,7 @@ cogorc_convert_YUY2_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D3, ORC_VAR_D2, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -8085,9 +8853,10 @@ cogorc_convert_YUY2_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, /* cogorc_convert_UYVY_Y42B */ #ifdef DISABLE_ORC void -cogorc_convert_UYVY_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, - int d2_stride, orc_uint8 * d3, int d3_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_UYVY_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, + int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, + int m) { int i; int j; @@ -8112,15 +8881,27 @@ cogorc_convert_UYVY_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, /* 0: loadl */ var33 = ptr4[i]; /* 1: splitwb */ - var34.x2[0] = (var33.x2[0] >> 8) & 0xff; - var37.x2[0] = var33.x2[0] & 0xff; - var34.x2[1] = (var33.x2[1] >> 8) & 0xff; - var37.x2[1] = var33.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var33.x2[0]; + var34.x2[0] = _src.x2[1]; + var37.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var33.x2[1]; + var34.x2[1] = _src.x2[1]; + var37.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var34; /* 3: splitwb */ - var35 = (var37.i >> 8) & 0xff; - var36 = var37.i & 0xff; + { + orc_union16 _src; + _src.i = var37.i; + var35 = _src.x2[1]; + var36 = _src.x2[0]; + } /* 4: storeb */ ptr2[i] = var35; /* 5: storeb */ @@ -8132,7 +8913,7 @@ cogorc_convert_UYVY_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, #else static void -_backup_cogorc_convert_UYVY_Y42B (OrcExecutor * ex) +_backup_cogorc_convert_UYVY_Y42B (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -8159,15 +8940,27 @@ _backup_cogorc_convert_UYVY_Y42B (OrcExecutor * ex) /* 0: loadl */ var33 = ptr4[i]; /* 1: splitwb */ - var34.x2[0] = (var33.x2[0] >> 8) & 0xff; - var37.x2[0] = var33.x2[0] & 0xff; - var34.x2[1] = (var33.x2[1] >> 8) & 0xff; - var37.x2[1] = var33.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var33.x2[0]; + var34.x2[0] = _src.x2[1]; + var37.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var33.x2[1]; + var34.x2[1] = _src.x2[1]; + var37.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var34; /* 3: splitwb */ - var35 = (var37.i >> 8) & 0xff; - var36 = var37.i & 0xff; + { + orc_union16 _src; + _src.i = var37.i; + var35 = _src.x2[1]; + var36 = _src.x2[0]; + } /* 4: storeb */ ptr2[i] = var35; /* 5: storeb */ @@ -8178,9 +8971,10 @@ _backup_cogorc_convert_UYVY_Y42B (OrcExecutor * ex) } void -cogorc_convert_UYVY_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, - int d2_stride, orc_uint8 * d3, int d3_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_UYVY_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, + int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, + int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -8190,7 +8984,6 @@ cogorc_convert_UYVY_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -8207,7 +9000,7 @@ cogorc_convert_UYVY_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D3, ORC_VAR_D2, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -8234,9 +9027,10 @@ cogorc_convert_UYVY_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, /* cogorc_convert_YUY2_Y444 */ #ifdef DISABLE_ORC void -cogorc_convert_YUY2_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, - int d2_stride, orc_uint16 * d3, int d3_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_YUY2_Y444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint16 * ORC_RESTRICT d3, + int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, + int m) { int i; int j; @@ -8263,15 +9057,27 @@ cogorc_convert_YUY2_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, /* 0: loadl */ var35 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var35.x2[0] >> 8) & 0xff; - var36.x2[0] = var35.x2[0] & 0xff; - var39.x2[1] = (var35.x2[1] >> 8) & 0xff; - var36.x2[1] = var35.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var35.x2[0]; + var39.x2[0] = _src.x2[1]; + var36.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var35.x2[1]; + var39.x2[1] = _src.x2[1]; + var36.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var36; /* 3: splitwb */ - var40 = (var39.i >> 8) & 0xff; - var41 = var39.i & 0xff; + { + orc_union16 _src; + _src.i = var39.i; + var40 = _src.x2[1]; + var41 = _src.x2[0]; + } /* 4: splatbw */ var37.i = ((var41 & 0xff) << 8) | (var41 & 0xff); /* 5: storew */ @@ -8287,7 +9093,7 @@ cogorc_convert_YUY2_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, #else static void -_backup_cogorc_convert_YUY2_Y444 (OrcExecutor * ex) +_backup_cogorc_convert_YUY2_Y444 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -8316,15 +9122,27 @@ _backup_cogorc_convert_YUY2_Y444 (OrcExecutor * ex) /* 0: loadl */ var35 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var35.x2[0] >> 8) & 0xff; - var36.x2[0] = var35.x2[0] & 0xff; - var39.x2[1] = (var35.x2[1] >> 8) & 0xff; - var36.x2[1] = var35.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var35.x2[0]; + var39.x2[0] = _src.x2[1]; + var36.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var35.x2[1]; + var39.x2[1] = _src.x2[1]; + var36.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var36; /* 3: splitwb */ - var40 = (var39.i >> 8) & 0xff; - var41 = var39.i & 0xff; + { + orc_union16 _src; + _src.i = var39.i; + var40 = _src.x2[1]; + var41 = _src.x2[0]; + } /* 4: splatbw */ var37.i = ((var41 & 0xff) << 8) | (var41 & 0xff); /* 5: storew */ @@ -8339,9 +9157,10 @@ _backup_cogorc_convert_YUY2_Y444 (OrcExecutor * ex) } void -cogorc_convert_YUY2_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, - int d2_stride, orc_uint16 * d3, int d3_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_YUY2_Y444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint16 * ORC_RESTRICT d3, + int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, + int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -8351,7 +9170,6 @@ cogorc_convert_YUY2_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -8374,7 +9192,7 @@ cogorc_convert_YUY2_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, orc_program_append_2 (p, "splatbw", 0, ORC_VAR_D3, ORC_VAR_T3, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -8401,9 +9219,10 @@ cogorc_convert_YUY2_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, /* cogorc_convert_UYVY_Y444 */ #ifdef DISABLE_ORC void -cogorc_convert_UYVY_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, - int d2_stride, orc_uint16 * d3, int d3_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_UYVY_Y444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint16 * ORC_RESTRICT d3, + int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, + int m) { int i; int j; @@ -8430,15 +9249,27 @@ cogorc_convert_UYVY_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, /* 0: loadl */ var35 = ptr4[i]; /* 1: splitwb */ - var36.x2[0] = (var35.x2[0] >> 8) & 0xff; - var39.x2[0] = var35.x2[0] & 0xff; - var36.x2[1] = (var35.x2[1] >> 8) & 0xff; - var39.x2[1] = var35.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var35.x2[0]; + var36.x2[0] = _src.x2[1]; + var39.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var35.x2[1]; + var36.x2[1] = _src.x2[1]; + var39.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var36; /* 3: splitwb */ - var40 = (var39.i >> 8) & 0xff; - var41 = var39.i & 0xff; + { + orc_union16 _src; + _src.i = var39.i; + var40 = _src.x2[1]; + var41 = _src.x2[0]; + } /* 4: splatbw */ var37.i = ((var41 & 0xff) << 8) | (var41 & 0xff); /* 5: storew */ @@ -8454,7 +9285,7 @@ cogorc_convert_UYVY_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, #else static void -_backup_cogorc_convert_UYVY_Y444 (OrcExecutor * ex) +_backup_cogorc_convert_UYVY_Y444 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -8483,15 +9314,27 @@ _backup_cogorc_convert_UYVY_Y444 (OrcExecutor * ex) /* 0: loadl */ var35 = ptr4[i]; /* 1: splitwb */ - var36.x2[0] = (var35.x2[0] >> 8) & 0xff; - var39.x2[0] = var35.x2[0] & 0xff; - var36.x2[1] = (var35.x2[1] >> 8) & 0xff; - var39.x2[1] = var35.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var35.x2[0]; + var36.x2[0] = _src.x2[1]; + var39.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var35.x2[1]; + var36.x2[1] = _src.x2[1]; + var39.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var36; /* 3: splitwb */ - var40 = (var39.i >> 8) & 0xff; - var41 = var39.i & 0xff; + { + orc_union16 _src; + _src.i = var39.i; + var40 = _src.x2[1]; + var41 = _src.x2[0]; + } /* 4: splatbw */ var37.i = ((var41 & 0xff) << 8) | (var41 & 0xff); /* 5: storew */ @@ -8506,9 +9349,10 @@ _backup_cogorc_convert_UYVY_Y444 (OrcExecutor * ex) } void -cogorc_convert_UYVY_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, - int d2_stride, orc_uint16 * d3, int d3_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_UYVY_Y444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint16 * ORC_RESTRICT d3, + int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, + int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -8518,7 +9362,6 @@ cogorc_convert_UYVY_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -8541,7 +9384,7 @@ cogorc_convert_UYVY_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, orc_program_append_2 (p, "splatbw", 0, ORC_VAR_D3, ORC_VAR_T3, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -8568,8 +9411,10 @@ cogorc_convert_UYVY_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, /* cogorc_convert_UYVY_I420 */ #ifdef DISABLE_ORC void -cogorc_convert_UYVY_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3, - orc_uint8 * d4, const orc_uint32 * s1, const orc_uint32 * s2, int n) +cogorc_convert_UYVY_I420 (orc_uint16 * ORC_RESTRICT d1, + orc_uint16 * ORC_RESTRICT d2, orc_uint8 * ORC_RESTRICT d3, + orc_uint8 * ORC_RESTRICT d4, const orc_uint32 * ORC_RESTRICT s1, + const orc_uint32 * ORC_RESTRICT s2, int n) { int i; orc_union16 *ORC_RESTRICT ptr0; @@ -8600,27 +9445,47 @@ cogorc_convert_UYVY_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3, /* 0: loadl */ var35 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var35.x2[0] >> 8) & 0xff; - var40.x2[0] = var35.x2[0] & 0xff; - var39.x2[1] = (var35.x2[1] >> 8) & 0xff; - var40.x2[1] = var35.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var35.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var35.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var39; /* 3: loadl */ var36 = ptr5[i]; /* 4: splitwb */ - var41.x2[0] = (var36.x2[0] >> 8) & 0xff; - var42.x2[0] = var36.x2[0] & 0xff; - var41.x2[1] = (var36.x2[1] >> 8) & 0xff; - var42.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var41.x2[0] = _src.x2[1]; + var42.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var41.x2[1] = _src.x2[1]; + var42.x2[1] = _src.x2[0]; + } /* 5: storew */ ptr1[i] = var41; /* 6: avgub */ var43.x2[0] = ((orc_uint8) var40.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var40.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; /* 7: splitwb */ - var37 = (var43.i >> 8) & 0xff; - var38 = var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var37 = _src.x2[1]; + var38 = _src.x2[0]; + } /* 8: storeb */ ptr3[i] = var37; /* 9: storeb */ @@ -8631,7 +9496,7 @@ cogorc_convert_UYVY_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3, #else static void -_backup_cogorc_convert_UYVY_I420 (OrcExecutor * ex) +_backup_cogorc_convert_UYVY_I420 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -8663,27 +9528,47 @@ _backup_cogorc_convert_UYVY_I420 (OrcExecutor * ex) /* 0: loadl */ var35 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var35.x2[0] >> 8) & 0xff; - var40.x2[0] = var35.x2[0] & 0xff; - var39.x2[1] = (var35.x2[1] >> 8) & 0xff; - var40.x2[1] = var35.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var35.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var35.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var39; /* 3: loadl */ var36 = ptr5[i]; /* 4: splitwb */ - var41.x2[0] = (var36.x2[0] >> 8) & 0xff; - var42.x2[0] = var36.x2[0] & 0xff; - var41.x2[1] = (var36.x2[1] >> 8) & 0xff; - var42.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var41.x2[0] = _src.x2[1]; + var42.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var41.x2[1] = _src.x2[1]; + var42.x2[1] = _src.x2[0]; + } /* 5: storew */ ptr1[i] = var41; /* 6: avgub */ var43.x2[0] = ((orc_uint8) var40.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var40.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; /* 7: splitwb */ - var37 = (var43.i >> 8) & 0xff; - var38 = var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var37 = _src.x2[1]; + var38 = _src.x2[0]; + } /* 8: storeb */ ptr3[i] = var37; /* 9: storeb */ @@ -8693,8 +9578,10 @@ _backup_cogorc_convert_UYVY_I420 (OrcExecutor * ex) } void -cogorc_convert_UYVY_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3, - orc_uint8 * d4, const orc_uint32 * s1, const orc_uint32 * s2, int n) +cogorc_convert_UYVY_I420 (orc_uint16 * ORC_RESTRICT d1, + orc_uint16 * ORC_RESTRICT d2, orc_uint8 * ORC_RESTRICT d3, + orc_uint8 * ORC_RESTRICT d4, const orc_uint32 * ORC_RESTRICT s1, + const orc_uint32 * ORC_RESTRICT s2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -8704,7 +9591,6 @@ cogorc_convert_UYVY_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_convert_UYVY_I420"); @@ -8732,7 +9618,7 @@ cogorc_convert_UYVY_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3, orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D4, ORC_VAR_D3, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -8756,10 +9642,11 @@ cogorc_convert_UYVY_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3, /* cogorc_convert_AYUV_I420 */ #ifdef DISABLE_ORC void -cogorc_convert_AYUV_I420 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, - int d2_stride, orc_uint8 * d3, int d3_stride, orc_uint8 * d4, int d4_stride, - const orc_uint64 * s1, int s1_stride, const orc_uint64 * s2, int s2_stride, - int n, int m) +cogorc_convert_AYUV_I420 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, + int d3_stride, orc_uint8 * ORC_RESTRICT d4, int d4_stride, + const orc_uint64 * ORC_RESTRICT s1, int s1_stride, + const orc_uint64 * ORC_RESTRICT s2, int s2_stride, int n, int m) { int i; int j; @@ -8800,25 +9687,57 @@ cogorc_convert_AYUV_I420 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, /* 0: loadq */ var40 = ptr4[i]; /* 1: splitlw */ - var46.x2[0] = (var40.x2[0] >> 16) & 0xffff; - var47.x2[0] = var40.x2[0] & 0xffff; - var46.x2[1] = (var40.x2[1] >> 16) & 0xffff; - var47.x2[1] = var40.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var40.x2[0]; + var46.x2[0] = _src.x2[1]; + var47.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var40.x2[1]; + var46.x2[1] = _src.x2[1]; + var47.x2[1] = _src.x2[0]; + } /* 2: select1wb */ - var41.x2[0] = ((orc_uint16) var47.x2[0] >> 8) & 0xff; - var41.x2[1] = ((orc_uint16) var47.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var47.x2[0]; + var41.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var47.x2[1]; + var41.x2[1] = _src.x2[1]; + } /* 3: storew */ ptr0[i] = var41; /* 4: loadq */ var42 = ptr5[i]; /* 5: splitlw */ - var48.x2[0] = (var42.x2[0] >> 16) & 0xffff; - var49.x2[0] = var42.x2[0] & 0xffff; - var48.x2[1] = (var42.x2[1] >> 16) & 0xffff; - var49.x2[1] = var42.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var42.x2[0]; + var48.x2[0] = _src.x2[1]; + var49.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var42.x2[1]; + var48.x2[1] = _src.x2[1]; + var49.x2[1] = _src.x2[0]; + } /* 6: select1wb */ - var43.x2[0] = ((orc_uint16) var49.x2[0] >> 8) & 0xff; - var43.x2[1] = ((orc_uint16) var49.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var49.x2[0]; + var43.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var49.x2[1]; + var43.x2[1] = _src.x2[1]; + } /* 7: storew */ ptr1[i] = var43; /* 8: avgub */ @@ -8831,20 +9750,36 @@ cogorc_convert_AYUV_I420 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, var50.x4[3] = ((orc_uint8) var46.x4[3] + (orc_uint8) var48.x4[3] + 1) >> 1; /* 9: splitwb */ - var51.x2[0] = (var50.x2[0] >> 8) & 0xff; - var52.x2[0] = var50.x2[0] & 0xff; - var51.x2[1] = (var50.x2[1] >> 8) & 0xff; - var52.x2[1] = var50.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var50.x2[0]; + var51.x2[0] = _src.x2[1]; + var52.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var50.x2[1]; + var51.x2[1] = _src.x2[1]; + var52.x2[1] = _src.x2[0]; + } /* 10: splitwb */ - var53 = (var52.i >> 8) & 0xff; - var54 = var52.i & 0xff; + { + orc_union16 _src; + _src.i = var52.i; + var53 = _src.x2[1]; + var54 = _src.x2[0]; + } /* 11: avgub */ var44 = ((orc_uint8) var53 + (orc_uint8) var54 + 1) >> 1; /* 12: storeb */ ptr2[i] = var44; /* 13: splitwb */ - var55 = (var51.i >> 8) & 0xff; - var56 = var51.i & 0xff; + { + orc_union16 _src; + _src.i = var51.i; + var55 = _src.x2[1]; + var56 = _src.x2[0]; + } /* 14: avgub */ var45 = ((orc_uint8) var55 + (orc_uint8) var56 + 1) >> 1; /* 15: storeb */ @@ -8856,7 +9791,7 @@ cogorc_convert_AYUV_I420 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, #else static void -_backup_cogorc_convert_AYUV_I420 (OrcExecutor * ex) +_backup_cogorc_convert_AYUV_I420 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -8899,25 +9834,57 @@ _backup_cogorc_convert_AYUV_I420 (OrcExecutor * ex) /* 0: loadq */ var40 = ptr4[i]; /* 1: splitlw */ - var46.x2[0] = (var40.x2[0] >> 16) & 0xffff; - var47.x2[0] = var40.x2[0] & 0xffff; - var46.x2[1] = (var40.x2[1] >> 16) & 0xffff; - var47.x2[1] = var40.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var40.x2[0]; + var46.x2[0] = _src.x2[1]; + var47.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var40.x2[1]; + var46.x2[1] = _src.x2[1]; + var47.x2[1] = _src.x2[0]; + } /* 2: select1wb */ - var41.x2[0] = ((orc_uint16) var47.x2[0] >> 8) & 0xff; - var41.x2[1] = ((orc_uint16) var47.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var47.x2[0]; + var41.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var47.x2[1]; + var41.x2[1] = _src.x2[1]; + } /* 3: storew */ ptr0[i] = var41; /* 4: loadq */ var42 = ptr5[i]; /* 5: splitlw */ - var48.x2[0] = (var42.x2[0] >> 16) & 0xffff; - var49.x2[0] = var42.x2[0] & 0xffff; - var48.x2[1] = (var42.x2[1] >> 16) & 0xffff; - var49.x2[1] = var42.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var42.x2[0]; + var48.x2[0] = _src.x2[1]; + var49.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var42.x2[1]; + var48.x2[1] = _src.x2[1]; + var49.x2[1] = _src.x2[0]; + } /* 6: select1wb */ - var43.x2[0] = ((orc_uint16) var49.x2[0] >> 8) & 0xff; - var43.x2[1] = ((orc_uint16) var49.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var49.x2[0]; + var43.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var49.x2[1]; + var43.x2[1] = _src.x2[1]; + } /* 7: storew */ ptr1[i] = var43; /* 8: avgub */ @@ -8930,20 +9897,36 @@ _backup_cogorc_convert_AYUV_I420 (OrcExecutor * ex) var50.x4[3] = ((orc_uint8) var46.x4[3] + (orc_uint8) var48.x4[3] + 1) >> 1; /* 9: splitwb */ - var51.x2[0] = (var50.x2[0] >> 8) & 0xff; - var52.x2[0] = var50.x2[0] & 0xff; - var51.x2[1] = (var50.x2[1] >> 8) & 0xff; - var52.x2[1] = var50.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var50.x2[0]; + var51.x2[0] = _src.x2[1]; + var52.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var50.x2[1]; + var51.x2[1] = _src.x2[1]; + var52.x2[1] = _src.x2[0]; + } /* 10: splitwb */ - var53 = (var52.i >> 8) & 0xff; - var54 = var52.i & 0xff; + { + orc_union16 _src; + _src.i = var52.i; + var53 = _src.x2[1]; + var54 = _src.x2[0]; + } /* 11: avgub */ var44 = ((orc_uint8) var53 + (orc_uint8) var54 + 1) >> 1; /* 12: storeb */ ptr2[i] = var44; /* 13: splitwb */ - var55 = (var51.i >> 8) & 0xff; - var56 = var51.i & 0xff; + { + orc_union16 _src; + _src.i = var51.i; + var55 = _src.x2[1]; + var56 = _src.x2[0]; + } /* 14: avgub */ var45 = ((orc_uint8) var55 + (orc_uint8) var56 + 1) >> 1; /* 15: storeb */ @@ -8954,10 +9937,11 @@ _backup_cogorc_convert_AYUV_I420 (OrcExecutor * ex) } void -cogorc_convert_AYUV_I420 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, - int d2_stride, orc_uint8 * d3, int d3_stride, orc_uint8 * d4, int d4_stride, - const orc_uint64 * s1, int s1_stride, const orc_uint64 * s2, int s2_stride, - int n, int m) +cogorc_convert_AYUV_I420 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, + int d3_stride, orc_uint8 * ORC_RESTRICT d4, int d4_stride, + const orc_uint64 * ORC_RESTRICT s1, int s1_stride, + const orc_uint64 * ORC_RESTRICT s2, int s2_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -8967,7 +9951,6 @@ cogorc_convert_AYUV_I420 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -9009,7 +9992,7 @@ cogorc_convert_AYUV_I420 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, orc_program_append_2 (p, "avgub", 0, ORC_VAR_D4, ORC_VAR_T7, ORC_VAR_T8, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -9040,8 +10023,8 @@ cogorc_convert_AYUV_I420 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, /* cogorc_convert_AYUV_YUY2 */ #ifdef DISABLE_ORC void -cogorc_convert_AYUV_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -9065,26 +10048,54 @@ cogorc_convert_AYUV_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1, /* 0: loadq */ var37 = ptr4[i]; /* 1: splitlw */ - var39.x2[0] = (var37.x2[0] >> 16) & 0xffff; - var40.x2[0] = var37.x2[0] & 0xffff; - var39.x2[1] = (var37.x2[1] >> 16) & 0xffff; - var40.x2[1] = var37.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var37.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var37.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var41.i = (var39.i >> 16) & 0xffff; - var42.i = var39.i & 0xffff; + { + orc_union32 _src; + _src.i = var39.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 3: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; /* 4: select1wb */ - var44.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff; - var44.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.x2[0]; + var44.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var40.x2[1]; + var44.x2[1] = _src.x2[1]; + } /* 5: mergebw */ - var38.x2[0] = - ((orc_uint8) var44.x2[0] & 0x00ff) | ((orc_uint8) var43.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var44.x2[1] & 0x00ff) | ((orc_uint8) var43.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var43.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var43.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storel */ ptr0[i] = var38; } @@ -9094,7 +10105,7 @@ cogorc_convert_AYUV_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1, #else static void -_backup_cogorc_convert_AYUV_YUY2 (OrcExecutor * ex) +_backup_cogorc_convert_AYUV_YUY2 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -9120,26 +10131,54 @@ _backup_cogorc_convert_AYUV_YUY2 (OrcExecutor * ex) /* 0: loadq */ var37 = ptr4[i]; /* 1: splitlw */ - var39.x2[0] = (var37.x2[0] >> 16) & 0xffff; - var40.x2[0] = var37.x2[0] & 0xffff; - var39.x2[1] = (var37.x2[1] >> 16) & 0xffff; - var40.x2[1] = var37.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var37.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var37.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var41.i = (var39.i >> 16) & 0xffff; - var42.i = var39.i & 0xffff; + { + orc_union32 _src; + _src.i = var39.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 3: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; /* 4: select1wb */ - var44.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff; - var44.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.x2[0]; + var44.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var40.x2[1]; + var44.x2[1] = _src.x2[1]; + } /* 5: mergebw */ - var38.x2[0] = - ((orc_uint8) var44.x2[0] & 0x00ff) | ((orc_uint8) var43.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var44.x2[1] & 0x00ff) | ((orc_uint8) var43.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var43.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var43.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storel */ ptr0[i] = var38; } @@ -9148,8 +10187,8 @@ _backup_cogorc_convert_AYUV_YUY2 (OrcExecutor * ex) } void -cogorc_convert_AYUV_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -9159,7 +10198,6 @@ cogorc_convert_AYUV_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -9184,7 +10222,7 @@ cogorc_convert_AYUV_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1, orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -9207,8 +10245,8 @@ cogorc_convert_AYUV_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1, /* cogorc_convert_AYUV_UYVY */ #ifdef DISABLE_ORC void -cogorc_convert_AYUV_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -9232,26 +10270,54 @@ cogorc_convert_AYUV_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1, /* 0: loadq */ var37 = ptr4[i]; /* 1: splitlw */ - var39.x2[0] = (var37.x2[0] >> 16) & 0xffff; - var40.x2[0] = var37.x2[0] & 0xffff; - var39.x2[1] = (var37.x2[1] >> 16) & 0xffff; - var40.x2[1] = var37.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var37.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var37.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var41.i = (var39.i >> 16) & 0xffff; - var42.i = var39.i & 0xffff; + { + orc_union32 _src; + _src.i = var39.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 3: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; /* 4: select1wb */ - var44.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff; - var44.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.x2[0]; + var44.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var40.x2[1]; + var44.x2[1] = _src.x2[1]; + } /* 5: mergebw */ - var38.x2[0] = - ((orc_uint8) var43.x2[0] & 0x00ff) | ((orc_uint8) var44.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var43.x2[1] & 0x00ff) | ((orc_uint8) var44.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[0]; + _dest.x2[1] = var44.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[1]; + _dest.x2[1] = var44.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storel */ ptr0[i] = var38; } @@ -9261,7 +10327,7 @@ cogorc_convert_AYUV_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1, #else static void -_backup_cogorc_convert_AYUV_UYVY (OrcExecutor * ex) +_backup_cogorc_convert_AYUV_UYVY (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -9287,26 +10353,54 @@ _backup_cogorc_convert_AYUV_UYVY (OrcExecutor * ex) /* 0: loadq */ var37 = ptr4[i]; /* 1: splitlw */ - var39.x2[0] = (var37.x2[0] >> 16) & 0xffff; - var40.x2[0] = var37.x2[0] & 0xffff; - var39.x2[1] = (var37.x2[1] >> 16) & 0xffff; - var40.x2[1] = var37.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var37.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var37.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var41.i = (var39.i >> 16) & 0xffff; - var42.i = var39.i & 0xffff; + { + orc_union32 _src; + _src.i = var39.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 3: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; /* 4: select1wb */ - var44.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff; - var44.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.x2[0]; + var44.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var40.x2[1]; + var44.x2[1] = _src.x2[1]; + } /* 5: mergebw */ - var38.x2[0] = - ((orc_uint8) var43.x2[0] & 0x00ff) | ((orc_uint8) var44.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var43.x2[1] & 0x00ff) | ((orc_uint8) var44.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[0]; + _dest.x2[1] = var44.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[1]; + _dest.x2[1] = var44.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storel */ ptr0[i] = var38; } @@ -9315,8 +10409,8 @@ _backup_cogorc_convert_AYUV_UYVY (OrcExecutor * ex) } void -cogorc_convert_AYUV_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -9326,7 +10420,6 @@ cogorc_convert_AYUV_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -9351,7 +10444,7 @@ cogorc_convert_AYUV_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1, orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -9374,9 +10467,10 @@ cogorc_convert_AYUV_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1, /* cogorc_convert_AYUV_Y42B */ #ifdef DISABLE_ORC void -cogorc_convert_AYUV_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, - int d2_stride, orc_uint8 * d3, int d3_stride, const orc_uint64 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, + int d3_stride, const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n, + int m) { int i; int j; @@ -9405,28 +10499,52 @@ cogorc_convert_AYUV_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, /* 0: loadq */ var36 = ptr4[i]; /* 1: splitlw */ - var40.x2[0] = (var36.x2[0] >> 16) & 0xffff; - var41.x2[0] = var36.x2[0] & 0xffff; - var40.x2[1] = (var36.x2[1] >> 16) & 0xffff; - var41.x2[1] = var36.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var36.x2[0]; + var40.x2[0] = _src.x2[1]; + var41.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var36.x2[1]; + var40.x2[1] = _src.x2[1]; + var41.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var42.i = (var40.i >> 16) & 0xffff; - var43.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var42.i = _src.x2[1]; + var43.i = _src.x2[0]; + } /* 3: avgub */ var44.x2[0] = ((orc_uint8) var42.x2[0] + (orc_uint8) var43.x2[0] + 1) >> 1; var44.x2[1] = ((orc_uint8) var42.x2[1] + (orc_uint8) var43.x2[1] + 1) >> 1; /* 4: splitwb */ - var37 = (var44.i >> 8) & 0xff; - var38 = var44.i & 0xff; + { + orc_union16 _src; + _src.i = var44.i; + var37 = _src.x2[1]; + var38 = _src.x2[0]; + } /* 5: storeb */ ptr2[i] = var37; /* 6: storeb */ ptr1[i] = var38; /* 7: select1wb */ - var39.x2[0] = ((orc_uint16) var41.x2[0] >> 8) & 0xff; - var39.x2[1] = ((orc_uint16) var41.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var41.x2[0]; + var39.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var41.x2[1]; + var39.x2[1] = _src.x2[1]; + } /* 8: storew */ ptr0[i] = var39; } @@ -9436,7 +10554,7 @@ cogorc_convert_AYUV_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, #else static void -_backup_cogorc_convert_AYUV_Y42B (OrcExecutor * ex) +_backup_cogorc_convert_AYUV_Y42B (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -9467,28 +10585,52 @@ _backup_cogorc_convert_AYUV_Y42B (OrcExecutor * ex) /* 0: loadq */ var36 = ptr4[i]; /* 1: splitlw */ - var40.x2[0] = (var36.x2[0] >> 16) & 0xffff; - var41.x2[0] = var36.x2[0] & 0xffff; - var40.x2[1] = (var36.x2[1] >> 16) & 0xffff; - var41.x2[1] = var36.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var36.x2[0]; + var40.x2[0] = _src.x2[1]; + var41.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var36.x2[1]; + var40.x2[1] = _src.x2[1]; + var41.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var42.i = (var40.i >> 16) & 0xffff; - var43.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var42.i = _src.x2[1]; + var43.i = _src.x2[0]; + } /* 3: avgub */ var44.x2[0] = ((orc_uint8) var42.x2[0] + (orc_uint8) var43.x2[0] + 1) >> 1; var44.x2[1] = ((orc_uint8) var42.x2[1] + (orc_uint8) var43.x2[1] + 1) >> 1; /* 4: splitwb */ - var37 = (var44.i >> 8) & 0xff; - var38 = var44.i & 0xff; + { + orc_union16 _src; + _src.i = var44.i; + var37 = _src.x2[1]; + var38 = _src.x2[0]; + } /* 5: storeb */ ptr2[i] = var37; /* 6: storeb */ ptr1[i] = var38; /* 7: select1wb */ - var39.x2[0] = ((orc_uint16) var41.x2[0] >> 8) & 0xff; - var39.x2[1] = ((orc_uint16) var41.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var41.x2[0]; + var39.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var41.x2[1]; + var39.x2[1] = _src.x2[1]; + } /* 8: storew */ ptr0[i] = var39; } @@ -9497,9 +10639,10 @@ _backup_cogorc_convert_AYUV_Y42B (OrcExecutor * ex) } void -cogorc_convert_AYUV_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, - int d2_stride, orc_uint8 * d3, int d3_stride, const orc_uint64 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride, + orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, + int d3_stride, const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n, + int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -9509,7 +10652,6 @@ cogorc_convert_AYUV_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -9535,7 +10677,7 @@ cogorc_convert_AYUV_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, orc_program_append_2 (p, "select1wb", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -9562,9 +10704,10 @@ cogorc_convert_AYUV_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, /* cogorc_convert_AYUV_Y444 */ #ifdef DISABLE_ORC void -cogorc_convert_AYUV_Y444 (orc_uint8 * d1, int d1_stride, orc_uint8 * d2, - int d2_stride, orc_uint8 * d3, int d3_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_Y444 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, + orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, + int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, + int m) { int i; int j; @@ -9590,17 +10733,29 @@ cogorc_convert_AYUV_Y444 (orc_uint8 * d1, int d1_stride, orc_uint8 * d2, /* 0: loadl */ var34 = ptr4[i]; /* 1: splitlw */ - var38.i = (var34.i >> 16) & 0xffff; - var39.i = var34.i & 0xffff; + { + orc_union32 _src; + _src.i = var34.i; + var38.i = _src.x2[1]; + var39.i = _src.x2[0]; + } /* 2: splitwb */ - var35 = (var38.i >> 8) & 0xff; - var36 = var38.i & 0xff; + { + orc_union16 _src; + _src.i = var38.i; + var35 = _src.x2[1]; + var36 = _src.x2[0]; + } /* 3: storeb */ ptr2[i] = var35; /* 4: storeb */ ptr1[i] = var36; /* 5: select1wb */ - var37 = ((orc_uint16) var39.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var39.i; + var37 = _src.x2[1]; + } /* 6: storeb */ ptr0[i] = var37; } @@ -9610,7 +10765,7 @@ cogorc_convert_AYUV_Y444 (orc_uint8 * d1, int d1_stride, orc_uint8 * d2, #else static void -_backup_cogorc_convert_AYUV_Y444 (OrcExecutor * ex) +_backup_cogorc_convert_AYUV_Y444 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -9638,17 +10793,29 @@ _backup_cogorc_convert_AYUV_Y444 (OrcExecutor * ex) /* 0: loadl */ var34 = ptr4[i]; /* 1: splitlw */ - var38.i = (var34.i >> 16) & 0xffff; - var39.i = var34.i & 0xffff; + { + orc_union32 _src; + _src.i = var34.i; + var38.i = _src.x2[1]; + var39.i = _src.x2[0]; + } /* 2: splitwb */ - var35 = (var38.i >> 8) & 0xff; - var36 = var38.i & 0xff; + { + orc_union16 _src; + _src.i = var38.i; + var35 = _src.x2[1]; + var36 = _src.x2[0]; + } /* 3: storeb */ ptr2[i] = var35; /* 4: storeb */ ptr1[i] = var36; /* 5: select1wb */ - var37 = ((orc_uint16) var39.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var39.i; + var37 = _src.x2[1]; + } /* 6: storeb */ ptr0[i] = var37; } @@ -9657,9 +10824,10 @@ _backup_cogorc_convert_AYUV_Y444 (OrcExecutor * ex) } void -cogorc_convert_AYUV_Y444 (orc_uint8 * d1, int d1_stride, orc_uint8 * d2, - int d2_stride, orc_uint8 * d3, int d3_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_Y444 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, + orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, + int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, + int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -9669,7 +10837,6 @@ cogorc_convert_AYUV_Y444 (orc_uint8 * d1, int d1_stride, orc_uint8 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -9689,7 +10856,7 @@ cogorc_convert_AYUV_Y444 (orc_uint8 * d1, int d1_stride, orc_uint8 * d2, orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -9716,9 +10883,10 @@ cogorc_convert_AYUV_Y444 (orc_uint8 * d1, int d1_stride, orc_uint8 * d2, /* cogorc_convert_Y42B_YUY2 */ #ifdef DISABLE_ORC void -cogorc_convert_Y42B_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, - int s1_stride, const orc_uint8 * s2, int s2_stride, const orc_uint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y42B_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, + const orc_uint8 * ORC_RESTRICT s2, int s2_stride, + const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { int i; int j; @@ -9745,14 +10913,27 @@ cogorc_convert_Y42B_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, /* 1: loadb */ var34 = ptr6[i]; /* 2: mergebw */ - var37.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var37.i = _dest.i; + } /* 3: loadw */ var35 = ptr4[i]; /* 4: mergebw */ - var36.x2[0] = - ((orc_uint8) var35.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var36.x2[1] = - ((orc_uint8) var35.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var35.x2[0]; + _dest.x2[1] = var37.x2[0]; + var36.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var35.x2[1]; + _dest.x2[1] = var37.x2[1]; + var36.x2[1] = _dest.i; + } /* 5: storel */ ptr0[i] = var36; } @@ -9762,7 +10943,7 @@ cogorc_convert_Y42B_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, #else static void -_backup_cogorc_convert_Y42B_YUY2 (OrcExecutor * ex) +_backup_cogorc_convert_Y42B_YUY2 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -9791,14 +10972,27 @@ _backup_cogorc_convert_Y42B_YUY2 (OrcExecutor * ex) /* 1: loadb */ var34 = ptr6[i]; /* 2: mergebw */ - var37.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var37.i = _dest.i; + } /* 3: loadw */ var35 = ptr4[i]; /* 4: mergebw */ - var36.x2[0] = - ((orc_uint8) var35.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var36.x2[1] = - ((orc_uint8) var35.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var35.x2[0]; + _dest.x2[1] = var37.x2[0]; + var36.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var35.x2[1]; + _dest.x2[1] = var37.x2[1]; + var36.x2[1] = _dest.i; + } /* 5: storel */ ptr0[i] = var36; } @@ -9807,9 +11001,10 @@ _backup_cogorc_convert_Y42B_YUY2 (OrcExecutor * ex) } void -cogorc_convert_Y42B_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, - int s1_stride, const orc_uint8 * s2, int s2_stride, const orc_uint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y42B_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, + const orc_uint8 * ORC_RESTRICT s2, int s2_stride, + const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -9819,7 +11014,6 @@ cogorc_convert_Y42B_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -9836,7 +11030,7 @@ cogorc_convert_Y42B_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -9863,9 +11057,10 @@ cogorc_convert_Y42B_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, /* cogorc_convert_Y42B_UYVY */ #ifdef DISABLE_ORC void -cogorc_convert_Y42B_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, - int s1_stride, const orc_uint8 * s2, int s2_stride, const orc_uint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y42B_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, + const orc_uint8 * ORC_RESTRICT s2, int s2_stride, + const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { int i; int j; @@ -9892,14 +11087,27 @@ cogorc_convert_Y42B_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, /* 1: loadb */ var34 = ptr6[i]; /* 2: mergebw */ - var37.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var37.i = _dest.i; + } /* 3: loadw */ var35 = ptr4[i]; /* 4: mergebw */ - var36.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var35.x2[0] << 8); - var36.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var35.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var35.x2[0]; + var36.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var35.x2[1]; + var36.x2[1] = _dest.i; + } /* 5: storel */ ptr0[i] = var36; } @@ -9909,7 +11117,7 @@ cogorc_convert_Y42B_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, #else static void -_backup_cogorc_convert_Y42B_UYVY (OrcExecutor * ex) +_backup_cogorc_convert_Y42B_UYVY (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -9938,14 +11146,27 @@ _backup_cogorc_convert_Y42B_UYVY (OrcExecutor * ex) /* 1: loadb */ var34 = ptr6[i]; /* 2: mergebw */ - var37.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var37.i = _dest.i; + } /* 3: loadw */ var35 = ptr4[i]; /* 4: mergebw */ - var36.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var35.x2[0] << 8); - var36.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var35.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var35.x2[0]; + var36.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var35.x2[1]; + var36.x2[1] = _dest.i; + } /* 5: storel */ ptr0[i] = var36; } @@ -9954,9 +11175,10 @@ _backup_cogorc_convert_Y42B_UYVY (OrcExecutor * ex) } void -cogorc_convert_Y42B_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, - int s1_stride, const orc_uint8 * s2, int s2_stride, const orc_uint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y42B_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, + const orc_uint8 * ORC_RESTRICT s2, int s2_stride, + const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -9966,7 +11188,6 @@ cogorc_convert_Y42B_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -9983,7 +11204,7 @@ cogorc_convert_Y42B_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -10010,9 +11231,10 @@ cogorc_convert_Y42B_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, /* cogorc_convert_Y42B_AYUV */ #ifdef DISABLE_ORC void -cogorc_convert_Y42B_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint16 * s1, - int s1_stride, const orc_uint8 * s2, int s2_stride, const orc_uint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y42B_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, + const orc_uint8 * ORC_RESTRICT s2, int s2_stride, + const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { int i; int j; @@ -10036,8 +11258,8 @@ cogorc_convert_Y42B_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint16 * s1, ptr6 = ORC_PTR_OFFSET (s3, s3_stride * j); /* 3: loadpb */ - var38.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var38.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var38.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var38.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -10045,24 +11267,47 @@ cogorc_convert_Y42B_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint16 * s1, /* 1: loadb */ var37 = ptr6[i]; /* 2: mergebw */ - var41.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var41.i = _dest.i; + } /* 4: loadw */ var39 = ptr4[i]; /* 5: mergebw */ - var42.x2[0] = - ((orc_uint8) var38.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var42.x2[1] = - ((orc_uint8) var38.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[0]; + _dest.x2[1] = var39.x2[0]; + var42.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[1]; + _dest.x2[1] = var39.x2[1]; + var42.x2[1] = _dest.i; + } /* 6: mergewl */ - var43.i = - ((orc_uint16) var41.i & 0x0000ffff) | ((orc_uint16) var41.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.i; + _dest.x2[1] = var41.i; + var43.i = _dest.i; + } /* 7: mergewl */ - var40.x2[0] = - ((orc_uint16) var42.x2[0] & 0x0000ffff) | ((orc_uint16) var43. - x2[0] << 16); - var40.x2[1] = - ((orc_uint16) var42.x2[1] & 0x0000ffff) | ((orc_uint16) var43. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var42.x2[0]; + _dest.x2[1] = var43.x2[0]; + var40.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var42.x2[1]; + _dest.x2[1] = var43.x2[1]; + var40.x2[1] = _dest.i; + } /* 8: storeq */ ptr0[i] = var40; } @@ -10072,7 +11317,7 @@ cogorc_convert_Y42B_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint16 * s1, #else static void -_backup_cogorc_convert_Y42B_AYUV (OrcExecutor * ex) +_backup_cogorc_convert_Y42B_AYUV (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -10098,8 +11343,8 @@ _backup_cogorc_convert_Y42B_AYUV (OrcExecutor * ex) ptr6 = ORC_PTR_OFFSET (ex->arrays[6], ex->params[6] * j); /* 3: loadpb */ - var38.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var38.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var38.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var38.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -10107,24 +11352,47 @@ _backup_cogorc_convert_Y42B_AYUV (OrcExecutor * ex) /* 1: loadb */ var37 = ptr6[i]; /* 2: mergebw */ - var41.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var41.i = _dest.i; + } /* 4: loadw */ var39 = ptr4[i]; /* 5: mergebw */ - var42.x2[0] = - ((orc_uint8) var38.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var42.x2[1] = - ((orc_uint8) var38.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[0]; + _dest.x2[1] = var39.x2[0]; + var42.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[1]; + _dest.x2[1] = var39.x2[1]; + var42.x2[1] = _dest.i; + } /* 6: mergewl */ - var43.i = - ((orc_uint16) var41.i & 0x0000ffff) | ((orc_uint16) var41.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.i; + _dest.x2[1] = var41.i; + var43.i = _dest.i; + } /* 7: mergewl */ - var40.x2[0] = - ((orc_uint16) var42.x2[0] & 0x0000ffff) | ((orc_uint16) var43. - x2[0] << 16); - var40.x2[1] = - ((orc_uint16) var42.x2[1] & 0x0000ffff) | ((orc_uint16) var43. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var42.x2[0]; + _dest.x2[1] = var43.x2[0]; + var40.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var42.x2[1]; + _dest.x2[1] = var43.x2[1]; + var40.x2[1] = _dest.i; + } /* 8: storeq */ ptr0[i] = var40; } @@ -10133,9 +11401,10 @@ _backup_cogorc_convert_Y42B_AYUV (OrcExecutor * ex) } void -cogorc_convert_Y42B_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint16 * s1, - int s1_stride, const orc_uint8 * s2, int s2_stride, const orc_uint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y42B_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, + const orc_uint8 * ORC_RESTRICT s2, int s2_stride, + const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -10145,7 +11414,6 @@ cogorc_convert_Y42B_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint16 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -10170,7 +11438,7 @@ cogorc_convert_Y42B_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint16 * s1, orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -10197,9 +11465,10 @@ cogorc_convert_Y42B_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint16 * s1, /* cogorc_convert_Y444_YUY2 */ #ifdef DISABLE_ORC void -cogorc_convert_Y444_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, - int s1_stride, const orc_uint16 * s2, int s2_stride, const orc_uint16 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y444_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, + const orc_uint16 * ORC_RESTRICT s2, int s2_stride, + const orc_uint16 * ORC_RESTRICT s3, int s3_stride, int n, int m) { int i; int j; @@ -10229,13 +11498,25 @@ cogorc_convert_Y444_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, /* 1: loadw */ var37 = ptr6[i]; /* 2: mergebw */ - var40.x2[0] = - ((orc_uint8) var36.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var40.x2[1] = - ((orc_uint8) var36.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[0]; + _dest.x2[1] = var37.x2[0]; + var40.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[1]; + _dest.x2[1] = var37.x2[1]; + var40.x2[1] = _dest.i; + } /* 3: splitlw */ - var41.i = (var40.i >> 16) & 0xffff; - var42.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 4: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; @@ -10244,10 +11525,18 @@ cogorc_convert_Y444_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, /* 5: loadw */ var38 = ptr4[i]; /* 6: mergebw */ - var39.x2[0] = - ((orc_uint8) var38.x2[0] & 0x00ff) | ((orc_uint8) var43.x2[0] << 8); - var39.x2[1] = - ((orc_uint8) var38.x2[1] & 0x00ff) | ((orc_uint8) var43.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[0]; + _dest.x2[1] = var43.x2[0]; + var39.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[1]; + _dest.x2[1] = var43.x2[1]; + var39.x2[1] = _dest.i; + } /* 7: storel */ ptr0[i] = var39; } @@ -10257,7 +11546,7 @@ cogorc_convert_Y444_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, #else static void -_backup_cogorc_convert_Y444_YUY2 (OrcExecutor * ex) +_backup_cogorc_convert_Y444_YUY2 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -10289,13 +11578,25 @@ _backup_cogorc_convert_Y444_YUY2 (OrcExecutor * ex) /* 1: loadw */ var37 = ptr6[i]; /* 2: mergebw */ - var40.x2[0] = - ((orc_uint8) var36.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var40.x2[1] = - ((orc_uint8) var36.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[0]; + _dest.x2[1] = var37.x2[0]; + var40.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[1]; + _dest.x2[1] = var37.x2[1]; + var40.x2[1] = _dest.i; + } /* 3: splitlw */ - var41.i = (var40.i >> 16) & 0xffff; - var42.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 4: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; @@ -10304,10 +11605,18 @@ _backup_cogorc_convert_Y444_YUY2 (OrcExecutor * ex) /* 5: loadw */ var38 = ptr4[i]; /* 6: mergebw */ - var39.x2[0] = - ((orc_uint8) var38.x2[0] & 0x00ff) | ((orc_uint8) var43.x2[0] << 8); - var39.x2[1] = - ((orc_uint8) var38.x2[1] & 0x00ff) | ((orc_uint8) var43.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[0]; + _dest.x2[1] = var43.x2[0]; + var39.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[1]; + _dest.x2[1] = var43.x2[1]; + var39.x2[1] = _dest.i; + } /* 7: storel */ ptr0[i] = var39; } @@ -10316,9 +11625,10 @@ _backup_cogorc_convert_Y444_YUY2 (OrcExecutor * ex) } void -cogorc_convert_Y444_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, - int s1_stride, const orc_uint16 * s2, int s2_stride, const orc_uint16 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y444_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, + const orc_uint16 * ORC_RESTRICT s2, int s2_stride, + const orc_uint16 * ORC_RESTRICT s3, int s3_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -10328,7 +11638,6 @@ cogorc_convert_Y444_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -10352,7 +11661,7 @@ cogorc_convert_Y444_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -10379,9 +11688,10 @@ cogorc_convert_Y444_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, /* cogorc_convert_Y444_UYVY */ #ifdef DISABLE_ORC void -cogorc_convert_Y444_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, - int s1_stride, const orc_uint16 * s2, int s2_stride, const orc_uint16 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y444_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, + const orc_uint16 * ORC_RESTRICT s2, int s2_stride, + const orc_uint16 * ORC_RESTRICT s3, int s3_stride, int n, int m) { int i; int j; @@ -10411,13 +11721,25 @@ cogorc_convert_Y444_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, /* 1: loadw */ var37 = ptr6[i]; /* 2: mergebw */ - var40.x2[0] = - ((orc_uint8) var36.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var40.x2[1] = - ((orc_uint8) var36.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[0]; + _dest.x2[1] = var37.x2[0]; + var40.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[1]; + _dest.x2[1] = var37.x2[1]; + var40.x2[1] = _dest.i; + } /* 3: splitlw */ - var41.i = (var40.i >> 16) & 0xffff; - var42.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 4: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; @@ -10426,10 +11748,18 @@ cogorc_convert_Y444_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, /* 5: loadw */ var38 = ptr4[i]; /* 6: mergebw */ - var39.x2[0] = - ((orc_uint8) var43.x2[0] & 0x00ff) | ((orc_uint8) var38.x2[0] << 8); - var39.x2[1] = - ((orc_uint8) var43.x2[1] & 0x00ff) | ((orc_uint8) var38.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[0]; + _dest.x2[1] = var38.x2[0]; + var39.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[1]; + _dest.x2[1] = var38.x2[1]; + var39.x2[1] = _dest.i; + } /* 7: storel */ ptr0[i] = var39; } @@ -10439,7 +11769,7 @@ cogorc_convert_Y444_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, #else static void -_backup_cogorc_convert_Y444_UYVY (OrcExecutor * ex) +_backup_cogorc_convert_Y444_UYVY (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -10471,13 +11801,25 @@ _backup_cogorc_convert_Y444_UYVY (OrcExecutor * ex) /* 1: loadw */ var37 = ptr6[i]; /* 2: mergebw */ - var40.x2[0] = - ((orc_uint8) var36.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var40.x2[1] = - ((orc_uint8) var36.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[0]; + _dest.x2[1] = var37.x2[0]; + var40.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[1]; + _dest.x2[1] = var37.x2[1]; + var40.x2[1] = _dest.i; + } /* 3: splitlw */ - var41.i = (var40.i >> 16) & 0xffff; - var42.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 4: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; @@ -10486,10 +11828,18 @@ _backup_cogorc_convert_Y444_UYVY (OrcExecutor * ex) /* 5: loadw */ var38 = ptr4[i]; /* 6: mergebw */ - var39.x2[0] = - ((orc_uint8) var43.x2[0] & 0x00ff) | ((orc_uint8) var38.x2[0] << 8); - var39.x2[1] = - ((orc_uint8) var43.x2[1] & 0x00ff) | ((orc_uint8) var38.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[0]; + _dest.x2[1] = var38.x2[0]; + var39.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[1]; + _dest.x2[1] = var38.x2[1]; + var39.x2[1] = _dest.i; + } /* 7: storel */ ptr0[i] = var39; } @@ -10498,9 +11848,10 @@ _backup_cogorc_convert_Y444_UYVY (OrcExecutor * ex) } void -cogorc_convert_Y444_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, - int s1_stride, const orc_uint16 * s2, int s2_stride, const orc_uint16 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y444_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint16 * ORC_RESTRICT s1, int s1_stride, + const orc_uint16 * ORC_RESTRICT s2, int s2_stride, + const orc_uint16 * ORC_RESTRICT s3, int s3_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -10510,7 +11861,6 @@ cogorc_convert_Y444_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -10534,7 +11884,7 @@ cogorc_convert_Y444_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -10561,9 +11911,10 @@ cogorc_convert_Y444_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, /* cogorc_convert_Y444_AYUV */ #ifdef DISABLE_ORC void -cogorc_convert_Y444_AYUV (orc_uint32 * d1, int d1_stride, const orc_uint8 * s1, - int s1_stride, const orc_uint8 * s2, int s2_stride, const orc_uint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y444_AYUV (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint8 * ORC_RESTRICT s1, int s1_stride, + const orc_uint8 * ORC_RESTRICT s2, int s2_stride, + const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { int i; int j; @@ -10586,7 +11937,7 @@ cogorc_convert_Y444_AYUV (orc_uint32 * d1, int d1_stride, const orc_uint8 * s1, ptr6 = ORC_PTR_OFFSET (s3, s3_stride * j); /* 3: loadpb */ - var36 = 0x000000ff; /* 255 or 1.25987e-321f */ + var36 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -10594,14 +11945,28 @@ cogorc_convert_Y444_AYUV (orc_uint32 * d1, int d1_stride, const orc_uint8 * s1, /* 1: loadb */ var35 = ptr6[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var34; + _dest.x2[1] = var35; + var39.i = _dest.i; + } /* 4: loadb */ var37 = ptr4[i]; /* 5: mergebw */ - var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var40.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var40.i & 0x0000ffff) | ((orc_uint16) var39.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var40.i; + _dest.x2[1] = var39.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -10611,7 +11976,7 @@ cogorc_convert_Y444_AYUV (orc_uint32 * d1, int d1_stride, const orc_uint8 * s1, #else static void -_backup_cogorc_convert_Y444_AYUV (OrcExecutor * ex) +_backup_cogorc_convert_Y444_AYUV (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -10636,7 +12001,7 @@ _backup_cogorc_convert_Y444_AYUV (OrcExecutor * ex) ptr6 = ORC_PTR_OFFSET (ex->arrays[6], ex->params[6] * j); /* 3: loadpb */ - var36 = 0x000000ff; /* 255 or 1.25987e-321f */ + var36 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -10644,14 +12009,28 @@ _backup_cogorc_convert_Y444_AYUV (OrcExecutor * ex) /* 1: loadb */ var35 = ptr6[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var34; + _dest.x2[1] = var35; + var39.i = _dest.i; + } /* 4: loadb */ var37 = ptr4[i]; /* 5: mergebw */ - var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var40.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var40.i & 0x0000ffff) | ((orc_uint16) var39.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var40.i; + _dest.x2[1] = var39.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -10660,9 +12039,10 @@ _backup_cogorc_convert_Y444_AYUV (OrcExecutor * ex) } void -cogorc_convert_Y444_AYUV (orc_uint32 * d1, int d1_stride, const orc_uint8 * s1, - int s1_stride, const orc_uint8 * s2, int s2_stride, const orc_uint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y444_AYUV (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint8 * ORC_RESTRICT s1, int s1_stride, + const orc_uint8 * ORC_RESTRICT s2, int s2_stride, + const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -10672,7 +12052,6 @@ cogorc_convert_Y444_AYUV (orc_uint32 * d1, int d1_stride, const orc_uint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -10693,7 +12072,7 @@ cogorc_convert_Y444_AYUV (orc_uint32 * d1, int d1_stride, const orc_uint8 * s1, orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -10720,8 +12099,8 @@ cogorc_convert_Y444_AYUV (orc_uint32 * d1, int d1_stride, const orc_uint8 * s1, /* cogorc_convert_AYUV_ARGB */ #ifdef DISABLE_ORC void -cogorc_convert_AYUV_ARGB (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_ARGB (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -10778,25 +12157,25 @@ cogorc_convert_AYUV_ARGB (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); /* 1: loadpb */ - var49.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 14: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 21: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 25: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 29: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 40: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadl */ @@ -10807,14 +12186,26 @@ cogorc_convert_AYUV_ARGB (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, var57.x4[2] = var48.x4[2] - var49.x4[2]; var57.x4[3] = var48.x4[3] - var49.x4[3]; /* 3: splitlw */ - var58.i = (var57.i >> 16) & 0xffff; - var59.i = var57.i & 0xffff; + { + orc_union32 _src; + _src.i = var57.i; + var58.i = _src.x2[1]; + var59.i = _src.x2[0]; + } /* 4: splitwb */ - var60 = (var59.i >> 8) & 0xff; - var61 = var59.i & 0xff; + { + orc_union16 _src; + _src.i = var59.i; + var60 = _src.x2[1]; + var61 = _src.x2[0]; + } /* 5: splitwb */ - var62 = (var58.i >> 8) & 0xff; - var63 = var58.i & 0xff; + { + orc_union16 _src; + _src.i = var58.i; + var62 = _src.x2[1]; + var63 = _src.x2[0]; + } /* 6: convsbw */ var64.i = var60; /* 7: convsbw */ @@ -10868,12 +12259,26 @@ cogorc_convert_AYUV_ARGB (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, /* 36: convssswb */ var89 = ORC_CLAMP_SB (var79.i); /* 37: mergebw */ - var90.i = ((orc_uint8) var61 & 0x00ff) | ((orc_uint8) var87 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var61; + _dest.x2[1] = var87; + var90.i = _dest.i; + } /* 38: mergebw */ - var91.i = ((orc_uint8) var88 & 0x00ff) | ((orc_uint8) var89 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var88; + _dest.x2[1] = var89; + var91.i = _dest.i; + } /* 39: mergewl */ - var92.i = - ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var90.i; + _dest.x2[1] = var91.i; + var92.i = _dest.i; + } /* 41: addb */ var56.x4[0] = var92.x4[0] + var55.x4[0]; var56.x4[1] = var92.x4[1] + var55.x4[1]; @@ -10888,7 +12293,7 @@ cogorc_convert_AYUV_ARGB (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, #else static void -_backup_cogorc_convert_AYUV_ARGB (OrcExecutor * ex) +_backup_cogorc_convert_AYUV_ARGB (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -10947,25 +12352,25 @@ _backup_cogorc_convert_AYUV_ARGB (OrcExecutor * ex) ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); /* 1: loadpb */ - var49.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 14: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 21: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 25: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 29: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 40: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadl */ @@ -10976,14 +12381,26 @@ _backup_cogorc_convert_AYUV_ARGB (OrcExecutor * ex) var57.x4[2] = var48.x4[2] - var49.x4[2]; var57.x4[3] = var48.x4[3] - var49.x4[3]; /* 3: splitlw */ - var58.i = (var57.i >> 16) & 0xffff; - var59.i = var57.i & 0xffff; + { + orc_union32 _src; + _src.i = var57.i; + var58.i = _src.x2[1]; + var59.i = _src.x2[0]; + } /* 4: splitwb */ - var60 = (var59.i >> 8) & 0xff; - var61 = var59.i & 0xff; + { + orc_union16 _src; + _src.i = var59.i; + var60 = _src.x2[1]; + var61 = _src.x2[0]; + } /* 5: splitwb */ - var62 = (var58.i >> 8) & 0xff; - var63 = var58.i & 0xff; + { + orc_union16 _src; + _src.i = var58.i; + var62 = _src.x2[1]; + var63 = _src.x2[0]; + } /* 6: convsbw */ var64.i = var60; /* 7: convsbw */ @@ -11037,12 +12454,26 @@ _backup_cogorc_convert_AYUV_ARGB (OrcExecutor * ex) /* 36: convssswb */ var89 = ORC_CLAMP_SB (var79.i); /* 37: mergebw */ - var90.i = ((orc_uint8) var61 & 0x00ff) | ((orc_uint8) var87 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var61; + _dest.x2[1] = var87; + var90.i = _dest.i; + } /* 38: mergebw */ - var91.i = ((orc_uint8) var88 & 0x00ff) | ((orc_uint8) var89 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var88; + _dest.x2[1] = var89; + var91.i = _dest.i; + } /* 39: mergewl */ - var92.i = - ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var90.i; + _dest.x2[1] = var91.i; + var92.i = _dest.i; + } /* 41: addb */ var56.x4[0] = var92.x4[0] + var55.x4[0]; var56.x4[1] = var92.x4[1] + var55.x4[1]; @@ -11056,8 +12487,8 @@ _backup_cogorc_convert_AYUV_ARGB (OrcExecutor * ex) } void -cogorc_convert_AYUV_ARGB (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_ARGB (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -11067,7 +12498,6 @@ cogorc_convert_AYUV_ARGB (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -11168,7 +12598,7 @@ cogorc_convert_AYUV_ARGB (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, 47, ORC_VAR_C2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -11191,8 +12621,8 @@ cogorc_convert_AYUV_ARGB (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, /* cogorc_convert_AYUV_BGRA */ #ifdef DISABLE_ORC void -cogorc_convert_AYUV_BGRA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_BGRA (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -11249,25 +12679,25 @@ cogorc_convert_AYUV_BGRA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); /* 1: loadpb */ - var49.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 14: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 21: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 25: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 29: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 40: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadl */ @@ -11278,14 +12708,26 @@ cogorc_convert_AYUV_BGRA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, var57.x4[2] = var48.x4[2] - var49.x4[2]; var57.x4[3] = var48.x4[3] - var49.x4[3]; /* 3: splitlw */ - var58.i = (var57.i >> 16) & 0xffff; - var59.i = var57.i & 0xffff; + { + orc_union32 _src; + _src.i = var57.i; + var58.i = _src.x2[1]; + var59.i = _src.x2[0]; + } /* 4: splitwb */ - var60 = (var59.i >> 8) & 0xff; - var61 = var59.i & 0xff; + { + orc_union16 _src; + _src.i = var59.i; + var60 = _src.x2[1]; + var61 = _src.x2[0]; + } /* 5: splitwb */ - var62 = (var58.i >> 8) & 0xff; - var63 = var58.i & 0xff; + { + orc_union16 _src; + _src.i = var58.i; + var62 = _src.x2[1]; + var63 = _src.x2[0]; + } /* 6: convsbw */ var64.i = var60; /* 7: convsbw */ @@ -11339,12 +12781,26 @@ cogorc_convert_AYUV_BGRA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, /* 36: convssswb */ var89 = ORC_CLAMP_SB (var79.i); /* 37: mergebw */ - var90.i = ((orc_uint8) var89 & 0x00ff) | ((orc_uint8) var88 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var89; + _dest.x2[1] = var88; + var90.i = _dest.i; + } /* 38: mergebw */ - var91.i = ((orc_uint8) var87 & 0x00ff) | ((orc_uint8) var61 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var87; + _dest.x2[1] = var61; + var91.i = _dest.i; + } /* 39: mergewl */ - var92.i = - ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var90.i; + _dest.x2[1] = var91.i; + var92.i = _dest.i; + } /* 41: addb */ var56.x4[0] = var92.x4[0] + var55.x4[0]; var56.x4[1] = var92.x4[1] + var55.x4[1]; @@ -11359,7 +12815,7 @@ cogorc_convert_AYUV_BGRA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, #else static void -_backup_cogorc_convert_AYUV_BGRA (OrcExecutor * ex) +_backup_cogorc_convert_AYUV_BGRA (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -11418,25 +12874,25 @@ _backup_cogorc_convert_AYUV_BGRA (OrcExecutor * ex) ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); /* 1: loadpb */ - var49.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 14: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 21: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 25: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 29: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 40: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadl */ @@ -11447,14 +12903,26 @@ _backup_cogorc_convert_AYUV_BGRA (OrcExecutor * ex) var57.x4[2] = var48.x4[2] - var49.x4[2]; var57.x4[3] = var48.x4[3] - var49.x4[3]; /* 3: splitlw */ - var58.i = (var57.i >> 16) & 0xffff; - var59.i = var57.i & 0xffff; + { + orc_union32 _src; + _src.i = var57.i; + var58.i = _src.x2[1]; + var59.i = _src.x2[0]; + } /* 4: splitwb */ - var60 = (var59.i >> 8) & 0xff; - var61 = var59.i & 0xff; + { + orc_union16 _src; + _src.i = var59.i; + var60 = _src.x2[1]; + var61 = _src.x2[0]; + } /* 5: splitwb */ - var62 = (var58.i >> 8) & 0xff; - var63 = var58.i & 0xff; + { + orc_union16 _src; + _src.i = var58.i; + var62 = _src.x2[1]; + var63 = _src.x2[0]; + } /* 6: convsbw */ var64.i = var60; /* 7: convsbw */ @@ -11508,12 +12976,26 @@ _backup_cogorc_convert_AYUV_BGRA (OrcExecutor * ex) /* 36: convssswb */ var89 = ORC_CLAMP_SB (var79.i); /* 37: mergebw */ - var90.i = ((orc_uint8) var89 & 0x00ff) | ((orc_uint8) var88 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var89; + _dest.x2[1] = var88; + var90.i = _dest.i; + } /* 38: mergebw */ - var91.i = ((orc_uint8) var87 & 0x00ff) | ((orc_uint8) var61 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var87; + _dest.x2[1] = var61; + var91.i = _dest.i; + } /* 39: mergewl */ - var92.i = - ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var90.i; + _dest.x2[1] = var91.i; + var92.i = _dest.i; + } /* 41: addb */ var56.x4[0] = var92.x4[0] + var55.x4[0]; var56.x4[1] = var92.x4[1] + var55.x4[1]; @@ -11527,8 +13009,8 @@ _backup_cogorc_convert_AYUV_BGRA (OrcExecutor * ex) } void -cogorc_convert_AYUV_BGRA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_BGRA (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -11538,7 +13020,6 @@ cogorc_convert_AYUV_BGRA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -11639,7 +13120,7 @@ cogorc_convert_AYUV_BGRA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, 47, ORC_VAR_C2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -11662,8 +13143,8 @@ cogorc_convert_AYUV_BGRA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, /* cogorc_convert_AYUV_ABGR */ #ifdef DISABLE_ORC void -cogorc_convert_AYUV_ABGR (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_ABGR (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -11720,25 +13201,25 @@ cogorc_convert_AYUV_ABGR (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); /* 1: loadpb */ - var49.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 14: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 21: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 25: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 29: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 40: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadl */ @@ -11749,14 +13230,26 @@ cogorc_convert_AYUV_ABGR (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, var57.x4[2] = var48.x4[2] - var49.x4[2]; var57.x4[3] = var48.x4[3] - var49.x4[3]; /* 3: splitlw */ - var58.i = (var57.i >> 16) & 0xffff; - var59.i = var57.i & 0xffff; + { + orc_union32 _src; + _src.i = var57.i; + var58.i = _src.x2[1]; + var59.i = _src.x2[0]; + } /* 4: splitwb */ - var60 = (var59.i >> 8) & 0xff; - var61 = var59.i & 0xff; + { + orc_union16 _src; + _src.i = var59.i; + var60 = _src.x2[1]; + var61 = _src.x2[0]; + } /* 5: splitwb */ - var62 = (var58.i >> 8) & 0xff; - var63 = var58.i & 0xff; + { + orc_union16 _src; + _src.i = var58.i; + var62 = _src.x2[1]; + var63 = _src.x2[0]; + } /* 6: convsbw */ var64.i = var60; /* 7: convsbw */ @@ -11810,12 +13303,26 @@ cogorc_convert_AYUV_ABGR (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, /* 36: convssswb */ var89 = ORC_CLAMP_SB (var79.i); /* 37: mergebw */ - var90.i = ((orc_uint8) var61 & 0x00ff) | ((orc_uint8) var89 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var61; + _dest.x2[1] = var89; + var90.i = _dest.i; + } /* 38: mergebw */ - var91.i = ((orc_uint8) var88 & 0x00ff) | ((orc_uint8) var87 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var88; + _dest.x2[1] = var87; + var91.i = _dest.i; + } /* 39: mergewl */ - var92.i = - ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var90.i; + _dest.x2[1] = var91.i; + var92.i = _dest.i; + } /* 41: addb */ var56.x4[0] = var92.x4[0] + var55.x4[0]; var56.x4[1] = var92.x4[1] + var55.x4[1]; @@ -11830,7 +13337,7 @@ cogorc_convert_AYUV_ABGR (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, #else static void -_backup_cogorc_convert_AYUV_ABGR (OrcExecutor * ex) +_backup_cogorc_convert_AYUV_ABGR (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -11889,25 +13396,25 @@ _backup_cogorc_convert_AYUV_ABGR (OrcExecutor * ex) ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); /* 1: loadpb */ - var49.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 14: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 21: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 25: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 29: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 40: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadl */ @@ -11918,14 +13425,26 @@ _backup_cogorc_convert_AYUV_ABGR (OrcExecutor * ex) var57.x4[2] = var48.x4[2] - var49.x4[2]; var57.x4[3] = var48.x4[3] - var49.x4[3]; /* 3: splitlw */ - var58.i = (var57.i >> 16) & 0xffff; - var59.i = var57.i & 0xffff; + { + orc_union32 _src; + _src.i = var57.i; + var58.i = _src.x2[1]; + var59.i = _src.x2[0]; + } /* 4: splitwb */ - var60 = (var59.i >> 8) & 0xff; - var61 = var59.i & 0xff; + { + orc_union16 _src; + _src.i = var59.i; + var60 = _src.x2[1]; + var61 = _src.x2[0]; + } /* 5: splitwb */ - var62 = (var58.i >> 8) & 0xff; - var63 = var58.i & 0xff; + { + orc_union16 _src; + _src.i = var58.i; + var62 = _src.x2[1]; + var63 = _src.x2[0]; + } /* 6: convsbw */ var64.i = var60; /* 7: convsbw */ @@ -11979,12 +13498,26 @@ _backup_cogorc_convert_AYUV_ABGR (OrcExecutor * ex) /* 36: convssswb */ var89 = ORC_CLAMP_SB (var79.i); /* 37: mergebw */ - var90.i = ((orc_uint8) var61 & 0x00ff) | ((orc_uint8) var89 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var61; + _dest.x2[1] = var89; + var90.i = _dest.i; + } /* 38: mergebw */ - var91.i = ((orc_uint8) var88 & 0x00ff) | ((orc_uint8) var87 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var88; + _dest.x2[1] = var87; + var91.i = _dest.i; + } /* 39: mergewl */ - var92.i = - ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var90.i; + _dest.x2[1] = var91.i; + var92.i = _dest.i; + } /* 41: addb */ var56.x4[0] = var92.x4[0] + var55.x4[0]; var56.x4[1] = var92.x4[1] + var55.x4[1]; @@ -11998,8 +13531,8 @@ _backup_cogorc_convert_AYUV_ABGR (OrcExecutor * ex) } void -cogorc_convert_AYUV_ABGR (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_ABGR (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -12009,7 +13542,6 @@ cogorc_convert_AYUV_ABGR (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -12110,7 +13642,7 @@ cogorc_convert_AYUV_ABGR (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, 47, ORC_VAR_C2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -12133,8 +13665,8 @@ cogorc_convert_AYUV_ABGR (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, /* cogorc_convert_AYUV_RGBA */ #ifdef DISABLE_ORC void -cogorc_convert_AYUV_RGBA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_RGBA (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -12191,25 +13723,25 @@ cogorc_convert_AYUV_RGBA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); /* 1: loadpb */ - var49.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 14: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 21: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 25: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 29: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 40: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadl */ @@ -12220,14 +13752,26 @@ cogorc_convert_AYUV_RGBA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, var57.x4[2] = var48.x4[2] - var49.x4[2]; var57.x4[3] = var48.x4[3] - var49.x4[3]; /* 3: splitlw */ - var58.i = (var57.i >> 16) & 0xffff; - var59.i = var57.i & 0xffff; + { + orc_union32 _src; + _src.i = var57.i; + var58.i = _src.x2[1]; + var59.i = _src.x2[0]; + } /* 4: splitwb */ - var60 = (var59.i >> 8) & 0xff; - var61 = var59.i & 0xff; + { + orc_union16 _src; + _src.i = var59.i; + var60 = _src.x2[1]; + var61 = _src.x2[0]; + } /* 5: splitwb */ - var62 = (var58.i >> 8) & 0xff; - var63 = var58.i & 0xff; + { + orc_union16 _src; + _src.i = var58.i; + var62 = _src.x2[1]; + var63 = _src.x2[0]; + } /* 6: convsbw */ var64.i = var60; /* 7: convsbw */ @@ -12281,12 +13825,26 @@ cogorc_convert_AYUV_RGBA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, /* 36: convssswb */ var89 = ORC_CLAMP_SB (var79.i); /* 37: mergebw */ - var90.i = ((orc_uint8) var87 & 0x00ff) | ((orc_uint8) var88 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var87; + _dest.x2[1] = var88; + var90.i = _dest.i; + } /* 38: mergebw */ - var91.i = ((orc_uint8) var89 & 0x00ff) | ((orc_uint8) var61 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var89; + _dest.x2[1] = var61; + var91.i = _dest.i; + } /* 39: mergewl */ - var92.i = - ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var90.i; + _dest.x2[1] = var91.i; + var92.i = _dest.i; + } /* 41: addb */ var56.x4[0] = var92.x4[0] + var55.x4[0]; var56.x4[1] = var92.x4[1] + var55.x4[1]; @@ -12301,7 +13859,7 @@ cogorc_convert_AYUV_RGBA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, #else static void -_backup_cogorc_convert_AYUV_RGBA (OrcExecutor * ex) +_backup_cogorc_convert_AYUV_RGBA (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -12360,25 +13918,25 @@ _backup_cogorc_convert_AYUV_RGBA (OrcExecutor * ex) ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); /* 1: loadpb */ - var49.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 14: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 21: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 25: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 29: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 40: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadl */ @@ -12389,14 +13947,26 @@ _backup_cogorc_convert_AYUV_RGBA (OrcExecutor * ex) var57.x4[2] = var48.x4[2] - var49.x4[2]; var57.x4[3] = var48.x4[3] - var49.x4[3]; /* 3: splitlw */ - var58.i = (var57.i >> 16) & 0xffff; - var59.i = var57.i & 0xffff; + { + orc_union32 _src; + _src.i = var57.i; + var58.i = _src.x2[1]; + var59.i = _src.x2[0]; + } /* 4: splitwb */ - var60 = (var59.i >> 8) & 0xff; - var61 = var59.i & 0xff; + { + orc_union16 _src; + _src.i = var59.i; + var60 = _src.x2[1]; + var61 = _src.x2[0]; + } /* 5: splitwb */ - var62 = (var58.i >> 8) & 0xff; - var63 = var58.i & 0xff; + { + orc_union16 _src; + _src.i = var58.i; + var62 = _src.x2[1]; + var63 = _src.x2[0]; + } /* 6: convsbw */ var64.i = var60; /* 7: convsbw */ @@ -12450,12 +14020,26 @@ _backup_cogorc_convert_AYUV_RGBA (OrcExecutor * ex) /* 36: convssswb */ var89 = ORC_CLAMP_SB (var79.i); /* 37: mergebw */ - var90.i = ((orc_uint8) var87 & 0x00ff) | ((orc_uint8) var88 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var87; + _dest.x2[1] = var88; + var90.i = _dest.i; + } /* 38: mergebw */ - var91.i = ((orc_uint8) var89 & 0x00ff) | ((orc_uint8) var61 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var89; + _dest.x2[1] = var61; + var91.i = _dest.i; + } /* 39: mergewl */ - var92.i = - ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var90.i; + _dest.x2[1] = var91.i; + var92.i = _dest.i; + } /* 41: addb */ var56.x4[0] = var92.x4[0] + var55.x4[0]; var56.x4[1] = var92.x4[1] + var55.x4[1]; @@ -12469,8 +14053,8 @@ _backup_cogorc_convert_AYUV_RGBA (OrcExecutor * ex) } void -cogorc_convert_AYUV_RGBA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_RGBA (orc_uint32 * ORC_RESTRICT d1, int d1_stride, + const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -12480,7 +14064,6 @@ cogorc_convert_AYUV_RGBA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -12581,7 +14164,7 @@ cogorc_convert_AYUV_RGBA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, 47, ORC_VAR_C2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -12604,8 +14187,9 @@ cogorc_convert_AYUV_RGBA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, /* cogorc_convert_I420_BGRA */ #ifdef DISABLE_ORC void -cogorc_convert_I420_BGRA (orc_uint32 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, const orc_uint8 * s3, int n) +cogorc_convert_I420_BGRA (orc_uint32 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -12665,28 +14249,28 @@ cogorc_convert_I420_BGRA (orc_uint32 * d1, const orc_uint8 * s1, ptr6 = (orc_int8 *) s3; /* 1: loadpb */ - var46 = 0x00000080; /* 128 or 6.32404e-322f */ + var46 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 5: loadpb */ - var47 = 0x00000080; /* 128 or 6.32404e-322f */ + var47 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpb */ - var48 = 0x00000080; /* 128 or 6.32404e-322f */ + var48 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 12: loadpw */ - var49.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var49.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 17: loadpw */ - var50.i = 0x00000067; /* 103 or 5.08888e-322f */ + var50.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 24: loadpw */ - var51.i = 0x00000004; /* 4 or 1.97626e-323f */ + var51.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 28: loadpw */ - var52.i = 0x00000064; /* 100 or 4.94066e-322f */ + var52.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 32: loadpw */ - var53.i = 0x00000068; /* 104 or 5.13828e-322f */ + var53.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 41: loadpb */ - var54 = 0x000000ff; /* 255 or 1.25987e-321f */ + var54 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ /* 44: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -12758,12 +14342,26 @@ cogorc_convert_I420_BGRA (orc_uint32 * d1, const orc_uint8 * s1, /* 39: convssswb */ var87 = ORC_CLAMP_SB (var77.i); /* 40: mergebw */ - var88.i = ((orc_uint8) var87 & 0x00ff) | ((orc_uint8) var86 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var87; + _dest.x2[1] = var86; + var88.i = _dest.i; + } /* 42: mergebw */ - var89.i = ((orc_uint8) var85 & 0x00ff) | ((orc_uint8) var54 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var85; + _dest.x2[1] = var54; + var89.i = _dest.i; + } /* 43: mergewl */ - var90.i = - ((orc_uint16) var88.i & 0x0000ffff) | ((orc_uint16) var89.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var88.i; + _dest.x2[1] = var89.i; + var90.i = _dest.i; + } /* 45: addb */ var56.x4[0] = var90.x4[0] + var55.x4[0]; var56.x4[1] = var90.x4[1] + var55.x4[1]; @@ -12777,7 +14375,7 @@ cogorc_convert_I420_BGRA (orc_uint32 * d1, const orc_uint8 * s1, #else static void -_backup_cogorc_convert_I420_BGRA (OrcExecutor * ex) +_backup_cogorc_convert_I420_BGRA (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -12838,28 +14436,28 @@ _backup_cogorc_convert_I420_BGRA (OrcExecutor * ex) ptr6 = (orc_int8 *) ex->arrays[6]; /* 1: loadpb */ - var46 = 0x00000080; /* 128 or 6.32404e-322f */ + var46 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 5: loadpb */ - var47 = 0x00000080; /* 128 or 6.32404e-322f */ + var47 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpb */ - var48 = 0x00000080; /* 128 or 6.32404e-322f */ + var48 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 12: loadpw */ - var49.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var49.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 17: loadpw */ - var50.i = 0x00000067; /* 103 or 5.08888e-322f */ + var50.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 24: loadpw */ - var51.i = 0x00000004; /* 4 or 1.97626e-323f */ + var51.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 28: loadpw */ - var52.i = 0x00000064; /* 100 or 4.94066e-322f */ + var52.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 32: loadpw */ - var53.i = 0x00000068; /* 104 or 5.13828e-322f */ + var53.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 41: loadpb */ - var54 = 0x000000ff; /* 255 or 1.25987e-321f */ + var54 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ /* 44: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -12931,12 +14529,26 @@ _backup_cogorc_convert_I420_BGRA (OrcExecutor * ex) /* 39: convssswb */ var87 = ORC_CLAMP_SB (var77.i); /* 40: mergebw */ - var88.i = ((orc_uint8) var87 & 0x00ff) | ((orc_uint8) var86 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var87; + _dest.x2[1] = var86; + var88.i = _dest.i; + } /* 42: mergebw */ - var89.i = ((orc_uint8) var85 & 0x00ff) | ((orc_uint8) var54 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var85; + _dest.x2[1] = var54; + var89.i = _dest.i; + } /* 43: mergewl */ - var90.i = - ((orc_uint16) var88.i & 0x0000ffff) | ((orc_uint16) var89.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var88.i; + _dest.x2[1] = var89.i; + var90.i = _dest.i; + } /* 45: addb */ var56.x4[0] = var90.x4[0] + var55.x4[0]; var56.x4[1] = var90.x4[1] + var55.x4[1]; @@ -12949,8 +14561,9 @@ _backup_cogorc_convert_I420_BGRA (OrcExecutor * ex) } void -cogorc_convert_I420_BGRA (orc_uint32 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, const orc_uint8 * s3, int n) +cogorc_convert_I420_BGRA (orc_uint32 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -12960,7 +14573,6 @@ cogorc_convert_I420_BGRA (orc_uint32 * d1, const orc_uint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_convert_I420_BGRA"); @@ -13062,7 +14674,7 @@ cogorc_convert_I420_BGRA (orc_uint32 * d1, const orc_uint8 * s1, orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, ORC_VAR_T13, ORC_VAR_C2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -13084,9 +14696,10 @@ cogorc_convert_I420_BGRA (orc_uint32 * d1, const orc_uint8 * s1, /* cogorc_convert_I420_BGRA_avg */ #ifdef DISABLE_ORC void -cogorc_convert_I420_BGRA_avg (orc_uint32 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, const orc_uint8 * s3, const orc_uint8 * s4, - const orc_uint8 * s5, int n) +cogorc_convert_I420_BGRA_avg (orc_uint32 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, + const orc_uint8 * ORC_RESTRICT s5, int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -13154,28 +14767,28 @@ cogorc_convert_I420_BGRA_avg (orc_uint32 * d1, const orc_uint8 * s1, ptr8 = (orc_int8 *) s5; /* 1: loadpb */ - var47 = 0x00000080; /* 128 or 6.32404e-322f */ + var47 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 7: loadpb */ - var48 = 0x00000080; /* 128 or 6.32404e-322f */ + var48 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 13: loadpb */ - var49 = 0x00000080; /* 128 or 6.32404e-322f */ + var49 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 16: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 21: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 28: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 32: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 36: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 45: loadpb */ - var55 = 0x000000ff; /* 255 or 1.25987e-321f */ + var55 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ /* 48: loadpb */ - var56.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var56.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var56.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var56.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var56.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var56.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var56.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var56.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -13259,12 +14872,26 @@ cogorc_convert_I420_BGRA_avg (orc_uint32 * d1, const orc_uint8 * s1, /* 43: convssswb */ var92 = ORC_CLAMP_SB (var82.i); /* 44: mergebw */ - var93.i = ((orc_uint8) var92 & 0x00ff) | ((orc_uint8) var91 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var92; + _dest.x2[1] = var91; + var93.i = _dest.i; + } /* 46: mergebw */ - var94.i = ((orc_uint8) var90 & 0x00ff) | ((orc_uint8) var55 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var90; + _dest.x2[1] = var55; + var94.i = _dest.i; + } /* 47: mergewl */ - var95.i = - ((orc_uint16) var93.i & 0x0000ffff) | ((orc_uint16) var94.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var93.i; + _dest.x2[1] = var94.i; + var95.i = _dest.i; + } /* 49: addb */ var57.x4[0] = var95.x4[0] + var56.x4[0]; var57.x4[1] = var95.x4[1] + var56.x4[1]; @@ -13278,7 +14905,7 @@ cogorc_convert_I420_BGRA_avg (orc_uint32 * d1, const orc_uint8 * s1, #else static void -_backup_cogorc_convert_I420_BGRA_avg (OrcExecutor * ex) +_backup_cogorc_convert_I420_BGRA_avg (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -13347,28 +14974,28 @@ _backup_cogorc_convert_I420_BGRA_avg (OrcExecutor * ex) ptr8 = (orc_int8 *) ex->arrays[8]; /* 1: loadpb */ - var47 = 0x00000080; /* 128 or 6.32404e-322f */ + var47 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 7: loadpb */ - var48 = 0x00000080; /* 128 or 6.32404e-322f */ + var48 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 13: loadpb */ - var49 = 0x00000080; /* 128 or 6.32404e-322f */ + var49 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 16: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 21: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 28: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 32: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 36: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 45: loadpb */ - var55 = 0x000000ff; /* 255 or 1.25987e-321f */ + var55 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ /* 48: loadpb */ - var56.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var56.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var56.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var56.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var56.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var56.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var56.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var56.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -13452,12 +15079,26 @@ _backup_cogorc_convert_I420_BGRA_avg (OrcExecutor * ex) /* 43: convssswb */ var92 = ORC_CLAMP_SB (var82.i); /* 44: mergebw */ - var93.i = ((orc_uint8) var92 & 0x00ff) | ((orc_uint8) var91 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var92; + _dest.x2[1] = var91; + var93.i = _dest.i; + } /* 46: mergebw */ - var94.i = ((orc_uint8) var90 & 0x00ff) | ((orc_uint8) var55 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var90; + _dest.x2[1] = var55; + var94.i = _dest.i; + } /* 47: mergewl */ - var95.i = - ((orc_uint16) var93.i & 0x0000ffff) | ((orc_uint16) var94.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var93.i; + _dest.x2[1] = var94.i; + var95.i = _dest.i; + } /* 49: addb */ var57.x4[0] = var95.x4[0] + var56.x4[0]; var57.x4[1] = var95.x4[1] + var56.x4[1]; @@ -13470,9 +15111,10 @@ _backup_cogorc_convert_I420_BGRA_avg (OrcExecutor * ex) } void -cogorc_convert_I420_BGRA_avg (orc_uint32 * d1, const orc_uint8 * s1, - const orc_uint8 * s2, const orc_uint8 * s3, const orc_uint8 * s4, - const orc_uint8 * s5, int n) +cogorc_convert_I420_BGRA_avg (orc_uint32 * ORC_RESTRICT d1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, + const orc_uint8 * ORC_RESTRICT s5, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -13482,7 +15124,6 @@ cogorc_convert_I420_BGRA_avg (orc_uint32 * d1, const orc_uint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_convert_I420_BGRA_avg"); @@ -13595,7 +15236,7 @@ cogorc_convert_I420_BGRA_avg (orc_uint32 * d1, const orc_uint8 * s1, orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, ORC_VAR_T14, ORC_VAR_C2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); diff --git a/ext/cog/gstcogorc-dist.h b/ext/cog/gstcogorc-dist.h index 4f1dbd204d..e7bac246ee 100644 --- a/ext/cog/gstcogorc-dist.h +++ b/ext/cog/gstcogorc-dist.h @@ -35,6 +35,7 @@ typedef unsigned __int16 orc_uint16; typedef unsigned __int32 orc_uint32; typedef unsigned __int64 orc_uint64; #define ORC_UINT64_C(x) (x##Ui64) +#define inline __inline #else #include typedef signed char orc_int8; @@ -57,80 +58,89 @@ typedef union { orc_int16 i; orc_int8 x2[2]; } orc_union16; typedef union { orc_int32 i; float f; orc_int16 x2[2]; orc_int8 x4[4]; } orc_union32; typedef union { orc_int64 i; double f; orc_int32 x2[2]; float x2f[2]; orc_int16 x4[4]; } orc_union64; #endif -void cogorc_memcpy_2d (orc_uint8 * d1, int d1_stride, const orc_uint8 * s1, int s1_stride, int n, int m); -void cogorc_downsample_horiz_cosite_1tap (orc_uint8 * d1, const orc_uint16 * s1, int n); -void cogorc_downsample_horiz_cosite_3tap (orc_uint8 * d1, const orc_uint16 * s1, const orc_uint16 * s2, int n); -void cogorc_downsample_420_jpeg (orc_uint8 * d1, const orc_uint16 * s1, const orc_uint16 * s2, int n); -void cogorc_downsample_vert_halfsite_2tap (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, int n); -void cogorc_downsample_vert_cosite_3tap (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, const orc_uint8 * s3, int n); -void cogorc_downsample_vert_halfsite_4tap (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, const orc_uint8 * s3, const orc_uint8 * s4, int n); -void cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const orc_uint8 * s1, int n); -void cogorc_upsample_horiz_cosite (guint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, int n); -void cogorc_upsample_vert_avgub (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, int n); -void orc_unpack_yuyv_y (orc_uint8 * d1, const orc_uint16 * s1, int n); -void orc_unpack_yuyv_u (orc_uint8 * d1, const orc_uint32 * s1, int n); -void orc_unpack_yuyv_v (orc_uint8 * d1, const orc_uint32 * s1, int n); -void orc_pack_yuyv (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2, const orc_uint8 * s3, int n); -void orc_unpack_uyvy_y (orc_uint8 * d1, const orc_uint16 * s1, int n); -void orc_unpack_uyvy_u (orc_uint8 * d1, const orc_uint32 * s1, int n); -void orc_unpack_uyvy_v (orc_uint8 * d1, const orc_uint32 * s1, int n); -void orc_pack_uyvy (orc_uint32 * d1, const guint8 * s1, const orc_uint8 * s2, const orc_uint8 * s3, int n); -void orc_addc_convert_u8_s16 (orc_uint8 * d1, const gint16 * s1, int n); -void orc_subc_convert_s16_u8 (gint16 * d1, const orc_uint8 * s1, int n); -void orc_splat_u8_ns (orc_uint8 * d1, int p1, int n); -void orc_splat_s16_ns (gint16 * d1, int p1, int n); -void orc_matrix2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, int p2, int p3, int n); -void orc_matrix2_11_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, int p2, int n); -void orc_matrix2_12_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, int p2, int n); -void orc_matrix3_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, int p1, int p2, int p3, int p4, int n); -void orc_matrix3_100_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, int p1, int p2, int p3, int n); -void orc_matrix3_100_offset_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, int p1, int p2, int p3, int p4, int p5, int n); -void orc_matrix3_000_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, int p1, int p2, int p3, int p4, int p5, int n); -void orc_pack_123x (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, const orc_uint8 * s3, int p1, int n); -void orc_pack_x123 (guint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, const orc_uint8 * s3, int p1, int n); -void cogorc_combine2_u8 (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, int p1, int p2, int n); -void cogorc_combine4_u8 (orc_uint8 * d1, const orc_uint8 * s1, const orc_uint8 * s2, const orc_uint8 * s3, const orc_uint8 * s4, int p1, int p2, int p3, int p4, int n); -void cogorc_unpack_axyz_0 (orc_uint8 * d1, const orc_uint32 * s1, int n); -void cogorc_unpack_axyz_1 (orc_uint8 * d1, const orc_uint32 * s1, int n); -void cogorc_unpack_axyz_2 (orc_uint8 * d1, const orc_uint32 * s1, int n); -void cogorc_unpack_axyz_3 (orc_uint8 * d1, const orc_uint32 * s1, int n); -void cogorc_resample_horiz_1tap (orc_uint8 * d1, const orc_uint8 * s1, int p1, int p2, int n); -void cogorc_resample_horiz_2tap (orc_uint8 * d1, const orc_uint8 * s1, int p1, int p2, int n); -void cogorc_convert_I420_UYVY (orc_uint32 * d1, orc_uint32 * d2, const orc_uint16 * s1, const orc_uint16 * s2, const orc_uint8 * s3, const orc_uint8 * s4, int n); -void cogorc_convert_I420_YUY2 (orc_uint32 * d1, orc_uint32 * d2, const orc_uint16 * s1, const orc_uint16 * s2, const orc_uint8 * s3, const orc_uint8 * s4, int n); -void cogorc_convert_I420_AYUV (orc_uint32 * d1, orc_uint32 * d2, const orc_uint8 * s1, const orc_uint8 * s2, const orc_uint8 * s3, const orc_uint8 * s4, int n); -void cogorc_convert_YUY2_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3, orc_uint8 * d4, const orc_uint32 * s1, const orc_uint32 * s2, int n); -void cogorc_convert_UYVY_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_420_422 (orc_uint8 * d1, int d1_stride, orc_uint8 * d2, int d2_stride, const orc_uint8 * s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_420_444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, int d2_stride, const orc_uint8 * s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_422_444 (orc_uint16 * d1, int d1_stride, const orc_uint8 * s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_444_422 (orc_uint8 * d1, int d1_stride, const orc_uint16 * s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_444_420 (orc_uint8 * d1, int d1_stride, const orc_uint16 * s1, int s1_stride, const orc_uint16 * s2, int s2_stride, int n, int m); -void cogorc_planar_chroma_422_420 (orc_uint8 * d1, int d1_stride, const orc_uint8 * s1, int s1_stride, const orc_uint8 * s2, int s2_stride, int n, int m); -void cogorc_convert_YUY2_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1, int s1_stride, int n, int m); -void cogorc_convert_UYVY_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint32 * s1, int s1_stride, int n, int m); -void cogorc_convert_YUY2_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, int d2_stride, orc_uint8 * d3, int d3_stride, const orc_uint32 * s1, int s1_stride, int n, int m); -void cogorc_convert_UYVY_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, int d2_stride, orc_uint8 * d3, int d3_stride, const orc_uint32 * s1, int s1_stride, int n, int m); -void cogorc_convert_YUY2_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, int d2_stride, orc_uint16 * d3, int d3_stride, const orc_uint32 * s1, int s1_stride, int n, int m); -void cogorc_convert_UYVY_Y444 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, int d2_stride, orc_uint16 * d3, int d3_stride, const orc_uint32 * s1, int s1_stride, int n, int m); -void cogorc_convert_UYVY_I420 (orc_uint16 * d1, orc_uint16 * d2, orc_uint8 * d3, orc_uint8 * d4, const orc_uint32 * s1, const orc_uint32 * s2, int n); -void cogorc_convert_AYUV_I420 (orc_uint16 * d1, int d1_stride, orc_uint16 * d2, int d2_stride, orc_uint8 * d3, int d3_stride, orc_uint8 * d4, int d4_stride, const orc_uint64 * s1, int s1_stride, const orc_uint64 * s2, int s2_stride, int n, int m); -void cogorc_convert_AYUV_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint64 * s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_Y42B (orc_uint16 * d1, int d1_stride, orc_uint8 * d2, int d2_stride, orc_uint8 * d3, int d3_stride, const orc_uint64 * s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_Y444 (orc_uint8 * d1, int d1_stride, orc_uint8 * d2, int d2_stride, orc_uint8 * d3, int d3_stride, const orc_uint32 * s1, int s1_stride, int n, int m); -void cogorc_convert_Y42B_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, int s1_stride, const orc_uint8 * s2, int s2_stride, const orc_uint8 * s3, int s3_stride, int n, int m); -void cogorc_convert_Y42B_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, int s1_stride, const orc_uint8 * s2, int s2_stride, const orc_uint8 * s3, int s3_stride, int n, int m); -void cogorc_convert_Y42B_AYUV (orc_uint64 * d1, int d1_stride, const orc_uint16 * s1, int s1_stride, const orc_uint8 * s2, int s2_stride, const orc_uint8 * s3, int s3_stride, int n, int m); -void cogorc_convert_Y444_YUY2 (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, int s1_stride, const orc_uint16 * s2, int s2_stride, const orc_uint16 * s3, int s3_stride, int n, int m); -void cogorc_convert_Y444_UYVY (orc_uint32 * d1, int d1_stride, const orc_uint16 * s1, int s1_stride, const orc_uint16 * s2, int s2_stride, const orc_uint16 * s3, int s3_stride, int n, int m); -void cogorc_convert_Y444_AYUV (orc_uint32 * d1, int d1_stride, const orc_uint8 * s1, int s1_stride, const orc_uint8 * s2, int s2_stride, const orc_uint8 * s3, int s3_stride, int n, int m); -void cogorc_convert_AYUV_ARGB (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_BGRA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_ABGR (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_RGBA (orc_uint32 * d1, int d1_stride, const orc_uint32 * s1, int s1_stride, int n, int m); -void cogorc_convert_I420_BGRA (orc_uint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, const orc_uint8 * s3, int n); -void cogorc_convert_I420_BGRA_avg (orc_uint32 * d1, const orc_uint8 * s1, const orc_uint8 * s2, const orc_uint8 * s3, const orc_uint8 * s4, const orc_uint8 * s5, int n); +#ifndef ORC_RESTRICT +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#define ORC_RESTRICT restrict +#elif defined(__GNUC__) && __GNUC__ >= 4 +#define ORC_RESTRICT __restrict__ +#else +#define ORC_RESTRICT +#endif +#endif +void cogorc_memcpy_2d (orc_uint8 * ORC_RESTRICT d1, int d1_stride, const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_downsample_horiz_cosite_1tap (orc_uint8 * ORC_RESTRICT d1, const orc_uint16 * ORC_RESTRICT s1, int n); +void cogorc_downsample_horiz_cosite_3tap (orc_uint8 * ORC_RESTRICT d1, const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * ORC_RESTRICT s2, int n); +void cogorc_downsample_420_jpeg (orc_uint8 * ORC_RESTRICT d1, const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * ORC_RESTRICT s2, int n); +void cogorc_downsample_vert_halfsite_2tap (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int n); +void cogorc_downsample_vert_cosite_3tap (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, int n); +void cogorc_downsample_vert_halfsite_4tap (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, int n); +void cogorc_upsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, int n); +void cogorc_upsample_horiz_cosite (guint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int n); +void cogorc_upsample_vert_avgub (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int n); +void orc_unpack_yuyv_y (orc_uint8 * ORC_RESTRICT d1, const orc_uint16 * ORC_RESTRICT s1, int n); +void orc_unpack_yuyv_u (orc_uint8 * ORC_RESTRICT d1, const orc_uint32 * ORC_RESTRICT s1, int n); +void orc_unpack_yuyv_v (orc_uint8 * ORC_RESTRICT d1, const orc_uint32 * ORC_RESTRICT s1, int n); +void orc_pack_yuyv (orc_uint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, int n); +void orc_unpack_uyvy_y (orc_uint8 * ORC_RESTRICT d1, const orc_uint16 * ORC_RESTRICT s1, int n); +void orc_unpack_uyvy_u (orc_uint8 * ORC_RESTRICT d1, const orc_uint32 * ORC_RESTRICT s1, int n); +void orc_unpack_uyvy_v (orc_uint8 * ORC_RESTRICT d1, const orc_uint32 * ORC_RESTRICT s1, int n); +void orc_pack_uyvy (orc_uint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, int n); +void orc_addc_convert_u8_s16 (orc_uint8 * ORC_RESTRICT d1, const gint16 * ORC_RESTRICT s1, int n); +void orc_subc_convert_s16_u8 (gint16 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, int n); +void orc_splat_u8_ns (orc_uint8 * ORC_RESTRICT d1, int p1, int n); +void orc_splat_s16_ns (gint16 * ORC_RESTRICT d1, int p1, int n); +void orc_matrix2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, int p2, int p3, int n); +void orc_matrix2_11_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, int p2, int n); +void orc_matrix2_12_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, int p2, int n); +void orc_matrix3_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int n); +void orc_matrix3_100_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int n); +void orc_matrix3_100_offset_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, int n); +void orc_matrix3_000_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, int n); +void orc_pack_123x (guint32 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, int p1, int n); +void orc_pack_x123 (guint32 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, int p1, int n); +void cogorc_combine2_u8 (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int p1, int p2, int n); +void cogorc_combine4_u8 (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, int p1, int p2, int p3, int p4, int n); +void cogorc_unpack_axyz_0 (orc_uint8 * ORC_RESTRICT d1, const orc_uint32 * ORC_RESTRICT s1, int n); +void cogorc_unpack_axyz_1 (orc_uint8 * ORC_RESTRICT d1, const orc_uint32 * ORC_RESTRICT s1, int n); +void cogorc_unpack_axyz_2 (orc_uint8 * ORC_RESTRICT d1, const orc_uint32 * ORC_RESTRICT s1, int n); +void cogorc_unpack_axyz_3 (orc_uint8 * ORC_RESTRICT d1, const orc_uint32 * ORC_RESTRICT s1, int n); +void cogorc_resample_horiz_1tap (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, int p1, int p2, int n); +void cogorc_resample_horiz_2tap (orc_uint8 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, int p1, int p2, int n); +void cogorc_convert_I420_UYVY (orc_uint32 * ORC_RESTRICT d1, orc_uint32 * ORC_RESTRICT d2, const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, int n); +void cogorc_convert_I420_YUY2 (orc_uint32 * ORC_RESTRICT d1, orc_uint32 * ORC_RESTRICT d2, const orc_uint16 * ORC_RESTRICT s1, const orc_uint16 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, int n); +void cogorc_convert_I420_AYUV (orc_uint32 * ORC_RESTRICT d1, orc_uint32 * ORC_RESTRICT d2, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, int n); +void cogorc_convert_YUY2_I420 (orc_uint16 * ORC_RESTRICT d1, orc_uint16 * ORC_RESTRICT d2, orc_uint8 * ORC_RESTRICT d3, orc_uint8 * ORC_RESTRICT d4, const orc_uint32 * ORC_RESTRICT s1, const orc_uint32 * ORC_RESTRICT s2, int n); +void cogorc_convert_UYVY_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_planar_chroma_420_422 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, orc_uint8 * ORC_RESTRICT d2, int d2_stride, const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_planar_chroma_420_444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, orc_uint16 * ORC_RESTRICT d2, int d2_stride, const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_planar_chroma_422_444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, const orc_uint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_planar_chroma_444_422 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, const orc_uint16 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_planar_chroma_444_420 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, const orc_uint16 * ORC_RESTRICT s1, int s1_stride, const orc_uint16 * ORC_RESTRICT s2, int s2_stride, int n, int m); +void cogorc_planar_chroma_422_420 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, const orc_uint8 * ORC_RESTRICT s1, int s1_stride, const orc_uint8 * ORC_RESTRICT s2, int s2_stride, int n, int m); +void cogorc_convert_YUY2_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_UYVY_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_YUY2_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride, orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_UYVY_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride, orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_YUY2_Y444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint16 * ORC_RESTRICT d3, int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_UYVY_Y444 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint16 * ORC_RESTRICT d3, int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_UYVY_I420 (orc_uint16 * ORC_RESTRICT d1, orc_uint16 * ORC_RESTRICT d2, orc_uint8 * ORC_RESTRICT d3, orc_uint8 * ORC_RESTRICT d4, const orc_uint32 * ORC_RESTRICT s1, const orc_uint32 * ORC_RESTRICT s2, int n); +void cogorc_convert_AYUV_I420 (orc_uint16 * ORC_RESTRICT d1, int d1_stride, orc_uint16 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, int d3_stride, orc_uint8 * ORC_RESTRICT d4, int d4_stride, const orc_uint64 * ORC_RESTRICT s1, int s1_stride, const orc_uint64 * ORC_RESTRICT s2, int s2_stride, int n, int m); +void cogorc_convert_AYUV_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_Y42B (orc_uint16 * ORC_RESTRICT d1, int d1_stride, orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, int d3_stride, const orc_uint64 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_Y444 (orc_uint8 * ORC_RESTRICT d1, int d1_stride, orc_uint8 * ORC_RESTRICT d2, int d2_stride, orc_uint8 * ORC_RESTRICT d3, int d3_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_Y42B_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint16 * ORC_RESTRICT s1, int s1_stride, const orc_uint8 * ORC_RESTRICT s2, int s2_stride, const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y42B_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint16 * ORC_RESTRICT s1, int s1_stride, const orc_uint8 * ORC_RESTRICT s2, int s2_stride, const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y42B_AYUV (orc_uint64 * ORC_RESTRICT d1, int d1_stride, const orc_uint16 * ORC_RESTRICT s1, int s1_stride, const orc_uint8 * ORC_RESTRICT s2, int s2_stride, const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y444_YUY2 (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint16 * ORC_RESTRICT s1, int s1_stride, const orc_uint16 * ORC_RESTRICT s2, int s2_stride, const orc_uint16 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y444_UYVY (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint16 * ORC_RESTRICT s1, int s1_stride, const orc_uint16 * ORC_RESTRICT s2, int s2_stride, const orc_uint16 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y444_AYUV (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint8 * ORC_RESTRICT s1, int s1_stride, const orc_uint8 * ORC_RESTRICT s2, int s2_stride, const orc_uint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_AYUV_ARGB (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_BGRA (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_ABGR (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_RGBA (orc_uint32 * ORC_RESTRICT d1, int d1_stride, const orc_uint32 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_I420_BGRA (orc_uint32 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, int n); +void cogorc_convert_I420_BGRA_avg (orc_uint32 * ORC_RESTRICT d1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, const orc_uint8 * ORC_RESTRICT s5, int n); #ifdef __cplusplus } diff --git a/ext/cog/gstcogscale.c b/ext/cog/gstcogscale.c index 570f367d60..52585ac90e 100644 --- a/ext/cog/gstcogscale.c +++ b/ext/cog/gstcogscale.c @@ -296,7 +296,6 @@ static GstCaps * gst_cog_scale_transform_caps (GstBaseTransform * trans, GstPadDirection direction, GstCaps * caps) { - GstCogScale *videoscale; GstCaps *ret; GstStructure *structure; const GValue *par; @@ -304,8 +303,6 @@ gst_cog_scale_transform_caps (GstBaseTransform * trans, /* this function is always called with a simple caps */ g_return_val_if_fail (GST_CAPS_IS_SIMPLE (caps), NULL); - videoscale = GST_COG_SCALE (trans); - structure = gst_caps_get_structure (caps, 0); ret = gst_caps_copy (caps); @@ -371,14 +368,11 @@ static gboolean gst_cog_scale_get_unit_size (GstBaseTransform * trans, GstCaps * caps, guint * size) { - GstCogScale *videoscale; GstVideoFormat format; gint width, height; g_assert (size); - videoscale = GST_COG_SCALE (trans); - if (!gst_video_format_parse_caps (caps, &format, &width, &height)) return FALSE; diff --git a/ext/cog/gstcolorconvert.c b/ext/cog/gstcolorconvert.c index 560ca68c90..1ed6d91a5d 100644 --- a/ext/cog/gstcolorconvert.c +++ b/ext/cog/gstcolorconvert.c @@ -148,11 +148,9 @@ gst_colorconvert_class_init (gpointer g_class, gpointer class_data) { GObjectClass *gobject_class; GstBaseTransformClass *base_transform_class; - GstColorconvertClass *filter_class; gobject_class = G_OBJECT_CLASS (g_class); base_transform_class = GST_BASE_TRANSFORM_CLASS (g_class); - filter_class = GST_COLORCONVERT_CLASS (g_class); gobject_class->set_property = gst_colorconvert_set_property; gobject_class->get_property = gst_colorconvert_get_property; @@ -172,10 +170,7 @@ static void gst_colorconvert_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { - GstColorconvert *src; - g_return_if_fail (GST_IS_COLORCONVERT (object)); - src = GST_COLORCONVERT (object); GST_DEBUG ("gst_colorconvert_set_property"); switch (prop_id) { @@ -188,10 +183,7 @@ static void gst_colorconvert_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { - GstColorconvert *src; - g_return_if_fail (GST_IS_COLORCONVERT (object)); - src = GST_COLORCONVERT (object); switch (prop_id) { default: diff --git a/ext/cog/gstlogoinsert.c b/ext/cog/gstlogoinsert.c index b6572be880..5746528e4c 100644 --- a/ext/cog/gstlogoinsert.c +++ b/ext/cog/gstlogoinsert.c @@ -49,7 +49,8 @@ struct _GstLogoinsert { GstBaseTransform base_transform; - gchar *location; + char *location; + GstBuffer *buffer; GstVideoFormat format; int width; @@ -73,21 +74,24 @@ enum { ARG_0, ARG_LOCATION, + ARG_DATA }; GType gst_logoinsert_get_type (void); -static void gst_logoinsert_base_init (gpointer g_class); -static void gst_logoinsert_class_init (gpointer g_class, gpointer class_data); -static void gst_logoinsert_init (GTypeInstance * instance, gpointer g_class); +GST_DEBUG_CATEGORY_STATIC (gst_logoinsert_debug_category); +#define GST_CAT_DEFAULT gst_logoinsert_debug_category static void gst_logoinsert_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_logoinsert_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); +static void gst_logoinsert_dispose (GObject * object); +static void gst_logoinsert_finalize (GObject * object); -static void gst_logoinsert_set_location (GstLogoinsert * li, - const gchar * location); +static void +gst_logoinsert_set_location (GstLogoinsert * li, const char *location); +static void gst_logoinsert_set_data (GstLogoinsert * li, GstBuffer * buffer); static gboolean gst_logoinsert_set_caps (GstBaseTransform * base_transform, GstCaps * incaps, GstCaps * outcaps); @@ -111,30 +115,14 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420")) ); -GType -gst_logoinsert_get_type (void) -{ - static GType compress_type = 0; +/* class initialization */ - if (!compress_type) { - static const GTypeInfo compress_info = { - sizeof (GstLogoinsertClass), - gst_logoinsert_base_init, - NULL, - gst_logoinsert_class_init, - NULL, - NULL, - sizeof (GstLogoinsert), - 0, - gst_logoinsert_init, - }; - - compress_type = g_type_register_static (GST_TYPE_BASE_TRANSFORM, - "GstLogoinsert", &compress_info, 0); - } - return compress_type; -} +#define DEBUG_INIT(bla) \ + GST_DEBUG_CATEGORY_INIT (gst_logoinsert_debug_category, "logoinsert", 0, \ + "debug category for logoinsert element"); +GST_BOILERPLATE_FULL (GstLogoinsert, gst_logoinsert, GstBaseTransform, + GST_TYPE_BASE_TRANSFORM, DEBUG_INIT); static void gst_logoinsert_base_init (gpointer g_class) @@ -153,30 +141,35 @@ gst_logoinsert_base_init (gpointer g_class) } static void -gst_logoinsert_class_init (gpointer g_class, gpointer class_data) +gst_logoinsert_class_init (GstLogoinsertClass * klass) { GObjectClass *gobject_class; GstBaseTransformClass *base_transform_class; - GstLogoinsertClass *filter_class; - gobject_class = G_OBJECT_CLASS (g_class); - base_transform_class = GST_BASE_TRANSFORM_CLASS (g_class); - filter_class = GST_LOGOINSERT_CLASS (g_class); + gobject_class = G_OBJECT_CLASS (klass); + base_transform_class = GST_BASE_TRANSFORM_CLASS (klass); gobject_class->set_property = gst_logoinsert_set_property; gobject_class->get_property = gst_logoinsert_get_property; + gobject_class->dispose = gst_logoinsert_dispose; + gobject_class->finalize = gst_logoinsert_finalize; g_object_class_install_property (gobject_class, ARG_LOCATION, g_param_spec_string ("location", "location", "location of PNG file to overlay", "", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (gobject_class, ARG_DATA, + gst_param_spec_mini_object ("data", "data", + "Buffer containing PNG file to overlay", GST_TYPE_BUFFER, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); base_transform_class->set_caps = gst_logoinsert_set_caps; base_transform_class->transform_ip = gst_logoinsert_transform_ip; } static void -gst_logoinsert_init (GTypeInstance * instance, gpointer g_class) +gst_logoinsert_init (GstLogoinsert * logoinsert, + GstLogoinsertClass * logoinsert_class) { GST_DEBUG ("gst_logoinsert_init"); @@ -196,6 +189,10 @@ gst_logoinsert_set_property (GObject * object, guint prop_id, case ARG_LOCATION: gst_logoinsert_set_location (src, g_value_get_string (value)); break; + case ARG_DATA: + gst_logoinsert_set_data (src, + (GstBuffer *) gst_value_get_mini_object (value)); + break; default: break; } @@ -214,12 +211,53 @@ gst_logoinsert_get_property (GObject * object, guint prop_id, GValue * value, case ARG_LOCATION: g_value_set_string (value, src->location); break; + case ARG_DATA: + gst_value_set_mini_object (value, (GstMiniObject *) src->buffer); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } +void +gst_logoinsert_dispose (GObject * object) +{ + g_return_if_fail (GST_IS_LOGOINSERT (object)); + + /* clean up as possible. may be called multiple times */ + + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +void +gst_logoinsert_finalize (GObject * object) +{ + GstLogoinsert *logoinsert; + + g_return_if_fail (GST_IS_LOGOINSERT (object)); + logoinsert = GST_LOGOINSERT (object); + + g_free (logoinsert->location); + if (logoinsert->buffer) { + gst_buffer_unref (logoinsert->buffer); + } + if (logoinsert->overlay_frame) { + cog_frame_unref (logoinsert->overlay_frame); + logoinsert->overlay_frame = NULL; + } + if (logoinsert->alpha_frame) { + cog_frame_unref (logoinsert->alpha_frame); + logoinsert->alpha_frame = NULL; + } + if (logoinsert->argb_frame) { + cog_frame_unref (logoinsert->argb_frame); + logoinsert->argb_frame = NULL; + } + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + static gboolean gst_logoinsert_set_caps (GstBaseTransform * base_transform, GstCaps * incaps, GstCaps * outcaps) @@ -243,11 +281,12 @@ gst_logoinsert_transform_ip (GstBaseTransform * base_transform, GstBuffer * buf) g_return_val_if_fail (GST_IS_LOGOINSERT (base_transform), GST_FLOW_ERROR); li = GST_LOGOINSERT (base_transform); - frame = gst_cog_buffer_wrap (buf, li->format, li->width, li->height); - if (li->argb_frame == NULL) return GST_FLOW_OK; + frame = gst_cog_buffer_wrap (gst_buffer_ref (buf), + li->format, li->width, li->height); + if (li->overlay_frame == NULL) { CogFrame *f; @@ -294,41 +333,65 @@ gst_logoinsert_transform_ip (GstBaseTransform * base_transform, GstBuffer * buf) } } + cog_frame_unref (frame); return GST_FLOW_OK; } -static void -gst_logoinsert_set_location (GstLogoinsert * li, const gchar * location) +static GstBuffer * +get_buffer_from_file (const char *filename) { gboolean ret; - GError *error = NULL; + GstBuffer *buffer; + gsize size; + gchar *data; + ret = g_file_get_contents (filename, &data, &size, NULL); + if (!ret) + return NULL; + + buffer = gst_buffer_new (); + GST_BUFFER_DATA (buffer) = (guchar *) data; + GST_BUFFER_MALLOCDATA (buffer) = (guchar *) data; + GST_BUFFER_SIZE (buffer) = size; + + return buffer; +} + +static void +gst_logoinsert_set_location (GstLogoinsert * li, const char *location) +{ g_free (li->location); - g_free (li->data); + li->location = g_strdup (location); + + gst_logoinsert_set_data (li, get_buffer_from_file (li->location)); +} + +static void +gst_logoinsert_set_data (GstLogoinsert * li, GstBuffer * buffer) +{ + if (li->buffer) + gst_buffer_unref (li->buffer); + + /* steals the reference */ + li->buffer = buffer; + if (li->overlay_frame) { cog_frame_unref (li->overlay_frame); li->overlay_frame = NULL; } - - li->location = g_strdup (location); - - ret = g_file_get_contents (li->location, &li->data, &li->size, &error); - if (!ret) { - li->data = NULL; - li->size = 0; - return; - } - - li->argb_frame = cog_frame_new_from_png (li->data, li->size); - if (li->alpha_frame) { cog_frame_unref (li->alpha_frame); li->alpha_frame = NULL; } - if (li->overlay_frame) { - cog_frame_unref (li->overlay_frame); - li->overlay_frame = NULL; + if (li->argb_frame) { + cog_frame_unref (li->argb_frame); + li->argb_frame = NULL; + } + + if (li->buffer) { + li->argb_frame = cog_frame_new_from_png (GST_BUFFER_DATA (li->buffer), + GST_BUFFER_SIZE (li->buffer)); } } @@ -360,7 +423,6 @@ cog_frame_new_from_png (void *data, int size) png_bytep *rows; CogFrame *frame; guchar *frame_data; - int rowbytes; int j; int width, height; int color_type; @@ -390,8 +452,8 @@ cog_frame_new_from_png (void *data, int size) frame_data = g_malloc (width * height * 4); frame = cog_frame_new_from_data_ARGB (frame_data, width, height); + frame->regions[0] = frame_data; - rowbytes = png_get_rowbytes (png_ptr, info_ptr); rows = (png_bytep *) g_malloc (sizeof (png_bytep) * height); for (j = 0; j < height; j++) { diff --git a/ext/dc1394/Makefile.am b/ext/dc1394/Makefile.am index 8f823523ff..6b09532774 100644 --- a/ext/dc1394/Makefile.am +++ b/ext/dc1394/Makefile.am @@ -1,4 +1,3 @@ -plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@ plugin_LTLIBRARIES = libgstdc1394.la diff --git a/ext/dc1394/gstdc1394.c b/ext/dc1394/gstdc1394.c index 94fcffb1eb..09c4fd1f9c 100644 --- a/ext/dc1394/gstdc1394.c +++ b/ext/dc1394/gstdc1394.c @@ -98,6 +98,7 @@ static void gst_dc1394_framerate_const_to_frac (gint framerateconst, GValue * framefrac); static gboolean gst_dc1394_change_camera_transmission (GstDc1394 * src, gboolean on); +static gboolean gst_dc1394_query (GstBaseSrc * bsrc, GstQuery * query); static void gst_dc1394_base_init (gpointer g_class) @@ -157,12 +158,12 @@ gst_dc1394_class_init (GstDc1394Class * klass) gstbasesrc_class->get_caps = gst_dc1394_getcaps; gstbasesrc_class->set_caps = gst_dc1394_setcaps; + gstbasesrc_class->query = gst_dc1394_query; gstbasesrc_class->get_times = gst_dc1394_get_times; gstpushsrc_class->create = gst_dc1394_create; gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_dc1394_change_state); - } static void @@ -182,7 +183,6 @@ gst_dc1394_init (GstDc1394 * src, GstDc1394Class * g_class) gst_dc1394_src_fixate); gst_base_src_set_live (GST_BASE_SRC (src), TRUE); - } static void @@ -205,6 +205,59 @@ gst_dc1394_src_fixate (GstPad * pad, GstCaps * caps) gst_object_unref (GST_OBJECT (src)); } +static gboolean +gst_dc1394_query (GstBaseSrc * bsrc, GstQuery * query) +{ + gboolean res = TRUE; + GstDc1394 *src = GST_DC1394 (bsrc); + + switch (GST_QUERY_TYPE (query)) { + case GST_QUERY_LATENCY: + { + GstClockTime min_latency, max_latency; + + if (!src->camera) { + GST_WARNING_OBJECT (src, + "Can't give latency since device isn't open !"); + res = FALSE; + goto done; + } + + if (src->rate_denominator <= 0 || src->rate_numerator <= 0) { + GST_WARNING_OBJECT (bsrc, + "Can't give latency since framerate isn't fixated !"); + res = FALSE; + goto done; + } + + /* min latency is the time to capture one frame */ + min_latency = gst_util_uint64_scale (GST_SECOND, + src->rate_denominator, src->rate_numerator); + + /* max latency is total duration of the frame buffer */ + max_latency = gst_util_uint64_scale (src->bufsize, + GST_SECOND * src->rate_denominator, src->rate_numerator); + + GST_DEBUG_OBJECT (bsrc, + "report latency min %" GST_TIME_FORMAT " max %" GST_TIME_FORMAT, + GST_TIME_ARGS (min_latency), GST_TIME_ARGS (max_latency)); + + /* we are always live, the min latency is 1 frame and the max latency is + * the complete buffer of frames. */ + gst_query_set_latency (query, TRUE, min_latency, max_latency); + + res = TRUE; + break; + } + default: + res = GST_BASE_SRC_CLASS (parent_class)->query (bsrc, query); + break; + } + +done: + return res; +} + static void gst_dc1394_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) @@ -280,11 +333,9 @@ gst_dc1394_getcaps (GstBaseSrc * bsrc) return gst_caps_copy (gsrc->caps); } - static gboolean gst_dc1394_setcaps (GstBaseSrc * bsrc, GstCaps * caps) { - gboolean res = TRUE; GstDc1394 *dc1394; gint width, height, rate_denominator, rate_numerator; diff --git a/ext/dirac/gstdiracenc.cc b/ext/dirac/gstdiracenc.cc index 6e3129aa04..1c499d71f8 100644 --- a/ext/dirac/gstdiracenc.cc +++ b/ext/dirac/gstdiracenc.cc @@ -150,7 +150,7 @@ static gboolean gst_dirac_enc_set_format (GstBaseVideoEncoder * static gboolean gst_dirac_enc_start (GstBaseVideoEncoder * base_video_encoder); static gboolean gst_dirac_enc_stop (GstBaseVideoEncoder * base_video_encoder); static gboolean gst_dirac_enc_finish (GstBaseVideoEncoder * base_video_encoder); -static gboolean gst_dirac_enc_handle_frame (GstBaseVideoEncoder * +static GstFlowReturn gst_dirac_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder, GstVideoFrame * frame); static GstFlowReturn gst_dirac_enc_shape_output (GstBaseVideoEncoder * base_video_encoder, GstVideoFrame * frame); @@ -421,6 +421,10 @@ gst_dirac_enc_set_format (GstBaseVideoEncoder * base_video_encoder, dirac_enc->enc_ctx.decode_flag = 0; dirac_enc->enc_ctx.instr_flag = 0; + dirac_enc->granule_offset = ~0; + + dirac_enc->encoder = dirac_encoder_init (&dirac_enc->enc_ctx, FALSE); + return TRUE; } @@ -821,12 +825,6 @@ error: static gboolean gst_dirac_enc_start (GstBaseVideoEncoder * base_video_encoder) { - GstDiracEnc *dirac_enc = GST_DIRAC_ENC (base_video_encoder); - - dirac_enc->granule_offset = ~0; - - dirac_enc->encoder = dirac_encoder_init (&dirac_enc->enc_ctx, FALSE); - return TRUE; } @@ -857,12 +855,12 @@ gst_dirac_enc_finish (GstBaseVideoEncoder * base_video_encoder) return TRUE; } -static gboolean +static GstFlowReturn gst_dirac_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder, GstVideoFrame * frame) { GstDiracEnc *dirac_enc = GST_DIRAC_ENC (base_video_encoder); - gboolean ret; + GstFlowReturn ret; int r; const GstVideoState *state; uint8_t *data; @@ -965,7 +963,7 @@ gst_dirac_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder, } if (r != (int) GST_BUFFER_SIZE (frame->sink_buffer)) { GST_ERROR ("failed to push picture"); - return FALSE; + return GST_FLOW_ERROR; } GST_DEBUG ("handle frame"); @@ -978,7 +976,7 @@ gst_dirac_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder, ret = gst_dirac_enc_process (dirac_enc, FALSE); - return (ret == GST_FLOW_OK); + return ret; } #if 0 @@ -1266,7 +1264,8 @@ gst_dirac_enc_shape_output_ogg (GstBaseVideoEncoder * base_video_encoder, GST_BUFFER_OFFSET_END (buf) = dirac_enc->last_granulepos; } - gst_buffer_set_caps (buf, GST_BASE_VIDEO_CODEC(base_video_encoder)->caps); + gst_buffer_set_caps (buf, + GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder))); return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), buf); } @@ -1297,7 +1296,8 @@ gst_dirac_enc_shape_output_quicktime (GstBaseVideoEncoder * base_video_encoder, GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); } - gst_buffer_set_caps (buf, GST_BASE_VIDEO_CODEC(base_video_encoder)->caps); + gst_buffer_set_caps (buf, + GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder))); return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), buf); } @@ -1333,7 +1333,8 @@ gst_dirac_enc_shape_output_mp4 (GstBaseVideoEncoder * base_video_encoder, GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); } - gst_buffer_set_caps (buf, GST_BASE_VIDEO_CODEC(base_video_encoder)->caps); + gst_buffer_set_caps (buf, + GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder))); return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), buf); } diff --git a/ext/directfb/Makefile.am b/ext/directfb/Makefile.am index de93f5cf63..05e79ac15b 100644 --- a/ext/directfb/Makefile.am +++ b/ext/directfb/Makefile.am @@ -1,4 +1,3 @@ -plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@ plugin_LTLIBRARIES = libgstdfbvideosink.la diff --git a/ext/directfb/dfbvideosink.c b/ext/directfb/dfbvideosink.c index 3c4e2ad0e0..a6db910735 100644 --- a/ext/directfb/dfbvideosink.c +++ b/ext/directfb/dfbvideosink.c @@ -1042,7 +1042,7 @@ beach: static gboolean gst_dfbvideosink_can_blit_from_format (GstDfbVideoSink * dfbvideosink, - DFBSurfacePixelFormat format) + DFBSurfacePixelFormat format, gboolean accelerated) { gboolean res = FALSE; DFBResult ret; @@ -1102,14 +1102,14 @@ gst_dfbvideosink_can_blit_from_format (GstDfbVideoSink * dfbvideosink, } /* Blitting from this format to our primary is accelerated */ - if (mask & DFXL_BLIT) { + if ((mask & DFXL_BLIT) && accelerated) { GST_DEBUG_OBJECT (dfbvideosink, "blitting from format %s to our primary " "is accelerated", gst_dfbvideosink_get_format_name (format)); res = TRUE; - } else { + } else if (!accelerated) { GST_DEBUG_OBJECT (dfbvideosink, "blitting from format %s to our primary " "is not accelerated", gst_dfbvideosink_get_format_name (format)); - res = FALSE; + res = TRUE; } /* Restore original layer configuration */ @@ -1209,41 +1209,52 @@ gst_dfbvideosink_getcaps (GstBaseSink * bsink) caps = gst_dfbvideosink_get_caps_from_format (dfbvideosink->pixel_format); } else { /* Try some formats */ + gboolean accelerated = TRUE; caps = gst_caps_new_empty (); - if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_RGB16)) { - gst_caps_append (caps, - gst_dfbvideosink_get_caps_from_format (DSPF_RGB16)); - } - if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_RGB24)) { - gst_caps_append (caps, - gst_dfbvideosink_get_caps_from_format (DSPF_RGB24)); - } - /* There's something wrong with RGB32, ffmpegcolorspace ? - if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_RGB32)) { - gst_caps_append (caps, - gst_dfbvideosink_get_caps_from_format (DSPF_RGB32)); - } */ - if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_ARGB)) { - gst_caps_append (caps, - gst_dfbvideosink_get_caps_from_format (DSPF_ARGB)); - } - if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_YUY2)) { - gst_caps_append (caps, - gst_dfbvideosink_get_caps_from_format (DSPF_YUY2)); - } - if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_UYVY)) { - gst_caps_append (caps, - gst_dfbvideosink_get_caps_from_format (DSPF_UYVY)); - } - if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_I420)) { - gst_caps_append (caps, - gst_dfbvideosink_get_caps_from_format (DSPF_I420)); - } - if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_YV12)) { - gst_caps_append (caps, - gst_dfbvideosink_get_caps_from_format (DSPF_YV12)); - } + do { + if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_RGB16, + accelerated)) { + gst_caps_append (caps, + gst_dfbvideosink_get_caps_from_format (DSPF_RGB16)); + } + if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_RGB24, + accelerated)) { + gst_caps_append (caps, + gst_dfbvideosink_get_caps_from_format (DSPF_RGB24)); + } + if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_RGB32, + accelerated)) { + gst_caps_append (caps, + gst_dfbvideosink_get_caps_from_format (DSPF_RGB32)); + } + if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_ARGB, + accelerated)) { + gst_caps_append (caps, + gst_dfbvideosink_get_caps_from_format (DSPF_ARGB)); + } + if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_YUY2, + accelerated)) { + gst_caps_append (caps, + gst_dfbvideosink_get_caps_from_format (DSPF_YUY2)); + } + if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_UYVY, + accelerated)) { + gst_caps_append (caps, + gst_dfbvideosink_get_caps_from_format (DSPF_UYVY)); + } + if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_I420, + accelerated)) { + gst_caps_append (caps, + gst_dfbvideosink_get_caps_from_format (DSPF_I420)); + } + if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_YV12, + accelerated)) { + gst_caps_append (caps, + gst_dfbvideosink_get_caps_from_format (DSPF_YV12)); + } + accelerated = !accelerated; + } while (accelerated == FALSE); } } diff --git a/ext/dts/gstdtsdec.c b/ext/dts/gstdtsdec.c index f1a218172f..2039c58ba9 100644 --- a/ext/dts/gstdtsdec.c +++ b/ext/dts/gstdtsdec.c @@ -535,8 +535,13 @@ gst_dtsdec_update_streaminfo (GstDtsDec * dts) taglist = gst_tag_list_new (); gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, - GST_TAG_AUDIO_CODEC, "DTS DCA", - GST_TAG_BITRATE, (guint) dts->bit_rate, NULL); + GST_TAG_AUDIO_CODEC, "DTS DCA", NULL); + + if (dts->bit_rate > 3) { + /* 1 => open bitrate, 2 => variable bitrate, 3 => lossless */ + gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, GST_TAG_BITRATE, + (guint) dts->bit_rate, NULL); + } gst_element_found_tags_for_pad (GST_ELEMENT (dts), dts->srcpad, taglist); } diff --git a/ext/faac/Makefile.am b/ext/faac/Makefile.am index b4ec10a3fe..13918ed3ea 100644 --- a/ext/faac/Makefile.am +++ b/ext/faac/Makefile.am @@ -1,10 +1,11 @@ plugin_LTLIBRARIES = libgstfaac.la libgstfaac_la_SOURCES = gstfaac.c -libgstfaac_la_CFLAGS = $(FAAC_CFLAGS) $(GST_CFLAGS) $(GST_BASE_CFLAGS) \ - $(GST_PLUGINS_BASE_CFLAGS) -libgstfaac_la_LIBADD = $(FAAC_LIBS) $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) \ - -lgstaudio-@GST_MAJORMINOR@ +libgstfaac_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) \ + $(GST_CFLAGS) $(FAAC_CFLAGS) +libgstfaac_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \ + -lgstaudio-@GST_MAJORMINOR@ -lgstpbutils-@GST_MAJORMINOR@ \ + $(GST_BASE_LIBS) $(FAAC_LIBS) libgstfaac_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstfaac_la_LIBTOOLFLAGS = --tag=disable-static diff --git a/ext/faac/gstfaac.c b/ext/faac/gstfaac.c index f3086036fe..978e6ccd22 100644 --- a/ext/faac/gstfaac.c +++ b/ext/faac/gstfaac.c @@ -24,16 +24,6 @@ * * faac encodes raw audio to AAC (MPEG-4 part 3) streams. * - * The #GstFaac:outputformat property determines whether or not the - * AAC data needs additional framing provided by a container - * (such as Matroska or Quicktime). - * This is required for raw data, whereas ADTS formatted AAC already provides - * framing and needs no container. - * - * The #GstFaac:profile property determines the AAC profile, where the default - * LC (Low Complexity) profile is most widely used, supported and suitable for - * general use. The other profiles are very rarely used and often not supported. - * * * Example launch line * |[ @@ -49,16 +39,29 @@ #include #include +#include #include "gstfaac.h" +#define SAMPLE_RATES " 8000, " \ + "11025, " \ + "12000, " \ + "16000, " \ + "22050, " \ + "24000, " \ + "32000, " \ + "44100, " \ + "48000, " \ + "64000, " \ + "88200, " \ + "96000" #define SINK_CAPS \ "audio/x-raw-int, " \ "endianness = (int) BYTE_ORDER, " \ "signed = (boolean) true, " \ "width = (int) 16, " \ "depth = (int) 16, " \ - "rate = (int) [ 8000, 96000 ], " \ + "rate = (int) {" SAMPLE_RATES "}, " \ "channels = (int) [ 1, 6 ] " /* these don't seem to work? */ @@ -77,10 +80,17 @@ #endif #define SRC_CAPS \ "audio/mpeg, " \ - "mpegversion = (int) { 4, 2 }, " \ + "mpegversion = (int) 4, " \ "channels = (int) [ 1, 6 ], " \ - "rate = (int) [ 8000, 96000 ], " \ - "stream-format = (string) { adts, raw } " + "rate = (int) {" SAMPLE_RATES "}, " \ + "stream-format = (string) { adts, raw }, " \ + "base-profile = (string) { main, lc, ssr, ltp }; " \ + "audio/mpeg, " \ + "mpegversion = (int) 2, " \ + "channels = (int) [ 1, 6 ], " \ + "rate = (int) {" SAMPLE_RATES "}, " \ + "stream-format = (string) { adts, raw }, " \ + "profile = (string) { main, lc }" static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, @@ -93,13 +103,12 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", enum { - ARG_0, - ARG_OUTPUTFORMAT, - ARG_BITRATE, - ARG_PROFILE, - ARG_TNS, - ARG_MIDSIDE, - ARG_SHORTCTL + PROP_0, + PROP_BITRATE, + PROP_PROFILE, + PROP_TNS, + PROP_MIDSIDE, + PROP_SHORTCTL }; static void gst_faac_base_init (GstFaacClass * klass); @@ -127,10 +136,8 @@ static GstElementClass *parent_class = NULL; GST_DEBUG_CATEGORY_STATIC (faac_debug); #define GST_CAT_DEFAULT faac_debug -#define FAAC_DEFAULT_MPEGVERSION 4 #define FAAC_DEFAULT_OUTPUTFORMAT 0 /* RAW */ #define FAAC_DEFAULT_BITRATE 128 * 1000 -#define FAAC_DEFAULT_PROFILE LOW #define FAAC_DEFAULT_TNS FALSE #define FAAC_DEFAULT_MIDSIDE TRUE #define FAAC_DEFAULT_SHORTCTL SHORTCTL_NORMAL @@ -186,28 +193,6 @@ gst_faac_base_init (GstFaacClass * klass) GST_DEBUG_CATEGORY_INIT (faac_debug, "faac", 0, "AAC encoding"); } -#define GST_TYPE_FAAC_PROFILE (gst_faac_profile_get_type ()) -static GType -gst_faac_profile_get_type (void) -{ - static GType gst_faac_profile_type = 0; - - if (!gst_faac_profile_type) { - static GEnumValue gst_faac_profile[] = { - {MAIN, "MAIN", "Main profile"}, - {LOW, "LC", "Low complexity profile"}, - {SSR, "SSR", "Scalable sampling rate profile"}, - {LTP, "LTP", "Long term prediction profile"}, - {0, NULL, NULL}, - }; - - gst_faac_profile_type = g_enum_register_static ("GstFaacProfile", - gst_faac_profile); - } - - return gst_faac_profile_type; -} - #define GST_TYPE_FAAC_SHORTCTL (gst_faac_shortctl_get_type ()) static GType gst_faac_shortctl_get_type (void) @@ -229,26 +214,6 @@ gst_faac_shortctl_get_type (void) return gst_faac_shortctl_type; } -#define GST_TYPE_FAAC_OUTPUTFORMAT (gst_faac_outputformat_get_type ()) -static GType -gst_faac_outputformat_get_type (void) -{ - static GType gst_faac_outputformat_type = 0; - - if (!gst_faac_outputformat_type) { - static GEnumValue gst_faac_outputformat[] = { - {0, "OUTPUTFORMAT_RAW", "Raw AAC"}, - {1, "OUTPUTFORMAT_ADTS", "ADTS headers"}, - {0, NULL, NULL}, - }; - - gst_faac_outputformat_type = g_enum_register_static ("GstFaacOutputFormat", - gst_faac_outputformat); - } - - return gst_faac_outputformat_type; -} - static void gst_faac_class_init (GstFaacClass * klass) { @@ -262,30 +227,21 @@ gst_faac_class_init (GstFaacClass * klass) gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_faac_finalize); /* properties */ - g_object_class_install_property (gobject_class, ARG_BITRATE, + g_object_class_install_property (gobject_class, PROP_BITRATE, g_param_spec_int ("bitrate", "Bitrate (bps)", "Bitrate in bits/sec", 8 * 1000, 320 * 1000, FAAC_DEFAULT_BITRATE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, ARG_PROFILE, - g_param_spec_enum ("profile", "Profile", "MPEG/AAC encoding profile", - GST_TYPE_FAAC_PROFILE, FAAC_DEFAULT_PROFILE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, ARG_TNS, + g_object_class_install_property (gobject_class, PROP_TNS, g_param_spec_boolean ("tns", "TNS", "Use temporal noise shaping", FAAC_DEFAULT_TNS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, ARG_MIDSIDE, + g_object_class_install_property (gobject_class, PROP_MIDSIDE, g_param_spec_boolean ("midside", "Midside", "Allow mid/side encoding", FAAC_DEFAULT_MIDSIDE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, ARG_SHORTCTL, + g_object_class_install_property (gobject_class, PROP_SHORTCTL, g_param_spec_enum ("shortctl", "Block type", "Block type encorcing", GST_TYPE_FAAC_SHORTCTL, FAAC_DEFAULT_SHORTCTL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, ARG_OUTPUTFORMAT, - g_param_spec_enum ("outputformat", "Output format", - "Format of output frames", - GST_TYPE_FAAC_OUTPUTFORMAT, FAAC_DEFAULT_OUTPUTFORMAT, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /* virtual functions */ gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_faac_change_state); @@ -311,9 +267,11 @@ gst_faac_init (GstFaac * faac) faac->adapter = gst_adapter_new (); + faac->profile = LOW; + faac->mpegversion = 4; + /* default properties */ faac->bitrate = FAAC_DEFAULT_BITRATE; - faac->profile = FAAC_DEFAULT_PROFILE; faac->shortctl = FAAC_DEFAULT_SHORTCTL; faac->outputformat = FAAC_DEFAULT_OUTPUTFORMAT; faac->tns = FAAC_DEFAULT_TNS; @@ -390,12 +348,26 @@ gst_faac_sink_getcaps (GstPad * pad) GstCaps *tmp = gst_caps_new_empty (); GstStructure *s, *t; gint i, c; + static const int rates[] = { + 8000, 11025, 12000, 16000, 22050, 24000, + 32000, 44100, 48000, 64000, 88200, 96000 + }; + GValue rates_arr = { 0, }; + GValue tmp_v = { 0, }; + + g_value_init (&rates_arr, GST_TYPE_LIST); + g_value_init (&tmp_v, G_TYPE_INT); + for (i = 0; i < G_N_ELEMENTS (rates); i++) { + g_value_set_int (&tmp_v, rates[i]); + gst_value_list_append_value (&rates_arr, &tmp_v); + } + g_value_unset (&tmp_v); s = gst_structure_new ("audio/x-raw-int", "endianness", G_TYPE_INT, G_BYTE_ORDER, "signed", G_TYPE_BOOLEAN, TRUE, - "width", G_TYPE_INT, 16, - "depth", G_TYPE_INT, 16, "rate", GST_TYPE_INT_RANGE, 8000, 96000, NULL); + "width", G_TYPE_INT, 16, "depth", G_TYPE_INT, 16, NULL); + gst_structure_set_value (s, "rate", &rates_arr); for (i = 1; i <= 6; i++) { GValue chanpos = { 0 }; @@ -419,6 +391,7 @@ gst_faac_sink_getcaps (GstPad * pad) gst_caps_append_structure (tmp, t); } gst_structure_free (s); + g_value_unset (&rates_arr); GST_DEBUG_OBJECT (pad, "Generated sinkcaps: %" GST_PTR_FORMAT, tmp); @@ -428,6 +401,59 @@ gst_faac_sink_getcaps (GstPad * pad) return gst_caps_ref ((GstCaps *) sinkcaps); } +/* check downstream caps to configure format */ +static void +gst_faac_negotiate (GstFaac * faac) +{ + GstCaps *caps; + + caps = gst_pad_get_allowed_caps (faac->srcpad); + + GST_DEBUG_OBJECT (faac, "allowed caps: %" GST_PTR_FORMAT, caps); + + if (caps && gst_caps_get_size (caps) > 0) { + GstStructure *s = gst_caps_get_structure (caps, 0); + const gchar *str = NULL; + gint i = 4; + + if ((str = gst_structure_get_string (s, "stream-format"))) { + if (strcmp (str, "adts") == 0) { + GST_DEBUG_OBJECT (faac, "use ADTS format for output"); + faac->outputformat = 1; + } else if (strcmp (str, "raw") == 0) { + GST_DEBUG_OBJECT (faac, "use RAW format for output"); + faac->outputformat = 0; + } else { + GST_DEBUG_OBJECT (faac, "unknown stream-format: %s", str); + faac->outputformat = 0; + } + } + + if ((str = gst_structure_get_string (s, "profile"))) { + if (strcmp (str, "main") == 0) { + faac->profile = MAIN; + } else if (strcmp (str, "lc") == 0) { + faac->profile = LOW; + } else if (strcmp (str, "ssr") == 0) { + faac->profile = SSR; + } else if (strcmp (str, "ltp") == 0) { + faac->profile = LTP; + } else { + faac->profile = LOW; + } + } + + if (!gst_structure_get_int (s, "mpegversion", &i) || i == 4) { + faac->mpegversion = 4; + } else { + faac->mpegversion = 2; + } + } + + if (caps) + gst_caps_unref (caps); +} + static gboolean gst_faac_sink_setcaps (GstPad * pad, GstCaps * caps) { @@ -494,6 +520,8 @@ gst_faac_sink_setcaps (GstPad * pad, GstCaps * caps) faac->channels = channels; faac->samplerate = samplerate; + gst_faac_negotiate (faac); + /* finish up */ result = gst_faac_configure_source_pad (faac); @@ -517,39 +545,14 @@ refuse_caps: static gboolean gst_faac_configure_source_pad (GstFaac * faac) { - GstCaps *allowed_caps; GstCaps *srccaps; gboolean ret = FALSE; - gint n, ver, mpegversion = 2; faacEncConfiguration *conf; guint maxbitrate; - mpegversion = FAAC_DEFAULT_MPEGVERSION; - - allowed_caps = gst_pad_get_allowed_caps (faac->srcpad); - GST_DEBUG_OBJECT (faac, "allowed caps: %" GST_PTR_FORMAT, allowed_caps); - - if (allowed_caps) { - if (gst_caps_is_empty (allowed_caps)) - goto empty_caps; - - if (!gst_caps_is_any (allowed_caps)) { - for (n = 0; n < gst_caps_get_size (allowed_caps); n++) { - GstStructure *s = gst_caps_get_structure (allowed_caps, n); - - if (gst_structure_get_int (s, "mpegversion", &ver) && - (ver == 4 || ver == 2)) { - mpegversion = ver; - break; - } - } - } - gst_caps_unref (allowed_caps); - } - /* we negotiated caps update current configuration */ conf = faacEncGetCurrentConfiguration (faac->handle); - conf->mpegVersion = (mpegversion == 4) ? MPEG4 : MPEG2; + conf->mpegVersion = (faac->mpegversion == 4) ? MPEG4 : MPEG2; conf->aacObjectType = faac->profile; conf->allowMidside = faac->midside; conf->useLfe = 0; @@ -587,14 +590,14 @@ gst_faac_configure_source_pad (GstFaac * faac) /* now create a caps for it all */ srccaps = gst_caps_new_simple ("audio/mpeg", - "mpegversion", G_TYPE_INT, mpegversion, + "mpegversion", G_TYPE_INT, faac->mpegversion, "channels", G_TYPE_INT, faac->channels, "rate", G_TYPE_INT, faac->samplerate, "stream-format", G_TYPE_STRING, (faac->outputformat ? "adts" : "raw"), NULL); - if (!faac->outputformat) { - GstBuffer *codec_data; + /* DecoderSpecificInfo is only available for mpegversion=4 */ + if (faac->mpegversion == 4) { guint8 *config = NULL; gulong config_len = 0; @@ -602,16 +605,49 @@ gst_faac_configure_source_pad (GstFaac * faac) GST_DEBUG_OBJECT (faac, "retrieving decoder info"); faacEncGetDecoderSpecificInfo (faac->handle, &config, &config_len); - /* copy it into a buffer */ - codec_data = gst_buffer_new_and_alloc (config_len); - memcpy (GST_BUFFER_DATA (codec_data), config, config_len); + if (!gst_codec_utils_aac_caps_set_level_and_profile (srccaps, config, + config_len)) { + free (config); + gst_caps_unref (srccaps); + goto invalid_codec_data; + } + + if (!faac->outputformat) { + GstBuffer *codec_data; + + /* copy it into a buffer */ + codec_data = gst_buffer_new_and_alloc (config_len); + memcpy (GST_BUFFER_DATA (codec_data), config, config_len); + + /* add to caps */ + gst_caps_set_simple (srccaps, + "codec_data", GST_TYPE_BUFFER, codec_data, NULL); + + gst_buffer_unref (codec_data); + } + free (config); + } else { + const gchar *profile; - /* add to caps */ - gst_caps_set_simple (srccaps, - "codec_data", GST_TYPE_BUFFER, codec_data, NULL); - - gst_buffer_unref (codec_data); + /* Add least add the profile to the caps */ + switch (faac->profile) { + case MAIN: + profile = "main"; + break; + case LTP: + profile = "ltp"; + break; + case SSR: + profile = "ssr"; + break; + case LOW: + default: + profile = "lc"; + break; + } + gst_caps_set_simple (srccaps, "profile", G_TYPE_STRING, profile, NULL); + /* FIXME: How to get the profile for mpegversion==2? */ } GST_DEBUG_OBJECT (faac, "src pad caps: %" GST_PTR_FORMAT, srccaps); @@ -622,16 +658,16 @@ gst_faac_configure_source_pad (GstFaac * faac) return ret; /* ERROR */ -empty_caps: - { - gst_caps_unref (allowed_caps); - return FALSE; - } set_failed: { GST_WARNING_OBJECT (faac, "Faac doesn't support the current configuration"); return FALSE; } +invalid_codec_data: + { + GST_ERROR_OBJECT (faac, "Invalid codec data"); + return FALSE; + } } static GstFlowReturn @@ -843,24 +879,18 @@ gst_faac_set_property (GObject * object, GST_OBJECT_LOCK (faac); switch (prop_id) { - case ARG_BITRATE: + case PROP_BITRATE: faac->bitrate = g_value_get_int (value); break; - case ARG_PROFILE: - faac->profile = g_value_get_enum (value); - break; - case ARG_TNS: + case PROP_TNS: faac->tns = g_value_get_boolean (value); break; - case ARG_MIDSIDE: + case PROP_MIDSIDE: faac->midside = g_value_get_boolean (value); break; - case ARG_SHORTCTL: + case PROP_SHORTCTL: faac->shortctl = g_value_get_enum (value); break; - case ARG_OUTPUTFORMAT: - faac->outputformat = g_value_get_enum (value); - break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -878,24 +908,18 @@ gst_faac_get_property (GObject * object, GST_OBJECT_LOCK (faac); switch (prop_id) { - case ARG_BITRATE: + case PROP_BITRATE: g_value_set_int (value, faac->bitrate); break; - case ARG_PROFILE: - g_value_set_enum (value, faac->profile); - break; - case ARG_TNS: + case PROP_TNS: g_value_set_boolean (value, faac->tns); break; - case ARG_MIDSIDE: + case PROP_MIDSIDE: g_value_set_boolean (value, faac->midside); break; - case ARG_SHORTCTL: + case PROP_SHORTCTL: g_value_set_enum (value, faac->shortctl); break; - case ARG_OUTPUTFORMAT: - g_value_set_enum (value, faac->outputformat); - break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; diff --git a/ext/faac/gstfaac.h b/ext/faac/gstfaac.h index 7a282ec508..49e2b85e86 100644 --- a/ext/faac/gstfaac.h +++ b/ext/faac/gstfaac.h @@ -54,6 +54,7 @@ struct _GstFaac { bps, bitrate, profile, + mpegversion, shortctl, outputformat; gboolean tns, diff --git a/ext/faad/Makefile.am b/ext/faad/Makefile.am index 5e2b653f84..957ad78496 100644 --- a/ext/faad/Makefile.am +++ b/ext/faad/Makefile.am @@ -9,3 +9,18 @@ libgstfaad_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstfaad_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstfaad.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstfaad -:SHARED libgstfaad \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstfaad_la_SOURCES) \ + -:CPPFLAGS $(CPPFLAGS) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstfaad_la_CFLAGS) \ + -:LDFLAGS $(libgstfaad_la_LDFLAGS) \ + $(libgstfaad_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/ext/gme/gstgme.c b/ext/gme/gstgme.c index 58df54cb1a..ae49c64088 100644 --- a/ext/gme/gstgme.c +++ b/ext/gme/gstgme.c @@ -406,7 +406,7 @@ gst_gme_play (GstPad * pad) } } - if (gme_track_ended (gme->player)) { + if (gme_tell (gme->player) * GST_MSECOND > gme->total_duration) { gst_pad_pause_task (pad); gst_pad_push_event (pad, gst_event_new_eos ()); } @@ -423,6 +423,7 @@ gme_setup (GstGmeDec * gme) gme_err_t gme_err = NULL; GstTagList *taglist; guint64 total_duration; + guint64 fade_time; GstBuffer *buffer; if (!gst_adapter_available (gme->adapter) || !gme_negotiate (gme)) { @@ -480,7 +481,9 @@ gme_setup (GstGmeDec * gme) info->system, NULL); gme->total_duration = total_duration = - gst_util_uint64_scale_int (info->play_length, GST_MSECOND, 1); + gst_util_uint64_scale_int (info->play_length + (info->loop_length > + 0 ? 8000 : 0), GST_MSECOND, 1); + fade_time = info->loop_length > 0 ? info->play_length : 0; gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, GST_TAG_DURATION, total_duration, NULL); @@ -494,6 +497,8 @@ gme_setup (GstGmeDec * gme) gme_enable_accuracy (gme->player, 1); #endif gme_start_track (gme->player, 0); + if (fade_time) + gme_set_fade (gme->player, fade_time); gst_pad_push_event (gme->srcpad, gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, -1, 0)); diff --git a/ext/gsm/gstgsmdec.c b/ext/gsm/gstgsmdec.c index facea23ceb..3318bdc778 100644 --- a/ext/gsm/gstgsmdec.c +++ b/ext/gsm/gstgsmdec.c @@ -119,10 +119,8 @@ static void gst_gsmdec_class_init (GstGSMDec * klass) { GObjectClass *gobject_class; - GstElementClass *gstelement_class; gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; parent_class = g_type_class_peek_parent (klass); diff --git a/ext/gsm/gstgsmenc.c b/ext/gsm/gstgsmenc.c index 828334032c..434c4b1faf 100644 --- a/ext/gsm/gstgsmenc.c +++ b/ext/gsm/gstgsmenc.c @@ -113,10 +113,8 @@ static void gst_gsmenc_class_init (GstGSMEnc * klass) { GObjectClass *gobject_class; - GstElementClass *gstelement_class; gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; parent_class = g_type_class_peek_parent (klass); diff --git a/ext/jp2k/gstjasperenc.c b/ext/jp2k/gstjasperenc.c index 27073e22a8..90fca51598 100644 --- a/ext/jp2k/gstjasperenc.c +++ b/ext/jp2k/gstjasperenc.c @@ -299,8 +299,6 @@ static gboolean gst_jasper_enc_sink_setcaps (GstPad * pad, GstCaps * caps) { GstJasperEnc *enc; - GstStructure *s; - const gchar *mimetype; GstVideoFormat format; gint width, height; gint fps_num, fps_den; @@ -308,8 +306,6 @@ gst_jasper_enc_sink_setcaps (GstPad * pad, GstCaps * caps) gint i; enc = GST_JASPER_ENC (GST_PAD_PARENT (pad)); - s = gst_caps_get_structure (caps, 0); - mimetype = gst_structure_get_name (s); /* get info from caps */ if (!gst_video_format_parse_caps (caps, &format, &width, &height)) diff --git a/ext/lv2/gstlv2.c b/ext/lv2/gstlv2.c index caa82b7f01..dd1df3df10 100644 --- a/ext/lv2/gstlv2.c +++ b/ext/lv2/gstlv2.c @@ -382,9 +382,38 @@ static gchar * gst_lv2_class_get_param_name (GstLV2Class * klass, SLV2Port port) { SLV2Plugin lv2plugin = klass->plugin; + gchar *ret; - return g_strdup (slv2_value_as_string (slv2_port_get_symbol (lv2plugin, + ret = g_strdup (slv2_value_as_string (slv2_port_get_symbol (lv2plugin, port))); + + /* this is the same thing that param_spec_* will do */ + g_strcanon (ret, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-", '-'); + /* satisfy glib2 (argname[0] must be [A-Za-z]) */ + if (!((ret[0] >= 'a' && ret[0] <= 'z') || (ret[0] >= 'A' && ret[0] <= 'Z'))) { + gchar *tempstr = ret; + + ret = g_strconcat ("param-", ret, NULL); + g_free (tempstr); + } + + /* check for duplicate property names */ + if (g_object_class_find_property (G_OBJECT_CLASS (klass), ret)) { + gint n = 1; + gchar *nret = g_strdup_printf ("%s-%d", ret, n++); + + while (g_object_class_find_property (G_OBJECT_CLASS (klass), nret)) { + g_free (nret); + nret = g_strdup_printf ("%s-%d", ret, n++); + } + g_free (ret); + ret = nret; + } + + GST_DEBUG ("built property name '%s' from port name '%s'", ret, + slv2_value_as_string (slv2_port_get_symbol (lv2plugin, port))); + + return ret; } static gchar * @@ -408,14 +437,6 @@ gst_lv2_class_get_param_spec (GstLV2Class * klass, gint portnum) nick = gst_lv2_class_get_param_nick (klass, port); name = gst_lv2_class_get_param_name (klass, port); - g_strcanon (name, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-", '-'); - if (!((name[0] >= 'a' && name[0] <= 'z') || (name[0] >= 'A' - && name[0] <= 'Z'))) { - gchar *tempstr = name; - - name = g_strconcat ("param-", name, NULL); - g_free (tempstr); - } GST_DEBUG ("%s trying port %s : %s", slv2_value_as_string (slv2_plugin_get_uri (lv2plugin)), name, nick); diff --git a/ext/mpeg2enc/gstmpeg2enc.cc b/ext/mpeg2enc/gstmpeg2enc.cc index 64008b1644..5c0b426e93 100644 --- a/ext/mpeg2enc/gstmpeg2enc.cc +++ b/ext/mpeg2enc/gstmpeg2enc.cc @@ -717,7 +717,7 @@ plugin_init (GstPlugin * plugin) mjpeg_default_handler_verbosity (0); return gst_element_register (plugin, "mpeg2enc", - GST_RANK_SECONDARY, GST_TYPE_MPEG2ENC); + GST_RANK_MARGINAL, GST_TYPE_MPEG2ENC); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/ext/mpeg2enc/gstmpeg2encoder.cc b/ext/mpeg2enc/gstmpeg2encoder.cc index acfda50523..776602cc6e 100644 --- a/ext/mpeg2enc/gstmpeg2encoder.cc +++ b/ext/mpeg2enc/gstmpeg2encoder.cc @@ -26,7 +26,10 @@ #include #include -#if GST_MJPEGTOOLS_API >= 10900 +#if GST_MJPEGTOOLS_API >= 20000 +#include +#include +#elif GST_MJPEGTOOLS_API >= 10900 #include #include #include diff --git a/ext/mplex/gstmplex.cc b/ext/mplex/gstmplex.cc index 04eae2edf1..fca40e38b8 100644 --- a/ext/mplex/gstmplex.cc +++ b/ext/mplex/gstmplex.cc @@ -129,7 +129,7 @@ gst_mplex_base_init (gpointer klass) "High-quality MPEG/DVD/SVCD/VCD video/audio multiplexer", "Andrew Stevens \n" "Ronald Bultje \n" - "Mark Nauwelaerts "); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&src_templ)); diff --git a/ext/musicbrainz/gsttrm.c b/ext/musicbrainz/gsttrm.c index facba1cb2e..7e53cc078d 100644 --- a/ext/musicbrainz/gsttrm.c +++ b/ext/musicbrainz/gsttrm.c @@ -171,7 +171,6 @@ gst_trm_setcaps (GstPad * pad, GstCaps * caps) { GstTRM *trm; GstStructure *structure; - const gchar *mimetype; gint width; trm = GST_TRM (gst_pad_get_parent (pad)); @@ -180,7 +179,6 @@ gst_trm_setcaps (GstPad * pad, GstCaps * caps) return FALSE; structure = gst_caps_get_structure (caps, 0); - mimetype = gst_structure_get_name (structure); if (!gst_structure_get_int (structure, "depth", &trm->depth) || !gst_structure_get_int (structure, "width", &width) || diff --git a/ext/openal/Makefile.am b/ext/openal/Makefile.am new file mode 100644 index 0000000000..b5e4e5b902 --- /dev/null +++ b/ext/openal/Makefile.am @@ -0,0 +1,15 @@ +# Note: plugindir is set in configure + +plugin_LTLIBRARIES = libgstopenal.la + +# sources used to compile this plug-in +libgstopenal_la_SOURCES = gstopenal.c gstopenalsink.c gstopenalsrc.c + +# compiler and linker flags used to compile this plugin, set in configure.ac +libgstopenal_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(OPENAL_CFLAGS) $(GST_PLUGINS_BAD_CFLAGS) +libgstopenal_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-@GST_MAJORMINOR@ $(GST_BASE_LIBS) $(GST_LIBS) $(OPENAL_LIBS) +libgstopenal_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstopenal_la_LIBTOOLFLAGS = --tag=disable-static + +# headers we need but don't want installed +noinst_HEADERS = gstopenalsink.h gstopenalsrc.h diff --git a/ext/openal/gstopenal.c b/ext/openal/gstopenal.c new file mode 100644 index 0000000000..7022441b53 --- /dev/null +++ b/ext/openal/gstopenal.c @@ -0,0 +1,55 @@ +/* + * GStreamer + * Copyright (C) 2005 Wim Taymans + * Copyright (C) 2006 Tim-Philipp Müller + * Copyright (C) 2009-2010 Chris Robinson + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "gstopenalsink.h" +#include "gstopenalsrc.h" + +static gboolean +plugin_init (GstPlugin * plugin) +{ + if (!gst_element_register (plugin, "openalsink", GST_RANK_SECONDARY, + GST_TYPE_OPENAL_SINK) || + !gst_element_register (plugin, "openalsrc", GST_RANK_SECONDARY, + GST_TYPE_OPENAL_SRC)) + return FALSE; + +#ifdef ENABLE_NLS + GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE, + LOCALEDIR); + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +#endif /* ENABLE_NLS */ + + return TRUE; +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, + "openal", + "OpenAL support for GStreamer", + plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/ext/openal/gstopenalsink.c b/ext/openal/gstopenalsink.c new file mode 100644 index 0000000000..ece5905315 --- /dev/null +++ b/ext/openal/gstopenalsink.c @@ -0,0 +1,952 @@ +/* + * GStreamer + * Copyright (C) 2005 Wim Taymans + * Copyright (C) 2006 Tim-Philipp Müller + * Copyright (C) 2009-2010 Chris Robinson + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/** + * SECTION:element-openalsink + * + * This element renders raw audio samples using the OpenAL API + * + * + * Example pipelines + * |[ + * gst-launch -v audiotestsrc ! audioconvert ! volume volume=0.1 ! openalsink + * ]| will output a sine wave (continuous beep sound) to your sound card (with + * a very low volume as precaution). + * |[ + * gst-launch -v filesrc location=music.ogg ! decodebin ! audioconvert ! audioresample ! openalsink + * ]| will play an Ogg/Vorbis audio file and output it using OpenAL. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "gstopenalsink.h" + +GST_DEBUG_CATEGORY (openalsink_debug); + +static void gst_openal_sink_dispose (GObject * object); +static void gst_openal_sink_finalize (GObject * object); + +static void gst_openal_sink_get_property (GObject * object, guint prop_id, + GValue * val, GParamSpec * pspec); +static void gst_openal_sink_set_property (GObject * object, guint prop_id, + const GValue * val, GParamSpec * pspec); + +static GstCaps *gst_openal_sink_getcaps (GstBaseSink * bsink); + +static gboolean gst_openal_sink_open (GstAudioSink * asink); +static gboolean gst_openal_sink_close (GstAudioSink * asink); +static gboolean gst_openal_sink_prepare (GstAudioSink * asink, + GstRingBufferSpec * spec); +static gboolean gst_openal_sink_unprepare (GstAudioSink * asink); +static guint gst_openal_sink_write (GstAudioSink * asink, gpointer data, + guint length); +static guint gst_openal_sink_delay (GstAudioSink * asink); +static void gst_openal_sink_reset (GstAudioSink * asink); + +#define DEFAULT_DEVICE NULL + +enum +{ + PROP_0, + + PROP_DEVICE, + PROP_DEVICE_NAME, + + PROP_DEVICE_HDL, + PROP_CONTEXT_HDL, + PROP_SOURCE_ID +}; + +static GstStaticPadTemplate openalsink_sink_factory = + GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw-float, " + "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", " + "width = (int) 32, " + "rate = (int) [ 1, MAX ], " + "channels = (int) [ 1, MAX ]; " + "audio/x-raw-int, " + "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", " + "signed = (boolean) TRUE, " + "width = (int) 16, " + "depth = (int) 16, " + "rate = (int) [ 1, MAX ], " + "channels = (int) [ 1, MAX ]; " + "audio/x-raw-int, " + "signed = (boolean) FALSE, " + "width = (int) 8, " + "depth = (int) 8, " + "rate = (int) [ 1, MAX ], " + "channels = (int) [ 1, MAX ]; " + "audio/x-mulaw, " + "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]") + ); + +static PFNALCSETTHREADCONTEXTPROC palcSetThreadContext; +static PFNALCGETTHREADCONTEXTPROC palcGetThreadContext; + +static inline ALCcontext * +pushContext (ALCcontext * ctx) +{ + ALCcontext *old; + if (!palcGetThreadContext || !palcSetThreadContext) + return NULL; + + old = palcGetThreadContext (); + if (old != ctx) + palcSetThreadContext (ctx); + return old; +} + +static inline void +popContext (ALCcontext * old, ALCcontext * ctx) +{ + if (!palcGetThreadContext || !palcSetThreadContext) + return; + + if (old != ctx) + palcSetThreadContext (old); +} + +static inline ALenum +checkALError (const char *fname, unsigned int fline) +{ + ALenum err = alGetError (); + if (err != AL_NO_ERROR) + g_warning ("%s:%u: context error: %s", fname, fline, alGetString (err)); + return err; +} + +#define checkALError() checkALError(__FILE__, __LINE__) + +GST_BOILERPLATE (GstOpenALSink, gst_openal_sink, GstAudioSink, + GST_TYPE_AUDIO_SINK); + +static void +gst_openal_sink_dispose (GObject * object) +{ + GstOpenALSink *sink = GST_OPENAL_SINK (object); + + if (sink->probed_caps) + gst_caps_unref (sink->probed_caps); + sink->probed_caps = NULL; + + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +/* GObject vmethod implementations */ +static void +gst_openal_sink_base_init (gpointer gclass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); + GstPadTemplate *pad_template; + + gst_element_class_set_details_simple (element_class, "Audio sink (OpenAL)", + "Sink/Audio", + "Output to a sound device via OpenAL", + "Chris Robinson "); + + pad_template = gst_static_pad_template_get (&openalsink_sink_factory); + gst_element_class_add_pad_template (element_class, pad_template); +} + +/* initialize the plugin's class */ +static void +gst_openal_sink_class_init (GstOpenALSinkClass * klass) +{ + GObjectClass *gobject_class = (GObjectClass *) klass; + GstBaseSinkClass *gstbasesink_class = (GstBaseSinkClass *) klass; + GstAudioSinkClass *gstaudiosink_class = (GstAudioSinkClass *) klass; + GParamSpec *spec; + + if (alcIsExtensionPresent (NULL, "ALC_EXT_thread_local_context")) { + palcSetThreadContext = alcGetProcAddress (NULL, "alcSetThreadContext"); + palcGetThreadContext = alcGetProcAddress (NULL, "alcGetThreadContext"); + } + + GST_DEBUG_CATEGORY_INIT (openalsink_debug, "openalsink", 0, "OpenAL sink"); + + gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_openal_sink_dispose); + gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_openal_sink_finalize); + gobject_class->set_property = + GST_DEBUG_FUNCPTR (gst_openal_sink_set_property); + gobject_class->get_property = + GST_DEBUG_FUNCPTR (gst_openal_sink_get_property); + + spec = g_param_spec_string ("device-name", "Device name", + "Opened OpenAL device name", "", G_PARAM_READABLE); + g_object_class_install_property (gobject_class, PROP_DEVICE_NAME, spec); + + spec = g_param_spec_string ("device", "Device", "OpenAL device string", + DEFAULT_DEVICE, G_PARAM_READWRITE); + g_object_class_install_property (gobject_class, PROP_DEVICE, spec); + + spec = g_param_spec_pointer ("device-handle", "ALCdevice", + "Custom playback device", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (gobject_class, PROP_DEVICE_HDL, spec); + + spec = g_param_spec_pointer ("context-handle", "ALCcontext", + "Custom playback context", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (gobject_class, PROP_CONTEXT_HDL, spec); + + spec = g_param_spec_uint ("source-id", "Source ID", "Custom playback sID", + 0, UINT_MAX, 0, G_PARAM_READWRITE); + g_object_class_install_property (gobject_class, PROP_SOURCE_ID, spec); + + parent_class = g_type_class_peek_parent (klass); + + gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_openal_sink_getcaps); + + gstaudiosink_class->open = GST_DEBUG_FUNCPTR (gst_openal_sink_open); + gstaudiosink_class->close = GST_DEBUG_FUNCPTR (gst_openal_sink_close); + gstaudiosink_class->prepare = GST_DEBUG_FUNCPTR (gst_openal_sink_prepare); + gstaudiosink_class->unprepare = GST_DEBUG_FUNCPTR (gst_openal_sink_unprepare); + gstaudiosink_class->write = GST_DEBUG_FUNCPTR (gst_openal_sink_write); + gstaudiosink_class->delay = GST_DEBUG_FUNCPTR (gst_openal_sink_delay); + gstaudiosink_class->reset = GST_DEBUG_FUNCPTR (gst_openal_sink_reset); +} + +static void +gst_openal_sink_init (GstOpenALSink * sink, GstOpenALSinkClass * klass) +{ + GST_DEBUG_OBJECT (sink, "initializing openalsink"); + + sink->devname = g_strdup (DEFAULT_DEVICE); + + sink->custom_dev = NULL; + sink->custom_ctx = NULL; + sink->custom_sID = 0; + + sink->device = NULL; + sink->context = NULL; + sink->sID = 0; + + sink->bID_idx = 0; + sink->bID_count = 0; + sink->bIDs = NULL; + sink->bID_length = 0; + + sink->write_reset = AL_FALSE; + sink->probed_caps = NULL; + + sink->openal_lock = g_mutex_new (); +} + +static void +gst_openal_sink_finalize (GObject * object) +{ + GstOpenALSink *sink = GST_OPENAL_SINK (object); + + g_free (sink->devname); + sink->devname = NULL; + g_mutex_free (sink->openal_lock); + sink->openal_lock = NULL; + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void +gst_openal_sink_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) +{ + GstOpenALSink *sink = GST_OPENAL_SINK (object); + + switch (prop_id) { + case PROP_DEVICE: + g_free (sink->devname); + sink->devname = g_value_dup_string (value); + if (sink->probed_caps) + gst_caps_unref (sink->probed_caps); + sink->probed_caps = NULL; + break; + case PROP_DEVICE_HDL: + if (!sink->device) + sink->custom_dev = g_value_get_pointer (value); + break; + case PROP_CONTEXT_HDL: + if (!sink->device) + sink->custom_ctx = g_value_get_pointer (value); + break; + case PROP_SOURCE_ID: + if (!sink->device) + sink->custom_sID = g_value_get_uint (value); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gst_openal_sink_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec) +{ + GstOpenALSink *sink = GST_OPENAL_SINK (object); + const ALCchar *name = sink->devname; + ALCdevice *device = sink->device; + ALCcontext *context = sink->context; + ALuint sourceID = sink->sID; + + switch (prop_id) { + case PROP_DEVICE_NAME: + name = ""; + if (device) + name = alcGetString (device, ALC_DEVICE_SPECIFIER); + /* fall-through */ + case PROP_DEVICE: + g_value_set_string (value, name); + break; + case PROP_DEVICE_HDL: + if (!device) + device = sink->custom_dev; + g_value_set_pointer (value, device); + break; + case PROP_CONTEXT_HDL: + if (!context) + context = sink->custom_ctx; + g_value_set_pointer (value, context); + break; + case PROP_SOURCE_ID: + if (!sourceID) + sourceID = sink->custom_sID; + g_value_set_uint (value, sourceID); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static GstCaps * +gst_openal_helper_probe_caps (ALCcontext * ctx) +{ + static const struct + { + gint count; + GstAudioChannelPosition pos[8]; + } chans[] = { + { + 1, { + GST_AUDIO_CHANNEL_POSITION_FRONT_MONO}}, { + 2, { + GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, + GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}}, { + 4, { + GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, + GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, + GST_AUDIO_CHANNEL_POSITION_REAR_LEFT, + GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}}, { + 6, { + GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, + GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, + GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER, + GST_AUDIO_CHANNEL_POSITION_LFE, + GST_AUDIO_CHANNEL_POSITION_REAR_LEFT, + GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}}, { + 7, { + GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, + GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, + GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER, + GST_AUDIO_CHANNEL_POSITION_LFE, + GST_AUDIO_CHANNEL_POSITION_REAR_CENTER, + GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT, + GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT}}, { + 8, { + GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, + GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, + GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER, + GST_AUDIO_CHANNEL_POSITION_LFE, + GST_AUDIO_CHANNEL_POSITION_REAR_LEFT, + GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT, + GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT, + GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT}},}; + GstStructure *structure; + ALCcontext *old; + GstCaps *caps; + + old = pushContext (ctx); + + caps = gst_caps_new_empty (); + if (alIsExtensionPresent ("AL_EXT_MCFORMATS")) { + const char *fmt32[] = { + "AL_FORMAT_MONO_FLOAT32", "AL_FORMAT_STEREO_FLOAT32", + "AL_FORMAT_QUAD32", "AL_FORMAT_51CHN32", "AL_FORMAT_61CHN32", + "AL_FORMAT_71CHN32", NULL + }, *fmt16[] = { + "AL_FORMAT_MONO16", "AL_FORMAT_STEREO16", "AL_FORMAT_QUAD16", + "AL_FORMAT_51CHN16", "AL_FORMAT_61CHN16", "AL_FORMAT_71CHN16", NULL}, + *fmt8[] = { + "AL_FORMAT_MONO8", "AL_FORMAT_STEREO8", "AL_FORMAT_QUAD8", + "AL_FORMAT_51CHN8", "AL_FORMAT_61CHN8", "AL_FORMAT_71CHN8", NULL}; + int i; + + if (alIsExtensionPresent ("AL_EXT_FLOAT32")) { + for (i = 0; fmt32[i]; i++) { + ALenum val = alGetEnumValue (fmt32[i]); + if (checkALError () != AL_NO_ERROR || val == 0 || val == -1) + continue; + + structure = gst_structure_new ("audio/x-raw-float", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "rate", GST_TYPE_INT_RANGE, OPENAL_MIN_RATE, + OPENAL_MAX_RATE, "width", G_TYPE_INT, 32, NULL); + gst_structure_set (structure, "channels", G_TYPE_INT, + chans[i].count, NULL); + if (chans[i].count > 2) + gst_audio_set_channel_positions (structure, chans[i].pos); + gst_caps_append_structure (caps, structure); + } + } + for (i = 0; fmt16[i]; i++) { + ALenum val = alGetEnumValue (fmt16[i]); + if (checkALError () != AL_NO_ERROR || val == 0 || val == -1) + continue; + + structure = gst_structure_new ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "rate", GST_TYPE_INT_RANGE, OPENAL_MIN_RATE, OPENAL_MAX_RATE, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, "signed", G_TYPE_BOOLEAN, TRUE, NULL); + gst_structure_set (structure, "channels", G_TYPE_INT, + chans[i].count, NULL); + if (chans[i].count > 2) + gst_audio_set_channel_positions (structure, chans[i].pos); + gst_caps_append_structure (caps, structure); + } + for (i = 0; fmt8[i]; i++) { + ALenum val = alGetEnumValue (fmt8[i]); + if (checkALError () != AL_NO_ERROR || val == 0 || val == -1) + continue; + + structure = gst_structure_new ("audio/x-raw-int", + "rate", GST_TYPE_INT_RANGE, OPENAL_MIN_RATE, OPENAL_MAX_RATE, + "width", G_TYPE_INT, 8, + "depth", G_TYPE_INT, 8, "signed", G_TYPE_BOOLEAN, FALSE, NULL); + gst_structure_set (structure, "channels", G_TYPE_INT, + chans[i].count, NULL); + if (chans[i].count > 2) + gst_audio_set_channel_positions (structure, chans[i].pos); + gst_caps_append_structure (caps, structure); + } + } else { + if (alIsExtensionPresent ("AL_EXT_FLOAT32")) { + structure = gst_structure_new ("audio/x-raw-float", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "rate", GST_TYPE_INT_RANGE, OPENAL_MIN_RATE, OPENAL_MAX_RATE, + "width", G_TYPE_INT, 32, "channels", GST_TYPE_INT_RANGE, 1, 2, NULL); + gst_caps_append_structure (caps, structure); + } + + structure = gst_structure_new ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "rate", GST_TYPE_INT_RANGE, OPENAL_MIN_RATE, OPENAL_MAX_RATE, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", GST_TYPE_INT_RANGE, 1, 2, NULL); + gst_caps_append_structure (caps, structure); + + structure = gst_structure_new ("audio/x-raw-int", + "rate", GST_TYPE_INT_RANGE, OPENAL_MIN_RATE, OPENAL_MAX_RATE, + "width", G_TYPE_INT, 8, + "depth", G_TYPE_INT, 8, + "signed", G_TYPE_BOOLEAN, FALSE, + "channels", GST_TYPE_INT_RANGE, 1, 2, NULL); + gst_caps_append_structure (caps, structure); + } + + if (alIsExtensionPresent ("AL_EXT_MULAW_MCFORMATS")) { + const char *fmtmulaw[] = { + "AL_FORMAT_MONO_MULAW", "AL_FORMAT_STEREO_MULAW", + "AL_FORMAT_QUAD_MULAW", "AL_FORMAT_51CHN_MULAW", + "AL_FORMAT_61CHN_MULAW", "AL_FORMAT_71CHN_MULAW", NULL + }; + int i; + + for (i = 0; fmtmulaw[i]; i++) { + ALenum val = alGetEnumValue (fmtmulaw[i]); + if (checkALError () != AL_NO_ERROR || val == 0 || val == -1) + continue; + + structure = gst_structure_new ("audio/x-mulaw", + "rate", GST_TYPE_INT_RANGE, OPENAL_MIN_RATE, OPENAL_MAX_RATE, NULL); + gst_structure_set (structure, "channels", G_TYPE_INT, + chans[i].count, NULL); + if (chans[i].count > 2) + gst_audio_set_channel_positions (structure, chans[i].pos); + gst_caps_append_structure (caps, structure); + } + } else if (alIsExtensionPresent ("AL_EXT_MULAW")) { + structure = gst_structure_new ("audio/x-mulaw", + "rate", GST_TYPE_INT_RANGE, OPENAL_MIN_RATE, OPENAL_MAX_RATE, + "channels", GST_TYPE_INT_RANGE, 1, 2, NULL); + gst_caps_append_structure (caps, structure); + } + + popContext (old, ctx); + return caps; +} + +static GstCaps * +gst_openal_sink_getcaps (GstBaseSink * bsink) +{ + GstOpenALSink *sink = GST_OPENAL_SINK (bsink); + GstCaps *caps; + + if (sink->device == NULL) { + GstPad *pad = GST_BASE_SINK_PAD (bsink); + caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); + } else if (sink->probed_caps) + caps = gst_caps_copy (sink->probed_caps); + else { + if (sink->context) + caps = gst_openal_helper_probe_caps (sink->context); + else if (sink->custom_ctx) + caps = gst_openal_helper_probe_caps (sink->custom_ctx); + else { + ALCcontext *ctx = alcCreateContext (sink->device, NULL); + if (ctx) { + caps = gst_openal_helper_probe_caps (ctx); + alcDestroyContext (ctx); + } else { + GST_ELEMENT_WARNING (sink, RESOURCE, FAILED, + ("Could not create temporary context."), + GST_ALC_ERROR (sink->device)); + caps = NULL; + } + } + + if (caps && !gst_caps_is_empty (caps)) + sink->probed_caps = gst_caps_copy (caps); + } + + return caps; +} + +static gboolean +gst_openal_sink_open (GstAudioSink * asink) +{ + GstOpenALSink *openal = GST_OPENAL_SINK (asink); + + if (openal->custom_dev) { + ALCint val = -1; + alcGetIntegerv (openal->custom_dev, ALC_ATTRIBUTES_SIZE, 1, &val); + if (val > 0) { + if (!openal->custom_ctx || + alcGetContextsDevice (openal->custom_ctx) == openal->custom_dev) + openal->device = openal->custom_dev; + } + } else if (openal->custom_ctx) + openal->device = alcGetContextsDevice (openal->custom_ctx); + else + openal->device = alcOpenDevice (openal->devname); + if (!openal->device) { + GST_ELEMENT_ERROR (openal, RESOURCE, OPEN_WRITE, + ("Could not open audio device for playback."), + GST_ALC_ERROR (openal->device)); + return FALSE; + } + + return TRUE; +} + +static gboolean +gst_openal_sink_close (GstAudioSink * asink) +{ + GstOpenALSink *openal = GST_OPENAL_SINK (asink); + + if (!openal->custom_dev && !openal->custom_ctx) { + if (alcCloseDevice (openal->device) == ALC_FALSE) { + GST_ELEMENT_ERROR (openal, RESOURCE, CLOSE, + ("Could not close audio device."), GST_ALC_ERROR (openal->device)); + return FALSE; + } + } + openal->device = NULL; + + if (openal->probed_caps) + gst_caps_unref (openal->probed_caps); + openal->probed_caps = NULL; + + return TRUE; +} + +static void +gst_openal_sink_parse_spec (GstOpenALSink * openal, + const GstRingBufferSpec * spec) +{ + ALuint format = AL_NONE; + + GST_DEBUG_OBJECT (openal, "Looking up format for type %d, gst-format %d, " + "and %d channels", spec->type, spec->format, spec->channels); + + /* Don't need to verify supported formats, since the probed caps will only + * report what was detected and we shouldn't get anything different */ + switch (spec->type) { + case GST_BUFTYPE_LINEAR: + switch (spec->format) { + case GST_U8: + if (spec->channels == 1) + format = AL_FORMAT_MONO8; + if (spec->channels == 2) + format = AL_FORMAT_STEREO8; + if (spec->channels == 4) + format = AL_FORMAT_QUAD8; + if (spec->channels == 6) + format = AL_FORMAT_51CHN8; + if (spec->channels == 7) + format = AL_FORMAT_61CHN8; + if (spec->channels == 8) + format = AL_FORMAT_71CHN8; + break; + + case GST_S16_NE: + if (spec->channels == 1) + format = AL_FORMAT_MONO16; + if (spec->channels == 2) + format = AL_FORMAT_STEREO16; + if (spec->channels == 4) + format = AL_FORMAT_QUAD16; + if (spec->channels == 6) + format = AL_FORMAT_51CHN16; + if (spec->channels == 7) + format = AL_FORMAT_61CHN16; + if (spec->channels == 8) + format = AL_FORMAT_71CHN16; + break; + + default: + break; + } + break; + + case GST_BUFTYPE_FLOAT: + switch (spec->format) { + case GST_FLOAT32_NE: + if (spec->channels == 1) + format = AL_FORMAT_MONO_FLOAT32; + if (spec->channels == 2) + format = AL_FORMAT_STEREO_FLOAT32; + if (spec->channels == 4) + format = AL_FORMAT_QUAD32; + if (spec->channels == 6) + format = AL_FORMAT_51CHN32; + if (spec->channels == 7) + format = AL_FORMAT_61CHN32; + if (spec->channels == 8) + format = AL_FORMAT_71CHN32; + break; + + default: + break; + } + break; + + case GST_BUFTYPE_MU_LAW: + switch (spec->format) { + case GST_MU_LAW: + if (spec->channels == 1) + format = AL_FORMAT_MONO_MULAW; + if (spec->channels == 2) + format = AL_FORMAT_STEREO_MULAW; + if (spec->channels == 4) + format = AL_FORMAT_QUAD_MULAW; + if (spec->channels == 6) + format = AL_FORMAT_51CHN_MULAW; + if (spec->channels == 7) + format = AL_FORMAT_61CHN_MULAW; + if (spec->channels == 8) + format = AL_FORMAT_71CHN_MULAW; + break; + + default: + break; + } + break; + + default: + break; + } + + openal->bytes_per_sample = spec->bytes_per_sample; + openal->srate = spec->rate; + openal->bID_count = spec->segtotal; + openal->bID_length = spec->segsize; + openal->format = format; +} + +static gboolean +gst_openal_sink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec) +{ + GstOpenALSink *openal = GST_OPENAL_SINK (asink); + ALCcontext *ctx, *old; + + if (openal->context && !gst_openal_sink_unprepare (asink)) + return FALSE; + + if (openal->custom_ctx) + ctx = openal->custom_ctx; + else { + ALCint attribs[3] = { 0, 0, 0 }; + + /* Don't try to change the playback frequency of an app's device */ + if (!openal->custom_dev) { + attribs[0] = ALC_FREQUENCY; + attribs[1] = spec->rate; + attribs[2] = 0; + } + + ctx = alcCreateContext (openal->device, attribs); + if (!ctx) { + GST_ELEMENT_ERROR (openal, RESOURCE, FAILED, + ("Unable to prepare device."), GST_ALC_ERROR (openal->device)); + return FALSE; + } + } + + old = pushContext (ctx); + + if (openal->custom_sID) { + if (!openal->custom_ctx || !alIsSource (openal->custom_sID)) { + GST_ELEMENT_ERROR (openal, RESOURCE, NOT_FOUND, (NULL), + ("Invalid source ID specified for context")); + goto fail; + } + openal->sID = openal->custom_sID; + } else { + ALuint sourceID; + + alGenSources (1, &sourceID); + if (checkALError () != AL_NO_ERROR) { + GST_ELEMENT_ERROR (openal, RESOURCE, NO_SPACE_LEFT, (NULL), + ("Unable to generate source")); + goto fail; + } + openal->sID = sourceID; + } + + gst_openal_sink_parse_spec (openal, spec); + if (openal->format == AL_NONE) { + GST_ELEMENT_ERROR (openal, RESOURCE, SETTINGS, (NULL), + ("Unable to get type %d, format %d, and %d channels", + spec->type, spec->format, spec->channels)); + goto fail; + } + + openal->bIDs = g_malloc (openal->bID_count * sizeof (*openal->bIDs)); + if (!openal->bIDs) { + GST_ELEMENT_ERROR (openal, RESOURCE, FAILED, ("Out of memory."), + ("Unable to allocate buffer IDs")); + goto fail; + } + + alGenBuffers (openal->bID_count, openal->bIDs); + if (checkALError () != AL_NO_ERROR) { + GST_ELEMENT_ERROR (openal, RESOURCE, NO_SPACE_LEFT, (NULL), + ("Unable to generate %d buffers", openal->bID_count)); + goto fail; + } + openal->bID_idx = 0; + + popContext (old, ctx); + openal->context = ctx; + return TRUE; + +fail: + if (!openal->custom_sID && openal->sID) + alDeleteSources (1, &openal->sID); + openal->sID = 0; + + g_free (openal->bIDs); + openal->bIDs = NULL; + openal->bID_count = 0; + openal->bID_length = 0; + + popContext (old, ctx); + if (!openal->custom_ctx) + alcDestroyContext (ctx); + return FALSE; +} + +static gboolean +gst_openal_sink_unprepare (GstAudioSink * asink) +{ + GstOpenALSink *openal = GST_OPENAL_SINK (asink); + ALCcontext *old; + + if (!openal->context) + return TRUE; + + old = pushContext (openal->context); + + alSourceStop (openal->sID); + alSourcei (openal->sID, AL_BUFFER, 0); + + if (!openal->custom_sID) + alDeleteSources (1, &openal->sID); + openal->sID = 0; + + alDeleteBuffers (openal->bID_count, openal->bIDs); + g_free (openal->bIDs); + openal->bIDs = NULL; + openal->bID_idx = 0; + openal->bID_count = 0; + openal->bID_length = 0; + + checkALError (); + popContext (old, openal->context); + if (!openal->custom_ctx) + alcDestroyContext (openal->context); + openal->context = NULL; + + return TRUE; +} + +static guint +gst_openal_sink_write (GstAudioSink * asink, gpointer data, guint length) +{ + GstOpenALSink *openal = GST_OPENAL_SINK (asink); + ALint processed, queued, state; + ALCcontext *old; + gulong rest_us; + + g_assert (length == openal->bID_length); + + old = pushContext (openal->context); + + rest_us = (guint64) (openal->bID_length / openal->bytes_per_sample) * + G_USEC_PER_SEC / openal->srate / 2; + do { + alGetSourcei (openal->sID, AL_SOURCE_STATE, &state); + alGetSourcei (openal->sID, AL_BUFFERS_QUEUED, &queued); + alGetSourcei (openal->sID, AL_BUFFERS_PROCESSED, &processed); + if (checkALError () != AL_NO_ERROR) { + GST_ELEMENT_ERROR (openal, RESOURCE, WRITE, (NULL), + ("Source state error detected")); + length = 0; + goto out_nolock; + } + + if (processed > 0 || queued < openal->bID_count) + break; + if (state != AL_PLAYING) + alSourcePlay (openal->sID); + g_usleep (rest_us); + } while (1); + + GST_OPENAL_SINK_LOCK (openal); + if (openal->write_reset != AL_FALSE) { + openal->write_reset = AL_FALSE; + length = 0; + goto out; + } + + queued -= processed; + while (processed-- > 0) { + ALuint bid; + alSourceUnqueueBuffers (openal->sID, 1, &bid); + } + if (state == AL_STOPPED) { + /* "Restore" from underruns (not actually needed, but it keeps delay + * calculations correct while rebuffering) */ + alSourceRewind (openal->sID); + } + + alBufferData (openal->bIDs[openal->bID_idx], openal->format, + data, openal->bID_length, openal->srate); + alSourceQueueBuffers (openal->sID, 1, &openal->bIDs[openal->bID_idx]); + openal->bID_idx = (openal->bID_idx + 1) % openal->bID_count; + queued++; + + if (state != AL_PLAYING && queued == openal->bID_count) + alSourcePlay (openal->sID); + + if (checkALError () != ALC_NO_ERROR) { + GST_ELEMENT_ERROR (openal, RESOURCE, WRITE, (NULL), + ("Source queue error detected")); + goto out; + } + +out: + GST_OPENAL_SINK_UNLOCK (openal); +out_nolock: + popContext (old, openal->context); + return length; +} + +static guint +gst_openal_sink_delay (GstAudioSink * asink) +{ + GstOpenALSink *openal = GST_OPENAL_SINK (asink); + ALint queued, state, offset, delay; + ALCcontext *old; + + if (!openal->context) + return 0; + + GST_OPENAL_SINK_LOCK (openal); + old = pushContext (openal->context); + + delay = 0; + alGetSourcei (openal->sID, AL_BUFFERS_QUEUED, &queued); + /* Order here is important. If the offset is queried after the state and an + * underrun occurs in between the two calls, it can end up with a 0 offset + * in a playing state, incorrectly reporting a len*queued/bps delay. */ + alGetSourcei (openal->sID, AL_BYTE_OFFSET, &offset); + alGetSourcei (openal->sID, AL_SOURCE_STATE, &state); + + /* Note: state=stopped is an underrun, meaning all buffers are processed + * and there's no delay when writing the next buffer. Pre-buffering is + * state=initial, which will introduce a delay while writing. */ + if (checkALError () == AL_NO_ERROR && state != AL_STOPPED) + delay = ((queued * openal->bID_length) - offset) / openal->bytes_per_sample; + + popContext (old, openal->context); + GST_OPENAL_SINK_UNLOCK (openal); + + return delay; +} + +static void +gst_openal_sink_reset (GstAudioSink * asink) +{ + GstOpenALSink *openal = GST_OPENAL_SINK (asink); + ALCcontext *old; + + GST_OPENAL_SINK_LOCK (openal); + old = pushContext (openal->context); + + openal->write_reset = AL_TRUE; + alSourceStop (openal->sID); + alSourceRewind (openal->sID); + alSourcei (openal->sID, AL_BUFFER, 0); + checkALError (); + + popContext (old, openal->context); + GST_OPENAL_SINK_UNLOCK (openal); +} diff --git a/ext/openal/gstopenalsink.h b/ext/openal/gstopenalsink.h new file mode 100644 index 0000000000..f83b1cf56c --- /dev/null +++ b/ext/openal/gstopenalsink.h @@ -0,0 +1,123 @@ +/* + * GStreamer + * Copyright (C) 2005 Thomas Vander Stichele + * Copyright (C) 2005 Ronald S. Bultje + * Copyright (C) 2009-2010 Chris Robinson + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GST_OPENALSINK_H__ +#define __GST_OPENALSINK_H__ + +#include +#include +#include + +#ifdef _WIN32 +#include +#include +#include +#elif defined(__APPLE__) +#include +#include +#include +#else +#include +#include +#include +#endif + +G_BEGIN_DECLS + +#define GST_TYPE_OPENAL_SINK (gst_openal_sink_get_type()) +#define GST_OPENAL_SINK(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OPENAL_SINK,GstOpenALSink)) +#define GST_OPENAL_SINK_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OPENAL_SINK,GstOpenALSinkClass)) +#define GST_IS_OPENAL_SINK(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OPENAL_SINK)) +#define GST_IS_OPENAL_SINK_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OPENAL_SINK)) + +#if 1 +#define GST_ALC_ERROR(Device) ("ALC error: %s", alcGetString((Device), alcGetError((Device)))) +#else +#define GST_ALC_ERROR(Device) ("ALC error: 0x%x", alcGetError((Device))) +#endif + +typedef struct _GstOpenALSink GstOpenALSink; +typedef struct _GstOpenALSinkClass GstOpenALSinkClass; + +#define GST_OPENAL_SINK_CAST(obj) ((GstOpenALSink*)obj) +#define GST_OPENAL_SINK_GET_LOCK(obj) (GST_OPENAL_SINK_CAST(obj)->openal_lock) +#define GST_OPENAL_SINK_LOCK(obj) (g_mutex_lock(GST_OPENAL_SINK_GET_LOCK(obj))) +#define GST_OPENAL_SINK_UNLOCK(obj) (g_mutex_unlock(GST_OPENAL_SINK_GET_LOCK(obj))) + +struct _GstOpenALSink { + GstAudioSink sink; + + gchar *devname; + + /* When set, we don't own device */ + ALCdevice *custom_dev; + /* When set, we don't own device or context */ + ALCcontext *custom_ctx; + /* When set, we don't own sID */ + ALuint custom_sID; + + ALCdevice *device; + ALCcontext *context; + ALuint sID; + + ALuint bID_idx; + ALuint bID_count; + ALuint *bIDs; + ALuint bID_length; + + ALenum format; + ALuint srate; + ALuint bytes_per_sample; + + ALboolean write_reset; + + GstCaps *probed_caps; + + GMutex *openal_lock; +}; + +struct _GstOpenALSinkClass { + GstAudioSinkClass parent_class; +}; + +GType gst_openal_sink_get_type(void); + +#if G_BYTE_ORDER == G_LITTLE_ENDIAN +#define GST_S16_NE GST_S16_LE +#define GST_FLOAT32_NE GST_FLOAT32_LE +#define GST_FLOAT64_NE GST_FLOAT64_LE +#else +#define GST_S16_NE GST_S16_BE +#define GST_FLOAT32_NE GST_FLOAT32_BE +#define GST_FLOAT64_NE GST_FLOAT64_BE +#endif + +#define OPENAL_MIN_RATE 8000 +#define OPENAL_MAX_RATE 192000 + +G_END_DECLS + +#endif /* __GST_OPENALSINK_H__ */ diff --git a/ext/openal/gstopenalsrc.c b/ext/openal/gstopenalsrc.c new file mode 100644 index 0000000000..3500719569 --- /dev/null +++ b/ext/openal/gstopenalsrc.c @@ -0,0 +1,359 @@ +/* + * GStreamer + * Copyright (C) 2005 Thomas Vander Stichele + * Copyright (C) 2005 Ronald S. Bultje + * Copyright (C) 2008 Victor Lin + * + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + + /** + * SECTION:element-openalsrc + * @short_description: record sound from your sound card using OpenAL + * + * + * + * This element lets you record sound using the OpenAL + * + * Example pipelines + * + * + * gst-launch -v openalsrc ! audioconvert ! vorbisenc ! oggmux ! filesink location=mymusic.ogg + * + * will record sound from your sound card using OpenAL and encode it to an Ogg/Vorbis file + * + * + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include "gstopenalsrc.h" + +GST_DEBUG_CATEGORY_STATIC (openalsrc_debug); + +#define GST_CAT_DEFAULT openalsrc_debug + +#define DEFAULT_DEVICE NULL +#define DEFAULT_DEVICE_NAME NULL + +/** + Filter signals and args +**/ +enum +{ + /* FILL ME */ + LAST_SIGNAL +}; + + +/** + Properties +**/ +enum +{ + PROP_0, + PROP_DEVICE, + PROP_DEVICE_NAME +}; + +static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw-int, " + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) TRUE, " + "width = (int) 16, " + "depth = (int) 16, " + "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]; " + "audio/x-raw-int, " + "signed = (boolean) TRUE, " + "width = (int) 8, " + "depth = (int) 8, " + "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]") + ); + +GST_BOILERPLATE (GstOpenalSrc, gst_openal_src, GstAudioSrc, GST_TYPE_AUDIO_SRC); + +static void gst_openal_src_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec); +static void gst_openal_src_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec); +static gboolean gst_openal_src_open (GstAudioSrc * src); +static gboolean +gst_openal_src_prepare (GstAudioSrc * src, GstRingBufferSpec * spec); +static gboolean gst_openal_src_unprepare (GstAudioSrc * src); +static gboolean gst_openal_src_close (GstAudioSrc * src); +static guint +gst_openal_src_read (GstAudioSrc * src, gpointer data, guint length); +static guint gst_openal_src_delay (GstAudioSrc * src); +static void gst_openal_src_reset (GstAudioSrc * src); + +static void gst_openal_src_finalize (GObject * object); + +static void +gst_openal_src_base_init (gpointer gclass) +{ + + GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); + + gst_element_class_set_details_simple (element_class, "OpenAL src", + "Source/Audio", + "OpenAL source capture audio from device", + "Victor Lin "); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&src_factory) + ); +} + +static void +gst_openal_src_class_init (GstOpenalSrcClass * klass) +{ + GObjectClass *gobject_class; + GstAudioSrcClass *gstaudio_src_class; + + gobject_class = G_OBJECT_CLASS (klass); + gstaudio_src_class = GST_AUDIO_SRC_CLASS (klass); + + GST_DEBUG_CATEGORY_INIT (openalsrc_debug, "openalsrc", + 0, "OpenAL source capture audio from device"); + + gobject_class->set_property = gst_openal_src_set_property; + gobject_class->get_property = gst_openal_src_get_property; + gobject_class->finalize = gst_openal_src_finalize; + + gstaudio_src_class->open = GST_DEBUG_FUNCPTR (gst_openal_src_open); + gstaudio_src_class->prepare = GST_DEBUG_FUNCPTR (gst_openal_src_prepare); + gstaudio_src_class->unprepare = GST_DEBUG_FUNCPTR (gst_openal_src_unprepare); + gstaudio_src_class->close = GST_DEBUG_FUNCPTR (gst_openal_src_close); + gstaudio_src_class->read = GST_DEBUG_FUNCPTR (gst_openal_src_read); + gstaudio_src_class->delay = GST_DEBUG_FUNCPTR (gst_openal_src_delay); + gstaudio_src_class->reset = GST_DEBUG_FUNCPTR (gst_openal_src_reset); + + g_object_class_install_property (gobject_class, + PROP_DEVICE, + g_param_spec_string ("device", + "Device", + "Specific capture device to open, NULL indicate default device", + DEFAULT_DEVICE, G_PARAM_READWRITE) + ); + + g_object_class_install_property (gobject_class, + PROP_DEVICE_NAME, + g_param_spec_string ("device-name", + "Device name", + "Readable name of device", DEFAULT_DEVICE_NAME, G_PARAM_READABLE) + ); +} + +static void +gst_openal_src_init (GstOpenalSrc * osrc, GstOpenalSrcClass * gclass) +{ + osrc->deviceName = g_strdup (DEFAULT_DEVICE_NAME); + osrc->device = DEFAULT_DEVICE; + osrc->deviceHandle = NULL; +} + +static void +gst_openal_src_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) +{ + GstOpenalSrc *osrc = GST_OPENAL_SRC (object); + + switch (prop_id) { + case PROP_DEVICE: + osrc->device = g_value_dup_string (value); + break; + case PROP_DEVICE_NAME: + osrc->deviceName = g_value_dup_string (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gst_openal_src_get_property (GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec) +{ + GstOpenalSrc *osrc = GST_OPENAL_SRC (object); + + switch (prop_id) { + case PROP_DEVICE: + g_value_set_string (value, osrc->device); + break; + case PROP_DEVICE_NAME: + g_value_set_string (value, osrc->deviceName); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static gboolean +gst_openal_src_open (GstAudioSrc * asrc) +{ + /* We don't do anything here */ + return TRUE; +} + +static gboolean +gst_openal_src_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec) +{ + + GstOpenalSrc *osrc = GST_OPENAL_SRC (asrc); + ALenum format; + guint64 bufferSize; + + switch (spec->width) { + case 8: + format = AL_FORMAT_STEREO8; + break; + case 16: + format = AL_FORMAT_STEREO16; + break; + default: + g_assert_not_reached (); + } + + bufferSize = + spec->buffer_time * spec->rate * spec->bytes_per_sample / 1000000; + + GST_INFO_OBJECT (osrc, "Open device : %s", osrc->deviceName); + osrc->deviceHandle = + alcCaptureOpenDevice (osrc->device, spec->rate, format, bufferSize); + + if (!osrc->deviceHandle) { + GST_ELEMENT_ERROR (osrc, + RESOURCE, + FAILED, + ("Can't open device \"%s\"", osrc->device), + ("Can't open device \"%s\"", osrc->device) + ); + return FALSE; + } + + osrc->deviceName = + g_strdup (alcGetString (osrc->deviceHandle, ALC_DEVICE_SPECIFIER)); + osrc->bytes_per_sample = spec->bytes_per_sample; + + GST_INFO_OBJECT (osrc, "Start capture"); + alcCaptureStart (osrc->deviceHandle); + + return TRUE; +} + +static gboolean +gst_openal_src_unprepare (GstAudioSrc * asrc) +{ + + GstOpenalSrc *osrc = GST_OPENAL_SRC (asrc); + + GST_INFO_OBJECT (osrc, "Close device : %s", osrc->deviceName); + if (osrc->deviceHandle) { + alcCaptureStop (osrc->deviceHandle); + alcCaptureCloseDevice (osrc->deviceHandle); + } + + return TRUE; +} + +static gboolean +gst_openal_src_close (GstAudioSrc * asrc) +{ + /* We don't do anything here */ + return TRUE; +} + +static guint +gst_openal_src_read (GstAudioSrc * asrc, gpointer data, guint length) +{ + GstOpenalSrc *osrc = GST_OPENAL_SRC (asrc); + gint samples; + + alcGetIntegerv (osrc->deviceHandle, ALC_CAPTURE_SAMPLES, sizeof (samples), + &samples); + + if (samples * osrc->bytes_per_sample > length) { + samples = length / osrc->bytes_per_sample; + } + + if (samples) { + GST_DEBUG_OBJECT (osrc, "Read samples : %d", samples); + alcCaptureSamples (osrc->deviceHandle, data, samples); + } + + return samples * osrc->bytes_per_sample; +} + +static guint +gst_openal_src_delay (GstAudioSrc * asrc) +{ + GstOpenalSrc *osrc = GST_OPENAL_SRC (asrc); + gint samples; + + alcGetIntegerv (osrc->deviceHandle, ALC_CAPTURE_SAMPLES, sizeof (samples), + &samples); + + return samples; +} + +static void +gst_openal_src_reset (GstAudioSrc * asrc) +{ + /* We don't do anything here */ +} + +static void +gst_openal_src_finalize (GObject * object) +{ + GstOpenalSrc *osrc = GST_OPENAL_SRC (object); + + g_free (osrc->deviceName); + g_free (osrc->device); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} diff --git a/ext/openal/gstopenalsrc.h b/ext/openal/gstopenalsrc.h new file mode 100644 index 0000000000..d8cde4d4f6 --- /dev/null +++ b/ext/openal/gstopenalsrc.h @@ -0,0 +1,105 @@ +/* + * GStreamer + * Copyright (C) 2005 Thomas Vander Stichele + * Copyright (C) 2005 Ronald S. Bultje + * Copyright (C) 2008 Victor Lin + * + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GST_OPENAL_SRC_H__ +#define __GST_OPENAL_SRC_H__ + +#include +#include + +#ifdef _WIN32 +#include +#include +#include +#elif defined(__APPLE__) +#include +#include +#include +#else +#include +#include +#include +#endif + +G_BEGIN_DECLS + +#define GST_TYPE_OPENAL_SRC \ + (gst_openal_src_get_type()) +#define GST_OPENAL_SRC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OPENAL_SRC,GstOpenalSrc)) +#define GST_OPENAL_SRC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OPENAL_SRC,GstOpenalSrcClass)) +#define GST_IS_OPENAL_SRC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OPENAL_SRC)) +#define GST_IS_OPENAL_SRC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OPENAL_SRC)) + +typedef struct _GstOpenalSrc GstOpenalSrc; +typedef struct _GstOpenalSrcClass GstOpenalSrcClass; + +struct _GstOpenalSrc { + GstAudioSrc element; + GstPad *srcpad; + gboolean silent; + + /* readable name of device */ + gchar *deviceName; + /* name of device to open, default is a NULL pointer to get default device */ + gchar *device; + /* OpenAL device handle */ + ALCdevice *deviceHandle; + + guint bytes_per_sample; +}; + +struct _GstOpenalSrcClass { + GstAudioSrcClass parent_class; +}; + +GType gst_openal_src_get_type (void); + +G_END_DECLS + +#endif /* __GST_OPENAL_SRC_H__ */ diff --git a/ext/opencv/Makefile.am b/ext/opencv/Makefile.am index 7ddbe05d1a..d5a70edade 100644 --- a/ext/opencv/Makefile.am +++ b/ext/opencv/Makefile.am @@ -16,7 +16,7 @@ libgstopencv_la_SOURCES = gstopencv.c \ gstfacedetect.c \ gstpyramidsegment.c \ gsttemplatematch.c \ - gsttextwrite.c + gsttextoverlay.c # flags used to compile this facedetect # add other _CFLAGS and _LIBS as needed @@ -46,4 +46,4 @@ noinst_HEADERS = gstopencvvideofilter.h gstopencvutils.h \ gstfacedetect.h \ gstpyramidsegment.h \ gsttemplatematch.h \ - gsttextwrite.h + gsttextoverlay.h diff --git a/ext/opencv/gstedgedetect.c b/ext/opencv/gstedgedetect.c index dbe86cf9f5..de692e4bed 100644 --- a/ext/opencv/gstedgedetect.c +++ b/ext/opencv/gstedgedetect.c @@ -46,7 +46,7 @@ /** * SECTION:element-edgedetect * - * FIXME:Describe edgedetect here. + * Performs canny edge detection on videos and images * * * Example launch line @@ -151,7 +151,6 @@ gst_edgedetect_class_init (GstedgedetectClass * klass) GObjectClass *gobject_class; gobject_class = (GObjectClass *) klass; - parent_class = g_type_class_peek_parent (klass); gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_edgedetect_finalize); gobject_class->set_property = gst_edgedetect_set_property; @@ -324,7 +323,6 @@ gst_edgedetect_plugin_init (GstPlugin * plugin) { /* debug category for fltering log messages * - * exchange the string 'Template edgedetect' with your description */ GST_DEBUG_CATEGORY_INIT (gst_edgedetect_debug, "edgedetect", 0, "Performs canny edge detection on videos and images"); diff --git a/ext/opencv/gstfaceblur.c b/ext/opencv/gstfaceblur.c index 3ac2af41b4..640756b4d3 100644 --- a/ext/opencv/gstfaceblur.c +++ b/ext/opencv/gstfaceblur.c @@ -269,7 +269,11 @@ gst_faceblur_chain (GstPad * pad, GstBuffer * buf) if (filter->cvCascade) { faces = cvHaarDetectObjects (filter->cvGray, filter->cvCascade, - filter->cvStorage, 1.1, 2, 0, cvSize (30, 30)); + filter->cvStorage, 1.1, 2, 0, cvSize (30, 30) +#if (CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >= 2) + , cvSize (32, 32) +#endif + ); if (faces && faces->total > 0) { buf = gst_buffer_make_writable (buf); diff --git a/ext/opencv/gstfaceblur.h b/ext/opencv/gstfaceblur.h index 34ea09a0a2..9c98ce8e89 100644 --- a/ext/opencv/gstfaceblur.h +++ b/ext/opencv/gstfaceblur.h @@ -49,6 +49,10 @@ #include #include +#if (CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >= 2) +#include +#endif + G_BEGIN_DECLS /* #defines don't like whitespacey bits */ #define GST_TYPE_FACEBLUR \ diff --git a/ext/opencv/gstfacedetect.c b/ext/opencv/gstfacedetect.c index 0254b74b65..49fa481660 100644 --- a/ext/opencv/gstfacedetect.c +++ b/ext/opencv/gstfacedetect.c @@ -46,7 +46,7 @@ /** * SECTION:element-facedetect * - * FIXME:Describe facedetect here. + * Performs face detection on videos and images. * * * Example launch line @@ -96,8 +96,6 @@ enum /** * GstOpencvFaceDetectFlags: - * @GST_CAMERABIN_FLAG_SOURCE_RESIZE: enable video crop and scale - * after capture * * Flags parameter to OpenCV's cvHaarDetectObjects function. */ @@ -205,7 +203,6 @@ gst_facedetect_class_init (GstfacedetectClass * klass) gobject_class = (GObjectClass *) klass; gstopencvbasefilter_class = (GstOpencvVideoFilterClass *) klass; - parent_class = g_type_class_peek_parent (klass); gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_facedetect_finalize); gobject_class->set_property = gst_facedetect_set_property; @@ -385,8 +382,8 @@ gst_facedetect_message_new (Gstfacedetect * filter, GstBuffer * buf) } -/* chain function - * this function does the actual processing +/* + * Performs the face detection */ static GstFlowReturn gst_facedetect_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf, @@ -408,8 +405,11 @@ gst_facedetect_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf, faces = cvHaarDetectObjects (filter->cvGray, filter->cvCascade, filter->cvStorage, filter->scale_factor, filter->min_neighbors, - filter->flags, - cvSize (filter->min_size_width, filter->min_size_height)); + filter->flags, cvSize (filter->min_size_width, filter->min_size_height) +#if (CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >= 2) + , cvSize (filter->min_size_width + 2, filter->min_size_height + 2) +#endif + ); if (faces && faces->total > 0) { msg = gst_facedetect_message_new (filter, buf); diff --git a/ext/opencv/gstfacedetect.h b/ext/opencv/gstfacedetect.h index fbb8718dc8..a5a0b49f4f 100644 --- a/ext/opencv/gstfacedetect.h +++ b/ext/opencv/gstfacedetect.h @@ -50,6 +50,10 @@ #include #include "gstopencvvideofilter.h" +#if (CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >= 2) +#include +#endif + G_BEGIN_DECLS /* #defines don't like whitespacey bits */ #define GST_TYPE_FACEDETECT \ diff --git a/ext/opencv/gstopencv.c b/ext/opencv/gstopencv.c index 5b25e30726..e12ca78028 100644 --- a/ext/opencv/gstopencv.c +++ b/ext/opencv/gstopencv.c @@ -34,7 +34,7 @@ #include "gstfacedetect.h" #include "gstpyramidsegment.h" #include "gsttemplatematch.h" -#include "gsttextwrite.h" +#include "gsttextoverlay.h" static gboolean plugin_init (GstPlugin * plugin) @@ -72,7 +72,7 @@ plugin_init (GstPlugin * plugin) if (!gst_templatematch_plugin_init (plugin)) return FALSE; - if (!gst_textwrite_plugin_init (plugin)) + if (!gst_opencv_text_overlay_plugin_init (plugin)) return FALSE; return TRUE; diff --git a/ext/opencv/gsttemplatematch.c b/ext/opencv/gsttemplatematch.c index bc15d815db..2d76aa8d3a 100644 --- a/ext/opencv/gsttemplatematch.c +++ b/ext/opencv/gsttemplatematch.c @@ -162,7 +162,7 @@ gst_templatematch_class_init (GstTemplateMatchClass * klass) /* initialize the new element * instantiate pads and add them to element - * set pad calback functions + * set pad callback functions * initialize instance structure */ static void @@ -315,19 +315,32 @@ gst_templatematch_chain (GstPad * pad, GstBuffer * buf) if ((!filter) || (!buf) || filter->template == NULL) { return GST_FLOW_OK; } + GST_DEBUG_OBJECT (filter, "Buffer size %u ", GST_BUFFER_SIZE (buf)); + filter->cvImage->imageData = (char *) GST_BUFFER_DATA (buf); if (!filter->cvDistImage) { - filter->cvDistImage = - cvCreateImage (cvSize (filter->cvImage->width - - filter->cvTemplateImage->width + 1, - filter->cvImage->height - filter->cvTemplateImage->height + 1), - IPL_DEPTH_32F, 1); - if (!filter->cvDistImage) { - GST_WARNING ("Couldn't create dist image."); + if (filter->cvTemplateImage->width > filter->cvImage->width) { + GST_WARNING ("Template Image is wider than input image"); + } else if (filter->cvTemplateImage->height > filter->cvImage->height) { + GST_WARNING ("Template Image is taller than input image"); + } else { + + GST_DEBUG_OBJECT (filter, "cvCreateImage (Size(%d-%d+1,%d) %d, %d)", + filter->cvImage->width, filter->cvTemplateImage->width, + filter->cvImage->height - filter->cvTemplateImage->height + 1, + IPL_DEPTH_32F, 1); + filter->cvDistImage = + cvCreateImage (cvSize (filter->cvImage->width - + filter->cvTemplateImage->width + 1, + filter->cvImage->height - filter->cvTemplateImage->height + 1), + IPL_DEPTH_32F, 1); + if (!filter->cvDistImage) { + GST_WARNING ("Couldn't create dist image."); + } } } - if (filter->cvTemplateImage) { + if (filter->cvTemplateImage && filter->cvImage && filter->cvDistImage) { GstStructure *s; GstMessage *m; @@ -389,8 +402,10 @@ gst_templatematch_load_template (GstTemplateMatch * filter) if (filter->template) { filter->cvTemplateImage = cvLoadImage (filter->template, CV_LOAD_IMAGE_COLOR); + if (!filter->cvTemplateImage) { - GST_WARNING ("Couldn't load template image: %s.", filter->template); + GST_WARNING ("Couldn't load template image: %s. error: %s", + filter->template, g_strerror (errno)); } } } diff --git a/ext/opencv/gsttextwrite.c b/ext/opencv/gsttextoverlay.c similarity index 79% rename from ext/opencv/gsttextwrite.c rename to ext/opencv/gsttextoverlay.c index 612e20a432..92169440fa 100644 --- a/ext/opencv/gsttextwrite.c +++ b/ext/opencv/gsttextoverlay.c @@ -44,14 +44,14 @@ */ /** - * SECTION:element-textwrite + * SECTION:element-opencvtextoverlay * - * FIXME:Describe textwrite here. + * opencvtextoverlay renders the text on top of the video frames * * * Example launch line * |[ - * gst-launch -v -m fakesrc ! textwrite ! fakesink silent=TRUE + * gst-launch-0.10 videotestsrc ! ffmpegcolorspace ! opencvtextoverlay text="Opencv Text Overlay " ! ffmpegcolorspace ! xvimagesink * ]| * */ @@ -63,10 +63,11 @@ #include #include "gstopencvutils.h" -#include "gsttextwrite.h" +#include "gsttextoverlay.h" + +GST_DEBUG_CATEGORY_STATIC (gst_opencv_text_overlay_debug); +#define GST_CAT_DEFAULT gst_opencv_opencv_text_overlay_debug -GST_DEBUG_CATEGORY_STATIC (gst_textwrite_debug); -#define GST_CAT_DEFAULT gst_textwrite_debug #define DEFAULT_PROP_TEXT "" #define DEFAULT_PROP_WIDTH 1 #define DEFAULT_PROP_HEIGHT 1 @@ -114,23 +115,25 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB) ); -GST_BOILERPLATE (Gsttextwrite, gst_textwrite, GstElement, GST_TYPE_ELEMENT); +GST_BOILERPLATE (GstOpencvTextOverlay, gst_opencv_text_overlay, GstElement, + GST_TYPE_ELEMENT); -static void gst_textwrite_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_textwrite_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); +static void gst_opencv_text_overlay_set_property (GObject * object, + guint prop_id, const GValue * value, GParamSpec * pspec); +static void gst_opencv_text_overlay_get_property (GObject * object, + guint prop_id, GValue * value, GParamSpec * pspec); -static gboolean gst_textwrite_set_caps (GstPad * pad, GstCaps * caps); -static GstFlowReturn gst_textwrite_chain (GstPad * pad, GstBuffer * buf); +static gboolean gst_opencv_text_overlay_set_caps (GstPad * pad, GstCaps * caps); +static GstFlowReturn gst_opencv_text_overlay_chain (GstPad * pad, + GstBuffer * buf); /* Clean up */ static void -gst_textwrite_finalize (GObject * obj) +gst_opencv_text_overlay_finalize (GObject * obj) { - Gsttextwrite *filter = GST_textwrite (obj); + GstOpencvTextOverlay *filter = GST_OPENCV_TEXT_OVERLAY (obj); if (filter->cvImage) { cvReleaseImage (&filter->cvImage); @@ -144,14 +147,14 @@ gst_textwrite_finalize (GObject * obj) /* GObject vmethod implementations */ static void -gst_textwrite_base_init (gpointer gclass) +gst_opencv_text_overlay_base_init (gpointer gclass) { GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); gst_element_class_set_details_simple (element_class, - "textwrite", + "opencvtextoverlay", "Filter/Effect/Video", - "Performs text writing to the video", "sreerenj"); + "Write text on the top of video", "sreerenj"); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&src_factory)); @@ -159,19 +162,20 @@ gst_textwrite_base_init (gpointer gclass) gst_static_pad_template_get (&sink_factory)); } -/* initialize the textwrite's class */ +/* initialize the opencvtextoverlay's class */ static void -gst_textwrite_class_init (GsttextwriteClass * klass) +gst_opencv_text_overlay_class_init (GstOpencvTextOverlayClass * klass) { GObjectClass *gobject_class; gobject_class = (GObjectClass *) klass; parent_class = g_type_class_peek_parent (klass); - gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_textwrite_finalize); + gobject_class->finalize = + GST_DEBUG_FUNCPTR (gst_opencv_text_overlay_finalize); - gobject_class->set_property = gst_textwrite_set_property; - gobject_class->get_property = gst_textwrite_get_property; + gobject_class->set_property = gst_opencv_text_overlay_set_property; + gobject_class->get_property = gst_opencv_text_overlay_get_property; g_object_class_install_property (gobject_class, PROP_TEXT, @@ -209,8 +213,6 @@ gst_textwrite_class_init (GsttextwriteClass * klass) "Sets the color -B", 0, 255, DEFAULT_PROP_COLOR, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (gobject_class, PROP_HEIGHT, g_param_spec_double ("height", "Height", "Sets the height of fonts", 1.0, 5.0, @@ -229,15 +231,16 @@ gst_textwrite_class_init (GsttextwriteClass * klass) * initialize instance structure */ static void -gst_textwrite_init (Gsttextwrite * filter, GsttextwriteClass * gclass) +gst_opencv_text_overlay_init (GstOpencvTextOverlay * filter, + GstOpencvTextOverlayClass * gclass) { filter->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink"); gst_pad_set_setcaps_function (filter->sinkpad, - GST_DEBUG_FUNCPTR (gst_textwrite_set_caps)); + GST_DEBUG_FUNCPTR (gst_opencv_text_overlay_set_caps)); gst_pad_set_getcaps_function (filter->sinkpad, GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps)); gst_pad_set_chain_function (filter->sinkpad, - GST_DEBUG_FUNCPTR (gst_textwrite_chain)); + GST_DEBUG_FUNCPTR (gst_opencv_text_overlay_chain)); filter->srcpad = gst_pad_new_from_static_template (&src_factory, "src"); gst_pad_set_getcaps_function (filter->srcpad, @@ -258,10 +261,10 @@ gst_textwrite_init (Gsttextwrite * filter, GsttextwriteClass * gclass) } static void -gst_textwrite_set_property (GObject * object, guint prop_id, +gst_opencv_text_overlay_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { - Gsttextwrite *filter = GST_textwrite (object); + GstOpencvTextOverlay *filter = GST_OPENCV_TEXT_OVERLAY (object); switch (prop_id) { case PROP_TEXT: @@ -301,10 +304,10 @@ gst_textwrite_set_property (GObject * object, guint prop_id, } static void -gst_textwrite_get_property (GObject * object, guint prop_id, +gst_opencv_text_overlay_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { - Gsttextwrite *filter = GST_textwrite (object); + GstOpencvTextOverlay *filter = GST_OPENCV_TEXT_OVERLAY (object); switch (prop_id) { case PROP_TEXT: @@ -344,15 +347,15 @@ gst_textwrite_get_property (GObject * object, guint prop_id, /* this function handles the link with other elements */ static gboolean -gst_textwrite_set_caps (GstPad * pad, GstCaps * caps) +gst_opencv_text_overlay_set_caps (GstPad * pad, GstCaps * caps) { - Gsttextwrite *filter; + GstOpencvTextOverlay *filter; GstPad *otherpad; gint width, height; GstStructure *structure; - filter = GST_textwrite (gst_pad_get_parent (pad)); + filter = GST_OPENCV_TEXT_OVERLAY (gst_pad_get_parent (pad)); structure = gst_caps_get_structure (caps, 0); gst_structure_get_int (structure, "width", &width); @@ -371,11 +374,11 @@ gst_textwrite_set_caps (GstPad * pad, GstCaps * caps) * this function does the actual processing */ static GstFlowReturn -gst_textwrite_chain (GstPad * pad, GstBuffer * buf) +gst_opencv_text_overlay_chain (GstPad * pad, GstBuffer * buf) { - Gsttextwrite *filter; + GstOpencvTextOverlay *filter; - filter = GST_textwrite (GST_OBJECT_PARENT (pad)); + filter = GST_OPENCV_TEXT_OVERLAY (GST_OBJECT_PARENT (pad)); filter->cvImage->imageData = (char *) GST_BUFFER_DATA (buf); @@ -396,15 +399,15 @@ gst_textwrite_chain (GstPad * pad, GstBuffer * buf) * register the element factories and other features */ gboolean -gst_textwrite_plugin_init (GstPlugin * plugin) +gst_opencv_text_overlay_plugin_init (GstPlugin * plugin) { /* debug category for fltering log messages * - * exchange the string 'Template textwrite' with your description + * exchange the string 'Template opencvtextoverlay' with your description */ - GST_DEBUG_CATEGORY_INIT (gst_textwrite_debug, "textwrite", - 0, "Template textwrite"); + GST_DEBUG_CATEGORY_INIT (gst_opencv_text_overlay_debug, "opencvtextoverlay", + 0, "Template opencvtextoverlay"); - return gst_element_register (plugin, "textwrite", GST_RANK_NONE, - GST_TYPE_textwrite); + return gst_element_register (plugin, "opencvtextoverlay", GST_RANK_NONE, + GST_TYPE_OPENCV_TEXT_OVERLAY); } diff --git a/ext/opencv/gsttextwrite.h b/ext/opencv/gsttextoverlay.h similarity index 70% rename from ext/opencv/gsttextwrite.h rename to ext/opencv/gsttextoverlay.h index 442519a61b..df0206bf5e 100644 --- a/ext/opencv/gsttextwrite.h +++ b/ext/opencv/gsttextoverlay.h @@ -2,7 +2,7 @@ * GStreamer * Copyright (C) 2005 Thomas Vander Stichele * Copyright (C) 2005 Ronald S. Bultje - * Copyright (C) 2010 root <>m + * Copyright (C) 2010 Sreerenj Balachandran * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -43,37 +43,34 @@ * Boston, MA 02111-1307, USA. */ -#ifndef __GST_textwrite_H__ -#define __GST_textwrite_H__ +#ifndef __GST_OPENCV_TEXT_OVERLAY_H__ +#define __GST_OPENCV_TEXT_OVERLAY_H__ #include -#include -#include -#include + G_BEGIN_DECLS /* #defines don't like whitespacey bits */ -#define GST_TYPE_textwrite \ - (gst_textwrite_get_type()) -#define GST_textwrite(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_textwrite,Gsttextwrite)) -#define GST_textwrite_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_textwrite,GsttextwriteClass)) -#define GST_IS_textwrite(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_textwrite)) -#define GST_IS_textwrite_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_textwrite)) +#define GST_TYPE_OPENCV_TEXT_OVERLAY \ + (gst_opencv_text_overlay_get_type()) +#define GST_OPENCV_TEXT_OVERLAY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OPENCV_TEXT_OVERLAY,GstOpencvTextOverlay)) +#define GST_OPECV_TEXT_OVERLAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OPECV_TEXT_OVERLAY,GstOpencvTextOverlayClass)) +#define GST_IS_OPENCV_TEXT_OVERLAY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OPENCV_TEXT_OVERLAY)) +#define GST_IS_OPENCV_TEXT_OVERLAY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OPENCV_TEXT_OVERLAY)) -typedef struct _Gsttextwrite Gsttextwrite; -typedef struct _GsttextwriteClass GsttextwriteClass; +typedef struct _GstOpencvTextOverlay GstOpencvTextOverlay; +typedef struct _GstOpencvTextOverlayClass GstOpencvTextOverlayClass; -struct _Gsttextwrite +struct _GstOpencvTextOverlay { GstElement element; GstPad *sinkpad, *srcpad; - IplImage *cvImage; CvMemStorage *cvStorage; CvFont font; @@ -88,14 +85,14 @@ struct _Gsttextwrite }; -struct _GsttextwriteClass +struct _GstOpencvTextOverlayClass { GstElementClass parent_class; }; -GType gst_textwrite_get_type (void); -gboolean gst_textwrite_plugin_init (GstPlugin * plugin); +GType gst_opencv_text_overlay_get_type (void); +gboolean gst_opencv_text_overlay_plugin_init (GstPlugin * plugin); G_END_DECLS -#endif /* __GST_textwrite_H__ */ +#endif /* __GST_OPENCV_TEXT_OVERLAY_H__ */ diff --git a/ext/resindvd/resindvdbin.c b/ext/resindvd/resindvdbin.c index e329568e1f..c2dcc5b2df 100644 --- a/ext/resindvd/resindvdbin.c +++ b/ext/resindvd/resindvdbin.c @@ -118,10 +118,8 @@ static void rsn_dvdbin_class_init (RsnDvdBinClass * klass) { GObjectClass *gobject_class; - GstElementClass *gstelement_class; gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; gobject_class->finalize = rsn_dvdbin_finalize; gobject_class->set_property = rsn_dvdbin_set_property; diff --git a/ext/resindvd/rsnparsetter.c b/ext/resindvd/rsnparsetter.c index c3580b8868..a69366f9d5 100644 --- a/ext/resindvd/rsnparsetter.c +++ b/ext/resindvd/rsnparsetter.c @@ -73,10 +73,8 @@ static void rsn_parsetter_class_init (RsnParSetterClass * klass) { GObjectClass *gobject_class; - GstElementClass *gstelement_class; gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; gobject_class->finalize = rsn_parsetter_finalize; } diff --git a/ext/schroedinger/gstschrodec.c b/ext/schroedinger/gstschrodec.c index 2282f7ee69..ab2c45a2c3 100644 --- a/ext/schroedinger/gstschrodec.c +++ b/ext/schroedinger/gstschrodec.c @@ -382,9 +382,7 @@ parse_sequence_header (GstSchroDec * schro_dec, guint8 * data, int size) state->par_d = video_format.aspect_ratio_denominator; GST_DEBUG ("Pixel aspect ratio is %d/%d", state->par_n, state->par_d); - /* FIXME state points to what is actually in the decoder */ - //gst_base_video_decoder_set_state (GST_BASE_VIDEO_DECODER (schro_dec), - // state); + gst_base_video_decoder_set_src_caps (GST_BASE_VIDEO_DECODER (schro_dec)); } else { GST_WARNING ("Failed to get frame rate from sequence header"); } @@ -571,28 +569,18 @@ gst_schro_dec_process (GstSchroDec * schro_dec, gboolean eos) GstBuffer *outbuf; GstVideoState *state; SchroFrame *schro_frame; - GstFlowReturn flow_ret; - int size; GST_DEBUG ("need frame"); state = gst_base_video_decoder_get_state (GST_BASE_VIDEO_DECODER (schro_dec)); - size = - gst_video_format_get_size (state->format, state->width, + outbuf = + gst_base_video_decoder_alloc_src_buffer (GST_BASE_VIDEO_DECODER + (schro_dec)); + schro_frame = + gst_schro_buffer_wrap (outbuf, state->format, state->width, state->height); - flow_ret = - gst_pad_alloc_buffer_and_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD - (schro_dec), GST_BUFFER_OFFSET_NONE, size, - GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (schro_dec)), &outbuf); - if (flow_ret != GST_FLOW_OK) { - go = FALSE; - ret = flow_ret; - break; - } - schro_frame = gst_schro_buffer_wrap (outbuf, - state->format, state->width, state->height); schro_decoder_add_output_picture (schro_dec->decoder, schro_frame); break; } @@ -642,6 +630,8 @@ gst_schro_dec_process (GstSchroDec * schro_dec, gboolean eos) GST_DEBUG ("codec error"); ret = GST_FLOW_ERROR; break; + default: + break; } } return ret; @@ -659,8 +649,6 @@ gst_schro_dec_handle_frame (GstBaseVideoDecoder * base_video_decoder, GST_DEBUG ("handle frame"); - gst_base_video_decoder_set_src_caps (base_video_decoder); - input_buffer = gst_schro_wrap_gst_buffer (frame->sink_buffer); frame->sink_buffer = NULL; @@ -680,8 +668,6 @@ gst_schro_dec_finish (GstBaseVideoDecoder * base_video_decoder) GST_DEBUG ("finish"); - gst_base_video_decoder_set_src_caps (base_video_decoder); - schro_decoder_autoparse_push_end_of_sequence (schro_dec->decoder); return gst_schro_dec_process (schro_dec, TRUE); diff --git a/ext/schroedinger/gstschroenc.c b/ext/schroedinger/gstschroenc.c index 7af28eac2a..16a3af95a2 100644 --- a/ext/schroedinger/gstschroenc.c +++ b/ext/schroedinger/gstschroenc.c @@ -338,6 +338,8 @@ gst_schro_enc_set_format (GstBaseVideoEncoder * base_video_encoder, gst_schro_wrap_schro_buffer (schro_encoder_encode_sequence_header (schro_enc->encoder)); + schro_enc->granule_offset = ~0; + return TRUE; } @@ -413,10 +415,6 @@ gst_schro_enc_get_property (GObject * object, guint prop_id, GValue * value, static gboolean gst_schro_enc_start (GstBaseVideoEncoder * base_video_encoder) { - GstSchroEnc *schro_enc = GST_SCHRO_ENC (base_video_encoder); - - schro_enc->granule_offset = ~0; - return TRUE; } @@ -648,7 +646,8 @@ gst_schro_enc_shape_output_ogg (GstBaseVideoEncoder * base_video_encoder, GST_BUFFER_OFFSET_END (buf) = schro_enc->last_granulepos; } - gst_buffer_set_caps (buf, GST_BASE_VIDEO_CODEC (base_video_encoder)->caps); + gst_buffer_set_caps (buf, + GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder))); return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), buf); } @@ -680,7 +679,8 @@ gst_schro_enc_shape_output_quicktime (GstBaseVideoEncoder * base_video_encoder, GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); } - gst_buffer_set_caps (buf, GST_BASE_VIDEO_CODEC (base_video_encoder)->caps); + gst_buffer_set_caps (buf, + GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder))); return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), buf); } @@ -716,7 +716,8 @@ gst_schro_enc_shape_output_mp4 (GstBaseVideoEncoder * base_video_encoder, GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); } - gst_buffer_set_caps (buf, GST_BASE_VIDEO_CODEC (base_video_encoder)->caps); + gst_buffer_set_caps (buf, + GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder))); return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), buf); } @@ -782,7 +783,7 @@ gst_schro_enc_process (GstSchroEnc * schro_enc) buf = gst_buffer_new_and_alloc (sizeof (double) * 21); schro_encoder_get_frame_stats (schro_enc->encoder, (double *) GST_BUFFER_DATA (buf), 21); - structure = gst_structure_new ("schroenc", + structure = gst_structure_new ("GstSchroEnc", "frame-stats", GST_TYPE_BUFFER, buf, NULL); gst_buffer_unref (buf); message = gst_message_new_element (GST_OBJECT (schro_enc), structure); diff --git a/ext/tarkin/Makefile.am b/ext/tarkin/Makefile.am deleted file mode 100644 index 7bc190908a..0000000000 --- a/ext/tarkin/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ - -plugin_LTLIBRARIES = libgsttarkin.la - -libgsttarkin_la_SOURCES = tarkin.c \ - mem.c wavelet.c wavelet_xform.c \ - wavelet_coeff.c yuv.c info.c \ - gsttarkin.c gsttarkinenc.c gsttarkindec.c - -libgsttarkin_la_CFLAGS = $(GST_CFLAGS) $(VORBIS_CFLAGS) -DTYPE_BITS=10 -DTYPE=int16_t -DRLECODER -## AM_PATH_VORBIS also sets VORBISENC_LIBS -libgsttarkin_la_LIBADD = $(VORBIS_LIBS) $(VORBISENC_LIBS) -libgsttarkin_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -libgsttarkin_la_LIBTOOLFLAGS = --tag=disable-static - -noinst_HEADERS = gsttarkinenc.h mem.h tarkin.h yuv.h wavelet.h diff --git a/ext/tarkin/README b/ext/tarkin/README deleted file mode 100644 index ee91356d1a..0000000000 --- a/ext/tarkin/README +++ /dev/null @@ -1,8 +0,0 @@ -This is a video codec based on an integer wavelet in 3 dimensions (x, -y, and time/frame). What documentation exists so far is on the -vorbis-dev and (now) tarkin-dev mailing lists at xiph.org. Some brief -documentation can be found in the w3d/docs directory. - -For sample / test streams, see http://media.xiph.org/ -(and feel free to submit more streams if you have them). - diff --git a/ext/tarkin/TODO b/ext/tarkin/TODO deleted file mode 100644 index 909d377168..0000000000 --- a/ext/tarkin/TODO +++ /dev/null @@ -1,42 +0,0 @@ - - -Most important things: - - - the entropy coder, replace static huffman - - clean up the pnsr tools - - write docs and do some performance analysis, compare to other codecs - - think about a multiresolution multidimensional motion flow detection scheme, - Marco posted a good paper comparing different algorithms to do this - - -Open bugs and stuff required to fix them: - - - wavelet xform bug at short rows, see workaround in wavelet_xform.c - - (4,x) and (x,4) wavelet implementations have a bug which causes round-off - errors in the two least significand bits - - -Wavelet-related TODO's: - - - remove unecessairy copying in inverse xform - - improve truncation table setup - - try other approaches to encode coefficients, jack was talking about VQ - and reuse vorbis code - - write avitotarkin/quicktimetotarkin/mpegtotarkin/player/recorder - (a libsndfile/libaudiofile/libao alike video library would be great !) - - profile - - add special transform functions for large strides to prevent cache misses - - mmx/3dnow/sse/altivec - - -Other: - - - u and v buffers could get quarter size already at color conversion - this would speed up the whole algorithm; perhaps this should get - configurable - - fast internal 16bitY/U/V->15/16bitRGB for display could make sense - - the wavelet codec could be used for still image compression too - (we just have to define a file format with all goodies you can imagine;) - - to make it perfect someone has to write a good bilevel compressor and - mask seperation algorithm - diff --git a/ext/tarkin/WHAT_THE_HECK_IS_THIS_CODE_DOING b/ext/tarkin/WHAT_THE_HECK_IS_THIS_CODE_DOING deleted file mode 100644 index 4660260582..0000000000 --- a/ext/tarkin/WHAT_THE_HECK_IS_THIS_CODE_DOING +++ /dev/null @@ -1,61 +0,0 @@ - -This is deprecated. Take a look in the w3d/docs directory. - -The command line semantics are changed. You have to call the test program -now like this: - -./tarkin_enc ../clips/venuscubes-ppm/AnimSpace00%03d.ppm 5000 4 4 -./tarkin_dec - ------------------------------------------------------------------------------- - -Hi, - -this is a experimental 3d-integer-wavelet-video compression codec. Since the -integer wavelet transform is reversible and a reversible rgb-yuv conversion -is used (you can understand it as (1,2) integer wavelet transform, too), this -codec should be lossless if you transmit the whole bitstream. -The Y/U/V-bitstreams are embedded, thus you can simply get lossy compression -and shape the used bandwith by cutting bitstreams, when a user defined limit -is reached. - - -Here is how the current code works: - -First we grab a block of N_FRAMES frames (defined in main.c) of .ppm files. -Then each pixel becomes transformed into a YUV-alike colorspace. Take a look in -yuv.c to see how it is done. Each component is then transformed into frequency -space by applying the wavelet transform in x, y and frame direction. -The frame-direction transform is our high-order 'motion compensation'. -At boundaries we use (1,1)-Wavelets (== HAAR transform), inside the image -(2,2)-Wavelets. (4,4)-Wavelets should be easy to add. See wavelet.c for details. - -The resulting coefficients are scanned bitplane by bitplane and -runlength-encoded. Runlengths are Huffman-compressed and written into the -bitstreams. The bitplanes of higher-frequency scales are offset'ed to ensure a -fast transmission of high-energy-low-frequency coefficients. (coder.c) -The huffman coder is quite simple and uses a hardcoded table, this can be done -much better, but I wanted to get it working fast. - -Decompression works exactly like compression but in reversed direction. - -The test program writes for each frame the grabbed original image, the y/u/v -component (may look strange, since u/v can be negative and are not clamped to -the [0:255] range), the coefficients (look much more like usual wavelet -coefficients if you add 128 to each pixel), the coefficients after they are -runlength/huffman encoded and decoded, the y/u/v components when inverse wavelet -transform is done and the output image in .ppm format. - -You can call the test program like this: - - $ ./main 20000 5000 5000 ../clips/%i.ppm - -which means: images are grabbed from directory ../clips/0.ppm, ../clips/1.ppm, -etc. The Y component bitstream is limited to 20000 Bytes, the U and V bitstreams -to 5000 Bytes. If the last argument is omitted, frames are taken from current -directory. - -Good Luck, - -- Holger - diff --git a/ext/tarkin/bitcoder.h b/ext/tarkin/bitcoder.h deleted file mode 100644 index 312cd8871b..0000000000 --- a/ext/tarkin/bitcoder.h +++ /dev/null @@ -1,148 +0,0 @@ -#ifndef __BITCODER_H -#define __BITCODER_H - -#include "mem.h" - -#if defined(BITCODER) - -#define OUTPUT_BIT(coder,bit) bitcoder_write_bit(coder,bit) -#define INPUT_BIT(coder) bitcoder_read_bit(coder) -#define OUTPUT_BIT_DIRECT(coder,bit) bitcoder_write_bit(coder,bit) -#define INPUT_BIT_DIRECT(coder) bitcoder_read_bit(coder) -#define ENTROPY_CODER BitCoderState -#define ENTROPY_ENCODER_init(coder,limit) bitcoder_coder_init(coder,limit) -#define ENTROPY_ENCODER_DONE(coder) bitcoder_encoder_done(coder) -#define ENTROPY_ENCODER_FLUSH(coder) bitcoder_flush(coder) -#define ENTROPY_DECODER_INIT(coder,bitstream,limit) \ - bitcoder_decoder_init(coder,bitstream,limit) -#define ENTROPY_DECODER_DONE(coder) /* nothing to do ... */ -#define ENTROPY_CODER_BITSTREAM(coder) (coder)->bitstream - -#define ENTROPY_CODER_SYMBOL(coder) 1 -#define ENTROPY_CODER_RUNLENGTH(coder) 0 -#define ENTROPY_CODER_SKIP(coder,skip) - -#endif - - -typedef struct { - int32_t bit_count; /* number of valid bits in byte */ - uint8_t byte; /* buffer to save bits */ - uint32_t byte_count; /* number of bytes written */ - uint8_t *bitstream; - uint32_t limit; /* don't write more bytes to bitstream ... */ - int eos; /* end of stream reached */ -} BitCoderState; - - - -static inline -void bitcoder_encoder_init (BitCoderState *s, uint32_t limit) -{ - s->bit_count = 0; - s->byte = 0; - s->byte_count = 0; - s->bitstream = (uint8_t*) MALLOC (limit); - s->limit = limit; - s->eos = 0; -} - - -static inline -void bitcoder_encoder_done (BitCoderState *s) -{ - FREE (s->bitstream); -} - - -static inline -void bitcoder_decoder_init (BitCoderState *s, uint8_t *bitstream, uint32_t limit) -{ - s->bit_count = -1; - s->byte = 0; - s->byte_count = 0; - s->bitstream = bitstream; - s->limit = limit; - s->eos = 0; -} - - -static inline -uint32_t bitcoder_flush (BitCoderState *s) -{ - if (s->bit_count > 0 && s->byte_count < s->limit) - s->bitstream [s->byte_count++] = s->byte << (8 - s->bit_count); - -/*printf ("%s: %i bytes written.\n", __FUNCTION__, s->byte_count); */ -/*printf ("%s: last bit %i\n", __FUNCTION__, s->bit_count); */ - return s->byte_count; -} - - - -static inline -void bitcoder_write_bit (BitCoderState *s, int bit) -{ - s->byte <<= 1; - s->byte |= bit & 1; - - s->bit_count++; - - if (s->bit_count == 8) { - if (s->byte_count < s->limit) { - s->bitstream [s->byte_count++] = s->byte; - s->bit_count = 0; - } else { - s->eos = 1; - } - } -} - - -static inline -int bitcoder_read_bit (BitCoderState *s) -{ - int ret; - - if (s->bit_count <= 0) { - if (!s->bitstream) { - s->eos = 1; - return 0; - } - - if (s->byte_count < s->limit) { - s->byte = s->bitstream [s->byte_count++]; - } else { - s->eos = 1; - s->byte = 0; - } - - s->bit_count = 8; - } - - ret = s->byte >> 7; - s->byte <<= 1; - s->bit_count--; - - return ret & 1; -} - - - - - - -static inline -void bit_print (TYPE byte) -{ - int bit = 8*sizeof(TYPE); - - do { - bit--; - printf ((byte & (1 << bit)) ? "1" : "0"); - } while (bit); - printf ("\n"); -} - -#endif - diff --git a/ext/tarkin/golomb.h b/ext/tarkin/golomb.h deleted file mode 100644 index 95e63c304f..0000000000 --- a/ext/tarkin/golomb.h +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef __GOLOMB_H -#define __GOLOMB_H - - -#include "bitcoder.h" - - -static inline -unsigned int required_bits (unsigned int x) -{ - int bits = 31; - - while ((x & (1 << bits)) == 0 && bits) - bits--; - - return bits; -} - - -static inline -void write_number_binary (BitCoderState *b, unsigned int x, int bits, int u) -{ -/*printf ("wrote %i with %i bits (%i+%i)\n", x, u+bits, u, bits); */ - while (bits) { - bits--; - bitcoder_write_bit (b, (x >> bits) & 1); - } -} - - -static inline -unsigned int read_number_binary (BitCoderState *b, int bits) -{ - unsigned int x = 0; - - while (bits) { - bits--; - x |= bitcoder_read_bit (b) << bits; - } - - return x; -} - - -static inline -void golomb_write_number (BitCoderState *b, unsigned int x, int bits) -{ - unsigned int q, r; -int i = 0; - - assert (x > 0); - - while ((q = (x - 1) >> bits) > 0) { - bitcoder_write_bit (b, 1); /* fast temporary adaption, write */ - bits++; /* unary representation of q */ -i++; - }; - - bitcoder_write_bit (b, 0); - - r = x - 1 - (q << bits); - - write_number_binary (b, r, bits, i+1); -} - - -static inline -unsigned int golomb_read_number (BitCoderState *b, int bits) -{ - unsigned int q = 0, r, x; - - while (bitcoder_read_bit (b) != 0) { - bits++; - } - - r = read_number_binary (b, bits); - x = (q << bits) + r + 1; - - return x; -} - - -typedef struct { - uint8_t count; - uint8_t bits; /* a 5.3 fixed point integer */ -} GolombAdaptiveCoderState; - -#define GOLOMB_ADAPTIVE_CODER_STATE_INITIALIZER { 8<<3, 0 } - - -static const int golomb_w_tab [] = { 256, 128, 64 }; - - - - -static inline -void golombcoder_encode_number (GolombAdaptiveCoderState *g, - BitCoderState *b, - unsigned int x) -{ - golomb_write_number (b, x, g->bits >> 3); - - g->bits = ((256 - golomb_w_tab[g->count]) * (int) g->bits + - golomb_w_tab[g->count] * (required_bits(x)<<3)) / 256; - g->count++; - - if (g->count > 2) - g->count = 2; -} - - -static inline -unsigned int golombcoder_decode_number (GolombAdaptiveCoderState *g, - BitCoderState *b) -{ - unsigned int x; - - x = golomb_read_number (b, g->bits >> 3); - - g->bits = ((256 - golomb_w_tab[g->count]) * g->bits + - golomb_w_tab[g->count] * (required_bits(x)<<3)) / 256; - g->count++; - - if (g->count > 2) - g->count = 2; - - return x; -} - - -#endif - diff --git a/ext/tarkin/gsttarkindec.c b/ext/tarkin/gsttarkindec.c deleted file mode 100644 index f6b1e834c0..0000000000 --- a/ext/tarkin/gsttarkindec.c +++ /dev/null @@ -1,334 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include -#include - -#include "gsttarkindec.h" - -static GstPadTemplate *dec_src_template, *dec_sink_template; - -/* TarkinDec signals and args */ -enum -{ - /* FILL ME */ - LAST_SIGNAL -}; - -enum -{ - ARG_0, - ARG_BITRATE -}; - -static void gst_tarkindec_base_init (gpointer g_class); -static void gst_tarkindec_class_init (TarkinDecClass * klass); -static void gst_tarkindec_init (TarkinDec * arkindec); - -static void gst_tarkindec_chain (GstPad * pad, GstData * _data); -static void gst_tarkindec_setup (TarkinDec * tarkindec); -static GstStateChangeReturn gst_tarkindec_change_state (GstElement * element, - GstStateChange transition); - -static void gst_tarkindec_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); -static void gst_tarkindec_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); - -static GstElementClass *parent_class = NULL; - -/*static guint gst_tarkindec_signals[LAST_SIGNAL] = { 0 }; */ - -GType -tarkindec_get_type (void) -{ - static GType tarkindec_type = 0; - - if (!tarkindec_type) { - static const GTypeInfo tarkindec_info = { - sizeof (TarkinDecClass), - gst_tarkindec_base_init, - NULL, - (GClassInitFunc) gst_tarkindec_class_init, - NULL, - NULL, - sizeof (TarkinDec), - 0, - (GInstanceInitFunc) gst_tarkindec_init, - }; - - tarkindec_type = - g_type_register_static (GST_TYPE_ELEMENT, "TarkinDec", &tarkindec_info, - 0); - } - return tarkindec_type; -} - -static GstCaps * -tarkin_caps_factory (void) -{ - return gst_caps_new ("tarkin_tarkin", "application/ogg", NULL); -} - -static GstCaps * -raw_caps_factory (void) -{ - return - GST_CAPS_NEW ("tarkin_raw", - "video/x-raw-rgb", - "bpp", GST_PROPS_INT (24), - "depth", GST_PROPS_INT (24), - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "red_mask", GST_PROPS_INT (0xff0000), - "green_mask", GST_PROPS_INT (0xff00), - "blue_mask", GST_PROPS_INT (0xff), - "width", GST_PROPS_INT_RANGE (0, G_MAXINT), - "height", GST_PROPS_INT_RANGE (0, G_MAXINT), - "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT) - ); -} - -static void -gst_tarkindec_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - GstCaps *raw_caps, *tarkin_caps; - - raw_caps = raw_caps_factory (); - tarkin_caps = tarkin_caps_factory (); - - dec_sink_template = gst_pad_template_new ("sink", - GST_PAD_SINK, GST_PAD_ALWAYS, tarkin_caps, NULL); - dec_src_template = gst_pad_template_new ("src", - GST_PAD_SRC, GST_PAD_ALWAYS, raw_caps, NULL); - gst_element_class_add_pad_template (element_class, dec_sink_template); - gst_element_class_add_pad_template (element_class, dec_src_template); - - gst_element_class_set_details_simple (element_class, "Tarkin video decoder", - "Codec/Decoder/Video", - "Decodes video in OGG Tarkin format", - "Monty , " "Wim Taymans "); -} - -static void -gst_tarkindec_class_init (TarkinDecClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE, - g_param_spec_int ("bitrate", "bitrate", "bitrate", - G_MININT, G_MAXINT, 3000, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - parent_class = g_type_class_peek_parent (klass); - - gobject_class->set_property = gst_tarkindec_set_property; - gobject_class->get_property = gst_tarkindec_get_property; - - gstelement_class->change_state = gst_tarkindec_change_state; -} - -static void -gst_tarkindec_init (TarkinDec * tarkindec) -{ - tarkindec->sinkpad = gst_pad_new_from_template (dec_sink_template, "sink"); - gst_element_add_pad (GST_ELEMENT (tarkindec), tarkindec->sinkpad); - gst_pad_set_chain_function (tarkindec->sinkpad, gst_tarkindec_chain); - - tarkindec->srcpad = gst_pad_new_from_template (dec_src_template, "src"); - gst_element_add_pad (GST_ELEMENT (tarkindec), tarkindec->srcpad); - - tarkindec->bitrate = 3000; - tarkindec->setup = FALSE; - tarkindec->nheader = 0; - - /* we're chained and we can deal with events */ - GST_OBJECT_FLAG_SET (tarkindec, GST_ELEMENT_EVENT_AWARE); -} - -static void -gst_tarkindec_setup (TarkinDec * tarkindec) -{ - tarkindec->tarkin_stream = tarkin_stream_new (); - - ogg_sync_init (&tarkindec->oy); - ogg_stream_init (&tarkindec->os, 1); - tarkin_info_init (&tarkindec->ti); - tarkin_comment_init (&tarkindec->tc); - - tarkindec->setup = TRUE; -} - -static void -gst_tarkindec_chain (GstPad * pad, GstData * _data) -{ - GstBuffer *buf = GST_BUFFER (_data); - TarkinDec *tarkindec; - - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (buf != NULL); - - tarkindec = GST_TARKINDEC (gst_pad_get_parent (pad)); - - if (!tarkindec->setup) { - GST_ELEMENT_ERROR (tarkindec, CORE, NEGOTATION, (NULL), - ("decoder not initialized (input is not tarkin?)")); - if (GST_IS_BUFFER (buf)) - gst_buffer_unref (buf); - else - gst_pad_event_default (pad, GST_EVENT (buf)); - return; - } - - if (GST_IS_EVENT (buf)) { - switch (GST_EVENT_TYPE (buf)) { - case GST_EVENT_EOS: - default: - gst_pad_event_default (pad, GST_EVENT (buf)); - break; - } - } else { - gchar *data; - gulong size; - gchar *buffer; - guchar *rgb; - TarkinTime date; - TarkinVideoLayerDesc *layer; - - /* data to decode */ - data = GST_BUFFER_DATA (buf); - size = GST_BUFFER_SIZE (buf); - - buffer = ogg_sync_buffer (&tarkindec->oy, size); - memcpy (buffer, data, size); - ogg_sync_wrote (&tarkindec->oy, size); - - if (ogg_sync_pageout (&tarkindec->oy, &tarkindec->og)) { - ogg_stream_pagein (&tarkindec->os, &tarkindec->og); - - while (ogg_stream_packetout (&tarkindec->os, &tarkindec->op)) { - if (tarkindec->op.e_o_s) - break; - if (tarkindec->nheader < 3) { /* 3 first packets to headerin */ - tarkin_synthesis_headerin (&tarkindec->ti, &tarkindec->tc, - &tarkindec->op); - - if (tarkindec->nheader == 2) { - tarkin_synthesis_init (tarkindec->tarkin_stream, &tarkindec->ti); - } - tarkindec->nheader++; - } else { - tarkin_synthesis_packetin (tarkindec->tarkin_stream, &tarkindec->op); - - while (tarkin_synthesis_frameout (tarkindec->tarkin_stream, &rgb, 0, - &date) == 0) { - GstBuffer *outbuf; - - layer = &tarkindec->tarkin_stream->layer->desc; - - if (!GST_PAD_CAPS (tarkindec->srcpad)) { - if (gst_pad_try_set_caps (tarkindec->srcpad, GST_CAPS_NEW ("tarkin_raw", "video/x-raw-rgb", "bpp", GST_PROPS_INT (24), "depth", GST_PROPS_INT (24), "endianness", GST_PROPS_INT (G_BYTE_ORDER), "red_mask", GST_PROPS_INT (0xff0000), "green_mask", GST_PROPS_INT (0xff00), "blue_mask", GST_PROPS_INT (0xff), "width", GST_PROPS_INT (layer->width), "height", GST_PROPS_INT (layer->height), "framerate", GST_PROPS_FLOAT (0.) /* FIXME!!! */ - )) <= 0) { - GST_ELEMENT_ERROR (tarkindec, CORE, NEGOTATION, (NULL), - ("could not output format")); - gst_buffer_unref (buf); - return; - } - } - outbuf = gst_buffer_new (); - GST_BUFFER_DATA (outbuf) = rgb; - GST_BUFFER_SIZE (outbuf) = layer->width * layer->height * 3; - GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_DONTFREE); - gst_pad_push (tarkindec->srcpad, GST_DATA (outbuf)); - - tarkin_synthesis_freeframe (tarkindec->tarkin_stream, rgb); - } - } - } - } - gst_buffer_unref (buf); - } -} - -static GstStateChangeReturn -gst_tarkindec_change_state (GstElement * element, GstStateChange transition) -{ - TarkinDec *tarkindec; - - tarkindec = GST_TARKINDEC (element); - - switch (transition) { - case GST_STATE_CHANGE_READY_TO_PAUSED: - gst_tarkindec_setup (tarkindec); - break; - case GST_STATE_CHANGE_PAUSED_TO_READY: - break; - default: - break; - } - - return parent_class->change_state (element, transition); -} - -static void -gst_tarkindec_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - TarkinDec *tarkindec; - - g_return_if_fail (GST_IS_TARKINDEC (object)); - - tarkindec = GST_TARKINDEC (object); - - switch (prop_id) { - case ARG_BITRATE: - g_value_set_int (value, tarkindec->bitrate); - break; - default: - break; - } -} - -static void -gst_tarkindec_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - TarkinDec *tarkindec; - - g_return_if_fail (GST_IS_TARKINDEC (object)); - - tarkindec = GST_TARKINDEC (object); - - switch (prop_id) { - case ARG_BITRATE: - tarkindec->bitrate = g_value_get_int (value); - break; - default: - break; - } -} diff --git a/ext/tarkin/gsttarkindec.h b/ext/tarkin/gsttarkindec.h deleted file mode 100644 index 41e55a1bcc..0000000000 --- a/ext/tarkin/gsttarkindec.h +++ /dev/null @@ -1,82 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __TARKINDEC_H__ -#define __TARKINDEC_H__ - - -#include - -#include "tarkin.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define GST_TYPE_TARKINDEC \ - (tarkindec_get_type()) -#define GST_TARKINDEC(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TARKINDEC,TarkinDec)) -#define GST_TARKINDEC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TARKINDEC,TarkinDecClass)) -#define GST_IS_TARKINDEC(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TARKINDEC)) -#define GST_IS_TARKINDEC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TARKINDEC)) - -typedef struct _TarkinDec TarkinDec; -typedef struct _TarkinDecClass TarkinDecClass; - -struct _TarkinDec { - GstElement element; - - GstPad *sinkpad,*srcpad; - - ogg_sync_state oy; - ogg_stream_state os; - ogg_page og; - ogg_packet op; - - TarkinStream *tarkin_stream; - TarkinComment tc; - TarkinInfo ti; - TarkinVideoLayerDesc layer[1]; - - gint frame_num; - gint nheader; - - gboolean eos; - gint bitrate; - gboolean setup; -}; - -struct _TarkinDecClass { - GstElementClass parent_class; -}; - -GType tarkindec_get_type(void); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __TARKINDEC_H__ */ diff --git a/ext/tarkin/gsttarkinenc.c b/ext/tarkin/gsttarkinenc.c deleted file mode 100644 index 7390da3b8d..0000000000 --- a/ext/tarkin/gsttarkinenc.c +++ /dev/null @@ -1,414 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include -#include - -#include "gsttarkinenc.h" - -static GstPadTemplate *enc_src_template, *enc_sink_template; - -/* TarkinEnc signals and args */ -enum -{ - /* FILL ME */ - LAST_SIGNAL -}; - -enum -{ - ARG_0, - ARG_BITRATE, - ARG_S_MOMENTS, - ARG_A_MOMENTS -}; - -static void gst_tarkinenc_base_init (gpointer g_class); -static void gst_tarkinenc_class_init (TarkinEncClass * klass); -static void gst_tarkinenc_init (TarkinEnc * arkinenc); - -static void gst_tarkinenc_chain (GstPad * pad, GstData * _data); -static void gst_tarkinenc_setup (TarkinEnc * tarkinenc); - -static void gst_tarkinenc_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); -static void gst_tarkinenc_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); - -static GstElementClass *parent_class = NULL; - -/*static guint gst_tarkinenc_signals[LAST_SIGNAL] = { 0 }; */ - -GType -tarkinenc_get_type (void) -{ - static GType tarkinenc_type = 0; - - if (!tarkinenc_type) { - static const GTypeInfo tarkinenc_info = { - sizeof (TarkinEncClass), - gst_tarkinenc_base_init, - NULL, - (GClassInitFunc) gst_tarkinenc_class_init, - NULL, - NULL, - sizeof (TarkinEnc), - 0, - (GInstanceInitFunc) gst_tarkinenc_init, - }; - - tarkinenc_type = - g_type_register_static (GST_TYPE_ELEMENT, "TarkinEnc", &tarkinenc_info, - 0); - } - return tarkinenc_type; -} - -static GstCaps * -tarkin_caps_factory (void) -{ - return gst_caps_new ("tarkin_tarkin", "application/ogg", NULL); -} - -static GstCaps * -raw_caps_factory (void) -{ - return - GST_CAPS_NEW ("tarkin_raw", - "video/x-raw-rgb", - "bpp", GST_PROPS_INT (24), - "depth", GST_PROPS_INT (24), - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "red_mask", GST_PROPS_INT (0xff0000), - "green_mask", GST_PROPS_INT (0xff00), - "blue_mask", GST_PROPS_INT (0xff), - "width", GST_PROPS_INT_RANGE (0, G_MAXINT), - "height", GST_PROPS_INT_RANGE (0, G_MAXINT), - "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT) - ); -} - -static void -gst_tarkinenc_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - GstCaps *raw_caps, *tarkin_caps; - - raw_caps = raw_caps_factory (); - tarkin_caps = tarkin_caps_factory (); - - enc_sink_template = gst_pad_template_new ("sink", - GST_PAD_SINK, GST_PAD_ALWAYS, raw_caps, NULL); - enc_src_template = gst_pad_template_new ("src", - GST_PAD_SRC, GST_PAD_ALWAYS, tarkin_caps, NULL); - gst_element_class_add_pad_template (element_class, enc_sink_template); - gst_element_class_add_pad_template (element_class, enc_src_template); - - gst_element_class_set_details_simple (element_class, "Tarkin video encoder", - "Codec/Encoder/Video", - "Encodes video in OGG Tarkin format", - "Monty , " "Wim Taymans "); -} - -static void -gst_tarkinenc_class_init (TarkinEncClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE, - g_param_spec_int ("bitrate", "bitrate", "bitrate", - G_MININT, G_MAXINT, 3000, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_S_MOMENTS, - g_param_spec_int ("s-moments", "Synthesis Moments", - "Number of vanishing moments for the synthesis filter", - 1, 4, 2, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_A_MOMENTS, - g_param_spec_int ("a-moments", "Analysis Moments", - "Number of vanishing moments for the analysis filter", - 1, 4, 2, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - parent_class = g_type_class_peek_parent (klass); - - gobject_class->set_property = gst_tarkinenc_set_property; - gobject_class->get_property = gst_tarkinenc_get_property; -} - -static GstPadLinkReturn -gst_tarkinenc_sinkconnect (GstPad * pad, GstCaps * caps) -{ - TarkinEnc *tarkinenc; - - tarkinenc = GST_TARKINENC (gst_pad_get_parent (pad)); - - if (!GST_CAPS_IS_FIXED (caps)) - return GST_PAD_LINK_DELAYED; - - gst_caps_debug (caps, "caps to be set on tarkin sink pad"); - - tarkinenc->layer[0].bitstream_len = tarkinenc->bitrate; - tarkinenc->layer[0].a_moments = tarkinenc->a_moments; - tarkinenc->layer[0].s_moments = tarkinenc->s_moments; - gst_caps_get_int (caps, "width", &tarkinenc->layer[0].width); - gst_caps_get_int (caps, "height", &tarkinenc->layer[0].height); - tarkinenc->layer[0].format = TARKIN_RGB24; - tarkinenc->layer[0].frames_per_buf = TARKIN_RGB24; - - gst_tarkinenc_setup (tarkinenc); - - if (tarkinenc->setup) - return GST_PAD_LINK_OK; - - return GST_PAD_LINK_REFUSED; -} - -static void -gst_tarkinenc_init (TarkinEnc * tarkinenc) -{ - tarkinenc->sinkpad = gst_pad_new_from_template (enc_sink_template, "sink"); - gst_element_add_pad (GST_ELEMENT (tarkinenc), tarkinenc->sinkpad); - gst_pad_set_chain_function (tarkinenc->sinkpad, gst_tarkinenc_chain); - gst_pad_set_link_function (tarkinenc->sinkpad, gst_tarkinenc_sinkconnect); - - tarkinenc->srcpad = gst_pad_new_from_template (enc_src_template, "src"); - gst_element_add_pad (GST_ELEMENT (tarkinenc), tarkinenc->srcpad); - - tarkinenc->bitrate = 3000; - tarkinenc->s_moments = 2; - tarkinenc->a_moments = 2; - tarkinenc->setup = FALSE; -} - -TarkinError -free_frame (void *s, void *ptr) -{ - return (TARKIN_OK); -} - -TarkinError -packet_out (void *stream, ogg_packet * op) -{ - ogg_page og; - TarkinStream *s = stream; - TarkinEnc *te = s->user_ptr; - GstBuffer *outbuf; - - ogg_stream_packetin (&te->os, op); - - if (op->e_o_s) { - ogg_stream_flush (&te->os, &og); - outbuf = gst_buffer_new (); - GST_BUFFER_DATA (outbuf) = og.header; - GST_BUFFER_SIZE (outbuf) = og.header_len; - GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_DONTFREE); - gst_pad_push (te->srcpad, GST_DATA (outbuf)); - outbuf = gst_buffer_new (); - GST_BUFFER_DATA (outbuf) = og.body; - GST_BUFFER_SIZE (outbuf) = og.body_len; - GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_DONTFREE); - gst_pad_push (te->srcpad, GST_DATA (outbuf)); - } else { - while (ogg_stream_pageout (&te->os, &og)) { - outbuf = gst_buffer_new (); - GST_BUFFER_DATA (outbuf) = og.header; - GST_BUFFER_SIZE (outbuf) = og.header_len; - GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_DONTFREE); - gst_pad_push (te->srcpad, GST_DATA (outbuf)); - outbuf = gst_buffer_new (); - GST_BUFFER_DATA (outbuf) = og.body; - GST_BUFFER_SIZE (outbuf) = og.body_len; - GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_DONTFREE); - gst_pad_push (te->srcpad, GST_DATA (outbuf)); - } - } - return (TARKIN_OK); -} - - -static void -gst_tarkinenc_setup (TarkinEnc * tarkinenc) -{ - gint i; - GstBuffer *outbuf; - - ogg_stream_init (&tarkinenc->os, 1); - tarkin_info_init (&tarkinenc->ti); - - tarkinenc->ti.inter.numerator = 1; - tarkinenc->ti.inter.denominator = 1; - - tarkin_comment_init (&tarkinenc->tc); - tarkin_comment_add_tag (&tarkinenc->tc, "TITLE", "GStreamer produced file"); - tarkin_comment_add_tag (&tarkinenc->tc, "ARTIST", "C coders ;)"); - - tarkinenc->tarkin_stream = tarkin_stream_new (); - tarkin_analysis_init (tarkinenc->tarkin_stream, - &tarkinenc->ti, free_frame, packet_out, (void *) tarkinenc); - tarkin_analysis_add_layer (tarkinenc->tarkin_stream, &tarkinenc->layer[0]); - - tarkin_analysis_headerout (tarkinenc->tarkin_stream, &tarkinenc->tc, - tarkinenc->op, &tarkinenc->op[1], &tarkinenc->op[2]); - for (i = 0; i < 3; i++) { - ogg_stream_packetin (&tarkinenc->os, &tarkinenc->op[i]); - } - - ogg_stream_flush (&tarkinenc->os, &tarkinenc->og); - - tarkinenc->frame_num = 0; - - outbuf = gst_buffer_new (); - GST_BUFFER_DATA (outbuf) = tarkinenc->og.header; - GST_BUFFER_SIZE (outbuf) = tarkinenc->og.header_len; - GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_DONTFREE); - gst_pad_push (tarkinenc->srcpad, GST_DATA (outbuf)); - - outbuf = gst_buffer_new (); - GST_BUFFER_DATA (outbuf) = tarkinenc->og.body; - GST_BUFFER_SIZE (outbuf) = tarkinenc->og.body_len; - GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_DONTFREE); - gst_pad_push (tarkinenc->srcpad, GST_DATA (outbuf)); - - tarkinenc->setup = TRUE; -} - -static void -gst_tarkinenc_chain (GstPad * pad, GstData * _data) -{ - GstBuffer *buf = GST_BUFFER (_data); - TarkinEnc *tarkinenc; - - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (buf != NULL); - - tarkinenc = GST_TARKINENC (gst_pad_get_parent (pad)); - - if (!tarkinenc->setup) { - GST_ELEMENT_ERROR (tarkinenc, CORE, NEGOTIATION, (NULL), - ("encoder not initialized (input is not tarkin?)")); - if (GST_IS_BUFFER (buf)) - gst_buffer_unref (buf); - else - gst_pad_event_default (pad, GST_EVENT (buf)); - return; - } - - if (GST_IS_EVENT (buf)) { - switch (GST_EVENT_TYPE (buf)) { - case GST_EVENT_EOS: - tarkin_analysis_framein (tarkinenc->tarkin_stream, NULL, 0, NULL); /* EOS */ - tarkin_comment_clear (&tarkinenc->tc); - tarkin_stream_destroy (tarkinenc->tarkin_stream); - default: - gst_pad_event_default (pad, GST_EVENT (buf)); - break; - } - } else { - gchar *data; - gulong size; - TarkinTime date; - - /* data to encode */ - data = GST_BUFFER_DATA (buf); - size = GST_BUFFER_SIZE (buf); - - date.numerator = tarkinenc->frame_num; - date.denominator = 1; - tarkin_analysis_framein (tarkinenc->tarkin_stream, data, 0, &date); - tarkinenc->frame_num++; - - gst_buffer_unref (buf); - } -} - -static void -gst_tarkinenc_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - TarkinEnc *tarkinenc; - - g_return_if_fail (GST_IS_TARKINENC (object)); - - tarkinenc = GST_TARKINENC (object); - - switch (prop_id) { - case ARG_BITRATE: - g_value_set_int (value, tarkinenc->bitrate); - break; - case ARG_S_MOMENTS: - g_value_set_int (value, tarkinenc->s_moments); - break; - case ARG_A_MOMENTS: - g_value_set_int (value, tarkinenc->a_moments); - break; - default: - break; - } -} - -static void -gst_tarkinenc_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - TarkinEnc *tarkinenc; - - g_return_if_fail (GST_IS_TARKINENC (object)); - - tarkinenc = GST_TARKINENC (object); - - switch (prop_id) { - case ARG_BITRATE: - tarkinenc->bitrate = g_value_get_int (value); - break; - case ARG_S_MOMENTS: - { - gint s_moments; - - s_moments = g_value_get_int (value); - if (s_moments != 1 || s_moments != 2 || s_moments != 4) { - g_warning ("tarkinenc: s_moments must be 1, 2 or 4"); - } else { - tarkinenc->s_moments = s_moments; - } - break; - } - case ARG_A_MOMENTS: - { - gint a_moments; - - a_moments = g_value_get_int (value); - if (a_moments != 1 || a_moments != 2 || a_moments != 4) { - g_warning ("tarkinenc: a_moments must be 1, 2 or 4"); - } else { - tarkinenc->a_moments = a_moments; - } - break; - } - default: - break; - } -} diff --git a/ext/tarkin/gsttarkinenc.h b/ext/tarkin/gsttarkinenc.h deleted file mode 100644 index 3c733b0e4a..0000000000 --- a/ext/tarkin/gsttarkinenc.h +++ /dev/null @@ -1,83 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __TARKINENC_H__ -#define __TARKINENC_H__ - - -#include - -#include "tarkin.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define GST_TYPE_TARKINENC \ - (tarkinenc_get_type()) -#define GST_TARKINENC(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TARKINENC,TarkinEnc)) -#define GST_TARKINENC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TARKINENC,TarkinEncClass)) -#define GST_IS_TARKINENC(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TARKINENC)) -#define GST_IS_TARKINENC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TARKINENC)) - -typedef struct _TarkinEnc TarkinEnc; -typedef struct _TarkinEncClass TarkinEncClass; - -struct _TarkinEnc { - GstElement element; - - GstPad *sinkpad,*srcpad; - - ogg_stream_state os; /* take physical pages, weld into a logical - stream of packets */ - ogg_page og; /* one Ogg bitstream page. Tarkin packets are inside */ - ogg_packet op[3]; /* one raw packet of data for decode */ - - TarkinStream *tarkin_stream; - TarkinComment tc; - TarkinInfo ti; - TarkinVideoLayerDesc layer[1]; - - gint frame_num; - - gboolean eos; - gint bitrate; - gint s_moments; - gint a_moments; - gboolean setup; -}; - -struct _TarkinEncClass { - GstElementClass parent_class; -}; - -GType tarkinenc_get_type(void); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __TARKINENC_H__ */ diff --git a/ext/tarkin/info.c b/ext/tarkin/info.c deleted file mode 100644 index 83fe1bae60..0000000000 --- a/ext/tarkin/info.c +++ /dev/null @@ -1,621 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * - * by the XIPHOPHORUS Company http://www.xiph.org/ * - - ******************************************************************** - - function: maintain the info structure, info <-> header packets - last mod: $Id$ - - ********************************************************************/ - -/* general handling of the header and the TarkinInfo structure (and - substructures) */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include "tarkin.h" -#include "yuv.h" -#include "mem.h" - -/* helpers */ -static void -_v_writestring (oggpack_buffer * o, char *s, int bytes) -{ - while (bytes--) { - oggpack_write (o, *s++, 8); - } -} - -static void -_v_readstring (oggpack_buffer * o, char *buf, int bytes) -{ - while (bytes--) { - *buf++ = oggpack_read (o, 8); - } -} - -void -tarkin_comment_init (TarkinComment * vc) -{ - memset (vc, 0, sizeof (*vc)); -} - -void -tarkin_comment_add (TarkinComment * vc, char *comment) -{ - vc->user_comments = REALLOC (vc->user_comments, - (vc->comments + 2) * sizeof (*vc->user_comments)); - vc->comment_lengths = REALLOC (vc->comment_lengths, - (vc->comments + 2) * sizeof (*vc->comment_lengths)); - vc->comment_lengths[vc->comments] = strlen (comment); - vc->user_comments[vc->comments] = - MALLOC (vc->comment_lengths[vc->comments] + 1); - strcpy (vc->user_comments[vc->comments], comment); - vc->comments++; - vc->user_comments[vc->comments] = NULL; -} - -void -tarkin_comment_add_tag (TarkinComment * vc, char *tag, char *contents) -{ - char *comment = alloca (strlen (tag) + strlen (contents) + 2); /* +2 for = and \0 */ - - strcpy (comment, tag); - strcat (comment, "="); - strcat (comment, contents); - tarkin_comment_add (vc, comment); -} - -/* This is more or less the same as strncasecmp - but that doesn't exist - * everywhere, and this is a fairly trivial function, so we include it */ -static int -tagcompare (const char *s1, const char *s2, int n) -{ - int c = 0; - - while (c < n) { - if (toupper (s1[c]) != toupper (s2[c])) - return !0; - c++; - } - return 0; -} - -char * -tarkin_comment_query (TarkinComment * vc, char *tag, int count) -{ - long i; - int found = 0; - int taglen = strlen (tag) + 1; /* +1 for the = we append */ - char *fulltag = alloca (taglen + 1); - - strcpy (fulltag, tag); - strcat (fulltag, "="); - - for (i = 0; i < vc->comments; i++) { - if (!tagcompare (vc->user_comments[i], fulltag, taglen)) { - if (count == found) - /* We return a pointer to the data, not a copy */ - return vc->user_comments[i] + taglen; - else - found++; - } - } - return NULL; /* didn't find anything */ -} - -int -tarkin_comment_query_count (TarkinComment * vc, char *tag) -{ - int i, count = 0; - int taglen = strlen (tag) + 1; /* +1 for the = we append */ - char *fulltag = alloca (taglen + 1); - - strcpy (fulltag, tag); - strcat (fulltag, "="); - - for (i = 0; i < vc->comments; i++) { - if (!tagcompare (vc->user_comments[i], fulltag, taglen)) - count++; - } - - return count; -} - -void -tarkin_comment_clear (TarkinComment * vc) -{ - if (vc) { - long i; - - for (i = 0; i < vc->comments; i++) - if (vc->user_comments[i]) - FREE (vc->user_comments[i]); - if (vc->user_comments) - FREE (vc->user_comments); - if (vc->comment_lengths) - FREE (vc->comment_lengths); - if (vc->vendor) - FREE (vc->vendor); - } - memset (vc, 0, sizeof (*vc)); -} - -/* used by synthesis, which has a full, alloced vi */ -void -tarkin_info_init (TarkinInfo * vi) -{ - memset (vi, 0, sizeof (*vi)); -} - -void -tarkin_info_clear (TarkinInfo * vi) -{ - memset (vi, 0, sizeof (*vi)); -} - -/* Header packing/unpacking ********************************************/ - -static int -_tarkin_unpack_info (TarkinInfo * vi, oggpack_buffer * opb) -{ -#ifdef DBG_OGG - printf ("dbg_ogg: Decoding Info: "); -#endif - vi->version = oggpack_read (opb, 32); - if (vi->version != 0) - return (-TARKIN_VERSION); - - vi->n_layers = oggpack_read (opb, 8); - vi->inter.numerator = oggpack_read (opb, 32); - vi->inter.denominator = oggpack_read (opb, 32); - - vi->bitrate_upper = oggpack_read (opb, 32); - vi->bitrate_nominal = oggpack_read (opb, 32); - vi->bitrate_lower = oggpack_read (opb, 32); - -#ifdef DBG_OGG - printf (" n_layers %d, interleave: %d/%d, ", - vi->n_layers, vi->inter.numerator, vi->inter.denominator); -#endif - - if (vi->inter.numerator < 1) - goto err_out; - if (vi->inter.denominator < 1) - goto err_out; - if (vi->n_layers < 1) - goto err_out; - - if (oggpack_read (opb, 1) != 1) - goto err_out; /* EOP check */ - -#ifdef DBG_OGG - printf ("Success\n"); -#endif - return (0); -err_out: -#ifdef DBG_OGG - printf ("Failed\n"); -#endif - tarkin_info_clear (vi); - return (-TARKIN_BAD_HEADER); -} - -static int -_tarkin_unpack_comment (TarkinComment * vc, oggpack_buffer * opb) -{ - int i; - int vendorlen = oggpack_read (opb, 32); - -#ifdef DBG_OGG - printf ("dbg_ogg: Decoding comment: "); -#endif - if (vendorlen < 0) - goto err_out; - vc->vendor = _ogg_calloc (vendorlen + 1, 1); - _v_readstring (opb, vc->vendor, vendorlen); - vc->comments = oggpack_read (opb, 32); - if (vc->comments < 0) - goto err_out; - vc->user_comments = - _ogg_calloc (vc->comments + 1, sizeof (*vc->user_comments)); - vc->comment_lengths = - _ogg_calloc (vc->comments + 1, sizeof (*vc->comment_lengths)); - - for (i = 0; i < vc->comments; i++) { - int len = oggpack_read (opb, 32); - - if (len < 0) - goto err_out; - vc->comment_lengths[i] = len; - vc->user_comments[i] = _ogg_calloc (len + 1, 1); - _v_readstring (opb, vc->user_comments[i], len); - } - if (oggpack_read (opb, 1) != 1) - goto err_out; /* EOP check */ - -#ifdef DBG_OGG - printf ("Success, read %d comments\n", vc->comments); -#endif - return (0); -err_out: -#ifdef DBG_OGG - printf ("Failed\n"); -#endif - tarkin_comment_clear (vc); - return (-TARKIN_BAD_HEADER); -} - -/* the real encoding details are here, currently TarkinVideoLayerDesc. */ -static int -_tarkin_unpack_layer_desc (TarkinInfo * vi, oggpack_buffer * opb) -{ - int i, j; - - vi->layer = CALLOC (vi->n_layers, (sizeof (*vi->layer))); - memset (vi->layer, 0, vi->n_layers * sizeof (*vi->layer)); - -#ifdef DBG_OGG - printf ("ogg: Decoding layers description: "); -#endif - for (i = 0; i < vi->n_layers; i++) { - TarkinVideoLayer *layer = vi->layer + i; - - layer->desc.width = oggpack_read (opb, 32); - layer->desc.height = oggpack_read (opb, 32); - layer->desc.a_moments = oggpack_read (opb, 32); - layer->desc.s_moments = oggpack_read (opb, 32); - layer->desc.frames_per_buf = oggpack_read (opb, 32); - layer->desc.bitstream_len = oggpack_read (opb, 32); - layer->desc.format = oggpack_read (opb, 32); - - switch (layer->desc.format) { - case TARKIN_GRAYSCALE: - layer->n_comp = 1; - layer->color_fwd_xform = grayscale_to_y; - layer->color_inv_xform = y_to_grayscale; - break; - case TARKIN_RGB24: - layer->n_comp = 3; - layer->color_fwd_xform = rgb24_to_yuv; - layer->color_inv_xform = yuv_to_rgb24; - break; - case TARKIN_RGB32: - layer->n_comp = 3; - layer->color_fwd_xform = rgb32_to_yuv; - layer->color_inv_xform = yuv_to_rgb32; - break; - case TARKIN_RGBA: - layer->n_comp = 4; - layer->color_fwd_xform = rgba_to_yuv; - layer->color_inv_xform = yuv_to_rgba; - break; - default: - return -TARKIN_INVALID_COLOR_FORMAT; - }; - - layer->waveletbuf = (Wavelet3DBuf **) CALLOC (layer->n_comp, - sizeof (Wavelet3DBuf *)); - - layer->packet = MALLOC (layer->n_comp * sizeof (*layer->packet)); - memset (layer->packet, 0, layer->n_comp * sizeof (*layer->packet)); - - for (j = 0; j < layer->n_comp; j++) { - layer->waveletbuf[j] = wavelet_3d_buf_new (layer->desc.width, - layer->desc.height, layer->desc.frames_per_buf); - layer->packet[j].data = MALLOC (layer->desc.bitstream_len); - layer->packet[j].storage = layer->desc.bitstream_len; - } - - vi->max_bitstream_len += layer->desc.bitstream_len + 2 * 10 * sizeof (uint32_t) * layer->n_comp; /* truncation tables */ - -#ifdef DBG_OGG - printf - ("\n layer%d: size %dx%dx%d, format %d, a_m %d, s_m %d, %d fpb\n", - i, layer->desc.width, layer->desc.height, layer->n_comp, - layer->desc.format, layer->desc.a_moments, layer->desc.s_moments, - layer->desc.frames_per_buf); -#endif - } /* for each layer */ - - if (oggpack_read (opb, 1) != 1) - goto err_out; /* EOP check */ - -#ifdef DBG_OGG - printf ("Success\n"); -#endif - - return (0); -err_out: -#ifdef DBG_OGG - printf ("Failed\n"); -#endif - tarkin_info_clear (vi); - return (-TARKIN_BAD_HEADER); -} - -/* The Tarkin header is in three packets; the initial small packet in - the first page that identifies basic parameters, a second packet - with bitstream comments and a third packet that holds the - layer description structures. */ - -TarkinError -tarkin_synthesis_headerin (TarkinInfo * vi, TarkinComment * vc, ogg_packet * op) -{ - oggpack_buffer opb; - - if (op) { - oggpack_readinit (&opb, op->packet, op->bytes); - - /* Which of the three types of header is this? */ - /* Also verify header-ness, tarkin */ - { - char buffer[6]; - int packtype = oggpack_read (&opb, 8); - - memset (buffer, 0, 6); - _v_readstring (&opb, buffer, 6); - if (memcmp (buffer, "tarkin", 6)) { - /* not a tarkin header */ - return (-TARKIN_NOT_TARKIN); - } - switch (packtype) { - case 0x01: /* least significant *bit* is read first */ - if (!op->b_o_s) { - /* Not the initial packet */ - return (-TARKIN_BAD_HEADER); - } - if (vi->inter.numerator != 0) { - /* previously initialized info header */ - return (-TARKIN_BAD_HEADER); - } - - return (_tarkin_unpack_info (vi, &opb)); - - case 0x03: /* least significant *bit* is read first */ - if (vi->inter.denominator == 0) { - /* um... we didn't get the initial header */ - return (-TARKIN_BAD_HEADER); - } - - return (_tarkin_unpack_comment (vc, &opb)); - - case 0x05: /* least significant *bit* is read first */ - if (vi->inter.numerator == 0 || vc->vendor == NULL) { - /* um... we didn;t get the initial header or comments yet */ - return (-TARKIN_BAD_HEADER); - } - - return (_tarkin_unpack_layer_desc (vi, &opb)); - - default: - /* Not a valid tarkin header type */ - return (-TARKIN_BAD_HEADER); - break; - } - } - } - return (-TARKIN_BAD_HEADER); -} - -/* pack side **********************************************************/ - -static int -_tarkin_pack_info (oggpack_buffer * opb, TarkinInfo * vi) -{ - - /* preamble */ - oggpack_write (opb, 0x01, 8); - _v_writestring (opb, "tarkin", 6); - - /* basic information about the stream */ - oggpack_write (opb, 0x00, 32); - oggpack_write (opb, vi->n_layers, 8); - oggpack_write (opb, vi->inter.numerator, 32); - oggpack_write (opb, vi->inter.denominator, 32); - - oggpack_write (opb, vi->bitrate_upper, 32); - oggpack_write (opb, vi->bitrate_nominal, 32); - oggpack_write (opb, vi->bitrate_lower, 32); - - oggpack_write (opb, 1, 1); - -#ifdef DBG_OGG - printf ("dbg_ogg: Putting out info, inter %d/%d, n_layers %d\n", - vi->inter.numerator, vi->inter.denominator, vi->n_layers); -#endif - return (0); -} - -static int -_tarkin_pack_comment (oggpack_buffer * opb, TarkinComment * vc) -{ - char temp[] = "libTarkin debugging edition 20011104"; - int bytes = strlen (temp); - - /* preamble */ - oggpack_write (opb, 0x03, 8); - _v_writestring (opb, "tarkin", 6); - - /* vendor */ - oggpack_write (opb, bytes, 32); - _v_writestring (opb, temp, bytes); - - /* comments */ - - oggpack_write (opb, vc->comments, 32); - if (vc->comments) { - int i; - - for (i = 0; i < vc->comments; i++) { - if (vc->user_comments[i]) { - oggpack_write (opb, vc->comment_lengths[i], 32); - _v_writestring (opb, vc->user_comments[i], vc->comment_lengths[i]); - } else { - oggpack_write (opb, 0, 32); - } - } - } - oggpack_write (opb, 1, 1); - -#ifdef DBG_OGG - printf ("dbg_ogg: Putting out %d comments\n", vc->comments); -#endif - - return (0); -} - -static int -_tarkin_pack_layer_desc (oggpack_buffer * opb, TarkinInfo * vi) -{ - int i; - TarkinVideoLayer *layer; - -#ifdef DBG_OGG - printf ("dbg_ogg: Putting out layers description:\n"); -#endif - - oggpack_write (opb, 0x05, 8); - _v_writestring (opb, "tarkin", 6); - - for (i = 0; i < vi->n_layers; i++) { - layer = vi->layer + i; - oggpack_write (opb, layer->desc.width, 32); - oggpack_write (opb, layer->desc.height, 32); - oggpack_write (opb, layer->desc.a_moments, 32); - oggpack_write (opb, layer->desc.s_moments, 32); - oggpack_write (opb, layer->desc.frames_per_buf, 32); - oggpack_write (opb, layer->desc.bitstream_len, 32); - oggpack_write (opb, layer->desc.format, 32); - -#ifdef DBG_OGG - printf (" res. %dx%d, format %d, a_m %d, s_m %d, fpb %d\n", - layer->desc.width, layer->desc.height, layer->desc.format, - layer->desc.a_moments, layer->desc.s_moments, - layer->desc.frames_per_buf); -#endif - - } - oggpack_write (opb, 1, 1); - -#ifdef DBG_OGG - printf (" wrote %ld bytes.\n", oggpack_bytes (opb)); -#endif - - return (0); -} - -int -tarkin_comment_header_out (TarkinComment * vc, ogg_packet * op) -{ - - oggpack_buffer opb; - - oggpack_writeinit (&opb); - if (_tarkin_pack_comment (&opb, vc)) - return -TARKIN_NOT_IMPLEMENTED; - - op->packet = MALLOC (oggpack_bytes (&opb)); - memcpy (op->packet, opb.buffer, oggpack_bytes (&opb)); - - op->bytes = oggpack_bytes (&opb); - op->b_o_s = 0; - op->e_o_s = 0; - op->granulepos = 0; - - return 0; -} - -TarkinError -tarkin_analysis_headerout (TarkinStream * v, - TarkinComment * vc, - ogg_packet * op, ogg_packet * op_comm, ogg_packet * op_code) -{ - int ret = -TARKIN_NOT_IMPLEMENTED; - TarkinInfo *vi; - oggpack_buffer opb; - tarkin_header_store *b = &v->headers; - - vi = v->ti; - - /* first header packet ********************************************* */ - - oggpack_writeinit (&opb); - if (_tarkin_pack_info (&opb, vi)) - goto err_out; - - /* build the packet */ - if (b->header) - FREE (b->header); - b->header = MALLOC (oggpack_bytes (&opb)); - memcpy (b->header, opb.buffer, oggpack_bytes (&opb)); - op->packet = b->header; - op->bytes = oggpack_bytes (&opb); - op->b_o_s = 1; - op->e_o_s = 0; - op->granulepos = 0; - - /* second header packet (comments) ********************************* */ - - oggpack_reset (&opb); - if (_tarkin_pack_comment (&opb, vc)) - goto err_out; - - if (b->header1) - FREE (b->header1); - b->header1 = MALLOC (oggpack_bytes (&opb)); - memcpy (b->header1, opb.buffer, oggpack_bytes (&opb)); - op_comm->packet = b->header1; - op_comm->bytes = oggpack_bytes (&opb); - op_comm->b_o_s = 0; - op_comm->e_o_s = 0; - op_comm->granulepos = 0; - - /* third header packet (modes/codebooks) *************************** */ - - oggpack_reset (&opb); - if (_tarkin_pack_layer_desc (&opb, vi)) - goto err_out; - - if (b->header2) - FREE (b->header2); - b->header2 = MALLOC (oggpack_bytes (&opb)); - memcpy (b->header2, opb.buffer, oggpack_bytes (&opb)); - op_code->packet = b->header2; - op_code->bytes = oggpack_bytes (&opb); - op_code->b_o_s = 0; - op_code->e_o_s = 0; - op_code->granulepos = 0; - - oggpack_writeclear (&opb); - return (0); -err_out: - oggpack_writeclear (&opb); - memset (op, 0, sizeof (*op)); - memset (op_comm, 0, sizeof (*op_comm)); - memset (op_code, 0, sizeof (*op_code)); - - if (b->header) - FREE (b->header); - if (b->header1) - FREE (b->header1); - if (b->header2) - FREE (b->header2); - b->header = NULL; - b->header1 = NULL; - b->header2 = NULL; - return (ret); -} diff --git a/ext/tarkin/mem.c b/ext/tarkin/mem.c deleted file mode 100644 index 5ef59f2f65..0000000000 --- a/ext/tarkin/mem.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Debugging implementation of MALLOC and friends - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "mem.h" - -#if defined(DBG_MEMLEAKS) - -typedef struct -{ - void *mem; - char *allocated_in_func; - char *allocated_in_file; - unsigned int allocated_in_line; -} -MemDesc; - - -static int initialized = 0; -static int alloc_count = 0; -static MemDesc *alloc_list = NULL; - - -static void -dbg_memleaks_done (int exitcode, void *dummy) -{ - unsigned int i; - - (void) dummy; - - if (exitcode == 0 && alloc_count != 0) { - fprintf (stderr, "\nmemory leak detected !!!\n"); - fprintf (stderr, "\nalloc_count == %i\n\n", alloc_count); - for (i = 0; i < alloc_count; i++) { - MemDesc *d = &alloc_list[i]; - - fprintf (stderr, "chunk %p allocated in %s (%s: %u) not free'd !!\n", - d->mem, d->allocated_in_func, d->allocated_in_file, - d->allocated_in_line); - } - free (alloc_list); - } - fprintf (stderr, "\n"); -} - - -static void -dbg_memleaks_init (void) -{ - on_exit (dbg_memleaks_done, NULL); - initialized = 1; -} - - -void * -dbg_malloc (char *file, int line, char *func, size_t bytes) -{ - void *mem = (void *) malloc (bytes); - MemDesc *d; - - if (!initialized) - dbg_memleaks_init (); - - alloc_count++; - alloc_list = realloc (alloc_list, alloc_count * sizeof (MemDesc)); - - d = &alloc_list[alloc_count - 1]; - d->mem = mem; - d->allocated_in_func = func; - d->allocated_in_file = file; - d->allocated_in_line = line; - - return mem; -} - - -void * -dbg_calloc (char *file, int line, char *func, size_t count, size_t bytes) -{ - void *mem = (void *) calloc (count, bytes); - MemDesc *d; - - if (!initialized) - dbg_memleaks_init (); - - alloc_count++; - alloc_list = realloc (alloc_list, alloc_count * sizeof (MemDesc)); - - d = &alloc_list[alloc_count - 1]; - d->mem = mem; - d->allocated_in_func = func; - d->allocated_in_file = file; - d->allocated_in_line = line; - - return mem; -} - - -void * -dbg_realloc (char *file, int line, char *func, char *what, - void *mem, size_t bytes) -{ - unsigned int i; - - for (i = 0; i < alloc_count; i++) { - if (alloc_list[i].mem == mem) { - alloc_list[i].mem = (void *) realloc (mem, bytes); - return alloc_list[i].mem; - } - } - - if (mem != NULL) { - fprintf (stderr, - "%s: trying to reallocate unknown chunk %p (%s)\n" - " in %s (%s: %u) !!!\n", - __FUNCTION__, mem, what, func, file, line); - exit (-1); - } - - return dbg_malloc (file, line, func, bytes); -} - - -void -dbg_free (char *file, int line, char *func, char *what, void *mem) -{ - unsigned int i; - - if (!initialized) - dbg_memleaks_init (); - - for (i = 0; i < alloc_count; i++) { - if (alloc_list[i].mem == mem) { - free (mem); - alloc_count--; - memmove (&alloc_list[i], &alloc_list[i + 1], - (alloc_count - i) * sizeof (MemDesc)); - return; - } - } - - fprintf (stderr, "%s: trying to free unknown chunk %p (%s)\n" - " in %s (%s: %u) !!!\n", - __FUNCTION__, mem, what, func, file, line); - exit (-1); -} - - -#endif diff --git a/ext/tarkin/mem.h b/ext/tarkin/mem.h deleted file mode 100644 index 4cd8518321..0000000000 --- a/ext/tarkin/mem.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __MEM_H -#define __MEM_H - -#include "_stdint.h" -#include -#include -#include - - -#if defined(DBG_MEMLEAKS) - -extern void* dbg_malloc (char *file, int line, char *func, size_t bytes); -extern void* dbg_calloc (char *file, int line, char *func, size_t count, size_t bytes); -extern void* dbg_realloc (char *file, int line, char *func, char *what, void *mem, size_t bytes); -extern void dbg_free (char *file, int line, char *func, char *what, void *mem); - -#define MALLOC(bytes) dbg_malloc(__FILE__,__LINE__,__FUNCTION__,bytes) -#define CALLOC(count,bytes) dbg_calloc(__FILE__,__LINE__,__FUNCTION__,count,bytes) -#define FREE(mem) dbg_free(__FILE__,__LINE__,__FUNCTION__,#mem,mem) -#define REALLOC(mem,bytes) dbg_realloc(__FILE__,__LINE__,__FUNCTION__,#mem,mem,bytes) - -#else - -#define MALLOC malloc -#define CALLOC calloc -#define REALLOC realloc -#define FREE free - -#endif - -#endif - diff --git a/ext/tarkin/rle.h b/ext/tarkin/rle.h deleted file mode 100644 index 7cf795173e..0000000000 --- a/ext/tarkin/rle.h +++ /dev/null @@ -1,143 +0,0 @@ -#ifndef __RLE_H -#define __RLE_H - -#include -#include -#include "mem.h" -#include "bitcoder.h" -#include "golomb.h" - -#if defined(RLECODER) - -#define OUTPUT_BIT(rlecoder,bit) rlecoder_write_bit(rlecoder,bit) -#define INPUT_BIT(rlecoder) rlecoder_read_bit(rlecoder) -#define OUTPUT_BIT_DIRECT(coder,bit) bitcoder_write_bit(&(coder)->bitcoder,bit) -#define INPUT_BIT_DIRECT(rlecoder) bitcoder_read_bit(&(rlecoder)->bitcoder) -#define ENTROPY_CODER RLECoderState -#define ENTROPY_ENCODER_INIT(coder,limit) rlecoder_encoder_init(coder,limit) -#define ENTROPY_ENCODER_DONE(coder) rlecoder_encoder_done(coder) -#define ENTROPY_ENCODER_FLUSH(coder) rlecoder_encoder_flush(coder) -#define ENTROPY_DECODER_INIT(coder,bitstream,limit) \ - rlecoder_decoder_init(coder,bitstream,limit) -#define ENTROPY_DECODER_DONE(coder) /* nothing to do ... */ -#define ENTROPY_CODER_BITSTREAM(coder) ((coder)->bitcoder.bitstream) -#define ENTROPY_CODER_EOS(coder) ((coder)->bitcoder.eos) - -#define ENTROPY_CODER_SYMBOL(coder) ((coder)->symbol) -#define ENTROPY_CODER_RUNLENGTH(coder) ((coder)->count) -#define ENTROPY_CODER_SKIP(coder,skip) do { (coder)->count -= skip; } while (0) -#endif - - - - -typedef struct { - int symbol; - uint32_t count; /* have seen count symbol's */ - BitCoderState bitcoder; - GolombAdaptiveCoderState golomb_state [2]; /* 2 states for 2 symbols... */ - int have_seen_1; -} RLECoderState; - - - -/* - * bit should be 0 or 1 !!! - */ -static inline -void rlecoder_write_bit (RLECoderState *s, int bit) -{ - assert (bit == 0 || bit == 1); - - if (s->symbol == -1) { - s->symbol = bit & 1; - s->count = 1; - s->have_seen_1 = bit; - bitcoder_write_bit (&s->bitcoder, bit); - } - - if (s->symbol != bit) { - golombcoder_encode_number (&s->golomb_state[s->symbol], - &s->bitcoder, s->count); - s->symbol = ~s->symbol & 1; - s->have_seen_1 = 1; - s->count = 1; - } else - s->count++; -} - -static inline -int rlecoder_read_bit (RLECoderState *s) -{ - if (s->count == 0) { - s->symbol = ~s->symbol & 1; - s->count = golombcoder_decode_number (&s->golomb_state[s->symbol], - &s->bitcoder); - if (s->bitcoder.eos) { - s->symbol = 0; - s->count = ~0; - } - } - s->count--; - return (s->symbol); -} - - -int coder_id = 0; -FILE *file = NULL; - -static inline -void rlecoder_encoder_init (RLECoderState *s, uint32_t limit) -{ - bitcoder_encoder_init (&s->bitcoder, limit); - s->symbol = -1; - s->have_seen_1 = 0; - s->golomb_state[0].count = 0; - s->golomb_state[1].count = 0; - s->golomb_state[0].bits = 5 << 3; - s->golomb_state[1].bits = 5 << 3; -} - - -/** - * once you called this, you better should not encode any more symbols ... - */ -static inline -uint32_t rlecoder_encoder_flush (RLECoderState *s) -{ - if (s->symbol == -1 || !s->have_seen_1) - return 0; - - golombcoder_encode_number (&s->golomb_state[s->symbol], - &s->bitcoder, s->count); - return bitcoder_flush (&s->bitcoder); -} - - -static inline -void rlecoder_decoder_init (RLECoderState *s, uint8_t *bitstream, uint32_t limit) -{ - bitcoder_decoder_init (&s->bitcoder, bitstream, limit); - s->golomb_state[0].count = 0; - s->golomb_state[1].count = 0; - s->golomb_state[0].bits = 5 << 3; - s->golomb_state[1].bits = 5 << 3; - s->symbol = bitcoder_read_bit (&s->bitcoder); - s->count = golombcoder_decode_number (&s->golomb_state[s->symbol], - &s->bitcoder) - 1; - if (s->bitcoder.eos) { - s->symbol = 0; - s->count = ~0; - } -} - - -static inline -void rlecoder_encoder_done (RLECoderState *s) -{ - bitcoder_encoder_done (&s->bitcoder); -} - - -#endif - diff --git a/ext/tarkin/tarkin.c b/ext/tarkin/tarkin.c deleted file mode 100644 index f1047e9e4e..0000000000 --- a/ext/tarkin/tarkin.c +++ /dev/null @@ -1,420 +0,0 @@ -/* - * The real io-stuff is in tarkin-io.c - * (this one has to be rewritten to write ogg streams ...) - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "mem.h" -#include "tarkin.h" -#include "yuv.h" - - -#define N_FRAMES 1 - - - -TarkinStream * -tarkin_stream_new () -{ - TarkinStream *s = (TarkinStream *) CALLOC (1, sizeof (TarkinStream)); - - if (!s) - return NULL; - memset (s, 0, sizeof (*s)); - - s->frames_per_buf = N_FRAMES; - - return s; -} - - -void -tarkin_stream_destroy (TarkinStream * s) -{ - uint32_t i, j; - - if (!s) - return; - - for (i = 0; i < s->n_layers; i++) { - if (s->layer[i].waveletbuf) { - for (j = 0; j < s->layer[i].n_comp; j++) { - wavelet_3d_buf_destroy (s->layer[i].waveletbuf[j]); - FREE (s->layer[i].packet[j].data); - } - FREE (s->layer[i].waveletbuf); - FREE (s->layer[i].packet); - } - } - - if (s->layer) - FREE (s->layer); - - if (s->headers.header) - FREE (s->headers.header); - - if (s->headers.header1) - FREE (s->headers.header1); - - if (s->headers.header2) - FREE (s->headers.header2); - - - FREE (s); -} - - -int -tarkin_analysis_init (TarkinStream * s, TarkinInfo * ti, - TarkinError (*free_frame) (void *s, void *ptr), - TarkinError (*packet_out) (void *s, ogg_packet * ptr), void *user_ptr) -{ - if ((!ti->inter.numerator) || (!ti->inter.denominator)) - return (-TARKIN_FAULT); - if ((!free_frame) || (!packet_out)) - return (-TARKIN_FAULT); - s->ti = ti; - s->free_frame = free_frame; - s->packet_out = packet_out; - s->user_ptr = user_ptr; - return (0); -} - - -extern int -tarkin_analysis_add_layer (TarkinStream * s, TarkinVideoLayerDesc * tvld) -{ - int i; - TarkinVideoLayer *layer; - - if (s->n_layers) { - s->layer = REALLOC (s->layer, (s->n_layers + 1) * sizeof (*s->layer)); - } else { - s->layer = MALLOC (sizeof (*s->layer)); - } - layer = s->layer + s->n_layers; - memset (layer, 0, sizeof (*s->layer)); - memcpy (&layer->desc, tvld, sizeof (TarkinVideoLayerDesc)); - - s->n_layers++; - s->ti->n_layers = s->n_layers; - s->ti->layer = s->layer; - - switch (layer->desc.format) { - case TARKIN_GRAYSCALE: - layer->n_comp = 1; - layer->color_fwd_xform = grayscale_to_y; - layer->color_inv_xform = y_to_grayscale; - break; - case TARKIN_RGB24: - layer->n_comp = 3; - layer->color_fwd_xform = rgb24_to_yuv; - layer->color_inv_xform = yuv_to_rgb24; - break; - case TARKIN_RGB32: - layer->n_comp = 3; - layer->color_fwd_xform = rgb32_to_yuv; - layer->color_inv_xform = yuv_to_rgb32; - break; - case TARKIN_RGBA: - layer->n_comp = 4; - layer->color_fwd_xform = rgba_to_yuv; - layer->color_inv_xform = yuv_to_rgba; - break; - default: - return -TARKIN_INVALID_COLOR_FORMAT; - }; - -#ifdef DBG_OGG - printf ("dbg_ogg:add_layer %d with %d components\n", - s->n_layers, layer->n_comp); -#endif - - layer->waveletbuf = (Wavelet3DBuf **) CALLOC (layer->n_comp, - sizeof (Wavelet3DBuf *)); - - layer->packet = MALLOC (layer->n_comp * sizeof (*layer->packet)); - memset (layer->packet, 0, layer->n_comp * sizeof (*layer->packet)); - - for (i = 0; i < layer->n_comp; i++) { - layer->waveletbuf[i] = wavelet_3d_buf_new (layer->desc.width, - layer->desc.height, layer->desc.frames_per_buf); - layer->packet[i].data = MALLOC (layer->desc.bitstream_len); - layer->packet[i].storage = layer->desc.bitstream_len; - } - /* - max_bitstream_len += layer->desc.bitstream_len - + 2 * 10 * sizeof(uint32_t) * layer->n_comp; - */ - return (TARKIN_OK); -} - -TarkinError -_analysis_packetout (TarkinStream * s, uint32_t layer_id, uint32_t comp) -{ - ogg_packet op; - oggpack_buffer opb; - uint8_t *data; - uint32_t data_len; - int i; - - data = s->layer[layer_id].packet[comp].data; - data_len = s->layer[layer_id].packet[comp].data_len; - - oggpack_writeinit (&opb); - oggpack_write (&opb, 0, 8); /* No feature flags for now */ - oggpack_write (&opb, layer_id, 12); - oggpack_write (&opb, comp, 12); - for (i = 0; i < data_len; i++) - oggpack_write (&opb, *(data + i), 8); - - op.b_o_s = 0; - op.e_o_s = data_len ? 0 : 1; - op.granulepos = 0; - op.bytes = oggpack_bytes (&opb) + 4; - op.packet = opb.buffer; -#ifdef DBG_OGG - printf ("dbg_ogg: writing packet layer %d, comp %d, data_len %d %s\n", - layer_id, comp, data_len, op.e_o_s ? "eos" : ""); -#endif - s->layer[layer_id].packet[comp].data_len = 0; /* so direct call => eos */ - return (s->packet_out (s, &op)); -} - -void -_stream_flush (TarkinStream * s) -{ - uint32_t i, j; - - s->current_frame_in_buf = 0; - - for (i = 0; i < s->n_layers; i++) { - TarkinVideoLayer *layer = &s->layer[i]; - - for (j = 0; j < layer->n_comp; j++) { - uint32_t comp_bitstream_len; - TarkinPacket *packet = layer->packet + j; - - /** - * implicit 6:1:1 subsampling - */ - if (j == 0) - comp_bitstream_len = - 6 * layer->desc.bitstream_len / (layer->n_comp + 5); - else - comp_bitstream_len = layer->desc.bitstream_len / (layer->n_comp + 5); - - if (packet->storage < comp_bitstream_len) { - packet->storage = comp_bitstream_len; - packet->data = REALLOC (packet->data, comp_bitstream_len); - } - - wavelet_3d_buf_dump ("color-%d-%03d.pgm", - s->current_frame, j, layer->waveletbuf[j], j == 0 ? 0 : 128); - - wavelet_3d_buf_fwd_xform (layer->waveletbuf[j], - layer->desc.a_moments, layer->desc.s_moments); - - wavelet_3d_buf_dump ("coeff-%d-%03d.pgm", - s->current_frame, j, layer->waveletbuf[j], 128); - - packet->data_len = wavelet_3d_buf_encode_coeff (layer->waveletbuf[j], - packet->data, comp_bitstream_len); - - _analysis_packetout (s, i, j); - } - } -} - - -uint32_t -tarkin_analysis_framein (TarkinStream * s, uint8_t * frame, - uint32_t layer_id, TarkinTime * date) -{ - TarkinVideoLayer *layer; - - if (!frame) - return (_analysis_packetout (s, 0, 0)); /* eos */ - if ((layer_id >= s->n_layers) || (date->denominator == 0)) - return (TARKIN_FAULT); - - layer = s->layer + layer_id; - layer->color_fwd_xform (frame, layer->waveletbuf, s->current_frame_in_buf); - /* We don't use this feature for now, neither date... */ - s->free_frame (s, frame); - - s->current_frame_in_buf++; - - if (s->current_frame_in_buf == s->frames_per_buf) - _stream_flush (s); - -#ifdef DBG_OGG - printf ("dbg_ogg: framein at pos %d/%d, n? %d,%d on layer %d\n", - date->numerator, date->denominator, - layer->frameno, s->current_frame, layer_id); -#endif - - layer->frameno++; - return (++s->current_frame); -} - - - - -/** - * tarkin_stream_read_header() is now info.c:_tarkin_unpack_layer_desc() - */ - - - -TarkinError -tarkin_stream_get_layer_desc (TarkinStream * s, - uint32_t layer_id, TarkinVideoLayerDesc * desc) -{ - if (layer_id > s->n_layers - 1) - return -TARKIN_INVALID_LAYER; - - memcpy (desc, &(s->layer[layer_id].desc), sizeof (TarkinVideoLayerDesc)); - - return TARKIN_OK; -} - -TarkinError -tarkin_synthesis_init (TarkinStream * s, TarkinInfo * ti) -{ - s->ti = ti; - s->layer = ti->layer; /* It was malloc()ed by headerin() */ - s->n_layers = ti->n_layers; - return (TARKIN_OK); -} - -TarkinError -tarkin_synthesis_packetin (TarkinStream * s, ogg_packet * op) -{ - uint32_t i, layer_id, comp, data_len; - uint32_t flags, junk; - int nread; - oggpack_buffer opb; - TarkinPacket *packet; - -#ifdef DBG_OGG - printf ("dbg_ogg: Reading packet n? %lld, granulepos %lld, len %ld, %s%s\n", - op->packetno, op->granulepos, op->bytes, - op->b_o_s ? "b_o_s" : "", op->e_o_s ? "e_o_s" : ""); -#endif - oggpack_readinit (&opb, op->packet, op->bytes); - flags = oggpack_read (&opb, 8); - layer_id = oggpack_read (&opb, 12); /* Theses are required for */ - comp = oggpack_read (&opb, 12); /* data hole handling (or maybe - * packetno would be enough ?) */ - nread = 4; - - if (flags) { /* This is void "infinite future features" feature ;) */ - if (flags & 1 << 7) { - junk = flags; - while (junk & 1 << 7) - junk = oggpack_read (&opb, 8); /* allow for many future flags - that must be correctly ordonned. */ - } - /* This shows how to get a feature's data: - if (flags & TARKIN_FLAGS_EXAMPLE){ - tp->example = oggpack_read(&opb,32); - junk = tp->example & 3<<30; - tp->example &= 0x4fffffff; - } - */ - for (junk = 1 << 31; junk & 1 << 31;) /* and many future data */ - while ((junk = oggpack_read (&opb, 32)) & 1 << 30); - /* That is, feature data comes in 30 bit chunks. We also have - * 31 potentially useful bits in last chunk. */ - } - - nread = (opb.ptr - opb.buffer); - data_len = op->bytes - nread; - -#ifdef DBG_OGG - printf (" layer_id %d, comp %d, meta-data %dB, w3d data %dB.\n", - layer_id, comp, nread, data_len); -#endif - - /* We now have for shure our data. */ - packet = &s->layer[layer_id].packet[comp]; - if (packet->data_len) - return (-TARKIN_UNUSED); /* Previous data wasn't used */ - - if (packet->storage < data_len) { - packet->storage = data_len + 255; - packet->data = REALLOC (packet->data, packet->storage); - } - - for (i = 0; i < data_len; i++) - packet->data[i] = oggpack_read (&opb, 8); - - packet->data_len = data_len; - - return (TARKIN_OK); -} - -TarkinError -tarkin_synthesis_frameout (TarkinStream * s, - uint8_t ** frame, uint32_t layer_id, TarkinTime * date) -{ - int j; - TarkinVideoLayer *layer = &s->layer[layer_id]; - - if (s->current_frame_in_buf == 0) { - *frame = MALLOC (layer->desc.width * layer->desc.height * layer->n_comp); - for (j = 0; j < layer->n_comp; j++) { - TarkinPacket *packet = layer->packet + j; - - if (packet->data_len == 0) - goto err_out; - - wavelet_3d_buf_decode_coeff (layer->waveletbuf[j], packet->data, - packet->data_len); - - wavelet_3d_buf_dump ("rcoeff-%d-%03d.pgm", - s->current_frame, j, layer->waveletbuf[j], 128); - - wavelet_3d_buf_inv_xform (layer->waveletbuf[j], - layer->desc.a_moments, layer->desc.s_moments); - - wavelet_3d_buf_dump ("rcolor-%d-%03d.pgm", - s->current_frame, j, layer->waveletbuf[j], j == 0 ? 0 : 128); - } - - /* We did successfylly read a block from this layer, acknowledge it. */ - for (j = 0; j < layer->n_comp; j++) - layer->packet[j].data_len = 0; - } - - layer->color_inv_xform (layer->waveletbuf, *frame, s->current_frame_in_buf); - s->current_frame_in_buf++; - s->current_frame++; - - if (s->current_frame_in_buf == s->frames_per_buf) - s->current_frame_in_buf = 0; - - date->numerator = layer->frameno * s->ti->inter.numerator; - date->denominator = s->ti->inter.denominator; -#ifdef DBG_OGG - printf ("dbg_ogg: outputting frame pos %d/%d from layer %d.\n", - date->numerator, date->denominator, layer_id); -#endif - layer->frameno++; - return (TARKIN_OK); -err_out: - FREE (*frame); - return (TARKIN_NEED_MORE); -} - -int -tarkin_synthesis_freeframe (TarkinStream * s, uint8_t * frame) -{ - FREE (frame); - - return (TARKIN_OK); -} diff --git a/ext/tarkin/tarkin.h b/ext/tarkin/tarkin.h deleted file mode 100644 index 633f9a141f..0000000000 --- a/ext/tarkin/tarkin.h +++ /dev/null @@ -1,239 +0,0 @@ -#ifndef __TARKIN_H -#define __TARKIN_H - -#include -#include "wavelet.h" -#include - - -#define BUG(x...) \ - do { \ - printf("BUG in %s (%s: line %i): ", __FUNCTION__, __FILE__, __LINE__); \ - printf(#x); \ - printf("\n"); \ - exit (-1); \ - } while (0); - - -/* Theses determine what infos the packet comes with */ -#define TARKIN_PACK_EXAMPLE 1 - -typedef struct { - uint8_t *data; - uint32_t data_len; - uint32_t storage; -} TarkinPacket; - - -typedef enum { - TARKIN_GRAYSCALE, - TARKIN_RGB24, /* tight packed RGB */ - TARKIN_RGB32, /* 32bit, no alphachannel */ - TARKIN_RGBA, /* dito w/ alphachannel */ - TARKIN_YUV2, /* 16 bits YUV */ - TARKIN_YUV12, /* 12 bits YUV */ - TARKIN_FYUV, /* Tarkin's Fast YUV-like? */ -} TarkinColorFormat; - -#define TARKIN_INTERNAL_FORMAT TARKIN_FYUV - -typedef enum { - TARKIN_OK = 0, - TARKIN_IO_ERROR, - TARKIN_SIGNATURE_NOT_FOUND, - TARKIN_INVALID_LAYER, - TARKIN_INVALID_COLOR_FORMAT, - TARKIN_VERSION, - TARKIN_BAD_HEADER, - TARKIN_NOT_TARKIN, - TARKIN_FAULT, - TARKIN_UNUSED, - TARKIN_NEED_MORE, - TARKIN_NOT_IMPLEMENTED -} TarkinError; - - - -typedef struct { - uint32_t width; - uint32_t height; - uint32_t a_moments; - uint32_t s_moments; - uint32_t frames_per_buf; - uint32_t bitstream_len; /* for all color components, bytes */ - TarkinColorFormat format; -} TarkinVideoLayerDesc; - - -typedef struct { - TarkinVideoLayerDesc desc; - uint32_t n_comp; /* number of color components */ - Wavelet3DBuf **waveletbuf; - TarkinPacket *packet; - uint32_t current_frame_in_buf; - uint32_t frameno; - - void (*color_fwd_xform) (uint8_t *rgba, Wavelet3DBuf *yuva [], uint32_t count); - void (*color_inv_xform) (Wavelet3DBuf *yuva [], uint8_t *rgba, uint32_t count); -} TarkinVideoLayer; - -typedef struct { - uint32_t numerator; - uint32_t denominator; -} TarkinTime; /* Let's say the unit is 1 second */ - -typedef struct TarkinInfo { - int version; - int n_layers; - TarkinVideoLayer *layer; - TarkinTime inter; /* numerator == O if per-frame time info. */ - int frames_per_block; - int comp_per_block; /* AKA "packets per block" for now */ - uint32_t max_bitstream_len; - - /* The below bitrate declarations are *hints*. - Combinations of the three values carry the following implications: - - all three set to the same value: - implies a fixed rate bitstream - only nominal set: - implies a VBR stream that averages the nominal bitrate. No hard - upper/lower limit - upper and or lower set: - implies a VBR bitstream that obeys the bitrate limits. nominal - may also be set to give a nominal rate. - none set: - the coder does not care to speculate. - */ - - long bitrate_upper; - long bitrate_nominal; - long bitrate_lower; - long bitrate_window; -} TarkinInfo; - -/* This is used for encoding */ -typedef struct { - unsigned char *header; - unsigned char *header1; - unsigned char *header2; -} tarkin_header_store; - - - - - /* Some of the fields in TarkinStream are redundent with TarkinInfo ones - * and will probably get deleted, namely n_layers and frames_per_buf */ -typedef struct TarkinStream { - uint32_t n_layers; - TarkinVideoLayer *layer; - uint32_t current_frame; - uint32_t current_frame_in_buf; - ogg_int64_t packetno; - uint32_t frames_per_buf; - uint32_t max_bitstream_len; - TarkinInfo *ti; - tarkin_header_store headers; - /* These callbacks are only used for encoding */ - TarkinError (*free_frame)(void *tarkinstream, void *ptr); - /* These thing allows not to buffer but it needs global var in caller. */ - TarkinError (*packet_out)(void *tarkinstream, ogg_packet *ptr); - void * user_ptr; -} TarkinStream; - - -typedef struct TarkinComment{ - /* unlimited user comment fields. libtarkin writes 'libtarkin' - whatever vendor is set to in encode */ - char **user_comments; - int *comment_lengths; - int comments; - char *vendor; - -} TarkinComment; - -/* Tarkin PRIMITIVES: general ***************************************/ - -/* The Tarkin header is in three packets, the initial small packet in - the first page that identifies basic parameters, that is a TarkinInfo - structure, a second packet with bitstream comments and a third packet - that holds the layers description structures. */ - - -/* Theses are the very same than Vorbis versions, they could be shared. */ -extern TarkinStream* tarkin_stream_new (); -extern void tarkin_stream_destroy (TarkinStream *s); -extern void tarkin_info_init(TarkinInfo *vi); -extern void tarkin_info_clear(TarkinInfo *vi); -extern void tarkin_comment_init(TarkinComment *vc); -extern void tarkin_comment_add(TarkinComment *vc, char *comment); -extern void tarkin_comment_add_tag(TarkinComment *vc, - char *tag, char *contents); -extern char *tarkin_comment_query(TarkinComment *vc, char *tag, int count); -extern int tarkin_comment_query_count(TarkinComment *vc, char *tag); -extern void tarkin_comment_clear(TarkinComment *vc); - -/* Tarkin PRIMITIVES: analysis layer ****************************/ -/* Tarkin encoding is done this way : you init it passing a fresh - * TarkinStream and a fresh TarkinInfo which has at least the rate_num - * field renseigned. You also pass it two callback functions: free_frame() - * is called when the lib doesn't need a frame anymore, and packet_out - * is called when a packet is ready. The pointers given as arguments to - * these callback functions are of course only valid at the function call - * time. The user_ptr is stored in s and can be used by packet_out(). */ -extern int tarkin_analysis_init(TarkinStream *s, - TarkinInfo *ti, - TarkinError (*free_frame)(void *tarkinstream, void *ptr), - TarkinError (*packet_out)(void *tarkinstream, ogg_packet *ptr), - void *user_ptr - ); -/* Then you need to add at least a layer in your stream, passing a - * TarkinVideoLayerDesc renseigned at least on the width, height and - * format parameters. */ -extern int tarkin_analysis_add_layer(TarkinStream *s, - TarkinVideoLayerDesc *tvld); -/* At that point you are ready to get headers out the lib by calling - * tarkin_analysis_headerout() passing it a renseigned TarkinComment - * structure. It does fill your 3 ogg_packet headers, which are valid - * till next call */ -extern int TarkinCommentheader_out(TarkinComment *vc, ogg_packet *op); -extern TarkinError tarkin_analysis_headerout(TarkinStream *s, - TarkinComment *vc, - ogg_packet *op, - ogg_packet *op_comm, - ogg_packet *op_code); -/* You are now ready to pass in frames to the codec, however don't free - * them before the codec told you so. It'll tell you when packets are - * ready to be taken out. When you have no more frame, simply pass NULL. - * If you encode multiple layers you have to do it synchronously, putting - * one frame from each layer at a time. */ -extern uint32_t tarkin_analysis_framein(TarkinStream *s, - uint8_t *frame, /* NULL for EOS */ - uint32_t layer, - TarkinTime *date); - -/* Tarkin PRIMITIVES: synthesis layer *******************************/ -/* For decoding, you needs first to give the three first packet of the - * stream to tarkin_synthesis_headerin() which will fill for you blank - * TarkinInfo and TarkinComment. */ -extern TarkinError tarkin_synthesis_headerin(TarkinInfo *vi,TarkinComment *vc, - ogg_packet *op); -/* Then you can init your stream with your TarkinInfo struct. */ -extern TarkinError tarkin_synthesis_init(TarkinStream *s,TarkinInfo *ti); -/* All subsequent packets are to this be passed to tarkin_synthesis_packetin*/ -extern TarkinError tarkin_synthesis_packetin(TarkinStream *s, ogg_packet *op); -/* and then tarkin_synthesis_frameout gives you ptr on next frame, or NULL. It - * also fills for you date. */ -extern TarkinError tarkin_synthesis_frameout(TarkinStream *s, - uint8_t **frame, uint32_t layer_id, TarkinTime *date); -/* When you're done with a frame, tell it to the codec with this. */ -extern int tarkin_synthesis_freeframe(TarkinStream *s, uint8_t *frame); - - -#endif - - - - - - diff --git a/ext/tarkin/wavelet.c b/ext/tarkin/wavelet.c deleted file mode 100644 index f6aeedc977..0000000000 --- a/ext/tarkin/wavelet.c +++ /dev/null @@ -1,124 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "mem.h" -#include "wavelet.h" - -/* - * (The transform code is in wavelet_xform.c) - */ - - -#define MAX(a,b) ((a) > (b) ? (a) : (b)) -#define MAX3(a,b,c) (MAX(a,MAX(b,c))) - - - -Wavelet3DBuf * -wavelet_3d_buf_new (uint32_t width, uint32_t height, uint32_t frames) -{ - Wavelet3DBuf *buf = (Wavelet3DBuf *) MALLOC (sizeof (Wavelet3DBuf)); - uint32_t _w = width; - uint32_t _h = height; - uint32_t _f = frames; - int level; - - if (!buf) - return NULL; - - buf->data = (TYPE *) MALLOC (width * height * frames * sizeof (TYPE)); - - if (!buf->data) { - wavelet_3d_buf_destroy (buf); - return NULL; - } - - buf->width = width; - buf->height = height; - buf->frames = frames; - buf->scales = 1; - - while (_w > 1 || _h > 1 || _f > 1) { - buf->scales++; - _w = (_w + 1) / 2; - _h = (_h + 1) / 2; - _f = (_f + 1) / 2; - } - - buf->w = (uint32_t *) MALLOC (buf->scales * sizeof (uint32_t)); - buf->h = (uint32_t *) MALLOC (buf->scales * sizeof (uint32_t)); - buf->f = (uint32_t *) MALLOC (buf->scales * sizeof (uint32_t)); - buf->offset = (uint32_t (*)[8]) MALLOC (8 * buf->scales * sizeof (uint32_t)); - - buf->scratchbuf = - (TYPE *) MALLOC (MAX3 (width, height, frames) * sizeof (TYPE)); - - if (!buf->w || !buf->h || !buf->f || !buf->offset || !buf->scratchbuf) { - wavelet_3d_buf_destroy (buf); - return NULL; - } - - buf->w[buf->scales - 1] = width; - buf->h[buf->scales - 1] = height; - buf->f[buf->scales - 1] = frames; - - for (level = buf->scales - 2; level >= 0; level--) { - buf->w[level] = (buf->w[level + 1] + 1) / 2; - buf->h[level] = (buf->h[level + 1] + 1) / 2; - buf->f[level] = (buf->f[level + 1] + 1) / 2; - buf->offset[level][0] = 0; - buf->offset[level][1] = buf->w[level]; - buf->offset[level][2] = buf->h[level] * width; - buf->offset[level][3] = buf->f[level] * width * height; - buf->offset[level][4] = buf->offset[level][2] + buf->w[level]; - buf->offset[level][5] = buf->offset[level][3] + buf->w[level]; - buf->offset[level][6] = buf->offset[level][3] + buf->offset[level][2]; - buf->offset[level][7] = buf->offset[level][6] + buf->w[level]; - } - - return buf; -} - - -void -wavelet_3d_buf_destroy (Wavelet3DBuf * buf) -{ - if (buf) { - if (buf->data) - FREE (buf->data); - if (buf->w) - FREE (buf->w); - if (buf->h) - FREE (buf->h); - if (buf->f) - FREE (buf->f); - if (buf->offset) - FREE (buf->offset); - if (buf->scratchbuf) - FREE (buf->scratchbuf); - FREE (buf); - } -} - - -#if defined(DBG_XFORM) - -#include "pnm.h" - -void -wavelet_3d_buf_dump (char *fmt, - uint32_t first_frame_in_buf, - uint32_t id, Wavelet3DBuf * buf, int16_t offset) -{ - char fname[256]; - uint32_t f; - - for (f = 0; f < buf->frames; f++) { - snprintf (fname, 256, fmt, id, first_frame_in_buf + f); - - write_pgm16 (fname, buf->data + f * buf->width * buf->height, - buf->width, buf->height, offset); - } -} -#endif diff --git a/ext/tarkin/wavelet.h b/ext/tarkin/wavelet.h deleted file mode 100644 index 6b7a7af4c0..0000000000 --- a/ext/tarkin/wavelet.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __WAVELET_H -#define __WAVELET_H - -#include "_stdint.h" - - -typedef struct { - TYPE *data; - uint32_t width; - uint32_t height; - uint32_t frames; - uint32_t scales; - uint32_t *w; - uint32_t *h; - uint32_t *f; - uint32_t (*offset)[8]; - TYPE *scratchbuf; -} Wavelet3DBuf; - - -extern Wavelet3DBuf* wavelet_3d_buf_new (uint32_t width, uint32_t height, - uint32_t frames); - -extern void wavelet_3d_buf_destroy (Wavelet3DBuf* buf); - -/* - * transform buf->data - * a_moments is the number of vanishing moments of the analyzing - * highpass filter, - * s_moments the one of the synthesizing lowpass filter. - */ -extern void wavelet_3d_buf_fwd_xform (Wavelet3DBuf* buf, - int a_moments, int s_moments); -extern void wavelet_3d_buf_inv_xform (Wavelet3DBuf* buf, - int a_moments, int s_moments); - -extern int wavelet_3d_buf_encode_coeff (const Wavelet3DBuf* buf, - uint8_t *bitstream, - uint32_t limit); - -extern void wavelet_3d_buf_decode_coeff (Wavelet3DBuf* buf, - uint8_t *bitstream, - uint32_t limit); - -#if defined(DBG_XFORM) -extern void wavelet_3d_buf_dump (char *fmt, - uint32_t first_frame_in_buf, - uint32_t id, - Wavelet3DBuf* buf, - int16_t offset); -#else -#define wavelet_3d_buf_dump(x...) -#endif - -#endif diff --git a/ext/tarkin/wavelet_coeff.c b/ext/tarkin/wavelet_coeff.c deleted file mode 100644 index fbe08f7813..0000000000 --- a/ext/tarkin/wavelet_coeff.c +++ /dev/null @@ -1,517 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "mem.h" -#include "wavelet.h" -#include "rle.h" - -#define printf(args...) - -#define GRAY_CODES 1 - -#if defined(GRAY_CODES) -static inline uint16_t -binary_to_gray (uint16_t x) -{ - return x ^ (x >> 1); -} - -static inline uint16_t -gray_to_binary (uint16_t x) -{ - int i; - - for (i = 1; i < 16; i += i) - x ^= x >> i; - return x; -} -#endif - - -static inline void -encode_coeff (ENTROPY_CODER significand_bitstream[], - ENTROPY_CODER insignificand_bitstream[], TYPE coeff) -{ - int sign = (coeff >> (8 * sizeof (TYPE) - 1)) & 1; - -#if defined(GRAY_CODES) - TYPE significance = binary_to_gray (coeff); -#else - static TYPE mask[2] = { 0, ~0 }; - TYPE significance = coeff ^ mask[sign]; -#endif - int i = TYPE_BITS; - - do { - i--; - OUTPUT_BIT (&significand_bitstream[i], (significance >> i) & 1); - } while (!((significance >> i) & 1) && i > 0); - - OUTPUT_BIT (&significand_bitstream[i], sign); - - while (--i >= 0) - OUTPUT_BIT (&insignificand_bitstream[i], (significance >> i) & 1); -} - - - -static inline TYPE -decode_coeff (ENTROPY_CODER significand_bitstream[], - ENTROPY_CODER insignificand_bitstream[]) -{ -#if !defined(GRAY_CODES) - static TYPE mask[2] = { 0, ~0 }; -#endif - TYPE significance = 0; - int sign; - int i = TYPE_BITS; - - do { - i--; - significance |= INPUT_BIT (&significand_bitstream[i]) << i; -/* if (ENTROPY_CODER_EOS(&significand_bitstream[i])) */ -/* return 0; */ - } while (!significance && i > 0); - - sign = INPUT_BIT (&significand_bitstream[i]); -/* if (ENTROPY_CODER_EOS(&significand_bitstream[i])) */ -/* return 0; */ - - while (--i >= 0) - significance |= INPUT_BIT (&insignificand_bitstream[i]) << i; - -#if defined(GRAY_CODES) - significance |= sign << (8 * sizeof (TYPE) - 1); - return gray_to_binary (significance); -#else - return (significance ^ mask[sign]); -#endif -} - - -static inline uint32_t -skip_0coeffs (Wavelet3DBuf * buf, - ENTROPY_CODER s_stream[], ENTROPY_CODER i_stream[], uint32_t limit) -{ - int i; - uint32_t skip = limit; - - for (i = 0; i < TYPE_BITS; i++) { - if (ENTROPY_CODER_SYMBOL (&s_stream[i]) != 0) { - return 0; - } else { - uint32_t runlength = ENTROPY_CODER_RUNLENGTH (&s_stream[i]); - - if (i == 0) - runlength /= 2; /* sign bits are in this bitplane ... */ - if (skip > runlength) - skip = runlength; - if (skip <= 2) - return 0; - } - } - - ENTROPY_CODER_SKIP (&s_stream[0], 2 * skip); /* kill sign+significance bits */ - - for (i = 1; i < TYPE_BITS; i++) - ENTROPY_CODER_SKIP (&s_stream[i], skip); - - return skip; -} - - - -#if 1 -static inline void -encode_quadrant (const Wavelet3DBuf * buf, - int level, int quadrant, uint32_t w, uint32_t h, uint32_t f, - ENTROPY_CODER significand_bitstream[], - ENTROPY_CODER insignificand_bitstream[]) -{ - uint32_t x, y, z; - - for (z = 0; z < f; z++) { - for (y = 0; y < h; y++) { - for (x = 0; x < w; x++) { - unsigned int index = buf->offset[level][quadrant] - + z * buf->width * buf->height + y * buf->width + x; - - encode_coeff (significand_bitstream, insignificand_bitstream, - buf->data[index]); - } - } - } -} - - -static void -encode_coefficients (const Wavelet3DBuf * buf, - ENTROPY_CODER s_stream[], ENTROPY_CODER i_stream[]) -{ - int level; - - encode_coeff (s_stream, i_stream, buf->data[0]); - - for (level = 0; level < buf->scales - 1; level++) { - uint32_t w, h, f, w1, h1, f1; - - w = buf->w[level]; - h = buf->h[level]; - f = buf->f[level]; - w1 = buf->w[level + 1] - w; - h1 = buf->h[level + 1] - h; - f1 = buf->f[level + 1] - f; - - if (w1 > 0) - encode_quadrant (buf, level, 1, w1, h, f, s_stream, i_stream); - if (h1 > 0) - encode_quadrant (buf, level, 2, w, h1, f, s_stream, i_stream); - if (f1 > 0) - encode_quadrant (buf, level, 3, w, h, f1, s_stream, i_stream); - if (w1 > 0 && h1 > 0) - encode_quadrant (buf, level, 4, w1, h1, f, s_stream, i_stream); - if (w1 > 0 && f1 > 0) - encode_quadrant (buf, level, 5, w1, h, f1, s_stream, i_stream); - if (h1 > 0 && f1 > 0) - encode_quadrant (buf, level, 6, w, h1, f1, s_stream, i_stream); - if (h1 > 0 && f1 > 0 && f1 > 0) - encode_quadrant (buf, level, 7, w1, h1, f1, s_stream, i_stream); - } -} - - -static inline void -decode_quadrant (Wavelet3DBuf * buf, - int level, int quadrant, uint32_t w, uint32_t h, uint32_t f, - ENTROPY_CODER s_stream[], ENTROPY_CODER i_stream[]) -{ - uint32_t x, y, z; - - z = 0; - do { - y = 0; - do { - x = 0; - do { - uint32_t skip; - uint32_t index = buf->offset[level][quadrant] - + z * buf->width * buf->height + y * buf->width + x; - - buf->data[index] = decode_coeff (s_stream, i_stream); - - skip = skip_0coeffs (buf, s_stream, i_stream, - (w - x - 1) + (h - y - 1) * w + (f - z - 1) * w * h); - if (skip > 0) { - x += skip; - while (x >= w) { - y++; - x -= w; - while (y >= h) { - z++; - y -= h; - if (z >= f) - return; - } - } - } - x++; - } while (x < w); - y++; - } while (y < h); - z++; - } while (z < f); -} - - -static void -decode_coefficients (Wavelet3DBuf * buf, - ENTROPY_CODER s_stream[], ENTROPY_CODER i_stream[]) -{ - int level; - - buf->data[0] = decode_coeff (s_stream, i_stream); - - for (level = 0; level < buf->scales - 1; level++) { - uint32_t w, h, f, w1, h1, f1; - - w = buf->w[level]; - h = buf->h[level]; - f = buf->f[level]; - w1 = buf->w[level + 1] - w; - h1 = buf->h[level + 1] - h; - f1 = buf->f[level + 1] - f; - - if (w1 > 0) - decode_quadrant (buf, level, 1, w1, h, f, s_stream, i_stream); - if (h1 > 0) - decode_quadrant (buf, level, 2, w, h1, f, s_stream, i_stream); - if (f1 > 0) - decode_quadrant (buf, level, 3, w, h, f1, s_stream, i_stream); - if (w1 > 0 && h1 > 0) - decode_quadrant (buf, level, 4, w1, h1, f, s_stream, i_stream); - if (w1 > 0 && f1 > 0) - decode_quadrant (buf, level, 5, w1, h, f1, s_stream, i_stream); - if (h1 > 0 && f1 > 0) - decode_quadrant (buf, level, 6, w, h1, f1, s_stream, i_stream); - if (h1 > 0 && f1 > 0 && f1 > 0) - decode_quadrant (buf, level, 7, w1, h1, f1, s_stream, i_stream); - } -} -#else - -static void -encode_coefficients (const Wavelet3DBuf * buf, - ENTROPY_CODER s_stream[], ENTROPY_CODER i_stream[]) -{ - uint32_t i; - - for (i = 0; i < buf->width * buf->height * buf->frames; i++) - encode_coeff (s_stream, i_stream, buf->data[i]); -} - - - - -static void -decode_coefficients (Wavelet3DBuf * buf, - ENTROPY_CODER s_stream[], ENTROPY_CODER i_stream[]) -{ - uint32_t i; - - for (i = 0; i < buf->width * buf->height * buf->frames; i++) { - uint32_t skip; - - buf->data[i] = decode_coeff (s_stream, i_stream); - - skip = skip_0coeffs (buf, s_stream, i_stream, - buf->width * buf->height * buf->frames - i); - i += skip; - } -} -#endif - - - -static uint32_t -setup_limittabs (ENTROPY_CODER significand_bitstream[], - ENTROPY_CODER insignificand_bitstream[], - uint32_t significand_limittab[], - uint32_t insignificand_limittab[], uint32_t limit) -{ - uint32_t significand_limit; - uint32_t insignificand_limit; - uint32_t byte_count; - int i; - - assert (limit > 2 * TYPE_BITS * sizeof (uint32_t)); /* limit too small */ - - printf ("%s: limit == %u\n", __FUNCTION__, limit); - byte_count = 2 * TYPE_BITS * sizeof (uint32_t); /* 2 binary coded limittabs */ - limit -= byte_count; - printf ("%s: rem. limit == %u\n", __FUNCTION__, limit); - - significand_limit = limit * 7 / 8; - insignificand_limit = limit - significand_limit; - - printf ("%s: limit == %u\n", __FUNCTION__, limit); - printf ("significand limit == %u\n", significand_limit); - printf ("insignificand limit == %u\n", insignificand_limit); - - for (i = TYPE_BITS - 1; i >= 0; i--) { - uint32_t s_bytes, i_bytes; - - if (i > 0) { - significand_limittab[i] = (significand_limit + 1) / 2; - insignificand_limittab[i] = (insignificand_limit + 1) / 2; - } else { - significand_limittab[0] = significand_limit; - insignificand_limittab[0] = insignificand_limit; - } - - s_bytes = ENTROPY_ENCODER_FLUSH (&significand_bitstream[i]); - i_bytes = ENTROPY_ENCODER_FLUSH (&insignificand_bitstream[i]); - - if (s_bytes < significand_limittab[i]) - significand_limittab[i] = s_bytes; - - if (i_bytes < insignificand_limittab[i]) - insignificand_limittab[i] = i_bytes; - - byte_count += significand_limittab[i]; - byte_count += insignificand_limittab[i]; - - printf ("insignificand_limittab[%i] == %u / %u\n", - i, insignificand_limittab[i], i_bytes); - printf (" significand_limittab[%i] == %u / %u\n", - i, significand_limittab[i], s_bytes); - - significand_limit -= significand_limittab[i]; - insignificand_limit -= insignificand_limittab[i]; - } - - printf ("byte_count == %u\n", byte_count); - - return byte_count; -} - - -/** - * write 'em binary for now, should be easy to compress ... - */ -static uint8_t * -write_limittabs (uint8_t * bitstream, - uint32_t significand_limittab[], uint32_t insignificand_limittab[]) -{ - int i; - - for (i = 0; i < TYPE_BITS; i++) { - *(uint32_t *) bitstream = significand_limittab[i]; - bitstream += 4; - } - - for (i = 0; i < TYPE_BITS; i++) { - *(uint32_t *) bitstream = insignificand_limittab[i]; - bitstream += 4; - } - - return bitstream; -} - - -static uint8_t * -read_limittabs (uint8_t * bitstream, - uint32_t significand_limittab[], uint32_t insignificand_limittab[]) -{ - int i; - - for (i = 0; i < TYPE_BITS; i++) { - significand_limittab[i] = *(uint32_t *) bitstream; - printf ("significand_limittab[%i] == %u\n", i, significand_limittab[i]); - bitstream += 4; - } - - for (i = 0; i < TYPE_BITS; i++) { - insignificand_limittab[i] = *(uint32_t *) bitstream; - printf ("insignificand_limittab[%i] == %u\n", i, - insignificand_limittab[i]); - bitstream += 4; - } - - return bitstream; -} - - -/** - * concatenate entropy coder bitstreams - */ -static void -merge_bitstreams (uint8_t * bitstream, - ENTROPY_CODER significand_bitstream[], - ENTROPY_CODER insignificand_bitstream[], - uint32_t significand_limittab[], uint32_t insignificand_limittab[]) -{ - int i; - - for (i = TYPE_BITS - 1; i >= 0; i--) { - memcpy (bitstream, - ENTROPY_CODER_BITSTREAM (&significand_bitstream[i]), - significand_limittab[i]); - - bitstream += significand_limittab[i]; - } - - for (i = TYPE_BITS - 1; i >= 0; i--) { - memcpy (bitstream, - ENTROPY_CODER_BITSTREAM (&insignificand_bitstream[i]), - insignificand_limittab[i]); - - bitstream += insignificand_limittab[i]; - } -} - - -static void -split_bitstreams (uint8_t * bitstream, - ENTROPY_CODER significand_bitstream[], - ENTROPY_CODER insignificand_bitstream[], - uint32_t significand_limittab[], uint32_t insignificand_limittab[]) -{ - uint32_t byte_count; - int i; - - for (i = TYPE_BITS - 1; i >= 0; i--) { - byte_count = significand_limittab[i]; - ENTROPY_DECODER_INIT (&significand_bitstream[i], bitstream, byte_count); - bitstream += byte_count; - } - - for (i = TYPE_BITS - 1; i >= 0; i--) { - byte_count = insignificand_limittab[i]; - ENTROPY_DECODER_INIT (&insignificand_bitstream[i], bitstream, byte_count); - bitstream += byte_count; - } -} - - -int -wavelet_3d_buf_encode_coeff (const Wavelet3DBuf * buf, - uint8_t * bitstream, uint32_t limit) -{ - ENTROPY_CODER significand_bitstream[TYPE_BITS]; - ENTROPY_CODER insignificand_bitstream[TYPE_BITS]; - uint32_t significand_limittab[TYPE_BITS]; - uint32_t insignificand_limittab[TYPE_BITS]; - uint32_t byte_count; - int i; - - for (i = 0; i < TYPE_BITS; i++) - ENTROPY_ENCODER_INIT (&significand_bitstream[i], limit); - for (i = 0; i < TYPE_BITS; i++) - ENTROPY_ENCODER_INIT (&insignificand_bitstream[i], limit); - - encode_coefficients (buf, significand_bitstream, insignificand_bitstream); - - byte_count = setup_limittabs (significand_bitstream, insignificand_bitstream, - significand_limittab, insignificand_limittab, limit); - - bitstream = write_limittabs (bitstream, - significand_limittab, insignificand_limittab); - - merge_bitstreams (bitstream, significand_bitstream, insignificand_bitstream, - significand_limittab, insignificand_limittab); - - for (i = 0; i < TYPE_BITS; i++) { - ENTROPY_ENCODER_DONE (&significand_bitstream[i]); - ENTROPY_ENCODER_DONE (&insignificand_bitstream[i]); - } - - return byte_count; -} - - -void -wavelet_3d_buf_decode_coeff (Wavelet3DBuf * buf, - uint8_t * bitstream, uint32_t byte_count) -{ - ENTROPY_CODER significand_bitstream[TYPE_BITS]; - ENTROPY_CODER insignificand_bitstream[TYPE_BITS]; - uint32_t significand_limittab[TYPE_BITS]; - uint32_t insignificand_limittab[TYPE_BITS]; - int i; - - memset (buf->data, 0, buf->width * buf->height * buf->frames * sizeof (TYPE)); - - bitstream = read_limittabs (bitstream, - significand_limittab, insignificand_limittab); - - split_bitstreams (bitstream, significand_bitstream, insignificand_bitstream, - significand_limittab, insignificand_limittab); - - decode_coefficients (buf, significand_bitstream, insignificand_bitstream); - - for (i = 0; i < TYPE_BITS; i++) { - ENTROPY_DECODER_DONE (&significand_bitstream[i]); - ENTROPY_DECODER_DONE (&insignificand_bitstream[i]); - } -} diff --git a/ext/tarkin/wavelet_xform.c b/ext/tarkin/wavelet_xform.c deleted file mode 100644 index c6eed7910a..0000000000 --- a/ext/tarkin/wavelet_xform.c +++ /dev/null @@ -1,421 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "mem.h" -#include -#include "wavelet.h" - - - -static void -fwd_analyze_1 (const TYPE * x, TYPE * d, int stride, int n) -{ - int i, k = n / 2; - - for (i = 0; i < k; i++) - d[i] = x[(2 * i + 1) * stride] - x[2 * i * stride]; -} - - -static void -fwd_synthesize_1 (const TYPE * x, TYPE * s, const TYPE * d, int stride, int n) -{ - int i, k = n / 2; - - for (i = 0; i < k; i++) - s[i * stride] = x[2 * i * stride] + d[i] / 2; - if (n & 1) - s[k * stride] = x[2 * k * stride] + d[k - 1] / 2; -} - - -static void -inv_analyze_1 (TYPE * x, const TYPE * d, int stride, int n) -{ - int i, k = n / 2; - - for (i = 0; i < k; i++) - x[(2 * i + 1) * stride] = d[i] + x[2 * i * stride]; -} - - -static void -inv_synthesize_1 (TYPE * x, const TYPE * s, const TYPE * d, int stride, int n) -{ - int i, k = n / 2; - - for (i = 0; i < k; i++) - x[2 * i * stride] = s[i] - d[i] / 2; - if (n & 1) - x[2 * k * stride] = s[k] - d[k - 1] / 2; -} - - - -static void -fwd_analyze_2 (const TYPE * x, TYPE * d, int stride, int n) -{ - int i, k = n / 2; - - if (n & 1) { - for (i = 0; i < k; i++) - d[i] = - x[(2 * i + 1) * stride] - (x[2 * i * stride] + x[(2 * i + - 2) * stride]) / 2; - } else { - for (i = 0; i < k - 1; i++) - d[i] = - x[(2 * i + 1) * stride] - (x[2 * i * stride] + x[(2 * i + - 2) * stride]) / 2; - d[k - 1] = x[(n - 1) * stride] - x[(n - 2) * stride]; - } -} - - - -static void -fwd_synthesize_2 (const TYPE * x, TYPE * s, const TYPE * d, int stride, int n) -{ - int i, k = n / 2; - - s[0] = x[0] + d[1] / 2; - for (i = 1; i < k; i++) - s[i * stride] = x[2 * i * stride] + (d[i - 1] + d[i]) / 4; - if (n & 1) - s[k * stride] = x[2 * k * stride] + d[k - 1] / 2; -} - - -static inline void -inv_analyze_2 (TYPE * x, const TYPE * d, int stride, int n) -{ - int i, k = n / 2; - - if (n & 1) { - for (i = 0; i < k; i++) - x[(2 * i + 1) * stride] = - d[i] + (x[2 * i * stride] + x[(2 * i + 2) * stride]) / 2; - } else { - for (i = 0; i < k - 1; i++) - x[(2 * i + 1) * stride] = - d[i] + (x[2 * i * stride] + x[(2 * i + 2) * stride]) / 2; - x[(n - 1) * stride] = d[k - 1] + x[(n - 2) * stride]; - } -} - - -static inline void -inv_synthesize_2 (TYPE * x, const TYPE * s, const TYPE * d, int stride, int n) -{ - int i, k = n / 2; - - x[0] = s[0] - d[1] / 2; - for (i = 1; i < k; i++) - x[2 * i * stride] = s[i] - (d[i - 1] + d[i]) / 4; - if (n & 1) - x[2 * k * stride] = s[k] - d[k - 1] / 2; -} - - - -static void -fwd_analyze_4 (const TYPE * x, TYPE * d, int stride, int n) -{ - int i, k = n / 2; - - d[0] = x[stride] - (x[0] + x[2 * stride]) / 2; - - if (n & 1) { - for (i = 1; i < k - 1; i++) - d[i] = x[(2 * i + 1) * stride] - - ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) - - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; - if (k > 1) - d[k - 1] = - x[(2 * k - 1) * stride] - (x[(2 * k - 2) * stride] + - x[2 * k * stride]) / 2; - } else { - for (i = 1; i < k - 2; i++) - d[i] = x[(2 * i + 1) * stride] - - ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) - - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; - if (k > 2) - d[k - 2] = x[(2 * k - 3) * stride] - (x[(2 * k - 4) * stride] - + x[(2 * k - 2) * stride]) / 2; - if (k > 1) - d[k - 1] = x[(n - 1) * stride] - x[(n - 2) * stride]; - } -} - - -static void -fwd_synthesize_4 (const TYPE * x, TYPE * s, const TYPE * d, int stride, int n) -{ - int i, k = n / 2; - - s[0] = x[0] + d[1] / 2; - if (k > 1) - s[stride] = x[2 * stride] + (d[0] + d[1]) / 4; - for (i = 2; i < k - 1; i++) - s[i * stride] = x[2 * i * stride] - + ((uint32_t) 9 * (d[i - 1] + d[i]) - (d[i - 2] + d[i + 1])) / 32; - if (k > 2) - s[(k - 1) * stride] = x[(2 * k - 2) * stride] + (d[k - 2] + d[k - 1]) / 4; - if (n & 1) - s[k * stride] = x[2 * k * stride] + d[k - 1] / 2; -} - - -static void -inv_analyze_4 (TYPE * x, const TYPE * d, int stride, int n) -{ - int i, k = n / 2; - - x[stride] = d[0] + (x[0] + x[2 * stride]) / 2; - - if (n & 1) { - for (i = 1; i < k - 1; i++) - x[(2 * i + 1) * stride] = d[i] - + ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) - - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; - if (k > 1) - x[(2 * k - 1) * stride] = - d[k - 1] + (x[(2 * k - 2) * stride] + x[2 * k * stride]) / 2; - } else { - for (i = 1; i < k - 2; i++) - x[(2 * i + 1) * stride] = d[i] - + (9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) - - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; - if (k > 2) - x[(2 * k - 3) * stride] = d[k - 2] + (x[(2 * k - 4) * stride] - + x[(2 * k - 2) * stride]) / 2; - if (k > 1) - x[(n - 1) * stride] = d[k - 1] + x[(n - 2) * stride]; - } -} - - -static void -inv_synthesize_4 (TYPE * x, const TYPE * s, const TYPE * d, int stride, int n) -{ - int i, k = n / 2; - - x[0] = s[0] - d[1] / 2; - if (k > 1) - x[2 * stride] = s[1] - (d[0] + d[1]) / 4; - for (i = 2; i < k - 1; i++) - x[2 * i * stride] = s[i] - ((uint32_t) 9 * (d[i - 1] + d[i]) - - (d[i - 2] + d[i + 1])) / 32; - if (k > 2) - x[(2 * k - 2) * stride] = s[k - 1] - (d[k - 2] + d[k - 1]) / 4; - if (n & 1) - x[2 * k * stride] = s[k] - d[k - 1] / 2; -} - - -static inline void -copyback_d (TYPE * x, const TYPE * d, int stride, int n) -{ - int i, j, k = n / 2; - - for (i = n - k, j = 0; i < n; i++, j++) - x[i * stride] = d[j]; -} - - -static inline void -copy_s_d (const TYPE * x, TYPE * s_d, int stride, int n) -{ - int i; - - for (i = 0; i < n; i++) - s_d[i] = x[i * stride]; -} - - - -typedef - void (*FwdSFnc) (const TYPE * x, TYPE * s, const TYPE * d, int stride, - int n); - -typedef void (*FwdAFnc) (const TYPE * x, TYPE * d, int stride, int n); - -typedef - void (*InvSFnc) (TYPE * x, const TYPE * s, const TYPE * d, int stride, - int n); - -typedef void (*InvAFnc) (TYPE * x, const TYPE * d, int stride, int n); - - - -static FwdSFnc fwd_synthesize[] = { NULL, fwd_synthesize_1, fwd_synthesize_2, - NULL, fwd_synthesize_4 -}; - -static FwdAFnc fwd_analyze[] = { NULL, fwd_analyze_1, fwd_analyze_2, - NULL, fwd_analyze_4 -}; - -static InvSFnc inv_synthesize[] = { NULL, inv_synthesize_1, inv_synthesize_2, - NULL, inv_synthesize_4 -}; - -static InvAFnc inv_analyze[] = { NULL, inv_analyze_1, inv_analyze_2, - NULL, inv_analyze_4 -}; - - - -static inline void -fwd_xform (TYPE * scratchbuf, TYPE * data, int stride, int n, - int a_moments, int s_moments) -{ - TYPE *x = data; - TYPE *d = scratchbuf; - TYPE *s = data; - - assert (a_moments == 1 || a_moments == 2 || a_moments == 4); - assert (s_moments == 1 || s_moments == 2 || s_moments == 4); - - /* XXX FIXME: Ugly hack to work around */ - /* the short-row bug in high */ - /* order xform functions */ - if (n < 9) - a_moments = s_moments = 2; - if (n < 5) - a_moments = s_moments = 1; - - fwd_analyze[a_moments] (x, d, stride, n); - fwd_synthesize[s_moments] (x, s, d, stride, n); - copyback_d (x, d, stride, n); -} - - -static inline void -inv_xform (TYPE * scratchbuf, TYPE * data, int stride, int n, - int a_moments, int s_moments) -{ - int k = n / 2; - TYPE *x = data; - TYPE *s = scratchbuf; - TYPE *d = scratchbuf + n - k; - - assert (a_moments == 1 || a_moments == 2 || a_moments == 4); - assert (s_moments == 1 || s_moments == 2 || s_moments == 4); - - /* XXX FIXME: Ugly hack to work around */ - /* the short-row bug in high */ - /* order xform functions */ - if (n < 9) - a_moments = s_moments = 2; - if (n < 5) - a_moments = s_moments = 1; - - copy_s_d (data, scratchbuf, stride, n); - inv_synthesize[s_moments] (x, s, d, stride, n); - inv_analyze[a_moments] (x, d, stride, n); -} - - - -void -wavelet_3d_buf_fwd_xform (Wavelet3DBuf * buf, int a_moments, int s_moments) -{ - int level; - - for (level = buf->scales - 1; level > 0; level--) { - uint32_t w = buf->w[level]; - uint32_t h = buf->h[level]; - uint32_t f = buf->f[level]; - - if (w > 1) { - int row, frame; - - for (frame = 0; frame < f; frame++) { - for (row = 0; row < h; row++) { - TYPE *data = buf->data + (frame * buf->height + row) * buf->width; - - fwd_xform (buf->scratchbuf, data, 1, w, a_moments, s_moments); - } - } - } - - if (h > 1) { - int col, frame; - - for (frame = 0; frame < f; frame++) { - for (col = 0; col < w; col++) { - TYPE *data = buf->data + frame * buf->width * buf->height + col; - - fwd_xform (buf->scratchbuf, data, buf->width, h, - a_moments, s_moments); - } - } - } - - if (f > 1) { - int i, j; - - for (j = 0; j < h; j++) { - for (i = 0; i < w; i++) { - TYPE *data = buf->data + j * buf->width + i; - - fwd_xform (buf->scratchbuf, data, buf->width * buf->height, f, - a_moments, s_moments); - } - } - } - } -} - - -void -wavelet_3d_buf_inv_xform (Wavelet3DBuf * buf, int a_moments, int s_moments) -{ - int level; - - for (level = 1; level < buf->scales; level++) { - uint32_t w = buf->w[level]; - uint32_t h = buf->h[level]; - uint32_t f = buf->f[level]; - - if (f > 1) { - int i, j; - - for (j = 0; j < h; j++) { - for (i = 0; i < w; i++) { - TYPE *data = buf->data + j * buf->width + i; - - inv_xform (buf->scratchbuf, data, buf->width * buf->height, f, - a_moments, s_moments); - } - } - } - - if (h > 1) { - int col, frame; - - for (frame = 0; frame < f; frame++) { - for (col = 0; col < w; col++) { - TYPE *data = buf->data + frame * buf->width * buf->height + col; - - inv_xform (buf->scratchbuf, data, buf->width, h, - a_moments, s_moments); - } - } - } - - if (w > 1) { - int row, frame; - - for (frame = 0; frame < f; frame++) { - for (row = 0; row < h; row++) { - TYPE *data = buf->data + (frame * buf->height + row) * buf->width; - - inv_xform (buf->scratchbuf, data, 1, w, a_moments, s_moments); - } - } - } - } -} diff --git a/ext/tarkin/yuv.c b/ext/tarkin/yuv.c deleted file mode 100644 index d781a3c8f2..0000000000 --- a/ext/tarkin/yuv.c +++ /dev/null @@ -1,234 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "yuv.h" - -/*#define TARKIN_YUV_EXACT*/ -/*#define TARKIN_YUV_LXY*/ - - -static inline uint8_t -CLAMP (int16_t x) -{ - return ((x > 255) ? 255 : (x < 0) ? 0 : x); -} - - - -void -rgb24_to_yuv (uint8_t * rgb, Wavelet3DBuf * yuv[], uint32_t frame) -{ - int count = yuv[0]->width * yuv[0]->height; - int16_t *y = yuv[0]->data + frame * count; - int16_t *u = yuv[1]->data + frame * count; - int16_t *v = yuv[2]->data + frame * count; - int i; - - -#if defined(TARKIN_YUV_EXACT) - for (i = 0; i < count; i++, rgb += 3) { - y[i] = ((int16_t) 77 * rgb[0] + 150 * rgb[1] + 29 * rgb[2]) / 256; - u[i] = ((int16_t) - 44 * rgb[0] - 87 * rgb[1] + 131 * rgb[2]) / 256; - v[i] = ((int16_t) 131 * rgb[0] - 110 * rgb[1] - 21 * rgb[2]) / 256; - } -#elif defined(TARKIN_YUV_LXY) - for (i = 0; i < count; i++, rgb += 3) { - y[i] = ((int16_t) 54 * rgb[0] + 182 * rgb[1] + 18 * rgb[2]) / 256; - u[i] = rgb[0] - y[i]; - v[i] = rgb[2] - y[i]; - } -#else - for (i = 0; i < count; i++, rgb += 3) { - v[i] = rgb[0] - rgb[1]; - u[i] = rgb[2] - rgb[1]; - y[i] = rgb[1] + (u[i] + v[i]) / 4; - } -#endif -} - - -void -yuv_to_rgb24 (Wavelet3DBuf * yuv[], uint8_t * rgb, uint32_t frame) -{ - int count = yuv[0]->width * yuv[0]->height; - int16_t *y = yuv[0]->data + frame * count; - int16_t *u = yuv[1]->data + frame * count; - int16_t *v = yuv[2]->data + frame * count; - int i; - -#if defined(TARKIN_YUV_EXACT) - for (i = 0; i < count; i++, rgb += 3) { - rgb[0] = CLAMP (y[i] + 1.371 * v[i]); - rgb[1] = CLAMP (y[i] - 0.698 * v[i] - 0.336 * u[i]); - rgb[2] = CLAMP (y[i] + 1.732 * u[i]); - } -#elif defined(TARKIN_YUV_LXY) - for (i = 0; i < count; i++, rgb += 3) { - rgb[1] = CLAMP (y[i] - (76 * u[i] - 26 * v[i]) / 256); - rgb[0] = CLAMP (y[i] + u[i]); - rgb[2] = CLAMP (y[i] + v[i]); - } -#else - for (i = 0; i < count; i++, rgb += 3) { - rgb[1] = CLAMP (y[i] - (u[i] + v[i]) / 4); - rgb[2] = CLAMP (u[i] + rgb[1]); - rgb[0] = CLAMP (v[i] + rgb[1]); - } -#endif -} - - -void -rgb32_to_yuv (uint8_t * rgb, Wavelet3DBuf * yuv[], uint32_t frame) -{ - int count = yuv[0]->width * yuv[0]->height; - int16_t *y = yuv[0]->data + frame * count; - int16_t *u = yuv[1]->data + frame * count; - int16_t *v = yuv[2]->data + frame * count; - int i; - -#if defined(TARKIN_YUV_EXACT) - for (i = 0; i < count; i++, rgb += 4) { - y[i] = ((int16_t) 77 * rgb[0] + 150 * rgb[1] + 29 * rgb[2]) / 256; - u[i] = ((int16_t) - 44 * rgb[0] - 87 * rgb[1] + 131 * rgb[2]) / 256; - v[i] = ((int16_t) 131 * rgb[0] - 110 * rgb[1] - 21 * rgb[2]) / 256; - } -#elif defined(TARKIN_YUV_LXY) - for (i = 0; i < count; i++, rgb += 4) { - y[i] = ((int16_t) 54 * rgb[0] + 182 * rgb[1] + 18 * rgb[2]) / 256; - u[i] = rgb[0] - y[i]; - v[i] = rgb[2] - y[i]; - } -#else - for (i = 0; i < count; i++, rgb += 4) { - v[i] = rgb[0] - rgb[1]; - u[i] = rgb[2] - rgb[1]; - y[i] = rgb[1] + (u[i] + v[i]) / 4; - } -#endif -} - - -void -yuv_to_rgb32 (Wavelet3DBuf * yuv[], uint8_t * rgb, uint32_t frame) -{ - int count = yuv[0]->width * yuv[0]->height; - int16_t *y = yuv[0]->data + frame * count; - int16_t *u = yuv[1]->data + frame * count; - int16_t *v = yuv[2]->data + frame * count; - int i; - -#if defined(TARKIN_YUV_EXACT) - for (i = 0; i < count; i++, rgb += 4) { - rgb[0] = CLAMP (y[i] + 1.371 * v[i]); - rgb[1] = CLAMP (y[i] - 0.698 * v[i] - 0.336 * u[i]); - rgb[2] = CLAMP (y[i] + 1.732 * u[i]); - } -#elif defined(TARKIN_YUV_LXY) - for (i = 0; i < count; i++, rgb += 4) { - rgb[1] = CLAMP (y[i] - (76 * u[i] - 26 * v[i]) / 256); - rgb[0] = CLAMP (y[i] + u[i]); - rgb[2] = CLAMP (y[i] + v[i]); - } -#else - for (i = 0; i < count; i++, rgb += 4) { - rgb[1] = CLAMP (y[i] - (u[i] + v[i]) / 4); - rgb[2] = CLAMP (u[i] + rgb[1]); - rgb[0] = CLAMP (v[i] + rgb[1]); - } -#endif -} - - -void -rgba_to_yuv (uint8_t * rgba, Wavelet3DBuf * yuva[], uint32_t frame) -{ - int count = yuva[0]->width * yuva[0]->height; - int16_t *y = yuva[0]->data + frame * count; - int16_t *u = yuva[1]->data + frame * count; - int16_t *v = yuva[2]->data + frame * count; - int16_t *a = yuva[3]->data + frame * count; - int i; - -#if defined(TARKIN_YUV_EXACT) - for (i = 0; i < count; i++, rgba += 4) { - y[i] = ((int16_t) 77 * rgba[0] + 150 * rgba[1] + 29 * rgba[2]) / 256; - u[i] = ((int16_t) - 44 * rgba[0] - 87 * rgba[1] + 131 * rgba[2]) / 256; - v[i] = ((int16_t) 131 * rgba[0] - 110 * rgba[1] - 21 * rgba[2]) / 256; - a[i] = rgba[3]; - } -#elif defined(TARKIN_YUV_LXY) - for (i = 0; i < count; i++, rgba += 4) { - y[i] = ((int16_t) 54 * rgba[0] + 182 * rgba[1] + 18 * rgba[2]) / 256; - u[i] = rgba[0] - y[i]; - v[i] = rgba[2] - y[i]; - a[i] = rgba[3]; - } -#else - for (i = 0; i < count; i++, rgba += 4) { - v[i] = rgba[0] - rgba[1]; - u[i] = rgba[2] - rgba[1]; - y[i] = rgba[1] + (u[i] + v[i]) / 4; - a[i] = rgba[3]; - } -#endif -} - - -void -yuv_to_rgba (Wavelet3DBuf * yuva[], uint8_t * rgba, uint32_t frame) -{ - int count = yuva[0]->width * yuva[0]->height; - int16_t *y = yuva[0]->data + frame * count; - int16_t *u = yuva[1]->data + frame * count; - int16_t *v = yuva[2]->data + frame * count; - int16_t *a = yuva[3]->data + frame * count; - int i; - -#if defined(TARKIN_YUV_EXACT) - for (i = 0; i < count; i++, rgba += 4) { - rgba[0] = CLAMP (y[i] + 1.371 * v[i]); - rgba[1] = CLAMP (y[i] - 0.698 * v[i] - 0.336 * u[i]); - rgba[2] = CLAMP (y[i] + 1.732 * u[i]); - rgba[3] = a[i]; - } -#elif defined(TARKIN_YUV_LXY) - for (i = 0; i < count; i++, rgba += 4) { - rgba[1] = CLAMP (y[i] - (76 * u[i] - 26 * v[i]) / 256); - rgba[0] = CLAMP (y[i] + u[i]); - rgba[2] = CLAMP (y[i] + v[i]); - rgba[3] = a[i]; - } -#else - for (i = 0; i < count; i++, rgba += 4) { - rgba[1] = CLAMP (y[i] - (u[i] + v[i]) / 4); - rgba[2] = CLAMP (u[i] + rgba[1]); - rgba[0] = CLAMP (v[i] + rgba[1]); - rgba[3] = a[i]; - } -#endif -} - -void -grayscale_to_y (uint8_t * rgba, Wavelet3DBuf * y[], uint32_t frame) -{ - int count = y[0]->width * y[0]->height; - int16_t *_y = y[0]->data + frame * count; - int i; - - for (i = 0; i < count; i++) - _y[i] = rgba[i]; -} - - -void -y_to_grayscale (Wavelet3DBuf * y[], uint8_t * rgba, uint32_t frame) -{ - int count = y[0]->width * y[0]->height; - int16_t *_y = y[0]->data + frame * count; - int i; - - for (i = 0; i < count; i++) - rgba[i] = CLAMP (_y[i]); -} diff --git a/ext/tarkin/yuv.h b/ext/tarkin/yuv.h deleted file mode 100644 index 036fc3549b..0000000000 --- a/ext/tarkin/yuv.h +++ /dev/null @@ -1,21 +0,0 @@ - -#ifndef __YUV_H -#define __YUV_H - -#include "_stdint.h" -#include "wavelet.h" - -extern void rgb24_to_yuv (uint8_t *rgb, Wavelet3DBuf *yuv [], uint32_t frame); -extern void yuv_to_rgb24 (Wavelet3DBuf *yuv [], uint8_t *rgb, uint32_t frame); - -extern void rgb32_to_yuv (uint8_t *rgb, Wavelet3DBuf *yuv [], uint32_t frame); -extern void yuv_to_rgb32 (Wavelet3DBuf *yuv [], uint8_t *rgb, uint32_t frame); - -extern void rgba_to_yuv (uint8_t *rgba, Wavelet3DBuf *yuva [], uint32_t frame); -extern void yuv_to_rgba (Wavelet3DBuf *yuva [], uint8_t *rgba, uint32_t frame); - -extern void grayscale_to_y (uint8_t *rgba, Wavelet3DBuf *y [], uint32_t frame); -extern void y_to_grayscale (Wavelet3DBuf *y [], uint8_t *rgba, uint32_t frame); - -#endif - diff --git a/ext/teletextdec/Makefile.am b/ext/teletextdec/Makefile.am new file mode 100644 index 0000000000..c153c563b2 --- /dev/null +++ b/ext/teletextdec/Makefile.am @@ -0,0 +1,10 @@ +plugin_LTLIBRARIES = libgstteletextdec.la + +libgstteletextdec_la_SOURCES = gstteletextdec.c teletext.c + +libgstteletextdec_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(TELETEXTDEC_CFLAGS) +libgstteletextdec_la_LIBADD = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_LIBS) $(TELETEXTDEC_LIBS) +libgstteletextdec_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstteletextdec_la_LIBTOOLFLAGS = --tag=disable-static + +noinst_HEADERS = gstteletextdec.h diff --git a/ext/teletextdec/gstteletextdec.c b/ext/teletextdec/gstteletextdec.c new file mode 100644 index 0000000000..846c243e41 --- /dev/null +++ b/ext/teletextdec/gstteletextdec.c @@ -0,0 +1,1240 @@ +/* + * GStreamer + * Copyright (C) 2009 Sebastian Pölsterl + * Copyright (C) 2010 Andoni Morales Alastruey + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General 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 + */ + +/** + * SECTION:element-teletextdec + * + * Decode PES stream containing teletext information to RGBA stream + * + * + * Example launch line + * |[ + * gst-launch -v -m filesrc location=recording.mpeg ! mpegtsdemux ! private/teletext ! teletextdec ! ffmpegcolorspace ! ximagesink + * ]| + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include "gstteletextdec.h" + +GST_DEBUG_CATEGORY_STATIC (gst_teletextdec_debug); +#define GST_CAT_DEFAULT gst_teletextdec_debug + +#define SUBTITLES_PAGE 888 +#define MAX_SLICES 32 +#define DEFAULT_FONT_DESCRIPTION "verdana 12" +#define PANGO_TEMPLATE " %s \n" + +/* Filter signals and args */ +enum +{ + LAST_SIGNAL +}; + +enum +{ + PROP_0, + PROP_PAGENO, + PROP_SUBNO, + PROP_SUBTITLES_MODE, + PROP_SUBS_TEMPLATE, + PROP_FONT_DESCRIPTION +}; + +enum +{ + VBI_ERROR = -1, + VBI_SUCCESS = 0, + VBI_NEW_FRAME = 1 +}; + +typedef enum +{ + DATA_UNIT_EBU_TELETEXT_NON_SUBTITLE = 0x02, + DATA_UNIT_EBU_TELETEXT_SUBTITLE = 0x03, + DATA_UNIT_EBU_TELETEXT_INVERTED = 0x0C, + + DATA_UNIT_ZVBI_WSS_CPR1204 = 0xB4, + DATA_UNIT_ZVBI_CLOSED_CAPTION_525 = 0xB5, + DATA_UNIT_ZVBI_MONOCHROME_SAMPLES_525 = 0xB6, + + DATA_UNIT_VPS = 0xC3, + DATA_UNIT_WSS = 0xC4, + DATA_UNIT_CLOSED_CAPTION = 0xC5, + DATA_UNIT_MONOCHROME_SAMPLES = 0xC6, + + DATA_UNIT_STUFFING = 0xFF, +} data_unit_id; + +typedef struct +{ + int pgno; + int subno; +} page_info; + +typedef enum +{ + SYSTEM_525 = 0, + SYSTEM_625 +} systems; + +/* + * ETS 300 706 Table 30: Colour Map + */ +static const gchar *default_color_map[40] = { + "#000000", "#FF0000", "#00FF00", "#FFFF00", "#0000FF", + "#FF00FF", "#00FFFF", "#FFFFFF", "#000000", "#770000", + "#007700", "#777700", "#000077", "#770077", "#007777", + "#777777", "#FF0055", "#FF7700", "#00FF77", "#FFFFBB", + "#00CCAA", "#550000", "#665522", "#CC7777", "#333333", + "#FF7777", "#77FF77", "#FFFF77", "#7777FF", "#FF77FF", + "#77FFFF", "#DDD0DD", + + /* Private colors */ + "#000000", "#FFAA99", "#44EE00", "#FFDD00", "#FFAA99", + "#FF00FF", "#00FFFF", "#EEEEEE" +}; + +static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS + ("video/mpeg,mpegversion=2,systemstream=TRUE ; private/teletext") + ); + +static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS + (GST_VIDEO_CAPS_RGBA "; text/plain ; text/html ; text/x-pango-markup") + ); + +/* debug category for filtering log messages */ +#define DEBUG_INIT(bla) \ + GST_DEBUG_CATEGORY_INIT (gst_teletextdec_debug, "teletext", 0, "Teletext decoder"); + +GST_BOILERPLATE_FULL (GstTeletextDec, gst_teletextdec, GstElement, + GST_TYPE_ELEMENT, DEBUG_INIT); + +static void gst_teletextdec_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec); +static void gst_teletextdec_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec); +static void gst_teletextdec_finalize (GObject * object); + +static GstStateChangeReturn gst_teletextdec_change_state (GstElement * element, + GstStateChange transition); + +static GstFlowReturn gst_teletextdec_chain (GstPad * pad, GstBuffer * buf); +static gboolean gst_teletextdec_sink_setcaps (GstPad * pad, GstCaps * caps); +static gboolean gst_teletextdec_sink_event (GstPad * pad, GstEvent * event); +static GstPadLinkReturn gst_teletextdec_src_set_caps (GstPad * pad, + GstCaps * caps); + +static vbi_bool gst_teletextdec_convert (vbi_dvb_demux * dx, gpointer user_data, + const vbi_sliced * sliced, guint n_lines, gint64 pts); +static void gst_teletextdec_event_handler (vbi_event * ev, void *user_data); + +static GstFlowReturn gst_teletextdec_push_page (GstTeletextDec * teletext); +static GstFlowReturn gst_teletextdec_export_text_page (GstTeletextDec * + teletext, vbi_page * page, GstBuffer ** buf); +static GstFlowReturn gst_teletextdec_export_html_page (GstTeletextDec * + teletext, vbi_page * page, GstBuffer ** buf); +static GstFlowReturn gst_teletextdec_export_rgba_page (GstTeletextDec * + teletext, vbi_page * page, GstBuffer ** buf); +static GstFlowReturn gst_teletextdec_export_pango_page (GstTeletextDec * + teletext, vbi_page * page, GstBuffer ** buf); + + +static gboolean gst_teletextdec_push_preroll_buffer (GstTeletextDec * teletext); +static void gst_teletextdec_process_telx_buffer (GstTeletextDec * teletext, + GstBuffer * buf); +static void gst_teletextdec_process_pes_buffer (GstTeletextDec * teletext, + GstBuffer * buf); +static gboolean gst_teletextdec_extract_data_units (GstTeletextDec * teletext, + GstTeletextFrame * f, guint8 * packet, guint * offset, gint size); + +static void gst_teletextdec_zvbi_init (GstTeletextDec * teletext); +static void gst_teletextdec_zvbi_clear (GstTeletextDec * teletext); + +/* GObject vmethod implementations */ + +static void +gst_teletextdec_base_init (gpointer klass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + + gst_element_class_set_details_simple (element_class, + "Teletext decoder", + "Decoder", + "Decode PES or raw VBI stream containing teletext information to RGBA, HTML and text", + "Sebastian Pölsterl , " + "Andoni Morales Alastruey "); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&src_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_template)); +} + +/* initialize the gstteletext's class */ +static void +gst_teletextdec_class_init (GstTeletextDecClass * klass) +{ + GObjectClass *gobject_class; + GstElementClass *gstelement_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->set_property = gst_teletextdec_set_property; + gobject_class->get_property = gst_teletextdec_get_property; + gobject_class->finalize = gst_teletextdec_finalize; + + gstelement_class = GST_ELEMENT_CLASS (klass); + gstelement_class->change_state = + GST_DEBUG_FUNCPTR (gst_teletextdec_change_state); + + g_object_class_install_property (gobject_class, PROP_PAGENO, + g_param_spec_int ("page", "Page number", + "Number of page that should displayed", + 100, 999, 100, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (gobject_class, PROP_SUBNO, + g_param_spec_int ("subpage", "Sub-page number", + "Number of sub-page that should displayed (-1 for all)", + -1, 0x99, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (gobject_class, PROP_SUBTITLES_MODE, + g_param_spec_boolean ("subtitles-mode", "Enable subtitles mode", + "Enables subtitles mode for text output stripping the blank lines and " + "the teletext state lines", FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (gobject_class, PROP_SUBS_TEMPLATE, + g_param_spec_string ("subtitles-template", "Subtitles output template", + "Output template used to print each one of the subtitles lines", + g_strescape ("%s\n", NULL), + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (gobject_class, PROP_FONT_DESCRIPTION, + g_param_spec_string ("font-description", "Pango font description", + "Font description used for the pango output.", + DEFAULT_FONT_DESCRIPTION, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +/* initialize the new element + * initialize instance structure + */ +static void +gst_teletextdec_init (GstTeletextDec * teletext, GstTeletextDecClass * klass) +{ + /* Create sink pad */ + teletext->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink"); + gst_pad_set_setcaps_function (teletext->sinkpad, + GST_DEBUG_FUNCPTR (gst_teletextdec_sink_setcaps)); + gst_pad_set_chain_function (teletext->sinkpad, + GST_DEBUG_FUNCPTR (gst_teletextdec_chain)); + gst_pad_set_event_function (teletext->sinkpad, + GST_DEBUG_FUNCPTR (gst_teletextdec_sink_event)); + gst_element_add_pad (GST_ELEMENT (teletext), teletext->sinkpad); + + /* Create src pad */ + teletext->srcpad = gst_pad_new_from_static_template (&src_template, "src"); + gst_pad_set_setcaps_function (teletext->srcpad, + GST_DEBUG_FUNCPTR (gst_teletextdec_src_set_caps)); + gst_element_add_pad (GST_ELEMENT (teletext), teletext->srcpad); + + teletext->demux = NULL; + teletext->decoder = NULL; + teletext->pageno = 0x100; + teletext->subno = -1; + teletext->subtitles_mode = FALSE; + teletext->subtitles_template = g_strescape ("%s\n", NULL); + teletext->font_description = g_strdup (DEFAULT_FONT_DESCRIPTION); + + teletext->in_timestamp = GST_CLOCK_TIME_NONE; + teletext->in_duration = GST_CLOCK_TIME_NONE; + + teletext->rate_numerator = 0; + teletext->rate_denominator = 1; + + teletext->queue = NULL; + teletext->queue_lock = g_mutex_new (); + + teletext->frame = g_new0 (GstTeletextFrame, 1); + teletext->frame->sliced_begin = g_new (vbi_sliced, MAX_SLICES); + + teletext->last_ts = 0; + + teletext->process_buf_func = NULL; +} + +static void +gst_teletextdec_finalize (GObject * object) +{ + GstTeletextDec *teletext = GST_TELETEXTDEC (object); + + g_mutex_free (teletext->queue_lock); + + g_free (teletext->frame); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void +gst_teletextdec_zvbi_init (GstTeletextDec * teletext) +{ + g_return_if_fail (teletext != NULL); + + GST_LOG_OBJECT (teletext, "Initializing structures"); + + teletext->decoder = vbi_decoder_new (); + + vbi_event_handler_register (teletext->decoder, + VBI_EVENT_TTX_PAGE | VBI_EVENT_CAPTION, + gst_teletextdec_event_handler, teletext); + + g_mutex_lock (teletext->queue_lock); + teletext->queue = g_queue_new (); + g_mutex_unlock (teletext->queue_lock); +} + +static void +gst_teletextdec_zvbi_clear (GstTeletextDec * teletext) +{ + g_return_if_fail (teletext != NULL); + + GST_LOG_OBJECT (teletext, "Clearing structures"); + + if (teletext->demux != NULL) { + vbi_dvb_demux_delete (teletext->demux); + teletext->demux = NULL; + } + if (teletext->decoder != NULL) { + vbi_decoder_delete (teletext->decoder); + teletext->decoder = NULL; + } + if (teletext->frame != NULL) { + g_free (teletext->frame); + teletext->frame = NULL; + } + + g_mutex_lock (teletext->queue_lock); + if (teletext->queue != NULL) { + g_queue_free (teletext->queue); + teletext->queue = NULL; + } + g_mutex_unlock (teletext->queue_lock); + + teletext->in_timestamp = GST_CLOCK_TIME_NONE; + teletext->in_duration = GST_CLOCK_TIME_NONE; + teletext->pageno = 0x100; + teletext->subno = -1; + teletext->last_ts = 0; +} + +static void +gst_teletextdec_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) +{ + GstTeletextDec *teletext = GST_TELETEXTDEC (object); + + switch (prop_id) { + case PROP_PAGENO: + teletext->pageno = (gint) vbi_bin2bcd (g_value_get_int (value)); + break; + case PROP_SUBNO: + teletext->subno = g_value_get_int (value); + break; + case PROP_SUBTITLES_MODE: + teletext->subtitles_mode = g_value_get_boolean (value); + break; + case PROP_SUBS_TEMPLATE: + teletext->subtitles_template = g_value_dup_string (value); + break; + case PROP_FONT_DESCRIPTION: + teletext->font_description = g_value_dup_string (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gst_teletextdec_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec) +{ + GstTeletextDec *teletext = GST_TELETEXTDEC (object); + + switch (prop_id) { + case PROP_PAGENO: + g_value_set_int (value, (gint) vbi_bcd2dec (teletext->pageno)); + break; + case PROP_SUBNO: + g_value_set_int (value, teletext->subno); + break; + case PROP_SUBTITLES_MODE: + g_value_set_boolean (value, teletext->subtitles_mode); + break; + case PROP_SUBS_TEMPLATE: + g_value_set_string (value, teletext->subtitles_template); + break; + case PROP_FONT_DESCRIPTION: + g_value_set_string (value, teletext->font_description); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static gboolean +gst_teletextdec_sink_event (GstPad * pad, GstEvent * event) +{ + gboolean ret; + GstTeletextDec *teletext = GST_TELETEXTDEC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (teletext, "got event %s", + gst_event_type_get_name (GST_EVENT_TYPE (event))); + + switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_NEWSEGMENT: + /* maybe save and/or update the current segment (e.g. for output + * clipping) or convert the event into one in a different format + * (e.g. BYTES to TIME) or drop it and set a flag to send a newsegment + * event in a different format later */ + ret = gst_pad_push_event (teletext->srcpad, event); + break; + case GST_EVENT_EOS: + /* end-of-stream, we should close down all stream leftovers here */ + gst_teletextdec_zvbi_clear (teletext); + ret = gst_pad_push_event (teletext->srcpad, event); + break; + case GST_EVENT_FLUSH_STOP: + gst_teletextdec_zvbi_clear (teletext); + gst_teletextdec_zvbi_init (teletext); + ret = gst_pad_push_event (teletext->srcpad, event); + break; + default: + ret = gst_pad_event_default (pad, event); + break; + } + + gst_object_unref (teletext); + + return ret; +} + +static GstStateChangeReturn +gst_teletextdec_change_state (GstElement * element, GstStateChange transition) +{ + GstStateChangeReturn ret; + GstTeletextDec *teletext; + + teletext = GST_TELETEXTDEC (element); + + switch (transition) { + case GST_STATE_CHANGE_READY_TO_PAUSED: + gst_teletextdec_zvbi_init (teletext); + break; + default: + break; + } + + 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_teletextdec_zvbi_clear (teletext); + break; + default: + break; + } + + return ret; +} + +static gboolean +gst_teletextdec_sink_setcaps (GstPad * pad, GstCaps * caps) +{ + GstTeletextDec *teletext = GST_TELETEXTDEC (gst_pad_get_parent (pad)); + GstStructure *structure = gst_caps_get_structure (caps, 0); + const gchar *mimetype = gst_structure_get_name (structure); + + GST_DEBUG_OBJECT (teletext, "%s:%s, caps=%" GST_PTR_FORMAT, + GST_DEBUG_PAD_NAME (pad), caps); + + if (g_strcmp0 (mimetype, "private/teletext") == 0) { + teletext->process_buf_func = gst_teletextdec_process_telx_buffer; + goto accept_caps; + } else if (g_strcmp0 (mimetype, "video/mpeg") == 0) { + gint version; + gboolean is_systemstream; + + if (!gst_structure_get_int (structure, "mpegversion", &version) || + !gst_structure_get_boolean (structure, "systemstream", + &is_systemstream)) + goto refuse_caps; + + if (version != 2 || !is_systemstream) + goto refuse_caps; + + teletext->process_buf_func = gst_teletextdec_process_pes_buffer; + teletext->demux = vbi_dvb_pes_demux_new (gst_teletextdec_convert, teletext); + goto accept_caps; + } else + goto refuse_caps; + +accept_caps: + { + gst_object_unref (teletext); + return gst_teletextdec_push_preroll_buffer (teletext); + } + +refuse_caps: + { + GST_ERROR_OBJECT (teletext, + "pad %s refused renegotiation to %" GST_PTR_FORMAT, + GST_PAD_NAME (pad), caps); + gst_object_unref (teletext); + return FALSE; + } +} + +static gboolean +gst_teletextdec_src_set_caps (GstPad * pad, GstCaps * caps) +{ + GstTeletextDec *teletext; + GstStructure *structure = NULL; + const gchar *mimetype; + GstPad *peer; + + teletext = GST_TELETEXTDEC (gst_pad_get_parent (pad)); + GST_DEBUG_OBJECT (teletext, "Linking teletext source pad"); + + if (gst_caps_is_empty (caps)) { + GST_ERROR_OBJECT (teletext, + "pad %s refused renegotiation to %" GST_PTR_FORMAT, + GST_PAD_NAME (pad), caps); + goto refuse_caps; + } + + peer = gst_pad_get_peer (pad); + if (peer) { + gst_pad_set_caps (peer, caps); + gst_object_unref (peer); + } + + structure = gst_caps_get_structure (caps, 0); + mimetype = gst_structure_get_name (structure); + + if (g_strcmp0 (mimetype, "video/x-raw-rgb") == 0) { + teletext->output_format = GST_TELETEXTDEC_OUTPUT_FORMAT_RGBA; + GST_DEBUG_OBJECT (teletext, "Selected RGBA output format"); + } else if (g_strcmp0 (mimetype, "text/html") == 0) { + teletext->output_format = GST_TELETEXTDEC_OUTPUT_FORMAT_HTML; + GST_DEBUG_OBJECT (teletext, "Selected HTML output format"); + } else if (g_strcmp0 (mimetype, "text/plain") == 0) { + teletext->output_format = GST_TELETEXTDEC_OUTPUT_FORMAT_TEXT; + GST_DEBUG_OBJECT (teletext, "Selected text output format"); + } else if (g_strcmp0 (mimetype, "text/x-pango-markup") == 0) { + teletext->output_format = GST_TELETEXTDEC_OUTPUT_FORMAT_PANGO; + GST_DEBUG_OBJECT (teletext, "Selected pango markup output format"); + } else + goto refuse_caps; + + gst_object_unref (teletext); + return TRUE; + + +refuse_caps: + { + gst_object_unref (teletext); + return FALSE; + } +} + +static void +gst_teletextdec_reset_frame (GstTeletextDec * teletext) +{ + teletext->frame->current_slice = teletext->frame->sliced_begin; + teletext->frame->sliced_end = teletext->frame->sliced_begin + MAX_SLICES; + teletext->frame->last_field = 0; + teletext->frame->last_field_line = 0; + teletext->frame->last_frame_line = 0; +} + +static void +gst_teletextdec_process_pes_buffer (GstTeletextDec * teletext, GstBuffer * buf) +{ + vbi_dvb_demux_feed (teletext->demux, GST_BUFFER_DATA (buf), + GST_BUFFER_SIZE (buf)); + return; +} + +static void +gst_teletextdec_process_telx_buffer (GstTeletextDec * teletext, GstBuffer * buf) +{ + guint8 *data = GST_BUFFER_DATA (buf); + const gint size = GST_BUFFER_SIZE (buf); + guint offset = 0; + gint res; + + teletext->in_timestamp = GST_BUFFER_TIMESTAMP (buf); + teletext->in_duration = GST_BUFFER_DURATION (buf); + + if (teletext->frame == NULL) { + gst_teletextdec_reset_frame (teletext); + } + + while (offset < size) { + res = + gst_teletextdec_extract_data_units (teletext, teletext->frame, data, + &offset, size); + + if (res == VBI_NEW_FRAME) { + /* We have a new frame, it's time to feed the decoder */ + vbi_sliced *s; + gint n_lines; + + n_lines = teletext->frame->current_slice - teletext->frame->sliced_begin; + GST_LOG_OBJECT (teletext, "Completed frame, decoding new %d lines", + n_lines); + s = g_memdup (teletext->frame->sliced_begin, + n_lines * sizeof (vbi_sliced)); + vbi_decode (teletext->decoder, s, n_lines, teletext->last_ts); + /* From vbi_decode(): + * timestamp shall advance by 1/30 to 1/25 seconds whenever calling this + * function. Failure to do so will be interpreted as frame dropping, which + * starts a resynchronization cycle, eventually a channel switch may be assumed + * which resets even more decoder state. So even if a frame did not contain + * any useful data this function must be called, with lines set to zero. + */ + teletext->last_ts += 0.04; + + g_free (s); + gst_teletextdec_reset_frame (teletext); + } else if (res == VBI_ERROR) { + gst_teletextdec_reset_frame (teletext); + return; + } + } + return; +} + +static vbi_bool +gst_teletextdec_convert (vbi_dvb_demux * dx, + gpointer user_data, const vbi_sliced * sliced, guint n_lines, gint64 pts) +{ + gdouble sample_time; + vbi_sliced *s; + + GstTeletextDec *teletext = GST_TELETEXTDEC (user_data); + + GST_DEBUG_OBJECT (teletext, "Converting %u lines to decode", n_lines); + + sample_time = pts * (1 / 90000.0); + + s = g_memdup (sliced, n_lines * sizeof (vbi_sliced)); + vbi_decode (teletext->decoder, s, n_lines, sample_time); + g_free (s); + + return GST_FLOW_OK; +} + +static void +gst_teletextdec_event_handler (vbi_event * ev, void *user_data) +{ + page_info *pi; + vbi_pgno pgno; + vbi_subno subno; + + GstTeletextDec *teletext = GST_TELETEXTDEC (user_data); + + switch (ev->type) { + case VBI_EVENT_TTX_PAGE: + pgno = ev->ev.ttx_page.pgno; + subno = ev->ev.ttx_page.subno; + + if (pgno != teletext->pageno + || (teletext->subno != -1 && subno != teletext->subno)) + return; + + GST_DEBUG_OBJECT (teletext, "Received teletext page %03d.%02d", + (gint) vbi_bcd2dec (pgno), (gint) vbi_bcd2dec (subno)); + + pi = g_new (page_info, 1); + pi->pgno = pgno; + pi->subno = subno; + + g_mutex_lock (teletext->queue_lock); + g_queue_push_tail (teletext->queue, pi); + g_mutex_unlock (teletext->queue_lock); + break; + case VBI_EVENT_CAPTION: + /* TODO: Handle subtitles in caption teletext pages */ + GST_DEBUG_OBJECT (teletext, "Received caption page. Not implemented"); + break; + default: + break; + } + return; +} + +/* this function does the actual processing + */ +static GstFlowReturn +gst_teletextdec_chain (GstPad * pad, GstBuffer * buf) +{ + GstTeletextDec *teletext = GST_TELETEXTDEC (GST_PAD_PARENT (pad)); + GstFlowReturn ret = GST_FLOW_OK; + + teletext->in_timestamp = GST_BUFFER_TIMESTAMP (buf); + teletext->in_duration = GST_BUFFER_DURATION (buf); + + teletext->process_buf_func (teletext, buf); + gst_buffer_unref (buf); + + g_mutex_lock (teletext->queue_lock); + if (!g_queue_is_empty (teletext->queue)) { + ret = gst_teletextdec_push_page (teletext); + if (ret != GST_FLOW_OK) { + g_mutex_unlock (teletext->queue_lock); + goto error; + } + } + g_mutex_unlock (teletext->queue_lock); + + return ret; + +/* ERRORS */ +error: + { + if (ret != GST_FLOW_OK && ret != GST_FLOW_NOT_LINKED + && ret != GST_FLOW_WRONG_STATE) { + GST_ELEMENT_ERROR (teletext, STREAM, FAILED, + ("Internal data stream error."), ("stream stopped, reason %s", + gst_flow_get_name (ret))); + return GST_FLOW_ERROR; + } + return ret; + } +} + +static GstFlowReturn +gst_teletextdec_push_page (GstTeletextDec * teletext) +{ + GstFlowReturn ret = GST_FLOW_OK; + GstBuffer *buf; + vbi_page page; + page_info *pi; + gint pgno, subno; + gboolean success; + + pi = (page_info *) g_queue_pop_head (teletext->queue); + + pgno = vbi_bcd2dec (pi->pgno); + subno = vbi_bcd2dec (pi->subno); + + GST_INFO_OBJECT (teletext, "Fetching teletext page %03d.%02d", pgno, subno); + + success = vbi_fetch_vt_page (teletext->decoder, &page, pi->pgno, pi->subno, + VBI_WST_LEVEL_3p5, 25, FALSE); + if (G_UNLIKELY (!success)) + goto fetch_page_failed; + + switch (teletext->output_format) { + case GST_TELETEXTDEC_OUTPUT_FORMAT_TEXT: + ret = gst_teletextdec_export_text_page (teletext, &page, &buf); + break; + case GST_TELETEXTDEC_OUTPUT_FORMAT_HTML: + ret = gst_teletextdec_export_html_page (teletext, &page, &buf); + break; + case GST_TELETEXTDEC_OUTPUT_FORMAT_RGBA: + ret = gst_teletextdec_export_rgba_page (teletext, &page, &buf); + break; + case GST_TELETEXTDEC_OUTPUT_FORMAT_PANGO: + ret = gst_teletextdec_export_pango_page (teletext, &page, &buf); + break; + default: + g_assert_not_reached (); + break; + } + vbi_unref_page (&page); + g_free (pi); + + if (ret != GST_FLOW_OK) + goto alloc_failed; + + GST_BUFFER_TIMESTAMP (buf) = teletext->in_timestamp; + GST_BUFFER_DURATION (buf) = teletext->in_duration; + + GST_INFO_OBJECT (teletext, "Pushing buffer of size %d", + GST_BUFFER_SIZE (buf)); + + ret = gst_pad_push (teletext->srcpad, buf); + if (ret != GST_FLOW_OK) + goto push_failed; + + return GST_FLOW_OK; + +fetch_page_failed: + { + GST_ELEMENT_ERROR (teletext, RESOURCE, READ, (NULL), (NULL)); + return GST_FLOW_ERROR; + } + +alloc_failed: + { + GST_ERROR_OBJECT (teletext, "Error allocating output buffer, reason %s", + gst_flow_get_name (ret)); + return ret; + } + +push_failed: + { + GST_ERROR_OBJECT (teletext, "Pushing buffer failed, reason %s", + gst_flow_get_name (ret)); + return ret; + } +} + +static gchar ** +gst_teletextdec_vbi_page_to_text_lines (GstTeletextDec * teletext, + guint start, guint stop, vbi_page * page) +{ + const guint lines_count = stop - start + 1; + const guint line_length = page->columns; + gchar **lines; + gint i; + + /* allocate a new NULL-terminated array of strings */ + lines = (gchar **) g_malloc (sizeof (gchar *) * (lines_count + 1)); + lines[lines_count] = g_strdup ('\0'); + + /* export each line in the range of the teletext page in text format */ + for (i = start; i <= stop; i++) { + lines[i - start] = (gchar *) g_malloc (sizeof (gchar) * (line_length + 1)); + vbi_print_page_region (page, lines[i - start], line_length + 1, "UTF-8", + TRUE, 0, 0, i, line_length, 1); + /* Add the null character */ + lines[i - start][line_length] = '\0'; + } + + return lines; +} + +static GstFlowReturn +gst_teletextdec_export_text_page (GstTeletextDec * teletext, vbi_page * page, + GstBuffer ** buf) +{ + GstCaps *caps; + GstFlowReturn ret; + gchar *text; + guint size; + + if (teletext->subtitles_mode) { + gchar **lines; + GString *subs; + guint i; + + lines = gst_teletextdec_vbi_page_to_text_lines (teletext, 1, 23, page); + subs = g_string_new (""); + /* Strip white spaces and squash blank lines */ + for (i = 0; i < 23; i++) { + g_strstrip (lines[i]); + if (g_strcmp0 (lines[i], "")) + g_string_append_printf (subs, teletext->subtitles_template, lines[i]); + } + /* if the page is blank and doesn't contain any line of text, just add a + * line break */ + if (!g_strcmp0 (subs->str, "")) + g_string_append (subs, "\n"); + + text = subs->str; + size = subs->len + 1; + g_string_free (subs, FALSE); + g_strfreev (lines); + } else { + size = page->columns * page->rows; + text = g_malloc (size); + vbi_print_page (page, text, size, "UTF-8", FALSE, TRUE); + } + + /* Allocate new buffer */ + caps = gst_caps_new_simple ("text/plain", NULL); + ret = gst_pad_alloc_buffer (teletext->srcpad, GST_BUFFER_OFFSET_NONE, + size, caps, &(*buf)); + if (G_LIKELY (ret == GST_FLOW_OK)) + GST_BUFFER_DATA (*buf) = GST_BUFFER_MALLOCDATA (*buf) = (guint8 *) text; + else + gst_buffer_unref (*buf); + + gst_caps_unref (caps); + return ret; +} + +static GstFlowReturn +gst_teletextdec_export_html_page (GstTeletextDec * teletext, vbi_page * page, + GstBuffer ** buf) +{ + GstCaps *caps; + GstFlowReturn ret; + gchar *html; + guint size; + vbi_export *ex; + gchar *err; + + if (!(ex = vbi_export_new ("html", &err))) { + GST_ELEMENT_ERROR (teletext, LIBRARY, SETTINGS, + ("Can't open the HTML export module: %s", err), (NULL)); + g_free (err); + return GST_FLOW_ERROR; + } + + /* export to NULL to get size of the memory needed to allocate the page */ + size = vbi_export_mem (ex, NULL, 0, page); + if (size < 0) + return GST_FLOW_ERROR; + html = g_malloc (size); + vbi_export_mem (ex, html, size, page); + + /* Allocate new buffer */ + caps = gst_caps_new_simple ("text/html", NULL); + ret = gst_pad_alloc_buffer (teletext->srcpad, GST_BUFFER_OFFSET_NONE, + size, caps, &(*buf)); + if (G_LIKELY (ret == GST_FLOW_OK)) + GST_BUFFER_DATA (*buf) = GST_BUFFER_MALLOCDATA (*buf) = (guint8 *) html; + + gst_caps_unref (caps); + return ret; +} + +static GstFlowReturn +gst_teletextdec_export_rgba_page (GstTeletextDec * teletext, vbi_page * page, + GstBuffer ** buf) +{ + guint size; + GstCaps *caps, *out_caps; + GstFlowReturn ret; + gint width, height; + GstPadTemplate *templ; + + /* one character occupies 12 x 10 pixels */ + width = page->columns * 12; + height = page->rows * 10; + + caps = gst_caps_new_simple ("video/x-raw-rgb", + "width", G_TYPE_INT, width, + "height", G_TYPE_INT, height, + "framerate", GST_TYPE_FRACTION, teletext->rate_numerator, + teletext->rate_denominator, NULL); + + templ = gst_static_pad_template_get (&src_template); + out_caps = gst_caps_intersect (caps, gst_pad_template_get_caps (templ)); + gst_caps_unref (caps); + gst_object_unref (templ); + + size = (guint) width *(guint) height *sizeof (vbi_rgba); + + ret = gst_pad_alloc_buffer_and_set_caps (teletext->srcpad, + GST_BUFFER_OFFSET_NONE, size, out_caps, &(*buf)); + + if (ret == GST_FLOW_OK) { + GST_DEBUG_OBJECT (teletext, "Creating image with %d rows and %d cols", + page->rows, page->columns); + vbi_draw_vt_page (page, VBI_PIXFMT_RGBA32_LE, + (vbi_rgba *) GST_BUFFER_DATA (*buf), FALSE, TRUE); + } + + gst_caps_unref (out_caps); + return ret; +} + +static GstFlowReturn +gst_teletextdec_export_pango_page (GstTeletextDec * teletext, vbi_page * page, + GstBuffer ** buf) +{ + vbi_char *acp; + const guint rows = page->rows; + gchar **colors; + gchar **lines; + GString *subs; + GstCaps *caps; + GstFlowReturn ret; + guint start, stop; + guint i, j; + + colors = (gchar **) g_malloc (sizeof (gchar *) * (rows + 1)); + colors[rows] = g_strdup ('\0'); + + /* parse all the lines and approximate it's foreground color using the first + * non null character */ + for (acp = page->text, i = 0; i < page->rows; acp += page->columns, i++) { + for (j = 0; j < page->columns; j++) { + colors[i] = g_strdup (default_color_map[7]); + if (acp[j].unicode != 0x20) { + colors[i] = g_strdup (default_color_map[acp[j].foreground]); + break; + } + } + } + + /* get an array of strings with each line of the telext page */ + start = teletext->subtitles_mode ? 1 : 0; + stop = teletext->subtitles_mode ? rows - 2 : rows - 1; + lines = gst_teletextdec_vbi_page_to_text_lines (teletext, start, stop, page); + + /* format each line in pango markup */ + subs = g_string_new (""); + for (i = start; i <= stop; i++) { + g_string_append_printf (subs, PANGO_TEMPLATE, + teletext->font_description, colors[i], lines[i - start]); + } + + /* Allocate new buffer */ + caps = gst_caps_new_simple ("text/x-pango-markup", NULL); + ret = gst_pad_alloc_buffer (teletext->srcpad, GST_BUFFER_OFFSET_NONE, + subs->len + 1, caps, &(*buf)); + if (G_LIKELY (ret == GST_FLOW_OK)) + GST_BUFFER_DATA (*buf) = GST_BUFFER_MALLOCDATA (*buf) = + (guint8 *) subs->str; + else + gst_buffer_unref (*buf); + + g_strfreev (lines); + g_strfreev (colors); + g_string_free (subs, FALSE); + gst_caps_unref (caps); + return ret; +} + +static gboolean +gst_teletextdec_push_preroll_buffer (GstTeletextDec * teletext) +{ + GstFlowReturn ret; + GstBuffer *buf; + gboolean res = TRUE; + GstStructure *structure; + const gchar *mimetype; + GstCaps *out_caps, *peer_caps, *pad_caps; + + /* the stream is sparse, we send a dummy buffer for preroll */ + peer_caps = gst_pad_peer_get_caps (teletext->srcpad); + pad_caps = gst_pad_get_caps (teletext->srcpad); + out_caps = gst_caps_intersect (pad_caps, peer_caps); + + if (gst_caps_is_empty (out_caps)) { + res = FALSE; + goto beach; + } + + gst_caps_truncate (out_caps); + structure = gst_caps_get_structure (out_caps, 0); + mimetype = gst_structure_get_name (structure); + if (g_strcmp0 (mimetype, "video/x-raw-rgb") == 0) { + /* omit preroll buffer for this format */ + goto beach; + } + + buf = gst_buffer_new_and_alloc (1); + GST_BUFFER_DATA (buf)[0] = 0; + gst_buffer_set_caps (buf, out_caps); + ret = gst_pad_push (teletext->srcpad, buf); + if (ret != GST_FLOW_OK) + res = FALSE; + +beach: + { + gst_caps_unref (out_caps); + gst_caps_unref (pad_caps); + gst_caps_unref (peer_caps); + return res; + } +} + + +/* Converts the line_offset / field_parity byte of a VBI data unit. */ +static void +gst_teletextdec_lofp_to_line (guint * field, guint * field_line, + guint * frame_line, guint lofp, systems system) +{ + guint line_offset; + + /* field_parity */ + *field = !(lofp & (1 << 5)); + + line_offset = lofp & 31; + + if (line_offset > 0) { + static const guint field_start[2][2] = { + {0, 263}, + {0, 313}, + }; + + *field_line = line_offset; + *frame_line = field_start[system][*field] + line_offset; + } else { + *field_line = 0; + *frame_line = 0; + } +} + +static int +gst_teletextdec_line_address (GstTeletextDec * teletext, + GstTeletextFrame * frame, vbi_sliced ** spp, guint lofp, systems system) +{ + guint field; + guint field_line; + guint frame_line; + + if (G_UNLIKELY (frame->current_slice >= frame->sliced_end)) { + GST_LOG_OBJECT (teletext, "Out of sliced VBI buffer space (%d lines).", + (int) (frame->sliced_end - frame->sliced_begin)); + return VBI_ERROR; + } + + gst_teletextdec_lofp_to_line (&field, &field_line, &frame_line, lofp, system); + + GST_LOG_OBJECT (teletext, "Line %u/%u=%u.", field, field_line, frame_line); + + if (frame_line != 0) { + GST_LOG_OBJECT (teletext, "Last frame Line %u.", frame->last_frame_line); + if (frame_line <= frame->last_frame_line) { + GST_LOG_OBJECT (teletext, "New frame"); + return VBI_NEW_FRAME; + } + + /* new segment flag */ + if (lofp < 0) { + GST_LOG_OBJECT (teletext, "New frame"); + return VBI_NEW_FRAME; + } + + frame->last_field = field; + frame->last_field_line = field_line; + frame->last_frame_line = frame_line; + + *spp = frame->current_slice++; + (*spp)->line = frame_line; + } else { + /* Undefined line. */ + return VBI_ERROR; + } + + return VBI_SUCCESS; +} + +static gboolean +gst_teletextdec_extract_data_units (GstTeletextDec * teletext, + GstTeletextFrame * f, guint8 * packet, guint * offset, gint size) +{ + guint8 *data_unit; + guint i; + + while (*offset < size) { + vbi_sliced *s = NULL; + gint data_unit_id, data_unit_length; + + data_unit = packet + *offset; + data_unit_id = data_unit[0]; + data_unit_length = data_unit[1]; + GST_LOG_OBJECT (teletext, "vbi header %02x %02x %02x\n", data_unit[0], + data_unit[1], data_unit[2]); + + switch (data_unit_id) { + case DATA_UNIT_STUFFING: + { + *offset += 2 + data_unit_length; + break; + } + + case DATA_UNIT_EBU_TELETEXT_NON_SUBTITLE: + case DATA_UNIT_EBU_TELETEXT_SUBTITLE: + { + gint res; + + if (G_UNLIKELY (data_unit_length != 1 + 1 + 42)) { + /* Skip this data unit */ + GST_WARNING_OBJECT (teletext, "The data unit length is not 44 bytes"); + *offset += 2 + data_unit_length; + break; + } + + res = + gst_teletextdec_line_address (teletext, f, &s, data_unit[2], + SYSTEM_625); + if (G_UNLIKELY (res == VBI_ERROR)) { + /* Can't retrieve line address, skip this data unit */ + GST_WARNING_OBJECT (teletext, + "Could not retrieve line address for this data unit"); + return VBI_ERROR; + } + if (G_UNLIKELY (f->last_field_line > 0 + && (f->last_field_line - 7 >= 23 - 7))) { + GST_WARNING_OBJECT (teletext, "Bad line: %d", f->last_field_line - 7); + return VBI_ERROR; + } + if (res == VBI_NEW_FRAME) { + /* New frame */ + return VBI_NEW_FRAME; + } + s->id = VBI_SLICED_TELETEXT_B; + for (i = 0; i < 42; i++) + s->data[i] = vbi_rev8 (data_unit[4 + i]); + *offset += 46; + break; + } + + case DATA_UNIT_ZVBI_WSS_CPR1204: + case DATA_UNIT_ZVBI_CLOSED_CAPTION_525: + case DATA_UNIT_ZVBI_MONOCHROME_SAMPLES_525: + case DATA_UNIT_VPS: + case DATA_UNIT_WSS: + case DATA_UNIT_CLOSED_CAPTION: + case DATA_UNIT_MONOCHROME_SAMPLES: + { + /*Not supported yet */ + *offset += 2 + data_unit_length; + break; + } + + default: + { + /* corrupted stream, increase the offset by one until we sync */ + GST_LOG_OBJECT (teletext, "Corrupted, increasing offset by one"); + *offset += 1; + break; + } + } + } + return VBI_SUCCESS; +} diff --git a/ext/teletextdec/gstteletextdec.h b/ext/teletextdec/gstteletextdec.h new file mode 100644 index 0000000000..460793d356 --- /dev/null +++ b/ext/teletextdec/gstteletextdec.h @@ -0,0 +1,107 @@ +/* + * GStreamer + * Copyright (C) 2009 Sebastian Pölsterl + * Copyright (C) 2010 Andoni Morales Alastruey + * + * This library is free software; you can redistribute it and/or + * mod1ify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General 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_TELETEXTDEC_H__ +#define __GST_TELETEXTDEC_H__ + +#include +#include + +G_BEGIN_DECLS +#define GST_TYPE_TELETEXTDEC \ + (gst_teletextdec_get_type()) +#define GST_TELETEXTDEC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TELETEXTDEC,GstTeletextDec)) +#define GST_TELETEXTDEC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TELETEXTDEC,GstTeletextDecClass)) +#define GST_IS_TELETEXTDEC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TELETEXTDEC)) +#define GST_IS_TELETEXTDEC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TELETEXTDEC)) +typedef struct _GstTeletextDec GstTeletextDec; +typedef struct _GstTeletextDecClass GstTeletextDecClass; +typedef struct _GstTeletextFrame GstTeletextFrame; +typedef enum _GstTeletextOutputFormat GstTeletextOutputFormat; + +enum _GstTeletextOutputFormat +{ + GST_TELETEXTDEC_OUTPUT_FORMAT_RGBA, + GST_TELETEXTDEC_OUTPUT_FORMAT_TEXT, + GST_TELETEXTDEC_OUTPUT_FORMAT_HTML, + GST_TELETEXTDEC_OUTPUT_FORMAT_PANGO +}; + +typedef void (*GstTeletextProcessBufferFunc) (GstTeletextDec * + teletext, GstBuffer * buf); + +struct _GstTeletextDec +{ + GstElement element; + + GstPad *sinkpad; + GstPad *srcpad; + + GstClockTime in_timestamp; + GstClockTime in_duration; + gint rate_numerator; + gint rate_denominator; + + /* Props */ + gint pageno; + gint subno; + gboolean subtitles_mode; + gchar *subtitles_template; + gchar *font_description; + + vbi_dvb_demux *demux; + vbi_decoder *decoder; + vbi_export *exporter; + GQueue *queue; + GMutex *queue_lock; + + GstTeletextFrame *frame; + float last_ts; + GstTeletextOutputFormat output_format; + + GstTeletextProcessBufferFunc process_buf_func; +}; + +struct _GstTeletextFrame +{ + vbi_sliced *sliced_begin; + vbi_sliced *sliced_end; + vbi_sliced *current_slice; + + guint last_field; + guint last_field_line; + guint last_frame_line; +}; + + +struct _GstTeletextDecClass +{ + GstElementClass parent_class; +}; + +GType gst_teletextdec_get_type (void); + +G_END_DECLS +#endif /* __GST_TELETEXTDEC_H__ */ diff --git a/ext/teletextdec/teletext.c b/ext/teletextdec/teletext.c new file mode 100644 index 0000000000..df4e635a05 --- /dev/null +++ b/ext/teletextdec/teletext.c @@ -0,0 +1,43 @@ +/* + * GStreamer + * Copyright (C) 2009 Sebastian Pölsterl + * + * This library is free software; you can redistribute it and/or + * mod1ify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General 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 +#include "gstteletextdec.h" + +/* entry point to initialize the plug-in + * initialize the plug-in itself + * register the element factories and other features + */ +static gboolean +teletext_init (GstPlugin * teletext) +{ + return gst_element_register (teletext, "teletextdec", GST_RANK_NONE, + GST_TYPE_TELETEXTDEC); +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "teletext", + "Teletext plugin", + teletext_init, VERSION, "LGPL", "GStreamer", "http://gstreamer.net/") diff --git a/ext/theora/Makefile.am b/ext/theora/Makefile.am deleted file mode 100644 index 91702a5e56..0000000000 --- a/ext/theora/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -### FIXME: rename directory to theoraexp - -plugin_LTLIBRARIES = libgsttheoraexp.la - -noinst_HEADERS = theoradec.h - -libgsttheoraexp_la_SOURCES = theoradec.c -libgsttheoraexp_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(THEORADEC_CFLAGS) -libgsttheoraexp_la_LIBADD = \ - $(GST_PLUGINS_BASE_LIBS) \ - -lgsttag-$(GST_MAJORMINOR) \ - $(GST_LIBS) \ - $(THEORADEC_LIBS) -libgsttheoraexp_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -libgsttheoraexp_la_LIBTOOLFLAGS = --tag=disable-static - diff --git a/ext/theora/theoradec.c b/ext/theora/theoradec.c deleted file mode 100644 index f5dba2f773..0000000000 --- a/ext/theora/theoradec.c +++ /dev/null @@ -1,1412 +0,0 @@ -/* GStreamer - * Copyright (C) 2004 Benjamin Otte - * 2006 Michael Smith - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/** - * SECTION:element-theoradecexp - * @see_also: theoradec, theoraenc, oggdemux - * - * This element decodes theora streams into raw video using the theora-exp - * decoder - * Theora is a royalty-free - * video codec maintained by the Xiph.org - * Foundation, based on the VP3 codec. - * - * - * Example pipeline - * |[ - * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoraexpdec ! xvimagesink - * ]| This example pipeline will demux an ogg stream and decode the theora video, - * displaying it on screen. - * - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "theoradec.h" -#include - -GST_DEBUG_CATEGORY_STATIC (theoradecexp_debug); -#define GST_CAT_DEFAULT theoradecexp_debug - -static GstStaticPadTemplate theora_dec_src_factory = -GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("video/x-raw-yuv, " - "format = (fourcc) { I420, YUY2, Y444 }, " - "framerate = (fraction) [0/1, MAX], " - "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]") - ); - -static GstStaticPadTemplate theora_dec_sink_factory = -GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("video/x-theora") - ); - -GST_BOILERPLATE (GstTheoraExpDec, gst_theoradec, GstElement, GST_TYPE_ELEMENT); - -static gboolean theora_dec_sink_event (GstPad * pad, GstEvent * event); -static GstFlowReturn theora_dec_chain (GstPad * pad, GstBuffer * buffer); -static GstStateChangeReturn theora_dec_change_state (GstElement * element, - GstStateChange transition); -static gboolean theora_dec_src_event (GstPad * pad, GstEvent * event); -static gboolean theora_dec_src_query (GstPad * pad, GstQuery * query); -static gboolean theora_dec_src_convert (GstPad * pad, - GstFormat src_format, gint64 src_value, - GstFormat * dest_format, gint64 * dest_value); -static gboolean theora_dec_sink_convert (GstPad * pad, - GstFormat src_format, gint64 src_value, - GstFormat * dest_format, gint64 * dest_value); -static gboolean theora_dec_sink_query (GstPad * pad, GstQuery * query); - -static const GstQueryType *theora_get_query_types (GstPad * pad); - -static void -gst_theoradec_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&theora_dec_src_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&theora_dec_sink_factory)); - gst_element_class_set_details_simple (element_class, "Theora video decoder", - "Codec/Decoder/Video", - "decode raw theora streams to raw YUV video using libtheoradec", - "Benjamin Otte , " - "Wim Taymans , " "Michael Smith "); -} - -static void -gst_theoradec_class_init (GstTheoraExpDecClass * klass) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); - - gstelement_class->change_state = theora_dec_change_state; - - GST_DEBUG_CATEGORY_INIT (theoradecexp_debug, "theoradecexp", 0, - "Theora decoder"); -} - -static void -gst_theoradec_init (GstTheoraExpDec * dec, GstTheoraExpDecClass * g_class) -{ - dec->sinkpad = - gst_pad_new_from_static_template (&theora_dec_sink_factory, "sink"); - gst_pad_set_query_function (dec->sinkpad, theora_dec_sink_query); - gst_pad_set_event_function (dec->sinkpad, theora_dec_sink_event); - gst_pad_set_chain_function (dec->sinkpad, theora_dec_chain); - gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad); - - dec->srcpad = - gst_pad_new_from_static_template (&theora_dec_src_factory, "src"); - gst_pad_set_event_function (dec->srcpad, theora_dec_src_event); - gst_pad_set_query_type_function (dec->srcpad, theora_get_query_types); - gst_pad_set_query_function (dec->srcpad, theora_dec_src_query); - gst_pad_use_fixed_caps (dec->srcpad); - - gst_element_add_pad (GST_ELEMENT (dec), dec->srcpad); - - dec->queued = NULL; -} - -static void -gst_theoradec_reset (GstTheoraExpDec * dec) -{ - GList *walk; - - dec->need_keyframe = TRUE; - dec->last_timestamp = -1; - dec->granulepos = -1; - dec->discont = TRUE; - dec->frame_nr = -1; - gst_segment_init (&dec->segment, GST_FORMAT_TIME); - - GST_OBJECT_LOCK (dec); - dec->proportion = 1.0; - dec->earliest_time = -1; - GST_OBJECT_UNLOCK (dec); - - for (walk = dec->queued; walk; walk = g_list_next (walk)) { - gst_buffer_unref (GST_BUFFER_CAST (walk->data)); - } - g_list_free (dec->queued); - dec->queued = NULL; -} - -static gint64 -inc_granulepos (GstTheoraExpDec * dec, gint64 granulepos) -{ - gint framecount; - - if (granulepos == -1) - return -1; - - framecount = th_granule_frame (dec->dec, granulepos); - - return (framecount + 1) << dec->info.keyframe_granule_shift; -} - -static const GstQueryType * -theora_get_query_types (GstPad * pad) -{ - static const GstQueryType theora_src_query_types[] = { - GST_QUERY_POSITION, - GST_QUERY_DURATION, - GST_QUERY_CONVERT, - 0 - }; - - return theora_src_query_types; -} - -static GstClockTime -gst_theoradec_granule_clocktime (GstTheoraExpDec * dec, ogg_int64_t granulepos) -{ - /* Avoid using theora_granule_time, which returns a double (in seconds); not - * what we want - */ - if (granulepos >= 0) { - guint64 framecount = th_granule_frame (dec->dec, granulepos); - - return gst_util_uint64_scale_int (framecount * GST_SECOND, - dec->info.fps_denominator, dec->info.fps_numerator); - } - return -1; -} - -static gboolean -theora_dec_src_convert (GstPad * pad, - GstFormat src_format, gint64 src_value, - GstFormat * dest_format, gint64 * dest_value) -{ - gboolean res = TRUE; - GstTheoraExpDec *dec; - guint64 scale = 1; - - if (src_format == *dest_format) { - *dest_value = src_value; - return TRUE; - } - - dec = GST_THEORA_DEC_EXP (gst_pad_get_parent (pad)); - - /* we need the info part before we can done something */ - if (!dec->have_header) - goto no_header; - - switch (src_format) { - case GST_FORMAT_BYTES: - switch (*dest_format) { - case GST_FORMAT_DEFAULT: - *dest_value = gst_util_uint64_scale_int (src_value, 8, - dec->info.pic_height * dec->info.pic_width * dec->output_bpp); - break; - case GST_FORMAT_TIME: - /* seems like a rather silly conversion, implement me if you like */ - default: - res = FALSE; - } - break; - case GST_FORMAT_TIME: - switch (*dest_format) { - case GST_FORMAT_BYTES: - scale = dec->output_bpp * - (dec->info.pic_width * dec->info.pic_height) / 8; - case GST_FORMAT_DEFAULT: - if (dec->info.fps_numerator && dec->info.fps_denominator) - *dest_value = scale * gst_util_uint64_scale (src_value, - dec->info.fps_numerator, - dec->info.fps_denominator * GST_SECOND); - else - res = FALSE; - break; - default: - res = FALSE; - } - break; - case GST_FORMAT_DEFAULT: - switch (*dest_format) { - case GST_FORMAT_TIME: - if (dec->info.fps_numerator && dec->info.fps_denominator) - *dest_value = gst_util_uint64_scale (src_value, - GST_SECOND * dec->info.fps_denominator, - dec->info.fps_numerator); - else - res = FALSE; - break; - case GST_FORMAT_BYTES: - *dest_value = gst_util_uint64_scale_int (src_value, - dec->output_bpp * dec->info.pic_width * dec->info.pic_height, 8); - break; - default: - res = FALSE; - } - break; - default: - res = FALSE; - } -done: - gst_object_unref (dec); - return res; - - /* ERRORS */ -no_header: - { - GST_DEBUG_OBJECT (dec, "no header yet, cannot convert"); - res = FALSE; - goto done; - } -} - -static gboolean -theora_dec_sink_convert (GstPad * pad, - GstFormat src_format, gint64 src_value, - GstFormat * dest_format, gint64 * dest_value) -{ - gboolean res = TRUE; - GstTheoraExpDec *dec; - - if (src_format == *dest_format) { - *dest_value = src_value; - return TRUE; - } - - dec = GST_THEORA_DEC_EXP (gst_pad_get_parent (pad)); - - /* we need the info part before we can done something */ - if (!dec->have_header) - goto no_header; - - switch (src_format) { - case GST_FORMAT_DEFAULT: - switch (*dest_format) { - case GST_FORMAT_TIME: - *dest_value = gst_theoradec_granule_clocktime (dec, src_value); - break; - default: - res = FALSE; - } - break; - case GST_FORMAT_TIME: - switch (*dest_format) { - case GST_FORMAT_DEFAULT: - { - guint rest; - - if (!dec->info.fps_numerator || !dec->info.fps_denominator) { - res = FALSE; - break; - } - - /* framecount */ - *dest_value = gst_util_uint64_scale (src_value, - dec->info.fps_numerator, GST_SECOND * dec->info.fps_denominator); - - /* funny way of calculating granulepos in theora */ - rest = *dest_value / (1 << dec->info.keyframe_granule_shift); - *dest_value -= rest; - *dest_value <<= dec->info.keyframe_granule_shift; - *dest_value += rest; - break; - } - default: - res = FALSE; - break; - } - break; - default: - res = FALSE; - } -done: - gst_object_unref (dec); - return res; - - /* ERRORS */ -no_header: - { - GST_DEBUG_OBJECT (dec, "no header yet, cannot convert"); - res = FALSE; - goto done; - } -} - -static gboolean -theora_dec_src_query (GstPad * pad, GstQuery * query) -{ - GstTheoraExpDec *dec; - - gboolean res = FALSE; - - dec = GST_THEORA_DEC_EXP (gst_pad_get_parent (pad)); - - switch (GST_QUERY_TYPE (query)) { - case GST_QUERY_POSITION: - { - gint64 granulepos, value; - GstFormat my_format, format; - gint64 time; - - /* we can convert a granule position to everything */ - granulepos = dec->granulepos; - - GST_LOG_OBJECT (dec, - "query %p: we have current granule: %lld", query, granulepos); - - /* parse format */ - gst_query_parse_position (query, &format, NULL); - - /* and convert to the final format in two steps with time as the - * intermediate step */ - my_format = GST_FORMAT_TIME; - if (!(res = - theora_dec_sink_convert (dec->sinkpad, GST_FORMAT_DEFAULT, - granulepos, &my_format, &time))) - goto error; - - time = gst_segment_to_stream_time (&dec->segment, GST_FORMAT_TIME, time); - - GST_LOG_OBJECT (dec, - "query %p: our time: %" GST_TIME_FORMAT, query, GST_TIME_ARGS (time)); - - if (!(res = - theora_dec_src_convert (pad, my_format, time, &format, &value))) - goto error; - - gst_query_set_position (query, format, value); - - GST_LOG_OBJECT (dec, - "query %p: we return %lld (format %u)", query, value, format); - - break; - } - case GST_QUERY_DURATION: - { - /* forward to peer for total */ - GstPad *peer; - - if (!(peer = gst_pad_get_peer (dec->sinkpad))) - goto error; - - res = gst_pad_query (peer, query); - gst_object_unref (peer); - if (!res) - goto error; - break; - } - case GST_QUERY_CONVERT: - { - GstFormat src_fmt, dest_fmt; - gint64 src_val, dest_val; - - gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); - if (!(res = - theora_dec_src_convert (pad, src_fmt, src_val, &dest_fmt, - &dest_val))) - goto error; - - gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); - break; - } - default: - res = gst_pad_query_default (pad, query); - break; - } -done: - gst_object_unref (dec); - - return res; - - /* ERRORS */ -error: - { - GST_DEBUG_OBJECT (dec, "query failed"); - goto done; - } -} - -static gboolean -theora_dec_sink_query (GstPad * pad, GstQuery * query) -{ - gboolean res = FALSE; - - switch (GST_QUERY_TYPE (query)) { - case GST_QUERY_CONVERT: - { - GstFormat src_fmt, dest_fmt; - gint64 src_val, dest_val; - - gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); - if (!(res = - theora_dec_sink_convert (pad, src_fmt, src_val, &dest_fmt, - &dest_val))) - goto error; - - gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); - break; - } - default: - res = gst_pad_query_default (pad, query); - break; - } - -error: - return res; -} - -static gboolean -theora_dec_src_event (GstPad * pad, GstEvent * event) -{ - gboolean res = TRUE; - GstTheoraExpDec *dec; - - dec = GST_THEORA_DEC_EXP (gst_pad_get_parent (pad)); - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_SEEK: - { - GstFormat format, tformat; - gdouble rate; - GstEvent *real_seek; - GstSeekFlags flags; - GstSeekType cur_type, stop_type; - gint64 cur, stop; - gint64 tcur, tstop; - - gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur, - &stop_type, &stop); - gst_event_unref (event); - - /* we have to ask our peer to seek to time here as we know - * nothing about how to generate a granulepos from the src - * formats or anything. - * - * First bring the requested format to time - */ - tformat = GST_FORMAT_TIME; - if (!(res = theora_dec_src_convert (pad, format, cur, &tformat, &tcur))) - goto convert_error; - if (!(res = theora_dec_src_convert (pad, format, stop, &tformat, &tstop))) - goto convert_error; - - /* then seek with time on the peer */ - real_seek = gst_event_new_seek (rate, GST_FORMAT_TIME, - flags, cur_type, tcur, stop_type, tstop); - - res = gst_pad_push_event (dec->sinkpad, real_seek); - - gst_event_unref (event); - break; - } - case GST_EVENT_QOS: - { - gdouble proportion; - GstClockTimeDiff diff; - GstClockTime timestamp; - - gst_event_parse_qos (event, &proportion, &diff, ×tamp); - - /* we cannot randomly skip frame decoding since we don't have - * B frames. we can however use the timestamp and diff to not - * push late frames. This would let us save the time for copying and - * cropping the frame. */ - GST_OBJECT_LOCK (dec); - dec->proportion = proportion; - dec->earliest_time = timestamp + diff; - GST_OBJECT_UNLOCK (dec); - - res = gst_pad_event_default (pad, event); - break; - } - default: - res = gst_pad_event_default (pad, event); - break; - } -done: - gst_object_unref (dec); - - return res; - - /* ERRORS */ -convert_error: - { - GST_DEBUG_OBJECT (dec, "could not convert format"); - goto done; - } -} - -static gboolean -theora_dec_sink_event (GstPad * pad, GstEvent * event) -{ - gboolean ret = FALSE; - GstTheoraExpDec *dec; - - dec = GST_THEORA_DEC_EXP (gst_pad_get_parent (pad)); - - GST_LOG_OBJECT (dec, "handling event"); - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_FLUSH_START: - ret = gst_pad_push_event (dec->srcpad, event); - break; - case GST_EVENT_FLUSH_STOP: - /* TODO: Call appropriate func with OC_DECCTL_SET_GRANPOS? */ - gst_theoradec_reset (dec); - ret = gst_pad_push_event (dec->srcpad, event); - break; - case GST_EVENT_EOS: - ret = gst_pad_push_event (dec->srcpad, event); - break; - case GST_EVENT_NEWSEGMENT: - { - gboolean update; - GstFormat format; - gdouble rate, arate; - gint64 start, stop, time; - - gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format, - &start, &stop, &time); - - /* we need TIME and a positive rate */ - if (format != GST_FORMAT_TIME) - goto newseg_wrong_format; - - if (rate <= 0.0) - goto newseg_wrong_rate; - - /* now configure the values */ - gst_segment_set_newsegment_full (&dec->segment, update, - rate, arate, format, start, stop, time); - - /* and forward */ - ret = gst_pad_push_event (dec->srcpad, event); - break; - } - default: - ret = gst_pad_push_event (dec->srcpad, event); - break; - } -done: - gst_object_unref (dec); - - return ret; - - /* ERRORS */ -newseg_wrong_format: - { - GST_DEBUG_OBJECT (dec, "received non TIME newsegment"); - gst_event_unref (event); - goto done; - } -newseg_wrong_rate: - { - GST_DEBUG_OBJECT (dec, "negative rates not supported yet"); - gst_event_unref (event); - goto done; - } -} - -static GstFlowReturn -theora_handle_comment_packet (GstTheoraExpDec * dec, ogg_packet * packet) -{ - gchar *encoder = NULL; - GstBuffer *buf; - GstTagList *list; - - GST_DEBUG_OBJECT (dec, "parsing comment packet"); - - buf = gst_buffer_new_and_alloc (packet->bytes); - memcpy (GST_BUFFER_DATA (buf), packet->packet, packet->bytes); - - list = - gst_tag_list_from_vorbiscomment_buffer (buf, (guint8 *) "\201theora", 7, - &encoder); - - gst_buffer_unref (buf); - - if (!list) { - GST_ERROR_OBJECT (dec, "couldn't decode comments"); - list = gst_tag_list_new (); - } - if (encoder) { - gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, - GST_TAG_ENCODER, encoder, NULL); - g_free (encoder); - } - gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, - GST_TAG_ENCODER_VERSION, dec->info.version_major, - GST_TAG_VIDEO_CODEC, "Theora", NULL); - - if (dec->info.target_bitrate > 0) { - gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, - GST_TAG_BITRATE, dec->info.target_bitrate, - GST_TAG_NOMINAL_BITRATE, dec->info.target_bitrate, NULL); - } - - gst_element_found_tags_for_pad (GST_ELEMENT_CAST (dec), dec->srcpad, list); - - return GST_FLOW_OK; -} - -static GstFlowReturn -theora_handle_type_packet (GstTheoraExpDec * dec, ogg_packet * packet) -{ - GstCaps *caps; - gint par_num, par_den; - guint32 fourcc; - - GST_DEBUG_OBJECT (dec, "fps %d/%d, PAR %d/%d", - dec->info.fps_numerator, dec->info.fps_denominator, - dec->info.aspect_numerator, dec->info.aspect_denominator); - - /* calculate par - * the info.aspect_* values reflect PAR; - * 0 for either is undefined; we're told to assume 1:1 */ - par_num = dec->info.aspect_numerator; - par_den = dec->info.aspect_denominator; - if (par_num == 0 || par_den == 0) { - par_num = par_den = 1; - } - /* theora has: - * - * frame_width/frame_height : dimension of the encoded frame - * pic_width/pic_height : dimension of the visible part - * pic_x/pic_y : offset in encoded frame where visible part starts - */ - GST_DEBUG_OBJECT (dec, "dimension %dx%d, PAR %d/%d", dec->info.frame_width, - dec->info.frame_height, par_num, par_den); - GST_DEBUG_OBJECT (dec, "pic dimension %dx%d, offset %d:%d", - dec->info.pic_width, dec->info.pic_height, - dec->info.pic_x, dec->info.pic_y); - - /* add black borders to make width/height/offsets even. we need this because - * we cannot express an offset to the peer plugin. */ - dec->width = GST_ROUND_UP_2 (dec->info.pic_width + (dec->info.pic_x & 1)); - dec->height = GST_ROUND_UP_2 (dec->info.pic_height + (dec->info.pic_y & 1)); - dec->offset_x = dec->info.pic_x & ~1; - dec->offset_y = dec->info.pic_y & ~1; - - GST_DEBUG_OBJECT (dec, "after fixup frame dimension %dx%d, offset %d:%d", - dec->width, dec->height, dec->offset_x, dec->offset_y); - - if (dec->info.pixel_fmt == TH_PF_420) { - dec->output_bpp = 12; /* Average bits per pixel. */ - - /* This is bad. I420 is very specific, and has implicit stride. This means - * we can't use the native output of the decoder, we have to memcpy it to - * an I420 buffer. For now, GStreamer gives us no better alternative. - */ - fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0'); - } else if (dec->info.pixel_fmt == TH_PF_422) { - dec->output_bpp = 16; - /* Unfortunately, we don't have a planar 'fourcc' value, which means we - * can't represent the output format of the decoder at all in gstreamer. - * So, we convert to a widely-supported packed format. - */ - fourcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'); - } else if (dec->info.pixel_fmt == TH_PF_444) { - dec->output_bpp = 24; - /* As for I420, we can't define the stride for this, so we need to memcpy, - * though at least this is a planar format... - */ - fourcc = GST_MAKE_FOURCC ('Y', '4', '4', '4'); - } else { - GST_ERROR_OBJECT (dec, "Invalid pixel format %d", dec->info.pixel_fmt); - return GST_FLOW_ERROR; - } - - dec->dec = th_decode_alloc (&dec->info, dec->setup); - - th_setup_free (dec->setup); - dec->setup = NULL; - - caps = gst_caps_new_simple ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, fourcc, - "framerate", GST_TYPE_FRACTION, - dec->info.fps_numerator, dec->info.fps_denominator, - "pixel-aspect-ratio", GST_TYPE_FRACTION, par_num, par_den, - "width", G_TYPE_INT, dec->width, "height", G_TYPE_INT, dec->height, NULL); - gst_pad_set_caps (dec->srcpad, caps); - gst_caps_unref (caps); - - dec->have_header = TRUE; - - return GST_FLOW_OK; -} - -static GstFlowReturn -theora_handle_header_packet (GstTheoraExpDec * dec, ogg_packet * packet) -{ - GstFlowReturn res; - int ret; - - GST_DEBUG_OBJECT (dec, "parsing header packet"); - - ret = th_decode_headerin (&dec->info, &dec->comment, &dec->setup, packet); - if (ret < 0) - goto header_read_error; - - /* We can never get here unless we have at least a one-byte packet */ - switch (packet->packet[0]) { - case 0x81: - res = theora_handle_comment_packet (dec, packet); - break; - case 0x82: - res = theora_handle_type_packet (dec, packet); - break; - default: - /* ignore */ - g_warning ("unknown theora header packet found"); - case 0x80: - /* nothing special, this is the identification header */ - res = GST_FLOW_OK; - break; - } - return res; - - /* ERRORS */ -header_read_error: - { - GST_WARNING_OBJECT (dec, "Header parsing failed: %d", ret); - GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE, - (NULL), ("couldn't read header packet")); - return GST_FLOW_ERROR; - } -} - -/* returns TRUE if buffer is within segment, else FALSE. - * if buffer is on segment border, its timestamp and duration will be clipped */ -static gboolean -clip_buffer (GstTheoraExpDec * dec, GstBuffer * buf) -{ - gboolean res = TRUE; - GstClockTime in_ts, in_dur, stop; - gint64 cstart, cstop; - - in_ts = GST_BUFFER_TIMESTAMP (buf); - in_dur = GST_BUFFER_DURATION (buf); - - GST_LOG_OBJECT (dec, - "timestamp:%" GST_TIME_FORMAT " , duration:%" GST_TIME_FORMAT, - GST_TIME_ARGS (in_ts), GST_TIME_ARGS (in_dur)); - - /* can't clip without TIME segment */ - if (dec->segment.format != GST_FORMAT_TIME) - goto beach; - - /* we need a start time */ - if (!GST_CLOCK_TIME_IS_VALID (in_ts)) - goto beach; - - /* generate valid stop, if duration unknown, we have unknown stop */ - stop = - GST_CLOCK_TIME_IS_VALID (in_dur) ? (in_ts + in_dur) : GST_CLOCK_TIME_NONE; - - /* now clip */ - if (!(res = gst_segment_clip (&dec->segment, GST_FORMAT_TIME, - in_ts, stop, &cstart, &cstop))) - goto beach; - - /* update timestamp and possibly duration if the clipped stop time is valid */ - GST_BUFFER_TIMESTAMP (buf) = cstart; - if (GST_CLOCK_TIME_IS_VALID (cstop)) - GST_BUFFER_DURATION (buf) = cstop - cstart; - -beach: - GST_LOG_OBJECT (dec, "%sdropping", (res ? "not " : "")); - return res; -} - - -/* FIXME, this needs to be moved to the demuxer */ -static GstFlowReturn -theora_dec_push (GstTheoraExpDec * dec, GstBuffer * buf) -{ - GstFlowReturn result = GST_FLOW_OK; - GstClockTime outtime = GST_BUFFER_TIMESTAMP (buf); - - if (outtime == GST_CLOCK_TIME_NONE) { - dec->queued = g_list_append (dec->queued, buf); - GST_DEBUG_OBJECT (dec, "queued buffer"); - result = GST_FLOW_OK; - } else { - if (dec->queued) { - gint64 size; - GList *walk; - - GST_DEBUG_OBJECT (dec, "first buffer with time %" GST_TIME_FORMAT, - GST_TIME_ARGS (outtime)); - - size = g_list_length (dec->queued); - for (walk = dec->queued; walk; walk = g_list_next (walk)) { - GstBuffer *buffer = GST_BUFFER (walk->data); - GstClockTime time; - - time = outtime - gst_util_uint64_scale_int (size * GST_SECOND, - dec->info.fps_denominator, dec->info.fps_numerator); - - GST_DEBUG_OBJECT (dec, "patch buffer %lld %lld", size, time); - GST_BUFFER_TIMESTAMP (buffer) = time; - - if (dec->discont) { - GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT); - dec->discont = FALSE; - } - - /* ignore the result.. */ - if (clip_buffer (dec, buffer)) - gst_pad_push (dec->srcpad, buffer); - else - gst_buffer_unref (buffer); - size--; - } - g_list_free (dec->queued); - dec->queued = NULL; - } - - if (dec->discont) { - GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT); - dec->discont = FALSE; - } - - if (clip_buffer (dec, buf)) - result = gst_pad_push (dec->srcpad, buf); - else - gst_buffer_unref (buf); - } - - return result; -} - -/* Create a packed 'YUY2' image, push it. - */ -static GstFlowReturn -theora_handle_422_image (GstTheoraExpDec * dec, th_ycbcr_buffer yuv, - GstClockTime outtime) -{ - int i, j; - gint width, height; - gint out_size; - gint stride; - GstBuffer *out; - GstFlowReturn result; - - width = dec->width; - height = dec->height; - - stride = GST_ROUND_UP_2 (width) * 2; - - out_size = stride * height; - - /* now copy over the area contained in offset_x,offset_y, - * frame_width, frame_height */ - result = - gst_pad_alloc_buffer_and_set_caps (dec->srcpad, GST_BUFFER_OFFSET_NONE, - out_size, GST_PAD_CAPS (dec->srcpad), &out); - if (result != GST_FLOW_OK) - goto no_buffer; - - /* The output pixels look like: - * YUYVYUYV.... - * - * Do the interleaving... Note that this is kinda messed up if our width is - * odd. In that case, we can't represent it properly in YUY2, so we just - * pad out to even in that case (this is why we have GST_ROUND_UP_2() above). - */ - { - guchar *src_y; - guchar *src_cb; - guchar *src_cr; - guchar *dest; - guchar *curdest; - guchar *src; - - dest = GST_BUFFER_DATA (out); - - src_y = yuv[0].data + dec->offset_x + dec->offset_y * yuv[0].ystride; - src_cb = yuv[1].data + dec->offset_x / 2 + dec->offset_y * yuv[1].ystride; - src_cr = yuv[2].data + dec->offset_x / 2 + dec->offset_y * yuv[2].ystride; - - for (i = 0; i < height; i++) { - /* Y first */ - curdest = dest; - src = src_y; - for (j = 0; j < width; j++) { - *curdest = *src++; - curdest += 2; - } - src_y += yuv[0].ystride; - - curdest = dest + 1; - src = src_cb; - for (j = 0; j < width; j++) { - *curdest = *src++; - curdest += 4; - } - src_cb += yuv[1].ystride; - - curdest = dest + 3; - src = src_cr; - for (j = 0; j < width; j++) { - *curdest = *src++; - curdest += 4; - } - src_cr += yuv[2].ystride; - - dest += stride; - } - } - - GST_BUFFER_OFFSET (out) = dec->frame_nr; - if (dec->frame_nr != -1) - dec->frame_nr++; - GST_BUFFER_OFFSET_END (out) = dec->frame_nr; - GST_BUFFER_DURATION (out) = - gst_util_uint64_scale_int (GST_SECOND, dec->info.fps_denominator, - dec->info.fps_numerator); - GST_BUFFER_TIMESTAMP (out) = outtime; - - return theora_dec_push (dec, out); - -no_buffer: - { - GST_DEBUG_OBJECT (dec, "could not get buffer, reason: %s", - gst_flow_get_name (result)); - return result; - } -} - -/* Get buffer, populate with original data (we must memcpy to get things to - * have the expected strides, etc...), and push. - */ -static GstFlowReturn -theora_handle_444_image (GstTheoraExpDec * dec, th_ycbcr_buffer yuv, - GstClockTime outtime) -{ - int i, plane; - gint width, height; - gint out_size; - gint stride; - GstBuffer *out; - GstFlowReturn result; - - width = dec->width; - height = dec->height; - - /* TODO: Check if we have any special alignment requirements for the planes, - * or for each line within a plane. */ - stride = width; - out_size = stride * height * 3; - - /* now copy over the area contained in offset_x,offset_y, - * frame_width, frame_height */ - result = - gst_pad_alloc_buffer_and_set_caps (dec->srcpad, GST_BUFFER_OFFSET_NONE, - out_size, GST_PAD_CAPS (dec->srcpad), &out); - if (result != GST_FLOW_OK) - goto no_buffer; - - { - guchar *dest, *src; - - for (plane = 0; plane < 3; plane++) { - /* TODO: do we have to use something different here? */ - dest = GST_BUFFER_DATA (out) + plane * stride * height; - - src = yuv[plane].data + dec->offset_x + - dec->offset_y * yuv[plane].ystride; - - for (i = 0; i < height; i++) { - memcpy (dest, src, width); - - dest += stride; - src += yuv[plane].ystride; - } - - } - } - - /* FIXME, frame_nr not correct */ - GST_BUFFER_OFFSET (out) = dec->frame_nr; - dec->frame_nr++; - GST_BUFFER_OFFSET_END (out) = dec->frame_nr; - GST_BUFFER_DURATION (out) = - gst_util_uint64_scale_int (GST_SECOND, dec->info.fps_denominator, - dec->info.fps_numerator); - GST_BUFFER_TIMESTAMP (out) = outtime; - - return theora_dec_push (dec, out); - -no_buffer: - { - GST_DEBUG_OBJECT (dec, "could not get buffer, reason: %s", - gst_flow_get_name (result)); - return result; - } -} - -/* Create a (planar, but with special alignment and stride requirements) 'I420' - * buffer, populate, push. - */ -static GstFlowReturn -theora_handle_420_image (GstTheoraExpDec * dec, th_ycbcr_buffer yuv, - GstClockTime outtime) -{ - int i; - gint width, height, cwidth, cheight; - gint out_size; - gint stride_y, stride_uv; - GstBuffer *out; - GstFlowReturn result; - - width = dec->width; - height = dec->height; - cwidth = width / 2; - cheight = height / 2; - - /* should get the stride from the caps, for now we round up to the nearest - * multiple of 4 because some element needs it. chroma needs special - * treatment, see videotestsrc. */ - stride_y = GST_ROUND_UP_4 (width); - stride_uv = GST_ROUND_UP_8 (width) / 2; - - out_size = stride_y * height + stride_uv * cheight * 2; - - /* now copy over the area contained in offset_x,offset_y, - * frame_width, frame_height */ - result = - gst_pad_alloc_buffer_and_set_caps (dec->srcpad, GST_BUFFER_OFFSET_NONE, - out_size, GST_PAD_CAPS (dec->srcpad), &out); - if (result != GST_FLOW_OK) - goto no_buffer; - - /* copy the visible region to the destination. This is actually pretty - * complicated and gstreamer doesn't support all the needed caps to do this - * correctly. For example, when we have an odd offset, we should only combine - * 1 row/column of luma samples with one chroma sample in colorspace conversion. - * We compensate for this by adding a black border around the image when the - * offset or size is odd (see above). - */ - { - guchar *dest_y, *src_y; - guchar *dest_u, *src_u; - guchar *dest_v, *src_v; - gint offset_u, offset_v; - - dest_y = GST_BUFFER_DATA (out); - dest_u = dest_y + stride_y * height; - dest_v = dest_u + stride_uv * cheight; - - src_y = yuv[0].data + dec->offset_x + dec->offset_y * yuv[0].ystride; - - for (i = 0; i < height; i++) { - memcpy (dest_y, src_y, width); - - dest_y += stride_y; - src_y += yuv[0].ystride; - } - - offset_u = dec->offset_x / 2 + dec->offset_y / 2 * yuv[1].ystride; - offset_v = dec->offset_x / 2 + dec->offset_y / 2 * yuv[2].ystride; - - src_u = yuv[1].data + offset_u; - src_v = yuv[2].data + offset_v; - - for (i = 0; i < cheight; i++) { - memcpy (dest_u, src_u, cwidth); - memcpy (dest_v, src_v, cwidth); - - dest_u += stride_uv; - src_u += yuv[1].ystride; - dest_v += stride_uv; - src_v += yuv[2].ystride; - } - } - - /* FIXME, frame_nr not correct */ - GST_BUFFER_OFFSET (out) = dec->frame_nr; - dec->frame_nr++; - GST_BUFFER_OFFSET_END (out) = dec->frame_nr; - GST_BUFFER_DURATION (out) = - gst_util_uint64_scale_int (GST_SECOND, dec->info.fps_denominator, - dec->info.fps_numerator); - GST_BUFFER_TIMESTAMP (out) = outtime; - - return theora_dec_push (dec, out); - -no_buffer: - { - GST_DEBUG_OBJECT (dec, "could not get buffer, reason: %s", - gst_flow_get_name (result)); - return result; - } -} - -static GstFlowReturn -theora_handle_data_packet (GstTheoraExpDec * dec, ogg_packet * packet, - GstClockTime outtime) -{ - /* normal data packet */ - th_ycbcr_buffer yuv; - GstFlowReturn result; - ogg_int64_t gp; - - if (G_UNLIKELY (!dec->have_header)) - goto not_initialized; - - if (th_packet_iskeyframe (packet)) { - dec->need_keyframe = FALSE; - } else if (G_UNLIKELY (dec->need_keyframe)) { - goto dropping; - } - - /* this does the decoding */ - if (G_UNLIKELY (th_decode_packetin (dec->dec, packet, &gp))) - goto decode_error; - - if (outtime != -1) { - gboolean need_skip; - GstClockTime qostime; - - /* QoS is done on running time */ - qostime = gst_segment_to_running_time (&dec->segment, GST_FORMAT_TIME, - outtime); - - GST_OBJECT_LOCK (dec); - /* check for QoS, don't perform the last steps of getting and - * pushing the buffers that are known to be late. */ - /* FIXME, we can also entirely skip decoding if the next valid buffer is - * known to be after a keyframe (using the granule_shift) */ - need_skip = dec->earliest_time != -1 && qostime <= dec->earliest_time; - GST_OBJECT_UNLOCK (dec); - - if (need_skip) - goto dropping_qos; - } - - /* this does postprocessing and set up the decoded frame - * pointers in our yuv variable */ - if (G_UNLIKELY (th_decode_ycbcr_out (dec->dec, yuv) < 0)) - goto no_yuv; - - if (G_UNLIKELY ((yuv[0].width != dec->info.frame_width) || - (yuv[0].height != dec->info.frame_height))) - goto wrong_dimensions; - - if (dec->info.pixel_fmt == TH_PF_420) { - result = theora_handle_420_image (dec, yuv, outtime); - } else if (dec->info.pixel_fmt == TH_PF_422) { - result = theora_handle_422_image (dec, yuv, outtime); - } else if (dec->info.pixel_fmt == TH_PF_444) { - result = theora_handle_444_image (dec, yuv, outtime); - } else { - g_assert_not_reached (); - } - - return result; - - /* ERRORS */ -not_initialized: - { - GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE, - (NULL), ("no header sent yet")); - return GST_FLOW_ERROR; - } -dropping: - { - GST_WARNING_OBJECT (dec, "dropping frame because we need a keyframe"); - dec->discont = TRUE; - return GST_FLOW_OK; - } -dropping_qos: - { - if (dec->frame_nr != -1) - dec->frame_nr++; - dec->discont = TRUE; - GST_WARNING_OBJECT (dec, "dropping frame because of QoS"); - return GST_FLOW_OK; - } -decode_error: - { - GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE, - (NULL), ("theora decoder did not decode data packet")); - return GST_FLOW_ERROR; - } -no_yuv: - { - GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE, - (NULL), ("couldn't read out YUV image")); - return GST_FLOW_ERROR; - } -wrong_dimensions: - { - GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, FORMAT, - (NULL), ("dimensions of image do not match header")); - return GST_FLOW_ERROR; - } -} - -static GstFlowReturn -theora_dec_chain (GstPad * pad, GstBuffer * buf) -{ - GstTheoraExpDec *dec; - ogg_packet packet; - GstFlowReturn result = GST_FLOW_OK; - gboolean isheader; - - dec = GST_THEORA_DEC_EXP (gst_pad_get_parent (pad)); - - /* resync on DISCONT */ - if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DISCONT))) { - GST_DEBUG_OBJECT (dec, "Received DISCONT buffer"); - dec->need_keyframe = TRUE; - dec->last_timestamp = -1; - dec->granulepos = -1; - dec->discont = TRUE; - } - - GST_DEBUG ("Offset end is %d, k-g-s %d", (int) (GST_BUFFER_OFFSET_END (buf)), - dec->info.keyframe_granule_shift); - /* make ogg_packet out of the buffer */ - packet.packet = GST_BUFFER_DATA (buf); - packet.bytes = GST_BUFFER_SIZE (buf); - packet.granulepos = GST_BUFFER_OFFSET_END (buf); - packet.packetno = 0; /* we don't really care */ - packet.b_o_s = dec->have_header ? 0 : 1; - /* EOS does not matter for the decoder */ - packet.e_o_s = 0; - - if (dec->have_header) { - if (packet.granulepos != -1) { - GST_DEBUG_OBJECT (dec, "Granulepos from packet: %lld", packet.granulepos); - dec->granulepos = packet.granulepos; - dec->last_timestamp = - gst_theoradec_granule_clocktime (dec, packet.granulepos); - } else if (dec->last_timestamp != -1) { - GST_DEBUG_OBJECT (dec, "Granulepos inferred?: %lld", dec->granulepos); - dec->last_timestamp = - gst_theoradec_granule_clocktime (dec, dec->granulepos); - } else { - GST_DEBUG_OBJECT (dec, "Granulepos unknown"); - dec->last_timestamp = GST_CLOCK_TIME_NONE; - } - if (dec->last_timestamp == GST_CLOCK_TIME_NONE && - GST_BUFFER_TIMESTAMP_IS_VALID (buf)) - dec->last_timestamp = GST_BUFFER_TIMESTAMP (buf); - - } else { - GST_DEBUG_OBJECT (dec, "Granulepos not usable: no headers seen"); - dec->last_timestamp = -1; - } - - /* A zero-byte packet is a valid data packet, meaning 'duplicate frame' */ - if (packet.bytes > 0 && packet.packet[0] & 0x80) - isheader = TRUE; - else - isheader = FALSE; - - GST_DEBUG_OBJECT (dec, "header=%d packetno=%lld, outtime=%" GST_TIME_FORMAT, - packet.bytes ? packet.packet[0] : -1, packet.packetno, - GST_TIME_ARGS (dec->last_timestamp)); - - /* switch depending on packet type */ - if (isheader) { - if (dec->have_header) { - GST_WARNING_OBJECT (GST_OBJECT (dec), "Ignoring header"); - goto done; - } - result = theora_handle_header_packet (dec, &packet); - } else { - result = theora_handle_data_packet (dec, &packet, dec->last_timestamp); - } - -done: - /* interpolate granule pos */ - dec->granulepos = inc_granulepos (dec, dec->granulepos); - - gst_object_unref (dec); - - gst_buffer_unref (buf); - - return result; -} - -static GstStateChangeReturn -theora_dec_change_state (GstElement * element, GstStateChange transition) -{ - GstTheoraExpDec *dec = GST_THEORA_DEC_EXP (element); - GstStateChangeReturn ret; - - - switch (transition) { - case GST_STATE_CHANGE_NULL_TO_READY: - break; - case GST_STATE_CHANGE_READY_TO_PAUSED: - th_info_init (&dec->info); - th_comment_init (&dec->comment); - dec->have_header = FALSE; - gst_theoradec_reset (dec); - break; - case GST_STATE_CHANGE_PAUSED_TO_PLAYING: - break; - default: - break; - } - - ret = parent_class->change_state (element, transition); - - switch (transition) { - case GST_STATE_CHANGE_PLAYING_TO_PAUSED: - break; - case GST_STATE_CHANGE_PAUSED_TO_READY: - th_decode_free (dec->dec); - dec->dec = NULL; - - th_comment_clear (&dec->comment); - th_info_clear (&dec->info); - gst_theoradec_reset (dec); - break; - case GST_STATE_CHANGE_READY_TO_NULL: - break; - default: - break; - } - - return ret; -} - -static gboolean -plugin_init (GstPlugin * plugin) -{ - if (!gst_element_register (plugin, "theoradecexp", GST_RANK_PRIMARY, - gst_theoradec_get_type ())) - return FALSE; - - return TRUE; -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "theoradec", - "Theora dec (exp) plugin library", - plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/ext/theora/theoradec.h b/ext/theora/theoradec.h deleted file mode 100644 index e9f0eb73b2..0000000000 --- a/ext/theora/theoradec.h +++ /dev/null @@ -1,99 +0,0 @@ -/* GStreamer - * Copyright (C) 2004 Benjamin Otte - * 2006 Michael Smith - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GST_THEORADEC_H__ -#define __GST_THEORADEC_H__ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include - -G_BEGIN_DECLS - -#define GST_TYPE_THEORA_DEC_EXP \ - (gst_theoradec_get_type()) -#define GST_THEORA_DEC_EXP(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_THEORA_DEC_EXP,GstTheoraExpDec)) -#define GST_THEORA_DEC_EXP_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_THEORA_DEC_EXP,GstTheoraExpDecClass)) -#define GST_IS_THEORA_DEC_EXP(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_THEORA_DEC_EXP)) -#define GST_IS_THEORA_DEC_EXP_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_THEORA_DEC_EXP)) - -typedef struct _GstTheoraExpDec GstTheoraExpDec; -typedef struct _GstTheoraExpDecClass GstTheoraExpDecClass; - -/** - * GstTheoraExpDec: - * - * Decoder using theora-exp - */ -struct _GstTheoraExpDec -{ - /* */ - GstElement element; - - /* Pads */ - GstPad *sinkpad; - GstPad *srcpad; - - /* theora decoder state */ - th_dec_ctx *dec; - th_setup_info *setup; - - th_info info; - th_comment comment; - - gboolean have_header; - guint64 granulepos; - guint64 granule_shift; - - GstClockTime last_timestamp; - gboolean need_keyframe; - gint width, height; - gint offset_x, offset_y; - gint output_bpp; - - int frame_nr; - gboolean discont; - - GList *queued; - - /* segment info */ /* with STREAM_LOCK */ - GstSegment segment; - - /* QoS stuff */ /* with LOCK*/ - gboolean proportion; - GstClockTime earliest_time; -}; - -struct _GstTheoraExpDecClass -{ - GstElementClass parent_class; -}; - -G_END_DECLS - -#endif /* __GST_THEORADEC_H__ */ diff --git a/ext/voaacenc/Makefile.am b/ext/voaacenc/Makefile.am new file mode 100644 index 0000000000..64a209e330 --- /dev/null +++ b/ext/voaacenc/Makefile.am @@ -0,0 +1,27 @@ +plugin_LTLIBRARIES = libgstvoaacenc.la + +libgstvoaacenc_la_SOURCES = \ + gstvoaac.c \ + gstvoaacenc.c + +libgstvoaacenc_la_CFLAGS = \ + $(GST_PLUGINS_BASE_CFLAGS) \ + $(GST_BASE_CFLAGS) \ + $(GST_CFLAGS) \ + $(VOAACENC_CFLAGS) +libgstvoaacenc_la_LIBADD = \ + $(GST_PLUGINS_BASE_LIBS) \ + -lgstaudio-$(GST_MAJORMINOR) \ + -lgstpbutils-$(GST_MAJORMINOR) \ + $(GST_BASE_LIBS) \ + $(GST_LIBS) \ + $(VOAACENC_LIBS) +libgstvoaacenc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstvoaacenc_la_LIBTOOLFLAGS = --tag=disable-static + +noinst_HEADERS = \ + gstvoaacenc.h + +presetdir = $(datadir)/gstreamer-$(GST_MAJORMINOR)/presets + +EXTRA_DIST = $(preset_DATA) diff --git a/ext/tarkin/gsttarkin.c b/ext/voaacenc/gstvoaac.c similarity index 69% rename from ext/tarkin/gsttarkin.c rename to ext/voaacenc/gstvoaac.c index cfda4088d5..30b5df952c 100644 --- a/ext/tarkin/gsttarkin.c +++ b/ext/voaacenc/gstvoaac.c @@ -1,5 +1,5 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen +/* GStreamer AAC encoder plugin + * Copyright (C) 2011 Kan Hu * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -21,25 +21,18 @@ #include "config.h" #endif -#include "gsttarkinenc.h" -#include "gsttarkindec.h" +#include "gstvoaacenc.h" static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_element_register (plugin, "tarkinenc", GST_RANK_NONE, - GST_TYPE_TARKINENC)) - return FALSE; - - if (!gst_element_register (plugin, "tarkindec", GST_RANK_PRIMARY, - GST_TYPE_TARKINDEC)) - return FALSE; - - return TRUE; + return gst_element_register (plugin, "voaacenc", + GST_RANK_SECONDARY, GST_TYPE_VOAACENC); } + GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, - "tarkin", - "Tarkin plugin library", - plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) + "voaacenc", + "AAC audio encoder", + plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN); diff --git a/ext/voaacenc/gstvoaacenc.c b/ext/voaacenc/gstvoaacenc.c new file mode 100644 index 0000000000..752f7a6ef1 --- /dev/null +++ b/ext/voaacenc/gstvoaacenc.c @@ -0,0 +1,690 @@ +/* GStreamer AAC encoder plugin + * Copyright (C) 2011 Kan Hu + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/** + * SECTION:element-voaacenc + * + * AAC audio encoder based on vo-aacenc library + * vo-aacenc library source file. + * + * + * Example launch line + * |[ + * gst-launch filesrc location=abc.wav ! wavparse ! audioresample ! audioconvert ! voaacenc ! filesink location=abc.aac + * ]| + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include +#include + +#include "gstvoaacenc.h" + +#define VOAAC_ENC_DEFAULT_BITRATE (128000) +#define VOAAC_ENC_DEFAULT_OUTPUTFORMAT (0) /* RAW */ +#define VOAAC_ENC_MPEGVERSION (4) +#define VOAAC_ENC_CODECDATA_LEN (2) +#define VOAAC_ENC_BITS_PER_SAMPLE (16) + +enum +{ + PROP_0, + PROP_BITRATE +}; + +#define SAMPLE_RATES " 8000, " \ + "11025, " \ + "12000, " \ + "16000, " \ + "22050, " \ + "24000, " \ + "32000, " \ + "44100, " \ + "48000, " \ + "64000, " \ + "88200, " \ + "96000" + +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, " + "signed = (boolean) TRUE, " + "endianness = (int) BYTE_ORDER, " + "rate = (int) { " SAMPLE_RATES " }, " "channels = (int) [1, 2]") + ); + +static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/mpeg, " + "mpegversion = (int) 4, " + "rate = (int) { " SAMPLE_RATES " }, " + "channels = (int) [1, 2], " + "stream-format = (string) { adts, raw }, " "base-profile = (string) lc") + ); + +GST_DEBUG_CATEGORY_STATIC (gst_voaacenc_debug); +#define GST_CAT_DEFAULT gst_voaacenc_debug + +static void gst_voaacenc_finalize (GObject * object); + +static GstFlowReturn gst_voaacenc_chain (GstPad * pad, GstBuffer * buffer); +static gboolean gst_voaacenc_setcaps (GstPad * pad, GstCaps * caps); +static GstStateChangeReturn gst_voaacenc_state_change (GstElement * element, + GstStateChange transition); +static gboolean voaacenc_core_init (GstVoAacEnc * voaacenc); +static gboolean voaacenc_core_set_parameter (GstVoAacEnc * voaacenc); +static void voaacenc_core_uninit (GstVoAacEnc * voaacenc); +static GstCaps *gst_voaacenc_getcaps (GstPad * pad); +static GstCaps *gst_voaacenc_create_source_pad_caps (GstVoAacEnc * voaacenc); +static gint voaacenc_get_rate_index (gint rate); + +static gpointer +gst_voaacenc_generate_sink_caps (gpointer data) +{ +#define VOAAC_ENC_MAX_CHANNELS 6 +/* describe the channels position */ + static const GstAudioChannelPosition + gst_voaacenc_channel_position[][VOAAC_ENC_MAX_CHANNELS] = { + { /* 1 ch: Mono */ + GST_AUDIO_CHANNEL_POSITION_FRONT_MONO}, + { /* 2 ch: front left + front right (front stereo) */ + GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, + GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}, + { /* 3 ch: front center + front stereo */ + GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER, + GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, + GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}, + { /* 4 ch: front center + front stereo + back center */ + GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER, + GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, + GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, + GST_AUDIO_CHANNEL_POSITION_REAR_CENTER}, + { /* 5 ch: front center + front stereo + back stereo */ + GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER, + GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, + GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, + GST_AUDIO_CHANNEL_POSITION_REAR_LEFT, + GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}, + { /* 6ch: front center + front stereo + back stereo + LFE */ + GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER, + GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, + GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, + GST_AUDIO_CHANNEL_POSITION_REAR_LEFT, + GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT, + GST_AUDIO_CHANNEL_POSITION_LFE} + }; + GstCaps *caps = gst_caps_new_empty (); + gint i, c; + static const int rates[] = { + 8000, 11025, 12000, 16000, 22050, 24000, + 32000, 44100, 48000, 64000, 88200, 96000 + }; + GValue rates_arr = { 0, }; + GValue tmp = { 0, }; + + g_value_init (&rates_arr, GST_TYPE_LIST); + g_value_init (&tmp, G_TYPE_INT); + for (i = 0; i < G_N_ELEMENTS (rates); i++) { + g_value_set_int (&tmp, rates[i]); + gst_value_list_append_value (&rates_arr, &tmp); + } + g_value_unset (&tmp); + + for (i = 0; i < 2 /*VOAAC_ENC_MAX_CHANNELS */ ; i++) { + GValue chanpos = { 0 }; + GValue pos = { 0 }; + GstStructure *structure; + + g_value_init (&chanpos, GST_TYPE_ARRAY); + g_value_init (&pos, GST_TYPE_AUDIO_CHANNEL_POSITION); + + for (c = 0; c <= i; c++) { + g_value_set_enum (&pos, gst_voaacenc_channel_position[i][c]); + gst_value_array_append_value (&chanpos, &pos); + } + + g_value_unset (&pos); + + structure = gst_structure_new ("audio/x-raw-int", + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "signed", G_TYPE_BOOLEAN, TRUE, + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "channels", G_TYPE_INT, i + 1, NULL); + + gst_structure_set_value (structure, "rate", &rates_arr); + gst_structure_set_value (structure, "channel-positions", &chanpos); + g_value_unset (&chanpos); + + gst_caps_append_structure (caps, structure); + } + + g_value_unset (&rates_arr); + + GST_DEBUG ("generated sink caps: %" GST_PTR_FORMAT, caps); + return caps; +} + +static GstCaps * +gst_voaacenc_get_sink_caps (void) +{ + static GOnce g_once = G_ONCE_INIT; + GstCaps *caps; + + g_once (&g_once, gst_voaacenc_generate_sink_caps, NULL); + caps = g_once.retval; + + return gst_caps_ref (caps); +} + +static void +_do_init (GType object_type) +{ + const GInterfaceInfo preset_interface_info = { + NULL, /* interface init */ + NULL, /* interface finalize */ + NULL /* interface_data */ + }; + + g_type_add_interface_static (object_type, GST_TYPE_PRESET, + &preset_interface_info); + + GST_DEBUG_CATEGORY_INIT (gst_voaacenc_debug, "voaacenc", 0, + "AAC audio encoder"); +} + +GST_BOILERPLATE_FULL (GstVoAacEnc, gst_voaacenc, GstElement, GST_TYPE_ELEMENT, + _do_init); + +static void +gst_voaacenc_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) +{ + GstVoAacEnc *self = GST_VOAACENC (object); + + switch (prop_id) { + case PROP_BITRATE: + self->bitrate = g_value_get_int (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } + return; +} + +static void +gst_voaacenc_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec) +{ + GstVoAacEnc *self = GST_VOAACENC (object); + + switch (prop_id) { + case PROP_BITRATE: + g_value_set_int (value, self->bitrate); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } + return; +} + +static void +gst_voaacenc_base_init (gpointer klass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&src_template)); + + gst_element_class_set_details_simple (element_class, "AAC audio encoder", + "Codec/Encoder/Audio", "AAC audio encoder", "Kan Hu "); +} + +static void +gst_voaacenc_class_init (GstVoAacEncClass * klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + + object_class->set_property = GST_DEBUG_FUNCPTR (gst_voaacenc_set_property); + object_class->get_property = GST_DEBUG_FUNCPTR (gst_voaacenc_get_property); + object_class->finalize = GST_DEBUG_FUNCPTR (gst_voaacenc_finalize); + + g_object_class_install_property (object_class, PROP_BITRATE, + g_param_spec_int ("bitrate", + "Bitrate", + "Target Audio Bitrate", + 0, G_MAXINT, VOAAC_ENC_DEFAULT_BITRATE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + element_class->change_state = GST_DEBUG_FUNCPTR (gst_voaacenc_state_change); +} + +static void +gst_voaacenc_init (GstVoAacEnc * voaacenc, GstVoAacEncClass * klass) +{ + /* create the sink pad */ + voaacenc->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink"); + gst_pad_set_setcaps_function (voaacenc->sinkpad, + GST_DEBUG_FUNCPTR (gst_voaacenc_setcaps)); + gst_pad_set_getcaps_function (voaacenc->sinkpad, + GST_DEBUG_FUNCPTR (gst_voaacenc_getcaps)); + gst_pad_set_chain_function (voaacenc->sinkpad, + GST_DEBUG_FUNCPTR (gst_voaacenc_chain)); + gst_element_add_pad (GST_ELEMENT (voaacenc), voaacenc->sinkpad); + + /* create the src pad */ + voaacenc->srcpad = gst_pad_new_from_static_template (&src_template, "src"); + gst_pad_use_fixed_caps (voaacenc->srcpad); + gst_element_add_pad (GST_ELEMENT (voaacenc), voaacenc->srcpad); + + voaacenc->adapter = gst_adapter_new (); + + voaacenc->bitrate = VOAAC_ENC_DEFAULT_BITRATE; + voaacenc->output_format = VOAAC_ENC_DEFAULT_OUTPUTFORMAT; + + /* init rest */ + voaacenc->handle = NULL; +} + +static void +gst_voaacenc_finalize (GObject * object) +{ + GstVoAacEnc *voaacenc; + + voaacenc = GST_VOAACENC (object); + + g_object_unref (G_OBJECT (voaacenc->adapter)); + voaacenc->adapter = NULL; + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +/* check downstream caps to configure format */ +static void +gst_voaacenc_negotiate (GstVoAacEnc * voaacenc) +{ + GstCaps *caps; + + caps = gst_pad_get_allowed_caps (voaacenc->srcpad); + + GST_DEBUG_OBJECT (voaacenc, "allowed caps: %" GST_PTR_FORMAT, caps); + + if (caps && gst_caps_get_size (caps) > 0) { + GstStructure *s = gst_caps_get_structure (caps, 0); + const gchar *str = NULL; + + if ((str = gst_structure_get_string (s, "stream-format"))) { + if (strcmp (str, "adts") == 0) { + GST_DEBUG_OBJECT (voaacenc, "use ADTS format for output"); + voaacenc->output_format = 1; + } else if (strcmp (str, "raw") == 0) { + GST_DEBUG_OBJECT (voaacenc, "use RAW format for output"); + voaacenc->output_format = 0; + } else { + GST_DEBUG_OBJECT (voaacenc, "unknown stream-format: %s", str); + voaacenc->output_format = VOAAC_ENC_DEFAULT_OUTPUTFORMAT; + } + } + } + + if (caps) + gst_caps_unref (caps); +} + +static GstCaps * +gst_voaacenc_getcaps (GstPad * pad) +{ + return gst_voaacenc_get_sink_caps (); +} + + +static gboolean +gst_voaacenc_setcaps (GstPad * pad, GstCaps * caps) +{ + gboolean ret = FALSE; + GstStructure *structure; + GstVoAacEnc *voaacenc; + GstCaps *src_caps; + + voaacenc = GST_VOAACENC (GST_PAD_PARENT (pad)); + + structure = gst_caps_get_structure (caps, 0); + + /* get channel count */ + gst_structure_get_int (structure, "channels", &voaacenc->channels); + gst_structure_get_int (structure, "rate", &voaacenc->rate); + + /* precalc duration as it's constant now */ + voaacenc->duration = + gst_util_uint64_scale_int (1024, GST_SECOND, voaacenc->rate); + voaacenc->inbuf_size = voaacenc->channels * 2 * 1024; + + gst_voaacenc_negotiate (voaacenc); + + /* create reverse caps */ + src_caps = gst_voaacenc_create_source_pad_caps (voaacenc); + + if (src_caps) { + gst_pad_set_caps (voaacenc->srcpad, src_caps); + gst_caps_unref (src_caps); + ret = voaacenc_core_set_parameter (voaacenc); + } + return ret; +} + +static GstFlowReturn +gst_voaacenc_chain (GstPad * pad, GstBuffer * buffer) +{ + GstVoAacEnc *voaacenc; + GstFlowReturn ret; + guint64 timestamp, distance = 0; + + voaacenc = GST_VOAACENC (GST_PAD_PARENT (pad)); + + g_return_val_if_fail (voaacenc->handle, GST_FLOW_WRONG_STATE); + + if (voaacenc->rate == 0 || voaacenc->channels == 0) + goto not_negotiated; + + /* discontinuity clears adapter, FIXME, maybe we can set some + * encoder flag to mask the discont. */ + if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)) { + gst_adapter_clear (voaacenc->adapter); + voaacenc->discont = TRUE; + } + + ret = GST_FLOW_OK; + gst_adapter_push (voaacenc->adapter, buffer); + + /* Collect samples until we have enough for an output frame */ + while (gst_adapter_available (voaacenc->adapter) >= voaacenc->inbuf_size) { + GstBuffer *out; + guint8 *data; + VO_CODECBUFFER input = { 0 } + , output = { + 0}; + VO_AUDIO_OUTPUTINFO output_info = { {0} + }; + + + /* max size */ + if ((ret = + gst_pad_alloc_buffer_and_set_caps (voaacenc->srcpad, 0, + voaacenc->inbuf_size, GST_PAD_CAPS (voaacenc->srcpad), + &out)) != GST_FLOW_OK) { + return ret; + } + + output.Buffer = GST_BUFFER_DATA (out); + output.Length = voaacenc->inbuf_size; + + if (voaacenc->discont) { + GST_BUFFER_FLAG_SET (out, GST_BUFFER_FLAG_DISCONT); + voaacenc->discont = FALSE; + } + + data = + (guint8 *) gst_adapter_peek (voaacenc->adapter, voaacenc->inbuf_size); + input.Buffer = data; + input.Length = voaacenc->inbuf_size; + voaacenc->codec_api.SetInputData (voaacenc->handle, &input); + + /* encode */ + if (voaacenc->codec_api.GetOutputData (voaacenc->handle, &output, + &output_info) != VO_ERR_NONE) { + gst_buffer_unref (out); + return GST_FLOW_ERROR; + } + + /* get timestamp from adapter */ + timestamp = gst_adapter_prev_timestamp (voaacenc->adapter, &distance); + + if (G_LIKELY (GST_CLOCK_TIME_IS_VALID (timestamp))) { + GST_BUFFER_TIMESTAMP (out) = + timestamp + + GST_FRAMES_TO_CLOCK_TIME (distance / voaacenc->channels / + VOAAC_ENC_BITS_PER_SAMPLE, voaacenc->rate); + } + + GST_BUFFER_DURATION (out) = + GST_FRAMES_TO_CLOCK_TIME (voaacenc->inbuf_size / voaacenc->channels / + VOAAC_ENC_BITS_PER_SAMPLE, voaacenc->rate); + + GST_LOG_OBJECT (voaacenc, "Pushing out buffer time: %" GST_TIME_FORMAT + " duration: %" GST_TIME_FORMAT, + GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (out)), + GST_TIME_ARGS (GST_BUFFER_DURATION (out))); + + GST_BUFFER_SIZE (out) = output.Length; + + /* flush the among of data we have peek */ + gst_adapter_flush (voaacenc->adapter, voaacenc->inbuf_size); + + /* play */ + if ((ret = gst_pad_push (voaacenc->srcpad, out)) != GST_FLOW_OK) + break; + } + return ret; + + /* ERRORS */ +not_negotiated: + { + GST_ELEMENT_ERROR (voaacenc, STREAM, TYPE_NOT_FOUND, + (NULL), ("unknown type")); + return GST_FLOW_NOT_NEGOTIATED; + } +} + +static GstStateChangeReturn +gst_voaacenc_state_change (GstElement * element, GstStateChange transition) +{ + GstVoAacEnc *voaacenc; + GstStateChangeReturn ret; + + voaacenc = GST_VOAACENC (element); + + switch (transition) { + case GST_STATE_CHANGE_NULL_TO_READY: + if (voaacenc_core_init (voaacenc) == FALSE) + return GST_STATE_CHANGE_FAILURE; + break; + case GST_STATE_CHANGE_READY_TO_PAUSED: + voaacenc->rate = 0; + voaacenc->channels = 0; + voaacenc->discont = FALSE; + gst_adapter_clear (voaacenc->adapter); + break; + default: + break; + } + + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + + switch (transition) { + case GST_STATE_CHANGE_READY_TO_NULL: + voaacenc_core_uninit (voaacenc); + gst_adapter_clear (voaacenc->adapter); + break; + default: + break; + } + return ret; +} + +static GstCaps * +gst_voaacenc_create_source_pad_caps (GstVoAacEnc * voaacenc) +{ + GstCaps *caps = NULL; + GstBuffer *codec_data; + gint index; + guint8 data[VOAAC_ENC_CODECDATA_LEN]; + + if ((index = voaacenc_get_rate_index (voaacenc->rate)) >= 0) { + /* LC profile only */ + data[0] = ((0x02 << 3) | (index >> 1)); + data[1] = ((index & 0x01) << 7) | (voaacenc->channels << 3); + + caps = gst_caps_new_simple ("audio/mpeg", + "mpegversion", G_TYPE_INT, VOAAC_ENC_MPEGVERSION, + "channels", G_TYPE_INT, voaacenc->channels, + "rate", G_TYPE_INT, voaacenc->rate, + "stream-format", G_TYPE_STRING, + (voaacenc->output_format ? "adts" : "raw") + , NULL); + + gst_codec_utils_aac_caps_set_level_and_profile (caps, data, sizeof (data)); + + if (!voaacenc->output_format) { + codec_data = gst_buffer_new_and_alloc (VOAAC_ENC_CODECDATA_LEN); + + memcpy (GST_BUFFER_DATA (codec_data), data, sizeof (data)); + + gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, codec_data, + NULL); + + gst_buffer_unref (codec_data); + } + } + + return caps; +} + +static VO_U32 +voaacenc_core_mem_alloc (VO_S32 uID, VO_MEM_INFO * pMemInfo) +{ + if (!pMemInfo) + return VO_ERR_INVALID_ARG; + + pMemInfo->VBuffer = g_malloc (pMemInfo->Size); + return 0; +} + +static VO_U32 +voaacenc_core_mem_free (VO_S32 uID, VO_PTR pMem) +{ + g_free (pMem); + return 0; +} + +static VO_U32 +voaacenc_core_mem_set (VO_S32 uID, VO_PTR pBuff, VO_U8 uValue, VO_U32 uSize) +{ + memset (pBuff, uValue, uSize); + return 0; +} + +static VO_U32 +voaacenc_core_mem_copy (VO_S32 uID, VO_PTR pDest, VO_PTR pSource, VO_U32 uSize) +{ + memcpy (pDest, pSource, uSize); + return 0; +} + +static VO_U32 +voaacenc_core_mem_check (VO_S32 uID, VO_PTR pBuffer, VO_U32 uSize) +{ + return 0; +} + +static gboolean +voaacenc_core_init (GstVoAacEnc * voaacenc) +{ + VO_CODEC_INIT_USERDATA user_data = { 0 }; + voGetAACEncAPI (&voaacenc->codec_api); + + voaacenc->mem_operator.Alloc = voaacenc_core_mem_alloc; + voaacenc->mem_operator.Copy = voaacenc_core_mem_copy; + voaacenc->mem_operator.Free = voaacenc_core_mem_free; + voaacenc->mem_operator.Set = voaacenc_core_mem_set; + voaacenc->mem_operator.Check = voaacenc_core_mem_check; + user_data.memflag = VO_IMF_USERMEMOPERATOR; + user_data.memData = &voaacenc->mem_operator; + voaacenc->codec_api.Init (&voaacenc->handle, VO_AUDIO_CodingAAC, &user_data); + + if (voaacenc->handle == NULL) { + return FALSE; + } + return TRUE; + +} + +static gboolean +voaacenc_core_set_parameter (GstVoAacEnc * voaacenc) +{ + AACENC_PARAM params = { 0 }; + guint32 ret; + + params.sampleRate = voaacenc->rate; + params.bitRate = voaacenc->bitrate; + params.nChannels = voaacenc->channels; + if (voaacenc->output_format) { + params.adtsUsed = 1; + } else { + params.adtsUsed = 0; + } + + ret = + voaacenc->codec_api.SetParam (voaacenc->handle, VO_PID_AAC_ENCPARAM, + ¶ms); + if (ret != VO_ERR_NONE) { + GST_ERROR_OBJECT (voaacenc, "Failed to set encoder parameters"); + return FALSE; + } + return TRUE; +} + +static void +voaacenc_core_uninit (GstVoAacEnc * voaacenc) +{ + if (voaacenc->handle) { + voaacenc->codec_api.Uninit (voaacenc->handle); + voaacenc->handle = NULL; + } +} + +static gint +voaacenc_get_rate_index (gint rate) +{ + static const gint rate_table[] = { + 96000, 88200, 64000, 48000, 44100, 32000, + 24000, 22050, 16000, 12000, 11025, 8000 + }; + gint i; + for (i = 0; i < G_N_ELEMENTS (rate_table); ++i) { + if (rate == rate_table[i]) { + return i; + } + } + return -1; +} diff --git a/ext/voaacenc/gstvoaacenc.h b/ext/voaacenc/gstvoaacenc.h new file mode 100644 index 0000000000..e0875d19f7 --- /dev/null +++ b/ext/voaacenc/gstvoaacenc.h @@ -0,0 +1,80 @@ +/* GStreamer AAC encoder plugin + * Copyright (C) 2011 Kan Hu + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GST_VOAACENC_H__ +#define __GST_VOAACENC_H__ + +#include +#include +#include + +#include + +G_BEGIN_DECLS + +#define GST_TYPE_VOAACENC \ + (gst_voaacenc_get_type()) +#define GST_VOAACENC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_VOAACENC, GstVoAacEnc)) +#define GST_VOAACENC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_VOAACENC, GstVoAacEncClass)) +#define GST_IS_VOAACENC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VOAACENC)) +#define GST_IS_VOAACENC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VOAACENC)) + +typedef struct _GstVoAacEnc GstVoAacEnc; +typedef struct _GstVoAacEncClass GstVoAacEncClass; + +struct _GstVoAacEnc { + GstElement element; + + /* pads */ + GstPad *sinkpad, *srcpad; + gboolean discont; + + GstAdapter *adapter; + + /* desired bitrate */ + gint bitrate; + + /* caps */ + gint channels; + gint rate; + gint output_format; + gint duration; + + gint inbuf_size; + + /* library handle */ + VO_AUDIO_CODECAPI codec_api; + VO_HANDLE handle; + VO_MEM_OPERATOR mem_operator; + +}; + +struct _GstVoAacEncClass { + GstElementClass parent_class; +}; + +GType gst_voaacenc_get_type (void); + +G_END_DECLS + +#endif /* __GST_VOAACENC_H__ */ diff --git a/ext/amrwbenc/GstAmrwbEnc.prs b/ext/voamrwbenc/GstVoAmrwbEnc.prs similarity index 87% rename from ext/amrwbenc/GstAmrwbEnc.prs rename to ext/voamrwbenc/GstVoAmrwbEnc.prs index 5765849494..86e4e55273 100644 --- a/ext/amrwbenc/GstAmrwbEnc.prs +++ b/ext/voamrwbenc/GstVoAmrwbEnc.prs @@ -1,6 +1,6 @@ [_presets_] version=0.10 -element-name=GstAmrwbEnc +element-name=GstVoAmrwbEnc [enhance-size] _meta/comment=Maximize compression, lowest bitrate diff --git a/ext/voamrwbenc/Makefile.am b/ext/voamrwbenc/Makefile.am new file mode 100644 index 0000000000..f490f70015 --- /dev/null +++ b/ext/voamrwbenc/Makefile.am @@ -0,0 +1,19 @@ +plugin_LTLIBRARIES = libgstvoamrwbenc.la + +libgstvoamrwbenc_la_SOURCES = \ + gstvoamrwb.c \ + gstvoamrwbenc.c + +libgstvoamrwbenc_la_CFLAGS = $(GST_CFLAGS) $(VOAMRWBENC_CFLAGS) +libgstvoamrwbenc_la_LIBADD = $(GST_BASE_LIBS) $(VOAMRWBENC_LIBS) +libgstvoamrwbenc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstvoamrwbenc_la_LIBTOOLFLAGS = --tag=disable-static + +noinst_HEADERS = \ + gstvoamrwbenc.h + +presetdir = $(datadir)/gstreamer-$(GST_MAJORMINOR)/presets +preset_DATA = GstVoAmrwbEnc.prs + +EXTRA_DIST = $(preset_DATA) + diff --git a/ext/amrwbenc/gstamrwb.c b/ext/voamrwbenc/gstvoamrwb.c similarity index 88% rename from ext/amrwbenc/gstamrwb.c rename to ext/voamrwbenc/gstvoamrwb.c index cc2407e91f..c6c0d3a771 100644 --- a/ext/amrwbenc/gstamrwb.c +++ b/ext/voamrwbenc/gstvoamrwb.c @@ -21,19 +21,19 @@ #include "config.h" #endif -#include "gstamrwbenc.h" +#include "gstvoamrwbenc.h" static gboolean plugin_init (GstPlugin * plugin) { - return gst_element_register (plugin, "amrwbenc", - GST_RANK_SECONDARY, GST_TYPE_AMRWBENC); + return gst_element_register (plugin, "voamrwbenc", + GST_RANK_SECONDARY, GST_TYPE_VOAMRWBENC); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, - "amrwbenc", + "voamrwbenc", "Adaptive Multi-Rate Wide-Band Encoder", plugin_init, VERSION, GST_LICENSE_UNKNOWN, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN); diff --git a/ext/amrwbenc/gstamrwbenc.c b/ext/voamrwbenc/gstvoamrwbenc.c similarity index 74% rename from ext/amrwbenc/gstamrwbenc.c rename to ext/voamrwbenc/gstvoamrwbenc.c index 990445f4a5..94932b46a9 100644 --- a/ext/amrwbenc/gstamrwbenc.c +++ b/ext/voamrwbenc/gstvoamrwbenc.c @@ -18,8 +18,8 @@ */ /** - * SECTION:element-amrwbenc - * @see_also: #GstAmrwbDec, #GstAmrwbParse + * SECTION:element-voamrwbenc + * @see_also: #GstAmrWbDec, #GstAmrWbParse * * AMR wideband encoder based on the * reference codec implementation. @@ -27,9 +27,9 @@ * * Example launch line * |[ - * gst-launch filesrc location=abc.wav ! wavparse ! audioresample ! audioconvert ! amrwbenc ! filesink location=abc.amr + * gst-launch filesrc location=abc.wav ! wavparse ! audioresample ! audioconvert ! voamrwbenc ! filesink location=abc.amr * ]| - * Please not that the above stream misses the header, that is needed to play + * Please note that the above stream misses the header, that is needed to play * the stream. * */ @@ -38,10 +38,8 @@ #include "config.h" #endif -#include "gstamrwbenc.h" +#include "gstvoamrwbenc.h" -/* these defines are not in all .h files */ -#ifndef MR660 #define MR660 0 #define MR885 1 #define MR1265 2 @@ -52,13 +50,14 @@ #define MR2305 6 #define MR2385 7 #define MRDTX 8 -#endif + +#define L_FRAME16k 320 /* Frame size at 16kHz */ static GType -gst_amrwbenc_bandmode_get_type (void) +gst_voamrwbenc_bandmode_get_type (void) { - static GType gst_amrwbenc_bandmode_type = 0; - static GEnumValue gst_amrwbenc_bandmode[] = { + static GType gst_voamrwbenc_bandmode_type = 0; + static GEnumValue gst_voamrwbenc_bandmode[] = { {MR660, "MR660", "MR660"}, {MR885, "MR885", "MR885"}, {MR1265, "MR1265", "MR1265"}, @@ -71,14 +70,15 @@ gst_amrwbenc_bandmode_get_type (void) {MRDTX, "MRDTX", "MRDTX"}, {0, NULL, NULL}, }; - if (!gst_amrwbenc_bandmode_type) { - gst_amrwbenc_bandmode_type = - g_enum_register_static ("GstAmrWbEncBandMode", gst_amrwbenc_bandmode); + if (!gst_voamrwbenc_bandmode_type) { + gst_voamrwbenc_bandmode_type = + g_enum_register_static ("GstVoAmrWbEncBandMode", + gst_voamrwbenc_bandmode); } - return gst_amrwbenc_bandmode_type; + return gst_voamrwbenc_bandmode_type; } -#define GST_AMRWBENC_BANDMODE_TYPE (gst_amrwbenc_bandmode_get_type()) +#define GST_VOAMRWBENC_BANDMODE_TYPE (gst_voamrwbenc_bandmode_get_type()) #define BANDMODE_DEFAULT MR660 @@ -106,14 +106,14 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", "rate = (int) 16000, " "channels = (int) 1") ); -GST_DEBUG_CATEGORY_STATIC (gst_amrwbenc_debug); -#define GST_CAT_DEFAULT gst_amrwbenc_debug +GST_DEBUG_CATEGORY_STATIC (gst_voamrwbenc_debug); +#define GST_CAT_DEFAULT gst_voamrwbenc_debug -static void gst_amrwbenc_finalize (GObject * object); +static void gst_voamrwbenc_finalize (GObject * object); -static GstFlowReturn gst_amrwbenc_chain (GstPad * pad, GstBuffer * buffer); -static gboolean gst_amrwbenc_setcaps (GstPad * pad, GstCaps * caps); -static GstStateChangeReturn gst_amrwbenc_state_change (GstElement * element, +static GstFlowReturn gst_voamrwbenc_chain (GstPad * pad, GstBuffer * buffer); +static gboolean gst_voamrwbenc_setcaps (GstPad * pad, GstCaps * caps); +static GstStateChangeReturn gst_voamrwbenc_state_change (GstElement * element, GstStateChange transition); static void @@ -128,21 +128,18 @@ _do_init (GType object_type) g_type_add_interface_static (object_type, GST_TYPE_PRESET, &preset_interface_info); - GST_DEBUG_CATEGORY_INIT (gst_amrwbenc_debug, "amrwbenc", 0, + GST_DEBUG_CATEGORY_INIT (gst_voamrwbenc_debug, "amrwbenc", 0, "AMR-WB audio encoder"); } -#define GstAmrWbEnc GstAmrwbEnc -#define GstAmrWbEncClass GstAmrwbEncClass - -GST_BOILERPLATE_FULL (GstAmrWbEnc, gst_amrwbenc, GstElement, GST_TYPE_ELEMENT, - _do_init); +GST_BOILERPLATE_FULL (GstVoAmrWbEnc, gst_voamrwbenc, GstElement, + GST_TYPE_ELEMENT, _do_init); static void -gst_amrwbenc_set_property (GObject * object, guint prop_id, +gst_voamrwbenc_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { - GstAmrwbEnc *self = GST_AMRWBENC (object); + GstVoAmrWbEnc *self = GST_VOAMRWBENC (object); switch (prop_id) { case PROP_BANDMODE: @@ -157,10 +154,10 @@ gst_amrwbenc_set_property (GObject * object, guint prop_id, } static void -gst_amrwbenc_get_property (GObject * object, guint prop_id, +gst_voamrwbenc_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { - GstAmrwbEnc *self = GST_AMRWBENC (object); + GstVoAmrWbEnc *self = GST_VOAMRWBENC (object); switch (prop_id) { case PROP_BANDMODE: @@ -175,7 +172,7 @@ gst_amrwbenc_get_property (GObject * object, guint prop_id, } static void -gst_amrwbenc_base_init (gpointer klass) +gst_voamrwbenc_base_init (gpointer klass) { GstElementClass *element_class = GST_ELEMENT_CLASS (klass); @@ -191,31 +188,31 @@ gst_amrwbenc_base_init (gpointer klass) } static void -gst_amrwbenc_class_init (GstAmrwbEncClass * klass) +gst_voamrwbenc_class_init (GstVoAmrWbEncClass * klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - object_class->finalize = gst_amrwbenc_finalize; - object_class->set_property = gst_amrwbenc_set_property; - object_class->get_property = gst_amrwbenc_get_property; + object_class->finalize = gst_voamrwbenc_finalize; + object_class->set_property = gst_voamrwbenc_set_property; + object_class->get_property = gst_voamrwbenc_get_property; g_object_class_install_property (object_class, PROP_BANDMODE, g_param_spec_enum ("band-mode", "Band Mode", - "Encoding Band Mode (Kbps)", GST_AMRWBENC_BANDMODE_TYPE, + "Encoding Band Mode (Kbps)", GST_VOAMRWBENC_BANDMODE_TYPE, BANDMODE_DEFAULT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); - element_class->change_state = GST_DEBUG_FUNCPTR (gst_amrwbenc_state_change); + element_class->change_state = GST_DEBUG_FUNCPTR (gst_voamrwbenc_state_change); } static void -gst_amrwbenc_init (GstAmrwbEnc * amrwbenc, GstAmrwbEncClass * klass) +gst_voamrwbenc_init (GstVoAmrWbEnc * amrwbenc, GstVoAmrWbEncClass * klass) { /* create the sink pad */ amrwbenc->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink"); - gst_pad_set_setcaps_function (amrwbenc->sinkpad, gst_amrwbenc_setcaps); - gst_pad_set_chain_function (amrwbenc->sinkpad, gst_amrwbenc_chain); + gst_pad_set_setcaps_function (amrwbenc->sinkpad, gst_voamrwbenc_setcaps); + gst_pad_set_chain_function (amrwbenc->sinkpad, gst_voamrwbenc_chain); gst_element_add_pad (GST_ELEMENT (amrwbenc), amrwbenc->sinkpad); /* create the src pad */ @@ -233,11 +230,11 @@ gst_amrwbenc_init (GstAmrwbEnc * amrwbenc, GstAmrwbEncClass * klass) } static void -gst_amrwbenc_finalize (GObject * object) +gst_voamrwbenc_finalize (GObject * object) { - GstAmrwbEnc *amrwbenc; + GstVoAmrWbEnc *amrwbenc; - amrwbenc = GST_AMRWBENC (object); + amrwbenc = GST_VOAMRWBENC (object); g_object_unref (G_OBJECT (amrwbenc->adapter)); amrwbenc->adapter = NULL; @@ -246,13 +243,13 @@ gst_amrwbenc_finalize (GObject * object) } static gboolean -gst_amrwbenc_setcaps (GstPad * pad, GstCaps * caps) +gst_voamrwbenc_setcaps (GstPad * pad, GstCaps * caps) { GstStructure *structure; - GstAmrwbEnc *amrwbenc; + GstVoAmrWbEnc *amrwbenc; GstCaps *copy; - amrwbenc = GST_AMRWBENC (GST_PAD_PARENT (pad)); + amrwbenc = GST_VOAMRWBENC (GST_PAD_PARENT (pad)); structure = gst_caps_get_structure (caps, 0); @@ -280,13 +277,13 @@ gst_amrwbenc_setcaps (GstPad * pad, GstCaps * caps) } static GstFlowReturn -gst_amrwbenc_chain (GstPad * pad, GstBuffer * buffer) +gst_voamrwbenc_chain (GstPad * pad, GstBuffer * buffer) { - GstAmrwbEnc *amrwbenc; + GstVoAmrWbEnc *amrwbenc; GstFlowReturn ret = GST_FLOW_OK; - const int buffer_size = sizeof (Word16) * L_FRAME16k; + const int buffer_size = sizeof (short) * L_FRAME16k; - amrwbenc = GST_AMRWBENC (gst_pad_get_parent (pad)); + amrwbenc = GST_VOAMRWBENC (gst_pad_get_parent (pad)); g_return_val_if_fail (amrwbenc->handle, GST_FLOW_WRONG_STATE); @@ -332,8 +329,8 @@ gst_amrwbenc_chain (GstPad * pad, GstBuffer * buffer) /* encode */ outsize = - E_IF_encode (amrwbenc->handle, amrwbenc->bandmode, (Word16 *) data, - (UWord8 *) GST_BUFFER_DATA (out), 0); + E_IF_encode (amrwbenc->handle, amrwbenc->bandmode, (const short *) data, + (unsigned char *) GST_BUFFER_DATA (out), 0); gst_adapter_flush (amrwbenc->adapter, buffer_size); GST_BUFFER_SIZE (out) = outsize; @@ -351,12 +348,12 @@ done: } static GstStateChangeReturn -gst_amrwbenc_state_change (GstElement * element, GstStateChange transition) +gst_voamrwbenc_state_change (GstElement * element, GstStateChange transition) { - GstAmrwbEnc *amrwbenc; + GstVoAmrWbEnc *amrwbenc; GstStateChangeReturn ret; - amrwbenc = GST_AMRWBENC (element); + amrwbenc = GST_VOAMRWBENC (element); switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: diff --git a/ext/amrwbenc/gstamrwbenc.h b/ext/voamrwbenc/gstvoamrwbenc.h similarity index 60% rename from ext/amrwbenc/gstamrwbenc.h rename to ext/voamrwbenc/gstvoamrwbenc.h index 034a5bed1b..751906834a 100644 --- a/ext/amrwbenc/gstamrwbenc.h +++ b/ext/voamrwbenc/gstvoamrwbenc.h @@ -17,31 +17,30 @@ * Boston, MA 02111-1307, USA. */ -#ifndef __GST_AMRWBENC_H__ -#define __GST_AMRWBENC_H__ +#ifndef __GST_VOAMRWBENC_H__ +#define __GST_VOAMRWBENC_H__ #include #include -#include -#include +#include G_BEGIN_DECLS -#define GST_TYPE_AMRWBENC \ - (gst_amrwbenc_get_type()) -#define GST_AMRWBENC(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_AMRWBENC, GstAmrwbEnc)) -#define GST_AMRWBENC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_AMRWBENC, GstAmrwbEncClass)) -#define GST_IS_AMRWBENC(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_AMRWBENC)) -#define GST_IS_AMRWBENC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_AMRWBENC)) +#define GST_TYPE_VOAMRWBENC \ + (gst_voamrwbenc_get_type()) +#define GST_VOAMRWBENC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_VOAMRWBENC, GstVoAmrWbEnc)) +#define GST_VOAMRWBENC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_VOAMRWBENC, GstVoAmrWbEncClass)) +#define GST_IS_VOAMRWBENC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VOAMRWBENC)) +#define GST_IS_VOAMRWBENC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VOAMRWBENC)) -typedef struct _GstAmrwbEnc GstAmrwbEnc; -typedef struct _GstAmrwbEncClass GstAmrwbEncClass; +typedef struct _GstVoAmrWbEnc GstVoAmrWbEnc; +typedef struct _GstVoAmrWbEncClass GstVoAmrWbEncClass; -struct _GstAmrwbEnc { +struct _GstVoAmrWbEnc { GstElement element; /* pads */ @@ -59,12 +58,12 @@ struct _GstAmrwbEnc { gint channels, rate; }; -struct _GstAmrwbEncClass { +struct _GstVoAmrWbEncClass { GstElementClass parent_class; }; -GType gst_amrwbenc_get_type (void); +GType gst_voamrwbenc_get_type (void); G_END_DECLS -#endif /* __GST_AMRWBENC_H__ */ +#endif /* __GST_VOAMRWBENC_H__ */ diff --git a/ext/vp8/Makefile.am b/ext/vp8/Makefile.am index 43989d6631..474b3cec4e 100644 --- a/ext/vp8/Makefile.am +++ b/ext/vp8/Makefile.am @@ -13,11 +13,11 @@ libgstvp8_la_CFLAGS = \ $(GST_BASE_CFLAGS) \ $(GST_CFLAGS) \ -DGST_USE_UNSTABLE_API +libgstvp8_la_LIBADD = \ + $(top_builddir)/gst-libs/gst/video/libgstbasevideo-@GST_MAJORMINOR@.la \ + $(GST_PLUGINS_BASE_LIBS) -lgsttag-@GST_MAJORMINOR@ -lgstvideo-@GST_MAJORMINOR@ \ + $(GST_BASE_LIBS) $(GST_LIBS) $(VPX_LIBS) libgstvp8_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -libgstvp8_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) -libgstvp8_la_LIBADD += $(GST_PLUGINS_BASE_LIBS) -lgsttag-@GST_MAJORMINOR@ -lgstvideo-@GST_MAJORMINOR@ -libgstvp8_la_LIBADD += $(top_builddir)/gst-libs/gst/video/libgstbasevideo-@GST_MAJORMINOR@.la -libgstvp8_la_LIBADD += $(VPX_LIBS) noinst_HEADERS = \ gstvp8dec.h \ diff --git a/ext/vp8/gstvp8dec.c b/ext/vp8/gstvp8dec.c index 3d8567ffc5..a945717be4 100644 --- a/ext/vp8/gstvp8dec.c +++ b/ext/vp8/gstvp8dec.c @@ -98,6 +98,8 @@ static void gst_vp8_dec_get_property (GObject * object, guint prop_id, static gboolean gst_vp8_dec_start (GstBaseVideoDecoder * decoder); static gboolean gst_vp8_dec_stop (GstBaseVideoDecoder * decoder); +static gboolean gst_vp8_dec_set_format (GstBaseVideoDecoder * decoder, + GstVideoState * state); static gboolean gst_vp8_dec_reset (GstBaseVideoDecoder * decoder); static GstFlowReturn gst_vp8_dec_parse_data (GstBaseVideoDecoder * decoder, gboolean at_eos); @@ -172,11 +174,15 @@ gst_vp8_dec_class_init (GstVP8DecClass * klass) 0, 16, DEFAULT_NOISE_LEVEL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - base_video_decoder_class->start = gst_vp8_dec_start; - base_video_decoder_class->stop = gst_vp8_dec_stop; - base_video_decoder_class->reset = gst_vp8_dec_reset; - base_video_decoder_class->parse_data = gst_vp8_dec_parse_data; - base_video_decoder_class->handle_frame = gst_vp8_dec_handle_frame; + base_video_decoder_class->start = GST_DEBUG_FUNCPTR (gst_vp8_dec_start); + base_video_decoder_class->stop = GST_DEBUG_FUNCPTR (gst_vp8_dec_stop); + base_video_decoder_class->reset = GST_DEBUG_FUNCPTR (gst_vp8_dec_reset); + base_video_decoder_class->set_format = + GST_DEBUG_FUNCPTR (gst_vp8_dec_set_format); + base_video_decoder_class->parse_data = + GST_DEBUG_FUNCPTR (gst_vp8_dec_parse_data); + base_video_decoder_class->handle_frame = + GST_DEBUG_FUNCPTR (gst_vp8_dec_handle_frame); GST_DEBUG_CATEGORY_INIT (gst_vp8dec_debug, "vp8dec", 0, "VP8 Decoder"); } @@ -274,6 +280,17 @@ gst_vp8_dec_stop (GstBaseVideoDecoder * base_video_decoder) return TRUE; } +static gboolean +gst_vp8_dec_set_format (GstBaseVideoDecoder * decoder, GstVideoState * state) +{ + GstVP8Dec *gst_vp8_dec = GST_VP8_DEC (decoder); + + GST_DEBUG_OBJECT (gst_vp8_dec, "set_format"); + gst_vp8_dec->decoder_inited = FALSE; + + return TRUE; +} + static gboolean gst_vp8_dec_reset (GstBaseVideoDecoder * base_video_decoder) { @@ -381,15 +398,17 @@ gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder, GstVideoFrame * frame) if (status != VPX_CODEC_OK || !stream_info.is_kf) { GST_WARNING_OBJECT (decoder, "No keyframe, skipping"); - gst_base_video_decoder_skip_frame (decoder, frame); + gst_base_video_decoder_finish_frame (decoder, frame); return GST_FLOW_OK; } - /* should set size here */ state->width = stream_info.w; state->height = stream_info.h; state->format = GST_VIDEO_FORMAT_I420; + state->par_n = 1; + state->par_d = 1; gst_vp8_dec_send_tags (dec); + gst_base_video_decoder_set_src_caps (decoder); caps = vpx_codec_get_caps (&vpx_codec_vp8_dx_algo); @@ -431,21 +450,6 @@ gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder, GstVideoFrame * frame) if (!GST_BUFFER_FLAG_IS_SET (frame->sink_buffer, GST_BUFFER_FLAG_DELTA_UNIT)) gst_base_video_decoder_set_sync_point (decoder); -#if 0 - if (GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (decoder)) == NULL) { - GstCaps *caps; - - caps = gst_video_format_new_caps (decoder->state.format, - decoder->state.width, decoder->state.height, - decoder->state.fps_n, decoder->state.fps_d, - decoder->state.par_n, decoder->state.par_d); - - GST_DEBUG ("setting caps %" GST_PTR_FORMAT, caps); - - gst_pad_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (decoder), caps); - } -#endif - deadline = gst_base_video_decoder_get_max_decode_time (decoder, frame); if (deadline < 0) { decoder_deadline = 1; @@ -469,15 +473,15 @@ gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder, GstVideoFrame * frame) if (deadline < 0) { GST_LOG_OBJECT (dec, "Skipping late frame (%f s past deadline)", (double) -deadline / GST_SECOND); - gst_base_video_decoder_skip_frame (decoder, frame); + gst_base_video_decoder_finish_frame (decoder, frame); } else { ret = gst_base_video_decoder_alloc_src_frame (decoder, frame); if (ret == GST_FLOW_OK) { gst_vp8_dec_image_to_buffer (dec, img, frame->src_buffer); - gst_base_video_decoder_finish_frame (decoder, frame); + ret = gst_base_video_decoder_finish_frame (decoder, frame); } else { - gst_base_video_decoder_skip_frame (decoder, frame); + gst_base_video_decoder_finish_frame (decoder, frame); } } @@ -489,7 +493,7 @@ gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder, GstVideoFrame * frame) } } else { /* Invisible frame */ - gst_base_video_decoder_skip_frame (decoder, frame); + gst_base_video_decoder_finish_frame (decoder, frame); } return ret; diff --git a/ext/vp8/gstvp8dec.h b/ext/vp8/gstvp8dec.h index 6e3de8410d..f68c85f2e1 100644 --- a/ext/vp8/gstvp8dec.h +++ b/ext/vp8/gstvp8dec.h @@ -25,7 +25,6 @@ #include #include -#include /* FIXME: Undef HAVE_CONFIG_H because vpx_codec.h uses it, * which causes compilation failures */ diff --git a/ext/vp8/gstvp8enc.c b/ext/vp8/gstvp8enc.c index 17b316a5bd..ad6a282be2 100644 --- a/ext/vp8/gstvp8enc.c +++ b/ext/vp8/gstvp8enc.c @@ -67,6 +67,8 @@ typedef struct #define DEFAULT_BITRATE 0 #define DEFAULT_MODE VPX_VBR +#define DEFAULT_MIN_QUANTIZER 0 +#define DEFAULT_MAX_QUANTIZER 63 #define DEFAULT_QUALITY 5 #define DEFAULT_ERROR_RESILIENT FALSE #define DEFAULT_MAX_LATENCY 10 @@ -82,6 +84,8 @@ enum PROP_0, PROP_BITRATE, PROP_MODE, + PROP_MIN_QUANTIZER, + PROP_MAX_QUANTIZER, PROP_QUALITY, PROP_ERROR_RESILIENT, PROP_MAX_LATENCY, @@ -149,14 +153,14 @@ static gboolean gst_vp8_enc_stop (GstBaseVideoEncoder * encoder); static gboolean gst_vp8_enc_set_format (GstBaseVideoEncoder * base_video_encoder, GstVideoState * state); static gboolean gst_vp8_enc_finish (GstBaseVideoEncoder * base_video_encoder); -static gboolean gst_vp8_enc_handle_frame (GstBaseVideoEncoder * +static GstFlowReturn gst_vp8_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder, GstVideoFrame * frame); static GstFlowReturn gst_vp8_enc_shape_output (GstBaseVideoEncoder * encoder, GstVideoFrame * frame); +static gboolean gst_vp8_enc_sink_event (GstBaseVideoEncoder * + base_video_encoder, GstEvent * event); static GstCaps *gst_vp8_enc_get_caps (GstBaseVideoEncoder * base_video_encoder); -static gboolean gst_vp8_enc_sink_event (GstPad * pad, GstEvent * event); - static GstStaticPadTemplate gst_vp8_enc_sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, @@ -225,6 +229,7 @@ gst_vp8_enc_class_init (GstVP8EncClass * klass) base_video_encoder_class->set_format = gst_vp8_enc_set_format; base_video_encoder_class->finish = gst_vp8_enc_finish; base_video_encoder_class->shape_output = gst_vp8_enc_shape_output; + base_video_encoder_class->event = gst_vp8_enc_sink_event; base_video_encoder_class->get_caps = gst_vp8_enc_get_caps; g_object_class_install_property (gobject_class, PROP_BITRATE, @@ -239,9 +244,21 @@ gst_vp8_enc_class_init (GstVP8EncClass * klass) GST_VP8_ENC_MODE_TYPE, DEFAULT_MODE, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); + g_object_class_install_property (gobject_class, PROP_MIN_QUANTIZER, + g_param_spec_int ("min-quantizer", "Minimum quantizer", + "Minimum (best) quantizer", + 0, 63, DEFAULT_MIN_QUANTIZER, + (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); + + g_object_class_install_property (gobject_class, PROP_MAX_QUANTIZER, + g_param_spec_int ("max-quantizer", "Maximum quantizer", + "Maximum (worst) quantizer", + 0, 63, DEFAULT_MAX_QUANTIZER, + (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); + g_object_class_install_property (gobject_class, PROP_QUALITY, g_param_spec_double ("quality", "Quality", - "Quality", + "Quality. This parameter sets a constant quantizer.", 0, 10.0, DEFAULT_QUALITY, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); @@ -304,6 +321,8 @@ gst_vp8_enc_init (GstVP8Enc * gst_vp8_enc, GstVP8EncClass * klass) GST_DEBUG_OBJECT (gst_vp8_enc, "init"); gst_vp8_enc->bitrate = DEFAULT_BITRATE; + gst_vp8_enc->min_quantizer = DEFAULT_MIN_QUANTIZER; + gst_vp8_enc->max_quantizer = DEFAULT_MAX_QUANTIZER; gst_vp8_enc->mode = DEFAULT_MODE; gst_vp8_enc->quality = DEFAULT_QUALITY; gst_vp8_enc->error_resilient = DEFAULT_ERROR_RESILIENT; @@ -312,12 +331,6 @@ gst_vp8_enc_init (GstVP8Enc * gst_vp8_enc, GstVP8EncClass * klass) gst_vp8_enc->multipass_mode = DEFAULT_MULTIPASS_MODE; gst_vp8_enc->multipass_cache_file = DEFAULT_MULTIPASS_CACHE_FILE; gst_vp8_enc->auto_alt_ref_frames = DEFAULT_AUTO_ALT_REF_FRAMES; - - /* FIXME: Add sink/src event vmethods */ - gst_vp8_enc->base_sink_event_func = - GST_PAD_EVENTFUNC (GST_BASE_VIDEO_CODEC_SINK_PAD (gst_vp8_enc)); - gst_pad_set_event_function (GST_BASE_VIDEO_CODEC_SINK_PAD (gst_vp8_enc), - gst_vp8_enc_sink_event); } static void @@ -354,6 +367,12 @@ gst_vp8_enc_set_property (GObject * object, guint prop_id, case PROP_MODE: gst_vp8_enc->mode = g_value_get_enum (value); break; + case PROP_MIN_QUANTIZER: + gst_vp8_enc->min_quantizer = g_value_get_int (value); + break; + case PROP_MAX_QUANTIZER: + gst_vp8_enc->max_quantizer = g_value_get_int (value); + break; case PROP_QUALITY: gst_vp8_enc->quality = g_value_get_double (value); break; @@ -404,6 +423,12 @@ gst_vp8_enc_get_property (GObject * object, guint prop_id, GValue * value, case PROP_MODE: g_value_set_enum (value, gst_vp8_enc->mode); break; + case PROP_MIN_QUANTIZER: + g_value_set_int (value, gst_vp8_enc->min_quantizer); + break; + case PROP_MAX_QUANTIZER: + g_value_set_int (value, gst_vp8_enc->max_quantizer); + break; case PROP_QUALITY: g_value_set_double (value, gst_vp8_enc->quality); break; @@ -479,8 +504,134 @@ static gboolean gst_vp8_enc_set_format (GstBaseVideoEncoder * base_video_encoder, GstVideoState * state) { + GstVP8Enc *encoder; + vpx_codec_enc_cfg_t cfg; + vpx_codec_err_t status; + vpx_image_t *image; + guint8 *data = NULL; + + encoder = GST_VP8_ENC (base_video_encoder); GST_DEBUG_OBJECT (base_video_encoder, "set_format"); + if (encoder->inited) { + GST_DEBUG_OBJECT (base_video_encoder, "refusing renegotiation"); + return FALSE; + } + + status = vpx_codec_enc_config_default (&vpx_codec_vp8_cx_algo, &cfg, 0); + if (status != VPX_CODEC_OK) { + GST_ELEMENT_ERROR (encoder, LIBRARY, INIT, + ("Failed to get default encoder configuration"), ("%s", + gst_vpx_error_name (status))); + return FALSE; + } + + cfg.g_w = state->width; + cfg.g_h = state->height; + cfg.g_timebase.num = state->fps_d; + cfg.g_timebase.den = state->fps_n; + + cfg.g_error_resilient = encoder->error_resilient; + cfg.g_lag_in_frames = encoder->max_latency; + cfg.g_threads = encoder->threads; + cfg.rc_end_usage = encoder->mode; + /* Standalone qp-min do not make any sence, with bitrate=0 and qp-min=1 + * encoder will use only default qp-max=63. Also this will make + * worst possbile quality. + */ + if (encoder->bitrate != DEFAULT_BITRATE || + encoder->max_quantizer != DEFAULT_MAX_QUANTIZER) { + cfg.rc_target_bitrate = encoder->bitrate / 1000; + cfg.rc_min_quantizer = encoder->min_quantizer; + cfg.rc_max_quantizer = encoder->max_quantizer; + } else { + cfg.rc_min_quantizer = (gint) (63 - encoder->quality * 6.2); + cfg.rc_max_quantizer = (gint) (63 - encoder->quality * 6.2); + cfg.rc_target_bitrate = encoder->bitrate; + } + + cfg.kf_mode = VPX_KF_AUTO; + cfg.kf_min_dist = 0; + cfg.kf_max_dist = encoder->max_keyframe_distance; + + cfg.g_pass = encoder->multipass_mode; + if (encoder->multipass_mode == VPX_RC_FIRST_PASS) { + encoder->first_pass_cache_content = g_byte_array_sized_new (4096); + } else if (encoder->multipass_mode == VPX_RC_LAST_PASS) { + GError *err = NULL; + + if (!encoder->multipass_cache_file) { + GST_ELEMENT_ERROR (encoder, RESOURCE, OPEN_READ, + ("No multipass cache file provided"), (NULL)); + return FALSE; + } + + if (!g_file_get_contents (encoder->multipass_cache_file, + (gchar **) & encoder->last_pass_cache_content.buf, + &encoder->last_pass_cache_content.sz, &err)) { + GST_ELEMENT_ERROR (encoder, RESOURCE, OPEN_READ, + ("Failed to read multipass cache file provided"), ("%s", + err->message)); + g_error_free (err); + return FALSE; + } + cfg.rc_twopass_stats_in = encoder->last_pass_cache_content; + } + + status = vpx_codec_enc_init (&encoder->encoder, &vpx_codec_vp8_cx_algo, + &cfg, 0); + if (status != VPX_CODEC_OK) { + GST_ELEMENT_ERROR (encoder, LIBRARY, INIT, + ("Failed to initialize encoder"), ("%s", gst_vpx_error_name (status))); + return FALSE; + } + + status = vpx_codec_control (&encoder->encoder, VP8E_SET_CPUUSED, 0); + if (status != VPX_CODEC_OK) { + GST_WARNING_OBJECT (encoder, "Failed to set VP8E_SET_CPUUSED to 0: %s", + gst_vpx_error_name (status)); + } + + status = + vpx_codec_control (&encoder->encoder, VP8E_SET_ENABLEAUTOALTREF, + (encoder->auto_alt_ref_frames ? 1 : 0)); + if (status != VPX_CODEC_OK) { + GST_WARNING_OBJECT (encoder, + "Failed to set VP8E_ENABLEAUTOALTREF to %d: %s", + (encoder->auto_alt_ref_frames ? 1 : 0), gst_vpx_error_name (status)); + } + + gst_base_video_encoder_set_latency (base_video_encoder, 0, + gst_util_uint64_scale (encoder->max_latency, + state->fps_d * GST_SECOND, state->fps_n)); + encoder->inited = TRUE; + + /* prepare cached image buffer setup */ + image = &encoder->image; + memset (image, 0, sizeof (image)); + + image->fmt = VPX_IMG_FMT_I420; + image->bps = 12; + image->x_chroma_shift = image->y_chroma_shift = 1; + image->w = image->d_w = state->width; + image->h = image->d_h = state->height; + + image->stride[VPX_PLANE_Y] = + gst_video_format_get_row_stride (state->format, 0, state->width); + image->stride[VPX_PLANE_U] = + gst_video_format_get_row_stride (state->format, 1, state->width); + image->stride[VPX_PLANE_V] = + gst_video_format_get_row_stride (state->format, 2, state->width); + image->planes[VPX_PLANE_Y] = + data + gst_video_format_get_component_offset (state->format, 0, + state->width, state->height); + image->planes[VPX_PLANE_U] = + data + gst_video_format_get_component_offset (state->format, 1, + state->width, state->height); + image->planes[VPX_PLANE_V] = + data + gst_video_format_get_component_offset (state->format, 2, + state->width, state->height); + return TRUE; } @@ -558,272 +709,17 @@ gst_vp8_enc_get_caps (GstBaseVideoEncoder * base_video_encoder) return caps; } -static gboolean -gst_vp8_enc_finish (GstBaseVideoEncoder * base_video_encoder) +static GstFlowReturn +gst_vp8_enc_process (GstVP8Enc * encoder) { - GstVP8Enc *encoder; - GstVideoFrame *frame; - int flags = 0; - vpx_codec_err_t status; vpx_codec_iter_t iter = NULL; const vpx_codec_cx_pkt_t *pkt; - - GST_DEBUG_OBJECT (base_video_encoder, "finish"); - - encoder = GST_VP8_ENC (base_video_encoder); - - status = - vpx_codec_encode (&encoder->encoder, NULL, encoder->n_frames, 1, flags, - 0); - if (status != 0) { - GST_ERROR_OBJECT (encoder, "encode returned %d %s", status, - gst_vpx_error_name (status)); - return FALSE; - } - - pkt = vpx_codec_get_cx_data (&encoder->encoder, &iter); - while (pkt != NULL) { - GstBuffer *buffer; - GstVP8EncCoderHook *hook; - gboolean invisible, keyframe; - - GST_DEBUG_OBJECT (encoder, "packet %u type %d", (guint) pkt->data.frame.sz, - pkt->kind); - - if (pkt->kind == VPX_CODEC_STATS_PKT - && encoder->multipass_mode == VPX_RC_FIRST_PASS) { - GST_LOG_OBJECT (encoder, "handling STATS packet"); - - g_byte_array_append (encoder->first_pass_cache_content, - pkt->data.twopass_stats.buf, pkt->data.twopass_stats.sz); - - frame = gst_base_video_encoder_get_oldest_frame (base_video_encoder); - if (frame != NULL) { - buffer = gst_buffer_new (); - GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_PREROLL); - frame->src_buffer = buffer; - gst_base_video_encoder_finish_frame (base_video_encoder, frame); - } - - pkt = vpx_codec_get_cx_data (&encoder->encoder, &iter); - continue; - } else if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) { - GST_LOG_OBJECT (encoder, "non frame pkt: %d", pkt->kind); - pkt = vpx_codec_get_cx_data (&encoder->encoder, &iter); - continue; - } - - invisible = (pkt->data.frame.flags & VPX_FRAME_IS_INVISIBLE) != 0; - keyframe = (pkt->data.frame.flags & VPX_FRAME_IS_KEY) != 0; - frame = gst_base_video_encoder_get_oldest_frame (base_video_encoder); - g_assert (frame != NULL); - hook = frame->coder_hook; - - buffer = gst_buffer_new_and_alloc (pkt->data.frame.sz); - - memcpy (GST_BUFFER_DATA (buffer), pkt->data.frame.buf, pkt->data.frame.sz); - frame->is_sync_point = frame->is_sync_point || keyframe; - - if (hook->image) - g_slice_free (vpx_image_t, hook->image); - hook->image = NULL; - - if (invisible) { - hook->invisible = g_list_append (hook->invisible, buffer); - } else { - frame->src_buffer = buffer; - gst_base_video_encoder_finish_frame (base_video_encoder, frame); - frame = NULL; - } - - pkt = vpx_codec_get_cx_data (&encoder->encoder, &iter); - } - - if (encoder->multipass_mode == VPX_RC_FIRST_PASS - && encoder->multipass_cache_file) { - GError *err = NULL; - - if (!g_file_set_contents (encoder->multipass_cache_file, - (const gchar *) encoder->first_pass_cache_content->data, - encoder->first_pass_cache_content->len, &err)) { - GST_ELEMENT_ERROR (encoder, RESOURCE, WRITE, (NULL), - ("Failed to write multipass cache file: %s", err->message)); - g_error_free (err); - } - } - - return TRUE; -} - -static vpx_image_t * -gst_vp8_enc_buffer_to_image (GstVP8Enc * enc, GstBuffer * buffer) -{ - vpx_image_t *image = g_slice_new0 (vpx_image_t); - guint8 *data = GST_BUFFER_DATA (buffer); - GstVideoState *state = &GST_BASE_VIDEO_CODEC (enc)->state; - - image->fmt = VPX_IMG_FMT_I420; - image->bps = 12; - image->x_chroma_shift = image->y_chroma_shift = 1; - image->img_data = data; - image->w = image->d_w = state->width; - image->h = image->d_h = state->height; - - image->stride[VPX_PLANE_Y] = - gst_video_format_get_row_stride (state->format, 0, state->width); - image->stride[VPX_PLANE_U] = - gst_video_format_get_row_stride (state->format, 1, state->width); - image->stride[VPX_PLANE_V] = - gst_video_format_get_row_stride (state->format, 2, state->width); - image->planes[VPX_PLANE_Y] = - data + gst_video_format_get_component_offset (state->format, 0, - state->width, state->height); - image->planes[VPX_PLANE_U] = - data + gst_video_format_get_component_offset (state->format, 1, - state->width, state->height); - image->planes[VPX_PLANE_V] = - data + gst_video_format_get_component_offset (state->format, 2, - state->width, state->height); - - return image; -} - -static const int speed_table[] = { - VPX_DL_BEST_QUALITY, - VPX_DL_GOOD_QUALITY, - VPX_DL_REALTIME, -}; - -static gboolean -gst_vp8_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder, - GstVideoFrame * frame) -{ - GstVP8Enc *encoder; - const GstVideoState *state; - vpx_codec_err_t status; - int flags = 0; - vpx_codec_iter_t iter = NULL; - const vpx_codec_cx_pkt_t *pkt; - vpx_image_t *image; + GstBaseVideoEncoder *base_video_encoder; GstVP8EncCoderHook *hook; + GstVideoFrame *frame; + GstFlowReturn ret = GST_FLOW_OK; - GST_DEBUG_OBJECT (base_video_encoder, "handle_frame"); - - encoder = GST_VP8_ENC (base_video_encoder); - - state = gst_base_video_encoder_get_state (base_video_encoder); - encoder->n_frames++; - - GST_DEBUG_OBJECT (base_video_encoder, "size %d %d", state->width, - state->height); - - if (!encoder->inited) { - vpx_codec_enc_cfg_t cfg; - - status = vpx_codec_enc_config_default (&vpx_codec_vp8_cx_algo, &cfg, 0); - if (status != VPX_CODEC_OK) { - GST_ELEMENT_ERROR (encoder, LIBRARY, INIT, - ("Failed to get default encoder configuration"), ("%s", - gst_vpx_error_name (status))); - return FALSE; - } - - cfg.g_w = state->width; - cfg.g_h = state->height; - cfg.g_timebase.num = state->fps_d; - cfg.g_timebase.den = state->fps_n; - - cfg.g_error_resilient = encoder->error_resilient; - cfg.g_lag_in_frames = encoder->max_latency; - cfg.g_threads = encoder->threads; - cfg.rc_end_usage = encoder->mode; - if (encoder->bitrate) { - cfg.rc_target_bitrate = encoder->bitrate / 1000; - } else { - cfg.rc_min_quantizer = 63 - encoder->quality * 5.0; - cfg.rc_max_quantizer = 63 - encoder->quality * 5.0; - cfg.rc_target_bitrate = encoder->bitrate; - } - - cfg.kf_mode = VPX_KF_AUTO; - cfg.kf_min_dist = 0; - cfg.kf_max_dist = encoder->max_keyframe_distance; - - cfg.g_pass = encoder->multipass_mode; - if (encoder->multipass_mode == VPX_RC_FIRST_PASS) { - encoder->first_pass_cache_content = g_byte_array_sized_new (4096); - } else if (encoder->multipass_mode == VPX_RC_LAST_PASS) { - GError *err = NULL; - - - if (!encoder->multipass_cache_file) { - GST_ELEMENT_ERROR (encoder, RESOURCE, OPEN_READ, - ("No multipass cache file provided"), (NULL)); - return GST_FLOW_ERROR; - } - - if (!g_file_get_contents (encoder->multipass_cache_file, - (gchar **) & encoder->last_pass_cache_content.buf, - &encoder->last_pass_cache_content.sz, &err)) { - GST_ELEMENT_ERROR (encoder, RESOURCE, OPEN_READ, - ("Failed to read multipass cache file provided"), ("%s", - err->message)); - g_error_free (err); - return GST_FLOW_ERROR; - } - cfg.rc_twopass_stats_in = encoder->last_pass_cache_content; - } - - status = vpx_codec_enc_init (&encoder->encoder, &vpx_codec_vp8_cx_algo, - &cfg, 0); - if (status != VPX_CODEC_OK) { - GST_ELEMENT_ERROR (encoder, LIBRARY, INIT, - ("Failed to initialize encoder"), ("%s", - gst_vpx_error_name (status))); - return GST_FLOW_ERROR; - } - - status = vpx_codec_control (&encoder->encoder, VP8E_SET_CPUUSED, 0); - if (status != VPX_CODEC_OK) { - GST_WARNING_OBJECT (encoder, "Failed to set VP8E_SET_CPUUSED to 0: %s", - gst_vpx_error_name (status)); - } - - status = - vpx_codec_control (&encoder->encoder, VP8E_SET_ENABLEAUTOALTREF, - (encoder->auto_alt_ref_frames ? 1 : 0)); - if (status != VPX_CODEC_OK) { - GST_WARNING_OBJECT (encoder, - "Failed to set VP8E_ENABLEAUTOALTREF to %d: %s", - (encoder->auto_alt_ref_frames ? 1 : 0), gst_vpx_error_name (status)); - } - - gst_base_video_encoder_set_latency (base_video_encoder, 0, - gst_util_uint64_scale (encoder->max_latency, - state->fps_d * GST_SECOND, state->fps_n)); - encoder->inited = TRUE; - } - - image = gst_vp8_enc_buffer_to_image (encoder, frame->sink_buffer); - - hook = g_slice_new0 (GstVP8EncCoderHook); - hook->image = image; - frame->coder_hook = hook; - - if (encoder->force_keyframe) { - flags |= VPX_EFLAG_FORCE_KF; - } - - status = vpx_codec_encode (&encoder->encoder, image, - encoder->n_frames, 1, flags, speed_table[encoder->speed]); - if (status != 0) { - GST_ELEMENT_ERROR (encoder, LIBRARY, ENCODE, - ("Failed to encode frame"), ("%s", gst_vpx_error_name (status))); - g_slice_free (GstVP8EncCoderHook, hook); - frame->coder_hook = NULL; - g_slice_free (vpx_image_t, image); - return FALSE; - } + base_video_encoder = GST_BASE_VIDEO_ENCODER (encoder); pkt = vpx_codec_get_cx_data (&encoder->encoder, &iter); while (pkt != NULL) { @@ -874,15 +770,124 @@ gst_vp8_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder, hook->invisible = g_list_append (hook->invisible, buffer); } else { frame->src_buffer = buffer; - gst_base_video_encoder_finish_frame (base_video_encoder, frame); + ret = gst_base_video_encoder_finish_frame (base_video_encoder, frame); } pkt = vpx_codec_get_cx_data (&encoder->encoder, &iter); } + return ret; +} + +static gboolean +gst_vp8_enc_finish (GstBaseVideoEncoder * base_video_encoder) +{ + GstVP8Enc *encoder; + int flags = 0; + vpx_codec_err_t status; + + GST_DEBUG_OBJECT (base_video_encoder, "finish"); + + encoder = GST_VP8_ENC (base_video_encoder); + + status = + vpx_codec_encode (&encoder->encoder, NULL, encoder->n_frames, 1, flags, + 0); + if (status != 0) { + GST_ERROR_OBJECT (encoder, "encode returned %d %s", status, + gst_vpx_error_name (status)); + return FALSE; + } + + /* dispatch remaining frames */ + gst_vp8_enc_process (encoder); + + if (encoder->multipass_mode == VPX_RC_FIRST_PASS + && encoder->multipass_cache_file) { + GError *err = NULL; + + if (!g_file_set_contents (encoder->multipass_cache_file, + (const gchar *) encoder->first_pass_cache_content->data, + encoder->first_pass_cache_content->len, &err)) { + GST_ELEMENT_ERROR (encoder, RESOURCE, WRITE, (NULL), + ("Failed to write multipass cache file: %s", err->message)); + g_error_free (err); + } + } + return TRUE; } +static vpx_image_t * +gst_vp8_enc_buffer_to_image (GstVP8Enc * enc, GstBuffer * buffer) +{ + vpx_image_t *image = g_slice_new (vpx_image_t); + guint8 *data = GST_BUFFER_DATA (buffer); + const GstVideoState *state; + + state = gst_base_video_encoder_get_state (GST_BASE_VIDEO_ENCODER (enc)); + + memcpy (image, &enc->image, sizeof (*image)); + + image->img_data = data; + image->planes[VPX_PLANE_Y] += (data - (guint8 *) NULL); + image->planes[VPX_PLANE_U] += (data - (guint8 *) NULL); + image->planes[VPX_PLANE_V] += (data - (guint8 *) NULL); + + return image; +} + +static const int speed_table[] = { + VPX_DL_BEST_QUALITY, + VPX_DL_GOOD_QUALITY, + VPX_DL_REALTIME, +}; + +static GstFlowReturn +gst_vp8_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder, + GstVideoFrame * frame) +{ + GstVP8Enc *encoder; + const GstVideoState *state; + vpx_codec_err_t status; + int flags = 0; + vpx_image_t *image; + GstVP8EncCoderHook *hook; + + GST_DEBUG_OBJECT (base_video_encoder, "handle_frame"); + + encoder = GST_VP8_ENC (base_video_encoder); + + state = gst_base_video_encoder_get_state (base_video_encoder); + encoder->n_frames++; + + GST_DEBUG_OBJECT (base_video_encoder, "size %d %d", state->width, + state->height); + + image = gst_vp8_enc_buffer_to_image (encoder, frame->sink_buffer); + + hook = g_slice_new0 (GstVP8EncCoderHook); + hook->image = image; + frame->coder_hook = hook; + + if (frame->force_keyframe) { + flags |= VPX_EFLAG_FORCE_KF; + } + + status = vpx_codec_encode (&encoder->encoder, image, + encoder->n_frames, 1, flags, speed_table[encoder->speed]); + if (status != 0) { + GST_ELEMENT_ERROR (encoder, LIBRARY, ENCODE, + ("Failed to encode frame"), ("%s", gst_vpx_error_name (status))); + g_slice_free (GstVP8EncCoderHook, hook); + frame->coder_hook = NULL; + g_slice_free (vpx_image_t, image); + return FALSE; + } + + return gst_vp8_enc_process (encoder); +} + static guint64 _to_granulepos (guint64 frame_end_number, guint inv_count, guint keyframe_dist) { @@ -941,7 +946,8 @@ gst_vp8_enc_shape_output (GstBaseVideoEncoder * base_video_encoder, gst_util_uint64_scale (frame->presentation_frame_number + 1, GST_SECOND * state->fps_d, state->fps_n); - gst_buffer_set_caps (buf, GST_BASE_VIDEO_CODEC (base_video_encoder)->caps); + gst_buffer_set_caps (buf, + GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder))); ret = gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), buf); if (ret != GST_FLOW_OK) { @@ -985,10 +991,9 @@ done: } static gboolean -gst_vp8_enc_sink_event (GstPad * pad, GstEvent * event) +gst_vp8_enc_sink_event (GstBaseVideoEncoder * benc, GstEvent * event) { - GstVP8Enc *enc = GST_VP8_ENC (gst_pad_get_parent (pad)); - gboolean ret; + GstVP8Enc *enc = GST_VP8_ENC (benc); if (GST_EVENT_TYPE (event) == GST_EVENT_TAG) { GstTagList *list; @@ -999,10 +1004,8 @@ gst_vp8_enc_sink_event (GstPad * pad, GstEvent * event) gst_tag_setter_merge_tags (setter, list, mode); } - ret = enc->base_sink_event_func (pad, event); - gst_object_unref (enc); - - return ret; + /* just peeked, baseclass handles the rest */ + return FALSE; } #endif /* HAVE_VP8_ENCODER */ diff --git a/ext/vp8/gstvp8enc.h b/ext/vp8/gstvp8enc.h index 0c14eb45dc..f9dbdc1bf4 100644 --- a/ext/vp8/gstvp8enc.h +++ b/ext/vp8/gstvp8enc.h @@ -24,7 +24,6 @@ #include #include -#include /* FIXME: Undef HAVE_CONFIG_H because vpx_codec.h uses it, * which causes compilation failures */ @@ -61,6 +60,8 @@ struct _GstVP8Enc /* properties */ int bitrate; enum vpx_rc_mode mode; + int min_quantizer; + int max_quantizer; double quality; gboolean error_resilient; int max_latency; @@ -74,14 +75,12 @@ struct _GstVP8Enc gboolean auto_alt_ref_frames; /* state */ - gboolean force_keyframe; gboolean inited; + vpx_image_t image; + int n_frames; int keyframe_distance; - - /* FIXME: Get a event vfunc in BaseVideoEncoder */ - GstPadEventFunction base_sink_event_func; }; struct _GstVP8EncClass diff --git a/ext/xvid/gstxviddec.c b/ext/xvid/gstxviddec.c index 67e33c03ec..c290777a9a 100644 --- a/ext/xvid/gstxviddec.c +++ b/ext/xvid/gstxviddec.c @@ -33,6 +33,11 @@ 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 ]") ); diff --git a/ext/xvid/gstxvidenc.c b/ext/xvid/gstxvidenc.c index 6d16e87bda..dc60d0d8c4 100644 --- a/ext/xvid/gstxvidenc.c +++ b/ext/xvid/gstxvidenc.c @@ -79,6 +79,7 @@ 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); @@ -497,6 +498,8 @@ gst_xvidenc_init (GstXvidEnc * xvidenc) 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)); @@ -794,6 +797,55 @@ gst_xvidenc_setcaps (GstPad * pad, GstCaps * vscaps) 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 diff --git a/ext/zbar/gstzbar.c b/ext/zbar/gstzbar.c index fc770a83d0..9ffb8a0529 100644 --- a/ext/zbar/gstzbar.c +++ b/ext/zbar/gstzbar.c @@ -17,13 +17,6 @@ * Boston, MA 02111-1307, USA. */ -/* - * This file was (probably) generated from - * gstvideotemplate.c,v 1.12 2004/01/07 21:07:12 ds Exp - * and - * make_filter,v 1.6 2004/01/07 21:33:01 ds Exp - */ - /** * SECTION:element-zbar * diff --git a/gst-libs/gst/Makefile.am b/gst-libs/gst/Makefile.am index 92d951cc88..f58086ca57 100644 --- a/gst-libs/gst/Makefile.am +++ b/gst-libs/gst/Makefile.am @@ -2,8 +2,8 @@ if BUILD_EXPERIMENTAL EXPERIMENTAL_LIBS=basecamerabinsrc endif -SUBDIRS = baseparse interfaces signalprocessor video $(EXPERIMENTAL_LIBS) +SUBDIRS = interfaces signalprocessor video $(EXPERIMENTAL_LIBS) noinst_HEADERS = gst-i18n-plugin.h gettext.h -DIST_SUBDIRS = baseparse interfaces signalprocessor video basecamerabinsrc +DIST_SUBDIRS = interfaces signalprocessor video basecamerabinsrc diff --git a/gst-libs/gst/basecamerabinsrc/Makefile.am b/gst-libs/gst/basecamerabinsrc/Makefile.am index c5d1ac0afe..7cae6a21af 100644 --- a/gst-libs/gst/basecamerabinsrc/Makefile.am +++ b/gst-libs/gst/basecamerabinsrc/Makefile.am @@ -5,11 +5,13 @@ CLEANFILES = $(BUILT_SOURCES) libgstbasecamerabinsrc_@GST_MAJORMINOR@_la_SOURCES = \ gstcamerabin-enum.c \ + gstcamerabinpreview.c \ gstbasecamerasrc.c libgstbasecamerabinsrc_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/basecamerabinsrc libgstbasecamerabinsrc_@GST_MAJORMINOR@include_HEADERS = \ gstcamerabin-enum.h \ + gstcamerabinpreview.h \ gstbasecamerasrc.h libgstbasecamerabinsrc_@GST_MAJORMINOR@_la_CFLAGS = \ @@ -20,7 +22,21 @@ libgstbasecamerabinsrc_@GST_MAJORMINOR@_la_CFLAGS = \ libgstbasecamerabinsrc_@GST_MAJORMINOR@_la_LIBADD = \ $(top_builddir)/gst-libs/gst/interfaces/libgstphotography-@GST_MAJORMINOR@.la \ $(GST_PLUGINS_BASE_LIBS) -lgstinterfaces-$(GST_MAJORMINOR) \ - $(GST_BASE_LIBS) $(GST_LIBS) + -lgstapp-$(GST_MAJORMINOR) $(GST_BASE_LIBS) $(GST_LIBS) libgstbasecamerabinsrc_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) +Android.mk: Makefile.am + androgenizer -:PROJECT libgstbasecamerabinsrc -:STATIC libgstbasecamerabinsrc-@GST_MAJORMINOR@ \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstbasecamerabinsrc_@GST_MAJORMINOR@_la_SOURCES) \ + -:CFLAGS $(DEFS) $(libgstbasecamerabinsrc_@GST_MAJORMINOR@_la_CFLAGS) \ + -:LDFLAGS $(libgstbasecamerabinsrc_@GST_MAJORMINOR@_la_LDFLAGS) \ + $(libgstbasecamerabinsrc_@GST_MAJORMINOR@_la_LIBADD) \ + -ldl \ + -:LIBFILTER_STATIC gstphotography-@GST_MAJORMINOR@ \ + -:HEADER_TARGET gstreamer-@GST_MAJORMINOR@/gst/basecamerabinsrc \ + -:HEADERS $(libgstbasecamerabinsrcinclude_HEADERS) \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + > $@ diff --git a/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c b/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c index 57582cba76..b2ae99298d 100644 --- a/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c +++ b/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c @@ -61,7 +61,11 @@ enum PROP_0, PROP_MODE, PROP_ZOOM, - PROP_READY_FOR_CAPTURE + PROP_MAX_ZOOM, + PROP_READY_FOR_CAPTURE, + PROP_POST_PREVIEW, + PROP_PREVIEW_CAPS, + PROP_PREVIEW_FILTER }; enum @@ -73,6 +77,8 @@ enum LAST_SIGNAL }; +#define DEFAULT_POST_PREVIEW TRUE + static guint basecamerasrc_signals[LAST_SIGNAL]; GST_DEBUG_CATEGORY (base_camera_src_debug); @@ -123,7 +129,7 @@ gst_base_camera_src_get_photography (GstBaseCameraSrc * self) } if (elem) { - return GST_PHOTOGRAPHY (self); + return GST_PHOTOGRAPHY (elem); } return NULL; @@ -186,16 +192,35 @@ void gst_base_camera_src_setup_zoom (GstBaseCameraSrc * self) { GstBaseCameraSrcClass *bclass = GST_BASE_CAMERA_SRC_GET_CLASS (self); - gint zoom; - zoom = g_atomic_int_get (&self->zoom); - - g_return_if_fail (zoom); + g_return_if_fail (self->zoom); g_return_if_fail (bclass->set_zoom); - bclass->set_zoom (self, zoom); + bclass->set_zoom (self, self->zoom); } +/** + * gst_base_camera_src_setup_preview: + * @self: camerasrc bin + * @preview_caps: preview caps to set + * + * Apply preview caps to preview pipeline and to video source. + */ +void +gst_base_camera_src_setup_preview (GstBaseCameraSrc * self, + GstCaps * preview_caps) +{ + GstBaseCameraSrcClass *bclass = GST_BASE_CAMERA_SRC_GET_CLASS (self); + + if (self->preview_pipeline) { + GST_DEBUG_OBJECT (self, + "Setting preview pipeline caps %" GST_PTR_FORMAT, self->preview_caps); + gst_camerabin_preview_set_caps (self->preview_pipeline, preview_caps); + } + + if (bclass->set_preview) + bclass->set_preview (self, preview_caps); +} /** * gst_base_camera_src_get_allowed_input_caps: @@ -228,6 +253,9 @@ gst_base_camera_src_start_capture (GstBaseCameraSrc * src) if (src->capturing) { GST_WARNING_OBJECT (src, "Capturing already ongoing"); g_mutex_unlock (src->capturing_mutex); + + /* post a warning to notify camerabin2 that the capture failed */ + GST_ELEMENT_WARNING (src, RESOURCE, BUSY, (NULL), (NULL)); return; } @@ -276,6 +304,19 @@ gst_base_camera_src_dispose (GObject * object) g_mutex_free (src->capturing_mutex); + if (src->preview_pipeline) { + gst_camerabin_destroy_preview_pipeline (src->preview_pipeline); + src->preview_pipeline = NULL; + } + + if (src->preview_caps) + gst_caps_replace (&src->preview_caps, NULL); + + if (src->preview_filter) { + gst_object_unref (src->preview_filter); + src->preview_filter = NULL; + } + G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -297,12 +338,38 @@ gst_base_camera_src_set_property (GObject * object, g_value_get_enum (value)); break; case PROP_ZOOM:{ - g_atomic_int_set (&self->zoom, g_value_get_int (value)); + self->zoom = g_value_get_float (value); + /* limit to max-zoom */ + if (self->zoom > self->max_zoom) { + GST_DEBUG_OBJECT (self, "Clipping zoom %f to max-zoom %f", self->zoom, + self->max_zoom); + self->zoom = self->max_zoom; + } /* does not set it if in NULL, the src is not created yet */ if (GST_STATE (self) != GST_STATE_NULL) gst_base_camera_src_setup_zoom (self); break; } + case PROP_POST_PREVIEW: + self->post_preview = g_value_get_boolean (value); + break; + case PROP_PREVIEW_CAPS:{ + GstCaps *new_caps = NULL; + new_caps = (GstCaps *) gst_value_get_caps (value); + if (!gst_caps_is_equal (self->preview_caps, new_caps)) { + gst_caps_replace (&self->preview_caps, new_caps); + gst_base_camera_src_setup_preview (self, new_caps); + } else { + GST_DEBUG_OBJECT (self, "New preview caps equal current preview caps"); + } + } + break; + case PROP_PREVIEW_FILTER: + if (self->preview_filter) + gst_object_unref (self->preview_filter); + self->preview_filter = g_value_dup_object (value); + self->preview_filter_changed = TRUE; + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec); break; @@ -323,7 +390,21 @@ gst_base_camera_src_get_property (GObject * object, g_value_set_boolean (value, !self->capturing); break; case PROP_ZOOM: - g_value_set_int (value, g_atomic_int_get (&self->zoom)); + g_value_set_float (value, self->zoom); + break; + case PROP_MAX_ZOOM: + g_value_set_float (value, self->max_zoom); + break; + case PROP_POST_PREVIEW: + g_value_set_boolean (value, self->post_preview); + break; + case PROP_PREVIEW_CAPS: + if (self->preview_caps) + gst_value_set_caps (value, self->preview_caps); + break; + case PROP_PREVIEW_FILTER: + if (self->preview_filter) + g_value_set_object (value, self->preview_filter); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec); @@ -370,10 +451,33 @@ gst_base_camera_src_change_state (GstElement * element, case GST_STATE_CHANGE_NULL_TO_READY: if (!construct_pipeline (self)) return GST_STATE_CHANGE_FAILURE; + + /* recreate the preview pipeline */ + if (self->preview_pipeline && self->preview_filter_changed) { + gst_camerabin_destroy_preview_pipeline (self->preview_pipeline); + self->preview_pipeline = NULL; + } + + if (self->preview_pipeline == NULL) + self->preview_pipeline = + gst_camerabin_create_preview_pipeline (GST_ELEMENT_CAST (self), + self->preview_filter); + + g_assert (self->preview_pipeline != NULL); + self->preview_filter_changed = FALSE; + if (self->preview_caps) { + GST_DEBUG_OBJECT (self, + "Setting preview pipeline caps %" GST_PTR_FORMAT, + self->preview_caps); + gst_camerabin_preview_set_caps (self->preview_pipeline, + self->preview_caps); + } break; case GST_STATE_CHANGE_READY_TO_PAUSED: if (!setup_pipeline (self)) return GST_STATE_CHANGE_FAILURE; + gst_element_set_state (self->preview_pipeline->pipeline, + GST_STATE_PLAYING); break; default: break; @@ -381,6 +485,14 @@ gst_base_camera_src_change_state (GstElement * element, ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + switch (transition) { + case GST_STATE_CHANGE_READY_TO_NULL: + gst_element_set_state (self->preview_pipeline->pipeline, GST_STATE_NULL); + break; + default: + break; + } + return ret; } @@ -426,6 +538,38 @@ gst_base_camera_src_class_init (GstBaseCameraSrcClass * klass) GST_TYPE_CAMERABIN_MODE, MODE_IMAGE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (gobject_class, PROP_ZOOM, + g_param_spec_float ("zoom", "Zoom", + "Digital zoom factor (e.g. 1.5 means 1.5x)", MIN_ZOOM, G_MAXFLOAT, + DEFAULT_ZOOM, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (gobject_class, PROP_MAX_ZOOM, + g_param_spec_float ("max-zoom", "Maximum zoom level (note: may change " + "depending on resolution/implementation)", + "Digital zoom factor (e.g. 1.5 means 1.5x)", MIN_ZOOM, G_MAXFLOAT, + MAX_ZOOM, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + + /** + * GstBaseCameraSrc:post-previews: + * + * When %TRUE, preview images should be posted to the bus when + * captures are made + */ + g_object_class_install_property (gobject_class, PROP_POST_PREVIEW, + g_param_spec_boolean ("post-previews", "Post Previews", + "If capture preview images should be posted to the bus", + DEFAULT_POST_PREVIEW, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (gobject_class, PROP_PREVIEW_CAPS, + g_param_spec_boxed ("preview-caps", "Preview caps", + "The caps of the preview image to be posted", + GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (gobject_class, PROP_PREVIEW_FILTER, + g_param_spec_object ("preview-filter", "Preview filter", + "A custom preview filter to process preview image data", + GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** * GstBaseCameraSrc:ready-for-capture: * @@ -475,8 +619,21 @@ gst_base_camera_src_init (GstBaseCameraSrc * self, self->width = DEFAULT_WIDTH; self->height = DEFAULT_HEIGHT; self->zoom = DEFAULT_ZOOM; + self->max_zoom = MAX_ZOOM; self->mode = MODE_IMAGE; self->capturing = FALSE; self->capturing_mutex = g_mutex_new (); + + self->post_preview = DEFAULT_POST_PREVIEW; +} + +void +gst_base_camera_src_post_preview (GstBaseCameraSrc * self, GstBuffer * buf) +{ + if (self->post_preview) { + gst_camerabin_preview_pipeline_post (self->preview_pipeline, buf); + } else { + GST_DEBUG_OBJECT (self, "Previews not enabled, not posting"); + } } diff --git a/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.h b/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.h index 70535bccff..1c412e493f 100644 --- a/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.h +++ b/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.h @@ -22,11 +22,17 @@ #ifndef __GST_BASE_CAMERA_SRC_H__ #define __GST_BASE_CAMERA_SRC_H__ +#ifndef GST_USE_UNSTABLE_API +#warning "GstBaseCameraSrc is unstable API and may change in future." +#warning "You can define GST_USE_UNSTABLE_API to avoid this warning." +#endif + #include #include #include #include #include "gstcamerabin-enum.h" +#include "gstcamerabinpreview.h" G_BEGIN_DECLS #define GST_TYPE_BASE_CAMERA_SRC \ @@ -66,12 +72,19 @@ struct _GstBaseCameraSrc gboolean capturing; GMutex *capturing_mutex; + /* Preview convert pipeline */ + GstCaps *preview_caps; + gboolean post_preview; + GstElement *preview_filter; + GstCameraBinPreviewPipelineData *preview_pipeline; + gboolean preview_filter_changed; + /* Resolution of the buffers configured to camerabin */ gint width; gint height; - /* The digital zoom (from 100% to 1000%) */ - gint zoom; + gfloat zoom; + gfloat max_zoom; gpointer _gst_reserved[GST_PADDING_LARGE]; }; @@ -95,12 +108,16 @@ struct _GstBaseCameraSrcClass gboolean (*setup_pipeline) (GstBaseCameraSrc *self); /* set the zoom */ - void (*set_zoom) (GstBaseCameraSrc *self, gint zoom); + void (*set_zoom) (GstBaseCameraSrc *self, gfloat zoom); /* set the mode */ gboolean (*set_mode) (GstBaseCameraSrc *self, GstCameraBinMode mode); + /* set preview caps */ + gboolean (*set_preview) (GstBaseCameraSrc *self, + GstCaps *preview_caps); + /* */ GstCaps * (*get_allowed_input_caps) (GstBaseCameraSrc * self); @@ -113,8 +130,8 @@ struct _GstBaseCameraSrcClass }; -#define MIN_ZOOM 100 -#define MAX_ZOOM 1000 +#define MIN_ZOOM 1.0f +#define MAX_ZOOM 10.0f #define ZOOM_1X MIN_ZOOM GstPhotography * gst_base_camera_src_get_photography (GstBaseCameraSrc *self); @@ -122,10 +139,12 @@ GstColorBalance * gst_base_camera_src_get_color_balance (GstBaseCameraSrc *self) gboolean gst_base_camera_src_set_mode (GstBaseCameraSrc *self, GstCameraBinMode mode); void gst_base_camera_src_setup_zoom (GstBaseCameraSrc * self); +void gst_base_camera_src_setup_preview (GstBaseCameraSrc * self, GstCaps * preview_caps); GstCaps * gst_base_camera_src_get_allowed_input_caps (GstBaseCameraSrc * self); void gst_base_camera_src_finish_capture (GstBaseCameraSrc *self); +void gst_base_camera_src_post_preview (GstBaseCameraSrc *self, GstBuffer * buf); // XXX add methods to get/set img capture and vid capture caps.. #endif /* __GST_BASE_CAMERA_SRC_H__ */ diff --git a/gst-libs/gst/basecamerabinsrc/gstcamerabin-enum.h b/gst-libs/gst/basecamerabinsrc/gstcamerabin-enum.h index 590cb68826..c6dbf043d2 100644 --- a/gst-libs/gst/basecamerabinsrc/gstcamerabin-enum.h +++ b/gst-libs/gst/basecamerabinsrc/gstcamerabin-enum.h @@ -21,6 +21,11 @@ #ifndef __GST_CAMERABIN_ENUM_H__ #define __GST_CAMERABIN_ENUM_H__ +#ifndef GST_USE_UNSTABLE_API +#warning "camerabin enums are unstable API and may change in future." +#warning "You can define GST_USE_UNSTABLE_API to avoid this warning." +#endif + #include G_BEGIN_DECLS diff --git a/gst-libs/gst/basecamerabinsrc/gstcamerabinpreview.c b/gst-libs/gst/basecamerabinsrc/gstcamerabinpreview.c new file mode 100644 index 0000000000..2c3bee582f --- /dev/null +++ b/gst-libs/gst/basecamerabinsrc/gstcamerabinpreview.c @@ -0,0 +1,329 @@ +/* + * GStreamer + * Copyright (C) 2008 Nokia Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/** + * SECTION:camerabingeneral + * @short_description: helper functions for #GstCameraBin and it's modules + * + * Common helper functions for #GstCameraBin, #GstCameraBinImage and + * #GstCameraBinVideo. + * + */ +#include +#include +#include "gstcamerabinpreview.h" +#include "gstbasecamerasrc.h" + +static void _gst_camerabin_preview_set_caps (GstCameraBinPreviewPipelineData * + preview, GstCaps * caps); + +static gboolean +bus_callback (GstBus * bus, GstMessage * message, gpointer user_data) +{ + switch (GST_MESSAGE_TYPE (message)) { + case GST_MESSAGE_ERROR:{ + GError *err; + GstCameraBinPreviewPipelineData *data; + + data = user_data; + + gst_message_parse_error (message, &err, NULL); + GST_WARNING ("Error from preview pipeline: %s", err->message); + g_error_free (err); + + /* TODO Not sure if we should post an Error or Warning here */ + GST_ELEMENT_ERROR (data, CORE, FAILED, + ("fatal error in preview pipeline, disposing the pipeline"), (NULL)); + + /* Possible error situations: + * 1) cond_wait pending. prevent deadlock by signalling the cond + * 2) preview_pipeline_post called with new buffer to handle. returns + * because data->pipeline is set to null + * 3) new preview caps incoming. returns because data->pipeline is null + */ + + if (data->pipeline) { + gst_element_set_state (data->pipeline, GST_STATE_NULL); + gst_object_unref (data->pipeline); + data->pipeline = NULL; + } + + g_cond_signal (data->processing_cond); + + break; + } + default: + break; + } + return TRUE; +} + +static GstFlowReturn +gst_camerabin_preview_pipeline_new_preroll (GstAppSink * appsink, + gpointer user_data) +{ + GstBuffer *buffer; + + buffer = gst_app_sink_pull_preroll (appsink); + gst_buffer_unref (buffer); + + return GST_FLOW_OK; +} + +static GstFlowReturn +gst_camerabin_preview_pipeline_new_buffer (GstAppSink * appsink, + gpointer user_data) +{ + GstBuffer *buffer; + GstStructure *s; + GstMessage *msg; + GstCameraBinPreviewPipelineData *data; + + data = user_data; + + buffer = gst_app_sink_pull_buffer (appsink); + s = gst_structure_new (GST_BASE_CAMERA_SRC_PREVIEW_MESSAGE_NAME, + "buffer", GST_TYPE_BUFFER, buffer, NULL); + gst_buffer_unref (buffer); + msg = gst_message_new_element (GST_OBJECT (data->element), s); + + GST_DEBUG_OBJECT (data->element, "sending message with preview image"); + if (gst_element_post_message (data->element, msg) == FALSE) { + GST_WARNING_OBJECT (data->element, + "This element has no bus, therefore no message sent!"); + } + + g_mutex_lock (data->processing_lock); + + data->processing--; + if (data->processing == 0) + g_cond_signal (data->processing_cond); + + g_mutex_unlock (data->processing_lock); + + return GST_FLOW_OK; +} + +/** + * gst_camerabin_create_preview_pipeline: + * @element: Owner of this pipeline + * @filter: Custom filter to process preview data (an extra ref is taken) + * + * Creates a new previewing pipeline that can receive buffers + * to be posted as camerabin preview messages for @element + * + * Returns: The newly created #GstCameraBinPreviewPipelineData + */ +GstCameraBinPreviewPipelineData * +gst_camerabin_create_preview_pipeline (GstElement * element, + GstElement * filter) +{ + GstCameraBinPreviewPipelineData *data; + GstElement *csp; + GstElement *csp2; + GstElement *vscale; + gboolean added = FALSE; + GstBus *bus; + GstAppSinkCallbacks callbacks = { 0, }; + + data = g_new (GstCameraBinPreviewPipelineData, 1); + + data->pipeline = gst_pipeline_new ("preview-pipeline"); + data->appsrc = gst_element_factory_make ("appsrc", "preview-appsrc"); + data->capsfilter = gst_element_factory_make ("capsfilter", + "preview-capsfilter"); + data->appsink = gst_element_factory_make ("appsink", "preview-appsink"); + csp = gst_element_factory_make ("ffmpegcolorspace", "preview-csp0"); + csp2 = gst_element_factory_make ("ffmpegcolorspace", "preview-csp1"); + vscale = gst_element_factory_make ("videoscale", "preview-vscale"); + + if (!data->appsrc || !data->capsfilter || !data->appsink || !csp || + !csp2 || !vscale) { + goto error; + } + + gst_bin_add_many (GST_BIN (data->pipeline), data->appsrc, data->capsfilter, + data->appsink, csp, csp2, vscale, NULL); + if (filter) + gst_bin_add (GST_BIN (data->pipeline), gst_object_ref (filter)); + added = TRUE; + + if (filter) { + if (!gst_element_link_many (data->appsrc, filter, csp, vscale, csp2, + data->capsfilter, data->appsink, NULL)) + goto error; + } else { + if (!gst_element_link_many (data->appsrc, csp, vscale, csp2, + data->capsfilter, data->appsink, NULL)) + goto error; + } + + callbacks.new_preroll = gst_camerabin_preview_pipeline_new_preroll; + callbacks.new_buffer = gst_camerabin_preview_pipeline_new_buffer; + gst_app_sink_set_callbacks ((GstAppSink *) data->appsink, &callbacks, data, + NULL); + + bus = gst_pipeline_get_bus (GST_PIPELINE (data->pipeline)); + gst_bus_add_watch (bus, bus_callback, data); + gst_object_unref (bus); + + g_object_set (data->appsink, "sync", FALSE, NULL); + + data->element = element; + data->filter = filter; + + data->processing_lock = g_mutex_new (); + data->processing_cond = g_cond_new (); + + data->pending_preview_caps = NULL; + data->processing = 0; + + return data; +error: + GST_WARNING ("Failed to create camerabin's preview pipeline"); + if (!added) { + if (csp) + gst_object_unref (csp); + if (csp2) + gst_object_unref (csp2); + if (vscale) + gst_object_unref (vscale); + if (data->appsrc) + gst_object_unref (data->appsrc); + if (data->capsfilter) + gst_object_unref (data->capsfilter); + if (data->appsink) + gst_object_unref (data->appsink); + } + gst_camerabin_destroy_preview_pipeline (data); + return NULL; +} + +/** + * gst_camerabin_destroy_preview_pipeline: + * @preview: the #GstCameraBinPreviewPipelineData + * + * Frees a #GstCameraBinPreviewPipelineData + */ +void +gst_camerabin_destroy_preview_pipeline (GstCameraBinPreviewPipelineData * + preview) +{ + if (preview->processing_lock) { + g_mutex_free (preview->processing_lock); + preview->processing_lock = NULL; + } + if (preview->processing_cond) { + g_cond_free (preview->processing_cond); + preview->processing_cond = NULL; + } + if (preview->pipeline) { + gst_element_set_state (preview->pipeline, GST_STATE_NULL); + gst_object_unref (preview->pipeline); + } + g_free (preview); +} + +/** + * gst_camerabin_preview_pipeline_post: + * @preview: the #GstCameraBinPreviewPipelineData + * @buffer: the buffer to be posted as a preview + * + * Converts the @buffer to the desired format and posts the preview + * message to the bus. + * + * Returns: %TRUE on success + */ +gboolean +gst_camerabin_preview_pipeline_post (GstCameraBinPreviewPipelineData * preview, + GstBuffer * buffer) +{ + g_return_val_if_fail (preview != NULL, FALSE); + g_return_val_if_fail (preview->pipeline != NULL, FALSE); + g_return_val_if_fail (buffer, FALSE); + + g_mutex_lock (preview->processing_lock); + g_return_val_if_fail (preview->pipeline != NULL, FALSE); + + if (preview->pending_preview_caps) { + if (preview->processing > 0) { + g_cond_wait (preview->processing_cond, preview->processing_lock); + } + _gst_camerabin_preview_set_caps (preview, preview->pending_preview_caps); + gst_caps_replace (&preview->pending_preview_caps, NULL); + } + + preview->processing++; + + gst_app_src_push_buffer ((GstAppSrc *) preview->appsrc, + gst_buffer_ref (buffer)); + + g_mutex_unlock (preview->processing_lock); + + return TRUE; +} + +static void +_gst_camerabin_preview_set_caps (GstCameraBinPreviewPipelineData * preview, + GstCaps * caps) +{ + GstState state, pending; + GstStateChangeReturn ret; + + g_return_if_fail (preview != NULL); + g_return_if_fail (preview->pipeline != NULL); + + ret = gst_element_get_state (preview->pipeline, &state, &pending, 0); + if (ret == GST_STATE_CHANGE_FAILURE) { + /* make it try again */ + state = GST_STATE_PLAYING; + pending = GST_STATE_VOID_PENDING; + } + gst_element_set_state (preview->pipeline, GST_STATE_NULL); + g_object_set (preview->capsfilter, "caps", caps, NULL); + if (pending != GST_STATE_VOID_PENDING) + state = pending; + gst_element_set_state (preview->pipeline, state); +} + +/** + * gst_camerabin_preview_set_caps: + * @preview: the #GstCameraBinPreviewPipelineData + * @caps: the #GstCaps to be set (a new ref will be taken) + * + * The caps that preview buffers should have when posted + * on the bus + */ +void +gst_camerabin_preview_set_caps (GstCameraBinPreviewPipelineData * preview, + GstCaps * caps) +{ + g_return_if_fail (preview != NULL); + + g_mutex_lock (preview->processing_lock); + + if (preview->processing == 0) { + _gst_camerabin_preview_set_caps (preview, caps); + } else { + GST_DEBUG ("Preview pipeline busy, storing new caps as pending"); + gst_caps_replace (&preview->pending_preview_caps, caps); + } + g_mutex_unlock (preview->processing_lock); +} diff --git a/gst-libs/gst/basecamerabinsrc/gstcamerabinpreview.h b/gst-libs/gst/basecamerabinsrc/gstcamerabinpreview.h new file mode 100644 index 0000000000..ff5bc719e3 --- /dev/null +++ b/gst-libs/gst/basecamerabinsrc/gstcamerabinpreview.h @@ -0,0 +1,55 @@ +/* + * GStreamer + * Copyright (C) 2008 Nokia Corporation + * Copyright (C) 2010 Thiago Santos + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __CAMERABIN_PREVIEW_H_ +#define __CAMERABIN_PREVIEW_H_ + +#ifndef GST_USE_UNSTABLE_API +#warning "camera bin preview is unstable API and may change in future." +#warning "You can define GST_USE_UNSTABLE_API to avoid this warning." +#endif + +#include + +typedef struct +{ + GstElement *pipeline; + + GstElement *appsrc; + GstElement *filter; + GstElement *capsfilter; + GstElement *appsink; + + GstElement *element; + + GstCaps *pending_preview_caps; + guint processing; + GMutex *processing_lock; + GCond *processing_cond; + +} GstCameraBinPreviewPipelineData; + +GstCameraBinPreviewPipelineData *gst_camerabin_create_preview_pipeline (GstElement * element, GstElement * filter); +void gst_camerabin_destroy_preview_pipeline (GstCameraBinPreviewPipelineData * preview); +gboolean gst_camerabin_preview_pipeline_post (GstCameraBinPreviewPipelineData * preview, GstBuffer * buffer); +void gst_camerabin_preview_set_caps (GstCameraBinPreviewPipelineData * preview, GstCaps * caps); + +#endif /* #ifndef __CAMERABIN_PREVIEW_H_ */ diff --git a/gst-libs/gst/baseparse/Makefile.am b/gst-libs/gst/baseparse/Makefile.am deleted file mode 100644 index e44a78b0aa..0000000000 --- a/gst-libs/gst/baseparse/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ - -lib_LTLIBRARIES = libgstbaseparse-@GST_MAJORMINOR@.la - -CLEANFILES = $(BUILT_SOURCES) - -libgstbaseparse_@GST_MAJORMINOR@_la_SOURCES = \ - gstbaseparse.c - -libgstbaseparse_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/baseparse -libgstbaseparse_@GST_MAJORMINOR@include_HEADERS = \ - gstbaseparse.h - -libgstbaseparse_@GST_MAJORMINOR@_la_CFLAGS = \ - $(GST_PLUGINS_BAD_CFLAGS) \ - $(GST_PLUGINS_BASE_CFLAGS) \ - -DGST_USE_UNSTABLE_API \ - $(GST_CFLAGS) -libgstbaseparse_@GST_MAJORMINOR@_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) -libgstbaseparse_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) - diff --git a/gst-libs/gst/baseparse/gstbaseparse.c b/gst-libs/gst/baseparse/gstbaseparse.c deleted file mode 100644 index e465529dbd..0000000000 --- a/gst-libs/gst/baseparse/gstbaseparse.c +++ /dev/null @@ -1,3717 +0,0 @@ -/* GStreamer - * Copyright (C) 2008 Nokia Corporation. All rights reserved. - * Contact: Stefan Kost - * Copyright (C) 2008 Sebastian Dröge . - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/** - * SECTION:gstbaseparse - * @short_description: Base class for stream parsers - * @see_also: #GstBaseTransform - * - * This base class is for parser elements that process data and splits it - * into separate audio/video/whatever frames. - * - * It provides for: - * - * One sinkpad and one srcpad - * Handles state changes - * Does flushing - * Push mode - * Pull mode - * Handles events (NEWSEGMENT/EOS/FLUSH) - * Handles seeking in both modes - * - * Handles POSITION/DURATION/SEEKING/FORMAT/CONVERT queries - * - * - * - * The purpose of this base class is to provide a basic functionality of - * a parser and share a lot of rather complex code. - * - * Description of the parsing mechanism: - * - * - * Set-up phase - * - * GstBaseParse class calls @set_sink_caps to inform the subclass about - * incoming sinkpad caps. Subclass should set the srcpad caps accordingly. - * - * - * GstBaseParse calls @start to inform subclass that data processing is - * about to start now. - * - * - * At least in this point subclass needs to tell the GstBaseParse class - * how big data chunks it wants to receive (min_frame_size). It can do - * this with @gst_base_parse_set_min_frame_size. - * - * - * GstBaseParse class sets up appropriate data passing mode (pull/push) - * and starts to process the data. - * - * - * - * - * - * Parsing phase - * - * GstBaseParse gathers at least min_frame_size bytes of data either - * by pulling it from upstream or collecting buffers into internal - * #GstAdapter. - * - * - * A buffer of (at least) min_frame_size bytes is passed to subclass with - * @check_valid_frame. Subclass checks the contents and returns TRUE - * if the buffer contains a valid frame. It also needs to set the - * @framesize according to the detected frame size. If buffer didn't - * contain a valid frame, this call must return FALSE and optionally - * set the @skipsize value to inform base class that how many bytes - * it needs to skip in order to find a valid frame. @framesize can always - * indicate a new minimum for current frame parsing. The passed buffer - * is read-only. Note that @check_valid_frame might receive any small - * amount of input data when leftover data is being drained (e.g. at EOS). - * - * - * After valid frame is found, it will be passed again to subclass with - * @parse_frame call. Now subclass is responsible for parsing the - * frame contents and setting the caps, and buffer metadata (e.g. - * buffer timestamp and duration, or keyframe if applicable). - * (although the latter can also be done by GstBaseParse if it is - * appropriately configured, see below). Frame is provided with - * timestamp derived from upstream (as much as generally possible), - * duration obtained form configuration (see below), and offset - * if meaningful (in pull mode). - * - * - * Finally the buffer can be pushed downstream and parsing loop starts - * over again. Just prior to actually pushing the buffer in question, - * it is passed to @pre_push_buffer which gives subclass yet one - * last chance to examine buffer metadata, or to send some custom (tag) - * events, or to perform custom (segment) filtering. - * - * - * During the parsing process GstBaseParseClass will handle both srcpad and - * sinkpad events. They will be passed to subclass if @event or - * @src_event callbacks have been provided. - * - * - * - * - * Shutdown phase - * - * GstBaseParse class calls @stop to inform the subclass that data - * parsing will be stopped. - * - * - * - * - * - * Subclass is responsible for providing pad template caps for - * source and sink pads. The pads need to be named "sink" and "src". It also - * needs to set the fixed caps on srcpad, when the format is ensured (e.g. - * when base class calls subclass' @set_sink_caps function). - * - * This base class uses GST_FORMAT_DEFAULT as a meaning of frames. So, - * subclass conversion routine needs to know that conversion from - * GST_FORMAT_TIME to GST_FORMAT_DEFAULT must return the - * frame number that can be found from the given byte position. - * - * GstBaseParse uses subclasses conversion methods also for seeking (or otherwise - * uses its own default one, see also below). - * - * Subclass @start and @stop functions will be called to inform the beginning - * and end of data processing. - * - * Things that subclass need to take care of: - * - * Provide pad templates - * - * Fixate the source pad caps when appropriate - * - * - * Inform base class how big data chunks should be retrieved. This is - * done with @gst_base_parse_set_min_frame_size function. - * - * - * Examine data chunks passed to subclass with @check_valid_frame - * and tell if they contain a valid frame - * - * - * Set the caps and timestamp to frame that is passed to subclass with - * @parse_frame function. - * - * Provide conversion functions - * - * Update the duration information with @gst_base_parse_set_duration - * - * - * Optionally passthrough using @gst_base_parse_set_format - * - * - * Configure various baseparse parameters using @gst_base_parse_set_seek and - * @gst_base_parse_set_frame_props. - * - * - * In particular, if subclass is unable to determine a duration, but - * parsing (or specs) yields a frames per seconds rate, then this can be - * provided to GstBaseParse to enable it to cater for - * buffer time metadata (which will be taken from upstream as much as possible). - * Internally keeping track of frame durations and respective - * sizes that have been pushed provides GstBaseParse with an estimated bitrate. - * A default @convert (used if not overriden) will then use these - * rates to perform obvious conversions. These rates are also used to update - * (estimated) duration at regular frame intervals. - * - * - * - */ - -/* TODO: - * - In push mode provide a queue of adapter-"queued" buffers for upstream - * buffer metadata - * - Queue buffers/events until caps are set - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include - -#include "gstbaseparse.h" - -#define MIN_FRAMES_TO_POST_BITRATE 10 -#define TARGET_DIFFERENCE (20 * GST_SECOND) - -GST_DEBUG_CATEGORY_STATIC (gst_base_parse_debug); -#define GST_CAT_DEFAULT gst_base_parse_debug - -/* Supported formats */ -static GstFormat fmtlist[] = { - GST_FORMAT_DEFAULT, - GST_FORMAT_BYTES, - GST_FORMAT_TIME, - 0 -}; - -#define GST_BASE_PARSE_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_BASE_PARSE, GstBaseParsePrivate)) - -struct _GstBaseParsePrivate -{ - GstActivateMode pad_mode; - - gint64 duration; - GstFormat duration_fmt; - gint64 estimated_duration; - - guint min_frame_size; - guint format; - guint fps_num, fps_den; - gint update_interval; - guint bitrate; - guint lead_in, lead_out; - GstClockTime lead_in_ts, lead_out_ts; - GstBaseParseSeekable seekable; - - gboolean discont; - gboolean flushing; - gboolean drain; - - gint64 offset; - gint64 sync_offset; - GstClockTime next_ts; - GstClockTime prev_ts; - GstClockTime frame_duration; - gboolean seen_keyframe; - gboolean is_video; - - guint64 framecount; - guint64 bytecount; - guint64 data_bytecount; - guint64 acc_duration; - GstClockTime first_frame_ts; - gint64 first_frame_offset; - - gboolean post_min_bitrate; - gboolean post_avg_bitrate; - gboolean post_max_bitrate; - guint min_bitrate; - guint avg_bitrate; - guint max_bitrate; - guint posted_avg_bitrate; - - GList *pending_events; - - GstBuffer *cache; - - /* index entry storage, either ours or provided */ - GstIndex *index; - gint index_id; - gboolean own_index; - /* seek table entries only maintained if upstream is BYTE seekable */ - gboolean upstream_seekable; - gboolean upstream_has_duration; - gint64 upstream_size; - /* minimum distance between two index entries */ - GstClockTimeDiff idx_interval; - /* ts and offset of last entry added */ - GstClockTime index_last_ts; - gint64 index_last_offset; - gboolean index_last_valid; - - /* timestamps currently produced are accurate, e.g. started from 0 onwards */ - gboolean exact_position; - /* seek events are temporarily kept to match them with newsegments */ - GSList *pending_seeks; - - /* reverse playback */ - GSList *buffers_pending; - GSList *buffers_queued; - GSList *buffers_send; - GstClockTime last_ts; - gint64 last_offset; -}; - -typedef struct _GstBaseParseSeek -{ - GstSegment segment; - gboolean accurate; - gint64 offset; - GstClockTime start_ts; -} GstBaseParseSeek; - -#define GST_BASE_PARSE_PASSTHROUGH(parse) \ - (parse->priv->format & GST_BASE_PARSE_FORMAT_PASSTHROUGH) -#define GST_BASE_PARSE_HAS_TIME(parse) \ - (parse->priv->format & GST_BASE_PARSE_FORMAT_HAS_TIME) - - -static GstElementClass *parent_class = NULL; - -static void gst_base_parse_class_init (GstBaseParseClass * klass); -static void gst_base_parse_init (GstBaseParse * parse, - GstBaseParseClass * klass); - -GType -gst_base_parse_get_type (void) -{ - static GType base_parse_type = 0; - - if (!base_parse_type) { - static const GTypeInfo base_parse_info = { - sizeof (GstBaseParseClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gst_base_parse_class_init, - NULL, - NULL, - sizeof (GstBaseParse), - 0, - (GInstanceInitFunc) gst_base_parse_init, - }; - - base_parse_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstBaseParseBad", &base_parse_info, G_TYPE_FLAG_ABSTRACT); - } - return base_parse_type; -} - -static void gst_base_parse_finalize (GObject * object); - -static GstStateChangeReturn gst_base_parse_change_state (GstElement * element, - GstStateChange transition); -static void gst_base_parse_reset (GstBaseParse * parse); - -static void gst_base_parse_set_index (GstElement * element, GstIndex * index); -static GstIndex *gst_base_parse_get_index (GstElement * element); - -static gboolean gst_base_parse_sink_activate (GstPad * sinkpad); -static gboolean gst_base_parse_sink_activate_push (GstPad * pad, - gboolean active); -static gboolean gst_base_parse_sink_activate_pull (GstPad * pad, - gboolean active); -static gboolean gst_base_parse_handle_seek (GstBaseParse * parse, - GstEvent * event); -static void gst_base_parse_handle_tag (GstBaseParse * parse, GstEvent * event); - -static gboolean gst_base_parse_src_event (GstPad * pad, GstEvent * event); -static gboolean gst_base_parse_sink_event (GstPad * pad, GstEvent * event); -static gboolean gst_base_parse_query (GstPad * pad, GstQuery * query); -static gboolean gst_base_parse_sink_setcaps (GstPad * pad, GstCaps * caps); -static const GstQueryType *gst_base_parse_get_querytypes (GstPad * pad); - -static GstFlowReturn gst_base_parse_chain (GstPad * pad, GstBuffer * buffer); -static void gst_base_parse_loop (GstPad * pad); - -static gboolean gst_base_parse_check_frame (GstBaseParse * parse, - GstBaseParseFrame * frame, guint * framesize, gint * skipsize); -static GstFlowReturn gst_base_parse_parse_frame (GstBaseParse * parse, - GstBaseParseFrame * frame); - -static gboolean gst_base_parse_sink_eventfunc (GstBaseParse * parse, - GstEvent * event); - -static gboolean gst_base_parse_src_eventfunc (GstBaseParse * parse, - GstEvent * event); - -static void gst_base_parse_drain (GstBaseParse * parse); - -static void gst_base_parse_post_bitrates (GstBaseParse * parse, - gboolean post_min, gboolean post_avg, gboolean post_max); - -static gint64 gst_base_parse_find_offset (GstBaseParse * parse, - GstClockTime time, gboolean before, GstClockTime * _ts); -static GstFlowReturn gst_base_parse_locate_time (GstBaseParse * parse, - GstClockTime * _time, gint64 * _offset); - -static GstFlowReturn gst_base_parse_process_fragment (GstBaseParse * parse, - gboolean push_only); - -static void -gst_base_parse_clear_queues (GstBaseParse * parse) -{ - g_slist_foreach (parse->priv->buffers_queued, (GFunc) gst_buffer_unref, NULL); - g_slist_free (parse->priv->buffers_queued); - parse->priv->buffers_queued = NULL; - g_slist_foreach (parse->priv->buffers_pending, (GFunc) gst_buffer_unref, - NULL); - g_slist_free (parse->priv->buffers_pending); - parse->priv->buffers_pending = NULL; - g_slist_foreach (parse->priv->buffers_send, (GFunc) gst_buffer_unref, NULL); - g_slist_free (parse->priv->buffers_send); - parse->priv->buffers_send = NULL; -} - -static void -gst_base_parse_finalize (GObject * object) -{ - GstBaseParse *parse = GST_BASE_PARSE (object); - GstEvent **p_ev; - - g_object_unref (parse->adapter); - - if (parse->pending_segment) { - p_ev = &parse->pending_segment; - gst_event_replace (p_ev, NULL); - } - if (parse->close_segment) { - p_ev = &parse->close_segment; - gst_event_replace (p_ev, NULL); - } - - if (parse->priv->cache) { - gst_buffer_unref (parse->priv->cache); - parse->priv->cache = NULL; - } - - g_list_foreach (parse->priv->pending_events, (GFunc) gst_mini_object_unref, - NULL); - g_list_free (parse->priv->pending_events); - parse->priv->pending_events = NULL; - - if (parse->priv->index) { - gst_object_unref (parse->priv->index); - parse->priv->index = NULL; - } - - gst_base_parse_clear_queues (parse); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -gst_base_parse_class_init (GstBaseParseClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (GstBaseParsePrivate)); - parent_class = g_type_class_peek_parent (klass); - gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_base_parse_finalize); - - gstelement_class = (GstElementClass *) klass; - gstelement_class->change_state = - GST_DEBUG_FUNCPTR (gst_base_parse_change_state); - gstelement_class->set_index = GST_DEBUG_FUNCPTR (gst_base_parse_set_index); - gstelement_class->get_index = GST_DEBUG_FUNCPTR (gst_base_parse_get_index); - - /* Default handlers */ - klass->check_valid_frame = gst_base_parse_check_frame; - klass->parse_frame = gst_base_parse_parse_frame; - klass->src_event = gst_base_parse_src_eventfunc; - klass->convert = gst_base_parse_convert_default; - - GST_DEBUG_CATEGORY_INIT (gst_base_parse_debug, "baseparse", 0, - "baseparse element"); -} - -static void -gst_base_parse_init (GstBaseParse * parse, GstBaseParseClass * bclass) -{ - GstPadTemplate *pad_template; - - GST_DEBUG_OBJECT (parse, "gst_base_parse_init"); - - parse->priv = GST_BASE_PARSE_GET_PRIVATE (parse); - - pad_template = - gst_element_class_get_pad_template (GST_ELEMENT_CLASS (bclass), "sink"); - g_return_if_fail (pad_template != NULL); - parse->sinkpad = gst_pad_new_from_template (pad_template, "sink"); - gst_pad_set_event_function (parse->sinkpad, - GST_DEBUG_FUNCPTR (gst_base_parse_sink_event)); - gst_pad_set_setcaps_function (parse->sinkpad, - GST_DEBUG_FUNCPTR (gst_base_parse_sink_setcaps)); - gst_pad_set_chain_function (parse->sinkpad, - GST_DEBUG_FUNCPTR (gst_base_parse_chain)); - gst_pad_set_activate_function (parse->sinkpad, - GST_DEBUG_FUNCPTR (gst_base_parse_sink_activate)); - gst_pad_set_activatepush_function (parse->sinkpad, - GST_DEBUG_FUNCPTR (gst_base_parse_sink_activate_push)); - gst_pad_set_activatepull_function (parse->sinkpad, - GST_DEBUG_FUNCPTR (gst_base_parse_sink_activate_pull)); - gst_element_add_pad (GST_ELEMENT (parse), parse->sinkpad); - - GST_DEBUG_OBJECT (parse, "sinkpad created"); - - pad_template = - gst_element_class_get_pad_template (GST_ELEMENT_CLASS (bclass), "src"); - g_return_if_fail (pad_template != NULL); - parse->srcpad = gst_pad_new_from_template (pad_template, "src"); - gst_pad_set_event_function (parse->srcpad, - GST_DEBUG_FUNCPTR (gst_base_parse_src_event)); - gst_pad_set_query_type_function (parse->srcpad, - GST_DEBUG_FUNCPTR (gst_base_parse_get_querytypes)); - gst_pad_set_query_function (parse->srcpad, - GST_DEBUG_FUNCPTR (gst_base_parse_query)); - gst_pad_use_fixed_caps (parse->srcpad); - gst_element_add_pad (GST_ELEMENT (parse), parse->srcpad); - GST_DEBUG_OBJECT (parse, "src created"); - - parse->adapter = gst_adapter_new (); - - parse->priv->pad_mode = GST_ACTIVATE_NONE; - - /* init state */ - gst_base_parse_reset (parse); - GST_DEBUG_OBJECT (parse, "init ok"); -} - -/** - * gst_base_parse_frame_init: - * @parse: #GstBaseParse. - * @fmt: #GstBaseParseFrame. - * - * Sets a #GstBaseParseFrame to initial state. Currently this means - * all fields are zero-ed. - */ -void -gst_base_parse_frame_init (GstBaseParse * parse, GstBaseParseFrame * frame) -{ - memset (frame, 0, sizeof (*frame)); -} - -/* clear == frame no longer to be used following this */ -static void -gst_base_parse_frame_clear (GstBaseParse * parse, GstBaseParseFrame * frame) -{ - /* limited for now */ - if (frame->buffer) { - gst_buffer_unref (frame->buffer); - frame->buffer = NULL; - } -} - -static inline void -gst_base_parse_frame_update (GstBaseParse * parse, GstBaseParseFrame * frame, - GstBuffer * buf) -{ - gst_buffer_replace (&frame->buffer, buf); - if (parse->priv->drain) { - frame->flags |= GST_BASE_PARSE_FRAME_FLAG_DRAIN; - } else { - frame->flags &= ~(GST_BASE_PARSE_FRAME_FLAG_DRAIN); - } - /* losing sync is pretty much a discont (and vice versa), no ? */ - if (!parse->priv->discont) { - frame->flags |= GST_BASE_PARSE_FRAME_FLAG_SYNC; - } else { - frame->flags &= ~(GST_BASE_PARSE_FRAME_FLAG_SYNC); - } -} - -static void -gst_base_parse_reset (GstBaseParse * parse) -{ - GST_OBJECT_LOCK (parse); - gst_segment_init (&parse->segment, GST_FORMAT_TIME); - parse->priv->duration = -1; - parse->priv->min_frame_size = 1; - parse->priv->discont = TRUE; - parse->priv->flushing = FALSE; - parse->priv->offset = 0; - parse->priv->sync_offset = 0; - parse->priv->update_interval = -1; - parse->priv->fps_num = parse->priv->fps_den = 0; - parse->priv->frame_duration = GST_CLOCK_TIME_NONE; - parse->priv->lead_in = parse->priv->lead_out = 0; - parse->priv->lead_in_ts = parse->priv->lead_out_ts = 0; - parse->priv->seekable = GST_BASE_PARSE_SEEK_DEFAULT; - parse->priv->bitrate = 0; - parse->priv->framecount = 0; - parse->priv->bytecount = 0; - parse->priv->acc_duration = 0; - parse->priv->first_frame_ts = GST_CLOCK_TIME_NONE; - parse->priv->first_frame_offset = -1; - parse->priv->estimated_duration = -1; - parse->priv->next_ts = 0; - parse->priv->format = 0; - parse->priv->post_min_bitrate = TRUE; - parse->priv->post_avg_bitrate = TRUE; - parse->priv->post_max_bitrate = TRUE; - parse->priv->min_bitrate = G_MAXUINT; - parse->priv->max_bitrate = 0; - parse->priv->avg_bitrate = 0; - parse->priv->posted_avg_bitrate = 0; - - parse->priv->index_last_ts = GST_CLOCK_TIME_NONE; - parse->priv->index_last_offset = -1; - parse->priv->index_last_valid = TRUE; - parse->priv->upstream_seekable = FALSE; - parse->priv->upstream_size = 0; - parse->priv->upstream_has_duration = FALSE; - parse->priv->idx_interval = 0; - parse->priv->exact_position = TRUE; - parse->priv->seen_keyframe = FALSE; - - parse->priv->last_ts = GST_CLOCK_TIME_NONE; - parse->priv->last_offset = 0; - - if (parse->pending_segment) { - gst_event_unref (parse->pending_segment); - parse->pending_segment = NULL; - } - - g_list_foreach (parse->priv->pending_events, (GFunc) gst_mini_object_unref, - NULL); - g_list_free (parse->priv->pending_events); - parse->priv->pending_events = NULL; - - if (parse->priv->cache) { - gst_buffer_unref (parse->priv->cache); - parse->priv->cache = NULL; - } - - g_slist_foreach (parse->priv->pending_seeks, (GFunc) g_free, NULL); - g_slist_free (parse->priv->pending_seeks); - parse->priv->pending_seeks = NULL; - - GST_OBJECT_UNLOCK (parse); -} - -/** - * gst_base_parse_check_frame: - * @parse: #GstBaseParse. - * @buffer: GstBuffer. - * @framesize: This will be set to tell the found frame size in bytes. - * @skipsize: Output parameter that tells how much data needs to be skipped - * in order to find the following frame header. - * - * Default callback for check_valid_frame. - * - * Returns: Always TRUE. - */ -static gboolean -gst_base_parse_check_frame (GstBaseParse * parse, - GstBaseParseFrame * frame, guint * framesize, gint * skipsize) -{ - *framesize = GST_BUFFER_SIZE (frame->buffer); - *skipsize = 0; - return TRUE; -} - - -/** - * gst_base_parse_parse_frame: - * @parse: #GstBaseParse. - * @buffer: #GstBuffer. - * - * Default callback for parse_frame. - */ -static GstFlowReturn -gst_base_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame) -{ - GstBuffer *buffer = frame->buffer; - - if (!GST_BUFFER_TIMESTAMP_IS_VALID (buffer) && - GST_CLOCK_TIME_IS_VALID (parse->priv->next_ts)) { - GST_BUFFER_TIMESTAMP (buffer) = parse->priv->next_ts; - } - if (!GST_BUFFER_DURATION_IS_VALID (buffer) && - GST_CLOCK_TIME_IS_VALID (parse->priv->frame_duration)) { - GST_BUFFER_DURATION (buffer) = parse->priv->frame_duration; - } - return GST_FLOW_OK; -} - -/** - * gst_base_parse_convert: - * @parse: #GstBaseParse. - * @src_format: #GstFormat describing the source format. - * @src_value: Source value to be converted. - * @dest_format: #GstFormat defining the converted format. - * @dest_value: Pointer where the conversion result will be put. - * - * Converts using configured "convert" vmethod in #GstBaseParse class. - * - * Returns: TRUE if conversion was successful. - */ -static gboolean -gst_base_parse_convert (GstBaseParse * parse, - GstFormat src_format, - gint64 src_value, GstFormat dest_format, gint64 * dest_value) -{ - GstBaseParseClass *klass = GST_BASE_PARSE_GET_CLASS (parse); - gboolean ret; - - g_return_val_if_fail (dest_value != NULL, FALSE); - - if (!klass->convert) - return FALSE; - - ret = klass->convert (parse, src_format, src_value, dest_format, dest_value); - -#ifndef GST_DISABLE_GST_DEBUG - { - if (ret) { - if (src_format == GST_FORMAT_TIME && dest_format == GST_FORMAT_BYTES) { - GST_LOG_OBJECT (parse, - "TIME -> BYTES: %" GST_TIME_FORMAT " -> %" G_GINT64_FORMAT, - GST_TIME_ARGS (src_value), *dest_value); - } else if (dest_format == GST_FORMAT_TIME && - src_format == GST_FORMAT_BYTES) { - GST_LOG_OBJECT (parse, - "BYTES -> TIME: %" G_GINT64_FORMAT " -> %" GST_TIME_FORMAT, - src_value, GST_TIME_ARGS (*dest_value)); - } else { - GST_LOG_OBJECT (parse, - "%s -> %s: %" G_GINT64_FORMAT " -> %" G_GINT64_FORMAT, - GST_STR_NULL (gst_format_get_name (src_format)), - GST_STR_NULL (gst_format_get_name (dest_format)), - src_value, *dest_value); - } - } else { - GST_DEBUG_OBJECT (parse, "conversion failed"); - } - } -#endif - - return ret; -} - -/** - * gst_base_parse_sink_event: - * @pad: #GstPad that received the event. - * @event: #GstEvent to be handled. - * - * Handler for sink pad events. - * - * Returns: TRUE if the event was handled. - */ -static gboolean -gst_base_parse_sink_event (GstPad * pad, GstEvent * event) -{ - GstBaseParse *parse; - GstBaseParseClass *bclass; - gboolean handled = FALSE; - gboolean ret = TRUE; - - parse = GST_BASE_PARSE (gst_pad_get_parent (pad)); - bclass = GST_BASE_PARSE_GET_CLASS (parse); - - GST_DEBUG_OBJECT (parse, "handling event %d, %s", GST_EVENT_TYPE (event), - GST_EVENT_TYPE_NAME (event)); - - /* Cache all events except EOS, NEWSEGMENT and FLUSH_STOP if we have a - * pending segment */ - if (parse->pending_segment && GST_EVENT_TYPE (event) != GST_EVENT_EOS - && GST_EVENT_TYPE (event) != GST_EVENT_NEWSEGMENT - && GST_EVENT_TYPE (event) != GST_EVENT_FLUSH_START - && GST_EVENT_TYPE (event) != GST_EVENT_FLUSH_STOP) { - - if (GST_EVENT_TYPE (event) == GST_EVENT_TAG) - /* See if any bitrate tags were posted */ - gst_base_parse_handle_tag (parse, event); - - parse->priv->pending_events = - g_list_append (parse->priv->pending_events, event); - ret = TRUE; - } else { - - if (GST_EVENT_TYPE (event) == GST_EVENT_EOS && - parse->priv->framecount < MIN_FRAMES_TO_POST_BITRATE) - /* We've not posted bitrate tags yet - do so now */ - gst_base_parse_post_bitrates (parse, TRUE, TRUE, TRUE); - - if (bclass->event) - handled = bclass->event (parse, event); - - if (!handled) - handled = gst_base_parse_sink_eventfunc (parse, event); - - if (!handled) - ret = gst_pad_event_default (pad, event); - } - - gst_object_unref (parse); - GST_DEBUG_OBJECT (parse, "event handled"); - return ret; -} - - -/** - * gst_base_parse_sink_eventfunc: - * @parse: #GstBaseParse. - * @event: #GstEvent to be handled. - * - * Element-level event handler function. - * - * The event will be unreffed only if it has been handled and this - * function returns %TRUE - * - * Returns: %TRUE if the event was handled and not need forwarding. - */ -static gboolean -gst_base_parse_sink_eventfunc (GstBaseParse * parse, GstEvent * event) -{ - gboolean handled = FALSE; - GstEvent **eventp; - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_NEWSEGMENT: - { - gdouble rate, applied_rate; - GstFormat format; - gint64 start, stop, pos, next_ts, offset = 0; - gboolean update; - - gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate, - &format, &start, &stop, &pos); - - GST_DEBUG_OBJECT (parse, "newseg rate %g, applied rate %g, " - "format %d, start = %" GST_TIME_FORMAT ", stop = %" GST_TIME_FORMAT - ", pos = %" GST_TIME_FORMAT, rate, applied_rate, format, - GST_TIME_ARGS (start), GST_TIME_ARGS (stop), GST_TIME_ARGS (pos)); - - if (format == GST_FORMAT_BYTES) { - GstClockTime seg_start, seg_stop; - GstBaseParseSeek *seek = NULL; - GSList *node; - - /* stop time is allowed to be open-ended, but not start & pos */ - seg_stop = GST_CLOCK_TIME_NONE; - seg_start = 0; - offset = pos; - - GST_OBJECT_LOCK (parse); - for (node = parse->priv->pending_seeks; node; node = node->next) { - GstBaseParseSeek *tmp = node->data; - - if (tmp->offset == pos) { - seek = tmp; - break; - } - } - parse->priv->pending_seeks = - g_slist_remove (parse->priv->pending_seeks, seek); - GST_OBJECT_UNLOCK (parse); - - if (seek) { - GST_DEBUG_OBJECT (parse, - "Matched newsegment to%s seek: %" GST_SEGMENT_FORMAT, - seek->accurate ? " accurate" : "", &seek->segment); - seg_start = seek->segment.start; - seg_stop = seek->segment.stop; - next_ts = seek->start_ts; - parse->priv->exact_position = seek->accurate; - g_free (seek); - } else { - /* best attempt convert */ - /* as these are only estimates, stop is kept open-ended to avoid - * premature cutting */ - gst_base_parse_convert (parse, GST_FORMAT_BYTES, start, - GST_FORMAT_TIME, (gint64 *) & seg_start); - parse->priv->exact_position = (start == 0); - next_ts = seg_start; - } - - gst_event_unref (event); - event = gst_event_new_new_segment_full (update, rate, applied_rate, - GST_FORMAT_TIME, seg_start, seg_stop, seg_start); - format = GST_FORMAT_TIME; - start = seg_start; - stop = seg_stop; - GST_DEBUG_OBJECT (parse, "Converted incoming segment to TIME. " - "start = %" GST_TIME_FORMAT ", stop = %" GST_TIME_FORMAT, - GST_TIME_ARGS (seg_start), GST_TIME_ARGS (seg_stop)); - } else if (format != GST_FORMAT_TIME) { - /* Unknown incoming segment format. Output a default open-ended - * TIME segment */ - gst_event_unref (event); - event = gst_event_new_new_segment_full (update, rate, applied_rate, - GST_FORMAT_TIME, 0, GST_CLOCK_TIME_NONE, 0); - format = GST_FORMAT_TIME; - next_ts = start = 0; - stop = GST_CLOCK_TIME_NONE; - } else { - /* not considered BYTE seekable if it is talking to us in TIME, - * whatever else it might claim */ - parse->priv->upstream_seekable = FALSE; - next_ts = start; - } - - gst_segment_set_newsegment_full (&parse->segment, update, rate, - applied_rate, format, start, stop, start); - - /* save the segment for later, right before we push a new buffer so that - * the caps are fixed and the next linked element can receive - * the segment. */ - eventp = &parse->pending_segment; - gst_event_replace (eventp, event); - gst_event_unref (event); - handled = TRUE; - - /* but finish the current segment */ - GST_DEBUG_OBJECT (parse, "draining current segment"); - if (parse->segment.rate > 0.0) - gst_base_parse_drain (parse); - else - gst_base_parse_process_fragment (parse, FALSE); - gst_adapter_clear (parse->adapter); - parse->priv->offset = offset; - parse->priv->sync_offset = offset; - parse->priv->next_ts = next_ts; - parse->priv->last_ts = GST_CLOCK_TIME_NONE; - parse->priv->discont = TRUE; - parse->priv->seen_keyframe = FALSE; - break; - } - - case GST_EVENT_FLUSH_START: - parse->priv->flushing = TRUE; - handled = gst_pad_push_event (parse->srcpad, gst_event_ref (event)); - if (handled) - gst_event_unref (event); - /* Wait for _chain() to exit by taking the srcpad STREAM_LOCK */ - GST_PAD_STREAM_LOCK (parse->srcpad); - GST_PAD_STREAM_UNLOCK (parse->srcpad); - - break; - - case GST_EVENT_FLUSH_STOP: - gst_adapter_clear (parse->adapter); - gst_base_parse_clear_queues (parse); - parse->priv->flushing = FALSE; - parse->priv->discont = TRUE; - parse->priv->last_ts = GST_CLOCK_TIME_NONE; - break; - - case GST_EVENT_EOS: - if (parse->segment.rate > 0.0) - gst_base_parse_drain (parse); - else - gst_base_parse_process_fragment (parse, FALSE); - - /* If we STILL have zero frames processed, fire an error */ - if (parse->priv->framecount == 0) { - GST_ELEMENT_ERROR (parse, STREAM, WRONG_TYPE, - ("No valid frames found before end of stream"), (NULL)); - } - /* newsegment before eos */ - if (parse->pending_segment) { - gst_pad_push_event (parse->srcpad, parse->pending_segment); - parse->pending_segment = NULL; - } - break; - - default: - break; - } - - return handled; -} - - -/** - * gst_base_parse_src_event: - * @pad: #GstPad that received the event. - * @event: #GstEvent that was received. - * - * Handler for source pad events. - * - * Returns: TRUE if the event was handled. - */ -static gboolean -gst_base_parse_src_event (GstPad * pad, GstEvent * event) -{ - GstBaseParse *parse; - GstBaseParseClass *bclass; - gboolean handled = FALSE; - gboolean ret = TRUE; - - parse = GST_BASE_PARSE (gst_pad_get_parent (pad)); - bclass = GST_BASE_PARSE_GET_CLASS (parse); - - GST_DEBUG_OBJECT (parse, "event %d, %s", GST_EVENT_TYPE (event), - GST_EVENT_TYPE_NAME (event)); - - if (bclass->src_event) - handled = bclass->src_event (parse, event); - - if (!handled) - ret = gst_pad_event_default (pad, event); - - gst_object_unref (parse); - return ret; -} - - -/** - * gst_base_parse_src_eventfunc: - * @parse: #GstBaseParse. - * @event: #GstEvent that was received. - * - * Default srcpad event handler. - * - * Returns: TRUE if the event was handled and can be dropped. - */ -static gboolean -gst_base_parse_src_eventfunc (GstBaseParse * parse, GstEvent * event) -{ - gboolean handled = FALSE; - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_SEEK: - { - if (parse->priv->seekable > GST_BASE_PARSE_SEEK_NONE) { - handled = gst_base_parse_handle_seek (parse, event); - } - break; - } - default: - break; - } - return handled; -} - - -/** - * gst_base_parse_convert_default: - * @parse: #GstBaseParse. - * @src_format: #GstFormat describing the source format. - * @src_value: Source value to be converted. - * @dest_format: #GstFormat defining the converted format. - * @dest_value: Pointer where the conversion result will be put. - * - * Default implementation of "convert" vmethod in #GstBaseParse class. - * - * Returns: TRUE if conversion was successful. - */ -gboolean -gst_base_parse_convert_default (GstBaseParse * parse, - GstFormat src_format, - gint64 src_value, GstFormat dest_format, gint64 * dest_value) -{ - gboolean ret = FALSE; - guint64 bytes, duration; - - if (G_UNLIKELY (src_format == dest_format)) { - *dest_value = src_value; - return TRUE; - } - - if (G_UNLIKELY (src_value == -1)) { - *dest_value = -1; - return TRUE; - } - - if (G_UNLIKELY (src_value == 0)) { - *dest_value = 0; - return TRUE; - } - - /* need at least some frames */ - if (!parse->priv->framecount) - return FALSE; - - duration = parse->priv->acc_duration / GST_MSECOND; - bytes = parse->priv->bytecount; - - if (G_UNLIKELY (!duration || !bytes)) - return FALSE; - - if (src_format == GST_FORMAT_BYTES) { - if (dest_format == GST_FORMAT_TIME) { - /* BYTES -> TIME conversion */ - GST_DEBUG_OBJECT (parse, "converting bytes -> time"); - *dest_value = gst_util_uint64_scale (src_value, duration, bytes); - *dest_value *= GST_MSECOND; - GST_DEBUG_OBJECT (parse, "conversion result: %" G_GINT64_FORMAT " ms", - *dest_value / GST_MSECOND); - ret = TRUE; - } - } else if (src_format == GST_FORMAT_TIME) { - if (dest_format == GST_FORMAT_BYTES) { - GST_DEBUG_OBJECT (parse, "converting time -> bytes"); - *dest_value = gst_util_uint64_scale (src_value / GST_MSECOND, bytes, - duration); - GST_DEBUG_OBJECT (parse, - "time %" G_GINT64_FORMAT " ms in bytes = %" G_GINT64_FORMAT, - src_value / GST_MSECOND, *dest_value); - ret = TRUE; - } - } else if (src_format == GST_FORMAT_DEFAULT) { - /* DEFAULT == frame-based */ - if (dest_format == GST_FORMAT_TIME) { - if (parse->priv->fps_den) { - *dest_value = gst_util_uint64_scale (src_value, - GST_SECOND * parse->priv->fps_den, parse->priv->fps_num); - ret = TRUE; - } - } else if (dest_format == GST_FORMAT_BYTES) { - } - } - - return ret; -} - -/** - * gst_base_parse_update_duration: - * @parse: #GstBaseParse. - * - */ -static void -gst_base_parse_update_duration (GstBaseParse * aacparse) -{ - GstPad *peer; - GstBaseParse *parse; - - parse = GST_BASE_PARSE (aacparse); - - peer = gst_pad_get_peer (parse->sinkpad); - if (peer) { - GstFormat pformat = GST_FORMAT_BYTES; - gboolean qres = FALSE; - gint64 ptot, dest_value; - - qres = gst_pad_query_duration (peer, &pformat, &ptot); - gst_object_unref (GST_OBJECT (peer)); - if (qres) { - if (gst_base_parse_convert (parse, pformat, ptot, - GST_FORMAT_TIME, &dest_value)) { - parse->priv->estimated_duration = dest_value; - GST_LOG_OBJECT (parse, - "updated estimated duration to %" GST_TIME_FORMAT, - GST_TIME_ARGS (dest_value)); - } - } - } -} - -static void -gst_base_parse_post_bitrates (GstBaseParse * parse, gboolean post_min, - gboolean post_avg, gboolean post_max) -{ - GstTagList *taglist = gst_tag_list_new (); - - if (post_min && parse->priv->post_min_bitrate) - gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, - GST_TAG_MINIMUM_BITRATE, parse->priv->min_bitrate, NULL); - - if (post_avg && parse->priv->post_avg_bitrate) { - parse->priv->posted_avg_bitrate = parse->priv->avg_bitrate; - gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, GST_TAG_BITRATE, - parse->priv->avg_bitrate, NULL); - } - - if (post_max && parse->priv->post_max_bitrate) - gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, - GST_TAG_MAXIMUM_BITRATE, parse->priv->max_bitrate, NULL); - - GST_DEBUG_OBJECT (parse, "Updated bitrates. Min: %u, Avg: %u, Max: %u", - parse->priv->min_bitrate, parse->priv->avg_bitrate, - parse->priv->max_bitrate); - - gst_element_found_tags_for_pad (GST_ELEMENT (parse), parse->srcpad, taglist); -} - -/** - * gst_base_parse_update_bitrates: - * @parse: #GstBaseParse. - * @buffer: Current frame as a #GstBuffer - * - * Keeps track of the minimum and maximum bitrates, and also maintains a - * running average bitrate of the stream so far. - */ -static void -gst_base_parse_update_bitrates (GstBaseParse * parse, GstBaseParseFrame * frame) -{ - /* Only update the tag on a 10 kbps delta */ - static const gint update_threshold = 10000; - - GstBaseParseClass *klass; - guint64 data_len, frame_dur; - gint overhead, frame_bitrate, old_avg_bitrate; - gboolean update_min = FALSE, update_avg = FALSE, update_max = FALSE; - GstBuffer *buffer = frame->buffer; - - klass = GST_BASE_PARSE_GET_CLASS (parse); - - overhead = frame->overhead; - if (overhead == -1) - return; - - data_len = GST_BUFFER_SIZE (buffer) - overhead; - parse->priv->data_bytecount += data_len; - - /* duration should be valid by now, - * either set by subclass or maybe based on fps settings */ - if (GST_BUFFER_DURATION_IS_VALID (buffer) && parse->priv->acc_duration != 0) { - /* Calculate duration of a frame from buffer properties */ - frame_dur = GST_BUFFER_DURATION (buffer); - parse->priv->avg_bitrate = (8 * parse->priv->data_bytecount * GST_SECOND) / - parse->priv->acc_duration; - - } else { - /* No way to figure out frame duration (is this even possible?) */ - return; - } - - /* override if subclass provided bitrate, e.g. metadata based */ - if (parse->priv->bitrate) { - parse->priv->avg_bitrate = parse->priv->bitrate; - /* spread this (confirmed) info ASAP */ - if (parse->priv->posted_avg_bitrate != parse->priv->avg_bitrate) - gst_base_parse_post_bitrates (parse, FALSE, TRUE, FALSE); - } - - if (frame_dur) - frame_bitrate = (8 * data_len * GST_SECOND) / frame_dur; - else - return; - - GST_LOG_OBJECT (parse, "frame bitrate %u, avg bitrate %u", frame_bitrate, - parse->priv->avg_bitrate); - - if (parse->priv->framecount < MIN_FRAMES_TO_POST_BITRATE) { - goto exit; - } else if (parse->priv->framecount == MIN_FRAMES_TO_POST_BITRATE) { - /* always post all at threshold time */ - update_min = update_max = update_avg = TRUE; - } - - if (G_LIKELY (parse->priv->framecount >= MIN_FRAMES_TO_POST_BITRATE)) { - if (frame_bitrate < parse->priv->min_bitrate) { - parse->priv->min_bitrate = frame_bitrate; - update_min = TRUE; - } - - if (frame_bitrate > parse->priv->max_bitrate) { - parse->priv->max_bitrate = frame_bitrate; - update_max = TRUE; - } - - old_avg_bitrate = parse->priv->posted_avg_bitrate; - if ((gint) (old_avg_bitrate - parse->priv->avg_bitrate) > update_threshold - || (gint) (parse->priv->avg_bitrate - old_avg_bitrate) > - update_threshold) - update_avg = TRUE; - } - - if ((update_min || update_avg || update_max)) - gst_base_parse_post_bitrates (parse, update_min, update_avg, update_max); - - /* If average bitrate changes that much and no valid (time) duration provided, - * then post a new duration message so applications can update their cached - * values */ - if (update_avg && !(parse->priv->duration_fmt == GST_FORMAT_TIME && - GST_CLOCK_TIME_IS_VALID (parse->priv->duration))) - gst_element_post_message (GST_ELEMENT (parse), - gst_message_new_duration (GST_OBJECT (parse), GST_FORMAT_TIME, -1)); - -exit: - return; -} - -/** - * gst_base_parse_add_index_entry: - * @parse: #GstBaseParse. - * @offset: offset of entry - * @ts: timestamp associated with offset - * @key: whether entry refers to keyframe - * @force: add entry disregarding sanity checks - * - * Adds an entry to the index associating @offset to @ts. It is recommended - * to only add keyframe entries. @force allows to bypass checks, such as - * whether the stream is (upstream) seekable, another entry is already "close" - * to the new entry, etc. - * - * Returns: #gboolean indicating whether entry was added - */ -gboolean -gst_base_parse_add_index_entry (GstBaseParse * parse, guint64 offset, - GstClockTime ts, gboolean key, gboolean force) -{ - gboolean ret = FALSE; - GstIndexAssociation associations[2]; - - GST_LOG_OBJECT (parse, "Adding key=%d index entry %" GST_TIME_FORMAT - " @ offset 0x%08" G_GINT64_MODIFIER "x", key, GST_TIME_ARGS (ts), offset); - - if (G_LIKELY (!force)) { - - if (!parse->priv->upstream_seekable) { - GST_DEBUG_OBJECT (parse, "upstream not seekable; discarding"); - goto exit; - } - - /* FIXME need better helper data structure that handles these issues - * related to ongoing collecting of index entries */ - if (parse->priv->index_last_offset >= (gint64) offset) { - GST_DEBUG_OBJECT (parse, "already have entries up to offset " - "0x%08" G_GINT64_MODIFIER "x", parse->priv->index_last_offset); - goto exit; - } - - if (GST_CLOCK_TIME_IS_VALID (parse->priv->index_last_ts) && - GST_CLOCK_DIFF (parse->priv->index_last_ts, ts) < - parse->priv->idx_interval) { - GST_DEBUG_OBJECT (parse, "entry too close to last time %" GST_TIME_FORMAT, - GST_TIME_ARGS (parse->priv->index_last_ts)); - goto exit; - } - - /* if last is not really the last one */ - if (!parse->priv->index_last_valid) { - GstClockTime prev_ts; - - gst_base_parse_find_offset (parse, ts, TRUE, &prev_ts); - if (GST_CLOCK_DIFF (prev_ts, ts) < parse->priv->idx_interval) { - GST_DEBUG_OBJECT (parse, - "entry too close to existing entry %" GST_TIME_FORMAT, - GST_TIME_ARGS (prev_ts)); - parse->priv->index_last_offset = offset; - parse->priv->index_last_ts = ts; - goto exit; - } - } - } - - associations[0].format = GST_FORMAT_TIME; - associations[0].value = ts; - associations[1].format = GST_FORMAT_BYTES; - associations[1].value = offset; - - /* index might change on-the-fly, although that would be nutty app ... */ - GST_OBJECT_LOCK (parse); - gst_index_add_associationv (parse->priv->index, parse->priv->index_id, - (key) ? GST_ASSOCIATION_FLAG_KEY_UNIT : GST_ASSOCIATION_FLAG_DELTA_UNIT, - 2, (const GstIndexAssociation *) &associations); - GST_OBJECT_UNLOCK (parse); - - if (key) { - parse->priv->index_last_offset = offset; - parse->priv->index_last_ts = ts; - } - - ret = TRUE; - -exit: - return ret; -} - -/* check for seekable upstream, above and beyond a mere query */ -static void -gst_base_parse_check_seekability (GstBaseParse * parse) -{ - GstQuery *query; - gboolean seekable = FALSE; - gint64 start = -1, stop = -1; - guint idx_interval = 0; - - query = gst_query_new_seeking (GST_FORMAT_BYTES); - if (!gst_pad_peer_query (parse->sinkpad, query)) { - GST_DEBUG_OBJECT (parse, "seeking query failed"); - goto done; - } - - gst_query_parse_seeking (query, NULL, &seekable, &start, &stop); - - /* try harder to query upstream size if we didn't get it the first time */ - if (seekable && stop == -1) { - GstFormat fmt = GST_FORMAT_BYTES; - - GST_DEBUG_OBJECT (parse, "doing duration query to fix up unset stop"); - gst_pad_query_peer_duration (parse->sinkpad, &fmt, &stop); - } - - /* if upstream doesn't know the size, it's likely that it's not seekable in - * practice even if it technically may be seekable */ - if (seekable && (start != 0 || stop <= start)) { - GST_DEBUG_OBJECT (parse, "seekable but unknown start/stop -> disable"); - seekable = FALSE; - } - - /* let's not put every single frame into our index */ - if (seekable) { - if (stop < 10 * 1024 * 1024) - idx_interval = 100; - else if (stop < 100 * 1024 * 1024) - idx_interval = 500; - else - idx_interval = 1000; - } - -done: - gst_query_unref (query); - - GST_DEBUG_OBJECT (parse, "seekable: %d (%" G_GUINT64_FORMAT " - %" - G_GUINT64_FORMAT ")", seekable, start, stop); - parse->priv->upstream_seekable = seekable; - parse->priv->upstream_size = seekable ? stop : 0; - - GST_DEBUG_OBJECT (parse, "idx_interval: %ums", idx_interval); - parse->priv->idx_interval = idx_interval * GST_MSECOND; -} - -/* some misc checks on upstream */ -static void -gst_base_parse_check_upstream (GstBaseParse * parse) -{ - GstFormat fmt = GST_FORMAT_TIME; - gint64 stop; - - if (gst_pad_query_peer_duration (parse->sinkpad, &fmt, &stop)) - if (GST_CLOCK_TIME_IS_VALID (stop) && stop) { - /* upstream has one, accept it also, and no further updates */ - gst_base_parse_set_duration (parse, GST_FORMAT_TIME, stop, 0); - parse->priv->upstream_has_duration = TRUE; - } - - GST_DEBUG_OBJECT (parse, "upstream_has_duration: %d", - parse->priv->upstream_has_duration); -} - -/* checks src caps to determine if dealing with audio or video */ -/* TODO maybe forego automagic stuff and let subclass configure it ? */ -static void -gst_base_parse_check_media (GstBaseParse * parse) -{ - GstCaps *caps; - GstStructure *s; - - caps = GST_PAD_CAPS (parse->srcpad); - if (G_LIKELY (caps) && (s = gst_caps_get_structure (caps, 0))) { - parse->priv->is_video = - g_str_has_prefix (gst_structure_get_name (s), "video"); - } else { - /* historical default */ - parse->priv->is_video = FALSE; - } - - GST_DEBUG_OBJECT (parse, "media is video == %d", parse->priv->is_video); -} - -/** - * gst_base_parse_handle_and_push_buffer: - * @parse: #GstBaseParse. - * @klass: #GstBaseParseClass. - * @buffer: #GstBuffer. - * - * Parses the frame from given buffer and pushes it forward. Also performs - * timestamp handling and checks the segment limits. - * - * This is called with srcpad STREAM_LOCK held. - * - * Returns: #GstFlowReturn - */ -static GstFlowReturn -gst_base_parse_handle_and_push_frame (GstBaseParse * parse, - GstBaseParseClass * klass, GstBaseParseFrame * frame) -{ - GstFlowReturn ret; - gint64 offset; - GstBuffer *buffer; - - g_return_val_if_fail (frame != NULL, GST_FLOW_ERROR); - - buffer = frame->buffer; - - if (parse->priv->discont) { - GST_DEBUG_OBJECT (parse, "marking DISCONT"); - GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT); - parse->priv->discont = FALSE; - } - - /* some one-time start-up */ - if (G_UNLIKELY (!parse->priv->framecount)) { - gst_base_parse_check_seekability (parse); - gst_base_parse_check_upstream (parse); - } - - GST_LOG_OBJECT (parse, - "parsing frame at offset %" G_GUINT64_FORMAT - " (%#" G_GINT64_MODIFIER "x) of size %d", - GST_BUFFER_OFFSET (buffer), GST_BUFFER_OFFSET (buffer), - GST_BUFFER_SIZE (buffer)); - - /* use default handler to provide initial (upstream) metadata */ - gst_base_parse_parse_frame (parse, frame); - - /* store offset as it might get overwritten */ - offset = GST_BUFFER_OFFSET (buffer); - ret = klass->parse_frame (parse, frame); - /* sync */ - buffer = frame->buffer; - /* subclass must play nice */ - g_return_val_if_fail (buffer != NULL, GST_FLOW_ERROR); - - /* check if subclass/format can provide ts. - * If so, that allows and enables extra seek and duration determining options */ - if (G_UNLIKELY (parse->priv->first_frame_offset < 0 && ret == GST_FLOW_OK)) { - if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer) && - GST_BASE_PARSE_HAS_TIME (parse) && - parse->priv->pad_mode == GST_ACTIVATE_PULL) { - parse->priv->first_frame_offset = offset; - parse->priv->first_frame_ts = GST_BUFFER_TIMESTAMP (buffer); - GST_DEBUG_OBJECT (parse, "subclass provided ts %" GST_TIME_FORMAT - " for first frame at offset %" G_GINT64_FORMAT, - GST_TIME_ARGS (parse->priv->first_frame_ts), - parse->priv->first_frame_offset); - if (!GST_CLOCK_TIME_IS_VALID (parse->priv->duration)) { - gint64 off; - GstClockTime last_ts = G_MAXINT64; - - GST_DEBUG_OBJECT (parse, "no duration; trying scan to determine"); - gst_base_parse_locate_time (parse, &last_ts, &off); - if (GST_CLOCK_TIME_IS_VALID (last_ts)) - gst_base_parse_set_duration (parse, GST_FORMAT_TIME, last_ts, 0); - } - } else { - /* disable further checks */ - parse->priv->first_frame_offset = 0; - } - } - - /* again use default handler to add missing metadata; - * we may have new information on frame properties */ - gst_base_parse_parse_frame (parse, frame); - if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer) && - GST_BUFFER_DURATION_IS_VALID (buffer)) { - parse->priv->next_ts = - GST_BUFFER_TIMESTAMP (buffer) + GST_BUFFER_DURATION (buffer); - } else { - /* we lost track, do not produce bogus time next time around - * (probably means parser subclass has given up on parsing as well) */ - GST_DEBUG_OBJECT (parse, "no next fallback timestamp"); - parse->priv->next_ts = GST_CLOCK_TIME_NONE; - } - - if (parse->priv->upstream_seekable && parse->priv->exact_position && - GST_BUFFER_TIMESTAMP_IS_VALID (buffer)) - gst_base_parse_add_index_entry (parse, offset, - GST_BUFFER_TIMESTAMP (buffer), - !GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT), FALSE); - - /* First buffers are dropped, this means that the subclass needs more - * frames to decide on the format and queues them internally */ - /* convert internal flow to OK and mark discont for the next buffer. */ - if (ret == GST_BASE_PARSE_FLOW_DROPPED) { - gst_base_parse_frame_clear (parse, frame); - return GST_FLOW_OK; - } else if (ret != GST_FLOW_OK) { - return ret; - } - - return gst_base_parse_push_frame (parse, frame); -} - -/** - * gst_base_parse_push_frame: - * @parse: #GstBaseParse. - * @frame: #GstBaseParseFrame. - * - * Pushes the frame downstream, sends any pending events and - * does some timestamp and segment handling. - * - * This must be called with sinkpad STREAM_LOCK held. - * - * Returns: #GstFlowReturn - */ -GstFlowReturn -gst_base_parse_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame) -{ - GstFlowReturn ret = GST_FLOW_OK; - GstClockTime last_start = GST_CLOCK_TIME_NONE; - GstClockTime last_stop = GST_CLOCK_TIME_NONE; - GstBaseParseClass *klass = GST_BASE_PARSE_GET_CLASS (parse); - GstBuffer *buffer; - - g_return_val_if_fail (frame != NULL, GST_FLOW_ERROR); - g_return_val_if_fail (frame->buffer != NULL, GST_FLOW_ERROR); - - buffer = frame->buffer; - - GST_LOG_OBJECT (parse, - "processing buffer of size %d with ts %" GST_TIME_FORMAT - ", duration %" GST_TIME_FORMAT, GST_BUFFER_SIZE (buffer), - GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)), - GST_TIME_ARGS (GST_BUFFER_DURATION (buffer))); - - /* update stats */ - parse->priv->bytecount += GST_BUFFER_SIZE (buffer); - if (G_LIKELY (!(frame->flags & GST_BASE_PARSE_FRAME_FLAG_NO_FRAME))) { - parse->priv->framecount++; - if (GST_BUFFER_DURATION_IS_VALID (buffer)) { - parse->priv->acc_duration += GST_BUFFER_DURATION (buffer); - } - } - /* 0 means disabled */ - if (parse->priv->update_interval < 0) - parse->priv->update_interval = 50; - else if (parse->priv->update_interval > 0 && - (parse->priv->framecount % parse->priv->update_interval) == 0) - gst_base_parse_update_duration (parse); - - if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer)) - last_start = last_stop = GST_BUFFER_TIMESTAMP (buffer); - if (last_start != GST_CLOCK_TIME_NONE - && GST_BUFFER_DURATION_IS_VALID (buffer)) - last_stop = last_start + GST_BUFFER_DURATION (buffer); - - /* should have caps by now */ - g_return_val_if_fail (GST_PAD_CAPS (parse->srcpad), GST_FLOW_ERROR); - - /* segment adjustment magic; only if we are running the whole show */ - if (!GST_BASE_PARSE_PASSTHROUGH (parse) && parse->segment.rate > 0.0 && - (parse->priv->pad_mode == GST_ACTIVATE_PULL || - parse->priv->upstream_seekable)) { - /* segment times are typically estimates, - * actual frame data might lead subclass to different timestamps, - * so override segment start from what is supplied there */ - if (G_UNLIKELY (parse->pending_segment && !parse->priv->exact_position && - GST_CLOCK_TIME_IS_VALID (last_start))) { - gst_event_unref (parse->pending_segment); - parse->segment.start = - MIN ((guint64) last_start, (guint64) parse->segment.stop); - GST_DEBUG_OBJECT (parse, - "adjusting pending segment start to %" GST_TIME_FORMAT, - GST_TIME_ARGS (parse->segment.start)); - parse->pending_segment = - gst_event_new_new_segment (FALSE, parse->segment.rate, - parse->segment.format, parse->segment.start, parse->segment.stop, - parse->segment.start); - } - /* handle gaps, e.g. non-zero start-time, in as much not handled by above */ - if (GST_CLOCK_TIME_IS_VALID (parse->segment.last_stop) && - GST_CLOCK_TIME_IS_VALID (last_start)) { - GstClockTimeDiff diff; - - /* only send newsegments with increasing start times, - * otherwise if these go back and forth downstream (sinks) increase - * accumulated time and running_time */ - diff = GST_CLOCK_DIFF (parse->segment.last_stop, last_start); - if (G_UNLIKELY (diff > 2 * GST_SECOND && last_start > parse->segment.start - && (!GST_CLOCK_TIME_IS_VALID (parse->segment.stop) || - last_start < parse->segment.stop))) { - GST_DEBUG_OBJECT (parse, - "Gap of %" G_GINT64_FORMAT " ns detected in stream " - "(%" GST_TIME_FORMAT " -> %" GST_TIME_FORMAT "). " - "Sending updated NEWSEGMENT events", diff, - GST_TIME_ARGS (parse->segment.last_stop), - GST_TIME_ARGS (last_start)); - if (G_UNLIKELY (parse->pending_segment)) { - gst_event_unref (parse->pending_segment); - parse->segment.start = last_start; - parse->pending_segment = - gst_event_new_new_segment (FALSE, parse->segment.rate, - parse->segment.format, parse->segment.start, parse->segment.stop, - parse->segment.start); - } else { - /* send newsegment events such that the gap is not accounted in - * accum time, hence running_time */ - /* close ahead of gap */ - gst_pad_push_event (parse->srcpad, - gst_event_new_new_segment (TRUE, parse->segment.rate, - parse->segment.format, parse->segment.last_stop, - parse->segment.last_stop, parse->segment.last_stop)); - /* skip gap */ - gst_pad_push_event (parse->srcpad, - gst_event_new_new_segment (FALSE, parse->segment.rate, - parse->segment.format, last_start, parse->segment.stop, - last_start)); - } - /* align segment view with downstream, - * prevents double-counting accum when closing segment */ - gst_segment_set_newsegment (&parse->segment, FALSE, - parse->segment.rate, parse->segment.format, last_start, - parse->segment.stop, last_start); - parse->segment.last_stop = last_start; - } - } - } - - /* and should then also be linked downstream, so safe to send some events */ - if (G_UNLIKELY (parse->close_segment)) { - /* only set up by loop */ - GST_DEBUG_OBJECT (parse, "loop sending close segment"); - gst_pad_push_event (parse->srcpad, parse->close_segment); - parse->close_segment = NULL; - } - if (G_UNLIKELY (parse->pending_segment)) { - GST_DEBUG_OBJECT (parse, "%s push pending segment", - parse->priv->pad_mode == GST_ACTIVATE_PULL ? "loop" : "chain"); - gst_pad_push_event (parse->srcpad, parse->pending_segment); - parse->pending_segment = NULL; - - /* have caps; check identity */ - gst_base_parse_check_media (parse); - } - - /* update bitrates and optionally post corresponding tags - * (following newsegment) */ - gst_base_parse_update_bitrates (parse, frame); - - if (G_UNLIKELY (parse->priv->pending_events)) { - GList *l; - - for (l = parse->priv->pending_events; l != NULL; l = l->next) { - gst_pad_push_event (parse->srcpad, GST_EVENT (l->data)); - } - g_list_free (parse->priv->pending_events); - parse->priv->pending_events = NULL; - } - - if (klass->pre_push_frame) { - ret = klass->pre_push_frame (parse, frame); - } else { - frame->flags |= GST_BASE_PARSE_FRAME_FLAG_CLIP; - } - - /* take final ownership of frame buffer */ - buffer = frame->buffer; - frame->buffer = NULL; - - /* subclass must play nice */ - g_return_val_if_fail (buffer != NULL, GST_FLOW_ERROR); - - /* decorate */ - buffer = gst_buffer_make_metadata_writable (buffer); - gst_buffer_set_caps (buffer, GST_PAD_CAPS (parse->srcpad)); - - parse->priv->seen_keyframe |= parse->priv->is_video && - !GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT); - - if (frame->flags & GST_BASE_PARSE_FRAME_FLAG_CLIP) { - if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer) && - GST_CLOCK_TIME_IS_VALID (parse->segment.stop) && - GST_BUFFER_TIMESTAMP (buffer) > - parse->segment.stop + parse->priv->lead_out_ts) { - GST_LOG_OBJECT (parse, "Dropped frame, after segment"); - ret = GST_FLOW_UNEXPECTED; - } else if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer) && - GST_BUFFER_DURATION_IS_VALID (buffer) && - GST_CLOCK_TIME_IS_VALID (parse->segment.start) && - GST_BUFFER_TIMESTAMP (buffer) + GST_BUFFER_DURATION (buffer) + - parse->priv->lead_in_ts < parse->segment.start) { - if (parse->priv->seen_keyframe) { - GST_LOG_OBJECT (parse, "Frame before segment, after keyframe"); - ret = GST_FLOW_OK; - } else { - GST_LOG_OBJECT (parse, "Dropped frame, before segment"); - ret = GST_BASE_PARSE_FLOW_DROPPED; - } - } else { - ret = GST_FLOW_OK; - } - } - - if (ret == GST_BASE_PARSE_FLOW_DROPPED) { - GST_LOG_OBJECT (parse, "frame (%d bytes) dropped", - GST_BUFFER_SIZE (buffer)); - gst_buffer_unref (buffer); - ret = GST_FLOW_OK; - } else if (ret == GST_FLOW_OK) { - if (parse->segment.rate > 0.0) { - ret = gst_pad_push (parse->srcpad, buffer); - GST_LOG_OBJECT (parse, "frame (%d bytes) pushed: %s", - GST_BUFFER_SIZE (buffer), gst_flow_get_name (ret)); - } else { - GST_LOG_OBJECT (parse, "frame (%d bytes) queued for now", - GST_BUFFER_SIZE (buffer)); - parse->priv->buffers_queued = - g_slist_prepend (parse->priv->buffers_queued, buffer); - ret = GST_FLOW_OK; - } - } else { - gst_buffer_unref (buffer); - GST_LOG_OBJECT (parse, "frame (%d bytes) not pushed: %s", - GST_BUFFER_SIZE (buffer), gst_flow_get_name (ret)); - /* if we are not sufficiently in control, let upstream decide on EOS */ - if (ret == GST_FLOW_UNEXPECTED && - (GST_BASE_PARSE_PASSTHROUGH (parse) || - (parse->priv->pad_mode == GST_ACTIVATE_PUSH && - !parse->priv->upstream_seekable))) - ret = GST_FLOW_OK; - } - - /* Update current running segment position */ - if (ret == GST_FLOW_OK && last_stop != GST_CLOCK_TIME_NONE && - parse->segment.last_stop < last_stop) - gst_segment_set_last_stop (&parse->segment, GST_FORMAT_TIME, last_stop); - - gst_base_parse_frame_clear (parse, frame); - - return ret; -} - - -/** - * gst_base_parse_drain: - * @parse: #GstBaseParse. - * - * Drains the adapter until it is empty. It decreases the min_frame_size to - * match the current adapter size and calls chain method until the adapter - * is emptied or chain returns with error. - */ -static void -gst_base_parse_drain (GstBaseParse * parse) -{ - guint avail; - - GST_DEBUG_OBJECT (parse, "draining"); - parse->priv->drain = TRUE; - - for (;;) { - avail = gst_adapter_available (parse->adapter); - if (!avail) - break; - - if (gst_base_parse_chain (parse->sinkpad, NULL) != GST_FLOW_OK) { - break; - } - - /* nothing changed, maybe due to truncated frame; break infinite loop */ - if (avail == gst_adapter_available (parse->adapter)) { - GST_DEBUG_OBJECT (parse, "no change during draining; flushing"); - gst_adapter_clear (parse->adapter); - } - } - - parse->priv->drain = FALSE; -} - -/** - * gst_base_parse_process_fragment: - * @parse: #GstBaseParse. - * - * Sends buffers collected in send_buffers downstream, and ensures that list - * is empty at the end (errors or not). - */ -static GstFlowReturn -gst_base_parse_send_buffers (GstBaseParse * parse) -{ - GSList *send = NULL; - GstBuffer *buf; - GstFlowReturn ret = GST_FLOW_OK; - - send = parse->priv->buffers_send; - - /* send buffers */ - while (send) { - buf = GST_BUFFER_CAST (send->data); - GST_LOG_OBJECT (parse, "pushing buffer %p, timestamp %" - GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT - ", offset %" G_GINT64_FORMAT, buf, - GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)), - GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), GST_BUFFER_OFFSET (buf)); - - /* iterate output queue an push downstream */ - ret = gst_pad_push (parse->srcpad, buf); - send = g_slist_delete_link (send, send); - - /* clear any leftover if error */ - if (G_UNLIKELY (ret != GST_FLOW_OK)) { - while (send) { - buf = GST_BUFFER_CAST (send->data); - gst_buffer_unref (buf); - send = g_slist_delete_link (send, send); - } - } - } - - parse->priv->buffers_send = send; - - return ret; -} - -/** - * gst_base_parse_process_fragment: - * @parse: #GstBaseParse. - * - * Processes a reverse playback (forward) fragment: - * - append head of last fragment that was skipped to current fragment data - * - drain the resulting current fragment data (i.e. repeated chain) - * - add time/duration (if needed) to frames queued by chain - * - push queued data - */ -static GstFlowReturn -gst_base_parse_process_fragment (GstBaseParse * parse, gboolean push_only) -{ - GstBuffer *buf; - GstFlowReturn ret = GST_FLOW_OK; - gboolean seen_key = FALSE, seen_delta = FALSE; - - if (push_only) - goto push; - - /* restore order */ - parse->priv->buffers_pending = g_slist_reverse (parse->priv->buffers_pending); - while (parse->priv->buffers_pending) { - buf = GST_BUFFER_CAST (parse->priv->buffers_pending->data); - GST_LOG_OBJECT (parse, "adding pending buffer (size %d)", - GST_BUFFER_SIZE (buf)); - gst_adapter_push (parse->adapter, buf); - parse->priv->buffers_pending = - g_slist_delete_link (parse->priv->buffers_pending, - parse->priv->buffers_pending); - } - - /* invalidate so no fall-back timestamping is performed; - * ok if taken from subclass or upstream */ - parse->priv->next_ts = GST_CLOCK_TIME_NONE; - /* prevent it hanging around stop all the time */ - parse->segment.last_stop = GST_CLOCK_TIME_NONE; - /* mark next run */ - parse->priv->discont = TRUE; - - /* chain looks for frames and queues resulting ones (in stead of pushing) */ - /* initial skipped data is added to buffers_pending */ - gst_base_parse_drain (parse); - -push: - if (parse->priv->buffers_send) { - buf = GST_BUFFER_CAST (parse->priv->buffers_send->data); - seen_key |= !GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); - } - - /* add metadata (if needed to queued buffers */ - GST_LOG_OBJECT (parse, "last timestamp: %" GST_TIME_FORMAT, - GST_TIME_ARGS (parse->priv->last_ts)); - while (parse->priv->buffers_queued) { - buf = GST_BUFFER_CAST (parse->priv->buffers_queued->data); - - /* no touching if upstream or parsing provided time */ - if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) { - GST_LOG_OBJECT (parse, "buffer has time %" GST_TIME_FORMAT, - GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf))); - } else if (GST_CLOCK_TIME_IS_VALID (parse->priv->last_ts) && - GST_BUFFER_DURATION_IS_VALID (buf)) { - if (G_LIKELY (GST_BUFFER_DURATION (buf) <= parse->priv->last_ts)) - parse->priv->last_ts -= GST_BUFFER_DURATION (buf); - else - parse->priv->last_ts = 0; - GST_BUFFER_TIMESTAMP (buf) = parse->priv->last_ts; - GST_LOG_OBJECT (parse, "applied time %" GST_TIME_FORMAT, - GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf))); - } else { - /* no idea, very bad */ - GST_WARNING_OBJECT (parse, "could not determine time for buffer"); - } - - parse->priv->last_ts = GST_BUFFER_TIMESTAMP (buf); - - /* reverse order for ascending sending */ - /* send downstream at keyframe not preceded by a keyframe - * (e.g. that should identify start of collection of IDR nals) */ - if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT)) { - if (seen_key) { - ret = gst_base_parse_send_buffers (parse); - /* if a problem, throw all to sending */ - if (ret != GST_FLOW_OK) { - parse->priv->buffers_send = - g_slist_reverse (parse->priv->buffers_queued); - parse->priv->buffers_queued = NULL; - break; - } - seen_key = FALSE; - } - } else { - seen_delta = TRUE; - } - - seen_key |= !GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); - - parse->priv->buffers_send = - g_slist_prepend (parse->priv->buffers_send, buf); - parse->priv->buffers_queued = - g_slist_delete_link (parse->priv->buffers_queued, - parse->priv->buffers_queued); - } - - /* audio may have all marked as keyframe, so arrange to send here */ - if (!seen_delta) - ret = gst_base_parse_send_buffers (parse); - - /* any trailing unused no longer usable (ideally none) */ - if (G_UNLIKELY (gst_adapter_available (parse->adapter))) { - GST_DEBUG_OBJECT (parse, "discarding %d trailing bytes", - gst_adapter_available (parse->adapter)); - gst_adapter_clear (parse->adapter); - } - - return ret; -} - -/* small helper that checks whether we have been trying to resync too long */ -static inline GstFlowReturn -gst_base_parse_check_sync (GstBaseParse * parse) -{ - if (G_UNLIKELY (parse->priv->discont && - parse->priv->offset - parse->priv->sync_offset > 2 * 1024 * 1024)) { - GST_ELEMENT_ERROR (parse, STREAM, DECODE, - ("Failed to parse stream"), (NULL)); - return GST_FLOW_ERROR; - } - - return GST_FLOW_OK; -} - - -/** - * gst_base_parse_chain: - * @pad: #GstPad. - * @buffer: #GstBuffer. - * - * Returns: #GstFlowReturn. - */ -static GstFlowReturn -gst_base_parse_chain (GstPad * pad, GstBuffer * buffer) -{ - GstBaseParseClass *bclass; - GstBaseParse *parse; - GstFlowReturn ret = GST_FLOW_OK; - GstBuffer *outbuf = NULL; - GstBuffer *tmpbuf = NULL; - guint fsize = 1; - gint skip = -1; - const guint8 *data; - guint old_min_size = 0, min_size, av; - GstClockTime timestamp; - GstBaseParseFrame _frame = { 0, }; - GstBaseParseFrame *frame; - - parse = GST_BASE_PARSE (GST_OBJECT_PARENT (pad)); - bclass = GST_BASE_PARSE_GET_CLASS (parse); - frame = &_frame; - - if (G_LIKELY (buffer)) { - GST_LOG_OBJECT (parse, "buffer size: %d, offset = %" G_GINT64_FORMAT, - GST_BUFFER_SIZE (buffer), GST_BUFFER_OFFSET (buffer)); - if (G_UNLIKELY (GST_BASE_PARSE_PASSTHROUGH (parse))) { - frame->buffer = gst_buffer_make_metadata_writable (buffer); - return gst_base_parse_push_frame (parse, frame); - } - /* upstream feeding us in reverse playback; - * gather each fragment, then process it in single run */ - if (parse->segment.rate < 0.0) { - if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT))) { - GST_DEBUG_OBJECT (parse, "buffer starts new reverse playback fragment"); - ret = gst_base_parse_process_fragment (parse, FALSE); - } - gst_adapter_push (parse->adapter, buffer); - return ret; - } - gst_adapter_push (parse->adapter, buffer); - } - - /* Parse and push as many frames as possible */ - /* Stop either when adapter is empty or we are flushing */ - while (!parse->priv->flushing) { - gboolean res; - - tmpbuf = gst_buffer_new (); - - old_min_size = 0; - /* Synchronization loop */ - for (;;) { - min_size = MAX (parse->priv->min_frame_size, fsize); - av = gst_adapter_available (parse->adapter); - - /* loop safety check */ - if (G_UNLIKELY (old_min_size >= min_size)) - goto invalid_min; - old_min_size = min_size; - - if (G_UNLIKELY (parse->priv->drain)) { - min_size = av; - GST_DEBUG_OBJECT (parse, "draining, data left: %d", min_size); - if (G_UNLIKELY (!min_size)) { - gst_buffer_unref (tmpbuf); - goto done; - } - } - - /* Collect at least min_frame_size bytes */ - if (av < min_size) { - GST_DEBUG_OBJECT (parse, "not enough data available (only %d bytes)", - av); - gst_buffer_unref (tmpbuf); - goto done; - } - - /* always pass all available data */ - data = gst_adapter_peek (parse->adapter, av); - GST_BUFFER_DATA (tmpbuf) = (guint8 *) data; - GST_BUFFER_SIZE (tmpbuf) = min_size; - GST_BUFFER_OFFSET (tmpbuf) = parse->priv->offset; - GST_BUFFER_FLAG_SET (tmpbuf, GST_MINI_OBJECT_FLAG_READONLY); - - if (parse->priv->discont) { - GST_DEBUG_OBJECT (parse, "marking DISCONT"); - GST_BUFFER_FLAG_SET (tmpbuf, GST_BUFFER_FLAG_DISCONT); - } - - skip = -1; - gst_base_parse_frame_update (parse, frame, tmpbuf); - res = bclass->check_valid_frame (parse, frame, &fsize, &skip); - gst_buffer_replace (&frame->buffer, NULL); - if (res) { - if (gst_adapter_available (parse->adapter) < fsize) { - GST_DEBUG_OBJECT (parse, - "found valid frame but not enough data available (only %d bytes)", - gst_adapter_available (parse->adapter)); - gst_buffer_unref (tmpbuf); - goto done; - } - GST_LOG_OBJECT (parse, "valid frame of size %d at pos %d", fsize, skip); - break; - } - if (skip == -1) { - /* subclass didn't touch this value. By default we skip 1 byte */ - skip = 1; - } - if (skip > 0) { - GST_LOG_OBJECT (parse, "finding sync, skipping %d bytes", skip); - if (parse->segment.rate < 0.0 && !parse->priv->buffers_queued) { - /* reverse playback, and no frames found yet, so we are skipping - * the leading part of a fragment, which may form the tail of - * fragment coming later, hopefully subclass skips efficiently ... */ - timestamp = gst_adapter_prev_timestamp (parse->adapter, NULL); - outbuf = gst_adapter_take_buffer (parse->adapter, skip); - outbuf = gst_buffer_make_metadata_writable (outbuf); - GST_BUFFER_TIMESTAMP (outbuf) = timestamp; - parse->priv->buffers_pending = - g_slist_prepend (parse->priv->buffers_pending, outbuf); - outbuf = NULL; - } else { - gst_adapter_flush (parse->adapter, skip); - } - parse->priv->offset += skip; - if (!parse->priv->discont) - parse->priv->sync_offset = parse->priv->offset; - parse->priv->discont = TRUE; - /* something changed least; nullify loop check */ - old_min_size = 0; - } - /* skip == 0 should imply subclass set min_size to need more data; - * we check this shortly */ - if ((ret = gst_base_parse_check_sync (parse)) != GST_FLOW_OK) { - gst_buffer_unref (tmpbuf); - goto done; - } - } - gst_buffer_unref (tmpbuf); - tmpbuf = NULL; - - if (skip > 0) { - /* Subclass found the sync, but still wants to skip some data */ - GST_LOG_OBJECT (parse, "skipping %d bytes", skip); - gst_adapter_flush (parse->adapter, skip); - parse->priv->offset += skip; - } - - /* Grab lock to prevent a race with FLUSH_START handler */ - GST_PAD_STREAM_LOCK (parse->srcpad); - - /* FLUSH_START event causes the "flushing" flag to be set. In this - * case we can leave the frame pushing loop */ - if (parse->priv->flushing) { - GST_PAD_STREAM_UNLOCK (parse->srcpad); - break; - } - - /* move along with upstream timestamp (if any), - * but interpolate in between */ - timestamp = gst_adapter_prev_timestamp (parse->adapter, NULL); - if (GST_CLOCK_TIME_IS_VALID (timestamp) && - (parse->priv->prev_ts != timestamp)) { - parse->priv->prev_ts = parse->priv->next_ts = timestamp; - } - - /* FIXME: Would it be more efficient to make a subbuffer instead? */ - outbuf = gst_adapter_take_buffer (parse->adapter, fsize); - outbuf = gst_buffer_make_metadata_writable (outbuf); - - /* Subclass may want to know the data offset */ - GST_BUFFER_OFFSET (outbuf) = parse->priv->offset; - parse->priv->offset += fsize; - GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE; - GST_BUFFER_DURATION (outbuf) = GST_CLOCK_TIME_NONE; - - frame->buffer = outbuf; - ret = gst_base_parse_handle_and_push_frame (parse, bclass, frame); - GST_PAD_STREAM_UNLOCK (parse->srcpad); - - if (ret != GST_FLOW_OK) { - GST_LOG_OBJECT (parse, "push returned %d", ret); - break; - } - } - -done: - GST_LOG_OBJECT (parse, "chain leaving"); - return ret; - - /* ERRORS */ -invalid_min: - { - GST_ELEMENT_ERROR (parse, STREAM, FAILED, (NULL), - ("min_size evolution %d -> %d; breaking to avoid looping", - old_min_size, min_size)); - return GST_FLOW_ERROR; - } -} - -/* pull @size bytes at current offset, - * i.e. at least try to and possibly return a shorter buffer if near the end */ -static GstFlowReturn -gst_base_parse_pull_range (GstBaseParse * parse, guint size, - GstBuffer ** buffer) -{ - GstFlowReturn ret = GST_FLOW_OK; - - g_return_val_if_fail (buffer != NULL, GST_FLOW_ERROR); - - /* Caching here actually makes much less difference than one would expect. - * We do it mainly to avoid pulling buffers of 1 byte all the time */ - if (parse->priv->cache) { - gint64 cache_offset = GST_BUFFER_OFFSET (parse->priv->cache); - gint cache_size = GST_BUFFER_SIZE (parse->priv->cache); - - if (cache_offset <= parse->priv->offset && - (parse->priv->offset + size) <= (cache_offset + cache_size)) { - *buffer = gst_buffer_create_sub (parse->priv->cache, - parse->priv->offset - cache_offset, size); - GST_BUFFER_OFFSET (*buffer) = parse->priv->offset; - return GST_FLOW_OK; - } - /* not enough data in the cache, free cache and get a new one */ - gst_buffer_unref (parse->priv->cache); - parse->priv->cache = NULL; - } - - /* refill the cache */ - ret = - gst_pad_pull_range (parse->sinkpad, parse->priv->offset, MAX (size, - 64 * 1024), &parse->priv->cache); - if (ret != GST_FLOW_OK) { - parse->priv->cache = NULL; - return ret; - } - - if (GST_BUFFER_SIZE (parse->priv->cache) >= size) { - *buffer = gst_buffer_create_sub (parse->priv->cache, 0, size); - GST_BUFFER_OFFSET (*buffer) = parse->priv->offset; - return GST_FLOW_OK; - } - - /* Not possible to get enough data, try a last time with - * requesting exactly the size we need */ - gst_buffer_unref (parse->priv->cache); - parse->priv->cache = NULL; - - ret = gst_pad_pull_range (parse->sinkpad, parse->priv->offset, size, - &parse->priv->cache); - - if (ret != GST_FLOW_OK) { - GST_DEBUG_OBJECT (parse, "pull_range returned %d", ret); - *buffer = NULL; - return ret; - } - - if (GST_BUFFER_SIZE (parse->priv->cache) < size) { - GST_DEBUG_OBJECT (parse, "Returning short buffer at offset %" - G_GUINT64_FORMAT ": wanted %u bytes, got %u bytes", parse->priv->offset, - size, GST_BUFFER_SIZE (parse->priv->cache)); - - *buffer = parse->priv->cache; - parse->priv->cache = NULL; - - return GST_FLOW_OK; - } - - *buffer = gst_buffer_create_sub (parse->priv->cache, 0, size); - GST_BUFFER_OFFSET (*buffer) = parse->priv->offset; - - return GST_FLOW_OK; -} - -static GstFlowReturn -gst_base_parse_handle_previous_fragment (GstBaseParse * parse) -{ - gint64 offset = 0; - GstClockTime ts = 0; - GstBuffer *buffer; - GstFlowReturn ret; - - GST_DEBUG_OBJECT (parse, "fragment ended; last_ts = %" GST_TIME_FORMAT - ", last_offset = %" G_GINT64_FORMAT, GST_TIME_ARGS (parse->priv->last_ts), - parse->priv->last_offset); - - if (!parse->priv->last_offset || parse->priv->last_ts <= parse->segment.start) { - GST_DEBUG_OBJECT (parse, "past start of segment %" GST_TIME_FORMAT, - GST_TIME_ARGS (parse->segment.start)); - ret = GST_FLOW_UNEXPECTED; - goto exit; - } - - /* last fragment started at last_offset / last_ts; - * seek back 10s capped at 1MB */ - if (parse->priv->last_ts >= 10 * GST_SECOND) - ts = parse->priv->last_ts - 10 * GST_SECOND; - /* if we are exact now, we will be more so going backwards */ - if (parse->priv->exact_position) { - offset = gst_base_parse_find_offset (parse, ts, TRUE, NULL); - } else { - GstFormat dstformat = GST_FORMAT_BYTES; - - if (!gst_pad_query_convert (parse->srcpad, GST_FORMAT_TIME, ts, - &dstformat, &offset)) { - GST_DEBUG_OBJECT (parse, "conversion failed, only BYTE based"); - } - } - offset = CLAMP (offset, parse->priv->last_offset - 1024 * 1024, - parse->priv->last_offset - 1024); - offset = MAX (0, offset); - - GST_DEBUG_OBJECT (parse, "next fragment from offset %" G_GINT64_FORMAT, - offset); - parse->priv->offset = offset; - - ret = gst_base_parse_pull_range (parse, parse->priv->last_offset - offset, - &buffer); - if (ret != GST_FLOW_OK) - goto exit; - - /* offset will increase again as fragment is processed/parsed */ - parse->priv->last_offset = offset; - - gst_adapter_push (parse->adapter, buffer); - ret = gst_base_parse_process_fragment (parse, FALSE); - if (ret != GST_FLOW_OK) - goto exit; - - /* force previous fragment */ - parse->priv->offset = -1; - -exit: - return ret; -} - -/* PULL mode: - * pull and scan for next frame starting from current offset - * ajusts sync, drain and offset going along */ -static GstFlowReturn -gst_base_parse_scan_frame (GstBaseParse * parse, GstBaseParseClass * klass, - GstBaseParseFrame * frame, gboolean full) -{ - GstBuffer *buffer, *outbuf; - GstFlowReturn ret = GST_FLOW_OK; - guint fsize = 1, min_size, old_min_size = 0; - gint skip = 0; - - g_return_val_if_fail (frame != NULL, GST_FLOW_ERROR); - - GST_LOG_OBJECT (parse, "scanning for frame at offset %" G_GUINT64_FORMAT - " (%#" G_GINT64_MODIFIER "x)", parse->priv->offset, parse->priv->offset); - - while (TRUE) { - gboolean res; - - min_size = MAX (parse->priv->min_frame_size, fsize); - /* loop safety check */ - if (G_UNLIKELY (old_min_size >= min_size)) - goto invalid_min; - old_min_size = min_size; - - ret = gst_base_parse_pull_range (parse, min_size, &buffer); - if (ret != GST_FLOW_OK) - goto done; - - if (parse->priv->discont) { - GST_DEBUG_OBJECT (parse, "marking DISCONT"); - GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT); - } - - /* if we got a short read, inform subclass we are draining leftover - * and no more is to be expected */ - if (GST_BUFFER_SIZE (buffer) < min_size) - parse->priv->drain = TRUE; - - skip = -1; - gst_base_parse_frame_update (parse, frame, buffer); - res = klass->check_valid_frame (parse, frame, &fsize, &skip); - gst_buffer_replace (&frame->buffer, NULL); - if (res) { - parse->priv->drain = FALSE; - GST_LOG_OBJECT (parse, "valid frame of size %d at pos %d", fsize, skip); - break; - } - parse->priv->drain = FALSE; - if (skip == -1) - skip = 1; - if (skip > 0) { - GST_LOG_OBJECT (parse, "finding sync, skipping %d bytes", skip); - if (full && parse->segment.rate < 0.0 && !parse->priv->buffers_queued) { - /* reverse playback, and no frames found yet, so we are skipping - * the leading part of a fragment, which may form the tail of - * fragment coming later, hopefully subclass skips efficiently ... */ - outbuf = gst_buffer_create_sub (buffer, 0, skip); - parse->priv->buffers_pending = - g_slist_prepend (parse->priv->buffers_pending, outbuf); - outbuf = NULL; - } - parse->priv->offset += skip; - if (!parse->priv->discont) - parse->priv->sync_offset = parse->priv->offset; - parse->priv->discont = TRUE; - /* something changed least; nullify loop check */ - old_min_size = 0; - } - /* skip == 0 should imply subclass set min_size to need more data; - * we check this shortly */ - GST_DEBUG_OBJECT (parse, "finding sync..."); - gst_buffer_unref (buffer); - if ((ret = gst_base_parse_check_sync (parse)) != GST_FLOW_OK) { - goto done; - } - } - - /* Does the subclass want to skip too? */ - if (skip > 0) - parse->priv->offset += skip; - else if (skip < 0) - skip = 0; - - if (fsize + skip <= GST_BUFFER_SIZE (buffer)) { - outbuf = gst_buffer_create_sub (buffer, skip, fsize); - GST_BUFFER_OFFSET (outbuf) = GST_BUFFER_OFFSET (buffer) + skip; - GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE; - gst_buffer_unref (buffer); - } else { - gst_buffer_unref (buffer); - ret = gst_base_parse_pull_range (parse, fsize, &outbuf); - if (ret != GST_FLOW_OK) - goto done; - if (GST_BUFFER_SIZE (outbuf) < fsize) { - gst_buffer_unref (outbuf); - ret = GST_FLOW_UNEXPECTED; - } - } - - parse->priv->offset += fsize; - - frame->buffer = outbuf; - -done: - return ret; - - /* ERRORS */ -invalid_min: - { - GST_ELEMENT_ERROR (parse, STREAM, FAILED, (NULL), - ("min_size evolution %d -> %d; breaking to avoid looping", - old_min_size, min_size)); - return GST_FLOW_ERROR; - } -} - -/** - * gst_base_parse_loop: - * @pad: GstPad - * - * Loop that is used in pull mode to retrieve data from upstream. - */ -static void -gst_base_parse_loop (GstPad * pad) -{ - GstBaseParse *parse; - GstBaseParseClass *klass; - GstFlowReturn ret = GST_FLOW_OK; - GstBaseParseFrame frame = { 0, }; - - parse = GST_BASE_PARSE (gst_pad_get_parent (pad)); - klass = GST_BASE_PARSE_GET_CLASS (parse); - - /* reverse playback: - * first fragment (closest to stop time) is handled normally below, - * then we pull in fragments going backwards */ - if (parse->segment.rate < 0.0) { - /* check if we jumped back to a previous fragment, - * which is a post-first fragment */ - if (parse->priv->offset < 0) { - ret = gst_base_parse_handle_previous_fragment (parse); - goto done; - } - } - - ret = gst_base_parse_scan_frame (parse, klass, &frame, TRUE); - if (ret != GST_FLOW_OK) - goto done; - - /* This always cleans up frame, even if error occurs */ - ret = gst_base_parse_handle_and_push_frame (parse, klass, &frame); - - /* eat expected eos signalling past segment in reverse playback */ - if (parse->segment.rate < 0.0 && ret == GST_FLOW_UNEXPECTED && - parse->segment.last_stop >= parse->segment.stop) { - GST_DEBUG_OBJECT (parse, "downstream has reached end of segment"); - /* push what was accumulated during loop run */ - gst_base_parse_process_fragment (parse, TRUE); - /* force previous fragment */ - parse->priv->offset = -1; - ret = GST_FLOW_OK; - } - -done: - if (ret == GST_FLOW_UNEXPECTED) - goto eos; - else if (ret != GST_FLOW_OK) - goto pause; - - gst_object_unref (parse); - return; - - /* ERRORS */ -eos: - { - ret = GST_FLOW_UNEXPECTED; - GST_DEBUG_OBJECT (parse, "eos"); - /* fall-through */ - } -pause: - { - gboolean push_eos = FALSE; - - GST_DEBUG_OBJECT (parse, "pausing task, reason %s", - gst_flow_get_name (ret)); - gst_pad_pause_task (parse->sinkpad); - - if (ret == GST_FLOW_UNEXPECTED) { - /* handle end-of-stream/segment */ - if (parse->segment.flags & GST_SEEK_FLAG_SEGMENT) { - gint64 stop; - - if ((stop = parse->segment.stop) == -1) - stop = parse->segment.duration; - - GST_DEBUG_OBJECT (parse, "sending segment_done"); - - gst_element_post_message - (GST_ELEMENT_CAST (parse), - gst_message_new_segment_done (GST_OBJECT_CAST (parse), - GST_FORMAT_TIME, stop)); - } else { - /* If we STILL have zero frames processed, fire an error */ - if (parse->priv->framecount == 0) { - GST_ELEMENT_ERROR (parse, STREAM, WRONG_TYPE, - ("No valid frames found before end of stream"), (NULL)); - } - push_eos = TRUE; - } - } else if (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_UNEXPECTED) { - /* for fatal errors we post an error message, wrong-state is - * not fatal because it happens due to flushes and only means - * that we should stop now. */ - GST_ELEMENT_ERROR (parse, STREAM, FAILED, (NULL), - ("streaming stopped, reason %s", gst_flow_get_name (ret))); - push_eos = TRUE; - } - if (push_eos) { - /* newsegment before eos */ - if (parse->pending_segment) { - gst_pad_push_event (parse->srcpad, parse->pending_segment); - parse->pending_segment = NULL; - } - gst_pad_push_event (parse->srcpad, gst_event_new_eos ()); - } - gst_object_unref (parse); - } -} - - -/** - * gst_base_parse_sink_activate: - * @sinkpad: #GstPad to be activated. - * - * Returns: TRUE if activation succeeded. - */ -static gboolean -gst_base_parse_sink_activate (GstPad * sinkpad) -{ - GstBaseParse *parse; - gboolean result = TRUE; - - parse = GST_BASE_PARSE (gst_pad_get_parent (sinkpad)); - - GST_DEBUG_OBJECT (parse, "sink activate"); - - if (gst_pad_check_pull_range (sinkpad)) { - GST_DEBUG_OBJECT (parse, "trying to activate in pull mode"); - result = gst_pad_activate_pull (sinkpad, TRUE); - } else { - GST_DEBUG_OBJECT (parse, "trying to activate in push mode"); - result = gst_pad_activate_push (sinkpad, TRUE); - } - - GST_DEBUG_OBJECT (parse, "sink activate return %d", result); - gst_object_unref (parse); - return result; -} - - -/** - * gst_base_parse_activate: - * @parse: #GstBaseParse. - * @active: TRUE if element will be activated, FALSE if deactivated. - * - * Returns: TRUE if the operation succeeded. - */ -static gboolean -gst_base_parse_activate (GstBaseParse * parse, gboolean active) -{ - GstBaseParseClass *klass; - gboolean result = FALSE; - - GST_DEBUG_OBJECT (parse, "activate %d", active); - - klass = GST_BASE_PARSE_GET_CLASS (parse); - - if (active) { - if (parse->priv->pad_mode == GST_ACTIVATE_NONE && klass->start) - result = klass->start (parse); - } else { - /* We must make sure streaming has finished before resetting things - * and calling the ::stop vfunc */ - GST_PAD_STREAM_LOCK (parse->sinkpad); - GST_PAD_STREAM_UNLOCK (parse->sinkpad); - - if (parse->priv->pad_mode != GST_ACTIVATE_NONE && klass->stop) - result = klass->stop (parse); - - parse->priv->pad_mode = GST_ACTIVATE_NONE; - } - GST_DEBUG_OBJECT (parse, "activate return: %d", result); - return result; -} - - -/** - * gst_base_parse_sink_activate_push: - * @pad: #GstPad to be (de)activated. - * @active: TRUE when activating, FALSE when deactivating. - * - * Returns: TRUE if (de)activation succeeded. - */ -static gboolean -gst_base_parse_sink_activate_push (GstPad * pad, gboolean active) -{ - gboolean result = TRUE; - GstBaseParse *parse; - - parse = GST_BASE_PARSE (gst_pad_get_parent (pad)); - - GST_DEBUG_OBJECT (parse, "sink activate push %d", active); - - result = gst_base_parse_activate (parse, active); - - if (result) - parse->priv->pad_mode = active ? GST_ACTIVATE_PUSH : GST_ACTIVATE_NONE; - - GST_DEBUG_OBJECT (parse, "sink activate push return: %d", result); - - gst_object_unref (parse); - return result; -} - - -/** - * gst_base_parse_sink_activate_pull: - * @sinkpad: #GstPad to be (de)activated. - * @active: TRUE when activating, FALSE when deactivating. - * - * Returns: TRUE if (de)activation succeeded. - */ -static gboolean -gst_base_parse_sink_activate_pull (GstPad * sinkpad, gboolean active) -{ - gboolean result = FALSE; - GstBaseParse *parse; - - parse = GST_BASE_PARSE (gst_pad_get_parent (sinkpad)); - - GST_DEBUG_OBJECT (parse, "activate pull %d", active); - - result = gst_base_parse_activate (parse, active); - - if (result) { - if (active) { - parse->pending_segment = gst_event_new_new_segment (FALSE, - parse->segment.rate, parse->segment.format, - parse->segment.start, parse->segment.stop, parse->segment.last_stop); - result &= gst_pad_start_task (sinkpad, - (GstTaskFunction) gst_base_parse_loop, sinkpad); - } else { - result &= gst_pad_stop_task (sinkpad); - } - } - - if (result) - parse->priv->pad_mode = active ? GST_ACTIVATE_PULL : GST_ACTIVATE_NONE; - - GST_DEBUG_OBJECT (parse, "sink activate pull return: %d", result); - - gst_object_unref (parse); - return result; -} - - -/** - * gst_base_parse_set_duration: - * @parse: #GstBaseParse. - * @fmt: #GstFormat. - * @duration: duration value. - * - * Sets the duration of the currently playing media. Subclass can use this - * when it is able to determine duration and/or notices a change in the media - * duration. Alternatively, if @interval is non-zero (default), then stream - * duration is determined based on estimated bitrate, and updated every @interval - * frames. */ -void -gst_base_parse_set_duration (GstBaseParse * parse, - GstFormat fmt, gint64 duration, gint interval) -{ - g_return_if_fail (parse != NULL); - - if (parse->priv->upstream_has_duration) { - GST_DEBUG_OBJECT (parse, "using upstream duration; discarding update"); - goto exit; - } - - if (duration != parse->priv->duration) { - GstMessage *m; - - m = gst_message_new_duration (GST_OBJECT (parse), fmt, duration); - gst_element_post_message (GST_ELEMENT (parse), m); - - /* TODO: what about duration tag? */ - } - parse->priv->duration = duration; - parse->priv->duration_fmt = fmt; - GST_DEBUG_OBJECT (parse, "set duration: %" G_GINT64_FORMAT, duration); - if (fmt == GST_FORMAT_TIME && GST_CLOCK_TIME_IS_VALID (duration)) { - if (interval != 0) { - GST_DEBUG_OBJECT (parse, "valid duration provided, disabling estimate"); - interval = 0; - } - } - GST_DEBUG_OBJECT (parse, "set update interval: %d", interval); - parse->priv->update_interval = interval; -exit: - return; -} - -/** - * gst_base_parse_set_seek: - * @parse: #GstBaseParse. - * @seek: #GstBaseParseSeekable. - * @abitrate: average bitrate. - * - * Sets whether and how the media is seekable (in time). - * Also optionally provides average bitrate detected in media (if non-zero), - * e.g. based on metadata, as it will be posted to the application. - * - * By default, announced average bitrate is estimated, and seekability is assumed - * possible based on estimated bitrate. - */ -void -gst_base_parse_set_seek (GstBaseParse * parse, - GstBaseParseSeekable seek, guint bitrate) -{ - parse->priv->seekable = seek; - parse->priv->bitrate = bitrate; - GST_DEBUG_OBJECT (parse, "seek %d, bitrate %d", seek, bitrate); -} - - -/** - * gst_base_parse_set_min_frame_size: - * @parse: #GstBaseParse. - * @min_size: Minimum size of the data that this base class should give to - * subclass. - * - * Subclass can use this function to tell the base class that it needs to - * give at least #min_size buffers. - */ -void -gst_base_parse_set_min_frame_size (GstBaseParse * parse, guint min_size) -{ - g_return_if_fail (parse != NULL); - - parse->priv->min_frame_size = min_size; - GST_LOG_OBJECT (parse, "set frame_min_size: %d", min_size); -} - -/** - * gst_base_parse_set_format: - * @parse: the #GstBaseParseFormat to set or unset - * @flags: format flag to enable or disable - * @on: whether or not to enable - * - * Set flags describing characteristics of parsed format. - */ -void -gst_base_parse_set_format (GstBaseParse * parse, GstBaseParseFormat flag, - gboolean on) -{ - g_return_if_fail (parse != NULL); - - GST_LOG_OBJECT (parse, "set flag %d to %d", flag, on); - if (on) - parse->priv->format |= flag; - else - parse->priv->format &= ~flag; -} - -/** - * gst_base_parse_set_frame_props: - * @parse: the #GstBaseParse to set - * @fps_num: frames per second (numerator). - * @fps_den: frames per second (denominator). - * @lead_in: frames needed before a segment for subsequent decode - * @lead_out: frames needed after a segment - * - * If frames per second is configured, parser can take care of buffer duration - * and timestamping. When performing segment clipping, or seeking to a specific - * location, a corresponding decoder might need an initial @lead_in and a - * following @lead_out number of frames to ensure the desired segment is - * entirely filled upon decoding. - */ -void -gst_base_parse_set_frame_props (GstBaseParse * parse, guint fps_num, - guint fps_den, guint lead_in, guint lead_out) -{ - g_return_if_fail (parse != NULL); - - parse->priv->fps_num = fps_num; - parse->priv->fps_den = fps_den; - if (!fps_num || !fps_den) { - GST_DEBUG_OBJECT (parse, "invalid fps (%d/%d), ignoring parameters", - fps_num, fps_den); - fps_num = fps_den = 0; - parse->priv->frame_duration = GST_CLOCK_TIME_NONE; - parse->priv->lead_in = parse->priv->lead_out = 0; - parse->priv->lead_in_ts = parse->priv->lead_out_ts = 0; - } else { - parse->priv->frame_duration = - gst_util_uint64_scale (GST_SECOND, fps_den, fps_num); - parse->priv->lead_in = lead_in; - parse->priv->lead_out = lead_out; - parse->priv->lead_in_ts = - gst_util_uint64_scale (GST_SECOND, fps_den * lead_in, fps_num); - parse->priv->lead_out_ts = - gst_util_uint64_scale (GST_SECOND, fps_den * lead_out, fps_num); - /* aim for about 1.5s to estimate duration */ - if (parse->priv->update_interval < 0) { - parse->priv->update_interval = fps_num * 3 / (fps_den * 2); - GST_LOG_OBJECT (parse, "estimated update interval to %d frames", - parse->priv->update_interval); - } - } - GST_LOG_OBJECT (parse, "set fps: %d/%d => duration: %" G_GINT64_FORMAT " ms", - fps_num, fps_den, parse->priv->frame_duration / GST_MSECOND); - GST_LOG_OBJECT (parse, "set lead in: %d frames = %" G_GUINT64_FORMAT " ms, " - "lead out: %d frames = %" G_GUINT64_FORMAT " ms", - lead_in, parse->priv->lead_in_ts / GST_MSECOND, - lead_out, parse->priv->lead_out_ts / GST_MSECOND); -} - -static gboolean -gst_base_parse_get_duration (GstBaseParse * parse, GstFormat format, - GstClockTime * duration) -{ - gboolean res = FALSE; - - g_return_val_if_fail (duration != NULL, FALSE); - - *duration = GST_CLOCK_TIME_NONE; - if (parse->priv->duration != -1 && format == parse->priv->duration_fmt) { - GST_LOG_OBJECT (parse, "using provided duration"); - *duration = parse->priv->duration; - res = TRUE; - } else if (parse->priv->duration != -1) { - GST_LOG_OBJECT (parse, "converting provided duration"); - res = gst_base_parse_convert (parse, parse->priv->duration_fmt, - parse->priv->duration, format, (gint64 *) duration); - } else if (format == GST_FORMAT_TIME && parse->priv->estimated_duration != -1) { - GST_LOG_OBJECT (parse, "using estimated duration"); - *duration = parse->priv->estimated_duration; - res = TRUE; - } - - GST_LOG_OBJECT (parse, "res: %d, duration %" GST_TIME_FORMAT, res, - GST_TIME_ARGS (*duration)); - return res; -} - -/** - * gst_base_parse_get_querytypes: - * @pad: GstPad - * - * Returns: A table of #GstQueryType items describing supported query types. - */ -static const GstQueryType * -gst_base_parse_get_querytypes (GstPad * pad) -{ - static const GstQueryType list[] = { - GST_QUERY_POSITION, - GST_QUERY_DURATION, - GST_QUERY_FORMATS, - GST_QUERY_SEEKING, - GST_QUERY_CONVERT, - 0 - }; - - return list; -} - - -/** - * gst_base_parse_query: - * @pad: #GstPad. - * @query: #GstQuery. - * - * Returns: TRUE on success. - */ -static gboolean -gst_base_parse_query (GstPad * pad, GstQuery * query) -{ - GstBaseParse *parse; - gboolean res = FALSE; - - parse = GST_BASE_PARSE (GST_PAD_PARENT (pad)); - - GST_LOG_OBJECT (parse, "handling query: %" GST_PTR_FORMAT, query); - - switch (GST_QUERY_TYPE (query)) { - case GST_QUERY_POSITION: - { - gint64 dest_value; - GstFormat format; - - GST_DEBUG_OBJECT (parse, "position query"); - gst_query_parse_position (query, &format, NULL); - - GST_OBJECT_LOCK (parse); - if (format == GST_FORMAT_BYTES) { - dest_value = parse->priv->offset; - res = TRUE; - } else if (format == parse->segment.format && - GST_CLOCK_TIME_IS_VALID (parse->segment.last_stop)) { - dest_value = parse->segment.last_stop; - res = TRUE; - } - GST_OBJECT_UNLOCK (parse); - - if (res) - gst_query_set_position (query, format, dest_value); - else { - res = gst_pad_query_default (pad, query); - if (!res) { - /* no precise result, upstream no idea either, then best estimate */ - /* priv->offset is updated in both PUSH/PULL modes */ - res = gst_base_parse_convert (parse, - GST_FORMAT_BYTES, parse->priv->offset, format, &dest_value); - } - } - break; - } - case GST_QUERY_DURATION: - { - GstFormat format; - GstClockTime duration; - - GST_DEBUG_OBJECT (parse, "duration query"); - gst_query_parse_duration (query, &format, NULL); - - /* consult upstream */ - res = gst_pad_query_default (pad, query); - - /* otherwise best estimate from us */ - if (!res) { - res = gst_base_parse_get_duration (parse, format, &duration); - if (res) - gst_query_set_duration (query, format, duration); - } - break; - } - case GST_QUERY_SEEKING: - { - GstFormat fmt; - GstClockTime duration = GST_CLOCK_TIME_NONE; - gboolean seekable = FALSE; - - GST_DEBUG_OBJECT (parse, "seeking query"); - gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL); - - /* consult upstream */ - res = gst_pad_query_default (pad, query); - - /* we may be able to help if in TIME */ - if (fmt == GST_FORMAT_TIME && - parse->priv->seekable > GST_BASE_PARSE_SEEK_NONE) { - gst_query_parse_seeking (query, &fmt, &seekable, NULL, NULL); - /* already OK if upstream takes care */ - GST_LOG_OBJECT (parse, "upstream handled %d, seekable %d", - res, seekable); - if (!(res && seekable)) { - if (!gst_base_parse_get_duration (parse, GST_FORMAT_TIME, &duration) - || duration == -1) { - /* seekable if we still have a chance to get duration later on */ - seekable = - parse->priv->upstream_seekable && parse->priv->update_interval; - } else { - seekable = parse->priv->upstream_seekable; - GST_LOG_OBJECT (parse, "already determine upstream seekabled: %d", - seekable); - } - gst_query_set_seeking (query, GST_FORMAT_TIME, seekable, 0, duration); - res = TRUE; - } - } - break; - } - case GST_QUERY_FORMATS: - gst_query_set_formatsv (query, 3, fmtlist); - res = TRUE; - break; - case GST_QUERY_CONVERT: - { - GstFormat src_format, dest_format; - gint64 src_value, dest_value; - - gst_query_parse_convert (query, &src_format, &src_value, - &dest_format, &dest_value); - - res = gst_base_parse_convert (parse, src_format, src_value, - dest_format, &dest_value); - if (res) { - gst_query_set_convert (query, src_format, src_value, - dest_format, dest_value); - } - break; - } - default: - res = gst_pad_query_default (pad, query); - break; - } - return res; -} - -/* scans for a cluster start from @pos, - * return GST_FLOW_OK and frame position/time in @pos/@time if found */ -static GstFlowReturn -gst_base_parse_find_frame (GstBaseParse * parse, gint64 * pos, - GstClockTime * time, GstClockTime * duration) -{ - GstBaseParseClass *klass; - gint64 orig_offset; - gboolean orig_drain, orig_discont; - GstFlowReturn ret = GST_FLOW_OK; - GstBuffer *buf = NULL; - GstBaseParseFrame frame = { 0, }; - - g_return_val_if_fail (GST_FLOW_ERROR, pos != NULL); - g_return_val_if_fail (GST_FLOW_ERROR, time != NULL); - g_return_val_if_fail (GST_FLOW_ERROR, duration != NULL); - - klass = GST_BASE_PARSE_GET_CLASS (parse); - - *time = GST_CLOCK_TIME_NONE; - *duration = GST_CLOCK_TIME_NONE; - - /* save state */ - orig_offset = parse->priv->offset; - orig_discont = parse->priv->discont; - orig_drain = parse->priv->drain; - - GST_DEBUG_OBJECT (parse, "scanning for frame starting at %" G_GINT64_FORMAT - " (%#" G_GINT64_MODIFIER "x)", *pos, *pos); - - /* jump elsewhere and locate next frame */ - parse->priv->offset = *pos; - ret = gst_base_parse_scan_frame (parse, klass, &frame, FALSE); - if (ret != GST_FLOW_OK) - goto done; - - buf = frame.buffer; - GST_LOG_OBJECT (parse, - "peek parsing frame at offset %" G_GUINT64_FORMAT - " (%#" G_GINT64_MODIFIER "x) of size %d", - GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf), GST_BUFFER_SIZE (buf)); - - /* get offset first, subclass parsing might dump other stuff in there */ - *pos = GST_BUFFER_OFFSET (buf); - ret = klass->parse_frame (parse, &frame); - buf = frame.buffer; - - /* but it should provide proper time */ - *time = GST_BUFFER_TIMESTAMP (buf); - *duration = GST_BUFFER_DURATION (buf); - gst_base_parse_frame_clear (parse, &frame); - - GST_LOG_OBJECT (parse, - "frame with time %" GST_TIME_FORMAT " at offset %" G_GINT64_FORMAT, - GST_TIME_ARGS (*time), *pos); - -done: - /* restore state */ - parse->priv->offset = orig_offset; - parse->priv->discont = orig_discont; - parse->priv->drain = orig_drain; - - return ret; -} - -/* bisect and scan through file for frame starting before @time, - * returns OK and @time/@offset if found, NONE and/or error otherwise - * If @time == G_MAXINT64, scan for duration ( == last frame) */ -static GstFlowReturn -gst_base_parse_locate_time (GstBaseParse * parse, GstClockTime * _time, - gint64 * _offset) -{ - GstFlowReturn ret = GST_FLOW_OK; - gint64 lpos, hpos, newpos; - GstClockTime time, ltime, htime, newtime, dur; - gboolean cont = TRUE; - const GstClockTime tolerance = TARGET_DIFFERENCE; - const guint chunk = 4 * 1024; - - g_return_val_if_fail (_time != NULL, GST_FLOW_ERROR); - g_return_val_if_fail (_offset != NULL, GST_FLOW_ERROR); - - /* TODO also make keyframe aware if useful some day */ - - time = *_time; - - /* basic cases */ - if (time == 0) { - *_offset = 0; - return GST_FLOW_OK; - } - - if (time == -1) { - *_offset = -1; - return GST_FLOW_OK; - } - - /* do not know at first */ - *_offset = -1; - *_time = GST_CLOCK_TIME_NONE; - - /* need initial positions; start and end */ - lpos = parse->priv->first_frame_offset; - ltime = parse->priv->first_frame_ts; - htime = parse->priv->duration; - hpos = parse->priv->upstream_size; - - /* check preconditions are satisfied; - * start and end are needed, except for special case where we scan for - * last frame to determine duration */ - if (parse->priv->pad_mode != GST_ACTIVATE_PULL || !hpos || - !GST_CLOCK_TIME_IS_VALID (ltime) || - (!GST_CLOCK_TIME_IS_VALID (htime) && time != G_MAXINT64)) { - return GST_FLOW_OK; - } - - /* shortcut cases */ - if (time < ltime) { - goto exit; - } else if (time < ltime + tolerance) { - *_offset = lpos; - *_time = ltime; - goto exit; - } else if (time >= htime) { - *_offset = hpos; - *_time = htime; - goto exit; - } - - while (htime > ltime && cont) { - GST_LOG_OBJECT (parse, - "lpos: %" G_GUINT64_FORMAT ", ltime: %" GST_TIME_FORMAT, lpos, - GST_TIME_ARGS (ltime)); - GST_LOG_OBJECT (parse, - "hpos: %" G_GUINT64_FORMAT ", htime: %" GST_TIME_FORMAT, hpos, - GST_TIME_ARGS (htime)); - if (G_UNLIKELY (time == G_MAXINT64)) { - newpos = hpos; - } else if (G_LIKELY (hpos > lpos)) { - newpos = - gst_util_uint64_scale (hpos - lpos, time - ltime, htime - ltime) + - lpos - chunk; - } else { - /* should mean lpos == hpos, since lpos <= hpos is invariant */ - newpos = lpos; - /* we check this case once, but not forever, so break loop */ - cont = FALSE; - } - - /* ensure */ - newpos = CLAMP (newpos, lpos, hpos); - GST_LOG_OBJECT (parse, - "estimated _offset for %" GST_TIME_FORMAT ": %" G_GINT64_FORMAT, - GST_TIME_ARGS (time), newpos); - - ret = gst_base_parse_find_frame (parse, &newpos, &newtime, &dur); - if (ret == GST_FLOW_UNEXPECTED) { - /* heuristic HACK */ - hpos = MAX (lpos, hpos - chunk); - continue; - } else if (ret != GST_FLOW_OK) { - goto exit; - } - - if (newtime == -1 || newpos == -1) { - GST_DEBUG_OBJECT (parse, "subclass did not provide metadata; aborting"); - break; - } - - if (G_UNLIKELY (time == G_MAXINT64)) { - *_offset = newpos; - *_time = newtime; - if (GST_CLOCK_TIME_IS_VALID (dur)) - *_time += dur; - break; - } else if (newtime > time) { - /* overshoot */ - hpos = (newpos >= hpos) ? MAX (lpos, hpos - chunk) : MAX (lpos, newpos); - htime = newtime; - } else if (newtime + tolerance > time) { - /* close enough undershoot */ - *_offset = newpos; - *_time = newtime; - break; - } else if (newtime < ltime) { - /* so a position beyond lpos resulted in earlier time than ltime ... */ - GST_DEBUG_OBJECT (parse, "non-ascending time; aborting"); - break; - } else { - /* undershoot too far */ - newpos += newpos == lpos ? chunk : 0; - lpos = CLAMP (newpos, lpos, hpos); - ltime = newtime; - } - } - -exit: - GST_LOG_OBJECT (parse, "return offset %" G_GINT64_FORMAT ", time %" - GST_TIME_FORMAT, *_offset, GST_TIME_ARGS (*_time)); - return ret; -} - -static gint64 -gst_base_parse_find_offset (GstBaseParse * parse, GstClockTime time, - gboolean before, GstClockTime * _ts) -{ - gint64 bytes = 0, ts = 0; - GstIndexEntry *entry = NULL; - - if (time == GST_CLOCK_TIME_NONE) { - ts = time; - bytes = -1; - goto exit; - } - - GST_OBJECT_LOCK (parse); - if (parse->priv->index) { - /* Let's check if we have an index entry for that time */ - entry = gst_index_get_assoc_entry (parse->priv->index, - parse->priv->index_id, - before ? GST_INDEX_LOOKUP_BEFORE : GST_INDEX_LOOKUP_AFTER, - GST_ASSOCIATION_FLAG_KEY_UNIT, GST_FORMAT_TIME, time); - } - - if (entry) { - gst_index_entry_assoc_map (entry, GST_FORMAT_BYTES, &bytes); - gst_index_entry_assoc_map (entry, GST_FORMAT_TIME, &ts); - - GST_DEBUG_OBJECT (parse, "found index entry for %" GST_TIME_FORMAT - " at %" GST_TIME_FORMAT ", offset %" G_GINT64_FORMAT, - GST_TIME_ARGS (time), GST_TIME_ARGS (ts), bytes); - } else { - GST_DEBUG_OBJECT (parse, "no index entry found for %" GST_TIME_FORMAT, - GST_TIME_ARGS (time)); - if (!before) { - bytes = -1; - ts = GST_CLOCK_TIME_NONE; - } - } - GST_OBJECT_UNLOCK (parse); - -exit: - if (_ts) - *_ts = ts; - - return bytes; -} - - -/** - * gst_base_parse_handle_seek: - * @parse: #GstBaseParse. - * @event: #GstEvent. - * - * Returns: TRUE if seek succeeded. - */ -static gboolean -gst_base_parse_handle_seek (GstBaseParse * parse, GstEvent * event) -{ - gdouble rate; - GstFormat format; - GstSeekFlags flags; - GstSeekType cur_type = GST_SEEK_TYPE_NONE, stop_type; - gboolean flush, update, res = TRUE, accurate; - gint64 cur, stop, seekpos, seekstop; - GstSegment seeksegment = { 0, }; - GstFormat dstformat; - GstClockTime start_ts; - - gst_event_parse_seek (event, &rate, &format, &flags, - &cur_type, &cur, &stop_type, &stop); - - GST_DEBUG_OBJECT (parse, "seek to format %s, rate %f, " - "start type %d at %" GST_TIME_FORMAT ", end type %d at %" - GST_TIME_FORMAT, gst_format_get_name (format), rate, - cur_type, GST_TIME_ARGS (cur), stop_type, GST_TIME_ARGS (stop)); - - /* no negative rates in push mode */ - if (rate < 0.0 && parse->priv->pad_mode == GST_ACTIVATE_PUSH) - goto negative_rate; - - if (cur_type != GST_SEEK_TYPE_SET || - (stop_type != GST_SEEK_TYPE_SET && stop_type != GST_SEEK_TYPE_NONE)) - goto wrong_type; - - /* For any format other than TIME, see if upstream handles - * it directly or fail. For TIME, try upstream, but do it ourselves if - * it fails upstream */ - if (format != GST_FORMAT_TIME) { - /* default action delegates to upstream */ - res = FALSE; - goto done; - } else { - gst_event_ref (event); - if ((res = gst_pad_push_event (parse->sinkpad, event))) { - goto done; - } - } - - /* get flush flag */ - flush = flags & GST_SEEK_FLAG_FLUSH; - - /* copy segment, we need this because we still need the old - * segment when we close the current segment. */ - memcpy (&seeksegment, &parse->segment, sizeof (GstSegment)); - - GST_DEBUG_OBJECT (parse, "configuring seek"); - gst_segment_set_seek (&seeksegment, rate, format, flags, - cur_type, cur, stop_type, stop, &update); - - /* accurate seeking implies seek tables are used to obtain position, - * and the requested segment is maintained exactly, not adjusted any way */ - accurate = flags & GST_SEEK_FLAG_ACCURATE; - - /* maybe we can be accurate for (almost) free */ - gst_base_parse_find_offset (parse, seeksegment.last_stop, TRUE, &start_ts); - if (seeksegment.last_stop <= start_ts + TARGET_DIFFERENCE) { - GST_DEBUG_OBJECT (parse, "accurate seek possible"); - accurate = TRUE; - } - if (accurate) { - GstClockTime startpos = seeksegment.last_stop; - - /* accurate requested, so ... seek a bit before target */ - if (startpos < parse->priv->lead_in_ts) - startpos = 0; - else - startpos -= parse->priv->lead_in_ts; - seekpos = gst_base_parse_find_offset (parse, startpos, TRUE, &start_ts); - seekstop = gst_base_parse_find_offset (parse, seeksegment.stop, FALSE, - NULL); - } else { - start_ts = seeksegment.last_stop; - dstformat = GST_FORMAT_BYTES; - if (!gst_pad_query_convert (parse->srcpad, format, seeksegment.last_stop, - &dstformat, &seekpos)) - goto convert_failed; - if (!gst_pad_query_convert (parse->srcpad, format, seeksegment.stop, - &dstformat, &seekstop)) - goto convert_failed; - } - - GST_DEBUG_OBJECT (parse, - "seek position %" G_GINT64_FORMAT " in bytes: %" G_GINT64_FORMAT, - start_ts, seekpos); - GST_DEBUG_OBJECT (parse, - "seek stop %" G_GINT64_FORMAT " in bytes: %" G_GINT64_FORMAT, - seeksegment.stop, seekstop); - - if (parse->priv->pad_mode == GST_ACTIVATE_PULL) { - gint64 last_stop; - - GST_DEBUG_OBJECT (parse, "seek in PULL mode"); - - if (flush) { - if (parse->srcpad) { - GST_DEBUG_OBJECT (parse, "sending flush start"); - gst_pad_push_event (parse->srcpad, gst_event_new_flush_start ()); - /* unlock upstream pull_range */ - gst_pad_push_event (parse->sinkpad, gst_event_new_flush_start ()); - } - } else { - gst_pad_pause_task (parse->sinkpad); - } - - /* we should now be able to grab the streaming thread because we stopped it - * with the above flush/pause code */ - GST_PAD_STREAM_LOCK (parse->sinkpad); - - /* save current position */ - last_stop = parse->segment.last_stop; - GST_DEBUG_OBJECT (parse, "stopped streaming at %" G_GINT64_FORMAT, - last_stop); - - /* now commit to new position */ - - /* prepare for streaming again */ - if (flush) { - GST_DEBUG_OBJECT (parse, "sending flush stop"); - gst_pad_push_event (parse->srcpad, gst_event_new_flush_stop ()); - gst_pad_push_event (parse->sinkpad, gst_event_new_flush_stop ()); - gst_base_parse_clear_queues (parse); - } else { - if (parse->close_segment) - gst_event_unref (parse->close_segment); - - parse->close_segment = gst_event_new_new_segment (TRUE, - parse->segment.rate, parse->segment.format, - parse->segment.accum, parse->segment.last_stop, parse->segment.accum); - - /* keep track of our last_stop */ - seeksegment.accum = parse->segment.last_stop; - - GST_DEBUG_OBJECT (parse, "Created close seg format %d, " - "start = %" GST_TIME_FORMAT ", stop = %" GST_TIME_FORMAT - ", pos = %" GST_TIME_FORMAT, format, - GST_TIME_ARGS (parse->segment.accum), - GST_TIME_ARGS (parse->segment.last_stop), - GST_TIME_ARGS (parse->segment.accum)); - } - - memcpy (&parse->segment, &seeksegment, sizeof (GstSegment)); - - /* store the newsegment event so it can be sent from the streaming thread. */ - if (parse->pending_segment) - gst_event_unref (parse->pending_segment); - - /* This will be sent later in _loop() */ - parse->pending_segment = - gst_event_new_new_segment (FALSE, parse->segment.rate, - parse->segment.format, parse->segment.start, parse->segment.stop, - parse->segment.start); - - GST_DEBUG_OBJECT (parse, "Created newseg format %d, " - "start = %" GST_TIME_FORMAT ", stop = %" GST_TIME_FORMAT - ", pos = %" GST_TIME_FORMAT, format, - GST_TIME_ARGS (parse->segment.start), - GST_TIME_ARGS (parse->segment.stop), - GST_TIME_ARGS (parse->segment.start)); - - /* one last chance in pull mode to stay accurate; - * maybe scan and subclass can find where to go */ - if (!accurate) { - gint64 scanpos; - GstClockTime ts = seeksegment.last_stop; - - gst_base_parse_locate_time (parse, &ts, &scanpos); - if (scanpos >= 0) { - accurate = TRUE; - seekpos = scanpos; - /* running collected index now consists of several intervals, - * so optimized check no longer possible */ - parse->priv->index_last_valid = FALSE; - parse->priv->index_last_offset = 0; - parse->priv->index_last_ts = 0; - } - } - - /* mark discont if we are going to stream from another position. */ - if (seekpos != parse->priv->offset) { - GST_DEBUG_OBJECT (parse, - "mark DISCONT, we did a seek to another position"); - parse->priv->offset = seekpos; - parse->priv->last_offset = seekpos; - parse->priv->seen_keyframe = FALSE; - parse->priv->discont = TRUE; - parse->priv->next_ts = start_ts; - parse->priv->last_ts = GST_CLOCK_TIME_NONE; - parse->priv->sync_offset = seekpos; - parse->priv->exact_position = accurate; - } - - /* Start streaming thread if paused */ - gst_pad_start_task (parse->sinkpad, - (GstTaskFunction) gst_base_parse_loop, parse->sinkpad); - - GST_PAD_STREAM_UNLOCK (parse->sinkpad); - - /* handled seek */ - res = TRUE; - } else { - GstEvent *new_event; - GstBaseParseSeek *seek; - - /* The only thing we need to do in PUSH-mode is to send the - seek event (in bytes) to upstream. Segment / flush handling happens - in corresponding src event handlers */ - GST_DEBUG_OBJECT (parse, "seek in PUSH mode"); - if (seekstop >= 0 && seekpos <= seekpos) - seekstop = seekpos; - new_event = gst_event_new_seek (rate, GST_FORMAT_BYTES, flush, - GST_SEEK_TYPE_SET, seekpos, stop_type, seekstop); - - /* store segment info so its precise details can be reconstructed when - * receiving newsegment; - * this matters for all details when accurate seeking, - * is most useful to preserve NONE stop time otherwise */ - seek = g_new0 (GstBaseParseSeek, 1); - seek->segment = seeksegment; - seek->accurate = accurate; - seek->offset = seekpos; - seek->start_ts = start_ts; - GST_OBJECT_LOCK (parse); - /* less optimal, but preserves order */ - parse->priv->pending_seeks = - g_slist_append (parse->priv->pending_seeks, seek); - GST_OBJECT_UNLOCK (parse); - - res = gst_pad_push_event (parse->sinkpad, new_event); - - if (!res) { - GST_OBJECT_LOCK (parse); - parse->priv->pending_seeks = - g_slist_remove (parse->priv->pending_seeks, seek); - GST_OBJECT_UNLOCK (parse); - g_free (seek); - } - } - -done: - /* handled event is ours to free */ - if (res) - gst_event_unref (event); - return res; - - /* ERRORS */ -negative_rate: - { - GST_DEBUG_OBJECT (parse, "negative playback rates delegated upstream."); - res = FALSE; - goto done; - } -wrong_type: - { - GST_DEBUG_OBJECT (parse, "unsupported seek type."); - res = FALSE; - goto done; - } -convert_failed: - { - GST_DEBUG_OBJECT (parse, "conversion TIME to BYTES failed."); - res = FALSE; - goto done; - } -} - -/** - * gst_base_parse_handle_tag: - * @parse: #GstBaseParse. - * @event: #GstEvent. - * - * Checks if bitrates are available from upstream tags so that we don't - * override them later - */ -static void -gst_base_parse_handle_tag (GstBaseParse * parse, GstEvent * event) -{ - GstTagList *taglist = NULL; - guint tmp; - - gst_event_parse_tag (event, &taglist); - - if (gst_tag_list_get_uint (taglist, GST_TAG_MINIMUM_BITRATE, &tmp)) { - GST_DEBUG_OBJECT (parse, "upstream min bitrate %d", tmp); - parse->priv->post_min_bitrate = FALSE; - } - if (gst_tag_list_get_uint (taglist, GST_TAG_BITRATE, &tmp)) { - GST_DEBUG_OBJECT (parse, "upstream avg bitrate %d", tmp); - parse->priv->post_avg_bitrate = FALSE; - } - if (gst_tag_list_get_uint (taglist, GST_TAG_MAXIMUM_BITRATE, &tmp)) { - GST_DEBUG_OBJECT (parse, "upstream max bitrate %d", tmp); - parse->priv->post_max_bitrate = FALSE; - } -} - -/** - * gst_base_parse_sink_setcaps: - * @pad: #GstPad. - * @caps: #GstCaps. - * - * Returns: TRUE if caps were accepted. - */ -static gboolean -gst_base_parse_sink_setcaps (GstPad * pad, GstCaps * caps) -{ - GstBaseParse *parse; - GstBaseParseClass *klass; - gboolean res = TRUE; - - parse = GST_BASE_PARSE (GST_PAD_PARENT (pad)); - klass = GST_BASE_PARSE_GET_CLASS (parse); - - GST_DEBUG_OBJECT (parse, "caps: %" GST_PTR_FORMAT, caps); - - if (klass->set_sink_caps) - res = klass->set_sink_caps (parse, caps); - - return res; -} - -static void -gst_base_parse_set_index (GstElement * element, GstIndex * index) -{ - GstBaseParse *parse = GST_BASE_PARSE (element); - - GST_OBJECT_LOCK (parse); - if (parse->priv->index) - gst_object_unref (parse->priv->index); - if (index) { - parse->priv->index = gst_object_ref (index); - gst_index_get_writer_id (index, GST_OBJECT (element), - &parse->priv->index_id); - parse->priv->own_index = FALSE; - } else - parse->priv->index = NULL; - GST_OBJECT_UNLOCK (parse); -} - -static GstIndex * -gst_base_parse_get_index (GstElement * element) -{ - GstBaseParse *parse = GST_BASE_PARSE (element); - GstIndex *result = NULL; - - GST_OBJECT_LOCK (parse); - if (parse->priv->index) - result = gst_object_ref (parse->priv->index); - GST_OBJECT_UNLOCK (parse); - - return result; -} - -static GstStateChangeReturn -gst_base_parse_change_state (GstElement * element, GstStateChange transition) -{ - GstBaseParse *parse; - GstStateChangeReturn result; - - parse = GST_BASE_PARSE (element); - - switch (transition) { - case GST_STATE_CHANGE_READY_TO_PAUSED: - /* If this is our own index destroy it as the - * old entries might be wrong for the new stream */ - if (parse->priv->own_index) { - gst_object_unref (parse->priv->index); - parse->priv->index = NULL; - parse->priv->own_index = FALSE; - } - - /* If no index was created, generate one */ - if (G_UNLIKELY (!parse->priv->index)) { - GST_DEBUG_OBJECT (parse, "no index provided creating our own"); - - parse->priv->index = gst_index_factory_make ("memindex"); - gst_index_get_writer_id (parse->priv->index, GST_OBJECT (parse), - &parse->priv->index_id); - parse->priv->own_index = TRUE; - } - break; - default: - break; - } - - result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - - switch (transition) { - case GST_STATE_CHANGE_PAUSED_TO_READY: - gst_base_parse_reset (parse); - break; - default: - break; - } - - return result; -} diff --git a/gst-libs/gst/baseparse/gstbaseparse.h b/gst-libs/gst/baseparse/gstbaseparse.h deleted file mode 100644 index d0f43ee7c4..0000000000 --- a/gst-libs/gst/baseparse/gstbaseparse.h +++ /dev/null @@ -1,344 +0,0 @@ -/* GStreamer - * Copyright (C) 2008 Nokia Corporation. All rights reserved. - * - * Contact: Stefan Kost - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GST_BASE_PARSE_H__ -#define __GST_BASE_PARSE_H__ - -#include -#include - -G_BEGIN_DECLS - -#define GST_TYPE_BASE_PARSE (gst_base_parse_get_type()) -#define GST_BASE_PARSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_PARSE,GstBaseParse)) -#define GST_BASE_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_PARSE,GstBaseParseClass)) -#define GST_BASE_PARSE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_PARSE,GstBaseParseClass)) -#define GST_IS_BASE_PARSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_PARSE)) -#define GST_IS_BASE_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_PARSE)) -#define GST_BASE_PARSE_CAST(obj) ((GstBaseParse *)(obj)) - -/** - * GST_BASE_PARSE_SINK_NAME: - * - * the name of the templates for the sink pad - */ -#define GST_BASE_PARSE_SINK_NAME "sink" -/** - * GST_BASE_PARSE_SRC_NAME: - * - * the name of the templates for the source pad - */ -#define GST_BASE_PARSE_SRC_NAME "src" - -/** - * GST_BASE_PARSE_SRC_PAD: - * @obj: base parse instance - * - * Gives the pointer to the source #GstPad object of the element. - * - * Since: 0.10.x - */ -#define GST_BASE_PARSE_SRC_PAD(obj) (GST_BASE_PARSE_CAST (obj)->srcpad) - -/** - * GST_BASE_PARSE_SINK_PAD: - * @obj: base parse instance - * - * Gives the pointer to the sink #GstPad object of the element. - * - * Since: 0.10.x - */ -#define GST_BASE_PARSE_SINK_PAD(obj) (GST_BASE_PARSE_CAST (obj)->sinkpad) - -/** - * GST_BASE_PARSE_SEGMENT: - * @obj: base parse instance - * - * Gives the segment of the element. - * - * Since: 0.10.x - */ -#define GST_BASE_PARSE_SEGMENT(obj) (GST_BASE_PARSE_CAST (obj)->segment) - -/** - * GST_BASE_PARSE_FLOW_DROPPED: - * - * A #GstFlowReturn that can be returned from parse_frame to - * indicate that no output buffer was generated, or from pre_push_buffer to - * to forego pushing buffer. - * - * Since: 0.10.x - */ -#define GST_BASE_PARSE_FLOW_DROPPED GST_FLOW_CUSTOM_SUCCESS - -/** - * GstBaseParseFrameFlags: - * @GST_BASE_PARSE_FRAME_FLAG_NONE: no flag - * @GST_BASE_PARSE_FRAME_FLAG_SYNC: indicates if parsing is 'in sync' - * @GST_BASE_PARSE_FRAME_FLAG_DRAIN: indicates if parser is 'draining'. - * That is, leftover data (e.g. in FLUSH or EOS situation) is being parsed. - * @GST_BASE_PARSE_FRAME_FLAG_NO_FRAME: set to indicate this buffer should not be - * counted as frame, e.g. if this frame is dependent on a previous one. - * As it is not counted as a frame, bitrate increases but frame to time - * conversions are maintained. - * @GST_BASE_PARSE_FRAME_FLAG_CLIP: @pre_push_buffer can set this to indicate - * that regular segment clipping can still be performed (as opposed to - * any custom one having been done). - * - * Flags to be used in a #GstBaseParseFrame. - * - * Since: 0.10.x - */ -typedef enum { - GST_BASE_PARSE_FRAME_FLAG_NONE = 0, - GST_BASE_PARSE_FRAME_FLAG_SYNC = (1 << 0), - GST_BASE_PARSE_FRAME_FLAG_DRAIN = (1 << 1), - GST_BASE_PARSE_FRAME_FLAG_NO_FRAME = (1 << 2), - GST_BASE_PARSE_FRAME_FLAG_CLIP = (1 << 3) -} GstBaseParseFrameFlags; - -/** - * GstBaseParseFrame: - * @buffer: data to check for valid frame or parsed frame. - * Subclass is allowed to replace this buffer. - * @overhead: subclass can set this to indicates the metadata overhead - * for the given frame, which is then used to enable more accurate bitrate - * computations. If this is -1, it is assumed that this frame should be - * skipped in bitrate calculation. - * @flags: a combination of input and output #GstBaseParseFrameFlags that - * convey additional context to subclass or allow subclass to tune - * subsequent #GstBaseParse actions. - * - * Frame (context) data passed to each frame parsing virtual methods. In - * addition to providing the data to be checked for a valid frame or an already - * identified frame, it conveys additional metadata or control information - * from and to the subclass w.r.t. the particular frame in question (rather - * than global parameters). Some of these may apply to each parsing stage, others - * only to some a particular one. These parameters are effectively zeroed at start - * of each frame's processing, i.e. parsing virtual method invocation sequence. - * - * Since: 0.10.x - */ -typedef struct { - GstBuffer *buffer; - guint flags; - gint overhead; -} GstBaseParseFrame; - -/** - * GST_BASE_PARSE_FRAME_SYNC: - * @frame: base parse frame instance - * - * Obtains current sync status indicated in frame. - * - * Since: 0.10.x - */ -#define GST_BASE_PARSE_FRAME_SYNC(frame) (!!(frame->flags & GST_BASE_PARSE_FRAME_FLAG_SYNC)) - -/** - * GST_BASE_PARSE_FRAME_DRAIN: - * @frame: base parse frame instance - * - * Obtains current drain status indicated in frame. - * - * Since: 0.10.x - */ -#define GST_BASE_PARSE_FRAME_DRAIN(frame) (!!(frame->flags & GST_BASE_PARSE_FRAME_FLAG_DRAIN)) - -/** - * GstBaseParseFormat: - * @GST_BASE_PARSE_FORMAT_NONE: default setting - * @GST_BASE_PARSE_FORMAT_PASSTHROUGH: nature of format or configuration - * does not allow (much) parsing, so parser should operate in passthrough mode - * (which only applies operating in pull mode). That is, incoming buffers - * are pushed through unmodified, i.e. no @check_valid_frame or @parse_frame - * callbacks will be invoked. On the other hand, @pre_push_buffer is still invoked, - * where subclass can perform as much or as little is appropriate for - * "passthrough" semantics. - * @GST_BASE_PARSE_FORMAT_HAS_TIME: frames carry timing info which subclass - * can (generally) parse and provide. In particular, intrinsic time - * (rather than estimated) can be obtained following seek. - * - * Since: 0.10.x - */ -typedef enum _GstBaseParseFormat { - GST_BASE_PARSE_FORMAT_NONE = 0, - GST_BASE_PARSE_FORMAT_PASSTHROUGH = (1 << 0), - GST_BASE_PARSE_FORMAT_HAS_TIME = (1 << 1), -} GstBaseParseFormat; - -/** - * GstBaseParseSeekable: - * @GST_BASE_PARSE_SEEK_NONE: No seeking possible. - * @GST_BASE_PARSE_SEEK_DEFAULT: Default seeking possible using estimated bitrate. - * @GST_BASE_PARSE_SEEK_TABLE: Additional metadata provides more accurate seeking. - * - * Indicates what level (of quality) of seeking is possible. - * - * Since: 0.10.x - */ -typedef enum _GstBaseParseSeekable { - GST_BASE_PARSE_SEEK_NONE, - GST_BASE_PARSE_SEEK_DEFAULT, - GST_BASE_PARSE_SEEK_TABLE -} GstBaseParseSeekable; - -typedef struct _GstBaseParse GstBaseParse; -typedef struct _GstBaseParseClass GstBaseParseClass; -typedef struct _GstBaseParsePrivate GstBaseParsePrivate; - -/** - * GstBaseParse: - * @element: the parent element. - * - * The opaque #GstBaseParse data structure. - */ -struct _GstBaseParse { - GstElement element; - GstAdapter *adapter; - - /*< protected >*/ - /* source and sink pads */ - GstPad *sinkpad; - GstPad *srcpad; - - /* MT-protected (with STREAM_LOCK) */ - GstSegment segment; - - /* Newsegment event to be sent after SEEK */ - GstEvent *pending_segment; - - /* Segment event that closes the running segment prior to SEEK */ - GstEvent *close_segment; - - /*< private >*/ - gpointer _gst_reserved[GST_PADDING_LARGE]; - GstBaseParsePrivate *priv; -}; - -/** - * GstBaseParseClass: - * @start: Optional. - * Called when the element starts processing. - * Allows opening external resources. - * @stop: Optional. - * Called when the element stops processing. - * Allows closing external resources. - * @set_sink_caps: allows the subclass to be notified of the actual caps set. - * @check_valid_frame: Check if the given piece of data contains a valid - * frame. - * @parse_frame: Parse the already checked frame. Subclass need to - * set the buffer timestamp, duration, caps and possibly - * other necessary metadata. This is called with srcpad's - * STREAM_LOCK held. - * @convert: Optional. - * Convert between formats. - * @event: Optional. - * Event handler on the sink pad. This function should return - * TRUE if the event was handled and can be dropped. - * @src_event: Optional. - * Event handler on the source pad. Should return TRUE - * if the event was handled and can be dropped. - * - * @pre_push_frame: Optional. - * Called just prior to pushing a frame (after any pending - * events have been sent) to give subclass a chance to perform - * additional actions at this time (e.g. tag sending) or to - * decide whether this buffer should be dropped or not - * (e.g. custom segment clipping). - * - * Subclasses can override any of the available virtual methods or not, as - * needed. At minimum @check_valid_frame and @parse_frame needs to be - * overridden. - */ -struct _GstBaseParseClass { - GstElementClass parent_class; - - /*< public >*/ - /* virtual methods for subclasses */ - - gboolean (*start) (GstBaseParse *parse); - - gboolean (*stop) (GstBaseParse *parse); - - gboolean (*set_sink_caps) (GstBaseParse *parse, - GstCaps *caps); - - gboolean (*check_valid_frame) (GstBaseParse *parse, - GstBaseParseFrame *frame, - guint *framesize, - gint *skipsize); - - GstFlowReturn (*parse_frame) (GstBaseParse *parse, - GstBaseParseFrame *frame); - - GstFlowReturn (*pre_push_frame) (GstBaseParse *parse, - GstBaseParseFrame *frame); - - gboolean (*convert) (GstBaseParse * parse, - GstFormat src_format, - gint64 src_value, - GstFormat dest_format, - gint64 * dest_value); - - gboolean (*event) (GstBaseParse *parse, - GstEvent *event); - - gboolean (*src_event) (GstBaseParse *parse, - GstEvent *event); - - /*< private >*/ - gpointer _gst_reserved[GST_PADDING_LARGE]; -}; - -GType gst_base_parse_get_type (void); - -void gst_base_parse_frame_init (GstBaseParse * parse, - GstBaseParseFrame * frame); -GstFlowReturn gst_base_parse_push_frame (GstBaseParse *parse, - GstBaseParseFrame *frame); - -void gst_base_parse_set_duration (GstBaseParse *parse, - GstFormat fmt, gint64 duration, - gint interval); -void gst_base_parse_set_seek (GstBaseParse * parse, - GstBaseParseSeekable seek, - guint bitrate); -void gst_base_parse_set_min_frame_size (GstBaseParse *parse, - guint min_size); -void gst_base_parse_set_format (GstBaseParse * parse, - GstBaseParseFormat flag, - gboolean on); -void gst_base_parse_set_frame_props (GstBaseParse * parse, - guint fps_num, guint fps_den, - guint lead_in, guint lead_out); - -gboolean gst_base_parse_convert_default (GstBaseParse * parse, - GstFormat src_format, gint64 src_value, - GstFormat dest_format, gint64 * dest_value); - -gboolean gst_base_parse_add_index_entry (GstBaseParse * parse, - guint64 offset, GstClockTime ts, - gboolean key, gboolean force); - -G_END_DECLS - -#endif /* __GST_BASE_PARSE_H__ */ diff --git a/gst-libs/gst/interfaces/Makefile.am b/gst-libs/gst/interfaces/Makefile.am index a4cf979a62..e6fb630ad3 100644 --- a/gst-libs/gst/interfaces/Makefile.am +++ b/gst-libs/gst/interfaces/Makefile.am @@ -43,3 +43,19 @@ BUILT_SOURCES = \ CLEANFILES = $(BUILT_SOURCES) include $(top_srcdir)/common/gst-glib-gen.mak + +Android.mk: $(BUILT_SOURCES) Makefile.am + androgenizer -:PROJECT libgstphotography -:STATIC libgstphotography-@GST_MAJORMINOR@ \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstphotography_@GST_MAJORMINOR@_la_SOURCES) \ + $(built_sources) \ + -:CFLAGS $(DEFS) $(libgstphotography_@GST_MAJORMINOR@_la_CFLAGS) \ + -:LDFLAGS $(libgstphotography_@GST_MAJORMINOR@_la_LDFLAGS) \ + $(libgstphotography_@GST_MAJORMINOR@_la_LIBADD) \ + -ldl \ + -:HEADER_TARGET gstreamer-@GST_MAJORMINOR@/gst/photography \ + -:HEADERS $(libgstphotographyinclude_HEADERS) \ + $(built_headers) \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + > $@ diff --git a/gst-libs/gst/media-info/.gitignore b/gst-libs/gst/media-info/.gitignore deleted file mode 100644 index 1ac8f85ab5..0000000000 --- a/gst-libs/gst/media-info/.gitignore +++ /dev/null @@ -1 +0,0 @@ -media-info-test diff --git a/gst-libs/gst/video/Makefile.am b/gst-libs/gst/video/Makefile.am index a0c4026ec2..a31276b1bd 100644 --- a/gst-libs/gst/video/Makefile.am +++ b/gst-libs/gst/video/Makefile.am @@ -11,7 +11,6 @@ libgstbasevideo_@GST_MAJORMINOR@_la_SOURCES = \ libgstbasevideo_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/video libgstbasevideo_@GST_MAJORMINOR@include_HEADERS = \ - gstbasevideoutils.h \ gstbasevideocodec.h \ gstbasevideodecoder.h \ gstbasevideoencoder.h diff --git a/gst-libs/gst/video/gstbasevideocodec.c b/gst-libs/gst/video/gstbasevideocodec.c index 39a13898a6..07085f7304 100644 --- a/gst-libs/gst/video/gstbasevideocodec.c +++ b/gst-libs/gst/video/gstbasevideocodec.c @@ -1,4 +1,4 @@ -/* Schrodinger +/* GStreamer * Copyright (C) 2006 David Schleef * * This library is free software; you can redistribute it and/or @@ -42,15 +42,8 @@ enum static void gst_base_video_codec_finalize (GObject * object); -//static const GstQueryType *gst_base_video_codec_get_query_types (GstPad *pad); -//static gboolean gst_base_video_codec_src_query (GstPad *pad, GstQuery *query); -//static gboolean gst_base_video_codec_sink_query (GstPad *pad, GstQuery *query); -//static gboolean gst_base_video_codec_src_event (GstPad *pad, GstEvent *event); -//static gboolean gst_base_video_codec_sink_event (GstPad *pad, GstEvent *event); static GstStateChangeReturn gst_base_video_codec_change_state (GstElement * element, GstStateChange transition); -//static GstFlowReturn gst_base_video_codec_push_all (GstBaseVideoCodec *base_video_codec, -// gboolean at_eos); GST_BOILERPLATE (GstBaseVideoCodec, gst_base_video_codec, GstElement, @@ -84,15 +77,13 @@ gst_base_video_codec_init (GstBaseVideoCodec * base_video_codec, { GstPadTemplate *pad_template; - GST_DEBUG ("gst_base_video_codec_init"); + GST_DEBUG_OBJECT (base_video_codec, "gst_base_video_codec_init"); pad_template = gst_element_class_get_pad_template (GST_ELEMENT_CLASS (klass), "sink"); g_return_if_fail (pad_template != NULL); base_video_codec->sinkpad = gst_pad_new_from_template (pad_template, "sink"); - //gst_pad_set_query_function (base_video_codec->sinkpad, - // gst_base_video_codec_sink_query); gst_element_add_pad (GST_ELEMENT (base_video_codec), base_video_codec->sinkpad); @@ -113,382 +104,24 @@ gst_base_video_codec_reset (GstBaseVideoCodec * base_video_codec) { GList *g; - GST_DEBUG ("reset"); + GST_DEBUG_OBJECT (base_video_codec, "reset"); for (g = base_video_codec->frames; g; g = g_list_next (g)) { gst_base_video_codec_free_frame ((GstVideoFrame *) g->data); } g_list_free (base_video_codec->frames); + base_video_codec->frames = NULL; - if (base_video_codec->caps) { - gst_caps_unref (base_video_codec->caps); - base_video_codec->caps = NULL; - } - + base_video_codec->bytes = 0; + base_video_codec->time = 0; } static void gst_base_video_codec_finalize (GObject * object) { - GstBaseVideoCodec *base_video_codec; - - g_return_if_fail (GST_IS_BASE_VIDEO_CODEC (object)); - base_video_codec = GST_BASE_VIDEO_CODEC (object); - G_OBJECT_CLASS (parent_class)->finalize (object); } -#ifdef unused -static const GstQueryType * -gst_base_video_codec_get_query_types (GstPad * pad) -{ - static const GstQueryType query_types[] = { - GST_QUERY_POSITION, - GST_QUERY_DURATION, - GST_QUERY_CONVERT, - 0 - }; - - return query_types; -} -#endif - -#if 0 -static gboolean -gst_base_video_codec_src_convert (GstPad * pad, - GstFormat src_format, gint64 src_value, - GstFormat * dest_format, gint64 * dest_value) -{ - gboolean res; - GstBaseVideoCodec *dec; - - if (src_format == *dest_format) { - *dest_value = src_value; - return TRUE; - } - - dec = GST_BASE_VIDEO_CODEC (gst_pad_get_parent (pad)); - - if (src_format == GST_FORMAT_DEFAULT && *dest_format == GST_FORMAT_TIME) { - if (dec->fps_d != 0) { - *dest_value = gst_util_uint64_scale (granulepos_to_frame (src_value), - dec->fps_d * GST_SECOND, dec->fps_n); - res = TRUE; - } else { - res = FALSE; - } - } else { - GST_WARNING ("unhandled conversion from %d to %d", src_format, - *dest_format); - res = FALSE; - } - - gst_object_unref (dec); - - return res; -} - -static gboolean -gst_base_video_codec_sink_convert (GstPad * pad, - GstFormat src_format, gint64 src_value, - GstFormat * dest_format, gint64 * dest_value) -{ - gboolean res = TRUE; - GstBaseVideoCodec *dec; - - if (src_format == *dest_format) { - *dest_value = src_value; - return TRUE; - } - - dec = GST_BASE_VIDEO_CODEC (gst_pad_get_parent (pad)); - - /* FIXME: check if we are in a decoding state */ - - switch (src_format) { - case GST_FORMAT_DEFAULT: - switch (*dest_format) { - case GST_FORMAT_TIME: - *dest_value = gst_util_uint64_scale (src_value, - dec->fps_d * GST_SECOND, dec->fps_n); - break; - default: - res = FALSE; - } - break; - case GST_FORMAT_TIME: - switch (*dest_format) { - case GST_FORMAT_DEFAULT: - { - *dest_value = gst_util_uint64_scale (src_value, - dec->fps_n, dec->fps_d * GST_SECOND); - break; - } - default: - res = FALSE; - break; - } - break; - default: - res = FALSE; - break; - } - - gst_object_unref (dec); - - return res; -} -#endif - -#ifdef unused -static gboolean -gst_base_video_codec_src_query (GstPad * pad, GstQuery * query) -{ - GstBaseVideoCodec *base_codec; - gboolean res = FALSE; - - base_codec = GST_BASE_VIDEO_CODEC (gst_pad_get_parent (pad)); - - switch (GST_QUERY_TYPE (query)) { - case GST_QUERY_POSITION: - { - GstFormat format; - gint64 time; - gint64 value; - - gst_query_parse_position (query, &format, NULL); - - time = gst_util_uint64_scale (base_codec->system_frame_number, - base_codec->state.fps_n, base_codec->state.fps_d); - time += base_codec->state.segment.time; - GST_DEBUG ("query position %" GST_TIME_FORMAT, GST_TIME_ARGS (time)); - res = gst_base_video_encoded_video_convert (&base_codec->state, - GST_FORMAT_TIME, time, &format, &value); - if (!res) - goto error; - - gst_query_set_position (query, format, value); - break; - } - case GST_QUERY_DURATION: - res = gst_pad_query (GST_PAD_PEER (base_codec->sinkpad), query); - if (!res) - goto error; - break; - case GST_QUERY_CONVERT: - { - GstFormat src_fmt, dest_fmt; - gint64 src_val, dest_val; - - GST_DEBUG ("query convert"); - - gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); - res = gst_base_video_encoded_video_convert (&base_codec->state, - src_fmt, src_val, &dest_fmt, &dest_val); - if (!res) - goto error; - gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); - break; - } - default: - res = gst_pad_query_default (pad, query); - break; - } -done: - gst_object_unref (base_codec); - - return res; -error: - GST_DEBUG_OBJECT (base_codec, "query failed"); - goto done; -} -#endif - -#ifdef unused -static gboolean -gst_base_video_codec_sink_query (GstPad * pad, GstQuery * query) -{ - GstBaseVideoCodec *base_video_codec; - gboolean res = FALSE; - - base_video_codec = GST_BASE_VIDEO_CODEC (gst_pad_get_parent (pad)); - - switch (GST_QUERY_TYPE (query)) { - case GST_QUERY_CONVERT: - { - GstFormat src_fmt, dest_fmt; - gint64 src_val, dest_val; - - gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); - res = gst_base_video_encoded_video_convert (&base_video_codec->state, - src_fmt, src_val, &dest_fmt, &dest_val); - if (!res) - goto error; - gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); - break; - } - default: - res = gst_pad_query_default (pad, query); - break; - } -done: - gst_object_unref (base_video_codec); - - return res; -error: - GST_DEBUG_OBJECT (base_video_codec, "query failed"); - goto done; -} -#endif - -#ifdef unused -static gboolean -gst_base_video_codec_src_event (GstPad * pad, GstEvent * event) -{ - GstBaseVideoCodec *base_video_codec; - gboolean res = FALSE; - - base_video_codec = GST_BASE_VIDEO_CODEC (gst_pad_get_parent (pad)); - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_SEEK: - { - GstFormat format, tformat; - gdouble rate; - GstEvent *real_seek; - GstSeekFlags flags; - GstSeekType cur_type, stop_type; - gint64 cur, stop; - gint64 tcur, tstop; - - gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, - &cur, &stop_type, &stop); - gst_event_unref (event); - - tformat = GST_FORMAT_TIME; - res = gst_base_video_encoded_video_convert (&base_video_codec->state, - format, cur, &tformat, &tcur); - if (!res) - goto convert_error; - res = gst_base_video_encoded_video_convert (&base_video_codec->state, - format, stop, &tformat, &tstop); - if (!res) - goto convert_error; - - real_seek = gst_event_new_seek (rate, GST_FORMAT_TIME, - flags, cur_type, tcur, stop_type, tstop); - - res = gst_pad_push_event (base_video_codec->sinkpad, real_seek); - - break; - } -#if 0 - case GST_EVENT_QOS: - { - gdouble proportion; - GstClockTimeDiff diff; - GstClockTime timestamp; - - gst_event_parse_qos (event, &proportion, &diff, ×tamp); - - GST_OBJECT_LOCK (base_video_codec); - base_video_codec->proportion = proportion; - base_video_codec->earliest_time = timestamp + diff; - GST_OBJECT_UNLOCK (base_video_codec); - - GST_DEBUG_OBJECT (base_video_codec, - "got QoS %" GST_TIME_FORMAT ", %" G_GINT64_FORMAT, - GST_TIME_ARGS (timestamp), diff); - - res = gst_pad_push_event (base_video_codec->sinkpad, event); - break; - } -#endif - default: - res = gst_pad_push_event (base_video_codec->sinkpad, event); - break; - } -done: - gst_object_unref (base_video_codec); - return res; - -convert_error: - GST_DEBUG_OBJECT (base_video_codec, "could not convert format"); - goto done; -} -#endif - -#ifdef unused -static gboolean -gst_base_video_codec_sink_event (GstPad * pad, GstEvent * event) -{ - GstBaseVideoCodec *base_video_codec; - gboolean ret = FALSE; - - base_video_codec = GST_BASE_VIDEO_CODEC (gst_pad_get_parent (pad)); - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_FLUSH_START: - ret = gst_pad_push_event (base_video_codec->srcpad, event); - break; - case GST_EVENT_FLUSH_STOP: - gst_base_video_codec_reset (base_video_codec); - ret = gst_pad_push_event (base_video_codec->srcpad, event); - break; - case GST_EVENT_EOS: - if (gst_base_video_codec_push_all (base_video_codec, - FALSE) == GST_FLOW_ERROR) { - gst_event_unref (event); - return FALSE; - } - - ret = gst_pad_push_event (base_video_codec->srcpad, event); - break; - case GST_EVENT_NEWSEGMENT: - { - gboolean update; - GstFormat format; - gdouble rate; - gint64 start, stop, time; - - gst_event_parse_new_segment (event, &update, &rate, &format, &start, - &stop, &time); - - if (format != GST_FORMAT_TIME) - goto newseg_wrong_format; - - if (rate <= 0.0) - goto newseg_wrong_rate; - - GST_DEBUG ("newsegment %" GST_TIME_FORMAT " %" GST_TIME_FORMAT, - GST_TIME_ARGS (start), GST_TIME_ARGS (time)); - gst_segment_set_newsegment (&base_video_codec->state.segment, update, - rate, format, start, stop, time); - - ret = gst_pad_push_event (base_video_codec->srcpad, event); - break; - } - default: - ret = gst_pad_push_event (base_video_codec->srcpad, event); - break; - } -done: - gst_object_unref (base_video_codec); - return ret; - -newseg_wrong_format: - GST_DEBUG_OBJECT (base_video_codec, "received non TIME newsegment"); - gst_event_unref (event); - goto done; - -newseg_wrong_rate: - GST_DEBUG_OBJECT (base_video_codec, "negative rates not supported"); - gst_event_unref (event); - goto done; -} -#endif - - static GstStateChangeReturn gst_base_video_codec_change_state (GstElement * element, GstStateChange transition) @@ -545,5 +178,9 @@ gst_base_video_codec_free_frame (GstVideoFrame * frame) gst_buffer_unref (frame->sink_buffer); } + if (frame->src_buffer) { + gst_buffer_unref (frame->src_buffer); + } + g_free (frame); } diff --git a/gst-libs/gst/video/gstbasevideocodec.h b/gst-libs/gst/video/gstbasevideocodec.h index 450928670b..9bada934b3 100644 --- a/gst-libs/gst/video/gstbasevideocodec.h +++ b/gst-libs/gst/video/gstbasevideocodec.h @@ -26,7 +26,8 @@ #endif #include -#include +#include +#include G_BEGIN_DECLS @@ -78,9 +79,57 @@ G_BEGIN_DECLS */ #define GST_BASE_VIDEO_CODEC_FLOW_NEED_DATA GST_FLOW_CUSTOM_SUCCESS +typedef struct _GstVideoState GstVideoState; +typedef struct _GstVideoFrame GstVideoFrame; typedef struct _GstBaseVideoCodec GstBaseVideoCodec; typedef struct _GstBaseVideoCodecClass GstBaseVideoCodecClass; +struct _GstVideoState +{ + GstVideoFormat format; + int width, height; + int fps_n, fps_d; + int par_n, par_d; + + gboolean have_interlaced; + gboolean interlaced; + gboolean top_field_first; + + int clean_width, clean_height; + int clean_offset_left, clean_offset_top; + + int bytes_per_picture; + + GstBuffer *codec_data; + +}; + +struct _GstVideoFrame +{ + GstClockTime decode_timestamp; + GstClockTime presentation_timestamp; + GstClockTime presentation_duration; + + gint system_frame_number; + gint decode_frame_number; + gint presentation_frame_number; + + int distance_from_sync; + gboolean is_sync_point; + gboolean is_eos; + + GstBuffer *sink_buffer; + GstBuffer *src_buffer; + + int field_index; + int n_fields; + + void *coder_hook; + GstClockTime deadline; + + gboolean force_keyframe; +}; + struct _GstBaseVideoCodec { GstElement element; @@ -95,10 +144,12 @@ struct _GstBaseVideoCodec GstVideoState state; GstSegment segment; - GstCaps *caps; - gdouble proportion; GstClockTime earliest_time; + gboolean discont; + + gint64 bytes; + gint64 time; /* FIXME before moving to base */ void *padding[GST_PADDING_LARGE]; @@ -108,15 +159,6 @@ struct _GstBaseVideoCodecClass { GstElementClass element_class; - gboolean (*start) (GstBaseVideoCodec *codec); - gboolean (*stop) (GstBaseVideoCodec *codec); - gboolean (*reset) (GstBaseVideoCodec *codec); - GstFlowReturn (*parse_data) (GstBaseVideoCodec *codec, gboolean at_eos); - int (*scan_for_sync) (GstAdapter *adapter, gboolean at_eos, - int offset, int n); - GstFlowReturn (*shape_output) (GstBaseVideoCodec *codec, GstVideoFrame *frame); - GstCaps *(*get_caps) (GstBaseVideoCodec *codec); - /* FIXME before moving to base */ void *padding[GST_PADDING_LARGE]; }; @@ -127,6 +169,16 @@ GstVideoFrame * gst_base_video_codec_new_frame (GstBaseVideoCodec *base_video_co void gst_base_video_codec_free_frame (GstVideoFrame *frame); +gboolean gst_base_video_rawvideo_convert (GstVideoState *state, + GstFormat src_format, gint64 src_value, + GstFormat * dest_format, gint64 *dest_value); +gboolean gst_base_video_encoded_video_convert (GstVideoState * state, + gint64 bytes, gint64 time, GstFormat src_format, + gint64 src_value, GstFormat * dest_format, gint64 * dest_value); + +GstClockTime gst_video_state_get_timestamp (const GstVideoState *state, + GstSegment *segment, int frame_number); + G_END_DECLS #endif diff --git a/gst-libs/gst/video/gstbasevideodecoder.c b/gst-libs/gst/video/gstbasevideodecoder.c index eba17a4cac..aca8d5cdfa 100644 --- a/gst-libs/gst/video/gstbasevideodecoder.c +++ b/gst-libs/gst/video/gstbasevideodecoder.c @@ -1,5 +1,8 @@ /* GStreamer * Copyright (C) 2008 David Schleef + * Copyright (C) 2011 Mark Nauwelaerts . + * Copyright (C) 2011 Nokia Corporation. All rights reserved. + * Contact: Stefan Kost * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -17,6 +20,109 @@ * Boston, MA 02111-1307, USA. */ +/** + * SECTION:gstbasevideodecoder + * @short_description: Base class for video decoders + * @see_also: #GstBaseTransform + * + * This base class is for video decoders turning encoded data into raw video + * frames. + * + * GstBaseVideoDecoder and subclass should cooperate as follows. + * + * + * Configuration + * + * Initially, GstBaseVideoDecoder calls @start when the decoder element + * is activated, which allows subclass to perform any global setup. + * + * + * GstBaseVideoDecoder calls @set_format to inform subclass of caps + * describing input video data that it is about to receive, including + * possibly configuration data. + * While unlikely, it might be called more than once, if changing input + * parameters require reconfiguration. + * + * + * GstBaseVideoDecoder calls @stop at end of all processing. + * + * + * + * + * + * Data processing + * + * Base class gathers input data, and optionally allows subclass + * to parse this into subsequently manageable chunks, typically + * corresponding to and referred to as 'frames'. + * + * + * Input frame is provided to subclass' @handle_frame. + * + * + * If codec processing results in decoded data, subclass should call + * @gst_base_video_decoder_finish_frame to have decoded data pushed + * downstream. + * + * + * + * + * Shutdown phase + * + * GstBaseVideoDecoder class calls @stop to inform the subclass that data + * parsing will be stopped. + * + * + * + * + * + * Subclass is responsible for providing pad template caps for + * source and sink pads. The pads need to be named "sink" and "src". It also + * needs to set the fixed caps on srcpad, when the format is ensured. This + * is typically when base class calls subclass' @set_format function, though + * it might be delayed until calling @gst_base_video_decoder_finish_frame. + * + * Subclass is also responsible for providing (presentation) timestamps + * (likely based on corresponding input ones). If that is not applicable + * or possible, baseclass provides limited framerate based interpolation. + * + * Similarly, the baseclass provides some limited (legacy) seeking support + * (upon explicit subclass request), as full-fledged support + * should rather be left to upstream demuxer, parser or alike. This simple + * approach caters for seeking and duration reporting using estimated input + * bitrates. + * + * Baseclass provides some support for reverse playback, in particular + * in case incoming data is not packetized or upstream does not provide + * fragments on keyframe boundaries. However, subclass should then be prepared + * for the parsing and frame processing stage to occur separately (rather + * than otherwise the latter immediately following the former), + * and should ensure the parsing stage properly marks keyframes or rely on + * upstream to do so properly for incoming data. + * + * Things that subclass need to take care of: + * + * Provide pad templates + * + * Set source pad caps when appropriate + * + * + * Configure some baseclass behaviour parameters. + * + * + * Optionally parse input data, if it is not considered packetized. + * Parse sync is obtained either by providing baseclass with a + * mask and pattern or a custom @scan_for_sync. When sync is established, + * @parse_data should invoke @gst_base_video_decoder_add_to_frame and + * @gst_base_video_decoder_have_frame as appropriate. + * + * + * Accept data in @handle_frame and provide decoded results to + * @gst_base_video_decoder_finish_frame. + * + * + */ + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -40,18 +146,14 @@ static GstFlowReturn gst_base_video_decoder_chain (GstPad * pad, GstBuffer * buf); static gboolean gst_base_video_decoder_sink_query (GstPad * pad, GstQuery * query); -//static GstFlowReturn gst_base_video_decoder_process (GstBaseVideoDecoder *base_video_decoder); static GstStateChangeReturn gst_base_video_decoder_change_state (GstElement * element, GstStateChange transition); static const GstQueryType *gst_base_video_decoder_get_query_types (GstPad * pad); static gboolean gst_base_video_decoder_src_query (GstPad * pad, GstQuery * query); -static gboolean gst_base_video_decoder_src_convert (GstPad * pad, - GstFormat src_format, gint64 src_value, GstFormat * dest_format, - gint64 * dest_value); static void gst_base_video_decoder_reset (GstBaseVideoDecoder * - base_video_decoder); + base_video_decoder, gboolean full); static GstFlowReturn gst_base_video_decoder_have_frame_2 (GstBaseVideoDecoder * base_video_decoder); @@ -68,6 +170,8 @@ static GstVideoFrame *gst_base_video_decoder_new_frame (GstBaseVideoDecoder * base_video_decoder); static void gst_base_video_decoder_free_frame (GstVideoFrame * frame); +static void gst_base_video_decoder_clear_queues (GstBaseVideoDecoder * dec); + GST_BOILERPLATE (GstBaseVideoDecoder, gst_base_video_decoder, GstBaseVideoCodec, GST_TYPE_BASE_VIDEO_CODEC); @@ -90,7 +194,8 @@ gst_base_video_decoder_class_init (GstBaseVideoDecoderClass * klass) gobject_class->finalize = gst_base_video_decoder_finalize; - gstelement_class->change_state = gst_base_video_decoder_change_state; + gstelement_class->change_state = + GST_DEBUG_FUNCPTR (gst_base_video_decoder_change_state); parent_class = g_type_class_peek_parent (klass); } @@ -101,29 +206,33 @@ gst_base_video_decoder_init (GstBaseVideoDecoder * base_video_decoder, { GstPad *pad; - GST_DEBUG ("gst_base_video_decoder_init"); + GST_DEBUG_OBJECT (base_video_decoder, "gst_base_video_decoder_init"); pad = GST_BASE_VIDEO_CODEC_SINK_PAD (base_video_decoder); - gst_pad_set_chain_function (pad, gst_base_video_decoder_chain); - gst_pad_set_event_function (pad, gst_base_video_decoder_sink_event); - gst_pad_set_setcaps_function (pad, gst_base_video_decoder_sink_setcaps); - gst_pad_set_query_function (pad, gst_base_video_decoder_sink_query); + gst_pad_set_chain_function (pad, + GST_DEBUG_FUNCPTR (gst_base_video_decoder_chain)); + gst_pad_set_event_function (pad, + GST_DEBUG_FUNCPTR (gst_base_video_decoder_sink_event)); + gst_pad_set_setcaps_function (pad, + GST_DEBUG_FUNCPTR (gst_base_video_decoder_sink_setcaps)); + gst_pad_set_query_function (pad, + GST_DEBUG_FUNCPTR (gst_base_video_decoder_sink_query)); pad = GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder); - gst_pad_set_event_function (pad, gst_base_video_decoder_src_event); - gst_pad_set_query_type_function (pad, gst_base_video_decoder_get_query_types); - gst_pad_set_query_function (pad, gst_base_video_decoder_src_query); + gst_pad_set_event_function (pad, + GST_DEBUG_FUNCPTR (gst_base_video_decoder_src_event)); + gst_pad_set_query_type_function (pad, + GST_DEBUG_FUNCPTR (gst_base_video_decoder_get_query_types)); + gst_pad_set_query_function (pad, + GST_DEBUG_FUNCPTR (gst_base_video_decoder_src_query)); gst_pad_use_fixed_caps (pad); base_video_decoder->input_adapter = gst_adapter_new (); base_video_decoder->output_adapter = gst_adapter_new (); - gst_base_video_decoder_reset (base_video_decoder); - - base_video_decoder->current_frame = - gst_base_video_decoder_new_frame (base_video_decoder); + gst_base_video_decoder_reset (base_video_decoder, TRUE); base_video_decoder->sink_clipping = TRUE; } @@ -142,20 +251,27 @@ gst_base_video_decoder_sink_setcaps (GstPad * pad, GstCaps * caps) base_video_decoder_class = GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); - GST_DEBUG ("setcaps %" GST_PTR_FORMAT, caps); + GST_DEBUG_OBJECT (base_video_decoder, "setcaps %" GST_PTR_FORMAT, caps); state = &GST_BASE_VIDEO_CODEC (base_video_decoder)->state; - if (state->codec_data) { - gst_buffer_unref (state->codec_data); - } memset (state, 0, sizeof (GstVideoState)); structure = gst_caps_get_structure (caps, 0); gst_video_format_parse_caps (caps, NULL, &state->width, &state->height); - gst_video_parse_caps_framerate (caps, &state->fps_n, &state->fps_d); - gst_video_parse_caps_pixel_aspect_ratio (caps, &state->par_n, &state->par_d); + /* this one fails if no framerate in caps */ + if (!gst_video_parse_caps_framerate (caps, &state->fps_n, &state->fps_d)) { + state->fps_n = 0; + state->fps_d = 1; + } + /* but the p-a-r sets 1/1 instead, which is not quite informative ... */ + if (!gst_structure_has_field (structure, "pixel-aspect-ratio") || + !gst_video_parse_caps_pixel_aspect_ratio (caps, + &state->par_n, &state->par_d)) { + state->par_n = 0; + state->par_d = 1; + } state->have_interlaced = gst_video_format_parse_caps_interlaced (caps, &state->interlaced); @@ -165,8 +281,9 @@ gst_base_video_decoder_sink_setcaps (GstPad * pad, GstCaps * caps) state->codec_data = gst_value_get_buffer (codec_data); } - if (base_video_decoder_class->start) { - ret = base_video_decoder_class->start (base_video_decoder); + if (base_video_decoder_class->set_format) { + ret = base_video_decoder_class->set_format (base_video_decoder, + &GST_BASE_VIDEO_CODEC (base_video_decoder)->state); } g_object_unref (base_video_decoder); @@ -178,13 +295,10 @@ static void gst_base_video_decoder_finalize (GObject * object) { GstBaseVideoDecoder *base_video_decoder; - GstBaseVideoDecoderClass *base_video_decoder_class; - g_return_if_fail (GST_IS_BASE_VIDEO_DECODER (object)); base_video_decoder = GST_BASE_VIDEO_DECODER (object); - base_video_decoder_class = GST_BASE_VIDEO_DECODER_GET_CLASS (object); - gst_base_video_decoder_reset (base_video_decoder); + GST_DEBUG_OBJECT (object, "finalize"); if (base_video_decoder->input_adapter) { g_object_unref (base_video_decoder->input_adapter); @@ -195,11 +309,43 @@ gst_base_video_decoder_finalize (GObject * object) base_video_decoder->output_adapter = NULL; } - GST_DEBUG_OBJECT (object, "finalize"); - G_OBJECT_CLASS (parent_class)->finalize (object); } +/* hard == FLUSH, otherwise discont */ +static GstFlowReturn +gst_base_video_decoder_flush (GstBaseVideoDecoder * dec, gboolean hard) +{ + GstBaseVideoDecoderClass *klass; + GstFlowReturn ret = GST_FLOW_OK; + + klass = GST_BASE_VIDEO_DECODER_GET_CLASS (dec); + + GST_LOG_OBJECT (dec, "flush hard %d", hard); + + /* FIXME make some more distinction between hard and soft, + * but subclass may not be prepared for that */ + /* FIXME perhaps also clear pending frames ?, + * but again, subclass may still come up with one of those */ + if (!hard) { + /* TODO ? finish/drain some stuff */ + } else { + gst_segment_init (&GST_BASE_VIDEO_CODEC (dec)->segment, + GST_FORMAT_UNDEFINED); + gst_base_video_decoder_clear_queues (dec); + dec->error_count = 0; + } + /* and get (re)set for the sequel */ + gst_base_video_decoder_reset (dec, FALSE); + + /* also inform subclass */ + /* FIXME ? only if hard, or tell it if hard ? */ + if (klass->reset) + klass->reset (dec); + + return ret; +} + static gboolean gst_base_video_decoder_sink_event (GstPad * pad, GstEvent * event) { @@ -211,6 +357,10 @@ gst_base_video_decoder_sink_event (GstPad * pad, GstEvent * event) base_video_decoder_class = GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); + GST_DEBUG_OBJECT (base_video_decoder, + "received event %d, %s", GST_EVENT_TYPE (event), + GST_EVENT_TYPE_NAME (event)); + switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: { @@ -235,52 +385,71 @@ gst_base_video_decoder_sink_event (GstPad * pad, GstEvent * event) case GST_EVENT_NEWSEGMENT: { gboolean update; - double rate; - double applied_rate; + double rate, arate; GstFormat format; gint64 start; gint64 stop; - gint64 position; + gint64 pos; GstSegment *segment = &GST_BASE_VIDEO_CODEC (base_video_decoder)->segment; gst_event_parse_new_segment_full (event, &update, &rate, - &applied_rate, &format, &start, &stop, &position); + &arate, &format, &start, &stop, &pos); - if (format != GST_FORMAT_TIME) - goto newseg_wrong_format; + if (format == GST_FORMAT_TIME) { + GST_DEBUG_OBJECT (base_video_decoder, + "received TIME NEW_SEGMENT %" GST_TIME_FORMAT + " -- %" GST_TIME_FORMAT ", pos %" GST_TIME_FORMAT + ", rate %g, applied_rate %g", + GST_TIME_ARGS (start), GST_TIME_ARGS (stop), GST_TIME_ARGS (pos), + rate, arate); + } else { + GstFormat dformat = GST_FORMAT_TIME; + + GST_DEBUG_OBJECT (base_video_decoder, + "received NEW_SEGMENT %" G_GINT64_FORMAT + " -- %" G_GINT64_FORMAT ", time %" G_GINT64_FORMAT + ", rate %g, applied_rate %g", start, stop, pos, rate, arate); + /* handle newsegment as a result from our legacy simple seeking */ + /* note that initial 0 should convert to 0 in any case */ + if (base_video_decoder->do_byte_time && + gst_pad_query_convert (GST_BASE_VIDEO_CODEC_SINK_PAD + (base_video_decoder), GST_FORMAT_BYTES, start, &dformat, + &start)) { + /* best attempt convert */ + /* as these are only estimates, stop is kept open-ended to avoid + * premature cutting */ + GST_DEBUG_OBJECT (base_video_decoder, + "converted to TIME start %" GST_TIME_FORMAT, + GST_TIME_ARGS (start)); + pos = start; + stop = GST_CLOCK_TIME_NONE; + /* replace event */ + gst_event_unref (event); + event = gst_event_new_new_segment_full (update, rate, arate, + GST_FORMAT_TIME, start, stop, pos); + } else { + goto newseg_wrong_format; + } + } if (!update) { - gst_base_video_decoder_reset (base_video_decoder); + gst_base_video_decoder_flush (base_video_decoder, FALSE); } base_video_decoder->timestamp_offset = start; gst_segment_set_newsegment_full (segment, - update, rate, applied_rate, format, start, stop, position); - base_video_decoder->have_segment = TRUE; - - GST_DEBUG_OBJECT (base_video_decoder, - "new segment: format %d rate %g start %" GST_TIME_FORMAT - " stop %" GST_TIME_FORMAT - " position %" GST_TIME_FORMAT - " update %d", - format, rate, - GST_TIME_ARGS (segment->start), - GST_TIME_ARGS (segment->stop), GST_TIME_ARGS (segment->time), update); + update, rate, arate, format, start, stop, pos); ret = gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), event); - } break; - case GST_EVENT_FLUSH_STOP:{ - GST_OBJECT_LOCK (base_video_decoder); - GST_BASE_VIDEO_CODEC (base_video_decoder)->earliest_time = - GST_CLOCK_TIME_NONE; - GST_BASE_VIDEO_CODEC (base_video_decoder)->proportion = 0.5; - gst_segment_init (&GST_BASE_VIDEO_CODEC (base_video_decoder)->segment, - GST_FORMAT_TIME); - GST_OBJECT_UNLOCK (base_video_decoder); + } + case GST_EVENT_FLUSH_STOP: + { + /* well, this is kind of worse than a DISCONT */ + gst_base_video_decoder_flush (base_video_decoder, TRUE); } default: /* FIXME this changes the order of events */ @@ -302,6 +471,76 @@ newseg_wrong_format: } } +/* perform upstream byte <-> time conversion (duration, seeking) + * if subclass allows and if enough data for moderately decent conversion */ +static inline gboolean +gst_base_video_decoder_do_byte (GstBaseVideoDecoder * dec) +{ + GstBaseVideoCodec *codec = GST_BASE_VIDEO_CODEC (dec); + + return dec->do_byte_time && (codec->bytes > 0) && (codec->time > GST_SECOND); +} + +static gboolean +gst_base_video_decoder_do_seek (GstBaseVideoDecoder * dec, GstEvent * event) +{ + GstBaseVideoCodec *codec = GST_BASE_VIDEO_CODEC (dec); + GstSeekFlags flags; + GstSeekType start_type, end_type; + GstFormat format; + gdouble rate; + gint64 start, start_time, end_time; + GstSegment seek_segment; + guint32 seqnum; + + gst_event_parse_seek (event, &rate, &format, &flags, &start_type, + &start_time, &end_type, &end_time); + + /* we'll handle plain open-ended flushing seeks with the simple approach */ + if (rate != 1.0) { + GST_DEBUG_OBJECT (dec, "unsupported seek: rate"); + return FALSE; + } + + if (start_type != GST_SEEK_TYPE_SET) { + GST_DEBUG_OBJECT (dec, "unsupported seek: start time"); + return FALSE; + } + + if (end_type != GST_SEEK_TYPE_NONE || + (end_type == GST_SEEK_TYPE_SET && end_time != GST_CLOCK_TIME_NONE)) { + GST_DEBUG_OBJECT (dec, "unsupported seek: end time"); + return FALSE; + } + + if (!(flags & GST_SEEK_FLAG_FLUSH)) { + GST_DEBUG_OBJECT (dec, "unsupported seek: not flushing"); + return FALSE; + } + + memcpy (&seek_segment, &codec->segment, sizeof (seek_segment)); + gst_segment_set_seek (&seek_segment, rate, format, flags, start_type, + start_time, end_type, end_time, NULL); + start_time = seek_segment.last_stop; + + format = GST_FORMAT_BYTES; + if (!gst_pad_query_convert (codec->sinkpad, GST_FORMAT_TIME, start_time, + &format, &start)) { + GST_DEBUG_OBJECT (dec, "conversion failed"); + return FALSE; + } + + seqnum = gst_event_get_seqnum (event); + event = gst_event_new_seek (1.0, GST_FORMAT_BYTES, flags, + GST_SEEK_TYPE_SET, start, GST_SEEK_TYPE_NONE, -1); + gst_event_set_seqnum (event, seqnum); + + GST_DEBUG_OBJECT (dec, "seeking to %" GST_TIME_FORMAT " at byte offset %" + G_GINT64_FORMAT, GST_TIME_ARGS (start_time), start); + + return gst_pad_push_event (codec->sinkpad, event); +} + static gboolean gst_base_video_decoder_src_event (GstPad * pad, GstEvent * event) { @@ -310,42 +549,54 @@ gst_base_video_decoder_src_event (GstPad * pad, GstEvent * event) base_video_decoder = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); + GST_DEBUG_OBJECT (base_video_decoder, + "received event %d, %s", GST_EVENT_TYPE (event), + GST_EVENT_TYPE_NAME (event)); + switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: { GstFormat format, tformat; gdouble rate; - GstEvent *real_seek; GstSeekFlags flags; GstSeekType cur_type, stop_type; gint64 cur, stop; - gint64 tcur = -1, tstop = -1; + gint64 tcur, tstop; + guint32 seqnum; - GST_DEBUG ("seek event"); + gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur, + &stop_type, &stop); + seqnum = gst_event_get_seqnum (event); - gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, - &cur, &stop_type, &stop); - gst_event_unref (event); + /* upstream gets a chance first */ + if ((res = + gst_pad_push_event (GST_BASE_VIDEO_CODEC_SINK_PAD + (base_video_decoder), event))) + break; + /* if upstream fails for a time seek, maybe we can help if allowed */ + if (format == GST_FORMAT_TIME) { + if (gst_base_video_decoder_do_byte (base_video_decoder)) + res = gst_base_video_decoder_do_seek (base_video_decoder, event); + break; + } + + /* ... though a non-time seek can be aided as well */ + /* First bring the requested format to time */ tformat = GST_FORMAT_TIME; - res = - gst_base_video_decoder_src_convert (pad, format, cur, &tformat, - &tcur); - if (!res) + if (!(res = gst_pad_query_convert (pad, format, cur, &tformat, &tcur))) goto convert_error; - res = - gst_base_video_decoder_src_convert (pad, format, stop, &tformat, - &tstop); - if (!res) + if (!(res = gst_pad_query_convert (pad, format, stop, &tformat, &tstop))) goto convert_error; - real_seek = gst_event_new_seek (rate, GST_FORMAT_TIME, + /* then seek with time on the peer */ + event = gst_event_new_seek (rate, GST_FORMAT_TIME, flags, cur_type, tcur, stop_type, tstop); + gst_event_set_seqnum (event, seqnum); res = gst_pad_push_event (GST_BASE_VIDEO_CODEC_SINK_PAD - (base_video_decoder), real_seek); - + (base_video_decoder), event); break; } case GST_EVENT_QOS: @@ -404,117 +655,6 @@ convert_error: goto done; } - -#if 0 -static gboolean -gst_base_video_decoder_sink_convert (GstPad * pad, - GstFormat src_format, gint64 src_value, - GstFormat * dest_format, gint64 * dest_value) -{ - gboolean res = TRUE; - GstBaseVideoDecoder *enc; - - if (src_format == *dest_format) { - *dest_value = src_value; - return TRUE; - } - - enc = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); - - /* FIXME: check if we are in a decoding state */ - - switch (src_format) { - case GST_FORMAT_BYTES: - switch (*dest_format) { -#if 0 - case GST_FORMAT_DEFAULT: - *dest_value = gst_util_uint64_scale_int (src_value, 1, - enc->bytes_per_picture); - break; -#endif - case GST_FORMAT_TIME: - /* seems like a rather silly conversion, implement me if you like */ - default: - res = FALSE; - } - break; - case GST_FORMAT_DEFAULT: - switch (*dest_format) { - case GST_FORMAT_TIME: - *dest_value = gst_util_uint64_scale (src_value, - GST_SECOND * enc->fps_d, enc->fps_n); - break; -#if 0 - case GST_FORMAT_BYTES: - *dest_value = gst_util_uint64_scale_int (src_value, - enc->bytes_per_picture, 1); - break; -#endif - default: - res = FALSE; - } - break; - default: - res = FALSE; - break; - } -} -#endif - -static gboolean -gst_base_video_decoder_src_convert (GstPad * pad, - GstFormat src_format, gint64 src_value, - GstFormat * dest_format, gint64 * dest_value) -{ - gboolean res = TRUE; - GstBaseVideoDecoder *enc; - - if (src_format == *dest_format) { - *dest_value = src_value; - return TRUE; - } - - enc = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); - - /* FIXME: check if we are in a encoding state */ - - GST_DEBUG ("src convert"); - switch (src_format) { -#if 0 - case GST_FORMAT_DEFAULT: - switch (*dest_format) { - case GST_FORMAT_TIME: - *dest_value = gst_util_uint64_scale (granulepos_to_frame (src_value), - enc->fps_d * GST_SECOND, enc->fps_n); - break; - default: - res = FALSE; - } - break; - case GST_FORMAT_TIME: - switch (*dest_format) { - case GST_FORMAT_DEFAULT: - { - *dest_value = gst_util_uint64_scale (src_value, - enc->fps_n, enc->fps_d * GST_SECOND); - break; - } - default: - res = FALSE; - break; - } - break; -#endif - default: - res = FALSE; - break; - } - - gst_object_unref (enc); - - return res; -} - static const GstQueryType * gst_base_video_decoder_get_query_types (GstPad * pad) { @@ -531,39 +671,74 @@ gst_base_video_decoder_get_query_types (GstPad * pad) static gboolean gst_base_video_decoder_src_query (GstPad * pad, GstQuery * query) { - GstBaseVideoDecoder *enc; + GstBaseVideoDecoder *dec; gboolean res = TRUE; - enc = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); + dec = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); - switch GST_QUERY_TYPE - (query) { + GST_LOG_OBJECT (dec, "handling query: %" GST_PTR_FORMAT, query); + + switch (GST_QUERY_TYPE (query)) { case GST_QUERY_POSITION: { GstFormat format; - gint64 time; + gint64 time, value; - gst_query_parse_position (query, &format, NULL); - GST_DEBUG ("query in format %d", format); - - if (format != GST_FORMAT_TIME) { - goto error; + /* upstream gets a chance first */ + if ((res = + gst_pad_peer_query (GST_BASE_VIDEO_CODEC_SINK_PAD (dec), + query))) { + GST_LOG_OBJECT (dec, "returning peer response"); + break; } - time = enc->last_timestamp; - time = - gst_segment_to_stream_time (&GST_BASE_VIDEO_CODEC (enc)->segment, + /* we start from the last seen time */ + time = dec->last_timestamp; + /* correct for the segment values */ + time = gst_segment_to_stream_time (&GST_BASE_VIDEO_CODEC (dec)->segment, GST_FORMAT_TIME, time); - gst_query_set_position (query, format, time); + GST_LOG_OBJECT (dec, + "query %p: our time: %" GST_TIME_FORMAT, query, GST_TIME_ARGS (time)); - res = TRUE; + /* and convert to the final format */ + gst_query_parse_position (query, &format, NULL); + if (!(res = gst_pad_query_convert (pad, GST_FORMAT_TIME, time, + &format, &value))) + break; + gst_query_set_position (query, format, value); + + GST_LOG_OBJECT (dec, + "query %p: we return %" G_GINT64_FORMAT " (format %u)", query, value, + format); break; } case GST_QUERY_DURATION: { - res = gst_pad_peer_query (enc->base_video_codec.sinkpad, query); + GstFormat format; + + /* upstream in any case */ + if ((res = gst_pad_query_default (pad, query))) + break; + + gst_query_parse_duration (query, &format, NULL); + /* try answering TIME by converting from BYTE if subclass allows */ + if (format == GST_FORMAT_TIME && gst_base_video_decoder_do_byte (dec)) { + gint64 value; + + format = GST_FORMAT_BYTES; + if (gst_pad_query_peer_duration (GST_BASE_VIDEO_CODEC_SINK_PAD (dec), + &format, &value)) { + GST_LOG_OBJECT (dec, "upstream size %" G_GINT64_FORMAT, value); + format = GST_FORMAT_TIME; + if (gst_pad_query_convert (GST_BASE_VIDEO_CODEC_SINK_PAD (dec), + GST_FORMAT_BYTES, value, &format, &value)) { + gst_query_set_duration (query, GST_FORMAT_TIME, value); + res = TRUE; + } + } + } break; } case GST_QUERY_CONVERT: @@ -571,12 +746,11 @@ gst_base_video_decoder_src_query (GstPad * pad, GstQuery * query) GstFormat src_fmt, dest_fmt; gint64 src_val, dest_val; - GST_DEBUG ("convert query"); + GST_DEBUG_OBJECT (dec, "convert query"); gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); - res = - gst_base_video_decoder_src_convert (pad, src_fmt, src_val, &dest_fmt, - &dest_val); + res = gst_base_video_rawvideo_convert (&GST_BASE_VIDEO_CODEC (dec)->state, + src_fmt, src_val, &dest_fmt, &dest_val); if (!res) goto error; gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); @@ -584,13 +758,13 @@ gst_base_video_decoder_src_query (GstPad * pad, GstQuery * query) } default: res = gst_pad_query_default (pad, query); - } - gst_object_unref (enc); + } + gst_object_unref (dec); return res; error: - GST_ERROR_OBJECT (enc, "query failed"); - gst_object_unref (enc); + GST_ERROR_OBJECT (dec, "query failed"); + gst_object_unref (dec); return res; } @@ -602,19 +776,19 @@ gst_base_video_decoder_sink_query (GstPad * pad, GstQuery * query) base_video_decoder = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); - GST_DEBUG_OBJECT (base_video_decoder, "sink query fps=%d/%d", - GST_BASE_VIDEO_CODEC (base_video_decoder)->state.fps_n, - GST_BASE_VIDEO_CODEC (base_video_decoder)->state.fps_d); + GST_LOG_OBJECT (base_video_decoder, "handling query: %" GST_PTR_FORMAT, + query); + switch (GST_QUERY_TYPE (query)) { case GST_QUERY_CONVERT: { + GstBaseVideoCodec *codec = GST_BASE_VIDEO_CODEC (base_video_decoder); GstFormat src_fmt, dest_fmt; gint64 src_val, dest_val; gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); - res = - gst_base_video_rawvideo_convert (&GST_BASE_VIDEO_CODEC - (base_video_decoder)->state, src_fmt, src_val, &dest_fmt, &dest_val); + res = gst_base_video_encoded_video_convert (&codec->state, codec->bytes, + codec->time, src_fmt, src_val, &dest_fmt, &dest_val); if (!res) goto error; gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); @@ -633,25 +807,6 @@ error: goto done; } - -#if 0 -static gboolean -gst_pad_is_negotiated (GstPad * pad) -{ - GstCaps *caps; - - g_return_val_if_fail (pad != NULL, FALSE); - - caps = gst_pad_get_negotiated_caps (pad); - if (caps) { - gst_caps_unref (caps); - return TRUE; - } - - return FALSE; -} -#endif - typedef struct _Timestamp Timestamp; struct _Timestamp { @@ -668,7 +823,8 @@ gst_base_video_decoder_add_timestamp (GstBaseVideoDecoder * base_video_decoder, ts = g_malloc (sizeof (Timestamp)); - GST_DEBUG ("adding timestamp %" GST_TIME_FORMAT " %" GST_TIME_FORMAT, + GST_LOG_OBJECT (base_video_decoder, + "adding timestamp %" GST_TIME_FORMAT " %" GST_TIME_FORMAT, GST_TIME_ARGS (base_video_decoder->input_offset), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer))); @@ -706,119 +862,86 @@ gst_base_video_decoder_get_timestamp_at_offset (GstBaseVideoDecoder * } } - GST_DEBUG ("got timestamp %" GST_TIME_FORMAT " %" GST_TIME_FORMAT, + GST_LOG_OBJECT (base_video_decoder, + "got timestamp %" GST_TIME_FORMAT " %" GST_TIME_FORMAT, GST_TIME_ARGS (offset), GST_TIME_ARGS (*timestamp)); } static void -gst_base_video_decoder_reset (GstBaseVideoDecoder * base_video_decoder) +gst_base_video_decoder_clear_queues (GstBaseVideoDecoder * dec) { - GstBaseVideoDecoderClass *base_video_decoder_class; + g_list_foreach (dec->queued, (GFunc) gst_mini_object_unref, NULL); + g_list_free (dec->queued); + dec->queued = NULL; + g_list_foreach (dec->gather, (GFunc) gst_mini_object_unref, NULL); + g_list_free (dec->gather); + dec->gather = NULL; + g_list_foreach (dec->decode, (GFunc) gst_base_video_decoder_free_frame, NULL); + g_list_free (dec->decode); + dec->decode = NULL; + g_list_foreach (dec->parse, (GFunc) gst_mini_object_unref, NULL); + g_list_free (dec->parse); + dec->decode = NULL; + g_list_foreach (dec->parse_gather, (GFunc) gst_base_video_decoder_free_frame, + NULL); + g_list_free (dec->parse_gather); + dec->decode = NULL; +} - base_video_decoder_class = - GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); +static void +gst_base_video_decoder_reset (GstBaseVideoDecoder * base_video_decoder, + gboolean full) +{ + GST_DEBUG_OBJECT (base_video_decoder, "reset full %d", full); - GST_DEBUG ("reset"); + if (full) { + gst_segment_init (&GST_BASE_VIDEO_CODEC (base_video_decoder)->segment, + GST_FORMAT_UNDEFINED); + gst_base_video_decoder_clear_queues (base_video_decoder); + base_video_decoder->error_count = 0; + } - base_video_decoder->started = FALSE; - - base_video_decoder->discont = TRUE; + GST_BASE_VIDEO_CODEC (base_video_decoder)->discont = TRUE; base_video_decoder->have_sync = FALSE; base_video_decoder->timestamp_offset = GST_CLOCK_TIME_NONE; - GST_BASE_VIDEO_CODEC (base_video_decoder)->system_frame_number = 0; - base_video_decoder->presentation_frame_number = 0; - base_video_decoder->base_picture_number = 0; + base_video_decoder->field_index = 0; base_video_decoder->last_timestamp = GST_CLOCK_TIME_NONE; base_video_decoder->input_offset = 0; base_video_decoder->frame_offset = 0; - - /* This function could be called from finalize() */ - if (base_video_decoder->input_adapter) { - gst_adapter_clear (base_video_decoder->input_adapter); - } - if (base_video_decoder->output_adapter) { - gst_adapter_clear (base_video_decoder->output_adapter); - } - //gst_segment_init (&base_video_decoder->segment, GST_FORMAT_TIME); + gst_adapter_clear (base_video_decoder->input_adapter); + gst_adapter_clear (base_video_decoder->output_adapter); + g_list_foreach (base_video_decoder->timestamps, (GFunc) g_free, NULL); + g_list_free (base_video_decoder->timestamps); + base_video_decoder->timestamps = NULL; if (base_video_decoder->current_frame) { gst_base_video_decoder_free_frame (base_video_decoder->current_frame); base_video_decoder->current_frame = NULL; } - base_video_decoder->have_src_caps = FALSE; + GST_BASE_VIDEO_CODEC (base_video_decoder)->system_frame_number = 0; + base_video_decoder->base_picture_number = 0; GST_OBJECT_LOCK (base_video_decoder); GST_BASE_VIDEO_CODEC (base_video_decoder)->earliest_time = GST_CLOCK_TIME_NONE; GST_BASE_VIDEO_CODEC (base_video_decoder)->proportion = 0.5; GST_OBJECT_UNLOCK (base_video_decoder); - - if (base_video_decoder_class->reset) { - base_video_decoder_class->reset (base_video_decoder); - } } static GstFlowReturn -gst_base_video_decoder_chain (GstPad * pad, GstBuffer * buf) +gst_base_video_decoder_chain_forward (GstBaseVideoDecoder * base_video_decoder, + GstBuffer * buf) { - GstBaseVideoDecoder *base_video_decoder; GstBaseVideoDecoderClass *klass; GstFlowReturn ret; - GST_DEBUG ("chain %" GST_TIME_FORMAT " duration %" GST_TIME_FORMAT, - GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)), - GST_TIME_ARGS (GST_BUFFER_DURATION (buf))); - -#if 0 - /* requiring the pad to be negotiated makes it impossible to use - * oggdemux or filesrc ! decoder */ - if (!gst_pad_is_negotiated (pad)) { - GST_DEBUG ("not negotiated"); - return GST_FLOW_NOT_NEGOTIATED; - } -#endif - - base_video_decoder = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad)); klass = GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); - GST_DEBUG_OBJECT (base_video_decoder, "chain"); - - if (!base_video_decoder->have_segment) { - GstEvent *event; - GstFlowReturn ret; - - GST_WARNING - ("Received buffer without a new-segment. Assuming timestamps start from 0."); - - gst_segment_set_newsegment_full (&GST_BASE_VIDEO_CODEC - (base_video_decoder)->segment, FALSE, 1.0, 1.0, GST_FORMAT_TIME, 0, - GST_CLOCK_TIME_NONE, 0); - base_video_decoder->have_segment = TRUE; - - event = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, - GST_CLOCK_TIME_NONE, 0); - - ret = - gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), - event); - if (!ret) { - GST_ERROR ("new segment event ret=%d", ret); - return GST_FLOW_ERROR; - } - } - - if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DISCONT))) { - GST_DEBUG_OBJECT (base_video_decoder, "received DISCONT buffer"); - gst_base_video_decoder_reset (base_video_decoder); - } - - if (!base_video_decoder->started) { - klass->start (base_video_decoder); - base_video_decoder->started = TRUE; - } + g_return_val_if_fail (base_video_decoder->packetized || klass->parse_data, + GST_FLOW_ERROR); if (base_video_decoder->current_frame == NULL) { base_video_decoder->current_frame = @@ -830,18 +953,12 @@ gst_base_video_decoder_chain (GstPad * pad, GstBuffer * buf) } base_video_decoder->input_offset += GST_BUFFER_SIZE (buf); -#if 0 - if (base_video_decoder->timestamp_offset == GST_CLOCK_TIME_NONE && - GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) { - GST_DEBUG ("got new offset %" GST_TIME_FORMAT, - GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf))); - base_video_decoder->timestamp_offset = GST_BUFFER_TIMESTAMP (buf); - } -#endif - if (base_video_decoder->packetized) { base_video_decoder->current_frame->sink_buffer = buf; + if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT)) + base_video_decoder->current_frame->is_sync_point = TRUE; + ret = gst_base_video_decoder_have_frame_2 (base_video_decoder); } else { @@ -850,7 +967,7 @@ gst_base_video_decoder_chain (GstPad * pad, GstBuffer * buf) if (!base_video_decoder->have_sync) { int n, m; - GST_DEBUG ("no sync, scanning"); + GST_DEBUG_OBJECT (base_video_decoder, "no sync, scanning"); n = gst_adapter_available (base_video_decoder->input_adapter); if (klass->capture_mask != 0) { @@ -862,21 +979,22 @@ gst_base_video_decoder_chain (GstPad * pad, GstBuffer * buf) m = 0; } if (m == -1) { - GST_ERROR ("scan returned no sync"); + GST_ERROR_OBJECT (base_video_decoder, "scan returned no sync"); gst_adapter_flush (base_video_decoder->input_adapter, n - 3); - gst_object_unref (base_video_decoder); return GST_FLOW_OK; } else { if (m > 0) { if (m >= n) { - GST_ERROR ("subclass scanned past end %d >= %d", m, n); + GST_ERROR_OBJECT (base_video_decoder, + "subclass scanned past end %d >= %d", m, n); } gst_adapter_flush (base_video_decoder->input_adapter, m); if (m < n) { - GST_DEBUG ("found possible sync after %d bytes (of %d)", m, n); + GST_DEBUG_OBJECT (base_video_decoder, + "found possible sync after %d bytes (of %d)", m, n); /* this is only "maybe" sync */ base_video_decoder->have_sync = TRUE; @@ -891,15 +1009,237 @@ gst_base_video_decoder_chain (GstPad * pad, GstBuffer * buf) } while (ret == GST_FLOW_OK); if (ret == GST_BASE_VIDEO_DECODER_FLOW_NEED_DATA) { - gst_object_unref (base_video_decoder); return GST_FLOW_OK; } } - gst_object_unref (base_video_decoder); return ret; } +static GstFlowReturn +gst_base_video_decoder_flush_decode (GstBaseVideoDecoder * dec) +{ + GstFlowReturn res = GST_FLOW_OK; + GList *walk; + + walk = dec->decode; + + GST_DEBUG_OBJECT (dec, "flushing buffers to decode"); + + /* clear buffer and decoder state */ + gst_base_video_decoder_flush (dec, FALSE); + + /* signal have_frame it should not capture frames */ + dec->process = TRUE; + + while (walk) { + GList *next; + GstVideoFrame *frame = (GstVideoFrame *) (walk->data); + GstBuffer *buf = frame->sink_buffer; + + GST_DEBUG_OBJECT (dec, "decoding frame %p, ts %" GST_TIME_FORMAT, + buf, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf))); + + next = g_list_next (walk); + if (dec->current_frame) + gst_base_video_decoder_free_frame (dec->current_frame); + dec->current_frame = frame; + /* decode buffer, resulting data prepended to queue */ + res = gst_base_video_decoder_have_frame_2 (dec); + + walk = next; + } + + dec->process = FALSE; + + return res; +} + +static GstFlowReturn +gst_base_video_decoder_flush_parse (GstBaseVideoDecoder * dec) +{ + GstFlowReturn res = GST_FLOW_OK; + GList *walk; + + walk = dec->parse; + + GST_DEBUG_OBJECT (dec, "flushing buffers to parsing"); + + /* clear buffer and decoder state */ + gst_base_video_decoder_flush (dec, FALSE); + + while (walk) { + GList *next; + GstBuffer *buf = GST_BUFFER_CAST (walk->data); + + GST_DEBUG_OBJECT (dec, "parsing buffer %p, ts %" GST_TIME_FORMAT, + buf, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf))); + + next = g_list_next (walk); + /* parse buffer, resulting frames prepended to parse_gather queue */ + gst_buffer_ref (buf); + res = gst_base_video_decoder_chain_forward (dec, buf); + + /* if we generated output, we can discard the buffer, else we + * keep it in the queue */ + if (dec->parse_gather) { + GST_DEBUG_OBJECT (dec, "parsed buffer to %p", dec->parse_gather->data); + dec->parse = g_list_delete_link (dec->parse, walk); + gst_buffer_unref (buf); + } else { + GST_DEBUG_OBJECT (dec, "buffer did not decode, keeping"); + } + walk = next; + } + + /* now we can process frames */ + GST_DEBUG_OBJECT (dec, "checking frames"); + while (dec->parse_gather) { + GstVideoFrame *frame; + + frame = (GstVideoFrame *) (dec->parse_gather->data); + /* remove from the gather list */ + dec->parse_gather = + g_list_delete_link (dec->parse_gather, dec->parse_gather); + /* copy to decode queue */ + dec->decode = g_list_prepend (dec->decode, frame); + + /* if we copied a keyframe, flush and decode the decode queue */ + if (frame->is_sync_point) { + GST_DEBUG_OBJECT (dec, "copied keyframe"); + res = gst_base_video_decoder_flush_decode (dec); + } + } + + /* now send queued data downstream */ + while (dec->queued) { + GstBuffer *buf = GST_BUFFER_CAST (dec->queued->data); + + if (G_LIKELY (res == GST_FLOW_OK)) { + GST_DEBUG_OBJECT (dec, "pushing buffer %p of size %u, " + "time %" GST_TIME_FORMAT ", dur %" GST_TIME_FORMAT, buf, + GST_BUFFER_SIZE (buf), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)), + GST_TIME_ARGS (GST_BUFFER_DURATION (buf))); + /* should be already, but let's be sure */ + buf = gst_buffer_make_metadata_writable (buf); + /* avoid stray DISCONT from forward processing, + * which have no meaning in reverse pushing */ + GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DISCONT); + res = gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (dec), buf); + } else { + gst_buffer_unref (buf); + } + + dec->queued = g_list_delete_link (dec->queued, dec->queued); + } + + return res; +} + +static GstFlowReturn +gst_base_video_decoder_chain_reverse (GstBaseVideoDecoder * dec, + GstBuffer * buf) +{ + GstFlowReturn result = GST_FLOW_OK; + + /* if we have a discont, move buffers to the decode list */ + if (!buf || GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DISCONT)) { + GST_DEBUG_OBJECT (dec, "received discont"); + while (dec->gather) { + GstBuffer *gbuf; + + gbuf = GST_BUFFER_CAST (dec->gather->data); + /* remove from the gather list */ + dec->gather = g_list_delete_link (dec->gather, dec->gather); + /* copy to parse queue */ + dec->parse = g_list_prepend (dec->parse, gbuf); + } + /* parse and decode stuff in the parse queue */ + gst_base_video_decoder_flush_parse (dec); + } + + if (G_LIKELY (buf)) { + GST_DEBUG_OBJECT (dec, "gathering buffer %p of size %u, " + "time %" GST_TIME_FORMAT ", dur %" GST_TIME_FORMAT, buf, + GST_BUFFER_SIZE (buf), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)), + GST_TIME_ARGS (GST_BUFFER_DURATION (buf))); + + /* add buffer to gather queue */ + dec->gather = g_list_prepend (dec->gather, buf); + } + + return result; +} + +static GstFlowReturn +gst_base_video_decoder_chain (GstPad * pad, GstBuffer * buf) +{ + GstBaseVideoDecoder *base_video_decoder; + + base_video_decoder = GST_BASE_VIDEO_DECODER (GST_PAD_PARENT (pad)); + + GST_LOG_OBJECT (base_video_decoder, + "chain %" 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)); + + /* NOTE: + * requiring the pad to be negotiated makes it impossible to use + * oggdemux or filesrc ! decoder */ + + if (GST_BASE_VIDEO_CODEC (base_video_decoder)->segment.format == + GST_FORMAT_UNDEFINED) { + GstEvent *event; + GstFlowReturn ret; + + GST_WARNING_OBJECT (base_video_decoder, + "Received buffer without a new-segment. " + "Assuming timestamps start from 0."); + + gst_segment_set_newsegment_full (&GST_BASE_VIDEO_CODEC + (base_video_decoder)->segment, FALSE, 1.0, 1.0, GST_FORMAT_TIME, 0, + GST_CLOCK_TIME_NONE, 0); + + event = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, + GST_CLOCK_TIME_NONE, 0); + + ret = + gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), + event); + if (!ret) { + GST_ERROR_OBJECT (base_video_decoder, "new segment event ret=%d", ret); + return GST_FLOW_ERROR; + } + } + + if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DISCONT))) { + gint64 ts, index; + + GST_DEBUG_OBJECT (base_video_decoder, "received DISCONT buffer"); + gst_base_video_decoder_flush (base_video_decoder, FALSE); + + /* track present position */ + ts = base_video_decoder->timestamp_offset; + index = base_video_decoder->field_index; + + /* buffer may claim DISCONT loudly, if it can't tell us where we are now, + * we'll stick to where we were ... + * Particularly useful/needed for upstream BYTE based */ + if (GST_BASE_VIDEO_CODEC (base_video_decoder)->segment.rate > 0.0 && + !GST_BUFFER_TIMESTAMP_IS_VALID (buf)) { + GST_DEBUG_OBJECT (base_video_decoder, + "... but restoring previous ts tracking"); + base_video_decoder->timestamp_offset = ts; + base_video_decoder->field_index = index & ~1; + } + } + + if (GST_BASE_VIDEO_CODEC (base_video_decoder)->segment.rate > 0.0) + return gst_base_video_decoder_chain_forward (base_video_decoder, buf); + else + return gst_base_video_decoder_chain_reverse (base_video_decoder, buf); +} + static GstStateChangeReturn gst_base_video_decoder_change_state (GstElement * element, GstStateChange transition) @@ -912,6 +1252,10 @@ gst_base_video_decoder_change_state (GstElement * element, base_video_decoder_class = GST_BASE_VIDEO_DECODER_GET_CLASS (element); switch (transition) { + case GST_STATE_CHANGE_READY_TO_PAUSED: + if (base_video_decoder_class->start) { + base_video_decoder_class->start (base_video_decoder); + } default: break; } @@ -923,11 +1267,7 @@ gst_base_video_decoder_change_state (GstElement * element, if (base_video_decoder_class->stop) { base_video_decoder_class->stop (base_video_decoder); } - gst_segment_init (&GST_BASE_VIDEO_CODEC (base_video_decoder)->segment, - GST_FORMAT_TIME); - g_list_foreach (base_video_decoder->timestamps, (GFunc) g_free, NULL); - g_list_free (base_video_decoder->timestamps); - base_video_decoder->timestamps = NULL; + gst_base_video_decoder_reset (base_video_decoder, TRUE); break; default: break; @@ -973,29 +1313,40 @@ gst_base_video_decoder_new_frame (GstBaseVideoDecoder * base_video_decoder) return frame; } +/** + * gst_base_video_decoder_finish_frame: + * @base_video_decoder: a #GstBaseVideoDecoder + * @frame: a decoded #GstVideoFrame + * + * @frame should have a valid decoded data buffer, whose metadata fields + * are then appropriately set according to frame data and pushed downstream. + * If no output data is provided, @frame is considered skipped. + * In any case, the frame is considered finished and released. + * + * Returns: a #GstFlowReturn resulting from sending data downstream + */ GstFlowReturn gst_base_video_decoder_finish_frame (GstBaseVideoDecoder * base_video_decoder, GstVideoFrame * frame) { - GstBaseVideoDecoderClass *base_video_decoder_class; GstVideoState *state = &GST_BASE_VIDEO_CODEC (base_video_decoder)->state; GstBuffer *src_buffer; + GstFlowReturn ret = GST_FLOW_OK; - GST_DEBUG ("finish frame"); - GST_DEBUG ("n %d in %d out %d", + GST_LOG_OBJECT (base_video_decoder, "finish frame"); + GST_LOG_OBJECT (base_video_decoder, "n %d in %d out %d", g_list_length (GST_BASE_VIDEO_CODEC (base_video_decoder)->frames), gst_adapter_available (base_video_decoder->input_adapter), gst_adapter_available (base_video_decoder->output_adapter)); - base_video_decoder_class = - GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); - - GST_DEBUG ("finish frame sync=%d pts=%" GST_TIME_FORMAT, frame->is_sync_point, + GST_LOG_OBJECT (base_video_decoder, + "finish frame sync=%d pts=%" GST_TIME_FORMAT, frame->is_sync_point, GST_TIME_ARGS (frame->presentation_timestamp)); if (GST_CLOCK_TIME_IS_VALID (frame->presentation_timestamp)) { if (frame->presentation_timestamp != base_video_decoder->timestamp_offset) { - GST_DEBUG ("sync timestamp %" GST_TIME_FORMAT " diff %" GST_TIME_FORMAT, + GST_DEBUG_OBJECT (base_video_decoder, + "sync timestamp %" GST_TIME_FORMAT " diff %" GST_TIME_FORMAT, GST_TIME_ARGS (frame->presentation_timestamp), GST_TIME_ARGS (frame->presentation_timestamp - GST_BASE_VIDEO_CODEC (base_video_decoder)->segment.start)); @@ -1004,15 +1355,17 @@ gst_base_video_decoder_finish_frame (GstBaseVideoDecoder * base_video_decoder, } else { /* This case is for one initial timestamp and no others, e.g., * filesrc ! decoder ! xvimagesink */ - GST_WARNING ("sync timestamp didn't change, ignoring"); + GST_WARNING_OBJECT (base_video_decoder, + "sync timestamp didn't change, ignoring"); frame->presentation_timestamp = GST_CLOCK_TIME_NONE; } } else { if (frame->is_sync_point) { - GST_WARNING ("sync point doesn't have timestamp"); + GST_WARNING_OBJECT (base_video_decoder, + "sync point doesn't have timestamp"); if (!GST_CLOCK_TIME_IS_VALID (base_video_decoder->timestamp_offset)) { - GST_WARNING - ("No base timestamp. Assuming frames start at segment start"); + GST_WARNING_OBJECT (base_video_decoder, + "No base timestamp. Assuming frames start at segment start"); base_video_decoder->timestamp_offset = GST_BASE_VIDEO_CODEC (base_video_decoder)->segment.start; base_video_decoder->field_index &= 1; @@ -1039,14 +1392,25 @@ gst_base_video_decoder_finish_frame (GstBaseVideoDecoder * base_video_decoder, if (GST_CLOCK_TIME_IS_VALID (base_video_decoder->last_timestamp)) { if (frame->presentation_timestamp < base_video_decoder->last_timestamp) { - GST_WARNING ("decreasing timestamp (%" GST_TIME_FORMAT " < %" + GST_WARNING_OBJECT (base_video_decoder, + "decreasing timestamp (%" GST_TIME_FORMAT " < %" GST_TIME_FORMAT ")", GST_TIME_ARGS (frame->presentation_timestamp), GST_TIME_ARGS (base_video_decoder->last_timestamp)); } } base_video_decoder->last_timestamp = frame->presentation_timestamp; - GST_BUFFER_FLAG_UNSET (frame->src_buffer, GST_BUFFER_FLAG_DELTA_UNIT); + /* no buffer data means this frame is skipped/dropped */ + if (!frame->src_buffer) { + GST_DEBUG_OBJECT (base_video_decoder, "skipping frame %" GST_TIME_FORMAT, + GST_TIME_ARGS (frame->presentation_timestamp)); + goto done; + } + + src_buffer = gst_buffer_make_metadata_writable (frame->src_buffer); + frame->src_buffer = NULL; + + GST_BUFFER_FLAG_UNSET (src_buffer, GST_BUFFER_FLAG_DELTA_UNIT); if (state->interlaced) { int tff = state->top_field_first; @@ -1054,40 +1418,46 @@ gst_base_video_decoder_finish_frame (GstBaseVideoDecoder * base_video_decoder, tff ^= 1; } if (tff) { - GST_BUFFER_FLAG_SET (frame->src_buffer, GST_VIDEO_BUFFER_TFF); + GST_BUFFER_FLAG_SET (src_buffer, GST_VIDEO_BUFFER_TFF); } else { - GST_BUFFER_FLAG_UNSET (frame->src_buffer, GST_VIDEO_BUFFER_TFF); + GST_BUFFER_FLAG_UNSET (src_buffer, GST_VIDEO_BUFFER_TFF); } - GST_BUFFER_FLAG_UNSET (frame->src_buffer, GST_VIDEO_BUFFER_RFF); - GST_BUFFER_FLAG_UNSET (frame->src_buffer, GST_VIDEO_BUFFER_ONEFIELD); + GST_BUFFER_FLAG_UNSET (src_buffer, GST_VIDEO_BUFFER_RFF); + GST_BUFFER_FLAG_UNSET (src_buffer, GST_VIDEO_BUFFER_ONEFIELD); if (frame->n_fields == 3) { - GST_BUFFER_FLAG_SET (frame->src_buffer, GST_VIDEO_BUFFER_RFF); + GST_BUFFER_FLAG_SET (src_buffer, GST_VIDEO_BUFFER_RFF); } else if (frame->n_fields == 1) { - GST_BUFFER_FLAG_SET (frame->src_buffer, GST_VIDEO_BUFFER_ONEFIELD); + GST_BUFFER_FLAG_SET (src_buffer, GST_VIDEO_BUFFER_ONEFIELD); } } - if (base_video_decoder->discont) { - GST_BUFFER_FLAG_SET (frame->src_buffer, GST_BUFFER_FLAG_DISCONT); - base_video_decoder->discont = FALSE; + if (GST_BASE_VIDEO_CODEC (base_video_decoder)->discont) { + GST_BUFFER_FLAG_SET (src_buffer, GST_BUFFER_FLAG_DISCONT); + GST_BASE_VIDEO_CODEC (base_video_decoder)->discont = FALSE; } - GST_BUFFER_TIMESTAMP (frame->src_buffer) = frame->presentation_timestamp; - GST_BUFFER_DURATION (frame->src_buffer) = frame->presentation_duration; - GST_BUFFER_OFFSET (frame->src_buffer) = GST_BUFFER_OFFSET_NONE; - GST_BUFFER_OFFSET_END (frame->src_buffer) = GST_BUFFER_OFFSET_NONE; + GST_BUFFER_TIMESTAMP (src_buffer) = frame->presentation_timestamp; + GST_BUFFER_DURATION (src_buffer) = frame->presentation_duration; + GST_BUFFER_OFFSET (src_buffer) = GST_BUFFER_OFFSET_NONE; + GST_BUFFER_OFFSET_END (src_buffer) = GST_BUFFER_OFFSET_NONE; - GST_DEBUG ("pushing frame %" GST_TIME_FORMAT, - GST_TIME_ARGS (frame->presentation_timestamp)); + /* update rate estimate */ + GST_BASE_VIDEO_CODEC (base_video_decoder)->bytes += + GST_BUFFER_SIZE (src_buffer); + if (GST_CLOCK_TIME_IS_VALID (frame->presentation_duration)) { + GST_BASE_VIDEO_CODEC (base_video_decoder)->time += + frame->presentation_duration; + } else { + /* better none than nothing valid */ + GST_BASE_VIDEO_CODEC (base_video_decoder)->time = GST_CLOCK_TIME_NONE; + } - GST_BASE_VIDEO_CODEC (base_video_decoder)->frames = - g_list_remove (GST_BASE_VIDEO_CODEC (base_video_decoder)->frames, frame); + gst_buffer_set_caps (src_buffer, + GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder))); - gst_base_video_decoder_set_src_caps (base_video_decoder); - - src_buffer = frame->src_buffer; - frame->src_buffer = NULL; - - gst_base_video_decoder_free_frame (frame); + GST_LOG_OBJECT (base_video_decoder, "pushing frame ts %" GST_TIME_FORMAT + ", duration %" GST_TIME_FORMAT, + GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (src_buffer)), + GST_TIME_ARGS (GST_BUFFER_DURATION (src_buffer))); if (base_video_decoder->sink_clipping) { gint64 start = GST_BUFFER_TIMESTAMP (src_buffer); @@ -1098,7 +1468,8 @@ gst_base_video_decoder_finish_frame (GstBaseVideoDecoder * base_video_decoder, if (gst_segment_clip (segment, GST_FORMAT_TIME, start, stop, &start, &stop)) { GST_BUFFER_TIMESTAMP (src_buffer) = start; GST_BUFFER_DURATION (src_buffer) = stop - start; - GST_DEBUG ("accepting buffer inside segment: %" GST_TIME_FORMAT + GST_LOG_OBJECT (base_video_decoder, + "accepting buffer inside segment: %" GST_TIME_FORMAT " %" GST_TIME_FORMAT " seg %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT " time %" GST_TIME_FORMAT, @@ -1108,7 +1479,8 @@ gst_base_video_decoder_finish_frame (GstBaseVideoDecoder * base_video_decoder, GST_TIME_ARGS (segment->start), GST_TIME_ARGS (segment->stop), GST_TIME_ARGS (segment->time)); } else { - GST_DEBUG ("dropping buffer outside segment: %" GST_TIME_FORMAT + GST_LOG_OBJECT (base_video_decoder, + "dropping buffer outside segment: %" GST_TIME_FORMAT " %" GST_TIME_FORMAT " seg %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT " time %" GST_TIME_FORMAT, @@ -1122,117 +1494,41 @@ gst_base_video_decoder_finish_frame (GstBaseVideoDecoder * base_video_decoder, } } - return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), - src_buffer); -} + /* we got data, so note things are looking up again */ + if (G_UNLIKELY (base_video_decoder->error_count)) + base_video_decoder->error_count--; -GstFlowReturn -gst_base_video_decoder_skip_frame (GstBaseVideoDecoder * base_video_decoder, - GstVideoFrame * frame) -{ - GstBaseVideoDecoderClass *base_video_decoder_class; - - GST_DEBUG ("finish frame"); - - base_video_decoder_class = - GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); - - GST_DEBUG ("finish frame sync=%d pts=%" GST_TIME_FORMAT, frame->is_sync_point, - GST_TIME_ARGS (frame->presentation_timestamp)); - - if (GST_CLOCK_TIME_IS_VALID (frame->presentation_timestamp)) { - if (frame->presentation_timestamp != base_video_decoder->timestamp_offset) { - GST_DEBUG ("sync timestamp %" GST_TIME_FORMAT " diff %" GST_TIME_FORMAT, - GST_TIME_ARGS (frame->presentation_timestamp), - GST_TIME_ARGS (frame->presentation_timestamp - - GST_BASE_VIDEO_CODEC (base_video_decoder)->segment.start)); - base_video_decoder->timestamp_offset = frame->presentation_timestamp; - base_video_decoder->field_index = 0; - } else { - /* This case is for one initial timestamp and no others, e.g., - * filesrc ! decoder ! xvimagesink */ - GST_WARNING ("sync timestamp didn't change, ignoring"); - frame->presentation_timestamp = GST_CLOCK_TIME_NONE; - } + if (GST_BASE_VIDEO_CODEC (base_video_decoder)->segment.rate < 0.0) { + GST_LOG_OBJECT (base_video_decoder, "queued buffer"); + base_video_decoder->queued = + g_list_prepend (base_video_decoder->queued, src_buffer); } else { - if (frame->is_sync_point) { - GST_WARNING ("sync point doesn't have timestamp"); - if (GST_CLOCK_TIME_IS_VALID (base_video_decoder->timestamp_offset)) { - GST_WARNING - ("No base timestamp. Assuming frames start at segment start"); - base_video_decoder->timestamp_offset = - GST_BASE_VIDEO_CODEC (base_video_decoder)->segment.start; - base_video_decoder->field_index = 0; - } - } - } - frame->field_index = base_video_decoder->field_index; - base_video_decoder->field_index += frame->n_fields; - - if (frame->presentation_timestamp == GST_CLOCK_TIME_NONE) { - frame->presentation_timestamp = - gst_base_video_decoder_get_field_timestamp (base_video_decoder, - frame->field_index); - frame->presentation_duration = GST_CLOCK_TIME_NONE; - frame->decode_timestamp = - gst_base_video_decoder_get_timestamp (base_video_decoder, - frame->decode_frame_number); - } - if (frame->presentation_duration == GST_CLOCK_TIME_NONE) { - frame->presentation_duration = - gst_base_video_decoder_get_field_duration (base_video_decoder, - frame->n_fields); + ret = gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), + src_buffer); } - base_video_decoder->last_timestamp = frame->presentation_timestamp; - - GST_DEBUG ("skipping frame %" GST_TIME_FORMAT, - GST_TIME_ARGS (frame->presentation_timestamp)); - +done: GST_BASE_VIDEO_CODEC (base_video_decoder)->frames = g_list_remove (GST_BASE_VIDEO_CODEC (base_video_decoder)->frames, frame); - gst_base_video_decoder_free_frame (frame); - return GST_FLOW_OK; -} - -int -gst_base_video_decoder_get_height (GstBaseVideoDecoder * base_video_decoder) -{ - GstVideoState *state = &GST_BASE_VIDEO_CODEC (base_video_decoder)->state; - - return state->height; -} - -int -gst_base_video_decoder_get_width (GstBaseVideoDecoder * base_video_decoder) -{ - GstVideoState *state = &GST_BASE_VIDEO_CODEC (base_video_decoder)->state; - - return state->width; -} - -GstFlowReturn -gst_base_video_decoder_end_of_stream (GstBaseVideoDecoder * base_video_decoder, - GstBuffer * buffer) -{ - - if (GST_BASE_VIDEO_CODEC (base_video_decoder)->frames) { - GST_DEBUG ("EOS with frames left over"); - } - - return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), - buffer); + return ret; } +/** + * gst_base_video_decoder_finish_frame: + * @base_video_decoder: a #GstBaseVideoDecoder + * @n_bytes: an encoded #GstVideoFrame + * + * Removes next @n_bytes of input data and adds it to currently parsed frame. + */ void gst_base_video_decoder_add_to_frame (GstBaseVideoDecoder * base_video_decoder, int n_bytes) { GstBuffer *buf; - GST_DEBUG ("add to frame"); + GST_LOG_OBJECT (base_video_decoder, "add %d bytes to frame", n_bytes); if (n_bytes == 0) return; @@ -1252,7 +1548,7 @@ gst_base_video_decoder_get_timestamp (GstBaseVideoDecoder * base_video_decoder, { GstVideoState *state = &GST_BASE_VIDEO_CODEC (base_video_decoder)->state; - if (state->fps_d == 0) { + if (state->fps_d == 0 || state->fps_n == 0) { return -1; } if (picture_number < base_video_decoder->base_picture_number) { @@ -1273,11 +1569,11 @@ gst_base_video_decoder_get_field_timestamp (GstBaseVideoDecoder * { GstVideoState *state = &GST_BASE_VIDEO_CODEC (base_video_decoder)->state; - if (state->fps_d == 0) { + if (state->fps_d == 0 || state->fps_n == 0) { return GST_CLOCK_TIME_NONE; } if (field_offset < 0) { - GST_WARNING ("field offset < 0"); + GST_WARNING_OBJECT (base_video_decoder, "field offset < 0"); return GST_CLOCK_TIME_NONE; } return base_video_decoder->timestamp_offset + @@ -1291,18 +1587,26 @@ gst_base_video_decoder_get_field_duration (GstBaseVideoDecoder * { GstVideoState *state = &GST_BASE_VIDEO_CODEC (base_video_decoder)->state; - if (state->fps_d == 0) { + if (state->fps_d == 0 || state->fps_n == 0) { return GST_CLOCK_TIME_NONE; } if (n_fields < 0) { - GST_WARNING ("n_fields < 0"); + GST_WARNING_OBJECT (base_video_decoder, "n_fields < 0"); return GST_CLOCK_TIME_NONE; } return gst_util_uint64_scale (n_fields, state->fps_d * GST_SECOND, state->fps_n * 2); } - +/** + * gst_base_video_decoder_have_frame: + * @base_video_decoder: a #GstBaseVideoDecoder + * + * Gathers all data collected for currently parsed frame, gathers corresponding + * metadata and passes it along for further processing, i.e. @handle_frame. + * + * Returns: a #GstFlowReturn + */ GstFlowReturn gst_base_video_decoder_have_frame (GstBaseVideoDecoder * base_video_decoder) { @@ -1311,7 +1615,7 @@ gst_base_video_decoder_have_frame (GstBaseVideoDecoder * base_video_decoder) GstClockTime timestamp; GstClockTime duration; - GST_DEBUG ("have_frame"); + GST_LOG_OBJECT (base_video_decoder, "have_frame"); n_available = gst_adapter_available (base_video_decoder->output_adapter); if (n_available) { @@ -1329,6 +1633,10 @@ gst_base_video_decoder_have_frame (GstBaseVideoDecoder * base_video_decoder) GST_BUFFER_TIMESTAMP (buffer) = timestamp; GST_BUFFER_DURATION (buffer) = duration; + GST_LOG_OBJECT (base_video_decoder, "collected frame size %d, " + "ts %" GST_TIME_FORMAT ", dur %" GST_TIME_FORMAT, + n_available, GST_TIME_ARGS (timestamp), GST_TIME_ARGS (duration)); + return gst_base_video_decoder_have_frame_2 (base_video_decoder); } @@ -1342,16 +1650,28 @@ gst_base_video_decoder_have_frame_2 (GstBaseVideoDecoder * base_video_decoder) base_video_decoder_class = GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); + g_return_val_if_fail (base_video_decoder_class->handle_frame != NULL, + GST_FLOW_ERROR); + + /* capture frames and queue for later processing */ + if (GST_BASE_VIDEO_CODEC (base_video_decoder)->segment.rate < 0.0 && + !base_video_decoder->process) { + base_video_decoder->parse_gather = + g_list_prepend (base_video_decoder->parse_gather, frame); + goto exit; + } + frame->distance_from_sync = base_video_decoder->distance_from_sync; base_video_decoder->distance_from_sync++; frame->presentation_timestamp = GST_BUFFER_TIMESTAMP (frame->sink_buffer); frame->presentation_duration = GST_BUFFER_DURATION (frame->sink_buffer); - GST_DEBUG ("pts %" GST_TIME_FORMAT, + GST_LOG_OBJECT (base_video_decoder, "pts %" GST_TIME_FORMAT, GST_TIME_ARGS (frame->presentation_timestamp)); - GST_DEBUG ("dts %" GST_TIME_FORMAT, GST_TIME_ARGS (frame->decode_timestamp)); - GST_DEBUG ("dist %d", frame->distance_from_sync); + GST_LOG_OBJECT (base_video_decoder, "dts %" GST_TIME_FORMAT, + GST_TIME_ARGS (frame->decode_timestamp)); + GST_LOG_OBJECT (base_video_decoder, "dist %d", frame->distance_from_sync); GST_BASE_VIDEO_CODEC (base_video_decoder)->frames = g_list_append (GST_BASE_VIDEO_CODEC (base_video_decoder)->frames, frame); @@ -1364,9 +1684,11 @@ gst_base_video_decoder_have_frame_2 (GstBaseVideoDecoder * base_video_decoder) /* do something with frame */ ret = base_video_decoder_class->handle_frame (base_video_decoder, frame); if (ret != GST_FLOW_OK) { - GST_DEBUG ("flow error!"); + GST_DEBUG_OBJECT (base_video_decoder, "flow error %s", + gst_flow_get_name (ret)); } +exit: /* create new frame */ base_video_decoder->current_frame = gst_base_video_decoder_new_frame (base_video_decoder); @@ -1374,28 +1696,30 @@ gst_base_video_decoder_have_frame_2 (GstBaseVideoDecoder * base_video_decoder) return ret; } +/** + * gst_base_video_decoder_get_state: + * @base_video_decoder: a #GstBaseVideoDecoder + * + * Returns: #GstVideoState describing format of video data. + */ GstVideoState * gst_base_video_decoder_get_state (GstBaseVideoDecoder * base_video_decoder) { return &GST_BASE_VIDEO_CODEC (base_video_decoder)->state; - -} - -void -gst_base_video_decoder_set_state (GstBaseVideoDecoder * base_video_decoder, - GstVideoState * state) -{ - memcpy (&GST_BASE_VIDEO_CODEC (base_video_decoder)->state, - state, sizeof (*state)); - } +/** + * gst_base_video_decoder_lost_sync: + * @base_video_decoder: a #GstBaseVideoDecoder + * + * Advances out-of-sync input data by 1 byte and marks it accordingly. + */ void gst_base_video_decoder_lost_sync (GstBaseVideoDecoder * base_video_decoder) { g_return_if_fail (GST_IS_BASE_VIDEO_DECODER (base_video_decoder)); - GST_DEBUG ("lost_sync"); + GST_DEBUG_OBJECT (base_video_decoder, "lost_sync"); if (gst_adapter_available (base_video_decoder->input_adapter) >= 1) { gst_adapter_flush (base_video_decoder->input_adapter, 1); @@ -1404,15 +1728,28 @@ gst_base_video_decoder_lost_sync (GstBaseVideoDecoder * base_video_decoder) base_video_decoder->have_sync = FALSE; } +/* FIXME not quite exciting; get rid of this ? */ +/** + * gst_base_video_decoder_set_sync_point: + * @base_video_decoder: a #GstBaseVideoDecoder + * + * Marks current frame as a sync point, i.e. keyframe. + */ void gst_base_video_decoder_set_sync_point (GstBaseVideoDecoder * base_video_decoder) { - GST_DEBUG ("set_sync_point"); + GST_DEBUG_OBJECT (base_video_decoder, "set_sync_point"); base_video_decoder->current_frame->is_sync_point = TRUE; base_video_decoder->distance_from_sync = 0; } +/** + * gst_base_video_decoder_get_oldest_frame: + * @base_video_decoder: a #GstBaseVideoDecoder + * + * Returns: oldest pending unfinished #GstVideoFrame. + */ GstVideoFrame * gst_base_video_decoder_get_oldest_frame (GstBaseVideoDecoder * base_video_decoder) @@ -1426,6 +1763,13 @@ gst_base_video_decoder_get_oldest_frame (GstBaseVideoDecoder * return (GstVideoFrame *) (g->data); } +/** + * gst_base_video_decoder_get_frame: + * @base_video_decoder: a #GstBaseVideoDecoder + * @frame_number: system_frame_number of a frame + * + * Returns: pending unfinished #GstVideoFrame identified by @frame_number. + */ GstVideoFrame * gst_base_video_decoder_get_frame (GstBaseVideoDecoder * base_video_decoder, int frame_number) @@ -1444,14 +1788,34 @@ gst_base_video_decoder_get_frame (GstBaseVideoDecoder * base_video_decoder, return NULL; } -void +/** + * gst_base_video_decoder_set_src_caps: + * @base_video_decoder: a #GstBaseVideoDecoder + * + * Sets src pad caps according to currently configured #GstVideoState. + * + */ +gboolean gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder * base_video_decoder) { GstCaps *caps; GstVideoState *state = &GST_BASE_VIDEO_CODEC (base_video_decoder)->state; + gboolean ret; - if (base_video_decoder->have_src_caps) - return; + /* minimum sense */ + g_return_val_if_fail (state->format != GST_VIDEO_FORMAT_UNKNOWN, FALSE); + g_return_val_if_fail (state->width != 0, FALSE); + g_return_val_if_fail (state->height != 0, FALSE); + + /* sanitize */ + if (state->fps_n == 0 || state->fps_d == 0) { + state->fps_n = 0; + state->fps_d = 1; + } + if (state->par_n == 0 || state->par_d == 0) { + state->par_n = 1; + state->par_d = 1; + } caps = gst_video_format_new_caps (state->format, state->width, state->height, @@ -1459,27 +1823,83 @@ gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder * base_video_decoder) gst_caps_set_simple (caps, "interlaced", G_TYPE_BOOLEAN, state->interlaced, NULL); - GST_DEBUG ("setting caps %" GST_PTR_FORMAT, caps); - - gst_pad_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), caps); - - base_video_decoder->have_src_caps = TRUE; + GST_DEBUG_OBJECT (base_video_decoder, "setting caps %" GST_PTR_FORMAT, caps); + ret = + gst_pad_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), + caps); gst_caps_unref (caps); + + /* arrange for derived info */ + state->bytes_per_picture = + gst_video_format_get_size (state->format, state->width, state->height); + + return ret; } +/** + * gst_base_video_decoder_alloc_src_buffer: + * @base_video_decoder: a #GstBaseVideoDecoder + * + * Helper function that uses gst_pad_alloc_buffer_and_set_caps + * to allocate a buffer to hold a video frame for @base_video_decoder's + * current #GstVideoState. + * + * Returns: allocated buffer + */ +GstBuffer * +gst_base_video_decoder_alloc_src_buffer (GstBaseVideoDecoder * + base_video_decoder) +{ + GstBuffer *buffer; + GstFlowReturn flow_ret; + int num_bytes; + GstVideoState *state = &GST_BASE_VIDEO_CODEC (base_video_decoder)->state; + + num_bytes = gst_video_format_get_size (state->format, state->width, + state->height); + GST_DEBUG ("alloc src buffer caps=%" GST_PTR_FORMAT, + GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder))); + flow_ret = + gst_pad_alloc_buffer_and_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD + (base_video_decoder), GST_BUFFER_OFFSET_NONE, num_bytes, + GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder)), + &buffer); + + if (flow_ret != GST_FLOW_OK) { + buffer = gst_buffer_new_and_alloc (num_bytes); + gst_buffer_set_caps (buffer, + GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder))); + } + + return buffer; +} + +/** + * gst_base_video_decoder_alloc_src_frame: + * @base_video_decoder: a #GstBaseVideoDecoder + * @frame: a #GstVideoFrame + * + * Helper function that uses gst_pad_alloc_buffer_and_set_caps + * to allocate a buffer to hold a video frame for @base_video_decoder's + * current #GstVideoState. Subclass should already have configured video state + * and set src pad caps. + * + * Returns: result from pad alloc call + */ GstFlowReturn gst_base_video_decoder_alloc_src_frame (GstBaseVideoDecoder * base_video_decoder, GstVideoFrame * frame) { GstFlowReturn flow_ret; - int num_bytes; GstVideoState *state = &GST_BASE_VIDEO_CODEC (base_video_decoder)->state; + int num_bytes = state->bytes_per_picture; - gst_base_video_decoder_set_src_caps (base_video_decoder); + g_return_val_if_fail (state->bytes_per_picture != 0, GST_FLOW_ERROR); + g_return_val_if_fail (GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD + (base_video_decoder)) != NULL, GST_FLOW_ERROR); - num_bytes = gst_video_format_get_size (state->format, state->width, - state->height); + GST_LOG_OBJECT (base_video_decoder, "alloc buffer size %d", num_bytes); flow_ret = gst_pad_alloc_buffer_and_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder), GST_BUFFER_OFFSET_NONE, num_bytes, @@ -1487,12 +1907,25 @@ gst_base_video_decoder_alloc_src_frame (GstBaseVideoDecoder * &frame->src_buffer); if (flow_ret != GST_FLOW_OK) { - GST_WARNING ("failed to get buffer"); + GST_WARNING_OBJECT (base_video_decoder, "failed to get buffer %s", + gst_flow_get_name (flow_ret)); } return flow_ret; } +/** + * gst_base_video_decoder_get_max_decode_time: + * @base_video_decoder: a #GstBaseVideoDecoder + * @frame: a #GstVideoFrame + * + * Determines maximum possible decoding time for @frame that will + * allow it to decode and arrive in time (as determined by QoS messages). + * In particular, a negative result means decoding in time is no longer possible + * and should therefore occur as soon/skippy as possible. + * + * Returns: max decoding time. + */ GstClockTimeDiff gst_base_video_decoder_get_max_decode_time (GstBaseVideoDecoder * base_video_decoder, GstVideoFrame * frame) @@ -1506,15 +1939,50 @@ gst_base_video_decoder_get_max_decode_time (GstBaseVideoDecoder * else deadline = G_MAXINT64; + GST_LOG_OBJECT (base_video_decoder, "earliest %" GST_TIME_FORMAT + ", frame deadline %" GST_TIME_FORMAT ", deadline %" GST_TIME_FORMAT, + GST_TIME_ARGS (earliest_time), GST_TIME_ARGS (frame->deadline), + GST_TIME_ARGS (deadline)); + return deadline; } +/** + * gst_base_video_decoder_get_oldest_frame: + * @base_video_decoder_class: a #GstBaseVideoDecoderClass + * + * Sets the mask and pattern that will be scanned for to obtain parse sync. + * Note that a non-zero @mask implies that @scan_for_sync will be ignored. + * + */ void gst_base_video_decoder_class_set_capture_pattern (GstBaseVideoDecoderClass * base_video_decoder_class, guint32 mask, guint32 pattern) { g_return_if_fail (((~mask) & pattern) == 0); + GST_DEBUG ("capture mask %08x, pattern %08x", mask, pattern); + base_video_decoder_class->capture_mask = mask; base_video_decoder_class->capture_pattern = pattern; } + +GstFlowReturn +_gst_base_video_decoder_error (GstBaseVideoDecoder * dec, gint weight, + GQuark domain, gint code, gchar * txt, gchar * dbg, const gchar * file, + const gchar * function, gint line) +{ + if (txt) + GST_WARNING_OBJECT (dec, "error: %s", txt); + if (dbg) + GST_WARNING_OBJECT (dec, "error: %s", dbg); + dec->error_count += weight; + GST_BASE_VIDEO_CODEC (dec)->discont = TRUE; + if (dec->max_errors < dec->error_count) { + gst_element_message_full (GST_ELEMENT (dec), GST_MESSAGE_ERROR, + domain, code, txt, dbg, file, function, line); + return GST_FLOW_ERROR; + } else { + return GST_FLOW_OK; + } +} diff --git a/gst-libs/gst/video/gstbasevideodecoder.h b/gst-libs/gst/video/gstbasevideodecoder.h index f193fa5252..235dcb11e1 100644 --- a/gst-libs/gst/video/gstbasevideodecoder.h +++ b/gst-libs/gst/video/gstbasevideodecoder.h @@ -1,5 +1,8 @@ /* GStreamer * Copyright (C) 2008 David Schleef + * Copyright (C) 2011 Mark Nauwelaerts . + * Copyright (C) 2011 Nokia Corporation. All rights reserved. + * Contact: Stefan Kost * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -56,123 +59,207 @@ G_BEGIN_DECLS #define GST_BASE_VIDEO_DECODER_SRC_NAME "src" /** - * * GST_BASE_VIDEO_DECODER_FLOW_NEED_DATA: - * * - * */ + * GST_BASE_VIDEO_DECODER_FLOW_NEED_DATA: + * + * Returned while parsing to indicate more data is needed. + **/ #define GST_BASE_VIDEO_DECODER_FLOW_NEED_DATA GST_FLOW_CUSTOM_SUCCESS - typedef struct _GstBaseVideoDecoder GstBaseVideoDecoder; typedef struct _GstBaseVideoDecoderClass GstBaseVideoDecoderClass; + +/* do not use this one, use macro below */ +GstFlowReturn _gst_base_video_decoder_error (GstBaseVideoDecoder *dec, gint weight, + GQuark domain, gint code, + gchar *txt, gchar *debug, + const gchar *file, const gchar *function, + gint line); + +/** + * GST_BASE_VIDEO_DECODER_ERROR: + * @el: the base video decoder element that generates the error + * @weight: element defined weight of the error, added to error count + * @domain: like CORE, LIBRARY, RESOURCE or STREAM (see #gstreamer-GstGError) + * @code: error code defined for that domain (see #gstreamer-GstGError) + * @text: the message to display (format string and args enclosed in + * parentheses) + * @debug: debugging information for the message (format string and args + * enclosed in parentheses) + * @ret: variable to receive return value + * + * Utility function that audio decoder elements can use in case they encountered + * a data processing error that may be fatal for the current "data unit" but + * need not prevent subsequent decoding. Such errors are counted and if there + * are too many, as configured in the context's max_errors, the pipeline will + * post an error message and the application will be requested to stop further + * media processing. Otherwise, it is considered a "glitch" and only a warning + * is logged. In either case, @ret is set to the proper value to + * return to upstream/caller (indicating either GST_FLOW_ERROR or GST_FLOW_OK). + */ +#define GST_BASE_AUDIO_DECODER_ERROR(el, w, domain, code, text, debug, ret) \ +G_STMT_START { \ + gchar *__txt = _gst_element_error_printf text; \ + gchar *__dbg = _gst_element_error_printf debug; \ + GstBaseVideoDecoder *dec = GST_BASE_VIDEO_DECODER (el); \ + ret = _gst_base_video_decoder_error (dec, w, GST_ ## domain ## _ERROR, \ + GST_ ## domain ## _ERROR_ ## code, __txt, __dbg, __FILE__, \ + GST_FUNCTION, __LINE__); \ +} G_STMT_END + + +/** + * GstBaseVideoDecoder: + * + * The opaque #GstBaseVideoDecoder data structure. + */ struct _GstBaseVideoDecoder { GstBaseVideoCodec base_video_codec; + /*< protected >*/ + gboolean sink_clipping; + gboolean do_byte_time; + gboolean packetized; + gint max_errors; + + /* parse tracking */ + /* input data */ + GstAdapter *input_adapter; + /* assembles current frame */ + GstAdapter *output_adapter; + /*< private >*/ - GstAdapter *input_adapter; - GstAdapter *output_adapter; + /* FIXME move to real private part ? + * (and introduce a context ?) */ + /* ... being tracked here; + * only available during parsing */ + /* FIXME remove and add parameter to method */ + GstVideoFrame *current_frame; + /* relative offset of input data */ + guint64 input_offset; + /* relative offset of frame */ + guint64 frame_offset; + /* tracking ts and offsets */ + GList *timestamps; + /* whether parsing is in sync */ + gboolean have_sync; - gboolean have_sync; - gboolean discont; - gboolean started; + /* maybe sort-of protected ? */ - gboolean sink_clipping; + /* combine to yield (presentation) ts */ + GstClockTime timestamp_offset; + int field_index; - guint64 presentation_frame_number; + /* last outgoing ts */ + GstClockTime last_timestamp; + gint error_count; - gboolean have_src_caps; + /* reverse playback */ + /* collect input */ + GList *gather; + /* to-be-parsed */ + GList *parse; + /* collected parsed frames */ + GList *parse_gather; + /* frames to be handled == decoded */ + GList *decode; + /* collected output */ + GList *queued; + gboolean process; - GstVideoFrame *current_frame; - - int distance_from_sync; - int reorder_depth; - - GstClockTime buffer_timestamp; - - GstClockTime timestamp_offset; - - //GstBuffer *codec_data; - - guint64 input_offset; - guint64 frame_offset; - GstClockTime last_timestamp; - - guint64 base_picture_number; - - int field_index; - - gboolean is_delta_unit; - gboolean packetized; - - GList *timestamps; - gboolean have_segment; + /* no comment ... */ + guint64 base_picture_number; + int reorder_depth; + int distance_from_sync; /* FIXME before moving to base */ - void *padding[GST_PADDING_LARGE]; + void *padding[GST_PADDING_LARGE]; }; +/** + * GstBaseAudioDecoderClass: + * @start: Optional. + * Called when the element starts processing. + * Allows opening external resources. + * @stop: Optional. + * Called when the element stops processing. + * Allows closing external resources. + * @set_format: Notifies subclass of incoming data format (caps). + * @scan_for_sync: Optional. + * Allows subclass to obtain sync for subsequent parsing + * by custom means (above an beyond scanning for specific + * marker and mask). + * @parse_data: Required for non-packetized input. + * Allows chopping incoming data into manageable units (frames) + * for subsequent decoding. + * @reset: Optional. + * Allows subclass (codec) to perform post-seek semantics reset. + * @handle_frame: Provides input data frame to subclass. + * @finish: Optional. + * Called to request subclass to dispatch any pending remaining + * data (e.g. at EOS). + * + * Subclasses can override any of the available virtual methods or not, as + * needed. At minimum @handle_frame needs to be overridden, and @set_format + * and likely as well. If non-packetized input is supported or expected, + * @parse needs to be overridden as well. + */ struct _GstBaseVideoDecoderClass { GstBaseVideoCodecClass base_video_codec_class; - gboolean (*set_format) (GstBaseVideoDecoder *coder, GstVideoFormat, - int width, int height, int fps_n, int fps_d, - int par_n, int par_d); - gboolean (*start) (GstBaseVideoDecoder *coder); - gboolean (*stop) (GstBaseVideoDecoder *coder); - gboolean (*reset) (GstBaseVideoDecoder *coder); - int (*scan_for_sync) (GstBaseVideoDecoder *decoder, gboolean at_eos, - int offset, int n); - GstFlowReturn (*parse_data) (GstBaseVideoDecoder *decoder, gboolean at_eos); - GstFlowReturn (*finish) (GstBaseVideoDecoder *coder); - GstFlowReturn (*handle_frame) (GstBaseVideoDecoder *coder, GstVideoFrame *frame); - GstFlowReturn (*shape_output) (GstBaseVideoDecoder *coder, GstVideoFrame *frame); - GstCaps *(*get_caps) (GstBaseVideoDecoder *coder); + gboolean (*start) (GstBaseVideoDecoder *coder); - guint32 capture_mask; - guint32 capture_pattern; + gboolean (*stop) (GstBaseVideoDecoder *coder); + + int (*scan_for_sync) (GstBaseVideoDecoder *decoder, gboolean at_eos, + int offset, int n); + + GstFlowReturn (*parse_data) (GstBaseVideoDecoder *decoder, gboolean at_eos); + + gboolean (*set_format) (GstBaseVideoDecoder *coder, GstVideoState * state); + + gboolean (*reset) (GstBaseVideoDecoder *coder); + + GstFlowReturn (*finish) (GstBaseVideoDecoder *coder); + + GstFlowReturn (*handle_frame) (GstBaseVideoDecoder *coder, GstVideoFrame *frame); + + + /*< private >*/ + guint32 capture_mask; + guint32 capture_pattern; /* FIXME before moving to base */ - void *padding[GST_PADDING_LARGE]; + void *padding[GST_PADDING_LARGE]; }; -GType gst_base_video_decoder_get_type (void); +void gst_base_video_decoder_class_set_capture_pattern (GstBaseVideoDecoderClass *klass, + guint32 mask, guint32 pattern); -void gst_base_video_decoder_class_set_capture_pattern (GstBaseVideoDecoderClass *klass, - guint32 mask, guint32 pattern); +GstVideoFrame *gst_base_video_decoder_get_frame (GstBaseVideoDecoder *coder, + int frame_number); +GstVideoFrame *gst_base_video_decoder_get_oldest_frame (GstBaseVideoDecoder *coder); -int gst_base_video_decoder_get_width (GstBaseVideoDecoder *coder); -int gst_base_video_decoder_get_height (GstBaseVideoDecoder *coder); - -guint64 gst_base_video_decoder_get_timestamp_offset (GstBaseVideoDecoder *coder); - -GstVideoFrame *gst_base_video_decoder_get_frame (GstBaseVideoDecoder *coder, - int frame_number); -GstVideoFrame *gst_base_video_decoder_get_oldest_frame (GstBaseVideoDecoder *coder); -void gst_base_video_decoder_add_to_frame (GstBaseVideoDecoder *base_video_decoder, - int n_bytes); -GstFlowReturn gst_base_video_decoder_finish_frame (GstBaseVideoDecoder *base_video_decoder, - GstVideoFrame *frame); -GstFlowReturn gst_base_video_decoder_skip_frame (GstBaseVideoDecoder * base_video_decoder, - GstVideoFrame * frame); -GstFlowReturn gst_base_video_decoder_end_of_stream (GstBaseVideoDecoder *base_video_decoder, - GstBuffer *buffer); -GstFlowReturn -gst_base_video_decoder_have_frame (GstBaseVideoDecoder *base_video_decoder); -GstVideoState * gst_base_video_decoder_get_state (GstBaseVideoDecoder *base_video_decoder); -void gst_base_video_decoder_set_state (GstBaseVideoDecoder *base_video_decoder, - GstVideoState *state); -void gst_base_video_decoder_lost_sync (GstBaseVideoDecoder *base_video_decoder); -void gst_base_video_decoder_set_sync_point (GstBaseVideoDecoder *base_video_decoder); - -void gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder *base_video_decoder); - -GstFlowReturn gst_base_video_decoder_alloc_src_frame (GstBaseVideoDecoder *base_video_decoder, - GstVideoFrame *frame); +void gst_base_video_decoder_add_to_frame (GstBaseVideoDecoder *base_video_decoder, + int n_bytes); +void gst_base_video_decoder_lost_sync (GstBaseVideoDecoder *base_video_decoder); +GstFlowReturn gst_base_video_decoder_have_frame (GstBaseVideoDecoder *base_video_decoder); +void gst_base_video_decoder_set_sync_point (GstBaseVideoDecoder *base_video_decoder); +gboolean gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder *base_video_decoder); +GstBuffer *gst_base_video_decoder_alloc_src_buffer (GstBaseVideoDecoder * base_video_decoder); +GstFlowReturn gst_base_video_decoder_alloc_src_frame (GstBaseVideoDecoder *base_video_decoder, + GstVideoFrame *frame); +GstVideoState *gst_base_video_decoder_get_state (GstBaseVideoDecoder *base_video_decoder); GstClockTimeDiff gst_base_video_decoder_get_max_decode_time ( - GstBaseVideoDecoder *base_video_decoder, GstVideoFrame *frame); + GstBaseVideoDecoder *base_video_decoder, + GstVideoFrame *frame); +GstFlowReturn gst_base_video_decoder_finish_frame (GstBaseVideoDecoder *base_video_decoder, + GstVideoFrame *frame); + +GType gst_base_video_decoder_get_type (void); G_END_DECLS diff --git a/gst-libs/gst/video/gstbasevideoencoder.c b/gst-libs/gst/video/gstbasevideoencoder.c index fb518fc1b2..1c27a72ef1 100644 --- a/gst-libs/gst/video/gstbasevideoencoder.c +++ b/gst-libs/gst/video/gstbasevideoencoder.c @@ -1,5 +1,8 @@ /* GStreamer * Copyright (C) 2008 David Schleef + * Copyright (C) 2011 Mark Nauwelaerts . + * Copyright (C) 2011 Nokia Corporation. All rights reserved. + * Contact: Stefan Kost * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -17,12 +20,92 @@ * Boston, MA 02111-1307, USA. */ +/** + * SECTION:gstbasevideoencoder + * @short_description: Base class for video encoders + * @see_also: #GstBaseTransform + * + * This base class is for video encoders turning raw video into + * encoded video data. + * + * GstBaseVideoEncoder and subclass should cooperate as follows. + * + * + * Configuration + * + * Initially, GstBaseVideoEncoder calls @start when the encoder element + * is activated, which allows subclass to perform any global setup. + * + * + * GstBaseVideoEncoder calls @set_format to inform subclass of the format + * of input video data that it is about to receive. Subclass should + * setup for encoding and configure base class as appropriate + * (e.g. latency). While unlikely, it might be called more than once, + * if changing input parameters require reconfiguration. Baseclass + * will ensure that processing of current configuration is finished. + * + * + * GstBaseVideoEncoder calls @stop at end of all processing. + * + * + * + * + * + * Data processing + * + * Base class collects input data and metadata into a frame and hands + * this to subclass' @handle_frame. + * + * + * If codec processing results in encoded data, subclass should call + * @gst_base_video_encoder_finish_frame to have encoded data pushed + * downstream. + * + * + * If implemented, baseclass calls subclass @shape_output which then sends + * data downstream in desired form. Otherwise, it is sent as-is. + * + * + * GstBaseVideoEncoderClass will handle both srcpad and sinkpad events. + * Sink events will be passed to subclass if @event callback has been + * provided. + * + * + * + * + * Shutdown phase + * + * GstBaseVideoEncoder class calls @stop to inform the subclass that data + * parsing will be stopped. + * + * + * + * + * + * Subclass is responsible for providing pad template caps for + * source and sink pads. The pads need to be named "sink" and "src". It should + * also be able to provide fixed src pad caps in @getcaps by the time it calls + * @gst_base_video_encoder_finish_frame. + * + * Things that subclass need to take care of: + * + * Provide pad templates + * + * Provide source pad caps in @get_caps. + * + * + * Accept data in @handle_frame and provide encoded results to + * @gst_base_video_encoder_finish_frame. + * + * + * + */ + #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "gstbasevideoencoder.h" -#include "gstbasevideoutils.h" GST_DEBUG_CATEGORY (basevideoencoder_debug); #define GST_CAT_DEFAULT basevideoencoder_debug @@ -37,7 +120,6 @@ static gboolean gst_base_video_encoder_sink_event (GstPad * pad, GstEvent * event); static GstFlowReturn gst_base_video_encoder_chain (GstPad * pad, GstBuffer * buf); -//static GstFlowReturn gst_base_video_encoder_process (GstBaseVideoEncoder *base_video_encoder); static GstStateChangeReturn gst_base_video_encoder_change_state (GstElement * element, GstStateChange transition); static const GstQueryType *gst_base_video_encoder_get_query_types (GstPad * @@ -46,8 +128,21 @@ static gboolean gst_base_video_encoder_src_query (GstPad * pad, GstQuery * query); -GST_BOILERPLATE (GstBaseVideoEncoder, gst_base_video_encoder, GstBaseVideoCodec, - GST_TYPE_BASE_VIDEO_CODEC); +static void +_do_init (GType object_type) +{ + const GInterfaceInfo preset_interface_info = { + NULL, /* interface_init */ + NULL, /* interface_finalize */ + NULL /* interface_data */ + }; + + g_type_add_interface_static (object_type, GST_TYPE_PRESET, + &preset_interface_info); +} + +GST_BOILERPLATE_FULL (GstBaseVideoEncoder, gst_base_video_encoder, + GstBaseVideoCodec, GST_TYPE_BASE_VIDEO_CODEC, _do_init); static void gst_base_video_encoder_base_init (gpointer g_class) @@ -68,31 +163,97 @@ gst_base_video_encoder_class_init (GstBaseVideoEncoderClass * klass) gobject_class->finalize = gst_base_video_encoder_finalize; - gstelement_class->change_state = gst_base_video_encoder_change_state; + gstelement_class->change_state = + GST_DEBUG_FUNCPTR (gst_base_video_encoder_change_state); parent_class = g_type_class_peek_parent (klass); } +static void +gst_base_video_encoder_reset (GstBaseVideoEncoder * base_video_encoder) +{ + base_video_encoder->presentation_frame_number = 0; + base_video_encoder->distance_from_sync = 0; + base_video_encoder->force_keyframe = FALSE; + + base_video_encoder->set_output_caps = FALSE; + base_video_encoder->drained = TRUE; + base_video_encoder->min_latency = 0; + base_video_encoder->max_latency = 0; + + if (base_video_encoder->force_keyunit_event) { + gst_event_unref (base_video_encoder->force_keyunit_event); + base_video_encoder->force_keyunit_event = NULL; + } +} + static void gst_base_video_encoder_init (GstBaseVideoEncoder * base_video_encoder, GstBaseVideoEncoderClass * klass) { GstPad *pad; - GST_DEBUG ("gst_base_video_encoder_init"); + GST_DEBUG_OBJECT (base_video_encoder, "gst_base_video_encoder_init"); pad = GST_BASE_VIDEO_CODEC_SINK_PAD (base_video_encoder); - gst_pad_set_chain_function (pad, gst_base_video_encoder_chain); - gst_pad_set_event_function (pad, gst_base_video_encoder_sink_event); - gst_pad_set_setcaps_function (pad, gst_base_video_encoder_sink_setcaps); - //gst_pad_set_query_function (pad, gst_base_video_encoder_sink_query); + gst_pad_set_chain_function (pad, + GST_DEBUG_FUNCPTR (gst_base_video_encoder_chain)); + gst_pad_set_event_function (pad, + GST_DEBUG_FUNCPTR (gst_base_video_encoder_sink_event)); + gst_pad_set_setcaps_function (pad, + GST_DEBUG_FUNCPTR (gst_base_video_encoder_sink_setcaps)); pad = GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder); - gst_pad_set_query_type_function (pad, gst_base_video_encoder_get_query_types); - gst_pad_set_query_function (pad, gst_base_video_encoder_src_query); - gst_pad_set_event_function (pad, gst_base_video_encoder_src_event); + gst_pad_set_query_type_function (pad, + GST_DEBUG_FUNCPTR (gst_base_video_encoder_get_query_types)); + gst_pad_set_query_function (pad, + GST_DEBUG_FUNCPTR (gst_base_video_encoder_src_query)); + gst_pad_set_event_function (pad, + GST_DEBUG_FUNCPTR (gst_base_video_encoder_src_event)); + + base_video_encoder->a.at_eos = FALSE; + + /* encoder is expected to do so */ + base_video_encoder->sink_clipping = TRUE; +} + +static gboolean +gst_base_video_encoder_drain (GstBaseVideoEncoder * enc) +{ + GstBaseVideoCodec *codec; + GstBaseVideoEncoderClass *enc_class; + gboolean ret = TRUE; + + codec = GST_BASE_VIDEO_CODEC (enc); + enc_class = GST_BASE_VIDEO_ENCODER_GET_CLASS (enc); + + GST_DEBUG_OBJECT (enc, "draining"); + + if (enc->drained) { + GST_DEBUG_OBJECT (enc, "already drained"); + return TRUE; + } + + if (enc_class->finish) { + GST_DEBUG_OBJECT (enc, "requesting subclass to finish"); + ret = enc_class->finish (enc); + } + /* everything should be away now */ + if (codec->frames) { + /* not fatal/impossible though if subclass/codec eats stuff */ + GST_WARNING_OBJECT (enc, "still %d frames left after draining", + g_list_length (codec->frames)); +#if 0 + /* FIXME should do this, but subclass may come up with it later on ? + * and would then need refcounting or so on frames */ + g_list_foreach (codec->frames, + (GFunc) gst_base_video_codec_free_frame, NULL); +#endif + } + + return ret; } static gboolean @@ -103,88 +264,119 @@ gst_base_video_encoder_sink_setcaps (GstPad * pad, GstCaps * caps) GstStructure *structure; GstVideoState *state; gboolean ret; + gboolean changed = FALSE, u, v; + GstVideoFormat fmt; + gint w, h, num, den; base_video_encoder = GST_BASE_VIDEO_ENCODER (gst_pad_get_parent (pad)); base_video_encoder_class = GST_BASE_VIDEO_ENCODER_GET_CLASS (base_video_encoder); - GST_DEBUG ("setcaps"); + /* subclass should do something here ... */ + g_return_val_if_fail (base_video_encoder_class->set_format != NULL, FALSE); + + GST_DEBUG_OBJECT (base_video_encoder, "setcaps %" GST_PTR_FORMAT, caps); state = &GST_BASE_VIDEO_CODEC (base_video_encoder)->state; structure = gst_caps_get_structure (caps, 0); - gst_video_format_parse_caps (caps, &state->format, - &state->width, &state->height); + ret = gst_video_format_parse_caps (caps, &fmt, &w, &h); + if (!ret) + goto exit; - state->fps_n = 0; - state->fps_d = 1; - gst_video_parse_caps_framerate (caps, &state->fps_n, &state->fps_d); - if (state->fps_d == 0) { - state->fps_n = 0; - state->fps_d = 1; + if (fmt != state->format || w != state->width || h != state->height) { + changed = TRUE; + state->format = fmt; + state->width = w; + state->height = h; } - state->par_n = 1; - state->par_d = 1; - gst_video_parse_caps_pixel_aspect_ratio (caps, &state->par_n, &state->par_d); + num = 0; + den = 1; + gst_video_parse_caps_framerate (caps, &num, &den); + if (den == 0) { + num = 0; + den = 1; + } + if (num != state->fps_n || den != state->fps_d) { + changed = TRUE; + state->fps_n = num; + state->fps_d = den; + } - state->have_interlaced = gst_structure_get_boolean (structure, - "interlaced", &state->interlaced); + num = 0; + den = 1; + gst_video_parse_caps_pixel_aspect_ratio (caps, &num, &den); + if (den == 0) { + num = 0; + den = 1; + } + if (num != state->par_n || den != state->par_d) { + changed = TRUE; + state->par_n = num; + state->par_d = den; + } + u = gst_structure_get_boolean (structure, "interlaced", &v); + if (u != state->have_interlaced || v != state->interlaced) { + changed = TRUE; + state->have_interlaced = u; + state->interlaced = v; + } + + state->bytes_per_picture = + gst_video_format_get_size (state->format, state->width, state->height); state->clean_width = state->width; state->clean_height = state->height; state->clean_offset_left = 0; state->clean_offset_top = 0; - ret = base_video_encoder_class->set_format (base_video_encoder, - &GST_BASE_VIDEO_CODEC (base_video_encoder)->state); - if (ret) { - ret = base_video_encoder_class->start (base_video_encoder); + if (changed) { + /* arrange draining pending frames */ + gst_base_video_encoder_drain (base_video_encoder); + + /* and subclass should be ready to configure format at any time around */ + if (base_video_encoder_class->set_format) + ret = base_video_encoder_class->set_format (base_video_encoder, state); + } else { + /* no need to stir things up */ + GST_DEBUG_OBJECT (base_video_encoder, + "new video format identical to configured format"); + ret = TRUE; } +exit: g_object_unref (base_video_encoder); + if (!ret) { + GST_WARNING_OBJECT (base_video_encoder, "rejected caps %" GST_PTR_FORMAT, + caps); + } + return ret; } static void gst_base_video_encoder_finalize (GObject * object) { - GstBaseVideoEncoder *base_video_encoder; - GstBaseVideoEncoderClass *base_video_encoder_class; - - g_return_if_fail (GST_IS_BASE_VIDEO_ENCODER (object)); - base_video_encoder = GST_BASE_VIDEO_ENCODER (object); - base_video_encoder_class = GST_BASE_VIDEO_ENCODER_GET_CLASS (object); - - GST_DEBUG ("finalize"); + GST_DEBUG_OBJECT (object, "finalize"); G_OBJECT_CLASS (parent_class)->finalize (object); } static gboolean -gst_base_video_encoder_sink_event (GstPad * pad, GstEvent * event) +gst_base_video_encoder_sink_eventfunc (GstBaseVideoEncoder * base_video_encoder, + GstEvent * event) { - GstBaseVideoEncoder *base_video_encoder; - GstBaseVideoEncoderClass *base_video_encoder_class; gboolean ret = FALSE; - base_video_encoder = GST_BASE_VIDEO_ENCODER (gst_pad_get_parent (pad)); - base_video_encoder_class = - GST_BASE_VIDEO_ENCODER_GET_CLASS (base_video_encoder); - switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: { - if (base_video_encoder_class->finish) { - base_video_encoder_class->finish (base_video_encoder); - } - - ret = - gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), - event); - } + base_video_encoder->a.at_eos = TRUE; + gst_base_video_encoder_drain (base_video_encoder); break; + } case GST_EVENT_NEWSEGMENT: { gboolean update; @@ -195,24 +387,27 @@ gst_base_video_encoder_sink_event (GstPad * pad, GstEvent * event) gint64 stop; gint64 position; - gst_event_parse_new_segment_full (event, &update, &rate, - &applied_rate, &format, &start, &stop, &position); + gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate, + &format, &start, &stop, &position); - if (format != GST_FORMAT_TIME) - goto newseg_wrong_format; + GST_DEBUG_OBJECT (base_video_encoder, "newseg rate %g, applied rate %g, " + "format %d, start = %" GST_TIME_FORMAT ", stop = %" GST_TIME_FORMAT + ", pos = %" GST_TIME_FORMAT, rate, applied_rate, format, + GST_TIME_ARGS (start), GST_TIME_ARGS (stop), + GST_TIME_ARGS (position)); - GST_DEBUG ("new segment %" GST_TIME_FORMAT " %" GST_TIME_FORMAT, - GST_TIME_ARGS (start), GST_TIME_ARGS (position)); + if (format != GST_FORMAT_TIME) { + GST_DEBUG_OBJECT (base_video_encoder, "received non TIME newsegment"); + break; + } + + base_video_encoder->a.at_eos = FALSE; gst_segment_set_newsegment_full (&GST_BASE_VIDEO_CODEC (base_video_encoder)->segment, update, rate, applied_rate, format, start, stop, position); - - ret = - gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), - event); - } break; + } case GST_EVENT_CUSTOM_DOWNSTREAM: { const GstStructure *s; @@ -222,46 +417,61 @@ gst_base_video_encoder_sink_event (GstPad * pad, GstEvent * event) if (gst_structure_has_name (s, "GstForceKeyUnit")) { GST_OBJECT_LOCK (base_video_encoder); base_video_encoder->force_keyframe = TRUE; + if (base_video_encoder->force_keyunit_event) + gst_event_unref (base_video_encoder->force_keyunit_event); + base_video_encoder->force_keyunit_event = gst_event_copy (event); GST_OBJECT_UNLOCK (base_video_encoder); gst_event_unref (event); - ret = GST_FLOW_OK; - } else { - ret = - gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD - (base_video_encoder), event); + ret = TRUE; } break; } default: - /* FIXME this changes the order of events */ - ret = - gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), - event); break; } -done: - gst_object_unref (base_video_encoder); return ret; +} -newseg_wrong_format: - { - GST_DEBUG_OBJECT (base_video_encoder, "received non TIME newsegment"); - gst_event_unref (event); - goto done; - } +static gboolean +gst_base_video_encoder_sink_event (GstPad * pad, GstEvent * event) +{ + GstBaseVideoEncoder *enc; + GstBaseVideoEncoderClass *klass; + gboolean handled = FALSE; + gboolean ret = TRUE; + + enc = GST_BASE_VIDEO_ENCODER (gst_pad_get_parent (pad)); + klass = GST_BASE_VIDEO_ENCODER_GET_CLASS (enc); + + GST_DEBUG_OBJECT (enc, "received event %d, %s", GST_EVENT_TYPE (event), + GST_EVENT_TYPE_NAME (event)); + + if (klass->event) + handled = klass->event (enc, event); + + if (!handled) + handled = gst_base_video_encoder_sink_eventfunc (enc, event); + + if (!handled) + ret = gst_pad_event_default (pad, event); + + GST_DEBUG_OBJECT (enc, "event handled"); + + gst_object_unref (enc); + return ret; } static gboolean gst_base_video_encoder_src_event (GstPad * pad, GstEvent * event) { GstBaseVideoEncoder *base_video_encoder; - GstBaseVideoEncoderClass *base_video_encoder_class; gboolean ret = FALSE; base_video_encoder = GST_BASE_VIDEO_ENCODER (gst_pad_get_parent (pad)); - base_video_encoder_class = - GST_BASE_VIDEO_ENCODER_GET_CLASS (base_video_encoder); + + GST_LOG_OBJECT (base_video_encoder, "handling event: %" GST_PTR_FORMAT, + event); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CUSTOM_UPSTREAM: @@ -299,8 +509,6 @@ static const GstQueryType * gst_base_video_encoder_get_query_types (GstPad * pad) { static const GstQueryType query_types[] = { - //GST_QUERY_POSITION, - //GST_QUERY_DURATION, GST_QUERY_CONVERT, GST_QUERY_LATENCY, 0 @@ -319,17 +527,18 @@ gst_base_video_encoder_src_query (GstPad * pad, GstQuery * query) enc = GST_BASE_VIDEO_ENCODER (gst_pad_get_parent (pad)); peerpad = gst_pad_get_peer (GST_BASE_VIDEO_CODEC_SINK_PAD (enc)); - switch GST_QUERY_TYPE - (query) { + GST_LOG_OBJECT (enc, "handling query: %" GST_PTR_FORMAT, query); + + switch (GST_QUERY_TYPE (query)) { case GST_QUERY_CONVERT: { + GstBaseVideoCodec *codec = GST_BASE_VIDEO_CODEC (enc); GstFormat src_fmt, dest_fmt; gint64 src_val, dest_val; gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); - res = - gst_base_video_encoded_video_convert (&GST_BASE_VIDEO_CODEC - (enc)->state, src_fmt, src_val, &dest_fmt, &dest_val); + res = gst_base_video_encoded_video_convert (&codec->state, + codec->bytes, codec->time, src_fmt, src_val, &dest_fmt, &dest_val); if (!res) goto error; gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); @@ -343,11 +552,16 @@ gst_base_video_encoder_src_query (GstPad * pad, GstQuery * query) res = gst_pad_query (peerpad, query); if (res) { gst_query_parse_latency (query, &live, &min_latency, &max_latency); + GST_DEBUG_OBJECT (enc, "Peer latency: live %d, min %" + GST_TIME_FORMAT " max %" GST_TIME_FORMAT, live, + GST_TIME_ARGS (min_latency), GST_TIME_ARGS (max_latency)); + GST_OBJECT_LOCK (enc); min_latency += enc->min_latency; if (max_latency != GST_CLOCK_TIME_NONE) { max_latency += enc->max_latency; } + GST_OBJECT_UNLOCK (enc); gst_query_set_latency (query, live, min_latency, max_latency); } @@ -355,7 +569,7 @@ gst_base_video_encoder_src_query (GstPad * pad, GstQuery * query) break; default: res = gst_pad_query_default (pad, query); - } + } gst_object_unref (peerpad); gst_object_unref (enc); return res; @@ -367,36 +581,33 @@ error: return res; } -static gboolean -gst_pad_is_negotiated (GstPad * pad) -{ - GstCaps *caps; - - g_return_val_if_fail (pad != NULL, FALSE); - - caps = gst_pad_get_negotiated_caps (pad); - if (caps) { - gst_caps_unref (caps); - return TRUE; - } - - return FALSE; -} - static GstFlowReturn gst_base_video_encoder_chain (GstPad * pad, GstBuffer * buf) { GstBaseVideoEncoder *base_video_encoder; GstBaseVideoEncoderClass *klass; GstVideoFrame *frame; - - if (!gst_pad_is_negotiated (pad)) { - return GST_FLOW_NOT_NEGOTIATED; - } + GstFlowReturn ret = GST_FLOW_OK; base_video_encoder = GST_BASE_VIDEO_ENCODER (gst_pad_get_parent (pad)); klass = GST_BASE_VIDEO_ENCODER_GET_CLASS (base_video_encoder); + g_return_val_if_fail (klass->handle_frame != NULL, GST_FLOW_ERROR); + + if (!GST_PAD_CAPS (pad)) { + return GST_FLOW_NOT_NEGOTIATED; + } + + GST_LOG_OBJECT (base_video_encoder, + "received buffer of size %d with ts %" GST_TIME_FORMAT + ", duration %" GST_TIME_FORMAT, GST_BUFFER_SIZE (buf), + GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)), + GST_TIME_ARGS (GST_BUFFER_DURATION (buf))); + + if (base_video_encoder->a.at_eos) { + return GST_FLOW_UNEXPECTED; + } + if (base_video_encoder->sink_clipping) { gint64 start = GST_BUFFER_TIMESTAMP (buf); gint64 stop = start + GST_BUFFER_DURATION (buf); @@ -405,11 +616,17 @@ gst_base_video_encoder_chain (GstPad * pad, GstBuffer * buf) if (!gst_segment_clip (&GST_BASE_VIDEO_CODEC (base_video_encoder)->segment, GST_FORMAT_TIME, start, stop, &clip_start, &clip_stop)) { - GST_DEBUG ("clipping to segment dropped frame"); + GST_DEBUG_OBJECT (base_video_encoder, + "clipping to segment dropped frame"); goto done; } } + if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DISCONT))) { + GST_LOG_OBJECT (base_video_encoder, "marked discont"); + GST_BASE_VIDEO_CODEC (base_video_encoder)->discont = TRUE; + } + frame = gst_base_video_codec_new_frame (GST_BASE_VIDEO_CODEC (base_video_encoder)); @@ -419,16 +636,24 @@ gst_base_video_encoder_chain (GstPad * pad, GstBuffer * buf) frame->presentation_frame_number = base_video_encoder->presentation_frame_number; base_video_encoder->presentation_frame_number++; + frame->force_keyframe = base_video_encoder->force_keyframe; + base_video_encoder->force_keyframe = FALSE; GST_BASE_VIDEO_CODEC (base_video_encoder)->frames = g_list_append (GST_BASE_VIDEO_CODEC (base_video_encoder)->frames, frame); - klass->handle_frame (base_video_encoder, frame); + /* new data, more finish needed */ + base_video_encoder->drained = FALSE; + + GST_LOG_OBJECT (base_video_encoder, "passing frame pfn %d to subclass", + frame->presentation_frame_number); + + ret = klass->handle_frame (base_video_encoder, frame); done: g_object_unref (base_video_encoder); - return GST_FLOW_OK; + return ret; } static GstStateChangeReturn @@ -443,6 +668,13 @@ gst_base_video_encoder_change_state (GstElement * element, base_video_encoder_class = GST_BASE_VIDEO_ENCODER_GET_CLASS (element); switch (transition) { + case GST_STATE_CHANGE_READY_TO_PAUSED: + gst_base_video_encoder_reset (base_video_encoder); + gst_base_video_encoder_reset (base_video_encoder); + if (base_video_encoder_class->start) { + base_video_encoder_class->start (base_video_encoder); + } + break; default: break; } @@ -451,6 +683,7 @@ gst_base_video_encoder_change_state (GstElement * element, switch (transition) { case GST_STATE_CHANGE_PAUSED_TO_READY: + gst_base_video_encoder_reset (base_video_encoder); if (base_video_encoder_class->stop) { base_video_encoder_class->stop (base_video_encoder); } @@ -462,6 +695,18 @@ gst_base_video_encoder_change_state (GstElement * element, return ret; } +/** + * gst_base_video_encoder_finish_frame: + * @base_video_encoder: a #GstBaseVideoEncoder + * @frame: an encoded #GstVideoFrame + * + * @frame must have a valid encoded data buffer, whose metadata fields + * are then appropriately set according to frame data. + * It is subsequently pushed downstream or provided to @shape_output. + * In any case, the frame is considered finished and released. + * + * Returns: a #GstFlowReturn resulting from sending data downstream + */ GstFlowReturn gst_base_video_encoder_finish_frame (GstBaseVideoEncoder * base_video_encoder, GstVideoFrame * frame) @@ -469,14 +714,16 @@ gst_base_video_encoder_finish_frame (GstBaseVideoEncoder * base_video_encoder, GstFlowReturn ret; GstBaseVideoEncoderClass *base_video_encoder_class; + g_return_val_if_fail (frame->src_buffer != NULL, GST_FLOW_ERROR); + base_video_encoder_class = GST_BASE_VIDEO_ENCODER_GET_CLASS (base_video_encoder); - frame->system_frame_number = - GST_BASE_VIDEO_CODEC (base_video_encoder)->system_frame_number; - GST_BASE_VIDEO_CODEC (base_video_encoder)->system_frame_number++; + GST_LOG_OBJECT (base_video_encoder, + "finish frame fpn %d", frame->presentation_frame_number); if (frame->is_sync_point) { + GST_LOG_OBJECT (base_video_encoder, "key frame"); base_video_encoder->distance_from_sync = 0; GST_BUFFER_FLAG_UNSET (frame->src_buffer, GST_BUFFER_FLAG_DELTA_UNIT); } else { @@ -499,29 +746,51 @@ gst_base_video_encoder_finish_frame (GstBaseVideoEncoder * base_video_encoder, GST_BUFFER_DURATION (frame->src_buffer) = frame->presentation_duration; GST_BUFFER_OFFSET (frame->src_buffer) = frame->decode_timestamp; + /* update rate estimate */ + GST_BASE_VIDEO_CODEC (base_video_encoder)->bytes += + GST_BUFFER_SIZE (frame->src_buffer); + if (GST_CLOCK_TIME_IS_VALID (frame->presentation_duration)) { + GST_BASE_VIDEO_CODEC (base_video_encoder)->time += + frame->presentation_duration; + } else { + /* better none than nothing valid */ + GST_BASE_VIDEO_CODEC (base_video_encoder)->time = GST_CLOCK_TIME_NONE; + } + + if (G_UNLIKELY (GST_BASE_VIDEO_CODEC (base_video_encoder)->discont)) { + GST_LOG_OBJECT (base_video_encoder, "marking discont"); + GST_BUFFER_FLAG_SET (frame->src_buffer, GST_BUFFER_FLAG_DISCONT); + GST_BASE_VIDEO_CODEC (base_video_encoder)->discont = FALSE; + } + GST_BASE_VIDEO_CODEC (base_video_encoder)->frames = g_list_remove (GST_BASE_VIDEO_CODEC (base_video_encoder)->frames, frame); + /* FIXME get rid of this ? + * seems a roundabout way that adds little benefit to simply get + * and subsequently set. subclass is adult enough to set_caps itself ... + * so simply check/ensure/assert that src pad caps are set by now */ if (!base_video_encoder->set_output_caps) { + GstCaps *caps; + if (base_video_encoder_class->get_caps) { - GST_BASE_VIDEO_CODEC (base_video_encoder)->caps = - base_video_encoder_class->get_caps (base_video_encoder); + caps = base_video_encoder_class->get_caps (base_video_encoder); } else { - GST_BASE_VIDEO_CODEC (base_video_encoder)->caps = - gst_caps_new_simple ("video/unknown", NULL); + caps = gst_caps_new_simple ("video/unknown", NULL); } - gst_pad_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), - GST_BASE_VIDEO_CODEC (base_video_encoder)->caps); + GST_DEBUG_OBJECT (base_video_encoder, "src caps %" GST_PTR_FORMAT, caps); + gst_pad_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), caps); + gst_caps_unref (caps); base_video_encoder->set_output_caps = TRUE; } gst_buffer_set_caps (GST_BUFFER (frame->src_buffer), - GST_BASE_VIDEO_CODEC (base_video_encoder)->caps); + GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder))); if (frame->force_keyframe) { GstClockTime stream_time; GstClockTime running_time; - GstStructure *s; + GstEvent *ev; running_time = gst_segment_to_running_time (&GST_BASE_VIDEO_CODEC @@ -532,15 +801,24 @@ gst_base_video_encoder_finish_frame (GstBaseVideoEncoder * base_video_encoder, (base_video_encoder)->segment, GST_FORMAT_TIME, frame->presentation_timestamp); - /* FIXME this should send the event that we got on the sink pad - instead of creating a new one */ - s = gst_structure_new ("GstForceKeyUnit", + /* re-use upstream event if any so it also conveys any additional + * info upstream arranged in there */ + GST_OBJECT_LOCK (base_video_encoder); + if (base_video_encoder->force_keyunit_event) { + ev = base_video_encoder->force_keyunit_event; + base_video_encoder->force_keyunit_event = NULL; + } else { + ev = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, + gst_structure_new ("GstForceKeyUnit", NULL)); + } + GST_OBJECT_UNLOCK (base_video_encoder); + + gst_structure_set (ev->structure, "timestamp", G_TYPE_UINT64, frame->presentation_timestamp, "stream-time", G_TYPE_UINT64, stream_time, "running-time", G_TYPE_UINT64, running_time, NULL); - gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), - gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, s)); + gst_pad_push_event (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), ev); } if (base_video_encoder_class->shape_output) { @@ -551,42 +829,33 @@ gst_base_video_encoder_finish_frame (GstBaseVideoEncoder * base_video_encoder, frame->src_buffer); } + /* handed out */ + frame->src_buffer = NULL; gst_base_video_codec_free_frame (frame); return ret; } -int -gst_base_video_encoder_get_height (GstBaseVideoEncoder * base_video_encoder) -{ - return GST_BASE_VIDEO_CODEC (base_video_encoder)->state.height; -} - -int -gst_base_video_encoder_get_width (GstBaseVideoEncoder * base_video_encoder) -{ - return GST_BASE_VIDEO_CODEC (base_video_encoder)->state.width; -} - +/** + * gst_base_video_encoder_get_state: + * @base_video_encoder: a #GstBaseVideoEncoder + * + * Returns: #GstVideoState describing format of video data. + */ const GstVideoState * gst_base_video_encoder_get_state (GstBaseVideoEncoder * base_video_encoder) { return &GST_BASE_VIDEO_CODEC (base_video_encoder)->state; } -GstFlowReturn -gst_base_video_encoder_end_of_stream (GstBaseVideoEncoder * base_video_encoder, - GstBuffer * buffer) -{ - - if (GST_BASE_VIDEO_CODEC (base_video_encoder)->frames) { - GST_WARNING ("EOS with frames left over"); - } - - return gst_pad_push (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder), - buffer); -} - +/** + * gst_base_video_encoder_set_latency: + * @base_video_encoder: a #GstBaseVideoEncoder + * @min_latency: minimum latency + * @max_latency: maximum latency + * + * Informs baseclass of encoding latency. + */ void gst_base_video_encoder_set_latency (GstBaseVideoEncoder * base_video_encoder, GstClockTime min_latency, GstClockTime max_latency) @@ -594,13 +863,23 @@ gst_base_video_encoder_set_latency (GstBaseVideoEncoder * base_video_encoder, g_return_if_fail (min_latency >= 0); g_return_if_fail (max_latency >= min_latency); + GST_OBJECT_LOCK (base_video_encoder); base_video_encoder->min_latency = min_latency; base_video_encoder->max_latency = max_latency; + GST_OBJECT_UNLOCK (base_video_encoder); gst_element_post_message (GST_ELEMENT_CAST (base_video_encoder), gst_message_new_latency (GST_OBJECT_CAST (base_video_encoder))); } +/** + * gst_base_video_encoder_set_latency_fields: + * @base_video_encoder: a #GstBaseVideoEncoder + * @fields: latency in fields + * + * Informs baseclass of encoding latency in terms of fields (both min + * and max latency). + */ void gst_base_video_encoder_set_latency_fields (GstBaseVideoEncoder * base_video_encoder, int n_fields) @@ -615,6 +894,12 @@ gst_base_video_encoder_set_latency_fields (GstBaseVideoEncoder * } +/** + * gst_base_video_encoder_get_oldest_frame: + * @base_video_encoder: a #GstBaseVideoEncoder + * + * Returns: oldest unfinished pending #GstVideoFrame + */ GstVideoFrame * gst_base_video_encoder_get_oldest_frame (GstBaseVideoEncoder * base_video_encoder) @@ -627,3 +912,6 @@ gst_base_video_encoder_get_oldest_frame (GstBaseVideoEncoder * return NULL; return (GstVideoFrame *) (g->data); } + +/* FIXME there could probably be more of these; + * get by presentation_number, by presentation_time ? */ diff --git a/gst-libs/gst/video/gstbasevideoencoder.h b/gst-libs/gst/video/gstbasevideoencoder.h index 759519630c..169c82fd0f 100644 --- a/gst-libs/gst/video/gstbasevideoencoder.h +++ b/gst-libs/gst/video/gstbasevideoencoder.h @@ -1,5 +1,8 @@ /* GStreamer * Copyright (C) 2008 David Schleef + * Copyright (C) 2011 Mark Nauwelaerts . + * Copyright (C) 2011 Nokia Corporation. All rights reserved. + * Contact: Stefan Kost * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -26,7 +29,6 @@ #endif #include -#include G_BEGIN_DECLS @@ -60,64 +62,119 @@ G_BEGIN_DECLS typedef struct _GstBaseVideoEncoder GstBaseVideoEncoder; typedef struct _GstBaseVideoEncoderClass GstBaseVideoEncoderClass; +/** + * GstBaseVideoEncoder: + * @element: the parent element. + * + * The opaque #GstBaseVideoEncoder data structure. + */ struct _GstBaseVideoEncoder { GstBaseVideoCodec base_video_codec; + /*< protected >*/ + gboolean sink_clipping; + + guint64 presentation_frame_number; + int distance_from_sync; + + gboolean force_keyframe; + /*< private >*/ - gboolean sink_clipping; + /* FIXME move to real private part ? + * (and introduce a context ?) */ + gboolean set_output_caps; + gboolean drained; - guint64 presentation_frame_number; - int distance_from_sync; + gint64 min_latency; + gint64 max_latency; - gboolean set_output_caps; + GstEvent *force_keyunit_event; - gint64 min_latency; - gint64 max_latency; - - gboolean force_keyframe; + union { + void *padding; + gboolean at_eos; + } a; /* FIXME before moving to base */ - void *padding[GST_PADDING_LARGE]; + void *padding[GST_PADDING_LARGE-1]; }; +/** + * GstBaseVideoEncoderClass: + * @start: Optional. + * Called when the element starts processing. + * Allows opening external resources. + * @stop: Optional. + * Called when the element stops processing. + * Allows closing external resources. + * @set_format: Optional. + * Notifies subclass of incoming data format. + * GstVideoState fields have already been + * set according to provided caps. + * @handle_frame: Provides input frame to subclass. + * @finish: Optional. + * Called to request subclass to dispatch any pending remaining + * data (e.g. at EOS). + * @shape_output: Optional. + * Allows subclass to push frame downstream in whatever + * shape or form it deems appropriate. If not provided, + * provided encoded frame data is simply pushed downstream. + * @event: Optional. + * Event handler on the sink pad. This function should return + * TRUE if the event was handled and should be discarded + * (i.e. not unref'ed). + * @getcaps: Optional, but recommended. + * Provides src pad caps to baseclass. + * + * Subclasses can override any of the available virtual methods or not, as + * needed. At minimum @handle_frame needs to be overridden, and @set_format + * and @get_caps are likely needed as well. + */ struct _GstBaseVideoEncoderClass { - GstBaseVideoCodecClass base_video_codec_class; + GstBaseVideoCodecClass base_video_codec_class; - gboolean (*set_format) (GstBaseVideoEncoder *coder, GstVideoState *state); - gboolean (*start) (GstBaseVideoEncoder *coder); - gboolean (*stop) (GstBaseVideoEncoder *coder); - gboolean (*finish) (GstBaseVideoEncoder *coder); - gboolean (*handle_frame) (GstBaseVideoEncoder *coder, GstVideoFrame *frame); - GstFlowReturn (*shape_output) (GstBaseVideoEncoder *coder, GstVideoFrame *frame); - GstCaps *(*get_caps) (GstBaseVideoEncoder *coder); + /*< public >*/ + /* virtual methods for subclasses */ + gboolean (*start) (GstBaseVideoEncoder *coder); + + gboolean (*stop) (GstBaseVideoEncoder *coder); + + gboolean (*set_format) (GstBaseVideoEncoder *coder, + GstVideoState *state); + + GstFlowReturn (*handle_frame) (GstBaseVideoEncoder *coder, + GstVideoFrame *frame); + + gboolean (*finish) (GstBaseVideoEncoder *coder); + + GstFlowReturn (*shape_output) (GstBaseVideoEncoder *coder, + GstVideoFrame *frame); + + gboolean (*event) (GstBaseVideoEncoder *coder, + GstEvent *event); + + GstCaps * (*get_caps) (GstBaseVideoEncoder *coder); + + /*< private >*/ /* FIXME before moving to base */ - void *padding[GST_PADDING_LARGE]; + gpointer _gst_reserved[GST_PADDING_LARGE]; }; -GType gst_base_video_encoder_get_type (void); +GType gst_base_video_encoder_get_type (void); -int gst_base_video_encoder_get_width (GstBaseVideoEncoder *coder); -int gst_base_video_encoder_get_height (GstBaseVideoEncoder *coder); -const GstVideoState *gst_base_video_encoder_get_state (GstBaseVideoEncoder *coder); +const GstVideoState* gst_base_video_encoder_get_state (GstBaseVideoEncoder *coder); -guint64 gst_base_video_encoder_get_timestamp_offset (GstBaseVideoEncoder *coder); - -GstVideoFrame *gst_base_video_encoder_get_frame (GstBaseVideoEncoder *coder, - int frame_number); -GstVideoFrame *gst_base_video_encoder_get_oldest_frame (GstBaseVideoEncoder *coder); -GstFlowReturn gst_base_video_encoder_finish_frame (GstBaseVideoEncoder *base_video_encoder, - GstVideoFrame *frame); -GstFlowReturn gst_base_video_encoder_end_of_stream (GstBaseVideoEncoder *base_video_encoder, - GstBuffer *buffer); - -void gst_base_video_encoder_set_latency (GstBaseVideoEncoder *base_video_encoder, - GstClockTime min_latency, GstClockTime max_latency); -void gst_base_video_encoder_set_latency_fields (GstBaseVideoEncoder *base_video_encoder, - int n_fields); +GstVideoFrame* gst_base_video_encoder_get_oldest_frame (GstBaseVideoEncoder *coder); +GstFlowReturn gst_base_video_encoder_finish_frame (GstBaseVideoEncoder *base_video_encoder, + GstVideoFrame *frame); +void gst_base_video_encoder_set_latency (GstBaseVideoEncoder *base_video_encoder, + GstClockTime min_latency, GstClockTime max_latency); +void gst_base_video_encoder_set_latency_fields (GstBaseVideoEncoder *base_video_encoder, + int n_fields); G_END_DECLS diff --git a/gst-libs/gst/video/gstbasevideoutils.c b/gst-libs/gst/video/gstbasevideoutils.c index 4ccdd58c5e..2d83213478 100644 --- a/gst-libs/gst/video/gstbasevideoutils.c +++ b/gst-libs/gst/video/gstbasevideoutils.c @@ -21,7 +21,7 @@ #include "config.h" #endif -#include "gstbasevideoutils.h" +#include "gstbasevideocodec.h" #include @@ -29,21 +29,6 @@ GST_DEBUG_CATEGORY_EXTERN (basevideocodec_debug); #define GST_CAT_DEFAULT basevideocodec_debug -#if 0 -guint64 -gst_base_video_convert_bytes_to_frames (GstVideoState * state, guint64 bytes) -{ - return gst_util_uint64_scale_int (bytes, 1, state->bytes_per_picture); -} - -guint64 -gst_base_video_convert_frames_to_bytes (GstVideoState * state, guint64 frames) -{ - return frames * state->bytes_per_picture; -} -#endif - - gboolean gst_base_video_rawvideo_convert (GstVideoState * state, GstFormat src_format, gint64 src_value, @@ -51,7 +36,10 @@ gst_base_video_rawvideo_convert (GstVideoState * state, { gboolean res = FALSE; - if (src_format == *dest_format) { + g_return_val_if_fail (dest_format != NULL, FALSE); + g_return_val_if_fail (dest_value != NULL, FALSE); + + if (src_format == *dest_format || src_value == 0 || src_value == -1) { *dest_value = src_value; return TRUE; } @@ -81,43 +69,77 @@ gst_base_video_rawvideo_convert (GstVideoState * state, *dest_value = gst_util_uint64_scale (src_value, state->fps_n, GST_SECOND * state->fps_d); res = TRUE; + } else if (src_format == GST_FORMAT_TIME && + *dest_format == GST_FORMAT_BYTES && state->fps_d != 0 && + state->bytes_per_picture != 0) { + /* convert time to frames */ + /* FIXME subtract segment time? */ + *dest_value = gst_util_uint64_scale (src_value, + state->fps_n * state->bytes_per_picture, GST_SECOND * state->fps_d); + res = TRUE; + } else if (src_format == GST_FORMAT_BYTES && + *dest_format == GST_FORMAT_TIME && state->fps_n != 0 && + state->bytes_per_picture != 0) { + /* convert frames to time */ + /* FIXME add segment time? */ + *dest_value = gst_util_uint64_scale (src_value, + GST_SECOND * state->fps_d, state->fps_n * state->bytes_per_picture); + res = TRUE; } - /* FIXME add bytes <--> time */ - return res; } gboolean gst_base_video_encoded_video_convert (GstVideoState * state, - GstFormat src_format, gint64 src_value, - GstFormat * dest_format, gint64 * dest_value) + gint64 bytes, gint64 time, GstFormat src_format, + gint64 src_value, GstFormat * dest_format, gint64 * dest_value) { gboolean res = FALSE; - if (src_format == *dest_format) { - *dest_value = src_value; + g_return_val_if_fail (dest_format != NULL, FALSE); + g_return_val_if_fail (dest_value != NULL, FALSE); + + if (G_UNLIKELY (src_format == *dest_format || src_value == 0 || + src_value == -1)) { + if (dest_value) + *dest_value = src_value; return TRUE; } - GST_DEBUG ("src convert"); - -#if 0 - if (src_format == GST_FORMAT_DEFAULT && *dest_format == GST_FORMAT_TIME) { - if (dec->fps_d != 0) { - *dest_value = gst_util_uint64_scale (granulepos_to_frame (src_value), - dec->fps_d * GST_SECOND, dec->fps_n); - res = TRUE; - } else { - res = FALSE; - } - } else { - GST_WARNING ("unhandled conversion from %d to %d", src_format, - *dest_format); - res = FALSE; + if (bytes <= 0 || time <= 0) { + GST_DEBUG ("not enough metadata yet to convert"); + goto exit; } -#endif + switch (src_format) { + case GST_FORMAT_BYTES: + switch (*dest_format) { + case GST_FORMAT_TIME: + *dest_value = gst_util_uint64_scale (src_value, time, bytes); + res = TRUE; + break; + default: + res = FALSE; + } + break; + case GST_FORMAT_TIME: + switch (*dest_format) { + case GST_FORMAT_BYTES: + *dest_value = gst_util_uint64_scale (src_value, bytes, time); + res = TRUE; + break; + default: + res = FALSE; + } + break; + default: + GST_DEBUG ("unhandled conversion from %d to %d", src_format, + *dest_format); + res = FALSE; + } + +exit: return res; } diff --git a/gst-libs/gst/video/gstbasevideoutils.h b/gst-libs/gst/video/gstbasevideoutils.h deleted file mode 100644 index 5f71aee510..0000000000 --- a/gst-libs/gst/video/gstbasevideoutils.h +++ /dev/null @@ -1,101 +0,0 @@ -/* GStreamer - * Copyright (C) 2008 David Schleef - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef _GST_BASE_VIDEO_UTILS_H_ -#define _GST_BASE_VIDEO_UTILS_H_ - -#ifndef GST_USE_UNSTABLE_API -#warning "The base video utils API is unstable and may change in future." -#warning "You can define GST_USE_UNSTABLE_API to avoid this warning." -#endif - -#include -#include -#include - -G_BEGIN_DECLS - -typedef struct _GstVideoState GstVideoState; -typedef struct _GstVideoFrame GstVideoFrame; - -struct _GstVideoState -{ - GstVideoFormat format; - int width, height; - int fps_n, fps_d; - int par_n, par_d; - - gboolean have_interlaced; - gboolean interlaced; - gboolean top_field_first; - - int clean_width, clean_height; - int clean_offset_left, clean_offset_top; - - int bytes_per_picture; - - //GstSegment segment; - - int picture_number; - GstBuffer *codec_data; - -}; - -struct _GstVideoFrame -{ - GstClockTime decode_timestamp; - GstClockTime presentation_timestamp; - GstClockTime presentation_duration; - - gint system_frame_number; - gint decode_frame_number; - gint presentation_frame_number; - - int distance_from_sync; - gboolean is_sync_point; - gboolean is_eos; - - GstBuffer *sink_buffer; - GstBuffer *src_buffer; - - int field_index; - int n_fields; - - void *coder_hook; - GstClockTime deadline; - - gboolean force_keyframe; -}; - -gboolean gst_base_video_rawvideo_convert (GstVideoState *state, - GstFormat src_format, gint64 src_value, - GstFormat * dest_format, gint64 *dest_value); -gboolean gst_base_video_encoded_video_convert (GstVideoState *state, - GstFormat src_format, gint64 src_value, - GstFormat * dest_format, gint64 *dest_value); - -GstClockTime gst_video_state_get_timestamp (const GstVideoState *state, - GstSegment *segment, int frame_number); - -GstBuffer *gst_adapter_get_buffer (GstAdapter *adapter); - -G_END_DECLS - -#endif - diff --git a/gst-plugins-bad.doap b/gst-plugins-bad.doap index 2ec1153d84..a4a3535a3c 100644 --- a/gst-plugins-bad.doap +++ b/gst-plugins-bad.doap @@ -33,6 +33,17 @@ real live maintainer, or some actual wide use. + + + 0.10.22 + 0.10 + Toy Piano + 2011-05-10 + + + + + 0.10.21 diff --git a/gst-plugins-bad.spec.in b/gst-plugins-bad.spec.in index 3b4fa9e27b..c1c81f198f 100644 --- a/gst-plugins-bad.spec.in +++ b/gst-plugins-bad.spec.in @@ -1,223 +1,433 @@ -%define majorminor @GST_MAJORMINOR@ -%define gstreamer gstreamer +%define majorminor @GST_MAJORMINOR@ +%define gstreamer gstreamer -%define gst_minver 0.10.0 +%define gst_minver 0.10.30 +%define gstpb_minver 0.10.30 -Name: %{gstreamer}-plugins-bad -Version: @VERSION@ -Release: @PACKAGE_VERSION_RELEASE@.gst -Summary: GStreamer plug-ins of bad quality +Summary: GStreamer streaming media framework "bad" plug-ins +Name: gstreamer-plugins-bad +Version: @VERSION@ +Release: @PACKAGE_VERSION_RELEASE@.gst +# The freeze and nfs plugins are LGPLv2 (only) +License: LGPLv2+ and LGPLv2 +Group: Applications/Multimedia +URL: http://gstreamer.freedesktop.org/ +Source: http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-%{version}.tar.bz2 +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -%define majorminor @GST_MAJORMINOR@ +Requires: %{gstreamer} >= %{gst_minver} +BuildRequires: %{gstreamer}-devel >= %{gst_minver} +BuildRequires: %{gstreamer}-plugins-base-devel >= %{gstpb_minver} -Group: Applications/Multimedia -License: LGPL -URL: http://gstreamer.freedesktop.org/ -Vendor: GStreamer Backpackers Team -Source: http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: check +BuildRequires: gettext-devel +BuildRequires: PyXML +BuildRequires: libXt-devel +BuildRequires: gtk-doc -Requires: %{gstreamer} >= %{gst_minver} -BuildRequires: %{gstreamer}-devel >= %{gst_minver} +BuildRequires: bzip2-devel +BuildRequires: celt-devel +BuildRequires: dirac-devel +BuildRequires: exempi-devel +BuildRequires: gmyth-devel >= 0.4 +BuildRequires: gsm-devel +BuildRequires: jack-audio-connection-kit-devel +BuildRequires: jasper-devel +BuildRequires: ladspa-devel +BuildRequires: libass-devel +BuildRequires: libcdaudio-devel +%ifnarch s390 s390x +BuildRequires: libdc1394-devel +%endif +BuildRequires: libdvdnav-devel +BuildRequires: libexif-devel +BuildRequires: libiptcdata-devel +BuildRequires: libkate-devel +BuildRequires: libmodplug-devel +BuildRequires: libmpcdec-devel +BuildRequires: libofa-devel +BuildRequires: liboil-devel +BuildRequires: librsvg2-devel +BuildRequires: libsndfile-devel +BuildRequires: libtimidity-devel +BuildRequires: libvpx-devel +BuildRequires: mesa-libGLU-devel +BuildRequires: openssl-devel +BuildRequires: orc-devel +BuildRequires: schroedinger-devel +BuildRequires: SDL-devel +BuildRequires: slv2-devel +BuildRequires: soundtouch-devel +Buildrequires: wavpack-devel +BuildRequires: wildmidi-devel +BuildRequires: zbar-devel +BuildRequires: libdca-devel +BuildRequires: faad2-devel +BuildRequires: xvidcore-devel +BuildRequires: libmms-devel +BuildRequires: mjpegtools-devel +BuildRequires: twolame-devel +BuildRequires: libmimic-devel -BuildRequires: gcc-c++ -@USE_LADSPA_TRUE@BuildRequires: ladspa-devel -@USE_FAAD_TRUE@BuildRequires: faad2-devel >= 2.0 -@USE_GSM_TRUE@BuildRequires: gsm-devel >= 1.0.10 -@USE_SDL_TRUE@Requires: SDL >= 1.2.0 -@USE_SWFDEC_TRUE@BuildRequires: swfdec-devel -@USE_FAAD_TRUE@Provides: gstreamer-faad = %{version}-%{release} -@USE_FAAC_TRUE@Requires: faac >= 1.23 -@USE_GSM_TRUE@Provides: gstreamer-gsm = %{version}-%{release} -@USE_LIBMMS_TRUE@Requires: libmms >= 0.1 -@USE_MYTHTV_TRUE@Requires: gmyth + +Obsoletes: gstreamer-plugins-flumpegdemux < 0.10.15-9 +Provides: gstreamer-plugins-flumpegdemux = %{version}-%{release} +Obsoletes: gstreamer-plugins-schroedinger < 1.0.9 +Provides: gstreamer-plugins-schroedinger = %{version}-%{release} + +Provides: gstreamer-plugins-farsight = 0.12.12-1 +Obsoletes: gstreamer-plugins-farsight < 0.12.12 + +%package free +Summary: Extra GStreamer "bad" plugins (Plugins shipped by default in Fedora) +Group: Applications/Multimedia +Requires: %{name} = %{version}-%{release} + +%description free +GStreamer is a streaming media framework, based on graphs of elements which +operate on media data. + +This package contains plug-ins that aren't tested +well enough, or the code is not of good enough quality. %description -GStreamer is a streaming media framework, based on graphs of filters which -operate on media data. Applications using this library can do anything -from real-time sound processing to playing videos, and just about anything -else media-related. Its plugin-based architecture means that new data -types or processing capabilities can be added simply by installing new -plug-ins. +GStreamer is a streaming media framework, based on graphs of elements which +operate on media data. + +This package containes the plugins which didn't fit into free or extra + +%package extras +Summary: Extra GStreamer "bad" plugins (less often used "bad" plugins) +Group: Applications/Multimedia +Requires: %{name} = %{version}-%{release} +Obsoletes: gstreamer-plugins-bad-extras < %{version}-%{release} +Provides: gstreamer-plugins-bad-extras = %{version}-%{release} + +%description extras +GStreamer is a streaming media framework, based on graphs of elements which +operate on media data. + +gstreamer-plugins-bad contains plug-ins that aren't +tested well enough, or the code is not of good enough quality. + +This package (gstreamer-plugins-bad-extras) contains extra "bad" plugins for +sources (mythtv), sinks (jack) and effects (pitch) which are not used +very much and require additional libraries to be installed. + + +%package devel +Summary: Development files for the GStreamer media framework "bad" plug-ins +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: gstreamer-plugins-base-devel +Obsoletes: gstreamer-plugins-bad-devel < %{version}-%{release} +Provides: gstreamer-plugins-bad-devel = %{version}-%{release} + +%description devel +GStreamer is a streaming media framework, based on graphs of elements which +operate on media data. + +This package contains the development files for the plug-ins that +aren't tested well enough, or the code is not of good enough quality. + + +%package devel-docs +Summary: Development documentation for the GStreamer "bad" plug-ins +Group: Development/Libraries +Requires: %{name}-devel = %{version}-%{release} +Obsoletes: gstreamer-plugins-bad-devel-docs < %{version}-%{release} +Provides: gstreamer-plugins-bad-devel-docs = %{version}-%{release} + +%description devel-docs +GStreamer is a streaming media framework, based on graphs of elements which +operate on media data. + +This package contains the development documentation for the plug-ins that +aren't tested well enough, or the code is not of good enough quality. -This package contains GStreamer Plugins that are considered to be of bad -quality, even though they might work. %prep %setup -q -n gst-plugins-bad-%{version} %build -%configure --enable-experimental +%configure \ + --with-package-name="Fedora gstreamer-plugins-bad package" \ + --with-package-origin="http://gstreamer.freedesktop.org" \ + --enable-debug --disable-static --enable-gtk-doc --enable-experimental -make %{?_smp_mflags} +# %{__make} %{?_smp_mflags} +make ERROR_CFLAGS='' ERROR_CXXFLAGS='' %install -rm -rf $RPM_BUILD_ROOT - -%makeinstall - -# Clean out files that should not be part of the rpm. -rm -f $RPM_BUILD_ROOT%{_libdir}/gstreamer-%{majorminor}/*.la -rm -f $RPM_BUILD_ROOT%{_libdir}/gstreamer-%{majorminor}/*.a -rm -f $RPM_BUILD_ROOT%{_libdir}/*.a -rm -f $RPM_BUILD_ROOT%{_libdir}/*.la - +%{__rm} -rf %{buildroot} +%{__make} install DESTDIR="%{buildroot}" %find_lang gst-plugins-bad-%{majorminor} +# Clean out files that should not be part of the rpm. +%{__rm} -f %{buildroot}%{_libdir}/gstreamer-%{majorminor}/*.la +%{__rm} -f %{buildroot}%{_libdir}/*.la + + %clean -rm -rf $RPM_BUILD_ROOT +%{__rm} -rf %{buildroot} + + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig %files -f gst-plugins-bad-%{majorminor}.lang -%defattr(-, root, root) -%doc AUTHORS COPYING README REQUIREMENTS gst-plugins-bad.doap -%{_bindir}/gst-camera -%{_bindir}/gst-camera-perf - -# non-core plugins without external dependencies -%{_libdir}/gstreamer-%{majorminor}/libgsttta.so -%{_libdir}/gstreamer-%{majorminor}/libgstspeed.so -%{_libdir}/gstreamer-%{majorminor}/libgstcdxaparse.so -%{_libdir}/gstreamer-%{majorminor}/libgstfreeze.so -%{_libdir}/gstreamer-%{majorminor}/libgsth264parse.so -%{_libdir}/gstreamer-%{majorminor}/libgstnsf.so -%{_libdir}/gstreamer-%{majorminor}/libgstnuvdemux.so -%{_libdir}/gstreamer-%{majorminor}/libgstrfbsrc.so -%{_libdir}/gstreamer-%{majorminor}/libgstreal.so -%{_libdir}/gstreamer-%{majorminor}/libgstmve.so -%{_libdir}/gstreamer-%{majorminor}/libgstmpegvideoparse.so -%{_libdir}/gstreamer-%{majorminor}/libgstbayer.so +# Plugins without external dependencies +%{_libdir}/gstreamer-%{majorminor}/libgstasfmux.so %{_libdir}/gstreamer-%{majorminor}/libgstdvdspu.so -%{_libdir}/gstreamer-%{majorminor}/libgstfestival.so -%{_libdir}/gstreamer-%{majorminor}/libgststereo.so -%{_libdir}/gstreamer-%{majorminor}/libgstvcdsrc.so -%{_libdir}/gstreamer-%{majorminor}/libgstdvb.so -%{_libdir}/gstreamer-%{majorminor}/libgstsdpelem.so -%{_libdir}/gstreamer-%{majorminor}/libgstmpeg4videoparse.so -%{_libdir}/gstreamer-%{majorminor}/libgstfbdevsink.so -%{_libdir}/gstreamer-%{majorminor}/libgstrawparse.so -%{_libdir}/gstreamer-%{majorminor}/libgstsubenc.so -%{_libdir}/gstreamer-%{majorminor}/libresindvd.so -%{_libdir}/gstreamer-%{majorminor}/libgstaiff.so -%{_libdir}/gstreamer-%{majorminor}/libgstdccp.so -%{_libdir}/gstreamer-%{majorminor}/libgstpcapparse.so +%{_libdir}/gstreamer-%{majorminor}/libgstmpegpsmux.so %{_libdir}/gstreamer-%{majorminor}/libgstmpegtsmux.so -%{_libdir}/gstreamer-%{majorminor}/libgstscaletempoplugin.so -%{_libdir}/gstreamer-%{majorminor}/libgstmpegdemux.so -%{_libdir}/gstreamer-%{majorminor}/libgstmpegtsdemux.so -%{_libdir}/gstreamer-%{majorminor}/libgstjp2k.so -%{_libdir}/gstreamer-%{majorminor}/libgstapexsink.so -%{_libdir}/gstreamer-%{majorminor}/libgstqtmux.so -%{_libdir}/gstreamer-%{majorminor}/libgstlegacyresample.so -%{_libdir}/gstreamer-%{majorminor}/libgstmxf.so -%{_libdir}/gstreamer-%{majorminor}/libgstvmnc.so -%{_libdir}/gstreamer-%{majorminor}/libgstvideosignal.so -%{_libdir}/gstreamer-%{majorminor}/libgstautoconvert.so -%{_libdir}/gstreamer-%{majorminor}/libgstdtmf.so -%{_libdir}/gstreamer-%{majorminor}/libgstliveadder.so -%{_libdir}/gstreamer-%{majorminor}/libgstrtpmux.so +%ifarch %{ix86} x86_64 +%{_libdir}/gstreamer-%{majorminor}/libgstreal.so +%endif %{_libdir}/gstreamer-%{majorminor}/libgstsiren.so + +# Plugins with external dependencies +%{_libdir}/gstreamer-%{majorminor}/libgstdtsdec.so +%{_libdir}/gstreamer-%{majorminor}/libgstfaad.so +%{_libdir}/gstreamer-%{majorminor}/libgstmms.so +%{_libdir}/gstreamer-%{majorminor}/libgstmimic.so +%{_libdir}/gstreamer-%{majorminor}/libgstmpeg2enc.so +%{_libdir}/gstreamer-%{majorminor}/libgstmplex.so +%{_libdir}/gstreamer-%{majorminor}/libgstxvid.so +%{_libdir}/gstreamer-%{majorminor}/libgstfaac.so + +%files free +%defattr(-,root,root,-) +%doc AUTHORS COPYING README REQUIREMENTS +#%{_datadir}/gstreamer-%{majorminor} +%{_libdir}/libgstbasevideo-%{majorminor}.so.* +%{_libdir}/libgstphotography-%{majorminor}.so.* +%{_libdir}/libgstsignalprocessor-%{majorminor}.so.* +# Plugins without external dependencies %{_libdir}/gstreamer-%{majorminor}/libgstadpcmdec.so %{_libdir}/gstreamer-%{majorminor}/libgstadpcmenc.so -%{_libdir}/gstreamer-%{majorminor}/libgstid3tag.so -%{_libdir}/gstreamer-%{majorminor}/libgsthdvparse.so -%{_libdir}/gstreamer-%{majorminor}/libgstdebugutilsbad.so -%{_libdir}/gstreamer-%{majorminor}/libgstasfmux.so -%{_libdir}/gstreamer-%{majorminor}/libgstpnm.so -%{_libdir}/gstreamer-%{majorminor}/libgstvideomeasure.so -%{_libdir}/gstreamer-%{majorminor}/libgstaudioparsersbad.so -%{_libdir}/gstreamer-%{majorminor}/libgstrsvg.so - -%{_includedir}/gstreamer-%{majorminor}/gst/video/gstbasevideocodec.h -%{_includedir}/gstreamer-%{majorminor}/gst/video/gstbasevideodecoder.h -%{_includedir}/gstreamer-%{majorminor}/gst/video/gstbasevideoencoder.h -%{_includedir}/gstreamer-%{majorminor}/gst/video/gstbasevideoparse.h -%{_includedir}/gstreamer-%{majorminor}/gst/video/gstbasevideoutils.h -%{_datadir}/gstreamer-%{majorminor}/camera-apps/gst-camera.ui -%{_includedir}/gstreamer-%{majorminor}/gst/signalprocessor/gstsignalprocessor.h - -%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/photography-enumtypes.h -%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/photography.h -%{_libdir}/libgstphotography-0.10.so +%{_libdir}/gstreamer-%{majorminor}/libgstaiff.so +%{_libdir}/gstreamer-%{majorminor}/libgstautoconvert.so +%{_libdir}/gstreamer-%{majorminor}/libgstbayer.so %{_libdir}/gstreamer-%{majorminor}/libgstcamerabin.so -%{_libdir}/libgstphotography-%{majorminor}.so.0 -%{_libdir}/libgstphotography-%{majorminor}.so.0.0.0 -%{_libdir}/libgstbasevideo* -%{_libdir}/libgstsignalprocessor* -%{_libdir}/gstreamer-%{majorminor}/libgstmpegpsmux.so +%{_libdir}/gstreamer-%{majorminor}/libgstcdxaparse.so +%{_libdir}/gstreamer-%{majorminor}/libgstcog.so +%{_libdir}/gstreamer-%{majorminor}/libgstcoloreffects.so +%{_libdir}/gstreamer-%{majorminor}/libgstdataurisrc.so +%{_libdir}/gstreamer-%{majorminor}/libgstdccp.so +%{_libdir}/gstreamer-%{majorminor}/libgstdtmf.so +%{_libdir}/gstreamer-%{majorminor}/libgstfestival.so +%{_libdir}/gstreamer-%{majorminor}/libgstfreeze.so +%{_libdir}/gstreamer-%{majorminor}/libgstfrei0r.so +%{_libdir}/gstreamer-%{majorminor}/libgstgaudieffects.so +%{_libdir}/gstreamer-%{majorminor}/libgstgeometrictransform.so +%{_libdir}/gstreamer-%{majorminor}/libgstgsettingselements.so +%{_libdir}/gstreamer-%{majorminor}/libgsth264parse.so +%{_libdir}/gstreamer-%{majorminor}/libgsthdvparse.so +%{_libdir}/gstreamer-%{majorminor}/libgstid3tag.so +%{_libdir}/gstreamer-%{majorminor}/libgstinvtelecine.so +%{_libdir}/gstreamer-%{majorminor}/libgstivfparse.so +%{_libdir}/gstreamer-%{majorminor}/libgstjpegformat.so +%{_libdir}/gstreamer-%{majorminor}/libgstlegacyresample.so +%{_libdir}/gstreamer-%{majorminor}/libgstliveadder.so +%{_libdir}/gstreamer-%{majorminor}/libgstmpeg4videoparse.so +%{_libdir}/gstreamer-%{majorminor}/libgstmpegdemux.so +%{_libdir}/gstreamer-%{majorminor}/libgstmpegvideoparse.so +%{_libdir}/gstreamer-%{majorminor}/libgstmve.so +%{_libdir}/gstreamer-%{majorminor}/libgstmxf.so +%{_libdir}/gstreamer-%{majorminor}/libgstnsf.so +%{_libdir}/gstreamer-%{majorminor}/libgstnuvdemux.so +%{_libdir}/gstreamer-%{majorminor}/libgstpcapparse.so +%{_libdir}/gstreamer-%{majorminor}/libgstpnm.so +%{_libdir}/gstreamer-%{majorminor}/libgstrfbsrc.so +%{_libdir}/gstreamer-%{majorminor}/libgstrtpmux.so +%{_libdir}/gstreamer-%{majorminor}/libgstsegmentclip.so +%{_libdir}/gstreamer-%{majorminor}/libgstrawparse.so +%{_libdir}/gstreamer-%{majorminor}/libgstscaletempoplugin.so +%{_libdir}/gstreamer-%{majorminor}/libgstshm.so +%{_libdir}/gstreamer-%{majorminor}/libgstsdpelem.so +%{_libdir}/gstreamer-%{majorminor}/libgstspeed.so +%{_libdir}/gstreamer-%{majorminor}/libgststereo.so +%{_libdir}/gstreamer-%{majorminor}/libgstsubenc.so +%{_libdir}/gstreamer-%{majorminor}/libgsttta.so +%{_libdir}/gstreamer-%{majorminor}/libgstvideosignal.so +%{_libdir}/gstreamer-%{majorminor}/libgstvideomaxrate.so +%{_libdir}/gstreamer-%{majorminor}/libgstvideomeasure.so +%{_libdir}/gstreamer-%{majorminor}/libgstvmnc.so +%{_libdir}/gstreamer-%{majorminor}/libgstcamerabin2.so +%{_libdir}/gstreamer-%{majorminor}/libgstcolorspace.so +%{_libdir}/gstreamer-%{majorminor}/libgstcurl.so +%{_libdir}/gstreamer-%{majorminor}/libgstdecklink.so +%{_libdir}/gstreamer-%{majorminor}/libgstdvbsuboverlay.so +%{_libdir}/gstreamer-%{majorminor}/libgstfieldanalysis.so +%{_libdir}/gstreamer-%{majorminor}/libgstfragmented.so +%{_libdir}/gstreamer-%{majorminor}/libgstinterlace.so +%{_libdir}/gstreamer-%{majorminor}/libgstjp2kdecimator.so +%{_libdir}/gstreamer-%{majorminor}/libgstlinsys.so +%{_libdir}/gstreamer-%{majorminor}/libgstmpegtsdemux.so +%{_libdir}/gstreamer-%{majorminor}/libgstopencv.so +%{_libdir}/gstreamer-%{majorminor}/libgstpatchdetect.so +%{_libdir}/gstreamer-%{majorminor}/libgstrtpvp8.so +%{_libdir}/gstreamer-%{majorminor}/libgstsdi.so +%{_libdir}/gstreamer-%{majorminor}/libgstvideofiltersbad.so +%{_libdir}/gstreamer-%{majorminor}/libgstvideoparsersbad.so +%{_libdir}/gstreamer-%{majorminor}/libgsty4mdec.so +%{_libdir}/gstreamer-%{majorminor}//libgstopenal.so +%{_libdir}/libgstbasecamerabinsrc-%{majorminor}.so.0 +%{_libdir}/libgstbasecamerabinsrc-%{majorminor}.so.0.0.0 -# hopefully very shortlived .pc file for bad -%{_libdir}/pkgconfig/gstreamer-plugins-bad-0.10.pc +# System (Linux) specific plugins +%{_libdir}/gstreamer-%{majorminor}/libgstdvb.so +%{_libdir}/gstreamer-%{majorminor}/libgstvcdsrc.so -# gstreamer-plugins with external dependencies but in the main package -@USE_FAAD_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstfaad.so -@USE_FAAC_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstfaac.so -@USE_MUSICBRAINZ_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgsttrm.so -@USE_SDL_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstsdl.so -@USE_SWFDEC_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstswfdec.so -@USE_LIBMMS_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstmms.so -@USE_XVID_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstxvid.so -@USE_BZ2_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstbz2.so -@USE_NEON_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstneonhttpsrc.so -@USE_MUSEPACK_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstmusepack.so -@USE_GSM_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstgsm.so -@USE_DTS_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstdtsdec.so -@USE_LADSPA_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstladspa.so -@USE_MYTHTV_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstmythtvsrc.so -@USE_DC1394_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstdc1394.so -@USE_TIMIDITY_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgsttimidity.so -@USE_WILDMIDI_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstwildmidi.so -@USE_SNDFILE_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstsndfile.so -@USE_CELT_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstcelt.so -@USE_MPEG2ENC_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstmpeg2enc.so -@USE_MPLEX_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstmplex.so -@USE_KATE_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstkate.so -@USE_ASSRENDER_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstassrender.so -@USE_PLUGIN_FREI0R_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstfrei0r.so -@USE_SCHRO_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstschro.so -@USE_OFA_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstofa.so -@USE_METADATA_TRUE@%{_libdir}/gstreamer-%{majorminor}/libgstmetadata.so +# Plugins with external dependencies +%{_libdir}/gstreamer-%{majorminor}/libgstapexsink.so +%{_libdir}/gstreamer-%{majorminor}/libgstassrender.so +%{_libdir}/gstreamer-%{majorminor}/libgstbz2.so +%{_libdir}/gstreamer-%{majorminor}/libgstcdaudio.so +%{_libdir}/gstreamer-%{majorminor}/libgstcelt.so +%ifnarch s390 s390x +%{_libdir}/gstreamer-%{majorminor}/libgstdc1394.so +%endif +%{_libdir}/gstreamer-%{majorminor}/libgstdirac.so +%{_libdir}/gstreamer-%{majorminor}/libgstgsm.so +%{_libdir}/gstreamer-%{majorminor}/libgstjp2k.so +%{_libdir}/gstreamer-%{majorminor}/libgstkate.so +%{_libdir}/gstreamer-%{majorminor}/libgstladspa.so +%{_libdir}/gstreamer-%{majorminor}/libgstlv2.so +%{_libdir}/gstreamer-%{majorminor}/libgstmodplug.so +%{_libdir}/gstreamer-%{majorminor}/libgstmusepack.so +%{_libdir}/gstreamer-%{majorminor}/libgstofa.so +%{_libdir}/gstreamer-%{majorminor}/libresindvd.so +%{_libdir}/gstreamer-%{majorminor}/libgstrsvg.so +%{_libdir}/gstreamer-%{majorminor}/libgstschro.so +%{_libdir}/gstreamer-%{majorminor}/libgstsndfile.so +%{_libdir}/gstreamer-%{majorminor}/libgstvp8.so + +#debugging plugin +%{_libdir}/gstreamer-%{majorminor}/libgstdebugutilsbad.so + +#data for plugins +%{_datadir}/glib-2.0/schemas/org.freedesktop.gstreamer-0.10.default-elements.gschema.xml + +%files extras +%defattr(-,root,root,-) +# Plugins with external dependencies +# %{_libdir}/gstreamer-%{majorminor}/libgstjack.so +%{_libdir}/gstreamer-%{majorminor}/libgstmythtvsrc.so +%{_libdir}/gstreamer-%{majorminor}/libgstsdl.so +%{_libdir}/gstreamer-%{majorminor}/libgstsoundtouch.so +%{_libdir}/gstreamer-%{majorminor}/libgsttimidity.so +%{_libdir}/gstreamer-%{majorminor}/libgstwildmidi.so +%{_libdir}/gstreamer-%{majorminor}/libgstzbar.so +# Linux specific plugins +%{_libdir}/gstreamer-%{majorminor}/libgstfbdevsink.so + +%files devel +%defattr(-,root,root,-) +%{_libdir}/libgstbasevideo-%{majorminor}.so +%{_libdir}/libgstphotography-%{majorminor}.so +%{_libdir}/libgstsignalprocessor-%{majorminor}.so +%{_libdir}/libgstbasecamerabinsrc-%{majorminor}.so +%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/photography* +%{_includedir}/gstreamer-%{majorminor}/gst/signalprocessor +%{_includedir}/gstreamer-%{majorminor}/gst/video +%{_includedir}/gstreamer-%{majorminor}/gst/basecamerabinsrc/gstbasecamerasrc.h +%{_includedir}/gstreamer-%{majorminor}/gst/basecamerabinsrc/gstcamerabin-enum.h +%{_includedir}/gstreamer-%{majorminor}/gst/basecamerabinsrc/gstcamerabinpreview.h + + +# pkg-config files +%{_libdir}/pkgconfig/gstreamer-plugins-bad-%{majorminor}.pc + +%files devel-docs +%defattr(-,root,root,-) +%doc %{_datadir}/gtk-doc/html/gst-plugins-bad-plugins-%{majorminor} %changelog -* Thu Mar 12 2009 Christian Schaller -- Add Celt, mpeg2enc and mplex plugins to spec file +* Thu May 19 2011 Christian Schaller +- Merge in upstread Fedora RPM into git master one -* Thu Oct 9 2008 Christian Schaller -- flacparse, flvmux and j2kdec plugins added +* Wed Sep 15 2010 Hans de Goede 0.10.20-3 +- Rebuild for new wildmidi -* Mon Sep 1 2008 Christian Schaller -- Add tsmux and scaletempo plugins +* Mon Sep 13 2010 Dan Horák 0.10.20-2 +- no Firewire on s390(x) -* Fri May 2 2008 Christian Schaller -- Add Wildmidi plugin +* Mon Sep 06 2010 Benjamin Otte 0.10.20-1 +- Update to 0.10.20 +- Reenable celt -* Mon Apr 14 2008 Tim-Philipp Müller -- Remove souphttpsrc plugin, which has moved to gst-plugins-good. +* Fri Aug 06 2010 Benjamin Otte 0.10.19-6 +- Disable NAS now that it's obsolete -* Thu Apr 3 2008 Christian Schaller -- Add new OSSv4 plugin to SPEC file +* Thu Jul 04 2010 Benjamin Otte 0.10.19-5 +- Disable celt now that an update broke it -* Tue Apr 1 2008 Tim-Philipp Müller -- Update spec file for srtenc plugin rename to subenc +* Thu Jun 17 2010 Benjamin Otte 0.10.19-4 +- Move zbar to -extras. It pulls in too many deps and is not really useful. -* Tue Apr 1 2008 Christian Schaller -- Update spec with libgstsrtenc plugin +* Tue Jun 01 2010 Benjamin Otte 0.10.19-3 +- Put back accidentally deleted make command -* Wed Jan 23 2008 Christian Schaller -- Update spec with fbdev sink and rawparse, remove videoparse +* Tue Jun 1 2010 Ville Skyttä - 0.10.19-2 +- Rebuild. -* Fri Dec 14 2007 Christian Schaller -- Update spec file with timidity, libgstdvb, libgstsdpelem, libgstspeexresample, libgstmpeg4videoparse +* Mon May 31 2010 Benjamin Otte 0.10.19-1 +- Update to 0.10.19 -* Tue Jun 12 2007 Jan Schmidt -- wavpack and qtdemux have moved to good. +* Fri May 15 2010 Benjamin Otte 0.10.18.3-1 +- Update pre-release +- Add vp8 elements -* Thu Mar 22 2007 Christian Schaller -- Add x264 and mpegvideoparse plugins +* Fri May 15 2010 Benjamin Otte 0.10.18.2-1 +- Update to pre-release -* Fri Dec 15 2006 Thomas Vander Stichele -- add doap file -- more cleanup +* Thu Apr 15 2010 Benjamin Otte 0.10.18-2 +- Include cog plugin -* Sun Nov 27 2005 Thomas Vander Stichele -- redone for split +* Mon Mar 08 2010 Benjamin Otte 0.10.18-1 +- Update to 0.10.18 + +* Thu Mar 04 2010 Benjamin Otte 0.10.17.4-1 +- Update pre-release + +* Mon Mar 01 2010 Benjamin Otte 0.10.17.3-2 +- Fix Obsoletes and add Provides for extras/devel/docs + +* Thu Feb 25 2010 Benjamin Otte 0.10.17.3-1 +- Update to pre-release + +* Fri Feb 19 2010 Benjamin Otte 0.10.17.2-1 +- Update to prerelease + +* Sun Feb 14 2010 Benjamin Otte 0.10.17-7 +- Fix compilation problems with DSO linking (#565015) + +* Thu Feb 04 2010 Bastien Nocera 0.10.17-6 +- Obsolete third-party packages, for upgrade purposes + +* Tue Feb 02 2010 Bastien Nocera 0.10.17-5 +- Another try at obsolete problems with flumpegdemux and + schroedinger (#560987) + +* Mon Feb 01 2010 Bastien Nocera 0.10.17-4 +- Add versioned provides for flumpegdemux and schroedinger plugins + +* Wed Jan 27 2010 Bastien Nocera 0.10.17-3 +- Modify original sources with a script to remove problematic + elements, and remove those from the filelist + +* Fri Dec 04 2009 Bastien Nocera 0.10.17-2 +- Add LADSPA plugins + +* Tue Nov 17 2009 Bastien Nocera 0.10.17-1 +- Update to 0.10.17 + +* Tue Nov 10 2009 Bastien Nocera 0.10.16-2 +- Add schroedinger plugin (#530835) + +* Sat Nov 07 2009 Bastien Nocera 0.10.16-1 +- First version with -free name, updated to 0.10.16 diff --git a/gst/adpcmdec/Makefile.am b/gst/adpcmdec/Makefile.am index 5c60ad4f78..2521fe6f1f 100644 --- a/gst/adpcmdec/Makefile.am +++ b/gst/adpcmdec/Makefile.am @@ -10,3 +10,16 @@ libgstadpcmdec_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) libgstadpcmdec_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstadpcmdec_la_LIBTOOLFLAGS = --tag=disable-static +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstadpcmdec -:SHARED libgstadpcmdec \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstadpcmdec_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstadpcmdec_la_CFLAGS) \ + -:LDFLAGS $(libgstadpcmdec_la_LDFLAGS) \ + $(libgstadpcmdec_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/adpcmdec/adpcmdec.c b/gst/adpcmdec/adpcmdec.c index d8a8dec746..08a3e914cc 100644 --- a/gst/adpcmdec/adpcmdec.c +++ b/gst/adpcmdec/adpcmdec.c @@ -569,7 +569,7 @@ adpcmdec_base_init (gpointer klass) gst_element_class_set_details_simple (element_class, "ADPCM decoder", "Codec/Decoder/Audio", "Decode MS and IMA ADPCM audio", - "Pioneers of the Inevitable "); } static gboolean diff --git a/gst/adpcmenc/Makefile.am b/gst/adpcmenc/Makefile.am index 3cc258ede6..17b3ecd280 100644 --- a/gst/adpcmenc/Makefile.am +++ b/gst/adpcmenc/Makefile.am @@ -10,3 +10,16 @@ libgstadpcmenc_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) libgstadpcmenc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstadpcmenc_la_LIBTOOLFLAGS = --tag=disable-static +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstadpcmenc -:SHARED libgstadpcmenc \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstadpcmenc_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstadpcmenc_la_CFLAGS) \ + -:LDFLAGS $(libgstadpcmenc_la_LDFLAGS) \ + $(libgstadpcmenc_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/adpcmenc/adpcmenc.c b/gst/adpcmenc/adpcmenc.c index bc45c3da46..49e0550617 100644 --- a/gst/adpcmenc/adpcmenc.c +++ b/gst/adpcmenc/adpcmenc.c @@ -550,7 +550,7 @@ adpcmenc_base_init (gpointer klass) gst_element_class_set_details_simple (element_class, "ADPCM encoder", "Codec/Encoder/Audio", "Encode ADPCM audio", - "Pioneers of the Inevitable "); } static gboolean diff --git a/gst/aiff/Makefile.am b/gst/aiff/Makefile.am index 2cdbc889a1..8c4a1c5a12 100644 --- a/gst/aiff/Makefile.am +++ b/gst/aiff/Makefile.am @@ -13,3 +13,17 @@ libgstaiff_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstaiff_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = aiffmux.h aiffparse.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstaiff -:SHARED libgstaiff \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstaiff_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstaiff_la_CFLAGS) \ + -:LDFLAGS $(libgstaiff_la_LDFLAGS) \ + $(libgstaiff_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/aiff/aiffparse.c b/gst/aiff/aiffparse.c index c5eafa0305..a286dceec4 100644 --- a/gst/aiff/aiffparse.c +++ b/gst/aiff/aiffparse.c @@ -90,10 +90,11 @@ GST_STATIC_PAD_TEMPLATE ("sink", ); static GstStaticPadTemplate src_template_factory = -GST_STATIC_PAD_TEMPLATE ("src", + GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS) + GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS ";" + GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS) ); GST_BOILERPLATE (GstAiffParse, gst_aiff_parse, GstElement, GST_TYPE_ELEMENT); @@ -204,25 +205,6 @@ gst_aiff_parse_init (GstAiffParse * aiffparse, GstAiffParseClass * g_class) gst_element_add_pad (GST_ELEMENT_CAST (aiffparse), aiffparse->srcpad); } -/* Compute (value * nom) % denom, avoiding overflow. This can be used - * to perform ceiling or rounding division together with - * gst_util_uint64_scale[_int]. */ -#define uint64_scale_modulo(val, nom, denom) \ - ((val % denom) * (nom % denom) % denom) - -/* Like gst_util_uint64_scale, but performs ceiling division. */ -static guint64 -uint64_ceiling_scale (guint64 val, guint64 num, guint64 denom) -{ - guint64 result = gst_util_uint64_scale_int (val, num, denom); - - if (uint64_scale_modulo (val, num, denom) == 0) - return result; - else - return result + 1; -} - - static gboolean gst_aiff_parse_parse_file_header (GstAiffParse * aiff, GstBuffer * buf) { @@ -387,8 +369,8 @@ gst_aiff_parse_perform_seek (GstAiffParse * aiff, GstEvent * event) * bytes. */ if (aiff->bps > 0) aiff->offset = - uint64_ceiling_scale (seeksegment.last_stop, (guint64) aiff->bps, - GST_SECOND); + gst_util_uint64_scale_ceil (seeksegment.last_stop, + (guint64) aiff->bps, GST_SECOND); else aiff->offset = seeksegment.last_stop; GST_LOG_OBJECT (aiff, "offset=%" G_GUINT64_FORMAT, aiff->offset); @@ -404,7 +386,7 @@ gst_aiff_parse_perform_seek (GstAiffParse * aiff, GstEvent * event) if (stop_type != GST_SEEK_TYPE_NONE) { if (aiff->bps > 0) aiff->end_offset = - uint64_ceiling_scale (stop, (guint64) aiff->bps, GST_SECOND); + gst_util_uint64_scale_ceil (stop, (guint64) aiff->bps, GST_SECOND); else aiff->end_offset = stop; GST_LOG_OBJECT (aiff, "end_offset=%" G_GUINT64_FORMAT, aiff->end_offset); @@ -594,7 +576,8 @@ gst_aiff_parse_calculate_duration (GstAiffParse * aiff) if (aiff->datasize > 0 && aiff->bps > 0) { aiff->duration = - uint64_ceiling_scale (aiff->datasize, GST_SECOND, (guint64) aiff->bps); + gst_util_uint64_scale_ceil (aiff->datasize, GST_SECOND, + (guint64) aiff->bps); GST_INFO_OBJECT (aiff, "Got duration %" GST_TIME_FORMAT, GST_TIME_ARGS (aiff->duration)); return TRUE; @@ -673,19 +656,37 @@ gst_aiff_parse_parse_comm (GstAiffParse * aiff, GstBuffer * buf) aiff->width = GST_ROUND_UP_8 (aiff->depth); aiff->rate = (int) gst_aiff_parse_read_IEEE80 (data + 8); + aiff->floating_point = FALSE; + if (aiff->is_aifc) { + guint32 fourcc = GST_READ_UINT32_LE (data + 18); + /* We only support the 'trivial' uncompressed AIFC, but it can be * either big or little endian */ - if (GST_READ_UINT32_LE (data + 18) == GST_MAKE_FOURCC ('N', 'O', 'N', 'E')) - aiff->endianness = G_BIG_ENDIAN; - else if (GST_READ_UINT32_LE (data + 18) == - GST_MAKE_FOURCC ('s', 'o', 'w', 't')) - aiff->endianness = G_LITTLE_ENDIAN; - else { - GST_WARNING_OBJECT (aiff, "Unsupported compression in AIFC " - "file: %" GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (GST_READ_UINT32_LE (data + 18))); - return FALSE; + switch (fourcc) { + case GST_MAKE_FOURCC ('N', 'O', 'N', 'E'): + aiff->endianness = G_BIG_ENDIAN; + break; + case GST_MAKE_FOURCC ('s', 'o', 'w', 't'): + aiff->endianness = G_LITTLE_ENDIAN; + break; + case GST_MAKE_FOURCC ('F', 'L', '3', '2'): + case GST_MAKE_FOURCC ('f', 'l', '3', '2'): + aiff->floating_point = TRUE; + aiff->width = aiff->depth = 32; + aiff->endianness = G_BIG_ENDIAN; + break; + case GST_MAKE_FOURCC ('f', 'l', '6', '4'): + aiff->floating_point = TRUE; + aiff->width = aiff->depth = 64; + aiff->endianness = G_BIG_ENDIAN; + break; + default: + GST_WARNING_OBJECT (aiff, "Unsupported compression in AIFC " + "file: %" GST_FOURCC_FORMAT, + GST_FOURCC_ARGS (GST_READ_UINT32_LE (data + 18))); + return FALSE; + } } else aiff->endianness = G_BIG_ENDIAN; @@ -737,12 +738,20 @@ gst_aiff_parse_create_caps (GstAiffParse * aiff) { GstCaps *caps; - caps = gst_caps_new_simple ("audio/x-raw-int", - "width", G_TYPE_INT, aiff->width, - "depth", G_TYPE_INT, aiff->depth, - "channels", G_TYPE_INT, aiff->channels, - "endianness", G_TYPE_INT, aiff->endianness, - "rate", G_TYPE_INT, aiff->rate, "signed", G_TYPE_BOOLEAN, TRUE, NULL); + if (aiff->floating_point) { + caps = gst_caps_new_simple ("audio/x-raw-float", + "width", G_TYPE_INT, aiff->width, + "channels", G_TYPE_INT, aiff->channels, + "endianness", G_TYPE_INT, aiff->endianness, + "rate", G_TYPE_INT, aiff->rate, NULL); + } else { + caps = gst_caps_new_simple ("audio/x-raw-int", + "width", G_TYPE_INT, aiff->width, + "depth", G_TYPE_INT, aiff->depth, + "channels", G_TYPE_INT, aiff->channels, + "endianness", G_TYPE_INT, aiff->endianness, + "rate", G_TYPE_INT, aiff->rate, "signed", G_TYPE_BOOLEAN, TRUE, NULL); + } GST_DEBUG_OBJECT (aiff, "Created caps: %" GST_PTR_FORMAT, caps); return caps; @@ -831,7 +840,6 @@ gst_aiff_parse_stream_headers (GstAiffParse * aiff) break; } case GST_MAKE_FOURCC ('S', 'S', 'N', 'D'):{ - GstFormat fmt; GstBuffer *ssndbuf = NULL; const guint8 *ssnddata = NULL; guint32 datasize; @@ -860,14 +868,13 @@ gst_aiff_parse_stream_headers (GstAiffParse * aiff) } else { gst_buffer_unref (ssndbuf); } - /* 8 byte chunk header, 16 byte SSND header */ - aiff->offset += 24; + /* 8 byte chunk header, 8 byte SSND header */ + aiff->offset += 16; datasize = size - 16; aiff->datastart = aiff->offset + aiff->ssnd_offset; /* file might be truncated */ - fmt = GST_FORMAT_BYTES; if (upstream_size) { size = MIN (datasize, (upstream_size - aiff->datastart)); } @@ -1123,9 +1130,10 @@ iterate_adapter: if (aiff->bps > 0) { /* and timestamps if we have a bitrate, be careful for overflows */ - timestamp = uint64_ceiling_scale (pos, GST_SECOND, (guint64) aiff->bps); + timestamp = + gst_util_uint64_scale_ceil (pos, GST_SECOND, (guint64) aiff->bps); next_timestamp = - uint64_ceiling_scale (nextpos, GST_SECOND, (guint64) aiff->bps); + gst_util_uint64_scale_ceil (nextpos, GST_SECOND, (guint64) aiff->bps); duration = next_timestamp - timestamp; /* update current running segment position */ @@ -1345,7 +1353,7 @@ gst_aiff_parse_pad_convert (GstPad * pad, break; case GST_FORMAT_TIME: if (aiffparse->bps > 0) { - *dest_value = uint64_ceiling_scale (src_value, GST_SECOND, + *dest_value = gst_util_uint64_scale_ceil (src_value, GST_SECOND, (guint64) aiffparse->bps); break; } diff --git a/gst/aiff/aiffparse.h b/gst/aiff/aiffparse.h index 1ffe212b74..b773a15052 100644 --- a/gst/aiff/aiffparse.h +++ b/gst/aiff/aiffparse.h @@ -77,6 +77,7 @@ struct _GstAiffParse { guint16 width; guint16 depth; guint32 endianness; + gboolean floating_point; /* real bytes per second used or 0 when no bitrate is known */ guint32 bps; diff --git a/gst/asfmux/Makefile.am b/gst/asfmux/Makefile.am index 5c6991f9df..8678fee5dd 100644 --- a/gst/asfmux/Makefile.am +++ b/gst/asfmux/Makefile.am @@ -22,3 +22,18 @@ noinst_HEADERS = gstasfmux.h \ gstasfobjects.h \ gstasfparse.h \ gstrtpasfpay.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstasfmux -:SHARED libgstasfmux \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstasfmux_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstasfmux_la_CFLAGS) \ + -:LDFLAGS $(libgstasfmux_la_LDFLAGS) \ + $(libgstasfmux_la_LIBADD) \ + $(libgstasfmux_la_LIBTOOLFLAGS) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/asfmux/gstasfmux.c b/gst/asfmux/gstasfmux.c index 2e85e1ae2e..4027525e5a 100644 --- a/gst/asfmux/gstasfmux.c +++ b/gst/asfmux/gstasfmux.c @@ -499,7 +499,6 @@ gst_asf_mux_get_content_description_tags (GstAsfMux * asfmux, GstAsfTags * asftags) { const GstTagList *tags; - GstTagList *taglist = NULL; tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (asfmux)); if (tags && !gst_tag_list_is_empty (tags)) { @@ -509,7 +508,6 @@ gst_asf_mux_get_content_description_tags (GstAsfMux * asfmux, asftags->tags = gst_tag_list_new (); asftags->cont_desc_size = 0; asftags->ext_cont_desc_size = 0; - taglist = asftags->tags; GST_DEBUG_OBJECT (asfmux, "Processing tags"); gst_tag_list_foreach (tags, content_description_calc_size_for_tag, asftags); diff --git a/gst/asfmux/gstasfobjects.c b/gst/asfmux/gstasfobjects.c index 7ea153961a..6496062a9a 100644 --- a/gst/asfmux/gstasfobjects.c +++ b/gst/asfmux/gstasfobjects.c @@ -520,6 +520,11 @@ gboolean gst_asf_parse_packet (GstBuffer * buffer, GstAsfPacketInfo * packet, gboolean trust_delta_flag, guint packet_size) { +/* Might be useful in future: + guint8 rep_data_len_type; + guint8 mo_number_len_type; + guint8 mo_offset_type; +*/ GstByteReader *reader; gboolean ret = TRUE; guint8 first = 0; @@ -528,9 +533,6 @@ gst_asf_parse_packet (GstBuffer * buffer, GstAsfPacketInfo * packet, guint8 packet_len_type; guint8 padding_len_type; guint8 seq_len_type; - guint8 rep_data_len_type; - guint8 mo_number_len_type; - guint8 mo_offset_type; gboolean mult_payloads; guint32 packet_len; guint32 padd_len; @@ -587,9 +589,12 @@ gst_asf_parse_packet (GstBuffer * buffer, GstAsfPacketInfo * packet, if (!gst_byte_reader_get_uint8 (reader, &aux)) goto error; + +/* rep_data_len_type = aux & 0x3; mo_offset_type = (aux >> 2) & 0x3; mo_number_len_type = (aux >> 4) & 0x3; +*/ /* gets the fields lengths */ GST_LOG ("Getting packet and padding length"); diff --git a/gst/asfmux/gstasfparse.c b/gst/asfmux/gstasfparse.c index 677ea3b181..ab1f69152a 100644 --- a/gst/asfmux/gstasfparse.c +++ b/gst/asfmux/gstasfparse.c @@ -30,11 +30,6 @@ GST_DEBUG_CATEGORY_STATIC (asfparse_debug); #define GST_CAT_DEFAULT asfparse_debug -enum -{ - PROP_0, -}; - static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, @@ -47,10 +42,6 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_CAPS ("video/x-ms-asf, parsed = (boolean) false") ); -static void gst_asf_parse_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec); -static void gst_asf_parse_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec); static GstStateChangeReturn gst_asf_parse_change_state (GstElement * element, GstStateChange transition); static void gst_asf_parse_loop (GstPad * pad); @@ -513,8 +504,6 @@ gst_asf_parse_class_init (GstAsfParseClass * klass) parent_class = g_type_class_peek_parent (klass); - gobject_class->get_property = gst_asf_parse_get_property; - gobject_class->set_property = gst_asf_parse_set_property; gobject_class->finalize = gst_asf_parse_finalize; gstelement_class->change_state = @@ -543,34 +532,6 @@ gst_asf_parse_init (GstAsfParse * asfparse, GstAsfParseClass * klass) gst_asf_parse_reset (asfparse); } -static void -gst_asf_parse_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec) -{ - GstAsfParse *asfparse; - - asfparse = GST_ASF_PARSE (object); - switch (prop_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_asf_parse_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec) -{ - GstAsfParse *asfparse; - - asfparse = GST_ASF_PARSE (object); - switch (prop_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - static GstStateChangeReturn gst_asf_parse_change_state (GstElement * element, GstStateChange transition) { diff --git a/gst/asfmux/gstrtpasfpay.c b/gst/asfmux/gstrtpasfpay.c index 1e616546e3..157533f924 100644 --- a/gst/asfmux/gstrtpasfpay.c +++ b/gst/asfmux/gstrtpasfpay.c @@ -312,7 +312,6 @@ gst_rtp_asf_pay_handle_packet (GstRtpAsfPay * rtpasfpay, GstBuffer * buffer) static GstFlowReturn gst_rtp_asf_pay_parse_headers (GstRtpAsfPay * rtpasfpay) { - GstFlowReturn ret = GST_FLOW_OK; gchar *maxps; g_return_val_if_fail (rtpasfpay->headers, GST_FLOW_ERROR); @@ -346,9 +345,11 @@ gst_rtp_asf_pay_parse_headers (GstRtpAsfPay * rtpasfpay) return GST_FLOW_OK; error: - ret = GST_FLOW_ERROR; - GST_ERROR_OBJECT (rtpasfpay, "Error while parsing headers"); - return GST_FLOW_ERROR; + { + GST_ELEMENT_ERROR (rtpasfpay, STREAM, DECODE, (NULL), + ("Error parsing headers")); + return GST_FLOW_ERROR; + } } static GstFlowReturn diff --git a/gst/audiobuffer/Makefile.am b/gst/audiobuffer/Makefile.am index 96df1c68f8..ff63c8cdbe 100644 --- a/gst/audiobuffer/Makefile.am +++ b/gst/audiobuffer/Makefile.am @@ -9,3 +9,17 @@ libgstaudiobuffer_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) \ libgstaudiobuffer_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstaudiobuffer_la_LIBTOOLFLAGS = --tag=disable-static +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstaudiobuffer -:SHARED libgstaudiobuffer \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstaudiobuffer_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstaudiobuffer_la_CFLAGS) \ + -:LDFLAGS $(libgstaudiobuffer_la_LDFLAGS) \ + $(libgstaudiobuffer_la_LIBADD) \ + $(libgstaudiobuffer_la_LIBTOOLFLAGS) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/audioparsers/Makefile.am b/gst/audioparsers/Makefile.am deleted file mode 100644 index 77039c7154..0000000000 --- a/gst/audioparsers/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -plugin_LTLIBRARIES = libgstaudioparsersbad.la - -libgstaudioparsersbad_la_SOURCES = \ - gstaacparse.c gstamrparse.c gstac3parse.c \ - gstdcaparse.c gstflacparse.c gstmpegaudioparse.c \ - plugin.c - -libgstaudioparsersbad_la_CFLAGS = \ - -I$(top_srcdir)/gst-libs \ - $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) -libgstaudioparsersbad_la_LIBADD = \ - $(top_builddir)/gst-libs/gst/baseparse/libgstbaseparse-$(GST_MAJORMINOR).la \ - $(GST_PLUGINS_BASE_LIBS) -lgsttag-$(GST_MAJORMINOR) \ - -lgstaudio-$(GST_MAJORMINOR) \ - $(GST_BASE_LIBS) $(GST_LIBS) -libgstaudioparsersbad_la_LDFLAGS = $(PACKAGE_LIBS) $(GST_PLUGIN_LDFLAGS) -libgstaudioparsersbad_la_LIBTOOLFLAGS = --tag=disable-static - -noinst_HEADERS = gstaacparse.h gstamrparse.h gstac3parse.h \ - gstdcaparse.h gstflacparse.h gstmpegaudioparse.h diff --git a/gst/audioparsers/gstaacparse.c b/gst/audioparsers/gstaacparse.c deleted file mode 100644 index 09e3e71f2c..0000000000 --- a/gst/audioparsers/gstaacparse.c +++ /dev/null @@ -1,715 +0,0 @@ -/* GStreamer AAC parser plugin - * Copyright (C) 2008 Nokia Corporation. All rights reserved. - * - * Contact: Stefan Kost - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/** - * SECTION:element-aacparse - * @short_description: AAC parser - * @see_also: #GstAmrParse - * - * This is an AAC parser which handles both ADIF and ADTS stream formats. - * - * As ADIF format is not framed, it is not seekable and stream duration cannot - * be determined either. However, ADTS format AAC clips can be seeked, and parser - * can also estimate playback position and clip duration. - * - * - * Example launch line - * |[ - * gst-launch filesrc location=abc.aac ! aacparse ! faad ! audioresample ! audioconvert ! alsasink - * ]| - * - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include "gstaacparse.h" - - -static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/mpeg, " - "framed = (boolean) true, " "mpegversion = (int) { 2, 4 }, " - "stream-format = (string) { raw, adts, adif };")); - -static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/mpeg, " - "framed = (boolean) false, " "mpegversion = (int) { 2, 4 };")); - -GST_DEBUG_CATEGORY_STATIC (gst_aacparse_debug); -#define GST_CAT_DEFAULT gst_aacparse_debug - - -#define ADIF_MAX_SIZE 40 /* Should be enough */ -#define ADTS_MAX_SIZE 10 /* Should be enough */ - - -#define AAC_FRAME_DURATION(parse) (GST_SECOND/parse->frames_per_sec) - -gboolean gst_aacparse_start (GstBaseParse * parse); -gboolean gst_aacparse_stop (GstBaseParse * parse); - -static gboolean gst_aacparse_sink_setcaps (GstBaseParse * parse, - GstCaps * caps); - -gboolean gst_aacparse_check_valid_frame (GstBaseParse * parse, - GstBaseParseFrame * frame, guint * size, gint * skipsize); - -GstFlowReturn gst_aacparse_parse_frame (GstBaseParse * parse, - GstBaseParseFrame * frame); - -gboolean gst_aacparse_convert (GstBaseParse * parse, - GstFormat src_format, - gint64 src_value, GstFormat dest_format, gint64 * dest_value); - -gint gst_aacparse_get_frame_overhead (GstBaseParse * parse, GstBuffer * buffer); - -gboolean gst_aacparse_event (GstBaseParse * parse, GstEvent * event); - -#define _do_init(bla) \ - GST_DEBUG_CATEGORY_INIT (gst_aacparse_debug, "aacparse", 0, \ - "AAC audio stream parser"); - -GST_BOILERPLATE_FULL (GstAacParse, gst_aacparse, GstBaseParse, - GST_TYPE_BASE_PARSE, _do_init); - -static inline gint -gst_aacparse_get_sample_rate_from_index (guint sr_idx) -{ - static const guint aac_sample_rates[] = { 96000, 88200, 64000, 48000, 44100, - 32000, 24000, 22050, 16000, 12000, 11025, 8000 - }; - - if (sr_idx < G_N_ELEMENTS (aac_sample_rates)) - return aac_sample_rates[sr_idx]; - GST_WARNING ("Invalid sample rate index %u", sr_idx); - return 0; -} - -/** - * gst_aacparse_base_init: - * @klass: #GstElementClass. - * - */ -static void -gst_aacparse_base_init (gpointer klass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_template)); - - gst_element_class_set_details_simple (element_class, - "AAC audio stream parser", "Codec/Parser/Audio", - "Advanced Audio Coding parser", "Stefan Kost "); -} - - -/** - * gst_aacparse_class_init: - * @klass: #GstAacParseClass. - * - */ -static void -gst_aacparse_class_init (GstAacParseClass * klass) -{ - GstBaseParseClass *parse_class = GST_BASE_PARSE_CLASS (klass); - - parse_class->start = GST_DEBUG_FUNCPTR (gst_aacparse_start); - parse_class->stop = GST_DEBUG_FUNCPTR (gst_aacparse_stop); - parse_class->set_sink_caps = GST_DEBUG_FUNCPTR (gst_aacparse_sink_setcaps); - parse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_aacparse_parse_frame); - parse_class->check_valid_frame = - GST_DEBUG_FUNCPTR (gst_aacparse_check_valid_frame); -} - - -/** - * gst_aacparse_init: - * @aacparse: #GstAacParse. - * @klass: #GstAacParseClass. - * - */ -static void -gst_aacparse_init (GstAacParse * aacparse, GstAacParseClass * klass) -{ - GST_DEBUG ("initialized"); -} - - -/** - * gst_aacparse_set_src_caps: - * @aacparse: #GstAacParse. - * @sink_caps: (proposed) caps of sink pad - * - * Set source pad caps according to current knowledge about the - * audio stream. - * - * Returns: TRUE if caps were successfully set. - */ -static gboolean -gst_aacparse_set_src_caps (GstAacParse * aacparse, GstCaps * sink_caps) -{ - GstStructure *s; - GstCaps *src_caps = NULL; - gboolean res = FALSE; - const gchar *stream_format; - - GST_DEBUG_OBJECT (aacparse, "sink caps: %" GST_PTR_FORMAT, sink_caps); - if (sink_caps) - src_caps = gst_caps_copy (sink_caps); - else - src_caps = gst_caps_new_simple ("audio/mpeg", NULL); - - gst_caps_set_simple (src_caps, "framed", G_TYPE_BOOLEAN, TRUE, - "mpegversion", G_TYPE_INT, aacparse->mpegversion, NULL); - - switch (aacparse->header_type) { - case DSPAAC_HEADER_NONE: - stream_format = "raw"; - break; - case DSPAAC_HEADER_ADTS: - stream_format = "adts"; - break; - case DSPAAC_HEADER_ADIF: - stream_format = "adif"; - break; - default: - stream_format = NULL; - } - - s = gst_caps_get_structure (src_caps, 0); - if (aacparse->sample_rate > 0) - gst_structure_set (s, "rate", G_TYPE_INT, aacparse->sample_rate, NULL); - if (aacparse->channels > 0) - gst_structure_set (s, "channels", G_TYPE_INT, aacparse->channels, NULL); - if (stream_format) - gst_structure_set (s, "stream-format", G_TYPE_STRING, stream_format, NULL); - - GST_DEBUG_OBJECT (aacparse, "setting src caps: %" GST_PTR_FORMAT, src_caps); - - res = gst_pad_set_caps (GST_BASE_PARSE (aacparse)->srcpad, src_caps); - gst_caps_unref (src_caps); - return res; -} - - -/** - * gst_aacparse_sink_setcaps: - * @sinkpad: GstPad - * @caps: GstCaps - * - * Implementation of "set_sink_caps" vmethod in #GstBaseParse class. - * - * Returns: TRUE on success. - */ -static gboolean -gst_aacparse_sink_setcaps (GstBaseParse * parse, GstCaps * caps) -{ - GstAacParse *aacparse; - GstStructure *structure; - gchar *caps_str; - const GValue *value; - - aacparse = GST_AACPARSE (parse); - structure = gst_caps_get_structure (caps, 0); - caps_str = gst_caps_to_string (caps); - - GST_DEBUG_OBJECT (aacparse, "setcaps: %s", caps_str); - g_free (caps_str); - - /* This is needed at least in case of RTP - * Parses the codec_data information to get ObjectType, - * number of channels and samplerate */ - value = gst_structure_get_value (structure, "codec_data"); - if (value) { - GstBuffer *buf = gst_value_get_buffer (value); - - if (buf) { - const guint8 *buffer = GST_BUFFER_DATA (buf); - guint sr_idx; - - sr_idx = ((buffer[0] & 0x07) << 1) | ((buffer[1] & 0x80) >> 7); - aacparse->object_type = (buffer[0] & 0xf8) >> 3; - aacparse->sample_rate = gst_aacparse_get_sample_rate_from_index (sr_idx); - aacparse->channels = (buffer[1] & 0x78) >> 3; - aacparse->header_type = DSPAAC_HEADER_NONE; - aacparse->mpegversion = 4; - - GST_DEBUG ("codec_data: object_type=%d, sample_rate=%d, channels=%d", - aacparse->object_type, aacparse->sample_rate, aacparse->channels); - - /* arrange for metadata and get out of the way */ - gst_aacparse_set_src_caps (aacparse, caps); - gst_base_parse_set_format (parse, - GST_BASE_PARSE_FORMAT_PASSTHROUGH, TRUE); - } else - return FALSE; - - /* caps info overrides */ - gst_structure_get_int (structure, "rate", &aacparse->sample_rate); - gst_structure_get_int (structure, "channels", &aacparse->channels); - } - - return TRUE; -} - - -/** - * gst_aacparse_adts_get_frame_len: - * @data: block of data containing an ADTS header. - * - * This function calculates ADTS frame length from the given header. - * - * Returns: size of the ADTS frame. - */ -static inline guint -gst_aacparse_adts_get_frame_len (const guint8 * data) -{ - return ((data[3] & 0x03) << 11) | (data[4] << 3) | ((data[5] & 0xe0) >> 5); -} - - -/** - * gst_aacparse_check_adts_frame: - * @aacparse: #GstAacParse. - * @data: Data to be checked. - * @avail: Amount of data passed. - * @framesize: If valid ADTS frame was found, this will be set to tell the - * found frame size in bytes. - * @needed_data: If frame was not found, this may be set to tell how much - * more data is needed in the next round to detect the frame - * reliably. This may happen when a frame header candidate - * is found but it cannot be guaranteed to be the header without - * peeking the following data. - * - * Check if the given data contains contains ADTS frame. The algorithm - * will examine ADTS frame header and calculate the frame size. Also, another - * consecutive ADTS frame header need to be present after the found frame. - * Otherwise the data is not considered as a valid ADTS frame. However, this - * "extra check" is omitted when EOS has been received. In this case it is - * enough when data[0] contains a valid ADTS header. - * - * This function may set the #needed_data to indicate that a possible frame - * candidate has been found, but more data (#needed_data bytes) is needed to - * be absolutely sure. When this situation occurs, FALSE will be returned. - * - * When a valid frame is detected, this function will use - * gst_base_parse_set_min_frame_size() function from #GstBaseParse class - * to set the needed bytes for next frame.This way next data chunk is already - * of correct size. - * - * Returns: TRUE if the given data contains a valid ADTS header. - */ -static gboolean -gst_aacparse_check_adts_frame (GstAacParse * aacparse, - const guint8 * data, const guint avail, gboolean drain, - guint * framesize, guint * needed_data) -{ - if (G_UNLIKELY (avail < 2)) - return FALSE; - - if ((data[0] == 0xff) && ((data[1] & 0xf6) == 0xf0)) { - *framesize = gst_aacparse_adts_get_frame_len (data); - - /* In EOS mode this is enough. No need to examine the data further */ - if (drain) { - return TRUE; - } - - if (*framesize + ADTS_MAX_SIZE > avail) { - /* We have found a possible frame header candidate, but can't be - sure since we don't have enough data to check the next frame */ - GST_DEBUG ("NEED MORE DATA: we need %d, available %d", - *framesize + ADTS_MAX_SIZE, avail); - *needed_data = *framesize + ADTS_MAX_SIZE; - gst_base_parse_set_min_frame_size (GST_BASE_PARSE (aacparse), - *framesize + ADTS_MAX_SIZE); - return FALSE; - } - - if ((data[*framesize] == 0xff) && ((data[*framesize + 1] & 0xf6) == 0xf0)) { - guint nextlen = gst_aacparse_adts_get_frame_len (data + (*framesize)); - - GST_LOG ("ADTS frame found, len: %d bytes", *framesize); - gst_base_parse_set_min_frame_size (GST_BASE_PARSE (aacparse), - nextlen + ADTS_MAX_SIZE); - return TRUE; - } - } - return FALSE; -} - -/* caller ensure sufficient data */ -static inline void -gst_aacparse_parse_adts_header (GstAacParse * aacparse, const guint8 * data, - gint * rate, gint * channels, gint * object, gint * version) -{ - - if (rate) { - gint sr_idx = (data[2] & 0x3c) >> 2; - - *rate = gst_aacparse_get_sample_rate_from_index (sr_idx); - } - if (channels) - *channels = ((data[2] & 0x01) << 2) | ((data[3] & 0xc0) >> 6); - - if (version) - *version = (data[1] & 0x08) ? 2 : 4; - if (object) - *object = (data[2] & 0xc0) >> 6; -} - -/** - * gst_aacparse_detect_stream: - * @aacparse: #GstAacParse. - * @data: A block of data that needs to be examined for stream characteristics. - * @avail: Size of the given datablock. - * @framesize: If valid stream was found, this will be set to tell the - * first frame size in bytes. - * @skipsize: If valid stream was found, this will be set to tell the first - * audio frame position within the given data. - * - * Examines the given piece of data and try to detect the format of it. It - * checks for "ADIF" header (in the beginning of the clip) and ADTS frame - * header. If the stream is detected, TRUE will be returned and #framesize - * is set to indicate the found frame size. Additionally, #skipsize might - * be set to indicate the number of bytes that need to be skipped, a.k.a. the - * position of the frame inside given data chunk. - * - * Returns: TRUE on success. - */ -static gboolean -gst_aacparse_detect_stream (GstAacParse * aacparse, - const guint8 * data, const guint avail, gboolean drain, - guint * framesize, gint * skipsize) -{ - gboolean found = FALSE; - guint need_data = 0; - guint i = 0; - - GST_DEBUG_OBJECT (aacparse, "Parsing header data"); - - /* FIXME: No need to check for ADIF if we are not in the beginning of the - stream */ - - /* Can we even parse the header? */ - if (avail < ADTS_MAX_SIZE) - return FALSE; - - for (i = 0; i < avail - 4; i++) { - if (((data[i] == 0xff) && ((data[i + 1] & 0xf6) == 0xf0)) || - strncmp ((char *) data + i, "ADIF", 4) == 0) { - found = TRUE; - - if (i) { - /* Trick: tell the parent class that we didn't find the frame yet, - but make it skip 'i' amount of bytes. Next time we arrive - here we have full frame in the beginning of the data. */ - *skipsize = i; - return FALSE; - } - break; - } - } - if (!found) { - if (i) - *skipsize = i; - return FALSE; - } - - if (gst_aacparse_check_adts_frame (aacparse, data, avail, drain, - framesize, &need_data)) { - gint rate, channels; - - GST_INFO ("ADTS ID: %d, framesize: %d", (data[1] & 0x08) >> 3, *framesize); - - aacparse->header_type = DSPAAC_HEADER_ADTS; - gst_aacparse_parse_adts_header (aacparse, data, &rate, &channels, - &aacparse->object_type, &aacparse->mpegversion); - - gst_base_parse_set_frame_props (GST_BASE_PARSE (aacparse), - rate, 1024, 2, 2); - - GST_DEBUG ("ADTS: samplerate %d, channels %d, objtype %d, version %d", - rate, channels, aacparse->object_type, aacparse->mpegversion); - - return TRUE; - } else if (need_data) { - /* This tells the parent class not to skip any data */ - *skipsize = 0; - return FALSE; - } - - if (avail < ADIF_MAX_SIZE) - return FALSE; - - if (memcmp (data + i, "ADIF", 4) == 0) { - const guint8 *adif; - int skip_size = 0; - int bitstream_type; - int sr_idx; - - aacparse->header_type = DSPAAC_HEADER_ADIF; - aacparse->mpegversion = 4; - - /* no way to seek this */ - gst_base_parse_set_seek (GST_BASE_PARSE (aacparse), - GST_BASE_PARSE_SEEK_NONE, 0); - - /* Skip the "ADIF" bytes */ - adif = data + i + 4; - - /* copyright string */ - if (adif[0] & 0x80) - skip_size += 9; /* skip 9 bytes */ - - bitstream_type = adif[0 + skip_size] & 0x10; - aacparse->bitrate = - ((unsigned int) (adif[0 + skip_size] & 0x0f) << 19) | - ((unsigned int) adif[1 + skip_size] << 11) | - ((unsigned int) adif[2 + skip_size] << 3) | - ((unsigned int) adif[3 + skip_size] & 0xe0); - - /* CBR */ - if (bitstream_type == 0) { -#if 0 - /* Buffer fullness parsing. Currently not needed... */ - guint num_elems = 0; - guint fullness = 0; - - num_elems = (adif[3 + skip_size] & 0x1e); - GST_INFO ("ADIF num_config_elems: %d", num_elems); - - fullness = ((unsigned int) (adif[3 + skip_size] & 0x01) << 19) | - ((unsigned int) adif[4 + skip_size] << 11) | - ((unsigned int) adif[5 + skip_size] << 3) | - ((unsigned int) (adif[6 + skip_size] & 0xe0) >> 5); - - GST_INFO ("ADIF buffer fullness: %d", fullness); -#endif - aacparse->object_type = ((adif[6 + skip_size] & 0x01) << 1) | - ((adif[7 + skip_size] & 0x80) >> 7); - sr_idx = (adif[7 + skip_size] & 0x78) >> 3; - } - /* VBR */ - else { - aacparse->object_type = (adif[4 + skip_size] & 0x18) >> 3; - sr_idx = ((adif[4 + skip_size] & 0x07) << 1) | - ((adif[5 + skip_size] & 0x80) >> 7); - } - - /* FIXME: This gives totally wrong results. Duration calculation cannot - be based on this */ - aacparse->sample_rate = gst_aacparse_get_sample_rate_from_index (sr_idx); - - /* baseparse is not given any fps, - * so it will give up on timestamps, seeking, etc */ - - /* FIXME: Can we assume this? */ - aacparse->channels = 2; - - GST_INFO ("ADIF: br=%d, samplerate=%d, objtype=%d", - aacparse->bitrate, aacparse->sample_rate, aacparse->object_type); - - gst_base_parse_set_min_frame_size (GST_BASE_PARSE (aacparse), 512); - - /* arrange for metadata and get out of the way */ - gst_aacparse_set_src_caps (aacparse, - GST_PAD_CAPS (GST_BASE_PARSE_SINK_PAD (aacparse))); - gst_base_parse_set_format (GST_BASE_PARSE (aacparse), - GST_BASE_PARSE_FORMAT_PASSTHROUGH, TRUE); - - *framesize = avail; - return TRUE; - } - - /* This should never happen */ - return FALSE; -} - - -/** - * gst_aacparse_check_valid_frame: - * @parse: #GstBaseParse. - * @buffer: #GstBuffer. - * @framesize: If the buffer contains a valid frame, its size will be put here - * @skipsize: How much data parent class should skip in order to find the - * frame header. - * - * Implementation of "check_valid_frame" vmethod in #GstBaseParse class. - * - * Returns: TRUE if buffer contains a valid frame. - */ -gboolean -gst_aacparse_check_valid_frame (GstBaseParse * parse, - GstBaseParseFrame * frame, guint * framesize, gint * skipsize) -{ - const guint8 *data; - GstAacParse *aacparse; - gboolean ret = FALSE; - gboolean sync; - GstBuffer *buffer; - - aacparse = GST_AACPARSE (parse); - buffer = frame->buffer; - data = GST_BUFFER_DATA (buffer); - - sync = GST_BASE_PARSE_FRAME_SYNC (frame); - - if (aacparse->header_type == DSPAAC_HEADER_ADIF || - aacparse->header_type == DSPAAC_HEADER_NONE) { - /* There is nothing to parse */ - *framesize = GST_BUFFER_SIZE (buffer); - ret = TRUE; - - } else if (aacparse->header_type == DSPAAC_HEADER_NOT_PARSED || sync == FALSE) { - - ret = gst_aacparse_detect_stream (aacparse, data, GST_BUFFER_SIZE (buffer), - GST_BASE_PARSE_FRAME_DRAIN (frame), framesize, skipsize); - - } else if (aacparse->header_type == DSPAAC_HEADER_ADTS) { - guint needed_data = 1024; - - ret = gst_aacparse_check_adts_frame (aacparse, data, - GST_BUFFER_SIZE (buffer), GST_BASE_PARSE_FRAME_DRAIN (frame), - framesize, &needed_data); - - if (!ret) { - GST_DEBUG ("buffer didn't contain valid frame"); - gst_base_parse_set_min_frame_size (GST_BASE_PARSE (aacparse), - needed_data); - } - - } else { - GST_DEBUG ("buffer didn't contain valid frame"); - gst_base_parse_set_min_frame_size (GST_BASE_PARSE (aacparse), 1024); - } - - return ret; -} - - -/** - * gst_aacparse_parse_frame: - * @parse: #GstBaseParse. - * @buffer: #GstBuffer. - * - * Implementation of "parse_frame" vmethod in #GstBaseParse class. - * - * Also determines frame overhead. - * ADTS streams have a 7 byte header in each frame. MP4 and ADIF streams don't have - * a per-frame header. - * - * We're making a couple of simplifying assumptions: - * - * 1. We count Program Configuration Elements rather than searching for them - * in the streams to discount them - the overhead is negligible. - * - * 2. We ignore CRC. This has a worst-case impact of (num_raw_blocks + 1)*16 - * bits, which should still not be significant enough to warrant the - * additional parsing through the headers - * - * Returns: GST_FLOW_OK if frame was successfully parsed and can be pushed - * forward. Otherwise appropriate error is returned. - */ -GstFlowReturn -gst_aacparse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame) -{ - GstAacParse *aacparse; - GstBuffer *buffer; - GstFlowReturn ret = GST_FLOW_OK; - gint rate, channels; - - aacparse = GST_AACPARSE (parse); - buffer = frame->buffer; - - if (G_UNLIKELY (aacparse->header_type != DSPAAC_HEADER_ADTS)) - return ret; - - /* see above */ - frame->overhead = 7; - - gst_aacparse_parse_adts_header (aacparse, GST_BUFFER_DATA (buffer), - &rate, &channels, NULL, NULL); - GST_LOG_OBJECT (aacparse, "rate: %d, chans: %d", rate, channels); - - if (G_UNLIKELY (rate != aacparse->sample_rate - || channels != aacparse->channels)) { - aacparse->sample_rate = rate; - aacparse->channels = channels; - - if (!gst_aacparse_set_src_caps (aacparse, - GST_PAD_CAPS (GST_BASE_PARSE (aacparse)->sinkpad))) { - /* If linking fails, we need to return appropriate error */ - ret = GST_FLOW_NOT_LINKED; - } - - gst_base_parse_set_frame_props (GST_BASE_PARSE (aacparse), - aacparse->sample_rate, 1024, 2, 2); - } - - return ret; -} - - -/** - * gst_aacparse_start: - * @parse: #GstBaseParse. - * - * Implementation of "start" vmethod in #GstBaseParse class. - * - * Returns: TRUE if startup succeeded. - */ -gboolean -gst_aacparse_start (GstBaseParse * parse) -{ - GstAacParse *aacparse; - - aacparse = GST_AACPARSE (parse); - GST_DEBUG ("start"); - gst_base_parse_set_min_frame_size (GST_BASE_PARSE (aacparse), 1024); - return TRUE; -} - - -/** - * gst_aacparse_stop: - * @parse: #GstBaseParse. - * - * Implementation of "stop" vmethod in #GstBaseParse class. - * - * Returns: TRUE is stopping succeeded. - */ -gboolean -gst_aacparse_stop (GstBaseParse * parse) -{ - GST_DEBUG ("stop"); - return TRUE; -} diff --git a/gst/audioparsers/gstaacparse.h b/gst/audioparsers/gstaacparse.h deleted file mode 100644 index e62bf651f0..0000000000 --- a/gst/audioparsers/gstaacparse.h +++ /dev/null @@ -1,109 +0,0 @@ -/* GStreamer AAC parser - * Copyright (C) 2008 Nokia Corporation. All rights reserved. - * - * Contact: Stefan Kost - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GST_AACPARSE_H__ -#define __GST_AACPARSE_H__ - -#include -#include - -G_BEGIN_DECLS - -#define GST_TYPE_AACPARSE \ - (gst_aacparse_get_type()) -#define GST_AACPARSE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_AACPARSE, GstAacParse)) -#define GST_AACPARSE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_AACPARSE, GstAacParseClass)) -#define GST_IS_AACPARSE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_AACPARSE)) -#define GST_IS_AACPARSE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_AACPARSE)) - - -/** - * GstAacHeaderType: - * @DSPAAC_HEADER_NOT_PARSED: Header not parsed yet. - * @DSPAAC_HEADER_UNKNOWN: Unknown (not recognized) header. - * @DSPAAC_HEADER_ADIF: ADIF header found. - * @DSPAAC_HEADER_ADTS: ADTS header found. - * @DSPAAC_HEADER_NONE: Raw stream, no header. - * - * Type header enumeration set in #header_type. - */ -typedef enum { - DSPAAC_HEADER_NOT_PARSED, - DSPAAC_HEADER_UNKNOWN, - DSPAAC_HEADER_ADIF, - DSPAAC_HEADER_ADTS, - DSPAAC_HEADER_NONE -} GstAacHeaderType; - - -typedef struct _GstAacParse GstAacParse; -typedef struct _GstAacParseClass GstAacParseClass; - -/** - * GstAacParse: - * @element: the parent element. - * @object_type: AAC object type of the stream. - * @bitrate: Current media bitrate. - * @sample_rate: Current media samplerate. - * @channels: Current media channel count. - * @frames_per_sec: FPS value of the current stream. - * @header_type: #GstAacHeaderType indicating the current stream type. - * @framecount: The amount of frames that has been processed this far. - * @bytecount: The amount of bytes that has been processed this far. - * @sync: Tells whether the parser is in sync (a.k.a. not searching for header) - * @eos: End-of-Stream indicator. Set when EOS event arrives. - * @duration: Duration of the current stream. - * @ts: Current stream timestamp. - * - * The opaque GstAacParse data structure. - */ -struct _GstAacParse { - GstBaseParse element; - - /* Stream type -related info */ - gint object_type; - gint bitrate; - gint sample_rate; - gint channels; - gint mpegversion; - - GstAacHeaderType header_type; -}; - -/** - * GstAacParseClass: - * @parent_class: Element parent class. - * - * The opaque GstAacParseClass data structure. - */ -struct _GstAacParseClass { - GstBaseParseClass parent_class; -}; - -GType gst_aacparse_get_type (void); - -G_END_DECLS - -#endif /* __GST_AACPARSE_H__ */ diff --git a/gst/audioparsers/gstac3parse.c b/gst/audioparsers/gstac3parse.c deleted file mode 100644 index e001bc37ec..0000000000 --- a/gst/audioparsers/gstac3parse.c +++ /dev/null @@ -1,507 +0,0 @@ -/* GStreamer AC3 parser - * Copyright (C) 2009 Tim-Philipp Müller - * Copyright (C) 2009 Mark Nauwelaerts - * Copyright (C) 2009 Nokia Corporation. All rights reserved. - * Contact: Stefan Kost - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/** - * SECTION:element-ac3parse - * @short_description: AC3 parser - * @see_also: #GstAmrParse, #GstAACParse - * - * This is an AC3 parser. - * - * - * Example launch line - * |[ - * gst-launch filesrc location=abc.ac3 ! ac3parse ! a52dec ! audioresample ! audioconvert ! autoaudiosink - * ]| - * - */ - -/* TODO: - * - add support for audio/x-private1-ac3 as well - * - should accept framed and unframed input (needs decodebin fixes first) - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include "gstac3parse.h" -#include -#include - -GST_DEBUG_CATEGORY_STATIC (ac3_parse_debug); -#define GST_CAT_DEFAULT ac3_parse_debug - -static const struct -{ - const guint bit_rate; /* nominal bit rate */ - const guint frame_size[3]; /* frame size for 32kHz, 44kHz, and 48kHz */ -} frmsizcod_table[38] = { - { - 32, { - 64, 69, 96}}, { - 32, { - 64, 70, 96}}, { - 40, { - 80, 87, 120}}, { - 40, { - 80, 88, 120}}, { - 48, { - 96, 104, 144}}, { - 48, { - 96, 105, 144}}, { - 56, { - 112, 121, 168}}, { - 56, { - 112, 122, 168}}, { - 64, { - 128, 139, 192}}, { - 64, { - 128, 140, 192}}, { - 80, { - 160, 174, 240}}, { - 80, { - 160, 175, 240}}, { - 96, { - 192, 208, 288}}, { - 96, { - 192, 209, 288}}, { - 112, { - 224, 243, 336}}, { - 112, { - 224, 244, 336}}, { - 128, { - 256, 278, 384}}, { - 128, { - 256, 279, 384}}, { - 160, { - 320, 348, 480}}, { - 160, { - 320, 349, 480}}, { - 192, { - 384, 417, 576}}, { - 192, { - 384, 418, 576}}, { - 224, { - 448, 487, 672}}, { - 224, { - 448, 488, 672}}, { - 256, { - 512, 557, 768}}, { - 256, { - 512, 558, 768}}, { - 320, { - 640, 696, 960}}, { - 320, { - 640, 697, 960}}, { - 384, { - 768, 835, 1152}}, { - 384, { - 768, 836, 1152}}, { - 448, { - 896, 975, 1344}}, { - 448, { - 896, 976, 1344}}, { - 512, { - 1024, 1114, 1536}}, { - 512, { - 1024, 1115, 1536}}, { - 576, { - 1152, 1253, 1728}}, { - 576, { - 1152, 1254, 1728}}, { - 640, { - 1280, 1393, 1920}}, { - 640, { - 1280, 1394, 1920}} -}; - -static const guint fscod_rates[4] = { 48000, 44100, 32000, 0 }; -static const guint acmod_chans[8] = { 2, 1, 2, 3, 3, 4, 4, 5 }; -static const guint numblks[4] = { 1, 2, 3, 6 }; - -static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-ac3, framed = (boolean) true, " - " channels = (int) [ 1, 6 ], rate = (int) [ 32000, 48000 ]; " - "audio/x-eac3, framed = (boolean) true, " - " channels = (int) [ 1, 6 ], rate = (int) [ 32000, 48000 ] ")); - -static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-ac3, framed = (boolean) false; " - "audio/x-eac3, framed = (boolean) false; " - "audio/ac3, framed = (boolean) false ")); - -static void gst_ac3_parse_finalize (GObject * object); - -static gboolean gst_ac3_parse_start (GstBaseParse * parse); -static gboolean gst_ac3_parse_stop (GstBaseParse * parse); -static gboolean gst_ac3_parse_check_valid_frame (GstBaseParse * parse, - GstBaseParseFrame * frame, guint * size, gint * skipsize); -static GstFlowReturn gst_ac3_parse_parse_frame (GstBaseParse * parse, - GstBaseParseFrame * frame); - -GST_BOILERPLATE (GstAc3Parse, gst_ac3_parse, GstBaseParse, GST_TYPE_BASE_PARSE); - -static void -gst_ac3_parse_base_init (gpointer klass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_template)); - - gst_element_class_set_details_simple (element_class, - "AC3 audio stream parser", "Codec/Parser/Audio", - "AC3 parser", "Tim-Philipp Müller "); -} - -static void -gst_ac3_parse_class_init (GstAc3ParseClass * klass) -{ - GstBaseParseClass *parse_class = GST_BASE_PARSE_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - GST_DEBUG_CATEGORY_INIT (ac3_parse_debug, "ac3parse", 0, - "AC3 audio stream parser"); - - object_class->finalize = gst_ac3_parse_finalize; - - parse_class->start = GST_DEBUG_FUNCPTR (gst_ac3_parse_start); - parse_class->stop = GST_DEBUG_FUNCPTR (gst_ac3_parse_stop); - parse_class->check_valid_frame = - GST_DEBUG_FUNCPTR (gst_ac3_parse_check_valid_frame); - parse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_ac3_parse_parse_frame); -} - -static void -gst_ac3_parse_reset (GstAc3Parse * ac3parse) -{ - ac3parse->channels = -1; - ac3parse->sample_rate = -1; - ac3parse->eac = FALSE; -} - -static void -gst_ac3_parse_init (GstAc3Parse * ac3parse, GstAc3ParseClass * klass) -{ - gst_base_parse_set_min_frame_size (GST_BASE_PARSE (ac3parse), 64 * 2); - gst_ac3_parse_reset (ac3parse); -} - -static void -gst_ac3_parse_finalize (GObject * object) -{ - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static gboolean -gst_ac3_parse_start (GstBaseParse * parse) -{ - GstAc3Parse *ac3parse = GST_AC3_PARSE (parse); - - GST_DEBUG_OBJECT (parse, "starting"); - - gst_ac3_parse_reset (ac3parse); - - return TRUE; -} - -static gboolean -gst_ac3_parse_stop (GstBaseParse * parse) -{ - GST_DEBUG_OBJECT (parse, "stopping"); - - return TRUE; -} - -static gboolean -gst_ac3_parse_frame_header_ac3 (GstAc3Parse * ac3parse, GstBuffer * buf, - guint * frame_size, guint * rate, guint * chans, guint * blks, guint * sid) -{ - GstBitReader bits = GST_BIT_READER_INIT_FROM_BUFFER (buf); - guint8 fscod, frmsizcod, bsid, bsmod, acmod, lfe_on; - - GST_LOG_OBJECT (ac3parse, "parsing ac3"); - - gst_bit_reader_skip_unchecked (&bits, 16 + 16); - fscod = gst_bit_reader_get_bits_uint8_unchecked (&bits, 2); - frmsizcod = gst_bit_reader_get_bits_uint8_unchecked (&bits, 6); - - if (G_UNLIKELY (fscod == 3 || frmsizcod >= G_N_ELEMENTS (frmsizcod_table))) { - GST_DEBUG_OBJECT (ac3parse, "bad fscod=%d frmsizcod=%d", fscod, frmsizcod); - return FALSE; - } - - bsid = gst_bit_reader_get_bits_uint8_unchecked (&bits, 5); - bsmod = gst_bit_reader_get_bits_uint8_unchecked (&bits, 3); - acmod = gst_bit_reader_get_bits_uint8_unchecked (&bits, 3); - - /* spec not quite clear here: decoder should decode if less than 8, - * but seemingly only defines 6 and 8 cases */ - if (bsid > 8) { - GST_DEBUG_OBJECT (ac3parse, "unexpected bsid=%d", bsid); - return FALSE; - } else if (bsid != 8 && bsid != 6) { - GST_DEBUG_OBJECT (ac3parse, "undefined bsid=%d", bsid); - } - - if ((acmod & 0x1) && (acmod != 0x1)) /* 3 front channels */ - gst_bit_reader_skip_unchecked (&bits, 2); - if ((acmod & 0x4)) /* if a surround channel exists */ - gst_bit_reader_skip_unchecked (&bits, 2); - if (acmod == 0x2) /* if in 2/0 mode */ - gst_bit_reader_skip_unchecked (&bits, 2); - - lfe_on = gst_bit_reader_get_bits_uint8_unchecked (&bits, 1); - - if (frame_size) - *frame_size = frmsizcod_table[frmsizcod].frame_size[fscod] * 2; - if (rate) - *rate = fscod_rates[fscod]; - if (chans) - *chans = acmod_chans[acmod] + lfe_on; - if (blks) - *blks = 6; - if (sid) - *sid = 0; - - return TRUE; -} - -static gboolean -gst_ac3_parse_frame_header_eac3 (GstAc3Parse * ac3parse, GstBuffer * buf, - guint * frame_size, guint * rate, guint * chans, guint * blks, guint * sid) -{ - GstBitReader bits = GST_BIT_READER_INIT_FROM_BUFFER (buf); - guint16 frmsiz, sample_rate, blocks; - guint8 strmtyp, fscod, fscod2, acmod, lfe_on, strmid, numblkscod; - - GST_LOG_OBJECT (ac3parse, "parsing e-ac3"); - - gst_bit_reader_skip_unchecked (&bits, 16); - strmtyp = gst_bit_reader_get_bits_uint8_unchecked (&bits, 2); /* strmtyp */ - if (G_UNLIKELY (strmtyp == 3)) { - GST_DEBUG_OBJECT (ac3parse, "bad strmtyp %d", strmtyp); - return FALSE; - } - - strmid = gst_bit_reader_get_bits_uint8_unchecked (&bits, 3); /* substreamid */ - frmsiz = gst_bit_reader_get_bits_uint16_unchecked (&bits, 11); /* frmsiz */ - fscod = gst_bit_reader_get_bits_uint8_unchecked (&bits, 2); /* fscod */ - if (fscod == 3) { - fscod2 = gst_bit_reader_get_bits_uint8_unchecked (&bits, 2); /* fscod2 */ - if (G_UNLIKELY (fscod2 == 3)) { - GST_DEBUG_OBJECT (ac3parse, "invalid fscod2"); - return FALSE; - } - sample_rate = fscod_rates[fscod2] / 2; - blocks = 6; - } else { - numblkscod = gst_bit_reader_get_bits_uint8_unchecked (&bits, 2); /* numblkscod */ - sample_rate = fscod_rates[fscod]; - blocks = numblks[numblkscod]; - } - - acmod = gst_bit_reader_get_bits_uint8_unchecked (&bits, 3); /* acmod */ - lfe_on = gst_bit_reader_get_bits_uint8_unchecked (&bits, 1); /* lfeon */ - - gst_bit_reader_skip_unchecked (&bits, 5); /* bsid */ - - if (frame_size) - *frame_size = (frmsiz + 1) * 2; - if (rate) - *rate = sample_rate; - if (chans) - *chans = acmod_chans[acmod] + lfe_on; - if (blks) - *blks = blocks; - if (sid) - *sid = (strmtyp & 0x1) << 3 | strmid; - - return TRUE; -} - -static gboolean -gst_ac3_parse_frame_header (GstAc3Parse * parse, GstBuffer * buf, - guint * framesize, guint * rate, guint * chans, guint * blocks, - guint * sid, gboolean * eac) -{ - GstBitReader bits = GST_BIT_READER_INIT_FROM_BUFFER (buf); - guint16 sync; - guint8 bsid; - - GST_MEMDUMP_OBJECT (parse, "AC3 frame sync", GST_BUFFER_DATA (buf), 16); - - sync = gst_bit_reader_get_bits_uint16_unchecked (&bits, 16); - gst_bit_reader_skip_unchecked (&bits, 16 + 8); - bsid = gst_bit_reader_peek_bits_uint8_unchecked (&bits, 5); - - if (G_UNLIKELY (sync != 0x0b77)) - return FALSE; - - GST_LOG_OBJECT (parse, "bsid = %d", bsid); - - if (bsid <= 10) { - if (eac) - *eac = FALSE; - return gst_ac3_parse_frame_header_ac3 (parse, buf, framesize, rate, chans, - blocks, sid); - } else if (bsid <= 16) { - if (eac) - *eac = TRUE; - return gst_ac3_parse_frame_header_eac3 (parse, buf, framesize, rate, chans, - blocks, sid); - } else { - GST_DEBUG_OBJECT (parse, "unexpected bsid %d", bsid); - return FALSE; - } -} - -static gboolean -gst_ac3_parse_check_valid_frame (GstBaseParse * parse, - GstBaseParseFrame * frame, guint * framesize, gint * skipsize) -{ - GstAc3Parse *ac3parse = GST_AC3_PARSE (parse); - GstBuffer *buf = frame->buffer; - GstByteReader reader = GST_BYTE_READER_INIT_FROM_BUFFER (buf); - gint off; - gboolean sync, drain; - - if (G_UNLIKELY (GST_BUFFER_SIZE (buf) < 6)) - return FALSE; - - off = gst_byte_reader_masked_scan_uint32 (&reader, 0xffff0000, 0x0b770000, - 0, GST_BUFFER_SIZE (buf)); - - GST_LOG_OBJECT (parse, "possible sync at buffer offset %d", off); - - /* didn't find anything that looks like a sync word, skip */ - if (off < 0) { - *skipsize = GST_BUFFER_SIZE (buf) - 3; - return FALSE; - } - - /* possible frame header, but not at offset 0? skip bytes before sync */ - if (off > 0) { - *skipsize = off; - return FALSE; - } - - /* make sure the values in the frame header look sane */ - if (!gst_ac3_parse_frame_header (ac3parse, buf, framesize, NULL, NULL, - NULL, NULL, NULL)) { - *skipsize = off + 2; - return FALSE; - } - - GST_LOG_OBJECT (parse, "got frame"); - - sync = GST_BASE_PARSE_FRAME_SYNC (frame); - drain = GST_BASE_PARSE_FRAME_DRAIN (frame); - - if (!sync && !drain) { - guint16 word = 0; - - GST_DEBUG_OBJECT (ac3parse, "resyncing; checking next frame syncword"); - - if (!gst_byte_reader_skip (&reader, *framesize) || - !gst_byte_reader_get_uint16_be (&reader, &word)) { - GST_DEBUG_OBJECT (ac3parse, "... but not sufficient data"); - gst_base_parse_set_min_frame_size (parse, *framesize + 6); - *skipsize = 0; - return FALSE; - } else { - if (word != 0x0b77) { - GST_DEBUG_OBJECT (ac3parse, "0x%x not OK", word); - *skipsize = off + 2; - return FALSE; - } else { - /* ok, got sync now, let's assume constant frame size */ - gst_base_parse_set_min_frame_size (parse, *framesize); - } - } - } - - return TRUE; -} - -static GstFlowReturn -gst_ac3_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame) -{ - GstAc3Parse *ac3parse = GST_AC3_PARSE (parse); - GstBuffer *buf = frame->buffer; - guint fsize, rate, chans, blocks, sid; - gboolean eac; - - if (!gst_ac3_parse_frame_header (ac3parse, buf, &fsize, &rate, &chans, - &blocks, &sid, &eac)) - goto broken_header; - - GST_LOG_OBJECT (parse, "size: %u, rate: %u, chans: %u", fsize, rate, chans); - - if (G_UNLIKELY (sid)) { - /* dependent frame, no need to (ac)count for or consider further */ - GST_LOG_OBJECT (parse, "sid: %d", sid); - frame->flags |= GST_BASE_PARSE_FRAME_FLAG_NO_FRAME; - /* TODO maybe also mark as DELTA_UNIT, - * if that does not surprise baseparse elsewhere */ - /* occupies same time space as previous base frame */ - if (G_LIKELY (GST_BUFFER_TIMESTAMP (buf) >= GST_BUFFER_DURATION (buf))) - GST_BUFFER_TIMESTAMP (buf) -= GST_BUFFER_DURATION (buf); - /* only return if we already arranged for caps */ - if (G_LIKELY (ac3parse->sample_rate > 0)) - return GST_FLOW_OK; - } - - if (G_UNLIKELY (ac3parse->sample_rate != rate || ac3parse->channels != chans - || ac3parse->eac != ac3parse->eac)) { - GstCaps *caps = gst_caps_new_simple (eac ? "audio/x-eac3" : "audio/x-ac3", - "framed", G_TYPE_BOOLEAN, TRUE, "rate", G_TYPE_INT, rate, - "channels", G_TYPE_INT, chans, NULL); - gst_buffer_set_caps (buf, caps); - gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (parse), caps); - gst_caps_unref (caps); - - ac3parse->sample_rate = rate; - ac3parse->channels = chans; - ac3parse->eac = eac; - - gst_base_parse_set_frame_props (parse, rate, 256 * blocks, 2, 2); - } - - return GST_FLOW_OK; - -/* ERRORS */ -broken_header: - { - /* this really shouldn't ever happen */ - GST_ELEMENT_ERROR (parse, STREAM, DECODE, (NULL), (NULL)); - return GST_FLOW_ERROR; - } -} diff --git a/gst/audioparsers/gstac3parse.h b/gst/audioparsers/gstac3parse.h deleted file mode 100644 index 781554be5f..0000000000 --- a/gst/audioparsers/gstac3parse.h +++ /dev/null @@ -1,73 +0,0 @@ -/* GStreamer AC3 parser - * Copyright (C) 2009 Tim-Philipp Müller - * Copyright (C) 2009 Mark Nauwelaerts - * Copyright (C) 2009 Nokia Corporation. All rights reserved. - * Contact: Stefan Kost - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GST_AC3_PARSE_H__ -#define __GST_AC3_PARSE_H__ - -#include -#include - -G_BEGIN_DECLS - -#define GST_TYPE_AC3_PARSE \ - (gst_ac3_parse_get_type()) -#define GST_AC3_PARSE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_AC3_PARSE, GstAc3Parse)) -#define GST_AC3_PARSE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_AC3_PARSE, GstAc3ParseClass)) -#define GST_IS_AC3_PARSE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_AC3_PARSE)) -#define GST_IS_AC3_PARSE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_AC3_PARSE)) - -typedef struct _GstAc3Parse GstAc3Parse; -typedef struct _GstAc3ParseClass GstAc3ParseClass; - -/** - * GstAc3Parse: - * - * The opaque GstAc3Parse object - */ -struct _GstAc3Parse { - GstBaseParse baseparse; - - /*< private >*/ - gint sample_rate; - gint channels; - gboolean eac; -}; - -/** - * GstAc3ParseClass: - * @parent_class: Element parent class. - * - * The opaque GstAc3ParseClass data structure. - */ -struct _GstAc3ParseClass { - GstBaseParseClass baseparse_class; -}; - -GType gst_ac3_parse_get_type (void); - -G_END_DECLS - -#endif /* __GST_AC3_PARSE_H__ */ diff --git a/gst/audioparsers/gstamrparse.c b/gst/audioparsers/gstamrparse.c deleted file mode 100644 index 42481a2b29..0000000000 --- a/gst/audioparsers/gstamrparse.c +++ /dev/null @@ -1,378 +0,0 @@ -/* GStreamer Adaptive Multi-Rate parser plugin - * Copyright (C) 2006 Edgard Lima - * Copyright (C) 2008 Nokia Corporation. All rights reserved. - * - * Contact: Stefan Kost - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/** - * SECTION:element-amrparse - * @short_description: AMR parser - * @see_also: #GstAmrnbDec, #GstAmrnbEnc - * - * This is an AMR parser capable of handling both narrow-band and wideband - * formats. - * - * - * Example launch line - * |[ - * gst-launch filesrc location=abc.amr ! amrparse ! amrdec ! audioresample ! audioconvert ! alsasink - * ]| - * - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include "gstamrparse.h" - - -static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/AMR, " "rate = (int) 8000, " "channels = (int) 1;" - "audio/AMR-WB, " "rate = (int) 16000, " "channels = (int) 1;") - ); - -static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-amr-nb-sh; audio/x-amr-wb-sh")); - -GST_DEBUG_CATEGORY_STATIC (gst_amrparse_debug); -#define GST_CAT_DEFAULT gst_amrparse_debug - -static const gint block_size_nb[16] = - { 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0 }; - -static const gint block_size_wb[16] = - { 17, 23, 32, 36, 40, 46, 50, 58, 60, 5, -1, -1, -1, -1, 0, 0 }; - -/* AMR has a "hardcoded" framerate of 50fps */ -#define AMR_FRAMES_PER_SECOND 50 -#define AMR_FRAME_DURATION (GST_SECOND/AMR_FRAMES_PER_SECOND) -#define AMR_MIME_HEADER_SIZE 9 - -gboolean gst_amrparse_start (GstBaseParse * parse); -gboolean gst_amrparse_stop (GstBaseParse * parse); - -static gboolean gst_amrparse_sink_setcaps (GstBaseParse * parse, - GstCaps * caps); - -gboolean gst_amrparse_check_valid_frame (GstBaseParse * parse, - GstBaseParseFrame * frame, guint * framesize, gint * skipsize); - -GstFlowReturn gst_amrparse_parse_frame (GstBaseParse * parse, - GstBaseParseFrame * frame); - -#define _do_init(bla) \ - GST_DEBUG_CATEGORY_INIT (gst_amrparse_debug, "amrparse", 0, \ - "AMR-NB audio stream parser"); - -GST_BOILERPLATE_FULL (GstAmrParse, gst_amrparse, GstBaseParse, - GST_TYPE_BASE_PARSE, _do_init); - - -/** - * gst_amrparse_base_init: - * @klass: #GstElementClass. - * - */ -static void -gst_amrparse_base_init (gpointer klass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_template)); - - gst_element_class_set_details_simple (element_class, - "AMR audio stream parser", "Codec/Parser/Audio", - "Adaptive Multi-Rate audio parser", - "Ronald Bultje "); -} - - -/** - * gst_amrparse_class_init: - * @klass: GstAmrParseClass. - * - */ -static void -gst_amrparse_class_init (GstAmrParseClass * klass) -{ - GstBaseParseClass *parse_class = GST_BASE_PARSE_CLASS (klass); - - parse_class->start = GST_DEBUG_FUNCPTR (gst_amrparse_start); - parse_class->stop = GST_DEBUG_FUNCPTR (gst_amrparse_stop); - parse_class->set_sink_caps = GST_DEBUG_FUNCPTR (gst_amrparse_sink_setcaps); - parse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_amrparse_parse_frame); - parse_class->check_valid_frame = - GST_DEBUG_FUNCPTR (gst_amrparse_check_valid_frame); -} - - -/** - * gst_amrparse_init: - * @amrparse: #GstAmrParse - * @klass: #GstAmrParseClass. - * - */ -static void -gst_amrparse_init (GstAmrParse * amrparse, GstAmrParseClass * klass) -{ - /* init rest */ - gst_base_parse_set_min_frame_size (GST_BASE_PARSE (amrparse), 62); - GST_DEBUG ("initialized"); - -} - - -/** - * gst_amrparse_set_src_caps: - * @amrparse: #GstAmrParse. - * - * Set source pad caps according to current knowledge about the - * audio stream. - * - * Returns: TRUE if caps were successfully set. - */ -static gboolean -gst_amrparse_set_src_caps (GstAmrParse * amrparse) -{ - GstCaps *src_caps = NULL; - gboolean res = FALSE; - - if (amrparse->wide) { - GST_DEBUG_OBJECT (amrparse, "setting srcpad caps to AMR-WB"); - src_caps = gst_caps_new_simple ("audio/AMR-WB", - "channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, 16000, NULL); - } else { - GST_DEBUG_OBJECT (amrparse, "setting srcpad caps to AMR-NB"); - /* Max. size of NB frame is 31 bytes, so we can set the min. frame - size to 32 (+1 for next frame header) */ - gst_base_parse_set_min_frame_size (GST_BASE_PARSE (amrparse), 32); - src_caps = gst_caps_new_simple ("audio/AMR", - "channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, 8000, NULL); - } - gst_pad_use_fixed_caps (GST_BASE_PARSE (amrparse)->srcpad); - res = gst_pad_set_caps (GST_BASE_PARSE (amrparse)->srcpad, src_caps); - gst_caps_unref (src_caps); - return res; -} - - -/** - * gst_amrparse_sink_setcaps: - * @sinkpad: GstPad - * @caps: GstCaps - * - * Returns: TRUE on success. - */ -static gboolean -gst_amrparse_sink_setcaps (GstBaseParse * parse, GstCaps * caps) -{ - GstAmrParse *amrparse; - GstStructure *structure; - const gchar *name; - - amrparse = GST_AMRPARSE (parse); - structure = gst_caps_get_structure (caps, 0); - name = gst_structure_get_name (structure); - - GST_DEBUG_OBJECT (amrparse, "setcaps: %s", name); - - if (!strncmp (name, "audio/x-amr-wb-sh", 17)) { - amrparse->block_size = block_size_wb; - amrparse->wide = 1; - } else if (!strncmp (name, "audio/x-amr-nb-sh", 17)) { - amrparse->block_size = block_size_nb; - amrparse->wide = 0; - } else { - GST_WARNING ("Unknown caps"); - return FALSE; - } - - amrparse->need_header = FALSE; - gst_base_parse_set_frame_props (GST_BASE_PARSE (amrparse), 50, 1, 2, 2); - gst_amrparse_set_src_caps (amrparse); - return TRUE; -} - -/** - * gst_amrparse_parse_header: - * @amrparse: #GstAmrParse - * @data: Header data to be parsed. - * @skipsize: Output argument where the frame size will be stored. - * - * Check if the given data contains an AMR mime header. - * - * Returns: TRUE on success. - */ -static gboolean -gst_amrparse_parse_header (GstAmrParse * amrparse, - const guint8 * data, gint * skipsize) -{ - GST_DEBUG_OBJECT (amrparse, "Parsing header data"); - - if (!memcmp (data, "#!AMR-WB\n", 9)) { - GST_DEBUG_OBJECT (amrparse, "AMR-WB detected"); - amrparse->block_size = block_size_wb; - amrparse->wide = TRUE; - *skipsize = amrparse->header = 9; - } else if (!memcmp (data, "#!AMR\n", 6)) { - GST_DEBUG_OBJECT (amrparse, "AMR-NB detected"); - amrparse->block_size = block_size_nb; - amrparse->wide = FALSE; - *skipsize = amrparse->header = 6; - } else - return FALSE; - - gst_amrparse_set_src_caps (amrparse); - return TRUE; -} - - -/** - * gst_amrparse_check_valid_frame: - * @parse: #GstBaseParse. - * @buffer: #GstBuffer. - * @framesize: Output variable where the found frame size is put. - * @skipsize: Output variable which tells how much data needs to be skipped - * until a frame header is found. - * - * Implementation of "check_valid_frame" vmethod in #GstBaseParse class. - * - * Returns: TRUE if the given data contains valid frame. - */ -gboolean -gst_amrparse_check_valid_frame (GstBaseParse * parse, - GstBaseParseFrame * frame, guint * framesize, gint * skipsize) -{ - GstBuffer *buffer; - const guint8 *data; - gint fsize, mode, dsize; - GstAmrParse *amrparse; - - amrparse = GST_AMRPARSE (parse); - buffer = frame->buffer; - data = GST_BUFFER_DATA (buffer); - dsize = GST_BUFFER_SIZE (buffer); - - GST_LOG ("buffer: %d bytes", dsize); - - if (amrparse->need_header) { - if (dsize >= AMR_MIME_HEADER_SIZE && - gst_amrparse_parse_header (amrparse, data, skipsize)) { - amrparse->need_header = FALSE; - gst_base_parse_set_frame_props (GST_BASE_PARSE (amrparse), 50, 1, 2, 2); - } else { - GST_WARNING ("media doesn't look like a AMR format"); - } - /* We return FALSE, so this frame won't get pushed forward. Instead, - the "skip" value is set, so next time we will receive a valid frame. */ - return FALSE; - } - - /* Does this look like a possible frame header candidate? */ - if ((data[0] & 0x83) == 0) { - /* Yep. Retrieve the frame size */ - mode = (data[0] >> 3) & 0x0F; - fsize = amrparse->block_size[mode] + 1; /* +1 for the header byte */ - - /* We recognize this data as a valid frame when: - * - We are in sync. There is no need for extra checks then - * - We are in EOS. There might not be enough data to check next frame - * - Sync is lost, but the following data after this frame seem - * to contain a valid header as well (and there is enough data to - * perform this check) - */ - if (fsize && - (GST_BASE_PARSE_FRAME_SYNC (frame) || GST_BASE_PARSE_FRAME_DRAIN (frame) - || (dsize > fsize && (data[fsize] & 0x83) == 0))) { - *framesize = fsize; - return TRUE; - } - } - - GST_LOG ("sync lost"); - return FALSE; -} - - -/** - * gst_amrparse_parse_frame: - * @parse: #GstBaseParse. - * @buffer: #GstBuffer. - * - * Implementation of "parse" vmethod in #GstBaseParse class. - * - * Returns: #GstFlowReturn defining the parsing status. - */ -GstFlowReturn -gst_amrparse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame) -{ - return GST_FLOW_OK; -} - - -/** - * gst_amrparse_start: - * @parse: #GstBaseParse. - * - * Implementation of "start" vmethod in #GstBaseParse class. - * - * Returns: TRUE on success. - */ -gboolean -gst_amrparse_start (GstBaseParse * parse) -{ - GstAmrParse *amrparse; - - amrparse = GST_AMRPARSE (parse); - GST_DEBUG ("start"); - amrparse->need_header = TRUE; - amrparse->header = 0; - return TRUE; -} - - -/** - * gst_amrparse_stop: - * @parse: #GstBaseParse. - * - * Implementation of "stop" vmethod in #GstBaseParse class. - * - * Returns: TRUE on success. - */ -gboolean -gst_amrparse_stop (GstBaseParse * parse) -{ - GstAmrParse *amrparse; - - amrparse = GST_AMRPARSE (parse); - GST_DEBUG ("stop"); - amrparse->need_header = TRUE; - amrparse->header = 0; - return TRUE; -} diff --git a/gst/audioparsers/gstamrparse.h b/gst/audioparsers/gstamrparse.h deleted file mode 100644 index 04cd6e7639..0000000000 --- a/gst/audioparsers/gstamrparse.h +++ /dev/null @@ -1,82 +0,0 @@ -/* GStreamer Adaptive Multi-Rate parser - * Copyright (C) 2004 Ronald Bultje - * Copyright (C) 2008 Nokia Corporation. All rights reserved. - * - * Contact: Stefan Kost - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GST_AMRPARSE_H__ -#define __GST_AMRPARSE_H__ - -#include -#include - -G_BEGIN_DECLS - -#define GST_TYPE_AMRPARSE \ - (gst_amrparse_get_type()) -#define GST_AMRPARSE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_AMRPARSE, GstAmrParse)) -#define GST_AMRPARSE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_AMRPARSE, GstAmrParseClass)) -#define GST_IS_AMRPARSE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_AMRPARSE)) -#define GST_IS_AMRPARSE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_AMRPARSE)) - - -typedef struct _GstAmrParse GstAmrParse; -typedef struct _GstAmrParseClass GstAmrParseClass; - -/** - * GstAmrParse: - * @element: the parent element. - * @block_size: Pointer to frame size lookup table. - * @need_header: Tells whether the MIME header should be read in the beginning. - * @wide: Wideband mode. - * @eos: Indicates the EOS situation. Set when EOS event is received. - * @sync: Tells whether the parser is in sync. - * @framecount: Total amount of frames handled. - * @bytecount: Total amount of bytes handled. - * @ts: Timestamp of the current media. - * - * The opaque GstAacParse data structure. - */ -struct _GstAmrParse { - GstBaseParse element; - const gint *block_size; - gboolean need_header; - gint header; - gboolean wide; -}; - -/** - * GstAmrParseClass: - * @parent_class: Element parent class. - * - * The opaque GstAmrParseClass data structure. - */ -struct _GstAmrParseClass { - GstBaseParseClass parent_class; -}; - -GType gst_amrparse_get_type (void); - -G_END_DECLS - -#endif /* __GST_AMRPARSE_H__ */ diff --git a/gst/audioparsers/gstdcaparse.c b/gst/audioparsers/gstdcaparse.c deleted file mode 100644 index 8ef6acd0ff..0000000000 --- a/gst/audioparsers/gstdcaparse.c +++ /dev/null @@ -1,417 +0,0 @@ -/* GStreamer DCA parser - * Copyright (C) 2010 Tim-Philipp Müller - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/** - * SECTION:element-dcaparse - * @short_description: DCA (DTS Coherent Acoustics) parser - * @see_also: #GstAmrParse, #GstAACParse, #GstAc3Parse - * - * This is a DCA (DTS Coherent Acoustics) parser. - * - * - * Example launch line - * |[ - * gst-launch filesrc location=abc.dts ! dcaparse ! dtsdec ! audioresample ! audioconvert ! autoaudiosink - * ]| - * - */ - -/* TODO: - * - should accept framed and unframed input (needs decodebin fixes first) - * - seeking in raw .dts files doesn't seem to work, but duration estimate ok - * - * - if frames have 'odd' durations, the frame durations (plus timestamps) - * aren't adjusted up occasionally to make up for rounding error gaps. - * (e.g. if 512 samples per frame @ 48kHz = 10.666666667 ms/frame) - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include "gstdcaparse.h" -#include -#include - -GST_DEBUG_CATEGORY_STATIC (dca_parse_debug); -#define GST_CAT_DEFAULT dca_parse_debug - -static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-dts, framed = (boolean) true, " - " channels = (int) [ 1, 8 ], rate = (int) [ 8000, 192000 ]")); - -static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-dts, framed = (boolean) false")); - -static void gst_dca_parse_finalize (GObject * object); - -static gboolean gst_dca_parse_start (GstBaseParse * parse); -static gboolean gst_dca_parse_stop (GstBaseParse * parse); -static gboolean gst_dca_parse_check_valid_frame (GstBaseParse * parse, - GstBaseParseFrame * frame, guint * size, gint * skipsize); -static GstFlowReturn gst_dca_parse_parse_frame (GstBaseParse * parse, - GstBaseParseFrame * frame); - -GST_BOILERPLATE (GstDcaParse, gst_dca_parse, GstBaseParse, GST_TYPE_BASE_PARSE); - -static void -gst_dca_parse_base_init (gpointer klass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_template)); - - gst_element_class_set_details_simple (element_class, - "DTS Coherent Acoustics audio stream parser", "Codec/Parser/Audio", - "DCA parser", "Tim-Philipp Müller "); -} - -static void -gst_dca_parse_class_init (GstDcaParseClass * klass) -{ - GstBaseParseClass *parse_class = GST_BASE_PARSE_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - GST_DEBUG_CATEGORY_INIT (dca_parse_debug, "dcaparse", 0, - "DCA audio stream parser"); - - object_class->finalize = gst_dca_parse_finalize; - - parse_class->start = GST_DEBUG_FUNCPTR (gst_dca_parse_start); - parse_class->stop = GST_DEBUG_FUNCPTR (gst_dca_parse_stop); - parse_class->check_valid_frame = - GST_DEBUG_FUNCPTR (gst_dca_parse_check_valid_frame); - parse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_dca_parse_parse_frame); -} - -static void -gst_dca_parse_reset (GstDcaParse * dcaparse) -{ - dcaparse->channels = -1; - dcaparse->rate = -1; - dcaparse->last_sync = 0; -} - -static void -gst_dca_parse_init (GstDcaParse * dcaparse, GstDcaParseClass * klass) -{ - gst_base_parse_set_min_frame_size (GST_BASE_PARSE (dcaparse), - DCA_MIN_FRAMESIZE); - gst_dca_parse_reset (dcaparse); -} - -static void -gst_dca_parse_finalize (GObject * object) -{ - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static gboolean -gst_dca_parse_start (GstBaseParse * parse) -{ - GstDcaParse *dcaparse = GST_DCA_PARSE (parse); - - GST_DEBUG_OBJECT (parse, "starting"); - - gst_dca_parse_reset (dcaparse); - - return TRUE; -} - -static gboolean -gst_dca_parse_stop (GstBaseParse * parse) -{ - GST_DEBUG_OBJECT (parse, "stopping"); - - return TRUE; -} - -static gboolean -gst_dca_parse_parse_header (GstDcaParse * dcaparse, - const GstByteReader * reader, guint * frame_size, - guint * sample_rate, guint * channels, guint * samples) -{ - static const int sample_rates[16] = { 0, 8000, 16000, 32000, 0, 0, 11025, - 22050, 44100, 0, 0, 12000, 24000, 48000, 96000, 192000 - }; - static const guint8 channels_table[16] = { 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, - 6, 6, 6, 7, 8, 8 - }; - GstByteReader r = *reader; - guint16 hdr[8]; - guint32 marker; - guint num_blocks, samples_per_block, chans, lfe, i; - - if (gst_byte_reader_get_remaining (&r) < (4 + sizeof (hdr))) - return FALSE; - - marker = gst_byte_reader_peek_uint32_be_unchecked (&r); - - /* raw big endian or 14-bit big endian */ - if (marker == 0x7FFE8001 || marker == 0x1FFFE800) { - for (i = 0; i < G_N_ELEMENTS (hdr); ++i) - hdr[i] = gst_byte_reader_get_uint16_be_unchecked (&r); - } else - /* raw little endian or 14-bit little endian */ - if (marker == 0xFE7F0180 || marker == 0xFF1F00E8) { - for (i = 0; i < G_N_ELEMENTS (hdr); ++i) - hdr[i] = gst_byte_reader_get_uint16_le_unchecked (&r); - } else { - return FALSE; - } - - GST_LOG_OBJECT (dcaparse, "dts sync marker 0x%08x at offset %u", marker, - gst_byte_reader_get_pos (reader)); - - /* 14-bit mode */ - if (marker == 0x1FFFE800 || marker == 0xFF1F00E8) { - if ((hdr[2] & 0xFFF0) != 0x07F0) - return FALSE; - /* discard top 2 bits (2 void), shift in 2 */ - hdr[0] = (hdr[0] << 2) | ((hdr[1] >> 12) & 0x0003); - /* discard top 4 bits (2 void, 2 shifted into hdr[0]), shift in 4 etc. */ - hdr[1] = (hdr[1] << 4) | ((hdr[2] >> 10) & 0x000F); - hdr[2] = (hdr[2] << 6) | ((hdr[3] >> 8) & 0x003F); - hdr[3] = (hdr[3] << 8) | ((hdr[4] >> 6) & 0x00FF); - hdr[4] = (hdr[4] << 10) | ((hdr[5] >> 4) & 0x03FF); - hdr[5] = (hdr[5] << 12) | ((hdr[6] >> 2) & 0x0FFF); - hdr[6] = (hdr[6] << 14) | ((hdr[7] >> 0) & 0x3FFF); - g_assert (hdr[0] == 0x7FFE && hdr[1] == 0x8001); - } - - GST_LOG_OBJECT (dcaparse, "frame header: %04x%04x%04x%04x", - hdr[2], hdr[3], hdr[4], hdr[5]); - - samples_per_block = ((hdr[2] >> 10) & 0x1f) + 1; - num_blocks = ((hdr[2] >> 2) & 0x7F) + 1; - *frame_size = (((hdr[2] & 0x03) << 12) | (hdr[3] >> 4)) + 1; - chans = ((hdr[3] & 0x0F) << 2) | (hdr[4] >> 14); - *sample_rate = sample_rates[(hdr[4] >> 10) & 0x0F]; - lfe = (hdr[5] >> 9) & 0x03; - - GST_TRACE_OBJECT (dcaparse, "frame size %u, num_blocks %u, rate %u, " - "samples per block %u", *frame_size, num_blocks, *sample_rate, - samples_per_block); - - if (num_blocks < 6 || *frame_size < 96 || *sample_rate == 0) - return FALSE; - - if (marker == 0x1FFFE800 || marker == 0xFF1F00E8) - *frame_size = (*frame_size * 16) / 14; /* FIXME: round up? */ - - if (chans < G_N_ELEMENTS (channels_table)) - *channels = channels_table[chans] + ((lfe) ? 1 : 0); - else - *channels = 0; - - *samples = num_blocks * samples_per_block; - - GST_TRACE_OBJECT (dcaparse, "frame size %u, channels %u, rate %u, samples %u", - *frame_size, *channels, *sample_rate, *samples); - return TRUE; -} - -static gint -gst_dca_parse_find_sync (GstDcaParse * dcaparse, GstByteReader * reader, - const GstBuffer * buf, guint32 * sync) -{ - guint32 best_sync = 0; - guint best_offset = G_MAXUINT; - gint off; - - /* FIXME: verify syncs via _parse_header() here already */ - - /* Raw little endian */ - off = gst_byte_reader_masked_scan_uint32 (reader, 0xffffffff, 0xfe7f0180, - 0, GST_BUFFER_SIZE (buf)); - if (off >= 0 && off < best_offset) { - best_offset = off; - best_sync = 0xfe7f0180; - } - - /* Raw big endian */ - off = gst_byte_reader_masked_scan_uint32 (reader, 0xffffffff, 0x7ffe8001, - 0, GST_BUFFER_SIZE (buf)); - if (off >= 0 && off < best_offset) { - best_offset = off; - best_sync = 0x7ffe8001; - } - - /* FIXME: check next 2 bytes as well for 14-bit formats (but then don't - * forget to adjust the *skipsize= in _check_valid_frame() */ - - /* 14-bit little endian */ - off = gst_byte_reader_masked_scan_uint32 (reader, 0xffffffff, 0xff1f00e8, - 0, GST_BUFFER_SIZE (buf)); - if (off >= 0 && off < best_offset) { - best_offset = off; - best_sync = 0xff1f00e8; - } - - /* 14-bit big endian */ - off = gst_byte_reader_masked_scan_uint32 (reader, 0xffffffff, 0x1fffe800, - 0, GST_BUFFER_SIZE (buf)); - if (off >= 0 && off < best_offset) { - best_offset = off; - best_sync = 0x1fffe800; - } - - if (best_offset == G_MAXUINT) - return -1; - - *sync = best_sync; - return best_offset; -} - -static gboolean -gst_dca_parse_check_valid_frame (GstBaseParse * parse, - GstBaseParseFrame * frame, guint * framesize, gint * skipsize) -{ - GstDcaParse *dcaparse = GST_DCA_PARSE (parse); - GstBuffer *buf = frame->buffer; - GstByteReader r = GST_BYTE_READER_INIT_FROM_BUFFER (buf); - gboolean parser_draining; - gboolean parser_in_sync; - guint32 sync = 0; - guint size, rate, chans, samples; - gint off = -1; - - if (G_UNLIKELY (GST_BUFFER_SIZE (buf) < 16)) - return FALSE; - - parser_in_sync = GST_BASE_PARSE_FRAME_SYNC (frame); - - if (G_LIKELY (parser_in_sync && dcaparse->last_sync != 0)) { - off = gst_byte_reader_masked_scan_uint32 (&r, 0xffffffff, - dcaparse->last_sync, 0, GST_BUFFER_SIZE (buf)); - } - - if (G_UNLIKELY (off < 0)) { - off = gst_dca_parse_find_sync (dcaparse, &r, buf, &sync); - } - - /* didn't find anything that looks like a sync word, skip */ - if (off < 0) { - *skipsize = GST_BUFFER_SIZE (buf) - 3; - GST_DEBUG_OBJECT (dcaparse, "no sync, skipping %d bytes", *skipsize); - return FALSE; - } - - GST_LOG_OBJECT (parse, "possible sync %08x at buffer offset %d", sync, off); - - /* possible frame header, but not at offset 0? skip bytes before sync */ - if (off > 0) { - *skipsize = off; - return FALSE; - } - - /* make sure the values in the frame header look sane */ - if (!gst_dca_parse_parse_header (dcaparse, &r, &size, &rate, &chans, - &samples)) { - *skipsize = 4; - return FALSE; - } - - GST_LOG_OBJECT (parse, "got frame, sync %08x, size %u, rate %d, channels %d", - sync, size, rate, chans); - - *framesize = size; - - dcaparse->last_sync = sync; - - parser_draining = GST_BASE_PARSE_FRAME_DRAIN (frame); - - if (!parser_in_sync && !parser_draining) { - /* check for second frame to be sure */ - GST_DEBUG_OBJECT (dcaparse, "resyncing; checking next frame syncword"); - if (GST_BUFFER_SIZE (buf) >= (size + 16)) { - guint s2, r2, c2, n2; - - GST_MEMDUMP ("buf", GST_BUFFER_DATA (buf), size + 16); - gst_byte_reader_init_from_buffer (&r, buf); - gst_byte_reader_skip_unchecked (&r, size); - - if (!gst_dca_parse_parse_header (dcaparse, &r, &s2, &r2, &c2, &n2)) { - GST_DEBUG_OBJECT (dcaparse, "didn't find second syncword"); - *skipsize = 4; - return FALSE; - } - - /* ok, got sync now, let's assume constant frame size */ - gst_base_parse_set_min_frame_size (parse, size); - } else { - /* FIXME: baseparse always seems to hand us buffers of min_frame_size - * bytes, which is unhelpful here */ - GST_LOG_OBJECT (dcaparse, "next sync out of reach (%u < %u)", - GST_BUFFER_SIZE (buf), size + 16); - /* *skipsize = 0; */ - /* return FALSE; */ - } - } - - return TRUE; -} - -static GstFlowReturn -gst_dca_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame) -{ - GstDcaParse *dcaparse = GST_DCA_PARSE (parse); - GstBuffer *buf = frame->buffer; - GstByteReader r = GST_BYTE_READER_INIT_FROM_BUFFER (buf); - guint size, rate, chans, samples; - - if (!gst_dca_parse_parse_header (dcaparse, &r, &size, &rate, &chans, - &samples)) - goto broken_header; - - if (G_UNLIKELY (dcaparse->rate != rate || dcaparse->channels != chans)) { - GstCaps *caps; - - caps = gst_caps_new_simple ("audio/x-dts", - "framed", G_TYPE_BOOLEAN, TRUE, - "rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, chans, NULL); - gst_buffer_set_caps (buf, caps); - gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (parse), caps); - gst_caps_unref (caps); - - dcaparse->rate = rate; - dcaparse->channels = chans; - - gst_base_parse_set_frame_props (parse, rate, samples, 0, 0); - } - - return GST_FLOW_OK; - -/* ERRORS */ -broken_header: - { - /* this really shouldn't ever happen */ - GST_ELEMENT_ERROR (parse, STREAM, DECODE, (NULL), (NULL)); - return GST_FLOW_ERROR; - } -} diff --git a/gst/audioparsers/gstdcaparse.h b/gst/audioparsers/gstdcaparse.h deleted file mode 100644 index b0d7546416..0000000000 --- a/gst/audioparsers/gstdcaparse.h +++ /dev/null @@ -1,74 +0,0 @@ -/* GStreamer DCA parser - * Copyright (C) 2010 Tim-Philipp Müller - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GST_DCA_PARSE_H__ -#define __GST_DCA_PARSE_H__ - -#include -#include - -G_BEGIN_DECLS - -#define GST_TYPE_DCA_PARSE \ - (gst_dca_parse_get_type()) -#define GST_DCA_PARSE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DCA_PARSE, GstDcaParse)) -#define GST_DCA_PARSE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DCA_PARSE, GstDcaParseClass)) -#define GST_IS_DCA_PARSE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DCA_PARSE)) -#define GST_IS_DCA_PARSE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DCA_PARSE)) - -#define DCA_MIN_FRAMESIZE 96 -#define DCA_MAX_FRAMESIZE 18725 /* 16384*16/14 */ - -typedef struct _GstDcaParse GstDcaParse; -typedef struct _GstDcaParseClass GstDcaParseClass; - -/** - * GstDcaParse: - * - * The opaque GstDcaParse object - */ -struct _GstDcaParse { - GstBaseParse baseparse; - - /*< private >*/ - gint rate; - gint channels; - - guint32 last_sync; -}; - -/** - * GstDcaParseClass: - * @parent_class: Element parent class. - * - * The opaque GstDcaParseClass data structure. - */ -struct _GstDcaParseClass { - GstBaseParseClass baseparse_class; -}; - -GType gst_dca_parse_get_type (void); - -G_END_DECLS - -#endif /* __GST_DCA_PARSE_H__ */ diff --git a/gst/audioparsers/gstflacparse.c b/gst/audioparsers/gstflacparse.c deleted file mode 100644 index 8306e8e8b1..0000000000 --- a/gst/audioparsers/gstflacparse.c +++ /dev/null @@ -1,1354 +0,0 @@ -/* GStreamer - * - * Copyright (C) 2008 Sebastian Dröge . - * Copyright (C) 2009 Mark Nauwelaerts - * Copyright (C) 2009 Nokia Corporation. All rights reserved. - * Contact: Stefan Kost - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/** - * SECTION:element-flacparse - * @see_also: flacdec, oggdemux, vorbisparse - * - * The flacparse element will parse the header packets of the FLAC - * stream and put them as the streamheader in the caps. This is used in the - * multifdsink case where you want to stream live FLAC streams to multiple - * clients, each client has to receive the streamheaders first before they can - * consume the FLAC packets. - * - * This element also makes sure that the buffers that it pushes out are properly - * timestamped and that their offset and offset_end are set. The buffers that - * flacparse outputs have all of the metadata that oggmux expects to receive, - * which allows you to (for example) remux an ogg/flac or convert a native FLAC - * format file to an ogg bitstream. - * - * - * Example pipelines - * |[ - * gst-launch -v filesrc location=sine.flac ! flacparse ! identity \ - * ! oggmux ! filesink location=sine-remuxed.ogg - * ]| This pipeline converts a native FLAC format file to an ogg bitstream. - * It also illustrates that the streamheader is set in the caps, and that each - * buffer has the timestamp, duration, offset, and offset_end set. - * - * - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "gstflacparse.h" - -#include -#include -#include - -#include -#include - -GST_DEBUG_CATEGORY_STATIC (flacparse_debug); -#define GST_CAT_DEFAULT flacparse_debug - -/* CRC-8, poly = x^8 + x^2 + x^1 + x^0, init = 0 */ -static const guint8 crc8_table[256] = { - 0x00, 0x07, 0x0E, 0x09, 0x1C, 0x1B, 0x12, 0x15, - 0x38, 0x3F, 0x36, 0x31, 0x24, 0x23, 0x2A, 0x2D, - 0x70, 0x77, 0x7E, 0x79, 0x6C, 0x6B, 0x62, 0x65, - 0x48, 0x4F, 0x46, 0x41, 0x54, 0x53, 0x5A, 0x5D, - 0xE0, 0xE7, 0xEE, 0xE9, 0xFC, 0xFB, 0xF2, 0xF5, - 0xD8, 0xDF, 0xD6, 0xD1, 0xC4, 0xC3, 0xCA, 0xCD, - 0x90, 0x97, 0x9E, 0x99, 0x8C, 0x8B, 0x82, 0x85, - 0xA8, 0xAF, 0xA6, 0xA1, 0xB4, 0xB3, 0xBA, 0xBD, - 0xC7, 0xC0, 0xC9, 0xCE, 0xDB, 0xDC, 0xD5, 0xD2, - 0xFF, 0xF8, 0xF1, 0xF6, 0xE3, 0xE4, 0xED, 0xEA, - 0xB7, 0xB0, 0xB9, 0xBE, 0xAB, 0xAC, 0xA5, 0xA2, - 0x8F, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9D, 0x9A, - 0x27, 0x20, 0x29, 0x2E, 0x3B, 0x3C, 0x35, 0x32, - 0x1F, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0D, 0x0A, - 0x57, 0x50, 0x59, 0x5E, 0x4B, 0x4C, 0x45, 0x42, - 0x6F, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7D, 0x7A, - 0x89, 0x8E, 0x87, 0x80, 0x95, 0x92, 0x9B, 0x9C, - 0xB1, 0xB6, 0xBF, 0xB8, 0xAD, 0xAA, 0xA3, 0xA4, - 0xF9, 0xFE, 0xF7, 0xF0, 0xE5, 0xE2, 0xEB, 0xEC, - 0xC1, 0xC6, 0xCF, 0xC8, 0xDD, 0xDA, 0xD3, 0xD4, - 0x69, 0x6E, 0x67, 0x60, 0x75, 0x72, 0x7B, 0x7C, - 0x51, 0x56, 0x5F, 0x58, 0x4D, 0x4A, 0x43, 0x44, - 0x19, 0x1E, 0x17, 0x10, 0x05, 0x02, 0x0B, 0x0C, - 0x21, 0x26, 0x2F, 0x28, 0x3D, 0x3A, 0x33, 0x34, - 0x4E, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5C, 0x5B, - 0x76, 0x71, 0x78, 0x7F, 0x6A, 0x6D, 0x64, 0x63, - 0x3E, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2C, 0x2B, - 0x06, 0x01, 0x08, 0x0F, 0x1A, 0x1D, 0x14, 0x13, - 0xAE, 0xA9, 0xA0, 0xA7, 0xB2, 0xB5, 0xBC, 0xBB, - 0x96, 0x91, 0x98, 0x9F, 0x8A, 0x8D, 0x84, 0x83, - 0xDE, 0xD9, 0xD0, 0xD7, 0xC2, 0xC5, 0xCC, 0xCB, - 0xE6, 0xE1, 0xE8, 0xEF, 0xFA, 0xFD, 0xF4, 0xF3 -}; - -static guint8 -gst_flac_calculate_crc8 (const guint8 * data, guint length) -{ - guint8 crc = 0; - - while (length--) { - crc = crc8_table[crc ^ *data]; - ++data; - } - - return crc; -} - -/* CRC-16, poly = x^16 + x^15 + x^2 + x^0, init = 0 */ -static const guint16 crc16_table[256] = { - 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011, - 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022, - 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072, - 0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041, - 0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2, - 0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1, - 0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1, - 0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082, - 0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192, - 0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1, - 0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1, - 0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2, - 0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151, - 0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162, - 0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132, - 0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101, - 0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312, - 0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321, - 0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371, - 0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342, - 0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1, - 0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2, - 0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2, - 0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381, - 0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291, - 0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2, - 0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2, - 0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1, - 0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252, - 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261, - 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231, - 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202 -}; - -static guint16 -gst_flac_calculate_crc16 (const guint8 * data, guint length) -{ - guint16 crc = 0; - - while (length--) { - crc = ((crc << 8) ^ crc16_table[(crc >> 8) ^ *data]) & 0xffff; - data++; - } - - return crc; -} - -enum -{ - PROP_0, - PROP_CHECK_FRAME_CHECKSUMS -}; - -#define DEFAULT_CHECK_FRAME_CHECKSUMS FALSE - -static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-flac, framed = (boolean) true, " - "channels = (int) [ 1, 8 ], " "rate = (int) [ 1, 655350 ]") - ); - -static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-flac, framed = (boolean) false") - ); - -static void gst_flac_parse_finalize (GObject * object); -static void gst_flac_parse_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_flac_parse_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -static gboolean gst_flac_parse_start (GstBaseParse * parse); -static gboolean gst_flac_parse_stop (GstBaseParse * parse); -static gboolean gst_flac_parse_check_valid_frame (GstBaseParse * parse, - GstBaseParseFrame * frame, guint * framesize, gint * skipsize); -static GstFlowReturn gst_flac_parse_parse_frame (GstBaseParse * parse, - GstBaseParseFrame * frame); -static GstFlowReturn gst_flac_parse_pre_push_frame (GstBaseParse * parse, - GstBaseParseFrame * frame); - -GST_BOILERPLATE (GstFlacParse, gst_flac_parse, GstBaseParse, - GST_TYPE_BASE_PARSE); - -static void -gst_flac_parse_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_factory)); - - gst_element_class_set_details_simple (element_class, "FLAC audio parser", - "Codec/Parser/Audio", - "Parses audio with the FLAC lossless audio codec", - "Sebastian Dröge "); - - GST_DEBUG_CATEGORY_INIT (flacparse_debug, "flacparse", 0, - "Flac parser element"); -} - -static void -gst_flac_parse_class_init (GstFlacParseClass * klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GstBaseParseClass *baseparse_class = GST_BASE_PARSE_CLASS (klass); - - gobject_class->finalize = gst_flac_parse_finalize; - gobject_class->set_property = gst_flac_parse_set_property; - gobject_class->get_property = gst_flac_parse_get_property; - - g_object_class_install_property (gobject_class, PROP_CHECK_FRAME_CHECKSUMS, - g_param_spec_boolean ("check-frame-checksums", "Check Frame Checksums", - "Check the overall checksums of every frame", - DEFAULT_CHECK_FRAME_CHECKSUMS, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - baseparse_class->start = GST_DEBUG_FUNCPTR (gst_flac_parse_start); - baseparse_class->stop = GST_DEBUG_FUNCPTR (gst_flac_parse_stop); - baseparse_class->check_valid_frame = - GST_DEBUG_FUNCPTR (gst_flac_parse_check_valid_frame); - baseparse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_flac_parse_parse_frame); - baseparse_class->pre_push_frame = - GST_DEBUG_FUNCPTR (gst_flac_parse_pre_push_frame); -} - -static void -gst_flac_parse_init (GstFlacParse * flacparse, GstFlacParseClass * klass) -{ - flacparse->check_frame_checksums = DEFAULT_CHECK_FRAME_CHECKSUMS; -} - -static void -gst_flac_parse_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstFlacParse *flacparse = GST_FLAC_PARSE (object); - - switch (prop_id) { - case PROP_CHECK_FRAME_CHECKSUMS: - flacparse->check_frame_checksums = g_value_get_boolean (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_flac_parse_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec) -{ - GstFlacParse *flacparse = GST_FLAC_PARSE (object); - - switch (prop_id) { - case PROP_CHECK_FRAME_CHECKSUMS: - g_value_set_boolean (value, flacparse->check_frame_checksums); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_flac_parse_finalize (GObject * object) -{ - GstFlacParse *flacparse = GST_FLAC_PARSE (object); - - if (flacparse->tags) { - gst_tag_list_free (flacparse->tags); - flacparse->tags = NULL; - } - - g_list_foreach (flacparse->headers, (GFunc) gst_mini_object_unref, NULL); - g_list_free (flacparse->headers); - flacparse->headers = NULL; - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static gboolean -gst_flac_parse_start (GstBaseParse * parse) -{ - GstFlacParse *flacparse = GST_FLAC_PARSE (parse); - - flacparse->state = GST_FLAC_PARSE_STATE_INIT; - flacparse->min_blocksize = 0; - flacparse->max_blocksize = 0; - flacparse->min_framesize = 0; - flacparse->max_framesize = 0; - - flacparse->upstream_length = -1; - - flacparse->samplerate = 0; - flacparse->channels = 0; - flacparse->bps = 0; - flacparse->total_samples = 0; - - flacparse->offset = GST_CLOCK_TIME_NONE; - flacparse->blocking_strategy = 0; - flacparse->block_size = 0; - flacparse->sample_number = 0; - - /* "fLaC" marker */ - gst_base_parse_set_min_frame_size (GST_BASE_PARSE (flacparse), 4); - /* inform baseclass we can come up with ts, based on counters in packets */ - gst_base_parse_set_format (GST_BASE_PARSE (flacparse), - GST_BASE_PARSE_FORMAT_HAS_TIME, TRUE); - - return TRUE; -} - -static gboolean -gst_flac_parse_stop (GstBaseParse * parse) -{ - GstFlacParse *flacparse = GST_FLAC_PARSE (parse); - - if (flacparse->tags) { - gst_tag_list_free (flacparse->tags); - flacparse->tags = NULL; - } - - g_list_foreach (flacparse->headers, (GFunc) gst_mini_object_unref, NULL); - g_list_free (flacparse->headers); - flacparse->headers = NULL; - - return TRUE; -} - -static const guint8 sample_size_table[] = { 0, 8, 12, 0, 16, 20, 24, 0 }; - -static const guint16 blocksize_table[16] = { - 0, 192, 576 << 0, 576 << 1, 576 << 2, 576 << 3, 0, 0, - 256 << 0, 256 << 1, 256 << 2, 256 << 3, 256 << 4, 256 << 5, 256 << 6, - 256 << 7, -}; - -static const guint32 sample_rate_table[16] = { - 0, - 88200, 176400, 192000, - 8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000, - 0, 0, 0, 0, -}; - -typedef enum -{ - FRAME_HEADER_VALID, - FRAME_HEADER_INVALID, - FRAME_HEADER_MORE_DATA -} FrameHeaderCheckReturn; - -static FrameHeaderCheckReturn -gst_flac_parse_frame_header_is_valid (GstFlacParse * flacparse, - const guint8 * data, guint size, gboolean set, guint16 * block_size_ret) -{ - GstBitReader reader = GST_BIT_READER_INIT (data, size); - guint8 blocking_strategy; - guint16 block_size; - guint32 samplerate = 0; - guint64 sample_number; - guint8 channels, bps; - guint8 tmp = 0; - guint8 actual_crc, expected_crc = 0; - - /* Skip 14 bit sync code */ - gst_bit_reader_skip_unchecked (&reader, 14); - - /* Must be 0 */ - if (gst_bit_reader_get_bits_uint8_unchecked (&reader, 1) != 0) - goto error; - - /* 0 == fixed block size, 1 == variable block size */ - blocking_strategy = gst_bit_reader_get_bits_uint8_unchecked (&reader, 1); - - /* block size index, calculation of the real blocksize below */ - block_size = gst_bit_reader_get_bits_uint16_unchecked (&reader, 4); - if (block_size == 0) - goto error; - - /* sample rate index, calculation of the real samplerate below */ - samplerate = gst_bit_reader_get_bits_uint16_unchecked (&reader, 4); - if (samplerate == 0x0f) - goto error; - - /* channel assignment */ - channels = gst_bit_reader_get_bits_uint8_unchecked (&reader, 4); - if (channels < 8) { - channels++; - } else if (channels <= 10) { - channels = 2; - } else if (channels > 10) { - goto error; - } - if (flacparse->channels && flacparse->channels != channels) - goto error; - - /* bits per sample */ - bps = gst_bit_reader_get_bits_uint8_unchecked (&reader, 3); - if (bps == 0x03 || bps == 0x07) { - goto error; - } else if (bps == 0 && flacparse->bps == 0) { - goto need_streaminfo; - } - bps = sample_size_table[bps]; - if (flacparse->bps && bps != flacparse->bps) - goto error; - - /* reserved, must be 0 */ - if (gst_bit_reader_get_bits_uint8_unchecked (&reader, 1) != 0) - goto error; - - /* read "utf8" encoded sample/frame number */ - { - gint len = 0; - - len = gst_bit_reader_get_bits_uint8_unchecked (&reader, 8); - - /* This is slightly faster than a loop */ - if (!(len & 0x80)) { - sample_number = len; - len = 0; - } else if ((len & 0xc0) && !(len & 0x20)) { - sample_number = len & 0x1f; - len = 1; - } else if ((len & 0xe0) && !(len & 0x10)) { - sample_number = len & 0x0f; - len = 2; - } else if ((len & 0xf0) && !(len & 0x08)) { - sample_number = len & 0x07; - len = 3; - } else if ((len & 0xf8) && !(len & 0x04)) { - sample_number = len & 0x03; - len = 4; - } else if ((len & 0xfc) && !(len & 0x02)) { - sample_number = len & 0x01; - len = 5; - } else if ((len & 0xfe) && !(len & 0x01)) { - sample_number = len & 0x0; - len = 6; - } else { - goto error; - } - - if ((blocking_strategy == 0 && len > 5) || - (blocking_strategy == 1 && len > 6)) - goto error; - - while (len > 0) { - if (!gst_bit_reader_get_bits_uint8 (&reader, &tmp, 8)) - goto need_more_data; - - if ((tmp & 0xc0) != 0x80) - goto error; - - sample_number <<= 6; - sample_number |= (tmp & 0x3f); - len--; - } - } - - /* calculate real blocksize from the blocksize index */ - if (block_size == 0) { - goto error; - } else if (block_size == 6) { - if (!gst_bit_reader_get_bits_uint16 (&reader, &block_size, 8)) - goto need_more_data; - block_size++; - } else if (block_size == 7) { - if (!gst_bit_reader_get_bits_uint16 (&reader, &block_size, 16)) - goto need_more_data; - block_size++; - } else { - block_size = blocksize_table[block_size]; - } - - /* calculate the real samplerate from the samplerate index */ - if (samplerate == 0 && flacparse->samplerate == 0) { - goto need_streaminfo; - } else if (samplerate < 12) { - samplerate = sample_rate_table[samplerate]; - } else if (samplerate == 12) { - if (!gst_bit_reader_get_bits_uint32 (&reader, &samplerate, 8)) - goto need_more_data; - samplerate *= 1000; - } else if (samplerate == 13) { - if (!gst_bit_reader_get_bits_uint32 (&reader, &samplerate, 16)) - goto need_more_data; - } else if (samplerate == 14) { - if (!gst_bit_reader_get_bits_uint32 (&reader, &samplerate, 16)) - goto need_more_data; - samplerate *= 10; - } - - if (flacparse->samplerate && flacparse->samplerate != samplerate) - goto error; - - /* check crc-8 for the header */ - if (!gst_bit_reader_get_bits_uint8 (&reader, &expected_crc, 8)) - goto need_more_data; - - actual_crc = - gst_flac_calculate_crc8 (data, - (gst_bit_reader_get_pos (&reader) / 8) - 1); - if (actual_crc != expected_crc) - goto error; - - if (set) { - flacparse->block_size = block_size; - if (!flacparse->samplerate) - flacparse->samplerate = samplerate; - if (!flacparse->bps) - flacparse->bps = bps; - if (!flacparse->blocking_strategy) - flacparse->blocking_strategy = blocking_strategy; - if (!flacparse->channels) - flacparse->channels = channels; - if (!flacparse->sample_number) - flacparse->sample_number = sample_number; - - GST_DEBUG_OBJECT (flacparse, - "Parsed frame at offset %" G_GUINT64_FORMAT ":\n" "Block size: %u\n" - "Sample/Frame number: %" G_GUINT64_FORMAT, flacparse->offset, - flacparse->block_size, flacparse->sample_number); - } - - if (block_size_ret) - *block_size_ret = block_size; - - return FRAME_HEADER_VALID; - -need_streaminfo: - GST_ERROR_OBJECT (flacparse, "Need STREAMINFO"); - return FRAME_HEADER_INVALID; -error: - return FRAME_HEADER_INVALID; - -need_more_data: - return FRAME_HEADER_MORE_DATA; -} - -static gboolean -gst_flac_parse_frame_is_valid (GstFlacParse * flacparse, - GstBaseParseFrame * frame, guint * ret) -{ - GstBuffer *buffer; - const guint8 *data; - guint max, size, remaining; - guint i, search_start, search_end; - FrameHeaderCheckReturn header_ret; - guint16 block_size; - - buffer = frame->buffer; - data = GST_BUFFER_DATA (buffer); - size = GST_BUFFER_SIZE (buffer); - - if (size <= flacparse->min_framesize) - goto need_more; - - header_ret = - gst_flac_parse_frame_header_is_valid (flacparse, data, size, TRUE, - &block_size); - if (header_ret == FRAME_HEADER_INVALID) { - *ret = 0; - return FALSE; - } else if (header_ret == FRAME_HEADER_MORE_DATA) { - goto need_more; - } - - /* mind unknown framesize */ - search_start = MAX (2, flacparse->min_framesize); - if (flacparse->max_framesize) - search_end = MIN (size, flacparse->max_framesize + 9 + 2); - else - search_end = size; - search_end -= 2; - - remaining = size; - - for (i = search_start; i < search_end; i++, remaining--) { - if ((GST_READ_UINT16_BE (data + i) & 0xfffe) == 0xfff8) { - header_ret = - gst_flac_parse_frame_header_is_valid (flacparse, data + i, remaining, - FALSE, NULL); - if (header_ret == FRAME_HEADER_VALID) { - if (flacparse->check_frame_checksums) { - guint16 actual_crc = gst_flac_calculate_crc16 (data, i - 2); - guint16 expected_crc = GST_READ_UINT16_BE (data + i - 2); - - if (actual_crc != expected_crc) - continue; - } - *ret = i; - flacparse->block_size = block_size; - return TRUE; - } else if (header_ret == FRAME_HEADER_MORE_DATA) { - goto need_more; - } - } - } - - /* For the last frame output everything to the end */ - if (G_UNLIKELY (GST_BASE_PARSE_FRAME_DRAIN (frame))) { - if (flacparse->check_frame_checksums) { - guint16 actual_crc = gst_flac_calculate_crc16 (data, size - 2); - guint16 expected_crc = GST_READ_UINT16_BE (data + size - 2); - - if (actual_crc == expected_crc) { - *ret = size; - flacparse->block_size = block_size; - return TRUE; - } - } else { - *ret = size; - flacparse->block_size = block_size; - return TRUE; - } - } - -need_more: - max = flacparse->max_framesize + 16; - if (max == 16) - max = 1 << 24; - *ret = MIN (size + 4096, max); - return FALSE; -} - -static gboolean -gst_flac_parse_check_valid_frame (GstBaseParse * parse, - GstBaseParseFrame * frame, guint * framesize, gint * skipsize) -{ - GstFlacParse *flacparse = GST_FLAC_PARSE (parse); - GstBuffer *buffer = frame->buffer; - const guint8 *data = GST_BUFFER_DATA (buffer); - - if (G_UNLIKELY (GST_BUFFER_SIZE (buffer) < 4)) - return FALSE; - - if (flacparse->state == GST_FLAC_PARSE_STATE_INIT) { - if (memcmp (GST_BUFFER_DATA (buffer), "fLaC", 4) == 0) { - GST_DEBUG_OBJECT (flacparse, "fLaC marker found"); - *framesize = 4; - return TRUE; - } else if (data[0] == 0xff && (data[1] >> 2) == 0x3e) { - GST_DEBUG_OBJECT (flacparse, "Found headerless FLAC"); - /* Minimal size of a frame header */ - gst_base_parse_set_min_frame_size (GST_BASE_PARSE (flacparse), 9); - flacparse->state = GST_FLAC_PARSE_STATE_GENERATE_HEADERS; - *skipsize = 0; - return FALSE; - } else { - GST_DEBUG_OBJECT (flacparse, "fLaC marker not found"); - return FALSE; - } - } else if (flacparse->state == GST_FLAC_PARSE_STATE_HEADERS) { - guint size = 4 + ((data[1] << 16) | (data[2] << 8) | (data[3])); - - GST_DEBUG_OBJECT (flacparse, "Found metadata block of size %u", size); - *framesize = size; - return TRUE; - } else { - if ((GST_READ_UINT16_BE (data) & 0xfffe) == 0xfff8) { - gboolean ret; - guint next; - - flacparse->offset = GST_BUFFER_OFFSET (buffer); - flacparse->blocking_strategy = 0; - flacparse->block_size = 0; - flacparse->sample_number = 0; - - GST_DEBUG_OBJECT (flacparse, "Found sync code"); - ret = gst_flac_parse_frame_is_valid (flacparse, frame, &next); - if (ret) { - *framesize = next; - return TRUE; - } else { - /* If we're at EOS and the frame was not valid, drop it! */ - if (G_UNLIKELY (GST_BASE_PARSE_FRAME_DRAIN (frame))) { - GST_WARNING_OBJECT (flacparse, "EOS"); - return FALSE; - } - - if (next == 0) { - } else if (next > GST_BUFFER_SIZE (buffer)) { - GST_DEBUG_OBJECT (flacparse, "Requesting %u bytes", next); - *skipsize = 0; - gst_base_parse_set_min_frame_size (parse, next); - return FALSE; - } else { - GST_ERROR_OBJECT (flacparse, - "Giving up on invalid frame (%d bytes)", - GST_BUFFER_SIZE (buffer)); - return FALSE; - } - } - } else { - GstByteReader reader = GST_BYTE_READER_INIT_FROM_BUFFER (buffer); - gint off; - - off = - gst_byte_reader_masked_scan_uint32 (&reader, 0xfffc0000, 0xfff80000, - 0, GST_BUFFER_SIZE (buffer)); - - if (off > 0) { - GST_DEBUG_OBJECT (parse, "Possible sync at buffer offset %d", off); - *skipsize = off; - return FALSE; - } else { - GST_DEBUG_OBJECT (flacparse, "Sync code not found"); - *skipsize = GST_BUFFER_SIZE (buffer) - 3; - return FALSE; - } - } - } - - return FALSE; -} - -static gboolean -gst_flac_parse_handle_streaminfo (GstFlacParse * flacparse, GstBuffer * buffer) -{ - GstBitReader reader = GST_BIT_READER_INIT_FROM_BUFFER (buffer); - - if (GST_BUFFER_SIZE (buffer) != 4 + 34) { - GST_ERROR_OBJECT (flacparse, "Invalid metablock size for STREAMINFO: %u", - GST_BUFFER_SIZE (buffer)); - return FALSE; - } - - /* Skip metadata block header */ - gst_bit_reader_skip (&reader, 32); - - if (!gst_bit_reader_get_bits_uint16 (&reader, &flacparse->min_blocksize, 16)) - goto error; - if (flacparse->min_blocksize < 16) { - GST_ERROR_OBJECT (flacparse, "Invalid minimum block size: %u", - flacparse->min_blocksize); - return FALSE; - } - - if (!gst_bit_reader_get_bits_uint16 (&reader, &flacparse->max_blocksize, 16)) - goto error; - if (flacparse->max_blocksize < 16) { - GST_ERROR_OBJECT (flacparse, "Invalid maximum block size: %u", - flacparse->max_blocksize); - return FALSE; - } - - if (!gst_bit_reader_get_bits_uint32 (&reader, &flacparse->min_framesize, 24)) - goto error; - if (!gst_bit_reader_get_bits_uint32 (&reader, &flacparse->max_framesize, 24)) - goto error; - - if (!gst_bit_reader_get_bits_uint32 (&reader, &flacparse->samplerate, 20)) - goto error; - if (flacparse->samplerate == 0) { - GST_ERROR_OBJECT (flacparse, "Invalid sample rate 0"); - return FALSE; - } - - if (!gst_bit_reader_get_bits_uint8 (&reader, &flacparse->channels, 3)) - goto error; - flacparse->channels++; - if (flacparse->channels > 8) { - GST_ERROR_OBJECT (flacparse, "Invalid number of channels %u", - flacparse->channels); - return FALSE; - } - - if (!gst_bit_reader_get_bits_uint8 (&reader, &flacparse->bps, 5)) - goto error; - flacparse->bps++; - - if (!gst_bit_reader_get_bits_uint64 (&reader, &flacparse->total_samples, 36)) - goto error; - if (flacparse->total_samples) - gst_base_parse_set_duration (GST_BASE_PARSE (flacparse), GST_FORMAT_TIME, - GST_FRAMES_TO_CLOCK_TIME (flacparse->total_samples, - flacparse->samplerate), 0); - - GST_DEBUG_OBJECT (flacparse, "STREAMINFO:\n" - "\tmin/max blocksize: %u/%u,\n" - "\tmin/max framesize: %u/%u,\n" - "\tsamplerate: %u,\n" - "\tchannels: %u,\n" - "\tbits per sample: %u,\n" - "\ttotal samples: %" G_GUINT64_FORMAT, - flacparse->min_blocksize, flacparse->max_blocksize, - flacparse->min_framesize, flacparse->max_framesize, - flacparse->samplerate, - flacparse->channels, flacparse->bps, flacparse->total_samples); - - return TRUE; - -error: - GST_ERROR_OBJECT (flacparse, "Failed to read data"); - return FALSE; -} - -static gboolean -gst_flac_parse_handle_vorbiscomment (GstFlacParse * flacparse, - GstBuffer * buffer) -{ - flacparse->tags = gst_tag_list_from_vorbiscomment_buffer (buffer, - GST_BUFFER_DATA (buffer), 4, NULL); - - if (flacparse->tags == NULL) { - GST_ERROR_OBJECT (flacparse, "Invalid vorbiscomment block"); - } else if (gst_tag_list_is_empty (flacparse->tags)) { - gst_tag_list_free (flacparse->tags); - flacparse->tags = NULL; - } - - return TRUE; -} - -static gboolean -gst_flac_parse_handle_picture (GstFlacParse * flacparse, GstBuffer * buffer) -{ - GstByteReader reader = GST_BYTE_READER_INIT_FROM_BUFFER (buffer); - const guint8 *data = GST_BUFFER_DATA (buffer); - guint32 img_len = 0, img_type = 0; - guint32 img_mimetype_len = 0, img_description_len = 0; - - if (!gst_byte_reader_skip (&reader, 4)) - goto error; - - if (!gst_byte_reader_get_uint32_be (&reader, &img_type)) - goto error; - - if (!gst_byte_reader_get_uint32_be (&reader, &img_mimetype_len)) - goto error; - if (!gst_byte_reader_skip (&reader, img_mimetype_len)) - goto error; - - if (!gst_byte_reader_get_uint32_be (&reader, &img_description_len)) - goto error; - if (!gst_byte_reader_skip (&reader, img_description_len)) - goto error; - - if (!gst_byte_reader_skip (&reader, 4 * 4)) - goto error; - - if (!gst_byte_reader_get_uint32_be (&reader, &img_len)) - goto error; - - if (!flacparse->tags) - flacparse->tags = gst_tag_list_new (); - - gst_tag_list_add_id3_image (flacparse->tags, - data + gst_byte_reader_get_pos (&reader), img_len, img_type); - - if (gst_tag_list_is_empty (flacparse->tags)) { - gst_tag_list_free (flacparse->tags); - flacparse->tags = NULL; - } - - return TRUE; - -error: - GST_ERROR_OBJECT (flacparse, "Error reading data"); - return FALSE; -} - -static gboolean -gst_flac_parse_handle_seektable (GstFlacParse * flacparse, GstBuffer * buffer) -{ - - GST_DEBUG_OBJECT (flacparse, "storing seektable"); - /* only store for now; - * offset of the first frame is needed to get real info */ - flacparse->seektable = gst_buffer_ref (buffer); - - return TRUE; -} - -static void -gst_flac_parse_process_seektable (GstFlacParse * flacparse, gint64 boffset) -{ - GstByteReader br; - gint64 offset = 0, samples = 0; - - GST_DEBUG_OBJECT (flacparse, - "parsing seektable; base offset %" G_GINT64_FORMAT, boffset); - - if (boffset <= 0) - goto done; - - gst_byte_reader_init_from_buffer (&br, flacparse->seektable); - /* skip header */ - if (!gst_byte_reader_skip (&br, 4)) - goto done; - - /* seekpoints */ - while (gst_byte_reader_get_remaining (&br)) { - if (!gst_byte_reader_get_int64_be (&br, &samples)) - break; - if (!gst_byte_reader_get_int64_be (&br, &offset)) - break; - if (!gst_byte_reader_skip (&br, 2)) - break; - - GST_LOG_OBJECT (flacparse, "samples %" G_GINT64_FORMAT " -> offset %" - G_GINT64_FORMAT, samples, offset); - - /* sanity check */ - if (G_LIKELY (offset > 0 && samples > 0)) { - gst_base_parse_add_index_entry (GST_BASE_PARSE (flacparse), - boffset + offset, gst_util_uint64_scale (samples, GST_SECOND, - flacparse->samplerate), TRUE, FALSE); - } - } - -done: - gst_buffer_unref (flacparse->seektable); - flacparse->seektable = NULL; -} - -static void -_value_array_append_buffer (GValue * array_val, GstBuffer * buf) -{ - GValue value = { 0, }; - - g_value_init (&value, GST_TYPE_BUFFER); - /* copy buffer to avoid problems with circular refcounts */ - buf = gst_buffer_copy (buf); - /* again, for good measure */ - GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_IN_CAPS); - gst_value_set_buffer (&value, buf); - gst_buffer_unref (buf); - gst_value_array_append_value (array_val, &value); - g_value_unset (&value); -} - -static gboolean -gst_flac_parse_handle_headers (GstFlacParse * flacparse) -{ - GstBuffer *vorbiscomment = NULL; - GstBuffer *streaminfo = NULL; - GstBuffer *marker = NULL; - GValue array = { 0, }; - GstCaps *caps; - GList *l; - gboolean res = TRUE; - - caps = gst_caps_new_simple ("audio/x-flac", - "channels", G_TYPE_INT, flacparse->channels, - "framed", G_TYPE_BOOLEAN, TRUE, - "rate", G_TYPE_INT, flacparse->samplerate, NULL); - - if (!flacparse->headers) - goto push_headers; - - for (l = flacparse->headers; l; l = l->next) { - GstBuffer *header = l->data; - const guint8 *data = GST_BUFFER_DATA (header); - guint size = GST_BUFFER_SIZE (header); - - GST_BUFFER_FLAG_SET (header, GST_BUFFER_FLAG_IN_CAPS); - - if (size == 4 && memcmp (data, "fLaC", 4) == 0) { - marker = header; - } else if (size > 1 && (data[0] & 0x7f) == 0) { - streaminfo = header; - } else if (size > 1 && (data[0] & 0x7f) == 4) { - vorbiscomment = header; - } - } - - if (marker == NULL || streaminfo == NULL || vorbiscomment == NULL) { - GST_WARNING_OBJECT (flacparse, - "missing header %p %p %p, muxing into container " - "formats may be broken", marker, streaminfo, vorbiscomment); - goto push_headers; - } - - g_value_init (&array, GST_TYPE_ARRAY); - - /* add marker including STREAMINFO header */ - { - GstBuffer *buf; - guint16 num; - - /* minus one for the marker that is merged with streaminfo here */ - num = g_list_length (flacparse->headers) - 1; - - buf = gst_buffer_new_and_alloc (13 + GST_BUFFER_SIZE (streaminfo)); - GST_BUFFER_DATA (buf)[0] = 0x7f; - memcpy (GST_BUFFER_DATA (buf) + 1, "FLAC", 4); - GST_BUFFER_DATA (buf)[5] = 0x01; /* mapping version major */ - GST_BUFFER_DATA (buf)[6] = 0x00; /* mapping version minor */ - GST_BUFFER_DATA (buf)[7] = (num & 0xFF00) >> 8; - GST_BUFFER_DATA (buf)[8] = (num & 0x00FF) >> 0; - memcpy (GST_BUFFER_DATA (buf) + 9, "fLaC", 4); - memcpy (GST_BUFFER_DATA (buf) + 13, GST_BUFFER_DATA (streaminfo), - GST_BUFFER_SIZE (streaminfo)); - _value_array_append_buffer (&array, buf); - gst_buffer_unref (buf); - } - - /* add VORBISCOMMENT header */ - _value_array_append_buffer (&array, vorbiscomment); - - /* add other headers, if there are any */ - for (l = flacparse->headers; l; l = l->next) { - if (GST_BUFFER_CAST (l->data) != marker && - GST_BUFFER_CAST (l->data) != streaminfo && - GST_BUFFER_CAST (l->data) != vorbiscomment) { - _value_array_append_buffer (&array, GST_BUFFER_CAST (l->data)); - } - } - - gst_structure_set_value (gst_caps_get_structure (caps, 0), - "streamheader", &array); - g_value_unset (&array); - -push_headers: - - gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (GST_BASE_PARSE (flacparse)), caps); - gst_caps_unref (caps); - - /* push header buffers; update caps, so when we push the first buffer the - * negotiated caps will change to caps that include the streamheader field */ - while (flacparse->headers) { - GstBuffer *buf = GST_BUFFER (flacparse->headers->data); - GstFlowReturn ret; - GstBaseParseFrame frame; - - flacparse->headers = - g_list_delete_link (flacparse->headers, flacparse->headers); - buf = gst_buffer_make_metadata_writable (buf); - gst_buffer_set_caps (buf, - GST_PAD_CAPS (GST_BASE_PARSE_SRC_PAD (GST_BASE_PARSE (flacparse)))); - - /* init, set and give away frame */ - gst_base_parse_frame_init (GST_BASE_PARSE (flacparse), &frame); - frame.buffer = buf; - frame.overhead = -1; - ret = gst_base_parse_push_frame (GST_BASE_PARSE (flacparse), &frame); - if (ret != GST_FLOW_OK) { - res = FALSE; - break; - } - } - g_list_foreach (flacparse->headers, (GFunc) gst_mini_object_unref, NULL); - g_list_free (flacparse->headers); - flacparse->headers = NULL; - - return res; -} - -static gboolean -gst_flac_parse_generate_headers (GstFlacParse * flacparse) -{ - GstBuffer *marker, *streaminfo, *vorbiscomment; - guint8 *data; - - marker = gst_buffer_new_and_alloc (4); - memcpy (GST_BUFFER_DATA (marker), "fLaC", 4); - GST_BUFFER_TIMESTAMP (marker) = GST_CLOCK_TIME_NONE; - GST_BUFFER_DURATION (marker) = GST_CLOCK_TIME_NONE; - GST_BUFFER_OFFSET (marker) = 0; - GST_BUFFER_OFFSET_END (marker) = 0; - flacparse->headers = g_list_append (flacparse->headers, marker); - - streaminfo = gst_buffer_new_and_alloc (4 + 34); - data = GST_BUFFER_DATA (streaminfo); - memset (data, 0, 4 + 34); - - /* metadata block header */ - data[0] = 0x00; /* is_last = 0; type = 0; */ - data[1] = 0x00; /* length = 34; */ - data[2] = 0x00; - data[3] = 0x22; - - /* streaminfo */ - - data[4] = (flacparse->block_size >> 8) & 0xff; /* min blocksize = blocksize; */ - data[5] = (flacparse->block_size) & 0xff; - data[6] = (flacparse->block_size >> 8) & 0xff; /* max blocksize = blocksize; */ - data[7] = (flacparse->block_size) & 0xff; - - data[8] = 0x00; /* min framesize = 0; */ - data[9] = 0x00; - data[10] = 0x00; - data[11] = 0x00; /* max framesize = 0; */ - data[12] = 0x00; - data[13] = 0x00; - - data[14] = (flacparse->samplerate >> 12) & 0xff; - data[15] = (flacparse->samplerate >> 4) & 0xff; - data[16] = (flacparse->samplerate >> 0) & 0xf0; - - data[16] |= (flacparse->channels - 1) << 1; - - data[16] |= ((flacparse->bps - 1) >> 4) & 0x01; - data[17] = (((flacparse->bps - 1)) & 0x0f) << 4; - - { - gint64 duration; - GstFormat fmt = GST_FORMAT_TIME; - - if (gst_pad_query_peer_duration (GST_BASE_PARSE_SINK_PAD (GST_BASE_PARSE - (flacparse)), &fmt, &duration) && fmt == GST_FORMAT_TIME) { - duration = GST_CLOCK_TIME_TO_FRAMES (duration, flacparse->samplerate); - - data[17] |= (duration >> 32) & 0xff; - data[18] |= (duration >> 24) & 0xff; - data[19] |= (duration >> 16) & 0xff; - data[20] |= (duration >> 8) & 0xff; - data[21] |= (duration >> 0) & 0xff; - } - } - /* MD5 = 0; */ - - GST_BUFFER_TIMESTAMP (streaminfo) = GST_CLOCK_TIME_NONE; - GST_BUFFER_DURATION (streaminfo) = GST_CLOCK_TIME_NONE; - GST_BUFFER_OFFSET (streaminfo) = 0; - GST_BUFFER_OFFSET_END (streaminfo) = 0; - flacparse->headers = g_list_append (flacparse->headers, streaminfo); - - /* empty vorbiscomment */ - { - GstTagList *taglist = gst_tag_list_new (); - guchar header[4]; - guint size; - - header[0] = 0x84; /* is_last = 1; type = 4; */ - - vorbiscomment = - gst_tag_list_to_vorbiscomment_buffer (taglist, header, - sizeof (header), NULL); - gst_tag_list_free (taglist); - - /* Get rid of framing bit */ - if (GST_BUFFER_DATA (vorbiscomment)[GST_BUFFER_SIZE (vorbiscomment) - - 1] == 1) { - GstBuffer *sub; - - sub = - gst_buffer_create_sub (vorbiscomment, 0, - GST_BUFFER_SIZE (vorbiscomment) - 1); - gst_buffer_unref (vorbiscomment); - vorbiscomment = sub; - } - - size = GST_BUFFER_SIZE (vorbiscomment) - 4; - GST_BUFFER_DATA (vorbiscomment)[1] = ((size & 0xFF0000) >> 16); - GST_BUFFER_DATA (vorbiscomment)[2] = ((size & 0x00FF00) >> 8); - GST_BUFFER_DATA (vorbiscomment)[3] = (size & 0x0000FF); - - GST_BUFFER_TIMESTAMP (vorbiscomment) = GST_CLOCK_TIME_NONE; - GST_BUFFER_DURATION (vorbiscomment) = GST_CLOCK_TIME_NONE; - GST_BUFFER_OFFSET (vorbiscomment) = 0; - GST_BUFFER_OFFSET_END (vorbiscomment) = 0; - flacparse->headers = g_list_append (flacparse->headers, vorbiscomment); - } - - return TRUE; -} - -static GstFlowReturn -gst_flac_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame) -{ - GstFlacParse *flacparse = GST_FLAC_PARSE (parse); - GstBuffer *buffer = frame->buffer; - const guint8 *data = GST_BUFFER_DATA (buffer); - - if (flacparse->state == GST_FLAC_PARSE_STATE_INIT) { - GST_BUFFER_TIMESTAMP (buffer) = GST_CLOCK_TIME_NONE; - GST_BUFFER_DURATION (buffer) = GST_CLOCK_TIME_NONE; - GST_BUFFER_OFFSET (buffer) = 0; - GST_BUFFER_OFFSET_END (buffer) = 0; - - /* 32 bits metadata block */ - gst_base_parse_set_min_frame_size (GST_BASE_PARSE (flacparse), 4); - flacparse->state = GST_FLAC_PARSE_STATE_HEADERS; - - flacparse->headers = - g_list_append (flacparse->headers, gst_buffer_ref (buffer)); - - return GST_BASE_PARSE_FLOW_DROPPED; - } else if (flacparse->state == GST_FLAC_PARSE_STATE_HEADERS) { - gboolean is_last = ((data[0] & 0x80) == 0x80); - guint type = (data[0] & 0x7F); - - if (type == 127) { - GST_WARNING_OBJECT (flacparse, "Invalid metadata block type"); - return GST_BASE_PARSE_FLOW_DROPPED; - } - - GST_DEBUG_OBJECT (flacparse, "Handling metadata block of type %u", type); - - switch (type) { - case 0: /* STREAMINFO */ - if (!gst_flac_parse_handle_streaminfo (flacparse, buffer)) - return GST_FLOW_ERROR; - break; - case 3: /* SEEKTABLE */ - if (!gst_flac_parse_handle_seektable (flacparse, buffer)) - return GST_FLOW_ERROR; - break; - case 4: /* VORBIS_COMMENT */ - if (!gst_flac_parse_handle_vorbiscomment (flacparse, buffer)) - return GST_FLOW_ERROR; - break; - case 6: /* PICTURE */ - if (!gst_flac_parse_handle_picture (flacparse, buffer)) - return GST_FLOW_ERROR; - break; - case 1: /* PADDING */ - case 2: /* APPLICATION */ - case 5: /* CUESHEET */ - default: /* RESERVED */ - break; - } - - GST_BUFFER_TIMESTAMP (buffer) = GST_CLOCK_TIME_NONE; - GST_BUFFER_DURATION (buffer) = GST_CLOCK_TIME_NONE; - GST_BUFFER_OFFSET (buffer) = 0; - GST_BUFFER_OFFSET_END (buffer) = 0; - - flacparse->headers = - g_list_append (flacparse->headers, gst_buffer_ref (buffer)); - - if (is_last) { - if (!gst_flac_parse_handle_headers (flacparse)) - return GST_FLOW_ERROR; - - /* Minimal size of a frame header */ - gst_base_parse_set_min_frame_size (GST_BASE_PARSE (flacparse), MAX (9, - flacparse->min_framesize)); - flacparse->state = GST_FLAC_PARSE_STATE_DATA; - } - - /* DROPPED because we pushed already or will push all headers manually */ - return GST_BASE_PARSE_FLOW_DROPPED; - } else { - if (flacparse->offset != GST_BUFFER_OFFSET (buffer)) { - FrameHeaderCheckReturn ret; - - flacparse->offset = GST_BUFFER_OFFSET (buffer); - ret = - gst_flac_parse_frame_header_is_valid (flacparse, - GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer), TRUE, NULL); - if (ret != FRAME_HEADER_VALID) { - GST_ERROR_OBJECT (flacparse, - "Baseclass didn't provide a complete frame"); - return GST_FLOW_ERROR; - } - } - - if (flacparse->block_size == 0) { - GST_ERROR_OBJECT (flacparse, "Unparsed frame"); - return GST_FLOW_ERROR; - } - - if (flacparse->seektable) - gst_flac_parse_process_seektable (flacparse, GST_BUFFER_OFFSET (buffer)); - - if (flacparse->state == GST_FLAC_PARSE_STATE_GENERATE_HEADERS) { - if (flacparse->blocking_strategy == 1) { - GST_WARNING_OBJECT (flacparse, - "Generating headers for variable blocksize streams not supported"); - - if (!gst_flac_parse_handle_headers (flacparse)) - return GST_FLOW_ERROR; - } else { - GST_DEBUG_OBJECT (flacparse, "Generating headers"); - - if (!gst_flac_parse_generate_headers (flacparse)) - return GST_FLOW_ERROR; - - if (!gst_flac_parse_handle_headers (flacparse)) - return GST_FLOW_ERROR; - } - flacparse->state = GST_FLAC_PARSE_STATE_DATA; - } - - /* also cater for oggmux metadata */ - if (flacparse->blocking_strategy == 0) { - GST_BUFFER_TIMESTAMP (buffer) = - gst_util_uint64_scale (flacparse->sample_number, - flacparse->block_size * GST_SECOND, flacparse->samplerate); - GST_BUFFER_OFFSET_END (buffer) = - flacparse->sample_number * flacparse->block_size + - flacparse->block_size; - } else { - GST_BUFFER_TIMESTAMP (buffer) = - gst_util_uint64_scale (flacparse->sample_number, GST_SECOND, - flacparse->samplerate); - GST_BUFFER_OFFSET_END (buffer) = - flacparse->sample_number + flacparse->block_size; - } - GST_BUFFER_OFFSET (buffer) = - gst_util_uint64_scale (GST_BUFFER_OFFSET_END (buffer), GST_SECOND, - flacparse->samplerate); - GST_BUFFER_DURATION (buffer) = - GST_BUFFER_OFFSET (buffer) - GST_BUFFER_TIMESTAMP (buffer); - - /* To simplify, we just assume that it's a fixed size header and ignore - * subframe headers. The first could lead us to being off by 88 bits and - * the second even less, so the total inaccuracy is negligible. */ - frame->overhead = 7; - - /* Minimal size of a frame header */ - gst_base_parse_set_min_frame_size (GST_BASE_PARSE (flacparse), MAX (9, - flacparse->min_framesize)); - - flacparse->offset = -1; - flacparse->blocking_strategy = 0; - flacparse->block_size = 0; - flacparse->sample_number = 0; - return GST_FLOW_OK; - } -} - -static GstFlowReturn -gst_flac_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame) -{ - GstFlacParse *flacparse = GST_FLAC_PARSE (parse); - - /* Push tags */ - if (flacparse->tags) { - gst_element_found_tags (GST_ELEMENT (flacparse), flacparse->tags); - flacparse->tags = NULL; - } - - frame->flags |= GST_BASE_PARSE_FRAME_FLAG_CLIP; - - return GST_FLOW_OK; -} diff --git a/gst/audioparsers/gstflacparse.h b/gst/audioparsers/gstflacparse.h deleted file mode 100644 index 664b2a6bc9..0000000000 --- a/gst/audioparsers/gstflacparse.h +++ /dev/null @@ -1,92 +0,0 @@ -/* GStreamer - * - * Copyright (C) 2008 Sebastian Dröge . - * Copyright (C) 2009 Mark Nauwelaerts - * Copyright (C) 2009 Nokia Corporation. All rights reserved. - * Contact: Stefan Kost - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GST_FLAC_PARSE_H__ -#define __GST_FLAC_PARSE_H__ - -#include -#include - -G_BEGIN_DECLS - -#define GST_TYPE_FLAC_PARSE (gst_flac_parse_get_type()) -#define GST_FLAC_PARSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FLAC_PARSE,GstFlacParse)) -#define GST_FLAC_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FLAC_PARSE,GstFlacParseClass)) -#define GST_FLAC_PARSE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_FLAC_PARSE,GstFlacParseClass)) -#define GST_IS_FLAC_PARSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FLAC_PARSE)) -#define GST_IS_FLAC_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FLAC_PARSE)) -#define GST_FLAC_PARSE_CAST(obj) ((GstFlacParse *)(obj)) - -typedef struct _GstFlacParse GstFlacParse; -typedef struct _GstFlacParseClass GstFlacParseClass; - -typedef enum { - GST_FLAC_PARSE_STATE_INIT, - GST_FLAC_PARSE_STATE_HEADERS, - GST_FLAC_PARSE_STATE_GENERATE_HEADERS, - GST_FLAC_PARSE_STATE_DATA -} GstFlacParseState; - -typedef struct { - guint8 type; -} GstFlacParseSubFrame; - -struct _GstFlacParse { - GstBaseParse parent; - - /* Properties */ - gboolean check_frame_checksums; - - GstFlacParseState state; - - gint64 upstream_length; - - /* STREAMINFO content */ - guint16 min_blocksize, max_blocksize; - guint32 min_framesize, max_framesize; - guint32 samplerate; - guint8 channels; - guint8 bps; - guint64 total_samples; - - /* Current frame */ - guint64 offset; - guint8 blocking_strategy; - guint16 block_size; - guint64 sample_number; - - GstTagList *tags; - - GList *headers; - GstBuffer *seektable; -}; - -struct _GstFlacParseClass { - GstBaseParseClass parent_class; -}; - -GType gst_flac_parse_get_type (void); - -G_END_DECLS - -#endif /* __GST_FLAC_PARSE_H__ */ diff --git a/gst/audioparsers/gstmpegaudioparse.c b/gst/audioparsers/gstmpegaudioparse.c deleted file mode 100644 index b9ad66a43e..0000000000 --- a/gst/audioparsers/gstmpegaudioparse.c +++ /dev/null @@ -1,1209 +0,0 @@ -/* GStreamer MPEG audio parser - * Copyright (C) 2006-2007 Jan Schmidt - * Copyright (C) 2010 Mark Nauwelaerts - * Copyright (C) 2010 Nokia Corporation. All rights reserved. - * Contact: Stefan Kost - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/** - * SECTION:element-mpegaudioparse - * @short_description: MPEG audio parser - * @see_also: #GstAmrParse, #GstAACParse - * - * Parses and frames mpeg1 audio streams. Provides seeking. - * - * - * Example launch line - * |[ - * gst-launch filesrc location=test.mp3 ! mpegaudioparse ! mad ! autoaudiosink - * ]| - * - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include "gstmpegaudioparse.h" -#include - -GST_DEBUG_CATEGORY_STATIC (mpeg_audio_parse_debug); -#define GST_CAT_DEFAULT mpeg_audio_parse_debug - -#define MPEG_AUDIO_CHANNEL_MODE_UNKNOWN -1 -#define MPEG_AUDIO_CHANNEL_MODE_STEREO 0 -#define MPEG_AUDIO_CHANNEL_MODE_JOINT_STEREO 1 -#define MPEG_AUDIO_CHANNEL_MODE_DUAL_CHANNEL 2 -#define MPEG_AUDIO_CHANNEL_MODE_MONO 3 - -#define CRC_UNKNOWN -1 -#define CRC_PROTECTED 0 -#define CRC_NOT_PROTECTED 1 - -#define XING_FRAMES_FLAG 0x0001 -#define XING_BYTES_FLAG 0x0002 -#define XING_TOC_FLAG 0x0004 -#define XING_VBR_SCALE_FLAG 0x0008 - -static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/mpeg, " - "mpegversion = (int) 1, " - "layer = (int) [ 1, 3 ], " - "rate = (int) [ 8000, 48000 ], channels = (int) [ 1, 2 ]," - "parsed=(boolean) true") - ); - -static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/mpeg, mpegversion = (int) 1, parsed=(boolean)false") - ); - -static void gst_mpeg_audio_parse_finalize (GObject * object); - -static gboolean gst_mpeg_audio_parse_start (GstBaseParse * parse); -static gboolean gst_mpeg_audio_parse_stop (GstBaseParse * parse); -static gboolean gst_mpeg_audio_parse_check_valid_frame (GstBaseParse * parse, - GstBaseParseFrame * frame, guint * size, gint * skipsize); -static GstFlowReturn gst_mpeg_audio_parse_parse_frame (GstBaseParse * parse, - GstBaseParseFrame * frame); -static GstFlowReturn gst_mpeg_audio_parse_pre_push_frame (GstBaseParse * parse, - GstBaseParseFrame * frame); -static gboolean gst_mpeg_audio_parse_convert (GstBaseParse * parse, - GstFormat src_format, gint64 src_value, - GstFormat dest_format, gint64 * dest_value); - -GST_BOILERPLATE (GstMpegAudioParse, gst_mpeg_audio_parse, GstBaseParse, - GST_TYPE_BASE_PARSE); - -#define GST_TYPE_MPEG_AUDIO_CHANNEL_MODE \ - (gst_mpeg_audio_channel_mode_get_type()) - -static const GEnumValue mpeg_audio_channel_mode[] = { - {MPEG_AUDIO_CHANNEL_MODE_UNKNOWN, "Unknown", "unknown"}, - {MPEG_AUDIO_CHANNEL_MODE_MONO, "Mono", "mono"}, - {MPEG_AUDIO_CHANNEL_MODE_DUAL_CHANNEL, "Dual Channel", "dual-channel"}, - {MPEG_AUDIO_CHANNEL_MODE_JOINT_STEREO, "Joint Stereo", "joint-stereo"}, - {MPEG_AUDIO_CHANNEL_MODE_STEREO, "Stereo", "stereo"}, - {0, NULL, NULL}, -}; - -static GType -gst_mpeg_audio_channel_mode_get_type (void) -{ - static GType mpeg_audio_channel_mode_type = 0; - - if (!mpeg_audio_channel_mode_type) { - mpeg_audio_channel_mode_type = - g_enum_register_static ("GstMpegAudioChannelMode", - mpeg_audio_channel_mode); - } - return mpeg_audio_channel_mode_type; -} - -static const gchar * -gst_mpeg_audio_channel_mode_get_nick (gint mode) -{ - guint i; - for (i = 0; i < G_N_ELEMENTS (mpeg_audio_channel_mode); i++) { - if (mpeg_audio_channel_mode[i].value == mode) - return mpeg_audio_channel_mode[i].value_nick; - } - return NULL; -} - -static void -gst_mpeg_audio_parse_base_init (gpointer klass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&src_template)); - - gst_element_class_set_details_simple (element_class, "MPEG1 Audio Parser", - "Codec/Parser/Audio", - "Parses and frames mpeg1 audio streams (levels 1-3), provides seek", - "Jan Schmidt ," - "Mark Nauwelaerts "); -} - -static void -gst_mpeg_audio_parse_class_init (GstMpegAudioParseClass * klass) -{ - GstBaseParseClass *parse_class = GST_BASE_PARSE_CLASS (klass); - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - GST_DEBUG_CATEGORY_INIT (mpeg_audio_parse_debug, "mpegaudioparse", 0, - "MPEG1 audio stream parser"); - - object_class->finalize = gst_mpeg_audio_parse_finalize; - - parse_class->start = GST_DEBUG_FUNCPTR (gst_mpeg_audio_parse_start); - parse_class->stop = GST_DEBUG_FUNCPTR (gst_mpeg_audio_parse_stop); - parse_class->check_valid_frame = - GST_DEBUG_FUNCPTR (gst_mpeg_audio_parse_check_valid_frame); - parse_class->parse_frame = - GST_DEBUG_FUNCPTR (gst_mpeg_audio_parse_parse_frame); - parse_class->pre_push_frame = - GST_DEBUG_FUNCPTR (gst_mpeg_audio_parse_pre_push_frame); - parse_class->convert = GST_DEBUG_FUNCPTR (gst_mpeg_audio_parse_convert); - - /* register tags */ -#define GST_TAG_CRC "has-crc" -#define GST_TAG_MODE "channel-mode" - - gst_tag_register (GST_TAG_CRC, GST_TAG_FLAG_META, G_TYPE_BOOLEAN, - "has crc", "Using CRC", NULL); - gst_tag_register (GST_TAG_MODE, GST_TAG_FLAG_ENCODED, G_TYPE_STRING, - "channel mode", "MPEG audio channel mode", NULL); - - g_type_class_ref (GST_TYPE_MPEG_AUDIO_CHANNEL_MODE); -} - -static void -gst_mpeg_audio_parse_reset (GstMpegAudioParse * mp3parse) -{ - mp3parse->channels = -1; - mp3parse->rate = -1; - mp3parse->sent_codec_tag = FALSE; - mp3parse->last_posted_crc = CRC_UNKNOWN; - mp3parse->last_posted_channel_mode = MPEG_AUDIO_CHANNEL_MODE_UNKNOWN; - - mp3parse->hdr_bitrate = 0; - - mp3parse->xing_flags = 0; - mp3parse->xing_bitrate = 0; - mp3parse->xing_frames = 0; - mp3parse->xing_total_time = 0; - mp3parse->xing_bytes = 0; - mp3parse->xing_vbr_scale = 0; - memset (mp3parse->xing_seek_table, 0, 100); - memset (mp3parse->xing_seek_table_inverse, 0, 256); - - mp3parse->vbri_bitrate = 0; - mp3parse->vbri_frames = 0; - mp3parse->vbri_total_time = 0; - mp3parse->vbri_bytes = 0; - mp3parse->vbri_seek_points = 0; - g_free (mp3parse->vbri_seek_table); - mp3parse->vbri_seek_table = NULL; -} - -static void -gst_mpeg_audio_parse_init (GstMpegAudioParse * mp3parse, - GstMpegAudioParseClass * klass) -{ - gst_mpeg_audio_parse_reset (mp3parse); -} - -static void -gst_mpeg_audio_parse_finalize (GObject * object) -{ - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static gboolean -gst_mpeg_audio_parse_start (GstBaseParse * parse) -{ - GstMpegAudioParse *mp3parse = GST_MPEG_AUDIO_PARSE (parse); - - gst_base_parse_set_min_frame_size (GST_BASE_PARSE (mp3parse), 1024); - GST_DEBUG_OBJECT (parse, "starting"); - - gst_mpeg_audio_parse_reset (mp3parse); - - return TRUE; -} - -static gboolean -gst_mpeg_audio_parse_stop (GstBaseParse * parse) -{ - GstMpegAudioParse *mp3parse = GST_MPEG_AUDIO_PARSE (parse); - - GST_DEBUG_OBJECT (parse, "stopping"); - - gst_mpeg_audio_parse_reset (mp3parse); - - return TRUE; -} - -static const guint mp3types_bitrates[2][3][16] = { - { - {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448,}, - {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384,}, - {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320,} - }, - { - {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256,}, - {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,}, - {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,} - }, -}; - -static const guint mp3types_freqs[3][3] = { {44100, 48000, 32000}, -{22050, 24000, 16000}, -{11025, 12000, 8000} -}; - -static inline guint -mp3_type_frame_length_from_header (GstMpegAudioParse * mp3parse, guint32 header, - guint * put_version, guint * put_layer, guint * put_channels, - guint * put_bitrate, guint * put_samplerate, guint * put_mode, - guint * put_crc) -{ - guint length; - gulong mode, samplerate, bitrate, layer, channels, padding, crc; - gulong version; - gint lsf, mpg25; - - if (header & (1 << 20)) { - lsf = (header & (1 << 19)) ? 0 : 1; - mpg25 = 0; - } else { - lsf = 1; - mpg25 = 1; - } - - version = 1 + lsf + mpg25; - - layer = 4 - ((header >> 17) & 0x3); - - crc = (header >> 16) & 0x1; - - bitrate = (header >> 12) & 0xF; - bitrate = mp3types_bitrates[lsf][layer - 1][bitrate] * 1000; - /* The caller has ensured we have a valid header, so bitrate can't be - zero here. */ - g_assert (bitrate != 0); - - samplerate = (header >> 10) & 0x3; - samplerate = mp3types_freqs[lsf + mpg25][samplerate]; - - padding = (header >> 9) & 0x1; - - mode = (header >> 6) & 0x3; - channels = (mode == 3) ? 1 : 2; - - switch (layer) { - case 1: - length = 4 * ((bitrate * 12) / samplerate + padding); - break; - case 2: - length = (bitrate * 144) / samplerate + padding; - break; - default: - case 3: - length = (bitrate * 144) / (samplerate << lsf) + padding; - break; - } - - GST_DEBUG_OBJECT (mp3parse, "Calculated mp3 frame length of %u bytes", - length); - GST_DEBUG_OBJECT (mp3parse, "samplerate = %lu, bitrate = %lu, version = %lu, " - "layer = %lu, channels = %lu, mode = %s", samplerate, bitrate, version, - layer, channels, gst_mpeg_audio_channel_mode_get_nick (mode)); - - if (put_version) - *put_version = version; - if (put_layer) - *put_layer = layer; - if (put_channels) - *put_channels = channels; - if (put_bitrate) - *put_bitrate = bitrate; - if (put_samplerate) - *put_samplerate = samplerate; - if (put_mode) - *put_mode = mode; - if (put_crc) - *put_crc = crc; - - return length; -} - -/* Minimum number of consecutive, valid-looking frames to consider - * for resyncing */ -#define MIN_RESYNC_FRAMES 3 - -/* Perform extended validation to check that subsequent headers match - * the first header given here in important characteristics, to avoid - * false sync. We look for a minimum of MIN_RESYNC_FRAMES consecutive - * frames to match their major characteristics. - * - * If at_eos is set to TRUE, we just check that we don't find any invalid - * frames in whatever data is available, rather than requiring a full - * MIN_RESYNC_FRAMES of data. - * - * Returns TRUE if we've seen enough data to validate or reject the frame. - * If TRUE is returned, then *valid contains TRUE if it validated, or false - * if we decided it was false sync. - * If FALSE is returned, then *valid contains minimum needed data. - */ -static gboolean -gst_mp3parse_validate_extended (GstMpegAudioParse * mp3parse, GstBuffer * buf, - guint32 header, int bpf, gboolean at_eos, gint * valid) -{ - guint32 next_header; - const guint8 *data; - guint available; - int frames_found = 1; - int offset = bpf; - - available = GST_BUFFER_SIZE (buf); - data = GST_BUFFER_DATA (buf); - - while (frames_found < MIN_RESYNC_FRAMES) { - /* Check if we have enough data for all these frames, plus the next - frame header. */ - if (available < offset + 4) { - if (at_eos) { - /* Running out of data at EOS is fine; just accept it */ - *valid = TRUE; - return TRUE; - } else { - *valid = offset + 4; - return FALSE; - } - } - - next_header = GST_READ_UINT32_BE (data + offset); - GST_DEBUG_OBJECT (mp3parse, "At %d: header=%08X, header2=%08X, bpf=%d", - offset, (unsigned int) header, (unsigned int) next_header, bpf); - -/* mask the bits which are allowed to differ between frames */ -#define HDRMASK ~((0xF << 12) /* bitrate */ | \ - (0x1 << 9) /* padding */ | \ - (0xf << 4) /* mode|mode extension */ | \ - (0xf)) /* copyright|emphasis */ - - if ((next_header & HDRMASK) != (header & HDRMASK)) { - /* If any of the unmasked bits don't match, then it's not valid */ - GST_DEBUG_OBJECT (mp3parse, "next header doesn't match " - "(header=%08X (%08X), header2=%08X (%08X), bpf=%d)", - (guint) header, (guint) header & HDRMASK, (guint) next_header, - (guint) next_header & HDRMASK, bpf); - *valid = FALSE; - return TRUE; - } else if ((((next_header >> 12) & 0xf) == 0) || - (((next_header >> 12) & 0xf) == 0xf)) { - /* The essential parts were the same, but the bitrate held an - invalid value - also reject */ - GST_DEBUG_OBJECT (mp3parse, "next header invalid (bitrate)"); - *valid = FALSE; - return TRUE; - } - - bpf = mp3_type_frame_length_from_header (mp3parse, next_header, - NULL, NULL, NULL, NULL, NULL, NULL, NULL); - - offset += bpf; - frames_found++; - } - - *valid = TRUE; - return TRUE; -} - -static gboolean -gst_mpeg_audio_parse_head_check (GstMpegAudioParse * mp3parse, - unsigned long head) -{ - GST_DEBUG_OBJECT (mp3parse, "checking mp3 header 0x%08lx", head); - /* if it's not a valid sync */ - if ((head & 0xffe00000) != 0xffe00000) { - GST_WARNING_OBJECT (mp3parse, "invalid sync"); - return FALSE; - } - /* if it's an invalid MPEG version */ - if (((head >> 19) & 3) == 0x1) { - GST_WARNING_OBJECT (mp3parse, "invalid MPEG version: 0x%lx", - (head >> 19) & 3); - return FALSE; - } - /* if it's an invalid layer */ - if (!((head >> 17) & 3)) { - GST_WARNING_OBJECT (mp3parse, "invalid layer: 0x%lx", (head >> 17) & 3); - return FALSE; - } - /* if it's an invalid bitrate */ - if (((head >> 12) & 0xf) == 0x0) { - GST_WARNING_OBJECT (mp3parse, "invalid bitrate: 0x%lx." - "Free format files are not supported yet", (head >> 12) & 0xf); - return FALSE; - } - if (((head >> 12) & 0xf) == 0xf) { - GST_WARNING_OBJECT (mp3parse, "invalid bitrate: 0x%lx", (head >> 12) & 0xf); - return FALSE; - } - /* if it's an invalid samplerate */ - if (((head >> 10) & 0x3) == 0x3) { - GST_WARNING_OBJECT (mp3parse, "invalid samplerate: 0x%lx", - (head >> 10) & 0x3); - return FALSE; - } - - if ((head & 0x3) == 0x2) { - /* Ignore this as there are some files with emphasis 0x2 that can - * be played fine. See BGO #537235 */ - GST_WARNING_OBJECT (mp3parse, "invalid emphasis: 0x%lx", head & 0x3); - } - - return TRUE; -} - -static gboolean -gst_mpeg_audio_parse_check_valid_frame (GstBaseParse * parse, - GstBaseParseFrame * frame, guint * framesize, gint * skipsize) -{ - GstMpegAudioParse *mp3parse = GST_MPEG_AUDIO_PARSE (parse); - GstBuffer *buf = frame->buffer; - GstByteReader reader = GST_BYTE_READER_INIT_FROM_BUFFER (buf); - gint off, bpf; - gboolean sync, drain, valid, caps_change; - guint32 header; - guint bitrate, layer, rate, channels, version, mode, crc; - - if (G_UNLIKELY (GST_BUFFER_SIZE (buf) < 6)) - return FALSE; - - off = gst_byte_reader_masked_scan_uint32 (&reader, 0xffe00000, 0xffe00000, - 0, GST_BUFFER_SIZE (buf)); - - GST_LOG_OBJECT (parse, "possible sync at buffer offset %d", off); - - /* didn't find anything that looks like a sync word, skip */ - if (off < 0) { - *skipsize = GST_BUFFER_SIZE (buf) - 3; - return FALSE; - } - - /* possible frame header, but not at offset 0? skip bytes before sync */ - if (off > 0) { - *skipsize = off; - return FALSE; - } - - /* make sure the values in the frame header look sane */ - header = GST_READ_UINT32_BE (GST_BUFFER_DATA (buf)); - if (!gst_mpeg_audio_parse_head_check (mp3parse, header)) { - *skipsize = 1; - return FALSE; - } - - GST_LOG_OBJECT (parse, "got frame"); - - bpf = mp3_type_frame_length_from_header (mp3parse, header, - &version, &layer, &channels, &bitrate, &rate, &mode, &crc); - g_assert (bpf != 0); - - if (channels != mp3parse->channels || rate != mp3parse->rate || - layer != mp3parse->layer || version != mp3parse->version) - caps_change = TRUE; - else - caps_change = FALSE; - - sync = GST_BASE_PARSE_FRAME_SYNC (frame); - drain = GST_BASE_PARSE_FRAME_DRAIN (frame); - - if (!drain && (!sync || caps_change)) { - if (!gst_mp3parse_validate_extended (mp3parse, buf, header, bpf, drain, - &valid)) { - /* not enough data */ - gst_base_parse_set_min_frame_size (parse, valid); - *skipsize = 0; - return FALSE; - } else { - if (!valid) { - *skipsize = off + 2; - return FALSE; - } - } - } - - *framesize = bpf; - return TRUE; -} - -static void -gst_mpeg_audio_parse_handle_first_frame (GstMpegAudioParse * mp3parse, - GstBuffer * buf) -{ - const guint32 xing_id = 0x58696e67; /* 'Xing' in hex */ - const guint32 info_id = 0x496e666f; /* 'Info' in hex - found in LAME CBR files */ - const guint32 vbri_id = 0x56425249; /* 'VBRI' in hex */ - gint offset; - guint64 avail; - gint64 upstream_total_bytes = 0; - GstFormat fmt = GST_FORMAT_BYTES; - guint32 read_id; - const guint8 *data; - GstBaseParseSeekable seekable; - guint bitrate; - - if (mp3parse->sent_codec_tag) - return; - - /* Check first frame for Xing info */ - if (mp3parse->version == 1) { /* MPEG-1 file */ - if (mp3parse->channels == 1) - offset = 0x11; - else - offset = 0x20; - } else { /* MPEG-2 header */ - if (mp3parse->channels == 1) - offset = 0x09; - else - offset = 0x11; - } - /* Skip the 4 bytes of the MP3 header too */ - offset += 4; - - /* Check if we have enough data to read the Xing header */ - avail = GST_BUFFER_SIZE (buf); - data = GST_BUFFER_DATA (buf); - if (avail < offset + 8) - return; - - /* The header starts at the provided offset */ - data += offset; - - /* obtain real upstream total bytes */ - fmt = GST_FORMAT_BYTES; - if (!gst_pad_query_peer_duration (GST_BASE_PARSE_SINK_PAD (GST_BASE_PARSE - (mp3parse)), &fmt, &upstream_total_bytes)) - upstream_total_bytes = 0; - - read_id = GST_READ_UINT32_BE (data); - if (read_id == xing_id || read_id == info_id) { - guint32 xing_flags; - guint bytes_needed = offset + 8; - gint64 total_bytes; - GstClockTime total_time; - - GST_DEBUG_OBJECT (mp3parse, "Found Xing header marker 0x%x", xing_id); - - /* Read 4 base bytes of flags, big-endian */ - xing_flags = GST_READ_UINT32_BE (data + 4); - if (xing_flags & XING_FRAMES_FLAG) - bytes_needed += 4; - if (xing_flags & XING_BYTES_FLAG) - bytes_needed += 4; - if (xing_flags & XING_TOC_FLAG) - bytes_needed += 100; - if (xing_flags & XING_VBR_SCALE_FLAG) - bytes_needed += 4; - if (avail < bytes_needed) { - GST_DEBUG_OBJECT (mp3parse, - "Not enough data to read Xing header (need %d)", bytes_needed); - return; - } - - GST_DEBUG_OBJECT (mp3parse, "Reading Xing header"); - mp3parse->xing_flags = xing_flags; - - data = GST_BUFFER_DATA (buf); - data += offset + 8; - - if (xing_flags & XING_FRAMES_FLAG) { - mp3parse->xing_frames = GST_READ_UINT32_BE (data); - if (mp3parse->xing_frames == 0) { - GST_WARNING_OBJECT (mp3parse, - "Invalid number of frames in Xing header"); - mp3parse->xing_flags &= ~XING_FRAMES_FLAG; - } else { - mp3parse->xing_total_time = gst_util_uint64_scale (GST_SECOND, - (guint64) (mp3parse->xing_frames) * (mp3parse->spf), - mp3parse->rate); - } - - data += 4; - } else { - mp3parse->xing_frames = 0; - mp3parse->xing_total_time = 0; - } - - if (xing_flags & XING_BYTES_FLAG) { - mp3parse->xing_bytes = GST_READ_UINT32_BE (data); - if (mp3parse->xing_bytes == 0) { - GST_WARNING_OBJECT (mp3parse, "Invalid number of bytes in Xing header"); - mp3parse->xing_flags &= ~XING_BYTES_FLAG; - } - data += 4; - } else { - mp3parse->xing_bytes = 0; - } - - /* If we know the upstream size and duration, compute the - * total bitrate, rounded up to the nearest kbit/sec */ - if ((total_time = mp3parse->xing_total_time) && - (total_bytes = mp3parse->xing_bytes)) { - mp3parse->xing_bitrate = gst_util_uint64_scale (total_bytes, - 8 * GST_SECOND, total_time); - mp3parse->xing_bitrate += 500; - mp3parse->xing_bitrate -= mp3parse->xing_bitrate % 1000; - } - - if (xing_flags & XING_TOC_FLAG) { - int i, percent = 0; - guchar *table = mp3parse->xing_seek_table; - guchar old = 0, new; - guint first; - - first = data[0]; - GST_DEBUG_OBJECT (mp3parse, - "Subtracting initial offset of %d bytes from Xing TOC", first); - - /* xing seek table: percent time -> 1/256 bytepos */ - for (i = 0; i < 100; i++) { - new = data[i] - first; - if (old > new) { - GST_WARNING_OBJECT (mp3parse, "Skipping broken Xing TOC"); - mp3parse->xing_flags &= ~XING_TOC_FLAG; - goto skip_toc; - } - mp3parse->xing_seek_table[i] = old = new; - } - - /* build inverse table: 1/256 bytepos -> 1/100 percent time */ - for (i = 0; i < 256; i++) { - while (percent < 99 && table[percent + 1] <= i) - percent++; - - if (table[percent] == i) { - mp3parse->xing_seek_table_inverse[i] = percent * 100; - } else if (table[percent] < i && percent < 99) { - gdouble fa, fb, fx; - gint a = percent, b = percent + 1; - - fa = table[a]; - fb = table[b]; - fx = (b - a) / (fb - fa) * (i - fa) + a; - mp3parse->xing_seek_table_inverse[i] = (guint16) (fx * 100); - } else if (percent == 99) { - gdouble fa, fb, fx; - gint a = percent, b = 100; - - fa = table[a]; - fb = 256.0; - fx = (b - a) / (fb - fa) * (i - fa) + a; - mp3parse->xing_seek_table_inverse[i] = (guint16) (fx * 100); - } - } - skip_toc: - data += 100; - } else { - memset (mp3parse->xing_seek_table, 0, 100); - memset (mp3parse->xing_seek_table_inverse, 0, 256); - } - - if (xing_flags & XING_VBR_SCALE_FLAG) { - mp3parse->xing_vbr_scale = GST_READ_UINT32_BE (data); - } else - mp3parse->xing_vbr_scale = 0; - - GST_DEBUG_OBJECT (mp3parse, "Xing header reported %u frames, time %" - GST_TIME_FORMAT ", %u bytes, vbr scale %u", mp3parse->xing_frames, - GST_TIME_ARGS (mp3parse->xing_total_time), mp3parse->xing_bytes, - mp3parse->xing_vbr_scale); - - /* check for truncated file */ - if (upstream_total_bytes && mp3parse->xing_bytes && - mp3parse->xing_bytes * 0.8 > upstream_total_bytes) { - GST_WARNING_OBJECT (mp3parse, "File appears to have been truncated; " - "invalidating Xing header duration and size"); - mp3parse->xing_flags &= ~XING_BYTES_FLAG; - mp3parse->xing_flags &= ~XING_FRAMES_FLAG; - } - } else if (read_id == vbri_id) { - gint64 total_bytes, total_frames; - GstClockTime total_time; - guint16 nseek_points; - - GST_DEBUG_OBJECT (mp3parse, "Found VBRI header marker 0x%x", vbri_id); - if (avail < offset + 26) { - GST_DEBUG_OBJECT (mp3parse, - "Not enough data to read VBRI header (need %d)", offset + 26); - return; - } - - GST_DEBUG_OBJECT (mp3parse, "Reading VBRI header"); - data = GST_BUFFER_DATA (buf); - data += offset + 4; - - if (GST_READ_UINT16_BE (data) != 0x0001) { - GST_WARNING_OBJECT (mp3parse, - "Unsupported VBRI version 0x%x", GST_READ_UINT16_BE (data)); - return; - } - data += 2; - - /* Skip encoder delay */ - data += 2; - - /* Skip quality */ - data += 2; - - total_bytes = GST_READ_UINT32_BE (data); - if (total_bytes != 0) - mp3parse->vbri_bytes = total_bytes; - data += 4; - - total_frames = GST_READ_UINT32_BE (data); - if (total_frames != 0) { - mp3parse->vbri_frames = total_frames; - mp3parse->vbri_total_time = gst_util_uint64_scale (GST_SECOND, - (guint64) (mp3parse->vbri_frames) * (mp3parse->spf), mp3parse->rate); - } - data += 4; - - /* If we know the upstream size and duration, compute the - * total bitrate, rounded up to the nearest kbit/sec */ - if ((total_time = mp3parse->vbri_total_time) && - (total_bytes = mp3parse->vbri_bytes)) { - mp3parse->vbri_bitrate = gst_util_uint64_scale (total_bytes, - 8 * GST_SECOND, total_time); - mp3parse->vbri_bitrate += 500; - mp3parse->vbri_bitrate -= mp3parse->vbri_bitrate % 1000; - } - - nseek_points = GST_READ_UINT16_BE (data); - data += 2; - - if (nseek_points > 0) { - guint scale, seek_bytes, seek_frames; - gint i; - - mp3parse->vbri_seek_points = nseek_points; - - scale = GST_READ_UINT16_BE (data); - data += 2; - - seek_bytes = GST_READ_UINT16_BE (data); - data += 2; - - seek_frames = GST_READ_UINT16_BE (data); - - if (scale == 0 || seek_bytes == 0 || seek_bytes > 4 || seek_frames == 0) { - GST_WARNING_OBJECT (mp3parse, "Unsupported VBRI seek table"); - goto out_vbri; - } - - if (avail < offset + 26 + nseek_points * seek_bytes) { - GST_WARNING_OBJECT (mp3parse, - "Not enough data to read VBRI seek table (need %d)", - offset + 26 + nseek_points * seek_bytes); - goto out_vbri; - } - - if (seek_frames * nseek_points < total_frames - seek_frames || - seek_frames * nseek_points > total_frames + seek_frames) { - GST_WARNING_OBJECT (mp3parse, - "VBRI seek table doesn't cover the complete file"); - goto out_vbri; - } - - if (avail < offset + 26) { - GST_DEBUG_OBJECT (mp3parse, - "Not enough data to read VBRI header (need %d)", - offset + 26 + nseek_points * seek_bytes); - return; - } - - data = GST_BUFFER_DATA (buf); - data += offset + 26; - - /* VBRI seek table: frame/seek_frames -> byte */ - mp3parse->vbri_seek_table = g_new (guint32, nseek_points); - if (seek_bytes == 4) - for (i = 0; i < nseek_points; i++) { - mp3parse->vbri_seek_table[i] = GST_READ_UINT32_BE (data) * scale; - data += 4; - } else if (seek_bytes == 3) - for (i = 0; i < nseek_points; i++) { - mp3parse->vbri_seek_table[i] = GST_READ_UINT24_BE (data) * scale; - data += 3; - } else if (seek_bytes == 2) - for (i = 0; i < nseek_points; i++) { - mp3parse->vbri_seek_table[i] = GST_READ_UINT16_BE (data) * scale; - data += 2; - } else /* seek_bytes == 1 */ - for (i = 0; i < nseek_points; i++) { - mp3parse->vbri_seek_table[i] = GST_READ_UINT8 (data) * scale; - data += 1; - } - } - out_vbri: - - GST_DEBUG_OBJECT (mp3parse, "VBRI header reported %u frames, time %" - GST_TIME_FORMAT ", bytes %u", mp3parse->vbri_frames, - GST_TIME_ARGS (mp3parse->vbri_total_time), mp3parse->vbri_bytes); - - /* check for truncated file */ - if (upstream_total_bytes && mp3parse->vbri_bytes && - mp3parse->vbri_bytes * 0.8 > upstream_total_bytes) { - GST_WARNING_OBJECT (mp3parse, "File appears to have been truncated; " - "invalidating VBRI header duration and size"); - mp3parse->vbri_valid = FALSE; - } else { - mp3parse->vbri_valid = TRUE; - } - } else { - GST_DEBUG_OBJECT (mp3parse, - "Xing, LAME or VBRI header not found in first frame"); - } - - /* set duration if tables provided a valid one */ - if (mp3parse->xing_flags & XING_FRAMES_FLAG) { - gst_base_parse_set_duration (GST_BASE_PARSE (mp3parse), GST_FORMAT_TIME, - mp3parse->xing_total_time, 0); - } - if (mp3parse->vbri_total_time != 0 && mp3parse->vbri_valid) { - gst_base_parse_set_duration (GST_BASE_PARSE (mp3parse), GST_FORMAT_TIME, - mp3parse->vbri_total_time, 0); - } - - /* tell baseclass how nicely we can seek, and a bitrate if one found */ - seekable = GST_BASE_PARSE_SEEK_DEFAULT; - if ((mp3parse->xing_flags & XING_TOC_FLAG) && mp3parse->xing_bytes && - mp3parse->xing_total_time) - seekable = GST_BASE_PARSE_SEEK_TABLE; - - if (mp3parse->vbri_seek_table && mp3parse->vbri_bytes && - mp3parse->vbri_total_time) - seekable = GST_BASE_PARSE_SEEK_TABLE; - - if (mp3parse->xing_bitrate) - bitrate = mp3parse->xing_bitrate; - else if (mp3parse->vbri_bitrate) - bitrate = mp3parse->vbri_bitrate; - else - bitrate = 0; - - gst_base_parse_set_seek (GST_BASE_PARSE (mp3parse), seekable, bitrate); -} - -static GstFlowReturn -gst_mpeg_audio_parse_parse_frame (GstBaseParse * parse, - GstBaseParseFrame * frame) -{ - GstMpegAudioParse *mp3parse = GST_MPEG_AUDIO_PARSE (parse); - GstBuffer *buf = frame->buffer; - guint bitrate, layer, rate, channels, version, mode, crc; - - g_return_val_if_fail (GST_BUFFER_SIZE (buf) >= 4, GST_FLOW_ERROR); - - if (!mp3_type_frame_length_from_header (mp3parse, - GST_READ_UINT32_BE (GST_BUFFER_DATA (buf)), - &version, &layer, &channels, &bitrate, &rate, &mode, &crc)) - goto broken_header; - - if (G_UNLIKELY (channels != mp3parse->channels || rate != mp3parse->rate || - layer != mp3parse->layer || version != mp3parse->version)) { - GstCaps *caps = gst_caps_new_simple ("audio/mpeg", - "mpegversion", G_TYPE_INT, 1, - "mpegaudioversion", G_TYPE_INT, version, - "layer", G_TYPE_INT, layer, - "rate", G_TYPE_INT, rate, - "channels", G_TYPE_INT, channels, "parsed", G_TYPE_BOOLEAN, TRUE, NULL); - gst_buffer_set_caps (buf, caps); - gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (parse), caps); - gst_caps_unref (caps); - - mp3parse->rate = rate; - mp3parse->channels = channels; - mp3parse->layer = layer; - mp3parse->version = version; - - /* see http://www.codeproject.com/audio/MPEGAudioInfo.asp */ - if (mp3parse->layer == 1) - mp3parse->spf = 384; - else if (mp3parse->layer == 2) - mp3parse->spf = 1152; - else if (mp3parse->version == 1) { - mp3parse->spf = 1152; - } else { - /* MPEG-2 or "2.5" */ - mp3parse->spf = 576; - } - - /* lead_in: - * We start pushing 9 frames earlier (29 frames for MPEG2) than - * segment start to be able to decode the first frame we want. - * 9 (29) frames are the theoretical maximum of frames that contain - * data for the current frame (bit reservoir). - * - * lead_out: - * Some mp3 streams have an offset in the timestamps, for which we have to - * push the frame *after* the end position in order for the decoder to be - * able to decode everything up until the segment.stop position. */ - gst_base_parse_set_frame_props (parse, mp3parse->rate, mp3parse->spf, - (version == 1) ? 10 : 30, 2); - } - - mp3parse->hdr_bitrate = bitrate; - - /* For first frame; check for seek tables and output a codec tag */ - gst_mpeg_audio_parse_handle_first_frame (mp3parse, buf); - - /* store some frame info for later processing */ - mp3parse->last_crc = crc; - mp3parse->last_mode = mode; - - return GST_FLOW_OK; - -/* ERRORS */ -broken_header: - { - /* this really shouldn't ever happen */ - GST_ELEMENT_ERROR (parse, STREAM, DECODE, (NULL), (NULL)); - return GST_FLOW_ERROR; - } -} - -static gboolean -gst_mpeg_audio_parse_time_to_bytepos (GstMpegAudioParse * mp3parse, - GstClockTime ts, gint64 * bytepos) -{ - gint64 total_bytes; - GstClockTime total_time; - - /* If XING seek table exists use this for time->byte conversion */ - if ((mp3parse->xing_flags & XING_TOC_FLAG) && - (total_bytes = mp3parse->xing_bytes) && - (total_time = mp3parse->xing_total_time)) { - gdouble fa, fb, fx; - gdouble percent = - CLAMP ((100.0 * gst_util_guint64_to_gdouble (ts)) / - gst_util_guint64_to_gdouble (total_time), 0.0, 100.0); - gint index = CLAMP (percent, 0, 99); - - fa = mp3parse->xing_seek_table[index]; - if (index < 99) - fb = mp3parse->xing_seek_table[index + 1]; - else - fb = 256.0; - - fx = fa + (fb - fa) * (percent - index); - - *bytepos = (1.0 / 256.0) * fx * total_bytes; - - return TRUE; - } - - if (mp3parse->vbri_seek_table && (total_bytes = mp3parse->vbri_bytes) && - (total_time = mp3parse->vbri_total_time)) { - gint i, j; - gdouble a, b, fa, fb; - - i = gst_util_uint64_scale (ts, mp3parse->vbri_seek_points - 1, total_time); - i = CLAMP (i, 0, mp3parse->vbri_seek_points - 1); - - a = gst_guint64_to_gdouble (gst_util_uint64_scale (i, total_time, - mp3parse->vbri_seek_points)); - fa = 0.0; - for (j = i; j >= 0; j--) - fa += mp3parse->vbri_seek_table[j]; - - if (i + 1 < mp3parse->vbri_seek_points) { - b = gst_guint64_to_gdouble (gst_util_uint64_scale (i + 1, total_time, - mp3parse->vbri_seek_points)); - fb = fa + mp3parse->vbri_seek_table[i + 1]; - } else { - b = gst_guint64_to_gdouble (total_time); - fb = total_bytes; - } - - *bytepos = fa + ((fb - fa) / (b - a)) * (gst_guint64_to_gdouble (ts) - a); - - return TRUE; - } - - return FALSE; -} - -static gboolean -gst_mpeg_audio_parse_bytepos_to_time (GstMpegAudioParse * mp3parse, - gint64 bytepos, GstClockTime * ts) -{ - gint64 total_bytes; - GstClockTime total_time; - - /* If XING seek table exists use this for byte->time conversion */ - if ((mp3parse->xing_flags & XING_TOC_FLAG) && - (total_bytes = mp3parse->xing_bytes) && - (total_time = mp3parse->xing_total_time)) { - gdouble fa, fb, fx; - gdouble pos; - gint index; - - pos = CLAMP ((bytepos * 256.0) / total_bytes, 0.0, 256.0); - index = CLAMP (pos, 0, 255); - fa = mp3parse->xing_seek_table_inverse[index]; - if (index < 255) - fb = mp3parse->xing_seek_table_inverse[index + 1]; - else - fb = 10000.0; - - fx = fa + (fb - fa) * (pos - index); - - *ts = (1.0 / 10000.0) * fx * gst_util_guint64_to_gdouble (total_time); - - return TRUE; - } - - if (mp3parse->vbri_seek_table && - (total_bytes = mp3parse->vbri_bytes) && - (total_time = mp3parse->vbri_total_time)) { - gint i = 0; - guint64 sum = 0; - gdouble a, b, fa, fb; - - do { - sum += mp3parse->vbri_seek_table[i]; - i++; - } while (i + 1 < mp3parse->vbri_seek_points - && sum + mp3parse->vbri_seek_table[i] < bytepos); - i--; - - a = gst_guint64_to_gdouble (sum); - fa = gst_guint64_to_gdouble (gst_util_uint64_scale (i, total_time, - mp3parse->vbri_seek_points)); - - if (i + 1 < mp3parse->vbri_seek_points) { - b = a + mp3parse->vbri_seek_table[i + 1]; - fb = gst_guint64_to_gdouble (gst_util_uint64_scale (i + 1, total_time, - mp3parse->vbri_seek_points)); - } else { - b = total_bytes; - fb = gst_guint64_to_gdouble (total_time); - } - - *ts = gst_gdouble_to_guint64 (fa + ((fb - fa) / (b - a)) * (bytepos - a)); - - return TRUE; - } - - return FALSE; -} - -static gboolean -gst_mpeg_audio_parse_convert (GstBaseParse * parse, GstFormat src_format, - gint64 src_value, GstFormat dest_format, gint64 * dest_value) -{ - GstMpegAudioParse *mp3parse = GST_MPEG_AUDIO_PARSE (parse); - gboolean res = FALSE; - - if (src_format == GST_FORMAT_TIME && dest_format == GST_FORMAT_BYTES) - res = - gst_mpeg_audio_parse_time_to_bytepos (mp3parse, src_value, dest_value); - else if (src_format == GST_FORMAT_BYTES && dest_format == GST_FORMAT_TIME) - res = gst_mpeg_audio_parse_bytepos_to_time (mp3parse, src_value, - (GstClockTime *) dest_value); - - /* if no tables, fall back to default estimated rate based conversion */ - if (!res) - return gst_base_parse_convert_default (parse, src_format, src_value, - dest_format, dest_value); - - return res; -} - -static GstFlowReturn -gst_mpeg_audio_parse_pre_push_frame (GstBaseParse * parse, - GstBaseParseFrame * frame) -{ - GstMpegAudioParse *mp3parse = GST_MPEG_AUDIO_PARSE (parse); - GstTagList *taglist; - - /* tag sending done late enough in hook to ensure pending events - * have already been sent */ - - if (!mp3parse->sent_codec_tag) { - gchar *codec; - - /* codec tag */ - if (mp3parse->layer == 3) { - codec = g_strdup_printf ("MPEG %d Audio, Layer %d (MP3)", - mp3parse->version, mp3parse->layer); - } else { - codec = g_strdup_printf ("MPEG %d Audio, Layer %d", - mp3parse->version, mp3parse->layer); - } - taglist = gst_tag_list_new (); - gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, - GST_TAG_AUDIO_CODEC, codec, NULL); - if (mp3parse->hdr_bitrate > 0 && mp3parse->xing_bitrate == 0 && - mp3parse->vbri_bitrate == 0) { - /* We don't have a VBR bitrate, so post the available bitrate as - * nominal and let baseparse calculate the real bitrate */ - gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, - GST_TAG_NOMINAL_BITRATE, mp3parse->hdr_bitrate, NULL); - } - gst_element_found_tags_for_pad (GST_ELEMENT (mp3parse), - GST_BASE_PARSE_SRC_PAD (mp3parse), taglist); - g_free (codec); - - /* also signals the end of first-frame processing */ - mp3parse->sent_codec_tag = TRUE; - } - - /* we will create a taglist (if any of the parameters has changed) - * to add the tags that changed */ - taglist = NULL; - if (mp3parse->last_posted_crc != mp3parse->last_crc) { - gboolean using_crc; - - if (!taglist) { - taglist = gst_tag_list_new (); - } - mp3parse->last_posted_crc = mp3parse->last_crc; - if (mp3parse->last_posted_crc == CRC_PROTECTED) { - using_crc = TRUE; - } else { - using_crc = FALSE; - } - gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, GST_TAG_CRC, - using_crc, NULL); - } - - if (mp3parse->last_posted_channel_mode != mp3parse->last_mode) { - if (!taglist) { - taglist = gst_tag_list_new (); - } - mp3parse->last_posted_channel_mode = mp3parse->last_mode; - - gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, GST_TAG_MODE, - gst_mpeg_audio_channel_mode_get_nick (mp3parse->last_mode), NULL); - } - - /* if the taglist exists, we need to send it */ - if (taglist) { - gst_element_found_tags_for_pad (GST_ELEMENT (mp3parse), - GST_BASE_PARSE_SRC_PAD (mp3parse), taglist); - } - - /* usual clipping applies */ - frame->flags |= GST_BASE_PARSE_FRAME_FLAG_CLIP; - - return GST_FLOW_OK; -} diff --git a/gst/audioparsers/gstmpegaudioparse.h b/gst/audioparsers/gstmpegaudioparse.h deleted file mode 100644 index 3f680d1e53..0000000000 --- a/gst/audioparsers/gstmpegaudioparse.h +++ /dev/null @@ -1,107 +0,0 @@ -/* GStreamer MPEG audio parser - * Copyright (C) 2006-2007 Jan Schmidt - * Copyright (C) 2010 Mark Nauwelaerts - * Copyright (C) 2010 Nokia Corporation. All rights reserved. - * Contact: Stefan Kost - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GST_MPEG_AUDIO_PARSE_H__ -#define __GST_MPEG_AUDIO_PARSE_H__ - -#include -#include - -G_BEGIN_DECLS - -#define GST_TYPE_MPEG_AUDIO_PARSE \ - (gst_mpeg_audio_parse_get_type()) -#define GST_MPEG_AUDIO_PARSE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_MPEG_AUDIO_PARSE, GstMpegAudioParse)) -#define GST_MPEG_AUDIO_PARSE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_MPEG_AUDIO_PARSE, GstMpegAudioParseClass)) -#define GST_IS_MPEG_AUDIO_PARSE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_MPEG_AUDIO_PARSE)) -#define GST_IS_MPEG_AUDIO_PARSE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_MPEG_AUDIO_PARSE)) - -typedef struct _GstMpegAudioParse GstMpegAudioParse; -typedef struct _GstMpegAudioParseClass GstMpegAudioParseClass; - -/** - * GstMpegAudioParse: - * - * The opaque GstMpegAudioParse object - */ -struct _GstMpegAudioParse { - GstBaseParse baseparse; - - /*< private >*/ - gint rate; - gint channels; - gint layer; - gint version; - - GstClockTime max_bitreservoir; - /* samples per frame */ - gint spf; - - gboolean sent_codec_tag; - guint last_posted_bitrate; - gint last_posted_crc, last_crc; - guint last_posted_channel_mode, last_mode; - - /* Bitrate from non-vbr headers */ - guint32 hdr_bitrate; - - /* Xing info */ - guint32 xing_flags; - guint32 xing_frames; - GstClockTime xing_total_time; - guint32 xing_bytes; - /* percent -> filepos mapping */ - guchar xing_seek_table[100]; - /* filepos -> percent mapping */ - guint16 xing_seek_table_inverse[256]; - guint32 xing_vbr_scale; - guint xing_bitrate; - - /* VBRI info */ - guint32 vbri_frames; - GstClockTime vbri_total_time; - guint32 vbri_bytes; - guint vbri_bitrate; - guint vbri_seek_points; - guint32 *vbri_seek_table; - gboolean vbri_valid; -}; - -/** - * GstMpegAudioParseClass: - * @parent_class: Element parent class. - * - * The opaque GstMpegAudioParseClass data structure. - */ -struct _GstMpegAudioParseClass { - GstBaseParseClass baseparse_class; -}; - -GType gst_mpeg_audio_parse_get_type (void); - -G_END_DECLS - -#endif /* __GST_MPEG_AUDIO_PARSE_H__ */ diff --git a/gst/audioparsers/plugin.c b/gst/audioparsers/plugin.c deleted file mode 100644 index 5d532d706d..0000000000 --- a/gst/audioparsers/plugin.c +++ /dev/null @@ -1,57 +0,0 @@ -/* GStreamer audio parsers - * Copyright (C) 2009 Tim-Philipp Müller - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "gstaacparse.h" -#include "gstamrparse.h" -#include "gstac3parse.h" -#include "gstdcaparse.h" -#include "gstflacparse.h" -#include "gstmpegaudioparse.h" - -static gboolean -plugin_init (GstPlugin * plugin) -{ - gboolean ret; - - ret = gst_element_register (plugin, "aacparse", - GST_RANK_PRIMARY + 1, GST_TYPE_AACPARSE); - ret &= gst_element_register (plugin, "amrparse", - GST_RANK_PRIMARY + 1, GST_TYPE_AMRPARSE); - ret &= gst_element_register (plugin, "ac3parse", - GST_RANK_PRIMARY + 1, GST_TYPE_AC3_PARSE); - ret &= gst_element_register (plugin, "dcaparse", - GST_RANK_NONE, GST_TYPE_DCA_PARSE); - ret &= gst_element_register (plugin, "flacparse", - GST_RANK_PRIMARY + 1, GST_TYPE_FLAC_PARSE); - ret &= gst_element_register (plugin, "mpegaudioparse", - GST_RANK_PRIMARY + 2, GST_TYPE_MPEG_AUDIO_PARSE); - - return ret; -} - - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "audioparsersbad", - "audioparsers", - plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN); diff --git a/gst/audiovisualizers/Makefile.am b/gst/audiovisualizers/Makefile.am new file mode 100644 index 0000000000..811c7d831f --- /dev/null +++ b/gst/audiovisualizers/Makefile.am @@ -0,0 +1,36 @@ +plugin_LTLIBRARIES = libgstaudiovisualizers.la + +libgstaudiovisualizers_la_SOURCES = plugin.c \ + gstbaseaudiovisualizer.c gstbaseaudiovisualizer.h \ + gstspacescope.c gstspacescope.h \ + gstspectrascope.c gstspectrascope.h \ + gstsynaescope.c gstsynaescope.h \ + gstwavescope.c gstwavescope.h + +libgstaudiovisualizers_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) \ + $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) \ + $(GST_CONTROLLER_CFLAGS) $(GST_CFLAGS) +libgstaudiovisualizers_la_LIBADD = \ + $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) \ + -lgstvideo-$(GST_MAJORMINOR) -lgstfft-$(GST_MAJORMINOR) \ + $(GST_BASE_LIBS) $(GST_CONTROLLER_LIBS) $(GST_LIBS) $(LIBM) +libgstaudiovisualizers_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstaudiovisualizers_la_LIBTOOLFLAGS = --tag=disable-static + +noinst_HEADERS = gstbaseaudiovisualizer.h \ + gstspacescope.h gstspectrascope.h gstsynaescope.h gstwavescope.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT audiovisualizers -:SHARED audiovisualizers \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstaudiovisualizers_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstaudiovisualizers_la_CFLAGS) \ + -:LDFLAGS $(libgstaudiovisualizers_la_LDFLAGS) \ + $(libgstaudiovisualizers_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ + diff --git a/gst/audiovisualizers/README b/gst/audiovisualizers/README new file mode 100644 index 0000000000..0d0f08a245 --- /dev/null +++ b/gst/audiovisualizers/README @@ -0,0 +1,51 @@ +A basclass for audiovisualizers. Takes care of re-fitting the audio-rate to +video-rate. It receives audio-data at the sampling-rate. It needs to render +video-frames at frame-rate. The rendering needs n audio samples (depends on +subclass). The baseclass takes care of that. + += Feedback = +* put 'Audio' to klass as well ? + += API = + +* should we add some basic drawing helpers to the baseclass + draw_point (x,y,color); + draw_hline (x1,x2,y,color); + draw_vline (x,y1,y2,color); + draw_rect (x1,x2,y1,y2,color); + draw_box (x1,x2,y1,y2,color); // filled + - would be nice if we could use cairo +* shading effects + - would be nice to use a generic 3x3 matrix operation, we don't run inplace + anyway + - this way we could also blur the background + += Elements to port = +gst-plugin-ugly/gst/synaestesia -> synaescope +gst-plugin-good/gst/monoscope -> blend into what we have in wavescope + += Elements to add = +spectrascope - done +spacescope - stereo wavescope +- left->x, right->y - done +- polar mapping + += TODO = +- element maker template +- test for baseclass + += Test it = + +GST_DEBUG="*:2,*scope*:4" + +GST_PLUGIN_PATH=$GST_PLUGIN_PATH:$PWD gst-inspect scopes + +GST_PLUGIN_PATH=$GST_PLUGIN_PATH:$PWD gst-launch audiotestsrc ! audioconvert ! wavescope ! colorspace ! ximagesink +GST_PLUGIN_PATH=$GST_PLUGIN_PATH:$PWD gst-launch filesrc location=/home/ensonic/Musik/xotox-hypnocat.mp3 ! decodebin2 ! audioconvert ! wavescope ! colorspace ! ximagesink +GST_PLUGIN_PATH=$GST_PLUGIN_PATH:$PWD gst-launch filesrc location=/home/ensonic/Musik/xotox-hypnocat.mp3 ! decodebin2 ! audioconvert ! spectrascope ! colorspace ! ximagesink + +GST_PLUGIN_PATH=$GST_PLUGIN_PATH:$PWD gst-launch filesrc location=/home/ensonic/Musik/Gridlock/Trace/04\ Uh4.17.mp3 ! decodebin2 ! audioconvert ! spectrascope ! colorspace ! ximagesink +GST_PLUGIN_PATH=$GST_PLUGIN_PATH:$PWD gst-launch filesrc location=/home/ensonic/Musik/Gridlock/Trace/04\ Uh4.17.mp3 ! decodebin2 ! audioconvert ! spectrascope shader=fade-and-move-up shade-amount=0x00040302 ! colorspace ! ximagesink + +GST_PLUGIN_PATH=$GST_PLUGIN_PATH:$PWD gst-launch filesrc location=/home/ensonic/Musik/Gridlock/Trace/04\ Uh4.17.mp3 ! decodebin2 ! tee name=t ! queue ! audioconvert ! synaesthesia ! ximagesink t. ! queue ! synaescope shade-amount=0x00040404 ! colorspace ! ximagesink + diff --git a/gst/audiovisualizers/gstbaseaudiovisualizer.c b/gst/audiovisualizers/gstbaseaudiovisualizer.c new file mode 100644 index 0000000000..52fe5acd42 --- /dev/null +++ b/gst/audiovisualizers/gstbaseaudiovisualizer.c @@ -0,0 +1,813 @@ +/* GStreamer + * Copyright (C) <2011> Stefan Kost + * + * gstbaseaudiovisualizer.h: base class for audio visualisation elements + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +/** + * SECTION:gstbaseaudiovisualizer + * + * A basclass for scopes. It takes care of re-fitting the audio-rate to + * video-rate. It also provides several background shading effects. These + * effects are applied to a previous picture before the render() implementation + * can draw a new frame. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include +#include + +#include "gstbaseaudiovisualizer.h" + +GST_DEBUG_CATEGORY_STATIC (base_audio_visualizer_debug); +#define GST_CAT_DEFAULT (base_audio_visualizer_debug) + +#define DEFAULT_SHADER GST_BASE_AUDIO_VISUALIZER_SHADER_FADE +#define DEFAULT_SHADE_AMOUNT 0x000a0a0a + +enum +{ + PROP_0, + PROP_SHADER, + PROP_SHADE_AMOUNT +}; + +static GstBaseTransformClass *parent_class = NULL; + +static void gst_base_audio_visualizer_class_init (GstBaseAudioVisualizerClass * + klass); +static void gst_base_audio_visualizer_init (GstBaseAudioVisualizer * scope, + GstBaseAudioVisualizerClass * g_class); +static void gst_base_audio_visualizer_set_property (GObject * object, + guint prop_id, const GValue * value, GParamSpec * pspec); +static void gst_base_audio_visualizer_get_property (GObject * object, + guint prop_id, GValue * value, GParamSpec * pspec); +static void gst_base_audio_visualizer_dispose (GObject * object); + +static gboolean gst_base_audio_visualizer_src_negotiate (GstBaseAudioVisualizer + * scope); +static gboolean gst_base_audio_visualizer_src_setcaps (GstPad * pad, + GstCaps * caps); +static gboolean gst_base_audio_visualizer_sink_setcaps (GstPad * pad, + GstCaps * caps); + +static GstFlowReturn gst_base_audio_visualizer_chain (GstPad * pad, + GstBuffer * buffer); +static GstStateChangeReturn gst_base_audio_visualizer_change_state (GstElement * + element, GstStateChange transition); + +/* shading functions */ + +#define GST_TYPE_BASE_AUDIO_VISUALIZER_SHADER (gst_base_audio_visualizer_shader_get_type()) +static GType +gst_base_audio_visualizer_shader_get_type (void) +{ + static GType shader_type = 0; + static const GEnumValue shaders[] = { + {GST_BASE_AUDIO_VISUALIZER_SHADER_NONE, "None", "none"}, + {GST_BASE_AUDIO_VISUALIZER_SHADER_FADE, "Fade", "fade"}, + {GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP, "Fade and move up", + "fade-and-move-up"}, + {GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN, "Fade and move down", + "fade-and-move-down"}, + {GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT, + "Fade and move horizontaly out", + "fade-and-move-horiz-out"}, + {0, NULL, NULL}, + }; + + if (G_UNLIKELY (shader_type == 0)) { + shader_type = + g_enum_register_static ("GstBaseAudioVisualizerShader", shaders); + } + return shader_type; +} + +static void +shader_fade (GstBaseAudioVisualizer * scope, const guint8 * s, guint8 * d) +{ + guint i, bpf = scope->bpf; + guint r = (scope->shade_amount >> 16) & 0xff; + guint g = (scope->shade_amount >> 8) & 0xff; + guint b = (scope->shade_amount >> 0) & 0xff; + + /* we're only supporting GST_VIDEO_FORMAT_xRGB right now) */ +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + for (i = 0; i < bpf;) { + d[i] = (s[i] > b) ? s[i] - b : 0; + i++; + d[i] = (s[i] > g) ? s[i] - g : 0; + i++; + d[i] = (s[i] > r) ? s[i] - r : 0; + i++; + d[i++] = 0; + } +#else + for (i = 0; i < bpf;) { + d[i++] = 0; + d[i] = (s[i] > r) ? s[i] - r : 0; + i++; + d[i] = (s[i] > g) ? s[i] - g : 0; + i++; + d[i] = (s[i] > b) ? s[i] - b : 0; + i++; + } +#endif +} + +static void +shader_fade_and_move_up (GstBaseAudioVisualizer * scope, const guint8 * s, + guint8 * d) +{ + guint i, j, bpf = scope->bpf; + guint bpl = 4 * scope->width; + guint r = (scope->shade_amount >> 16) & 0xff; + guint g = (scope->shade_amount >> 8) & 0xff; + guint b = (scope->shade_amount >> 0) & 0xff; + +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + for (j = 0, i = bpl; i < bpf;) { + d[j++] = (s[i] > b) ? s[i] - b : 0; + i++; + d[j++] = (s[i] > g) ? s[i] - g : 0; + i++; + d[j++] = (s[i] > r) ? s[i] - r : 0; + i++; + d[j++] = 0; + i++; + } + for (i = 0; i < bpl; i += 4) { + d[j] = (s[j] > b) ? s[j] - b : 0; + j++; + d[j] = (s[j] > g) ? s[j] - g : 0; + j++; + d[j] = (s[j] > r) ? s[j] - r : 0; + j++; + d[j++] = 0; + } +#else + for (j = 0, i = bpl; i < bpf;) { + d[j++] = 0; + i++; + d[j++] = (s[i] > r) ? s[i] - r : 0; + i++; + d[j++] = (s[i] > g) ? s[i] - g : 0; + i++; + d[j++] = (s[i] > b) ? s[i] - b : 0; + i++; + } + for (i = 0; i < bpl; i += 4) { + d[j++] = 0; + d[j] = (s[j] > r) ? s[j] - r : 0; + j++; + d[j] = (s[j] > g) ? s[j] - g : 0; + j++; + d[j] = (s[j] > b) ? s[j] - b : 0; + j++; + } +#endif +} + +static void +shader_fade_and_move_down (GstBaseAudioVisualizer * scope, const guint8 * s, + guint8 * d) +{ + guint i, j, bpf = scope->bpf; + guint bpl = 4 * scope->width; + guint r = (scope->shade_amount >> 16) & 0xff; + guint g = (scope->shade_amount >> 8) & 0xff; + guint b = (scope->shade_amount >> 0) & 0xff; + +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + for (i = 0; i < bpl;) { + d[i] = (s[i] > b) ? s[i] - b : 0; + i++; + d[i] = (s[i] > g) ? s[i] - g : 0; + i++; + d[i] = (s[i] > r) ? s[i] - r : 0; + i++; + d[i++] = 0; + } + for (j = bpl, i = 0; j < bpf;) { + d[j++] = (s[i] > b) ? s[i] - b : 0; + i++; + d[j++] = (s[i] > g) ? s[i] - g : 0; + i++; + d[j++] = (s[i] > r) ? s[i] - r : 0; + i++; + d[j++] = 0; + i++; + } +#else + for (i = 0; i < bpl;) { + d[i++] = 0; + d[i] = (s[i] > r) ? s[i] - r : 0; + i++; + d[i] = (s[i] > g) ? s[i] - g : 0; + i++; + d[i] = (s[i] > b) ? s[i] - b : 0; + i++; + } + for (j = bpl, i = 0; j < bpf;) { + d[j++] = 0; + i++; + d[j++] = (s[i] > r) ? s[i] - r : 0; + i++; + d[j++] = (s[i] > g) ? s[i] - g : 0; + i++; + d[j++] = (s[i] > b) ? s[i] - b : 0; + i++; + } +#endif +} + +static void +shader_fade_and_move_horiz_out (GstBaseAudioVisualizer * scope, + const guint8 * s, guint8 * d) +{ + guint i, j, bpf = scope->bpf / 2; + guint bpl = 4 * scope->width; + guint r = (scope->shade_amount >> 16) & 0xff; + guint g = (scope->shade_amount >> 8) & 0xff; + guint b = (scope->shade_amount >> 0) & 0xff; + +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + /* middle up */ + for (j = 0, i = bpl; i < bpf;) { + d[j++] = (s[i] > b) ? s[i] - b : 0; + i++; + d[j++] = (s[i] > g) ? s[i] - g : 0; + i++; + d[j++] = (s[i] > r) ? s[i] - r : 0; + i++; + d[j++] = 0; + i++; + } + for (i = 0; i < bpl; i += 4) { + d[j] = (s[j] > b) ? s[j] - b : 0; + j++; + d[j] = (s[j] > g) ? s[j] - g : 0; + j++; + d[j] = (s[j] > r) ? s[j] - r : 0; + j++; + d[j++] = 0; + } + /* middle down */ + for (i = bpf; i < bpf + bpl;) { + d[i] = (s[i] > b) ? s[i] - b : 0; + i++; + d[i] = (s[i] > g) ? s[i] - g : 0; + i++; + d[i] = (s[i] > r) ? s[i] - r : 0; + i++; + d[i++] = 0; + } + for (j = bpf + bpl, i = bpf; j < bpf + bpf;) { + d[j++] = (s[i] > b) ? s[i] - b : 0; + i++; + d[j++] = (s[i] > g) ? s[i] - g : 0; + i++; + d[j++] = (s[i] > r) ? s[i] - r : 0; + i++; + d[j++] = 0; + i++; + } +#else + /* middle up */ + for (j = 0, i = bpl; i < bpf;) { + d[j++] = 0; + i++; + d[j++] = (s[i] > r) ? s[i] - r : 0; + i++; + d[j++] = (s[i] > g) ? s[i] - g : 0; + i++; + d[j++] = (s[i] > b) ? s[i] - b : 0; + i++; + } + for (i = 0; i < bpl; i += 4) { + d[j++] = 0; + d[j] = (s[j] > r) ? s[j] - r : 0; + j++; + d[j] = (s[j] > g) ? s[j] - g : 0; + j++; + d[j] = (s[j] > b) ? s[j] - b : 0; + j++; + } + /* middle down */ + for (i = bpf; i < bpf + bpl;) { + d[i++] = 0; + d[i] = (s[i] > r) ? s[i] - r : 0; + i++; + d[i] = (s[i] > g) ? s[i] - g : 0; + i++; + d[i] = (s[i] > b) ? s[i] - b : 0; + i++; + } + for (j = bpf + bpl, i = bpf; j < bpf + bpf;) { + d[j++] = 0; + i++; + d[j++] = (s[i] > r) ? s[i] - r : 0; + i++; + d[j++] = (s[i] > g) ? s[i] - g : 0; + i++; + d[j++] = (s[i] > b) ? s[i] - b : 0; + i++; + } +#endif +} + + +static void +gst_base_audio_visualizer_change_shader (GstBaseAudioVisualizer * scope) +{ + switch (scope->shader_type) { + case GST_BASE_AUDIO_VISUALIZER_SHADER_NONE: + scope->shader = NULL; + break; + case GST_BASE_AUDIO_VISUALIZER_SHADER_FADE: + scope->shader = shader_fade; + break; + case GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP: + scope->shader = shader_fade_and_move_up; + break; + case GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN: + scope->shader = shader_fade_and_move_down; + break; + case GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT: + scope->shader = shader_fade_and_move_horiz_out; + break; + default: + GST_ERROR ("invalid shader function"); + scope->shader = NULL; + break; + } +} + +/* base class */ + +GType +gst_base_audio_visualizer_get_type (void) +{ + static volatile gsize base_audio_visualizer_type = 0; + + if (g_once_init_enter (&base_audio_visualizer_type)) { + static const GTypeInfo base_audio_visualizer_info = { + sizeof (GstBaseAudioVisualizerClass), + NULL, + NULL, + (GClassInitFunc) gst_base_audio_visualizer_class_init, + NULL, + NULL, + sizeof (GstBaseAudioVisualizer), + 0, + (GInstanceInitFunc) gst_base_audio_visualizer_init, + }; + GType _type; + + _type = g_type_register_static (GST_TYPE_ELEMENT, + "GstBaseAudioVisualizer", &base_audio_visualizer_info, + G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&base_audio_visualizer_type, _type); + } + return (GType) base_audio_visualizer_type; +} + +static void +gst_base_audio_visualizer_class_init (GstBaseAudioVisualizerClass * klass) +{ + GObjectClass *gobject_class = (GObjectClass *) klass; + GstElementClass *element_class = (GstElementClass *) klass; + + parent_class = g_type_class_peek_parent (klass); + + GST_DEBUG_CATEGORY_INIT (base_audio_visualizer_debug, "baseaudiovisualizer", + 0, "scope audio visualisation base class"); + + gobject_class->set_property = gst_base_audio_visualizer_set_property; + gobject_class->get_property = gst_base_audio_visualizer_get_property; + gobject_class->dispose = gst_base_audio_visualizer_dispose; + + element_class->change_state = + GST_DEBUG_FUNCPTR (gst_base_audio_visualizer_change_state); + + g_object_class_install_property (gobject_class, PROP_SHADER, + g_param_spec_enum ("shader", "shader type", + "Shader function to apply on each frame", + GST_TYPE_BASE_AUDIO_VISUALIZER_SHADER, DEFAULT_SHADER, + G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (gobject_class, PROP_SHADE_AMOUNT, + g_param_spec_uint ("shade-amount", "shade amount", + "Shading color to use (big-endian ARGB)", 0, G_MAXUINT32, + DEFAULT_SHADE_AMOUNT, + G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS)); +} + +static void +gst_base_audio_visualizer_init (GstBaseAudioVisualizer * scope, + GstBaseAudioVisualizerClass * g_class) +{ + GstPadTemplate *pad_template; + + /* create the sink and src pads */ + pad_template = + gst_element_class_get_pad_template (GST_ELEMENT_CLASS (g_class), "sink"); + g_return_if_fail (pad_template != NULL); + scope->sinkpad = gst_pad_new_from_template (pad_template, "sink"); + gst_pad_set_chain_function (scope->sinkpad, + GST_DEBUG_FUNCPTR (gst_base_audio_visualizer_chain)); + gst_pad_set_setcaps_function (scope->sinkpad, + GST_DEBUG_FUNCPTR (gst_base_audio_visualizer_sink_setcaps)); + gst_element_add_pad (GST_ELEMENT (scope), scope->sinkpad); + + pad_template = + gst_element_class_get_pad_template (GST_ELEMENT_CLASS (g_class), "src"); + g_return_if_fail (pad_template != NULL); + scope->srcpad = gst_pad_new_from_template (pad_template, "src"); + gst_pad_set_setcaps_function (scope->srcpad, + GST_DEBUG_FUNCPTR (gst_base_audio_visualizer_src_setcaps)); + gst_element_add_pad (GST_ELEMENT (scope), scope->srcpad); + + scope->adapter = gst_adapter_new (); + scope->inbuf = gst_buffer_new (); + + /* properties */ + scope->shader_type = DEFAULT_SHADER; + gst_base_audio_visualizer_change_shader (scope); + scope->shade_amount = DEFAULT_SHADE_AMOUNT; + + /* reset the initial video state */ + scope->width = 320; + scope->height = 200; + scope->fps_n = 25; /* desired frame rate */ + scope->fps_d = 1; + scope->frame_duration = GST_CLOCK_TIME_NONE; + + /* reset the initial audio state */ + scope->rate = GST_AUDIO_DEF_RATE; + scope->channels = 2; + + scope->next_ts = GST_CLOCK_TIME_NONE; + +} + +static void +gst_base_audio_visualizer_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) +{ + GstBaseAudioVisualizer *scope = GST_BASE_AUDIO_VISUALIZER (object); + + switch (prop_id) { + case PROP_SHADER: + scope->shader_type = g_value_get_enum (value); + gst_base_audio_visualizer_change_shader (scope); + break; + case PROP_SHADE_AMOUNT: + scope->shade_amount = g_value_get_uint (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gst_base_audio_visualizer_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec) +{ + GstBaseAudioVisualizer *scope = GST_BASE_AUDIO_VISUALIZER (object); + + switch (prop_id) { + case PROP_SHADER: + g_value_set_enum (value, scope->shader_type); + break; + case PROP_SHADE_AMOUNT: + g_value_set_uint (value, scope->shade_amount); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gst_base_audio_visualizer_dispose (GObject * object) +{ + GstBaseAudioVisualizer *scope = GST_BASE_AUDIO_VISUALIZER (object); + + if (scope->adapter) { + g_object_unref (scope->adapter); + scope->adapter = NULL; + } + if (scope->inbuf) { + gst_buffer_unref (scope->inbuf); + scope->inbuf = NULL; + } + if (scope->pixelbuf) { + g_free (scope->pixelbuf); + scope->pixelbuf = NULL; + } + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +static gboolean +gst_base_audio_visualizer_sink_setcaps (GstPad * pad, GstCaps * caps) +{ + GstBaseAudioVisualizer *scope; + GstStructure *structure; + gint channels; + gint rate; + gboolean res = TRUE; + + scope = GST_BASE_AUDIO_VISUALIZER (gst_pad_get_parent (pad)); + structure = gst_caps_get_structure (caps, 0); + + if (!gst_structure_get_int (structure, "channels", &channels) || + !gst_structure_get_int (structure, "rate", &rate)) + goto missing_caps_details; + + if (channels != 2) + goto wrong_channels; + + if (rate <= 0) + goto wrong_rate; + + scope->channels = channels; + scope->rate = rate; + + GST_DEBUG_OBJECT (scope, "audio: channels %d, rate %d", + scope->channels, scope->rate); + +done: + gst_object_unref (scope); + return res; + + /* Errors */ +missing_caps_details: + { + GST_WARNING_OBJECT (scope, "missing channels or rate in the caps"); + res = FALSE; + goto done; + } +wrong_channels: + { + GST_WARNING_OBJECT (scope, "number of channels must be 2, but is %d", + channels); + res = FALSE; + goto done; + } +wrong_rate: + { + GST_WARNING_OBJECT (scope, "sample rate must be >0, but is %d", rate); + res = FALSE; + goto done; + } +} + +static gboolean +gst_base_audio_visualizer_src_negotiate (GstBaseAudioVisualizer * scope) +{ + GstCaps *othercaps, *target, *intersect; + GstStructure *structure; + const GstCaps *templ; + + templ = gst_pad_get_pad_template_caps (scope->srcpad); + + GST_DEBUG_OBJECT (scope, "performing negotiation"); + + /* see what the peer can do */ + othercaps = gst_pad_peer_get_caps (scope->srcpad); + if (othercaps) { + intersect = gst_caps_intersect (othercaps, templ); + gst_caps_unref (othercaps); + + if (gst_caps_is_empty (intersect)) + goto no_format; + + target = gst_caps_copy_nth (intersect, 0); + gst_caps_unref (intersect); + } else { + target = gst_caps_ref ((GstCaps *) templ); + } + + structure = gst_caps_get_structure (target, 0); + gst_structure_fixate_field_nearest_int (structure, "width", scope->width); + gst_structure_fixate_field_nearest_int (structure, "height", scope->height); + gst_structure_fixate_field_nearest_fraction (structure, "framerate", + scope->fps_n, scope->fps_d); + + GST_DEBUG_OBJECT (scope, "final caps are %" GST_PTR_FORMAT, target); + + gst_pad_set_caps (scope->srcpad, target); + gst_caps_unref (target); + + return TRUE; + +no_format: + { + gst_caps_unref (intersect); + return FALSE; + } +} + +static gboolean +gst_base_audio_visualizer_src_setcaps (GstPad * pad, GstCaps * caps) +{ + GstBaseAudioVisualizer *scope; + GstBaseAudioVisualizerClass *klass; + gint w, h; + gint num, denom; + GstVideoFormat format; + gboolean res = TRUE; + + scope = GST_BASE_AUDIO_VISUALIZER (gst_pad_get_parent (pad)); + klass = GST_BASE_AUDIO_VISUALIZER_CLASS (G_OBJECT_GET_CLASS (scope)); + + if (!gst_video_format_parse_caps (caps, &format, &w, &h)) { + goto missing_caps_details; + } + if (!gst_video_parse_caps_framerate (caps, &num, &denom)) { + goto missing_caps_details; + } + + scope->width = w; + scope->height = h; + scope->fps_n = num; + scope->fps_d = denom; + scope->video_format = format; + + scope->frame_duration = gst_util_uint64_scale_int (GST_SECOND, + scope->fps_d, scope->fps_n); + scope->spf = gst_util_uint64_scale_int (scope->rate, + scope->fps_d, scope->fps_n); + scope->req_spf = scope->spf; + + scope->bpf = w * h * 4; + + if (scope->pixelbuf) + g_free (scope->pixelbuf); + scope->pixelbuf = g_malloc0 (scope->bpf); + + if (klass->setup) + res = klass->setup (scope); + + GST_DEBUG_OBJECT (scope, "video: dimension %dx%d, framerate %d/%d", + scope->width, scope->height, scope->fps_n, scope->fps_d); + GST_DEBUG_OBJECT (scope, "blocks: spf %u, req_spf %u", + scope->spf, scope->req_spf); +done: + gst_object_unref (scope); + return res; + + /* Errors */ +missing_caps_details: + { + GST_WARNING_OBJECT (scope, + "missing width, height or framerate in the caps"); + res = FALSE; + goto done; + } +} + +static GstFlowReturn +gst_base_audio_visualizer_chain (GstPad * pad, GstBuffer * buffer) +{ + GstFlowReturn ret = GST_FLOW_OK; + GstBaseAudioVisualizer *scope; + GstBaseAudioVisualizerClass *klass; + GstBuffer *inbuf; + guint avail, sbpf; + gboolean (*render) (GstBaseAudioVisualizer * scope, GstBuffer * audio, + GstBuffer * video); + + scope = GST_BASE_AUDIO_VISUALIZER (gst_pad_get_parent (pad)); + klass = GST_BASE_AUDIO_VISUALIZER_CLASS (G_OBJECT_GET_CLASS (scope)); + + render = klass->render; + + GST_LOG_OBJECT (scope, "chainfunc called"); + + /* resync on DISCONT */ + if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)) { + scope->next_ts = GST_CLOCK_TIME_NONE; + gst_adapter_clear (scope->adapter); + } + + if (GST_PAD_CAPS (scope->srcpad) == NULL) { + if (!gst_base_audio_visualizer_src_negotiate (scope)) + return GST_FLOW_NOT_NEGOTIATED; + } + + /* Match timestamps from the incoming audio */ + if (GST_BUFFER_TIMESTAMP (buffer) != GST_CLOCK_TIME_NONE) + scope->next_ts = GST_BUFFER_TIMESTAMP (buffer); + + gst_adapter_push (scope->adapter, buffer); + + /* this is what we want */ + sbpf = scope->req_spf * scope->channels * sizeof (gint16); + + inbuf = scope->inbuf; + /* FIXME: the timestamp in the adapter would be different */ + gst_buffer_copy_metadata (inbuf, buffer, GST_BUFFER_COPY_ALL); + + /* this is what we have */ + avail = gst_adapter_available (scope->adapter); + GST_LOG_OBJECT (scope, "avail: %u, bpf: %u", avail, sbpf); + while (avail >= sbpf) { + GstBuffer *outbuf; + + ret = gst_pad_alloc_buffer_and_set_caps (scope->srcpad, + GST_BUFFER_OFFSET_NONE, + scope->bpf, GST_PAD_CAPS (scope->srcpad), &outbuf); + + /* no buffer allocated, we don't care why. */ + if (ret != GST_FLOW_OK) + break; + + /* sync controlled properties */ + gst_object_sync_values (G_OBJECT (scope), scope->next_ts); + + GST_BUFFER_TIMESTAMP (outbuf) = scope->next_ts; + GST_BUFFER_DURATION (outbuf) = scope->frame_duration; + if (scope->shader) { + memcpy (GST_BUFFER_DATA (outbuf), scope->pixelbuf, scope->bpf); + } else { + memset (GST_BUFFER_DATA (outbuf), 0, scope->bpf); + } + + GST_BUFFER_DATA (inbuf) = + (guint8 *) gst_adapter_peek (scope->adapter, sbpf); + GST_BUFFER_SIZE (inbuf) = sbpf; + + /* call class->render() vmethod */ + if (render) { + if (!render (scope, inbuf, outbuf)) { + ret = GST_FLOW_ERROR; + } else { + /* run various post processing (shading and geometri transformation */ + if (scope->shader) { + scope->shader (scope, GST_BUFFER_DATA (outbuf), scope->pixelbuf); + } + } + } + + ret = gst_pad_push (scope->srcpad, outbuf); + outbuf = NULL; + + GST_LOG_OBJECT (scope, "avail: %u, bpf: %u", avail, sbpf); + /* we want to take less or more, depending on spf : req_spf */ + if (avail - sbpf >= sbpf) { + gst_adapter_flush (scope->adapter, sbpf); + } else if (avail - sbpf >= 0) { + /* just flush a bit and stop */ + gst_adapter_flush (scope->adapter, (avail - sbpf)); + break; + } + avail = gst_adapter_available (scope->adapter); + + if (ret != GST_FLOW_OK) + break; + + if (scope->next_ts != GST_CLOCK_TIME_NONE) + scope->next_ts += scope->frame_duration; + } + + gst_object_unref (scope); + + return ret; +} + +static GstStateChangeReturn +gst_base_audio_visualizer_change_state (GstElement * element, + GstStateChange transition) +{ + GstBaseAudioVisualizer *scope; + + scope = GST_BASE_AUDIO_VISUALIZER (element); + + switch (transition) { + case GST_STATE_CHANGE_READY_TO_PAUSED: + scope->next_ts = GST_CLOCK_TIME_NONE; + gst_adapter_clear (scope->adapter); + break; + default: + break; + } + + return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); +} diff --git a/gst/audiovisualizers/gstbaseaudiovisualizer.h b/gst/audiovisualizers/gstbaseaudiovisualizer.h new file mode 100644 index 0000000000..e2119b6114 --- /dev/null +++ b/gst/audiovisualizers/gstbaseaudiovisualizer.h @@ -0,0 +1,108 @@ +/* GStreamer + * Copyright (C) <2011> Stefan Kost + * + * gstbaseaudiovisualizer.c: base class for audio visualisation elements + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __GST_BASE_AUDIO_VISUALIZER_H__ +#define __GST_BASE_AUDIO_VISUALIZER_H__ + +#include +#include + +#include +#include +#include + +G_BEGIN_DECLS +#define GST_TYPE_BASE_AUDIO_VISUALIZER (gst_base_audio_visualizer_get_type()) +#define GST_BASE_AUDIO_VISUALIZER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_AUDIO_VISUALIZER,GstBaseAudioVisualizer)) +#define GST_BASE_AUDIO_VISUALIZER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_AUDIO_VISUALIZER,GstBaseAudioVisualizerClass)) +#define GST_IS_SYNAESTHESIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_AUDIO_VISUALIZER)) +#define GST_IS_SYNAESTHESIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_AUDIO_VISUALIZER)) +typedef struct _GstBaseAudioVisualizer GstBaseAudioVisualizer; +typedef struct _GstBaseAudioVisualizerClass GstBaseAudioVisualizerClass; + +typedef void (*GstBaseAudioVisualizerShaderFunc)(GstBaseAudioVisualizer *scope, const guint8 *s, guint8 *d); + +/** + * GstBaseAudioVisualizerShader: + * @GST_BASE_AUDIO_VISUALIZER_SHADER_NONE: no shading + * @GST_BASE_AUDIO_VISUALIZER_SHADER_FADE: plain fading + * @GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP: fade and move up + * @GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN: fade and move down + * @GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT: fade and move horizontaly out + * + * Different types of supported background shading functions. + */ +typedef enum { + GST_BASE_AUDIO_VISUALIZER_SHADER_NONE, + GST_BASE_AUDIO_VISUALIZER_SHADER_FADE, + GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP, + GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN, + GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT +} GstBaseAudioVisualizerShader; + +struct _GstBaseAudioVisualizer +{ + GstElement parent; + + /* pads */ + GstPad *srcpad, *sinkpad; + + GstAdapter *adapter; + GstBuffer *inbuf; + guint8 *pixelbuf; + + GstBaseAudioVisualizerShader shader_type; + GstBaseAudioVisualizerShaderFunc shader; + guint32 shade_amount; + + guint64 next_ts; /* the timestamp of the next frame */ + guint64 frame_duration; + guint bpf; /* bytes per frame */ + guint bps; /* bytes per sample */ + guint spf; /* samples per video frame */ + guint req_spf; /* min samples per frame wanted by the subclass */ + + /* video state */ + GstVideoFormat video_format; + gint fps_n, fps_d; + gint width; + gint height; + gint channels; + + /* audio state */ + gint sample_rate; + gint rate; +}; + +struct _GstBaseAudioVisualizerClass +{ + GstElementClass parent_class; + + /* virtual function, called whenever the format changes */ + gboolean (*setup) (GstBaseAudioVisualizer * scope); + + /* virtual function for rendering a frame */ + gboolean (*render) (GstBaseAudioVisualizer * scope, GstBuffer * audio, GstBuffer * video); +}; + +GType gst_base_audio_visualizer_get_type (void); + +G_END_DECLS +#endif /* __GST_BASE_AUDIO_VISUALIZER_H__ */ diff --git a/gst/audiovisualizers/gstspacescope.c b/gst/audiovisualizers/gstspacescope.c new file mode 100644 index 0000000000..fe8169dc46 --- /dev/null +++ b/gst/audiovisualizers/gstspacescope.c @@ -0,0 +1,129 @@ +/* GStreamer + * Copyright (C) <2011> Stefan Kost + * + * gstspacescope.c: simple stereo visualizer + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +/** + * SECTION:element-spacescope + * @see_also: goom + * + * Spacescope is a simple audio visualisation element. It maps the left and + * right channel to x and y coordinates. + * + * + * Example launch line + * |[ + * gst-launch audiotestsrc ! audioconvert ! spacescope ! ximagesink + * ]| + * + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "gstspacescope.h" + +static GstStaticPadTemplate gst_space_scope_src_template = +GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN) + ); + +static GstStaticPadTemplate gst_space_scope_sink_template = +GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS) + ); + + +GST_DEBUG_CATEGORY_STATIC (space_scope_debug); +#define GST_CAT_DEFAULT space_scope_debug + +static gboolean gst_space_scope_render (GstBaseAudioVisualizer * scope, + GstBuffer * audio, GstBuffer * video); + + +GST_BOILERPLATE (GstSpaceScope, gst_space_scope, GstBaseAudioVisualizer, + GST_TYPE_BASE_AUDIO_VISUALIZER); + +static void +gst_space_scope_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_set_details_simple (element_class, "Stereo visualizer", + "Visualization", + "Simple stereo visualizer", "Stefan Kost "); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_space_scope_src_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_space_scope_sink_template)); +} + +static void +gst_space_scope_class_init (GstSpaceScopeClass * g_class) +{ + GstBaseAudioVisualizerClass *scope_class = + (GstBaseAudioVisualizerClass *) g_class; + + scope_class->render = GST_DEBUG_FUNCPTR (gst_space_scope_render); +} + +static void +gst_space_scope_init (GstSpaceScope * scope, GstSpaceScopeClass * g_class) +{ + /* do nothing */ +} + +static gboolean +gst_space_scope_render (GstBaseAudioVisualizer * scope, GstBuffer * audio, + GstBuffer * video) +{ + guint32 *vdata = (guint32 *) GST_BUFFER_DATA (video); + gint16 *adata = (gint16 *) GST_BUFFER_DATA (audio); + guint i, s, x, y, off, ox, oy; + guint num_samples; + gfloat dx, dy; + guint w = scope->width; + + /* draw dots 1st channel x, 2nd channel y */ + num_samples = GST_BUFFER_SIZE (audio) / (scope->channels * sizeof (gint16)); + dx = scope->width / 65536.0; + ox = scope->width / 2; + dy = scope->height / 65536.0; + oy = scope->height / 2; + s = 0; + for (i = 0; i < num_samples; i++) { + x = (guint) (ox + (gfloat) adata[s++] * dx); + y = (guint) (oy + (gfloat) adata[s++] * dy); + off = (y * w) + x; + vdata[off] = 0x00FFFFFF; + } + return TRUE; +} + +gboolean +gst_space_scope_plugin_init (GstPlugin * plugin) +{ + GST_DEBUG_CATEGORY_INIT (space_scope_debug, "spacescope", 0, "spacescope"); + + return gst_element_register (plugin, "spacescope", GST_RANK_NONE, + GST_TYPE_SPACE_SCOPE); +} diff --git a/gst/audiovisualizers/gstspacescope.h b/gst/audiovisualizers/gstspacescope.h new file mode 100644 index 0000000000..0beae5a1f7 --- /dev/null +++ b/gst/audiovisualizers/gstspacescope.h @@ -0,0 +1,50 @@ +/* GStreamer + * Copyright (C) <2011> Stefan Kost + * + * gstspacescope.h: simple stereo visualizer + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +#ifndef __GST_SPACE_SCOPE_H__ +#define __GST_SPACE_SCOPE_H__ + +#include "gstbaseaudiovisualizer.h" + +G_BEGIN_DECLS +#define GST_TYPE_SPACE_SCOPE (gst_space_scope_get_type()) +#define GST_SPACE_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SPACE_SCOPE,GstSpaceScope)) +#define GST_SPACE_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SPACE_SCOPE,GstSpaceScopeClass)) +#define GST_IS_SPACE_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SPACE_SCOPE)) +#define GST_IS_SPACE_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SPACE_SCOPE)) +typedef struct _GstSpaceScope GstSpaceScope; +typedef struct _GstSpaceScopeClass GstSpaceScopeClass; + +struct _GstSpaceScope +{ + GstBaseAudioVisualizer parent; +}; + +struct _GstSpaceScopeClass +{ + GstBaseAudioVisualizerClass parent_class; +}; + +GType gst_space_scope_get_type (void); +gboolean gst_space_scope_plugin_init (GstPlugin * plugin); + +G_END_DECLS +#endif /* __GST_SPACE_SCOPE_H__ */ \ No newline at end of file diff --git a/gst/audiovisualizers/gstspectrascope.c b/gst/audiovisualizers/gstspectrascope.c new file mode 100644 index 0000000000..9ab5419833 --- /dev/null +++ b/gst/audiovisualizers/gstspectrascope.c @@ -0,0 +1,222 @@ +/* GStreamer + * Copyright (C) <2011> Stefan Kost + * + * gstspectrascope.c: frequency spectrum scope + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +/** + * SECTION:element-spectrascope + * @see_also: goom + * + * Spectrascope is a simple spectrum visualisation element. It renders the + * frequency spectrum as a series of bars. + * + * + * Example launch line + * |[ + * gst-launch audiotestsrc ! audioconvert ! spectrascope ! ximagesink + * ]| + * + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include + +#include "gstspectrascope.h" + +static GstStaticPadTemplate gst_spectra_scope_src_template = +GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN) + ); + +static GstStaticPadTemplate gst_spectra_scope_sink_template = +GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS) + ); + + +GST_DEBUG_CATEGORY_STATIC (spectra_scope_debug); +#define GST_CAT_DEFAULT spectra_scope_debug + +static void gst_spectra_scope_finalize (GObject * object); + +static gboolean gst_spectra_scope_setup (GstBaseAudioVisualizer * scope); +static gboolean gst_spectra_scope_render (GstBaseAudioVisualizer * scope, + GstBuffer * audio, GstBuffer * video); + + +GST_BOILERPLATE (GstSpectraScope, gst_spectra_scope, GstBaseAudioVisualizer, + GST_TYPE_BASE_AUDIO_VISUALIZER); + +static void +gst_spectra_scope_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_set_details_simple (element_class, + "Frequency spectrum scope", "Visualization", + "Simple frequency spectrum scope", "Stefan Kost "); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_spectra_scope_src_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_spectra_scope_sink_template)); +} + +static void +gst_spectra_scope_class_init (GstSpectraScopeClass * g_class) +{ + GObjectClass *gobject_class = (GObjectClass *) g_class; + GstBaseAudioVisualizerClass *scope_class = + (GstBaseAudioVisualizerClass *) g_class; + + gobject_class->finalize = gst_spectra_scope_finalize; + + scope_class->setup = GST_DEBUG_FUNCPTR (gst_spectra_scope_setup); + scope_class->render = GST_DEBUG_FUNCPTR (gst_spectra_scope_render); +} + +static void +gst_spectra_scope_init (GstSpectraScope * scope, GstSpectraScopeClass * g_class) +{ + /* do nothing */ +} + +static void +gst_spectra_scope_finalize (GObject * object) +{ + GstSpectraScope *scope = GST_SPECTRA_SCOPE (object); + + if (scope->fft_ctx) { + gst_fft_s16_free (scope->fft_ctx); + scope->fft_ctx = NULL; + } + if (scope->freq_data) { + g_free (scope->freq_data); + scope->freq_data = NULL; + } + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static gboolean +gst_spectra_scope_setup (GstBaseAudioVisualizer * bscope) +{ + GstSpectraScope *scope = GST_SPECTRA_SCOPE (bscope); + guint num_freq = bscope->width + 1; + + if (scope->fft_ctx) + gst_fft_s16_free (scope->fft_ctx); + g_free (scope->freq_data); + + /* we'd need this amount of samples per render() call */ + bscope->req_spf = num_freq * 2 - 2; + scope->fft_ctx = gst_fft_s16_new (bscope->req_spf, FALSE); + scope->freq_data = g_new (GstFFTS16Complex, num_freq); + + return TRUE; +} + +static inline void +add_pixel (guint32 * _p, guint32 _c) +{ + guint8 *p = (guint8 *) _p; + guint8 *c = (guint8 *) & _c; + + if (p[0] < 255 - c[0]) + p[0] += c[0]; + else + p[0] = 255; + if (p[1] < 255 - c[1]) + p[1] += c[1]; + else + p[1] = 255; + if (p[2] < 255 - c[2]) + p[2] += c[2]; + else + p[2] = 255; + if (p[3] < 255 - c[3]) + p[3] += c[3]; + else + p[3] = 255; +} + +static gboolean +gst_spectra_scope_render (GstBaseAudioVisualizer * bscope, GstBuffer * audio, + GstBuffer * video) +{ + GstSpectraScope *scope = GST_SPECTRA_SCOPE (bscope); + guint32 *vdata = (guint32 *) GST_BUFFER_DATA (video); + gint16 *adata = (gint16 *) GST_BUFFER_DATA (audio); + GstFFTS16Complex *fdata = scope->freq_data; + guint x, y, off; + guint l, h = bscope->height - 1; + gfloat fr, fi; + guint w = bscope->width; + + if (bscope->channels > 1) { + guint ch = bscope->channels; + guint num_samples = GST_BUFFER_SIZE (audio) / (ch * sizeof (gint16)); + guint i, c, v, s = 0; + + /* deinterleave and mixdown adata */ + for (i = 0; i < num_samples; i++) { + v = 0; + for (c = 0; c < ch; c++) { + v += adata[s++]; + } + adata[i] = v / ch; + } + } + + /* run fft */ + gst_fft_s16_window (scope->fft_ctx, adata, GST_FFT_WINDOW_HAMMING); + gst_fft_s16_fft (scope->fft_ctx, adata, fdata); + + /* draw lines */ + for (x = 0; x < bscope->width; x++) { + /* figure out the range so that we don't need to clip, + * or even better do a log mapping? */ + fr = (gfloat) fdata[1 + x].r / 512.0; + fi = (gfloat) fdata[1 + x].i / 512.0; + y = (guint) (h * fabs (fr * fr + fi * fi)); + if (y > h) + y = h; + y = h - y; + off = (y * w) + x; + vdata[off] = 0x00FFFFFF; + for (l = y + 1; l <= h; l++) { + off += w; + add_pixel (&vdata[off], 0x007F7F7F); + } + } + return TRUE; +} + +gboolean +gst_spectra_scope_plugin_init (GstPlugin * plugin) +{ + GST_DEBUG_CATEGORY_INIT (spectra_scope_debug, "spectrascope", 0, + "spectrascope"); + + return gst_element_register (plugin, "spectrascope", GST_RANK_NONE, + GST_TYPE_SPECTRA_SCOPE); +} diff --git a/gst/audiovisualizers/gstspectrascope.h b/gst/audiovisualizers/gstspectrascope.h new file mode 100644 index 0000000000..3ba666ad44 --- /dev/null +++ b/gst/audiovisualizers/gstspectrascope.h @@ -0,0 +1,54 @@ +/* GStreamer + * Copyright (C) <2011> Stefan Kost + * + * gstspectrascope.h: simple oscilloscope + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +#ifndef __GST_SPECTRA_SCOPE_H__ +#define __GST_SPECTRA_SCOPE_H__ + +#include "gstbaseaudiovisualizer.h" +#include + +G_BEGIN_DECLS +#define GST_TYPE_SPECTRA_SCOPE (gst_spectra_scope_get_type()) +#define GST_SPECTRA_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SPECTRA_SCOPE,GstSpectraScope)) +#define GST_SPECTRA_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SPECTRA_SCOPE,GstSpectraScopeClass)) +#define GST_IS_SPECTRA_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SPECTRA_SCOPE)) +#define GST_IS_SPECTRA_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SPECTRA_SCOPE)) +typedef struct _GstSpectraScope GstSpectraScope; +typedef struct _GstSpectraScopeClass GstSpectraScopeClass; + +struct _GstSpectraScope +{ + GstBaseAudioVisualizer parent; + + GstFFTS16 *fft_ctx; + GstFFTS16Complex *freq_data; +}; + +struct _GstSpectraScopeClass +{ + GstBaseAudioVisualizerClass parent_class; +}; + +GType gst_spectra_scope_get_type (void); +gboolean gst_spectra_scope_plugin_init (GstPlugin * plugin); + +G_END_DECLS +#endif /* __GST_SPECTRA_SCOPE_H__ */ \ No newline at end of file diff --git a/gst/audiovisualizers/gstsynaescope.c b/gst/audiovisualizers/gstsynaescope.c new file mode 100644 index 0000000000..414e6087eb --- /dev/null +++ b/gst/audiovisualizers/gstsynaescope.c @@ -0,0 +1,307 @@ +/* GStreamer + * Copyright (C) <2011> Stefan Kost + * + * gstsynaescope.c: frequency spectrum scope + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +/** + * SECTION:element-synaescope + * @see_also: goom + * + * Synaescope is an audio visualisation element. It analyzes frequencies and + * out-of phase properties of audio and draws this as clouds of stars. + * + * + * Example launch line + * |[ + * gst-launch audiotestsrc ! audioconvert ! synaescope ! ximagesink + * ]| + * + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "gstsynaescope.h" + +static GstStaticPadTemplate gst_synae_scope_src_template = +GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN) + ); + +static GstStaticPadTemplate gst_synae_scope_sink_template = +GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS) + ); + + +GST_DEBUG_CATEGORY_STATIC (synae_scope_debug); +#define GST_CAT_DEFAULT synae_scope_debug + +static void gst_synae_scope_finalize (GObject * object); + +static gboolean gst_synae_scope_setup (GstBaseAudioVisualizer * scope); +static gboolean gst_synae_scope_render (GstBaseAudioVisualizer * scope, + GstBuffer * audio, GstBuffer * video); + + +GST_BOILERPLATE (GstSynaeScope, gst_synae_scope, GstBaseAudioVisualizer, + GST_TYPE_BASE_AUDIO_VISUALIZER); + +static void +gst_synae_scope_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_set_details_simple (element_class, "Synaescope", + "Visualization", + "Creates video visualizations of audio input, using stereo and pitch information", + "Stefan Kost "); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_synae_scope_src_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_synae_scope_sink_template)); +} + +static void +gst_synae_scope_class_init (GstSynaeScopeClass * g_class) +{ + GObjectClass *gobject_class = (GObjectClass *) g_class; + GstBaseAudioVisualizerClass *scope_class = + (GstBaseAudioVisualizerClass *) g_class; + + gobject_class->finalize = gst_synae_scope_finalize; + + scope_class->setup = GST_DEBUG_FUNCPTR (gst_synae_scope_setup); + scope_class->render = GST_DEBUG_FUNCPTR (gst_synae_scope_render); +} + +static void +gst_synae_scope_init (GstSynaeScope * scope, GstSynaeScopeClass * g_class) +{ + guint32 *colors = scope->colors; + guint *shade = scope->shade; + guint i, r, g, b; + +#define BOUND(x) ((x) > 255 ? 255 : (x)) +#define PEAKIFY(x) BOUND((x) - (x)*(255-(x))/255/2) + + for (i = 0; i < 256; i++) { + r = PEAKIFY ((i & 15 * 16)); + g = PEAKIFY ((i & 15) * 16 + (i & 15 * 16) / 4); + b = PEAKIFY ((i & 15) * 16); + + colors[i] = (r << 16) | (g << 8) | b; + } +#undef BOUND +#undef PEAKIFY + + for (i = 0; i < 256; i++) + shade[i] = i * 200 >> 8; +} + +static void +gst_synae_scope_finalize (GObject * object) +{ + GstSynaeScope *scope = GST_SYNAE_SCOPE (object); + + if (scope->fft_ctx) { + gst_fft_s16_free (scope->fft_ctx); + scope->fft_ctx = NULL; + } + if (scope->freq_data_l) { + g_free (scope->freq_data_l); + scope->freq_data_l = NULL; + } + if (scope->freq_data_r) { + g_free (scope->freq_data_r); + scope->freq_data_r = NULL; + } + if (scope->adata_l) { + g_free (scope->adata_l); + scope->adata_l = NULL; + } + if (scope->adata_r) { + g_free (scope->adata_r); + scope->adata_r = NULL; + } + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static gboolean +gst_synae_scope_setup (GstBaseAudioVisualizer * bscope) +{ + GstSynaeScope *scope = GST_SYNAE_SCOPE (bscope); + guint num_freq = bscope->height + 1; + + if (scope->fft_ctx) + gst_fft_s16_free (scope->fft_ctx); + g_free (scope->freq_data_l); + g_free (scope->freq_data_r); + g_free (scope->adata_l); + g_free (scope->adata_r); + + /* FIXME: we could have horizontal or vertical layout */ + + /* we'd need this amount of samples per render() call */ + bscope->req_spf = num_freq * 2 - 2; + scope->fft_ctx = gst_fft_s16_new (bscope->req_spf, FALSE); + scope->freq_data_l = g_new (GstFFTS16Complex, num_freq); + scope->freq_data_r = g_new (GstFFTS16Complex, num_freq); + + scope->adata_l = g_new (gint16, bscope->req_spf); + scope->adata_r = g_new (gint16, bscope->req_spf); + + return TRUE; +} + +static inline void +add_pixel (guint32 * _p, guint32 _c) +{ + guint8 *p = (guint8 *) _p; + guint8 *c = (guint8 *) & _c; + + if (p[0] < 255 - c[0]) + p[0] += c[0]; + else + p[0] = 255; + if (p[1] < 255 - c[1]) + p[1] += c[1]; + else + p[1] = 255; + if (p[2] < 255 - c[2]) + p[2] += c[2]; + else + p[2] = 255; + if (p[3] < 255 - c[3]) + p[3] += c[3]; + else + p[3] = 255; +} + +static gboolean +gst_synae_scope_render (GstBaseAudioVisualizer * bscope, GstBuffer * audio, + GstBuffer * video) +{ + GstSynaeScope *scope = GST_SYNAE_SCOPE (bscope); + guint32 *vdata = (guint32 *) GST_BUFFER_DATA (video); + gint16 *adata = (gint16 *) GST_BUFFER_DATA (audio); + gint16 *adata_l = scope->adata_l; + gint16 *adata_r = scope->adata_r; + GstFFTS16Complex *fdata_l = scope->freq_data_l; + GstFFTS16Complex *fdata_r = scope->freq_data_r; + gint x, y; + guint off; + guint w = bscope->width; + guint h = bscope->height; + guint32 *colors = scope->colors, c; + guint *shade = scope->shade; + //guint w2 = w /2; + guint ch = bscope->channels; + guint num_samples = GST_BUFFER_SIZE (audio) / (ch * sizeof (gint16)); + gint i, j, b; + gint br, br1, br2; + gint clarity; + gdouble fc, r, l, rr, ll; + gdouble frl, fil, frr, fir; + const guint sl = 30; + + /* deinterleave */ + for (i = 0, j = 0; i < num_samples; i++) { + adata_l[i] = adata[j++]; + adata_r[i] = adata[j++]; + } + + /* run fft */ + /*gst_fft_s16_window (scope->fft_ctx, adata_l, GST_FFT_WINDOW_HAMMING); */ + gst_fft_s16_fft (scope->fft_ctx, adata_l, fdata_l); + /*gst_fft_s16_window (scope->fft_ctx, adata_r, GST_FFT_WINDOW_HAMMING); */ + gst_fft_s16_fft (scope->fft_ctx, adata_r, fdata_r); + + /* draw stars */ + for (y = 0; y < h; y++) { + b = h - y; + frl = (gdouble) fdata_l[b].r; + fil = (gdouble) fdata_l[b].i; + frr = (gdouble) fdata_r[b].r; + fir = (gdouble) fdata_r[b].i; + + ll = (frl + fil) * (frl + fil) + (frr - fir) * (frr - fir); + l = sqrt (ll); + rr = (frl - fil) * (frl - fil) + (frr + fir) * (frr + fir); + r = sqrt (rr); + /* out-of-phase'ness for this frequency component */ + clarity = (gint) ( + ((frl + fil) * (frl - fil) + (frr + fir) * (frr - fir)) / + (ll + rr) * 256); + fc = r + l; + + x = (guint) (r * w / fc); + /* the brighness scaling factor was picked by experimenting */ + br = b * fc * 0.01; + + br1 = br * (clarity + 128) >> 8; + br2 = br * (128 - clarity) >> 8; + br1 = CLAMP (br1, 0, 255); + br2 = CLAMP (br2, 0, 255); + + GST_DEBUG ("y %3d fc %10.6f clarity %d br %d br1 %d br2 %d", y, fc, clarity, + br, br1, br2); + + /* draw a star */ + off = (y * w) + x; + c = colors[(br1 >> 4) | (br2 & 0xf0)]; + add_pixel (&vdata[off], c); + if ((x > (sl - 1)) && (x < (w - sl)) && (y > (sl - 1)) && (y < (h - sl))) { + for (i = 1; br1 || br2; i++, br1 = shade[br1], br2 = shade[br2]) { + c = colors[(br1 >> 4) + (br2 & 0xf0)]; + add_pixel (&vdata[off - i], c); + add_pixel (&vdata[off + i], c); + add_pixel (&vdata[off - i * w], c); + add_pixel (&vdata[off + i * w], c); + } + } else { + for (i = 1; br1 || br2; i++, br1 = shade[br1], br2 = shade[br2]) { + c = colors[(br1 >> 4) | (br2 & 0xf0)]; + if (x - i > 0) + add_pixel (&vdata[off - i], c); + if (x + i < (w - 1)) + add_pixel (&vdata[off + i], c); + if (y - i > 0) + add_pixel (&vdata[off - i * w], c); + if (y + i < (h - 1)) + add_pixel (&vdata[off + i * w], c); + } + } + } + + return TRUE; +} + +gboolean +gst_synae_scope_plugin_init (GstPlugin * plugin) +{ + GST_DEBUG_CATEGORY_INIT (synae_scope_debug, "synaescope", 0, "synaescope"); + + return gst_element_register (plugin, "synaescope", GST_RANK_NONE, + GST_TYPE_SYNAE_SCOPE); +} diff --git a/gst/audiovisualizers/gstsynaescope.h b/gst/audiovisualizers/gstsynaescope.h new file mode 100644 index 0000000000..1ecbe3dfd4 --- /dev/null +++ b/gst/audiovisualizers/gstsynaescope.h @@ -0,0 +1,58 @@ +/* GStreamer + * Copyright (C) <2011> Stefan Kost + * + * gstsynaescope.h: simple oscilloscope + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +#ifndef __GST_SYNAE_SCOPE_H__ +#define __GST_SYNAE_SCOPE_H__ + +#include "gstbaseaudiovisualizer.h" +#include + +G_BEGIN_DECLS +#define GST_TYPE_SYNAE_SCOPE (gst_synae_scope_get_type()) +#define GST_SYNAE_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SYNAE_SCOPE,GstSynaeScope)) +#define GST_SYNAE_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SYNAE_SCOPE,GstSynaeScopeClass)) +#define GST_IS_SYNAE_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SYNAE_SCOPE)) +#define GST_IS_SYNAE_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SYNAE_SCOPE)) +typedef struct _GstSynaeScope GstSynaeScope; +typedef struct _GstSynaeScopeClass GstSynaeScopeClass; + +struct _GstSynaeScope +{ + GstBaseAudioVisualizer parent; + + GstFFTS16 *fft_ctx; + GstFFTS16Complex *freq_data_l, *freq_data_r; + gint16 *adata_l, *adata_r; + + guint32 colors[256]; + guint shade[256]; +}; + +struct _GstSynaeScopeClass +{ + GstBaseAudioVisualizerClass parent_class; +}; + +GType gst_synae_scope_get_type (void); +gboolean gst_synae_scope_plugin_init (GstPlugin * plugin); + +G_END_DECLS +#endif /* __GST_SYNAE_SCOPE_H__ */ \ No newline at end of file diff --git a/gst/audiovisualizers/gstwavescope.c b/gst/audiovisualizers/gstwavescope.c new file mode 100644 index 0000000000..e7351486b7 --- /dev/null +++ b/gst/audiovisualizers/gstwavescope.c @@ -0,0 +1,130 @@ +/* GStreamer + * Copyright (C) <2011> Stefan Kost + * + * gstwavescope.c: simple oscilloscope + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +/** + * SECTION:element-wavescope + * @see_also: goom + * + * Wavescope is a simple audio visualisation element. It renders the waveforms + * like on an oscilloscope. + * + * + * Example launch line + * |[ + * gst-launch audiotestsrc ! audioconvert ! wavescope ! ximagesink + * ]| + * + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "gstwavescope.h" + +static GstStaticPadTemplate gst_wave_scope_src_template = +GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN) + ); + +static GstStaticPadTemplate gst_wave_scope_sink_template = +GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS) + ); + + +GST_DEBUG_CATEGORY_STATIC (wave_scope_debug); +#define GST_CAT_DEFAULT wave_scope_debug + +static gboolean gst_wave_scope_render (GstBaseAudioVisualizer * scope, + GstBuffer * audio, GstBuffer * video); + + +GST_BOILERPLATE (GstWaveScope, gst_wave_scope, GstBaseAudioVisualizer, + GST_TYPE_BASE_AUDIO_VISUALIZER); + +static void +gst_wave_scope_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_set_details_simple (element_class, "Waveform oscilloscope", + "Visualization", + "Simple waveform oscilloscope", "Stefan Kost "); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_wave_scope_src_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_wave_scope_sink_template)); +} + +static void +gst_wave_scope_class_init (GstWaveScopeClass * g_class) +{ + GstBaseAudioVisualizerClass *scope_class = + (GstBaseAudioVisualizerClass *) g_class; + + scope_class->render = GST_DEBUG_FUNCPTR (gst_wave_scope_render); +} + +static void +gst_wave_scope_init (GstWaveScope * scope, GstWaveScopeClass * g_class) +{ + /* do nothing */ +} + +static gboolean +gst_wave_scope_render (GstBaseAudioVisualizer * scope, GstBuffer * audio, + GstBuffer * video) +{ + guint32 *vdata = (guint32 *) GST_BUFFER_DATA (video); + gint16 *adata = (gint16 *) GST_BUFFER_DATA (audio); + guint i, c, s, x, y, off, oy; + guint num_samples; + gfloat dx, dy; + guint w = scope->width; + + /* draw dots */ + num_samples = GST_BUFFER_SIZE (audio) / (scope->channels * sizeof (gint16)); + dx = (gfloat) scope->width / (gfloat) num_samples; + dy = scope->height / 65536.0; + oy = scope->height / 2; + s = 0; + for (i = 0; i < num_samples; i++) { + x = (guint) ((gfloat) i * dx); + for (c = 0; c < scope->channels; c++) { + y = (guint) (oy + (gfloat) adata[s++] * dy); + off = (y * w) + x; + vdata[off] = 0x00FFFFFF; + } + } + return TRUE; +} + +gboolean +gst_wave_scope_plugin_init (GstPlugin * plugin) +{ + GST_DEBUG_CATEGORY_INIT (wave_scope_debug, "wavescope", 0, "wavescope"); + + return gst_element_register (plugin, "wavescope", GST_RANK_NONE, + GST_TYPE_WAVE_SCOPE); +} diff --git a/gst/audiovisualizers/gstwavescope.h b/gst/audiovisualizers/gstwavescope.h new file mode 100644 index 0000000000..1467663a3d --- /dev/null +++ b/gst/audiovisualizers/gstwavescope.h @@ -0,0 +1,50 @@ +/* GStreamer + * Copyright (C) <2011> Stefan Kost + * + * gstwavescope.h: simple oscilloscope + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +#ifndef __GST_WAVE_SCOPE_H__ +#define __GST_WAVE_SCOPE_H__ + +#include "gstbaseaudiovisualizer.h" + +G_BEGIN_DECLS +#define GST_TYPE_WAVE_SCOPE (gst_wave_scope_get_type()) +#define GST_WAVE_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WAVE_SCOPE,GstWaveScope)) +#define GST_WAVE_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_WAVE_SCOPE,GstWaveScopeClass)) +#define GST_IS_WAVE_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WAVE_SCOPE)) +#define GST_IS_WAVE_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_WAVE_SCOPE)) +typedef struct _GstWaveScope GstWaveScope; +typedef struct _GstWaveScopeClass GstWaveScopeClass; + +struct _GstWaveScope +{ + GstBaseAudioVisualizer parent; +}; + +struct _GstWaveScopeClass +{ + GstBaseAudioVisualizerClass parent_class; +}; + +GType gst_wave_scope_get_type (void); +gboolean gst_wave_scope_plugin_init (GstPlugin * plugin); + +G_END_DECLS +#endif /* __GST_WAVE_SCOPE_H__ */ \ No newline at end of file diff --git a/gst/audiovisualizers/plugin.c b/gst/audiovisualizers/plugin.c new file mode 100644 index 0000000000..4130f9725c --- /dev/null +++ b/gst/audiovisualizers/plugin.c @@ -0,0 +1,51 @@ +/* GStreamer + * Copyright (C) <2011> Stefan Kost + * + * plugin.c: scopes plugin + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include +#include + +#include "gstspacescope.h" +#include "gstspectrascope.h" +#include "gstsynaescope.h" +#include "gstwavescope.h" + +static gboolean +plugin_init (GstPlugin * plugin) +{ + gboolean res = TRUE; + + /* initialize gst controller library */ + gst_controller_init (NULL, NULL); + + res &= gst_space_scope_plugin_init (plugin); + res &= gst_spectra_scope_plugin_init (plugin); + res &= gst_synae_scope_plugin_init (plugin); + res &= gst_wave_scope_plugin_init (plugin); + return res; +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "audiovisualizers", + "Creates video visualizations of audio input", + plugin_init, VERSION, "GPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/gst/autoconvert/Makefile.am b/gst/autoconvert/Makefile.am index e57b9bc6c1..faa0d9cd0e 100644 --- a/gst/autoconvert/Makefile.am +++ b/gst/autoconvert/Makefile.am @@ -8,3 +8,17 @@ libgstautoconvert_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstautoconvert_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstautoconvert.h gstautovideoconvert.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstautoconvert -:SHARED libgstautoconvert \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstautoconvert_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstautoconvert_la_CFLAGS) \ + -:LDFLAGS $(libgstautoconvert_la_LDFLAGS) \ + $(libgstautoconvert_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/bayer/Makefile.am b/gst/bayer/Makefile.am index 8bcdb09f18..69666ea2f6 100644 --- a/gst/bayer/Makefile.am +++ b/gst/bayer/Makefile.am @@ -1,14 +1,35 @@ plugin_LTLIBRARIES = libgstbayer.la +ORC_SOURCE=gstbayerorc +include $(top_srcdir)/common/orc.mak + libgstbayer_la_SOURCES = \ gstbayer.c \ gstbayer2rgb.c \ gstrgb2bayer.c \ gstrgb2bayer.h libgstbayer_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) \ + $(ORC_CFLAGS) \ $(GST_CFLAGS) libgstbayer_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) \ + $(ORC_LIBS) \ $(GST_BASE_LIBS) libgstbayer_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstbayer_la_LIBTOOLFLAGS = --tag=disable-static +nodist_libgstbayer_la_SOURCES = $(ORC_NODIST_SOURCES) + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstbayer -:SHARED libgstbayer \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstbayer_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstbayer_la_CFLAGS) \ + -:LDFLAGS $(libgstbayer_la_LDFLAGS) \ + $(libgstbayer_la_LIBADD) \ + $(libgstbayer_la_LIBTOOLFLAGS) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/bayer/gstbayer2rgb.c b/gst/bayer/gstbayer2rgb.c index 67aaa42296..8f9ed124da 100644 --- a/gst/bayer/gstbayer2rgb.c +++ b/gst/bayer/gstbayer2rgb.c @@ -80,7 +80,8 @@ #include #include #include -#include "_stdint.h" +#include <_stdint.h> +#include "gstbayerorc.h" #define GST_CAT_DEFAULT gst_bayer2rgb_debug GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); @@ -125,7 +126,6 @@ struct _GstBayer2RGBClass GstBaseTransformClass parent; }; -//#define SRC_CAPS GST_VIDEO_CAPS_RGBx #define SRC_CAPS \ GST_VIDEO_CAPS_RGBx ";" \ GST_VIDEO_CAPS_xRGB ";" \ @@ -134,9 +134,7 @@ struct _GstBayer2RGBClass GST_VIDEO_CAPS_RGBA ";" \ GST_VIDEO_CAPS_ARGB ";" \ GST_VIDEO_CAPS_BGRA ";" \ - GST_VIDEO_CAPS_ABGR ";" \ - GST_VIDEO_CAPS_RGB ";" \ - GST_VIDEO_CAPS_BGR + GST_VIDEO_CAPS_ABGR #define SINK_CAPS "video/x-raw-bayer,format=(string){bggr,grbg,gbrg,rggb}," \ "width=(int)[1,MAX],height=(int)[1,MAX],framerate=(fraction)[0/1,MAX]" @@ -365,7 +363,6 @@ gst_bayer2rgb_get_unit_size (GstBaseTransform * base, GstCaps * caps, name = gst_structure_get_name (structure); /* Our name must be either video/x-raw-bayer video/x-raw-rgb */ if (strcmp (name, "video/x-raw-rgb")) { - /* For bayer, we handle only BA81 (BGGR), which is BPP=24 */ *size = GST_ROUND_UP_4 (width) * height; return TRUE; } else { @@ -382,283 +379,107 @@ gst_bayer2rgb_get_unit_size (GstBaseTransform * base, GstCaps * caps, return FALSE; } -/* - * We define values for the colors, just to make the code more readable. - */ -#define RED 0 /* Pure red element */ -#define GREENB 1 /* Green element which is on a blue line */ -#define BLUE 2 /* Pure blue element */ -#define GREENR 3 /* Green element which is on a red line */ - -static int -get_pixel_type (GstBayer2RGB * filter, int x, int y) -{ - int type; - - if (((x ^ filter->format) & 1)) { - if ((y ^ (filter->format >> 1)) & 1) - type = RED; - else - type = GREENB; - } else { - if ((y ^ (filter->format >> 1)) & 1) - type = GREENR; - else - type = BLUE; - } - return type; -} - -/* Routine to generate the top and bottom edges (not including corners) */ static void -hborder (uint8_t * input, uint8_t * output, int bot_top, - int typ, GstBayer2RGB * filter) +gst_bayer2rgb_split_and_upsample_horiz (guint8 * dest0, guint8 * dest1, + const guint8 * src, int n) { - uint8_t *op; /* output pointer */ - uint8_t *ip; /* input pointer */ - uint8_t *nx; /* next line pointer */ - int ix; /* loop index */ + int i; - op = output + (bot_top * filter->width * (filter->height - 1) + 1) * - filter->pixsize; - ip = input + bot_top * filter->stride * (filter->height - 1); - /* calculate minus or plus one line, depending upon bot_top flag */ - nx = ip + (1 - 2 * bot_top) * filter->stride; - /* Stepping horizontally */ - for (ix = 1; ix < filter->width - 1; ix++, op += filter->pixsize) { - switch (typ) { - case RED: - op[filter->r_off] = ip[ix]; - op[filter->g_off] = (ip[ix + 1] + ip[ix - 1] + nx[ix] + 1) / 3; - op[filter->b_off] = (nx[ix + 1] + nx[ix - 1] + 1) / 2; - typ = GREENR; - break; - case GREENR: - op[filter->r_off] = (ip[ix + 1] + ip[ix - 1] + 1) / 2; - op[filter->g_off] = ip[ix]; - op[filter->b_off] = nx[ix]; - typ = RED; - break; - case GREENB: - op[filter->r_off] = nx[ix]; - op[filter->g_off] = ip[ix]; - op[filter->b_off] = (ip[ix + 1] + ip[ix - 1] + 1) / 2; - typ = BLUE; - break; - case BLUE: - op[filter->r_off] = (nx[ix + 1] + nx[ix - 1] + 1) / 2; - op[filter->g_off] = (ip[ix + 1] + ip[ix - 1] + nx[ix] + 1) / 3; - op[filter->b_off] = ip[ix]; - typ = GREENB; - break; + dest0[0] = src[0]; + dest1[0] = src[1]; + dest0[1] = (src[0] + src[2] + 1) >> 1; + dest1[1] = src[1]; + +#if defined(__i386__) || defined(__amd64__) + gst_bayer_horiz_upsample_unaligned (dest0 + 2, dest1 + 2, src + 1, + (n - 4) >> 1); +#else + gst_bayer_horiz_upsample (dest0 + 2, dest1 + 2, src + 2, (n - 4) >> 1); +#endif + + for (i = n - 2; i < n; i++) { + if ((i & 1) == 0) { + dest0[i] = src[i]; + dest1[i] = src[i - 1]; + } else { + dest0[i] = src[i - 1]; + dest1[i] = src[i]; } } } -/* Routine to generate the left and right edges, not including corners */ -static void -vborder (uint8_t * input, uint8_t * output, int right_left, - int typ, GstBayer2RGB * filter) -{ - uint8_t *op; /* output pointer */ - uint8_t *ip; /* input pointer */ - uint8_t *la; /* line above pointer */ - uint8_t *lb; /* line below pointer */ - int ix; /* loop index */ - int lr; /* 'left-right' flag - +1 is right, -1 is left */ +typedef void (*process_func) (guint8 * d0, const guint8 * s0, const guint8 * s1, + const guint8 * s2, const guint8 * s3, const guint8 * s4, const guint8 * s5, + int n); - lr = (1 - 2 * right_left); - /* stepping vertically */ - for (ix = 1; ix < filter->height - 1; ix++) { - ip = input + right_left * (filter->width - 1) + ix * filter->stride; - op = output + (right_left * (filter->width - 1) + ix * filter->width) * - filter->pixsize; - la = ip + filter->stride; - lb = ip - filter->stride; - switch (typ) { - case RED: - op[filter->r_off] = ip[0]; - op[filter->g_off] = (la[0] + ip[lr] + lb[0] + 1) / 3; - op[filter->b_off] = (la[lr] + lb[lr] + 1) / 2; - typ = GREENB; - break; - case GREENR: - op[filter->r_off] = ip[lr]; - op[filter->g_off] = ip[0]; - op[filter->b_off] = (la[lr] + lb[lr] + 1) / 2; - typ = BLUE; - break; - case GREENB: - op[filter->r_off] = (la[lr] + lb[lr] + 1) / 2; - op[filter->g_off] = ip[0]; - op[filter->b_off] = ip[lr]; - typ = RED; - break; - case BLUE: - op[filter->r_off] = (la[lr] + lb[lr] + 1) / 2; - op[filter->g_off] = (la[0] + ip[lr] + lb[0] + 1) / 3; - op[filter->b_off] = ip[0]; - typ = GREENR; - break; +static void +gst_bayer2rgb_process (GstBayer2RGB * bayer2rgb, uint8_t * dest, + int dest_stride, uint8_t * src, int src_stride) +{ + int j; + guint8 *tmp; + process_func merge[2] = { NULL, NULL }; + int r_off, g_off, b_off; + + /* We exploit some symmetry in the functions here. The base functions + * are all named for the BGGR arrangement. For RGGB, we swap the + * red offset and blue offset in the output. For GRBG, we swap the + * order of the merge functions. For GBRG, do both. */ + r_off = bayer2rgb->r_off; + g_off = bayer2rgb->g_off; + b_off = bayer2rgb->b_off; + if (bayer2rgb->format == GST_BAYER_2_RGB_FORMAT_RGGB || + bayer2rgb->format == GST_BAYER_2_RGB_FORMAT_GBRG) { + r_off = bayer2rgb->b_off; + b_off = bayer2rgb->r_off; + } + + if (r_off == 2 && g_off == 1 && b_off == 0) { + merge[0] = gst_bayer_merge_bg_bgra; + merge[1] = gst_bayer_merge_gr_bgra; + } else if (r_off == 3 && g_off == 2 && b_off == 1) { + merge[0] = gst_bayer_merge_bg_abgr; + merge[1] = gst_bayer_merge_gr_abgr; + } else if (r_off == 1 && g_off == 2 && b_off == 3) { + merge[0] = gst_bayer_merge_bg_argb; + merge[1] = gst_bayer_merge_gr_argb; + } else if (r_off == 0 && g_off == 1 && b_off == 2) { + merge[0] = gst_bayer_merge_bg_rgba; + merge[1] = gst_bayer_merge_gr_rgba; + } + if (bayer2rgb->format == GST_BAYER_2_RGB_FORMAT_GRBG || + bayer2rgb->format == GST_BAYER_2_RGB_FORMAT_GBRG) { + process_func tmp = merge[0]; + merge[0] = merge[1]; + merge[1] = tmp; + } + + tmp = g_malloc (2 * 4 * bayer2rgb->width); +#define LINE(x) (tmp + ((x)&7) * bayer2rgb->width) + + gst_bayer2rgb_split_and_upsample_horiz (LINE (3 * 2 + 0), LINE (3 * 2 + 1), + src + 1 * src_stride, bayer2rgb->width); + j = 0; + gst_bayer2rgb_split_and_upsample_horiz (LINE (j * 2 + 0), LINE (j * 2 + 1), + src + j * src_stride, bayer2rgb->width); + + for (j = 0; j < bayer2rgb->height; j++) { + if (j < bayer2rgb->height - 1) { + gst_bayer2rgb_split_and_upsample_horiz (LINE ((j + 1) * 2 + 0), + LINE ((j + 1) * 2 + 1), src + (j + 1) * src_stride, bayer2rgb->width); } + + merge[j & 1] (dest + j * dest_stride, + LINE (j * 2 - 2), LINE (j * 2 - 1), + LINE (j * 2 + 0), LINE (j * 2 + 1), + LINE (j * 2 + 2), LINE (j * 2 + 3), bayer2rgb->width >> 1); } + + g_free (tmp); } -/* Produce the four (top, bottom, left, right) edges */ -static void -do_row0_col0 (uint8_t * input, uint8_t * output, GstBayer2RGB * filter) -{ - /* Horizontal edges */ - hborder (input, output, 0, get_pixel_type (filter, 1, 0), filter); - hborder (input, output, 1, get_pixel_type (filter, 1, filter->height - 1), - filter); - /* Vertical edges */ - vborder (input, output, 0, get_pixel_type (filter, 0, 1), filter); - vborder (input, output, 1, get_pixel_type (filter, filter->width - 1, 1), - filter); -} -static void -corner (uint8_t * input, uint8_t * output, int x, int y, - int xd, int yd, int typ, GstBayer2RGB * filter) -{ - uint8_t *ip; /* input pointer */ - uint8_t *op; /* output pointer */ - uint8_t *nx; /* adjacent line */ - - op = output + y * filter->width * filter->pixsize + x * filter->pixsize; - ip = input + y * filter->stride + x; - nx = ip + yd * filter->stride; - switch (typ) { - case RED: - op[filter->r_off] = ip[0]; - op[filter->g_off] = (nx[0] + ip[xd] + 1) / 2; - op[filter->b_off] = nx[xd]; - break; - case GREENR: - op[filter->r_off] = ip[xd]; - op[filter->g_off] = ip[0]; - op[filter->b_off] = nx[0]; - break; - case GREENB: - op[filter->r_off] = nx[0]; - op[filter->g_off] = ip[0]; - op[filter->b_off] = ip[xd]; - break; - case BLUE: - op[filter->r_off] = nx[xd]; - op[filter->g_off] = (nx[0] + ip[xd] + 1) / 2; - op[filter->b_off] = ip[0]; - break; - } -} - -static void -do_corners (uint8_t * input, uint8_t * output, GstBayer2RGB * filter) -{ - /* Top left */ - corner (input, output, 0, 0, 1, 1, get_pixel_type (filter, 0, 0), filter); - /* Bottom left */ - corner (input, output, 0, filter->height - 1, 1, -1, - get_pixel_type (filter, 0, filter->height - 1), filter); - /* Top right */ - corner (input, output, filter->width - 1, 0, -1, 0, - get_pixel_type (filter, filter->width - 1, 0), filter); - /* Bottom right */ - corner (input, output, filter->width - 1, filter->height - 1, -1, -1, - get_pixel_type (filter, filter->width - 1, filter->height - 1), filter); -} - -static void -do_body (uint8_t * input, uint8_t * output, GstBayer2RGB * filter) -{ - int ip, op; /* input and output pointers */ - int w, h; /* loop indices */ - int type; /* calculated colour of current element */ - int a1, a2; - int v1, v2, h1, h2; - - /* - * We are processing row (line) by row, starting with the second - * row and continuing through the next to last. Each row is processed - * column by column, starting with the second and continuing through - * to the next to last. - */ - for (h = 1; h < filter->height - 1; h++) { - /* - * Remember we are processing "row by row". For each row, we need - * to set the type of the first element to be processed. Since we - * have already processed the edges, the "first element" will be - * the pixel at position (1,1). Assuming BG format, this should - * be RED for odd-numbered rows and GREENB for even rows. - */ - type = get_pixel_type (filter, 1, h); - /* Calculate the starting position for the row */ - op = h * filter->width * filter->pixsize; /* output (converted) pos */ - ip = h * filter->stride; /* input (bayer data) pos */ - for (w = 1; w < filter->width - 1; w++) { - op += filter->pixsize; /* we are processing "horizontally" */ - ip++; - switch (type) { - case RED: - output[op + filter->r_off] = input[ip]; - output[op + filter->b_off] = (input[ip - filter->stride - 1] + - input[ip - filter->stride + 1] + - input[ip + filter->stride - 1] + - input[ip + filter->stride + 1] + 2) / 4; - v1 = input[ip + filter->stride]; - v2 = input[ip - filter->stride]; - h1 = input[ip + 1]; - h2 = input[ip - 1]; - a1 = abs (v1 - v2); - a2 = abs (h1 - h2); - if (a1 < a2) - output[op + filter->g_off] = (v1 + v2 + 1) / 2; - else if (a1 > a2) - output[op + filter->g_off] = (h1 + h2 + 1) / 2; - else - output[op + filter->g_off] = (v1 + h1 + v2 + h2 + 2) / 4; - type = GREENR; - break; - case GREENR: - output[op + filter->r_off] = (input[ip + 1] + input[ip - 1] + 1) / 2; - output[op + filter->g_off] = input[ip]; - output[op + filter->b_off] = (input[ip - filter->stride] + - input[ip + filter->stride] + 1) / 2; - type = RED; - break; - case GREENB: - output[op + filter->r_off] = (input[ip - filter->stride] + - input[ip + filter->stride] + 1) / 2; - output[op + filter->g_off] = input[ip]; - output[op + filter->b_off] = (input[ip + 1] + input[ip - 1] + 1) / 2; - type = BLUE; - break; - case BLUE: - output[op + filter->r_off] = (input[ip - filter->stride - 1] + - input[ip - filter->stride + 1] + - input[ip + filter->stride - 1] + - input[ip + filter->stride + 1] + 2) / 4; - output[op + filter->b_off] = input[ip]; - v1 = input[ip + filter->stride]; - v2 = input[ip - filter->stride]; - h1 = input[ip + 1]; - h2 = input[ip - 1]; - a1 = abs (v1 - v2); - a2 = abs (h1 - h2); - if (a1 < a2) - output[op + filter->g_off] = (v1 + v2 + 1) / 2; - else if (a1 > a2) - output[op + filter->g_off] = (h1 + h2 + 1) / 2; - else - output[op + filter->g_off] = (v1 + h1 + v2 + h2 + 2) / 4; - type = GREENB; - break; - } - } - } -} static GstFlowReturn gst_bayer2rgb_transform (GstBaseTransform * base, GstBuffer * inbuf, @@ -677,9 +498,8 @@ gst_bayer2rgb_transform (GstBaseTransform * base, GstBuffer * inbuf, GST_DEBUG ("transforming buffer"); input = (uint8_t *) GST_BUFFER_DATA (inbuf); output = (uint8_t *) GST_BUFFER_DATA (outbuf); - do_corners (input, output, filter); - do_row0_col0 (input, output, filter); - do_body (input, output, filter); + gst_bayer2rgb_process (filter, output, filter->width * 4, + input, filter->width); GST_OBJECT_UNLOCK (filter); return GST_FLOW_OK; diff --git a/gst/bayer/gstbayerorc-dist.c b/gst/bayer/gstbayerorc-dist.c new file mode 100644 index 0000000000..a8bc117166 --- /dev/null +++ b/gst/bayer/gstbayerorc-dist.c @@ -0,0 +1,3212 @@ + +/* autogenerated from gstbayerorc.orc */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include + +#ifndef _ORC_INTEGER_TYPEDEFS_ +#define _ORC_INTEGER_TYPEDEFS_ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#include +typedef int8_t orc_int8; +typedef int16_t orc_int16; +typedef int32_t orc_int32; +typedef int64_t orc_int64; +typedef uint8_t orc_uint8; +typedef uint16_t orc_uint16; +typedef uint32_t orc_uint32; +typedef uint64_t orc_uint64; +#define ORC_UINT64_C(x) UINT64_C(x) +#elif defined(_MSC_VER) +typedef signed __int8 orc_int8; +typedef signed __int16 orc_int16; +typedef signed __int32 orc_int32; +typedef signed __int64 orc_int64; +typedef unsigned __int8 orc_uint8; +typedef unsigned __int16 orc_uint16; +typedef unsigned __int32 orc_uint32; +typedef unsigned __int64 orc_uint64; +#define ORC_UINT64_C(x) (x##Ui64) +#define inline __inline +#else +#include +typedef signed char orc_int8; +typedef short orc_int16; +typedef int orc_int32; +typedef unsigned char orc_uint8; +typedef unsigned short orc_uint16; +typedef unsigned int orc_uint32; +#if INT_MAX == LONG_MAX +typedef long long orc_int64; +typedef unsigned long long orc_uint64; +#define ORC_UINT64_C(x) (x##ULL) +#else +typedef long orc_int64; +typedef unsigned long orc_uint64; +#define ORC_UINT64_C(x) (x##UL) +#endif +#endif +typedef union +{ + orc_int16 i; + orc_int8 x2[2]; +} orc_union16; +typedef union +{ + orc_int32 i; + float f; + orc_int16 x2[2]; + orc_int8 x4[4]; +} orc_union32; +typedef union +{ + orc_int64 i; + double f; + orc_int32 x2[2]; + float x2f[2]; + orc_int16 x4[4]; +} orc_union64; +#endif +#ifndef ORC_RESTRICT +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#define ORC_RESTRICT restrict +#elif defined(__GNUC__) && __GNUC__ >= 4 +#define ORC_RESTRICT __restrict__ +#else +#define ORC_RESTRICT +#endif +#endif + +#ifndef DISABLE_ORC +#include +#endif +void gst_bayer_horiz_upsample_unaligned (guint8 * ORC_RESTRICT d1, + guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n); +void gst_bayer_horiz_upsample (guint8 * ORC_RESTRICT d1, + guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n); +void gst_bayer_merge_bg_bgra (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n); +void gst_bayer_merge_gr_bgra (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n); +void gst_bayer_merge_bg_abgr (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n); +void gst_bayer_merge_gr_abgr (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n); +void gst_bayer_merge_bg_rgba (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n); +void gst_bayer_merge_gr_rgba (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n); +void gst_bayer_merge_bg_argb (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n); +void gst_bayer_merge_gr_argb (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n); + + +/* begin Orc C target preamble */ +#define ORC_CLAMP(x,a,b) ((x)<(a) ? (a) : ((x)>(b) ? (b) : (x))) +#define ORC_ABS(a) ((a)<0 ? -(a) : (a)) +#define ORC_MIN(a,b) ((a)<(b) ? (a) : (b)) +#define ORC_MAX(a,b) ((a)>(b) ? (a) : (b)) +#define ORC_SB_MAX 127 +#define ORC_SB_MIN (-1-ORC_SB_MAX) +#define ORC_UB_MAX 255 +#define ORC_UB_MIN 0 +#define ORC_SW_MAX 32767 +#define ORC_SW_MIN (-1-ORC_SW_MAX) +#define ORC_UW_MAX 65535 +#define ORC_UW_MIN 0 +#define ORC_SL_MAX 2147483647 +#define ORC_SL_MIN (-1-ORC_SL_MAX) +#define ORC_UL_MAX 4294967295U +#define ORC_UL_MIN 0 +#define ORC_CLAMP_SB(x) ORC_CLAMP(x,ORC_SB_MIN,ORC_SB_MAX) +#define ORC_CLAMP_UB(x) ORC_CLAMP(x,ORC_UB_MIN,ORC_UB_MAX) +#define ORC_CLAMP_SW(x) ORC_CLAMP(x,ORC_SW_MIN,ORC_SW_MAX) +#define ORC_CLAMP_UW(x) ORC_CLAMP(x,ORC_UW_MIN,ORC_UW_MAX) +#define ORC_CLAMP_SL(x) ORC_CLAMP(x,ORC_SL_MIN,ORC_SL_MAX) +#define ORC_CLAMP_UL(x) ORC_CLAMP(x,ORC_UL_MIN,ORC_UL_MAX) +#define ORC_SWAP_W(x) ((((x)&0xff)<<8) | (((x)&0xff00)>>8)) +#define ORC_SWAP_L(x) ((((x)&0xff)<<24) | (((x)&0xff00)<<8) | (((x)&0xff0000)>>8) | (((x)&0xff000000)>>24)) +#define ORC_SWAP_Q(x) ((((x)&ORC_UINT64_C(0xff))<<56) | (((x)&ORC_UINT64_C(0xff00))<<40) | (((x)&ORC_UINT64_C(0xff0000))<<24) | (((x)&ORC_UINT64_C(0xff000000))<<8) | (((x)&ORC_UINT64_C(0xff00000000))>>8) | (((x)&ORC_UINT64_C(0xff0000000000))>>24) | (((x)&ORC_UINT64_C(0xff000000000000))>>40) | (((x)&ORC_UINT64_C(0xff00000000000000))>>56)) +#define ORC_PTR_OFFSET(ptr,offset) ((void *)(((unsigned char *)(ptr)) + (offset))) +#define ORC_DENORMAL(x) ((x) & ((((x)&0x7f800000) == 0) ? 0xff800000 : 0xffffffff)) +#define ORC_ISNAN(x) ((((x)&0x7f800000) == 0x7f800000) && (((x)&0x007fffff) != 0)) +#define ORC_DENORMAL_DOUBLE(x) ((x) & ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == 0) ? ORC_UINT64_C(0xfff0000000000000) : ORC_UINT64_C(0xffffffffffffffff))) +#define ORC_ISNAN_DOUBLE(x) ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == ORC_UINT64_C(0x7ff0000000000000)) && (((x)&ORC_UINT64_C(0x000fffffffffffff)) != 0)) +#ifndef ORC_RESTRICT +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#define ORC_RESTRICT restrict +#elif defined(__GNUC__) && __GNUC__ >= 4 +#define ORC_RESTRICT __restrict__ +#else +#define ORC_RESTRICT +#endif +#endif +/* end Orc C target preamble */ + + + +/* gst_bayer_horiz_upsample_unaligned */ +#ifdef DISABLE_ORC +void +gst_bayer_horiz_upsample_unaligned (guint8 * ORC_RESTRICT d1, + guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n) +{ + int i; + orc_union16 *ORC_RESTRICT ptr0; + orc_union16 *ORC_RESTRICT ptr1; + const orc_union16 *ORC_RESTRICT ptr4; + orc_union16 var37; + orc_union16 var38; + orc_union16 var39; + orc_int8 var40; + orc_int8 var41; + orc_union16 var42; + orc_int8 var43; + orc_int8 var44; + orc_int8 var45; + orc_int8 var46; + + ptr0 = (orc_union16 *) d1; + ptr1 = (orc_union16 *) d2; + ptr4 = (orc_union16 *) s1; + + + for (i = 0; i < n; i++) { + /* 0: loadw */ + var37 = ptr4[i]; + /* 1: splitwb */ + { + orc_union16 _src; + _src.i = var37.i; + var40 = _src.x2[1]; + var41 = _src.x2[0]; + } + /* 2: loadoffw */ + var42 = ptr4[i + 1]; + /* 3: splitwb */ + { + orc_union16 _src; + _src.i = var42.i; + var43 = _src.x2[1]; + var44 = _src.x2[0]; + } + /* 4: avgub */ + var45 = ((orc_uint8) var40 + (orc_uint8) var43 + 1) >> 1; + /* 5: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var40; + _dest.x2[1] = var45; + var38.i = _dest.i; + } + /* 6: storew */ + ptr0[i] = var38; + /* 7: avgub */ + var46 = ((orc_uint8) var41 + (orc_uint8) var44 + 1) >> 1; + /* 8: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var46; + _dest.x2[1] = var44; + var39.i = _dest.i; + } + /* 9: storew */ + ptr1[i] = var39; + } + +} + +#else +static void +_backup_gst_bayer_horiz_upsample_unaligned (OrcExecutor * ORC_RESTRICT ex) +{ + int i; + int n = ex->n; + orc_union16 *ORC_RESTRICT ptr0; + orc_union16 *ORC_RESTRICT ptr1; + const orc_union16 *ORC_RESTRICT ptr4; + orc_union16 var37; + orc_union16 var38; + orc_union16 var39; + orc_int8 var40; + orc_int8 var41; + orc_union16 var42; + orc_int8 var43; + orc_int8 var44; + orc_int8 var45; + orc_int8 var46; + + ptr0 = (orc_union16 *) ex->arrays[0]; + ptr1 = (orc_union16 *) ex->arrays[1]; + ptr4 = (orc_union16 *) ex->arrays[4]; + + + for (i = 0; i < n; i++) { + /* 0: loadw */ + var37 = ptr4[i]; + /* 1: splitwb */ + { + orc_union16 _src; + _src.i = var37.i; + var40 = _src.x2[1]; + var41 = _src.x2[0]; + } + /* 2: loadoffw */ + var42 = ptr4[i + 1]; + /* 3: splitwb */ + { + orc_union16 _src; + _src.i = var42.i; + var43 = _src.x2[1]; + var44 = _src.x2[0]; + } + /* 4: avgub */ + var45 = ((orc_uint8) var40 + (orc_uint8) var43 + 1) >> 1; + /* 5: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var40; + _dest.x2[1] = var45; + var38.i = _dest.i; + } + /* 6: storew */ + ptr0[i] = var38; + /* 7: avgub */ + var46 = ((orc_uint8) var41 + (orc_uint8) var44 + 1) >> 1; + /* 8: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var46; + _dest.x2[1] = var44; + var39.i = _dest.i; + } + /* 9: storew */ + ptr1[i] = var39; + } + +} + +void +gst_bayer_horiz_upsample_unaligned (guint8 * ORC_RESTRICT d1, + guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n) +{ + OrcExecutor _ex, *ex = &_ex; + static int p_inited = 0; + static OrcProgram *p = 0; + void (*func) (OrcExecutor *); + + if (!p_inited) { + orc_once_mutex_lock (); + if (!p_inited) { + + p = orc_program_new (); + orc_program_set_name (p, "gst_bayer_horiz_upsample_unaligned"); + orc_program_set_backup_function (p, + _backup_gst_bayer_horiz_upsample_unaligned); + orc_program_add_destination (p, 2, "d1"); + orc_program_add_destination (p, 2, "d2"); + orc_program_add_source (p, 2, "s1"); + orc_program_add_constant (p, 4, 0x00000001, "c1"); + orc_program_add_temporary (p, 2, "t1"); + orc_program_add_temporary (p, 1, "t2"); + orc_program_add_temporary (p, 1, "t3"); + orc_program_add_temporary (p, 1, "t4"); + orc_program_add_temporary (p, 1, "t5"); + + orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T3, ORC_VAR_T2, ORC_VAR_S1, + ORC_VAR_D1); + orc_program_append_2 (p, "loadoffw", 0, ORC_VAR_T1, ORC_VAR_S1, + ORC_VAR_C1, ORC_VAR_D1); + orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_T1, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 0, ORC_VAR_T5, ORC_VAR_T3, ORC_VAR_T5, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T5, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_T4, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 0, ORC_VAR_D2, ORC_VAR_T2, ORC_VAR_T4, + ORC_VAR_D1); + + orc_program_compile (p); + } + p_inited = TRUE; + orc_once_mutex_unlock (); + } + ex->program = p; + + ex->n = n; + ex->arrays[ORC_VAR_D1] = d1; + ex->arrays[ORC_VAR_D2] = d2; + ex->arrays[ORC_VAR_S1] = (void *) s1; + + func = p->code_exec; + func (ex); +} +#endif + + +/* gst_bayer_horiz_upsample */ +#ifdef DISABLE_ORC +void +gst_bayer_horiz_upsample (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + const guint8 * ORC_RESTRICT s1, int n) +{ + int i; + orc_union16 *ORC_RESTRICT ptr0; + orc_union16 *ORC_RESTRICT ptr1; + const orc_union16 *ORC_RESTRICT ptr4; + orc_union16 var39; + orc_union16 var40; + orc_union16 var41; + orc_union16 var42; + orc_int8 var43; + orc_int8 var44; + orc_int8 var45; + orc_int8 var46; + orc_union16 var47; + orc_int8 var48; + orc_int8 var49; + orc_int8 var50; + orc_int8 var51; + + ptr0 = (orc_union16 *) d1; + ptr1 = (orc_union16 *) d2; + ptr4 = (orc_union16 *) s1; + + + for (i = 0; i < n; i++) { + /* 0: loadoffw */ + var42 = ptr4[i + -1]; + /* 1: splitwb */ + { + orc_union16 _src; + _src.i = var42.i; + var43 = _src.x2[1]; + var44 = _src.x2[0]; + } + /* 2: loadw */ + var39 = ptr4[i]; + /* 3: splitwb */ + { + orc_union16 _src; + _src.i = var39.i; + var45 = _src.x2[1]; + var46 = _src.x2[0]; + } + /* 4: loadoffw */ + var47 = ptr4[i + 1]; + /* 5: splitwb */ + { + orc_union16 _src; + _src.i = var47.i; + var48 = _src.x2[1]; + var49 = _src.x2[0]; + } + /* 6: avgub */ + var50 = ((orc_uint8) var46 + (orc_uint8) var49 + 1) >> 1; + /* 7: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var46; + _dest.x2[1] = var50; + var40.i = _dest.i; + } + /* 8: storew */ + ptr0[i] = var40; + /* 9: avgub */ + var51 = ((orc_uint8) var43 + (orc_uint8) var45 + 1) >> 1; + /* 10: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var51; + _dest.x2[1] = var45; + var41.i = _dest.i; + } + /* 11: storew */ + ptr1[i] = var41; + } + +} + +#else +static void +_backup_gst_bayer_horiz_upsample (OrcExecutor * ORC_RESTRICT ex) +{ + int i; + int n = ex->n; + orc_union16 *ORC_RESTRICT ptr0; + orc_union16 *ORC_RESTRICT ptr1; + const orc_union16 *ORC_RESTRICT ptr4; + orc_union16 var39; + orc_union16 var40; + orc_union16 var41; + orc_union16 var42; + orc_int8 var43; + orc_int8 var44; + orc_int8 var45; + orc_int8 var46; + orc_union16 var47; + orc_int8 var48; + orc_int8 var49; + orc_int8 var50; + orc_int8 var51; + + ptr0 = (orc_union16 *) ex->arrays[0]; + ptr1 = (orc_union16 *) ex->arrays[1]; + ptr4 = (orc_union16 *) ex->arrays[4]; + + + for (i = 0; i < n; i++) { + /* 0: loadoffw */ + var42 = ptr4[i + -1]; + /* 1: splitwb */ + { + orc_union16 _src; + _src.i = var42.i; + var43 = _src.x2[1]; + var44 = _src.x2[0]; + } + /* 2: loadw */ + var39 = ptr4[i]; + /* 3: splitwb */ + { + orc_union16 _src; + _src.i = var39.i; + var45 = _src.x2[1]; + var46 = _src.x2[0]; + } + /* 4: loadoffw */ + var47 = ptr4[i + 1]; + /* 5: splitwb */ + { + orc_union16 _src; + _src.i = var47.i; + var48 = _src.x2[1]; + var49 = _src.x2[0]; + } + /* 6: avgub */ + var50 = ((orc_uint8) var46 + (orc_uint8) var49 + 1) >> 1; + /* 7: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var46; + _dest.x2[1] = var50; + var40.i = _dest.i; + } + /* 8: storew */ + ptr0[i] = var40; + /* 9: avgub */ + var51 = ((orc_uint8) var43 + (orc_uint8) var45 + 1) >> 1; + /* 10: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var51; + _dest.x2[1] = var45; + var41.i = _dest.i; + } + /* 11: storew */ + ptr1[i] = var41; + } + +} + +void +gst_bayer_horiz_upsample (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + const guint8 * ORC_RESTRICT s1, int n) +{ + OrcExecutor _ex, *ex = &_ex; + static int p_inited = 0; + static OrcProgram *p = 0; + void (*func) (OrcExecutor *); + + if (!p_inited) { + orc_once_mutex_lock (); + if (!p_inited) { + + p = orc_program_new (); + orc_program_set_name (p, "gst_bayer_horiz_upsample"); + orc_program_set_backup_function (p, _backup_gst_bayer_horiz_upsample); + orc_program_add_destination (p, 2, "d1"); + orc_program_add_destination (p, 2, "d2"); + orc_program_add_source (p, 2, "s1"); + orc_program_add_constant (p, 4, 0xffffffff, "c1"); + orc_program_add_constant (p, 4, 0x00000001, "c2"); + orc_program_add_temporary (p, 2, "t1"); + orc_program_add_temporary (p, 1, "t2"); + orc_program_add_temporary (p, 1, "t3"); + orc_program_add_temporary (p, 1, "t4"); + orc_program_add_temporary (p, 1, "t5"); + orc_program_add_temporary (p, 1, "t6"); + orc_program_add_temporary (p, 1, "t7"); + + orc_program_append_2 (p, "loadoffw", 0, ORC_VAR_T1, ORC_VAR_S1, + ORC_VAR_C1, ORC_VAR_D1); + orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T3, ORC_VAR_T2, ORC_VAR_T1, + ORC_VAR_D1); + orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_S1, + ORC_VAR_D1); + orc_program_append_2 (p, "loadoffw", 0, ORC_VAR_T1, ORC_VAR_S1, + ORC_VAR_C2, ORC_VAR_D1); + orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T7, ORC_VAR_T6, ORC_VAR_T1, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 0, ORC_VAR_T6, ORC_VAR_T4, ORC_VAR_T6, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 0, ORC_VAR_D1, ORC_VAR_T4, ORC_VAR_T6, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 0, ORC_VAR_T3, ORC_VAR_T3, ORC_VAR_T5, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 0, ORC_VAR_D2, ORC_VAR_T3, ORC_VAR_T5, + ORC_VAR_D1); + + orc_program_compile (p); + } + p_inited = TRUE; + orc_once_mutex_unlock (); + } + ex->program = p; + + ex->n = n; + ex->arrays[ORC_VAR_D1] = d1; + ex->arrays[ORC_VAR_D2] = d2; + ex->arrays[ORC_VAR_S1] = (void *) s1; + + func = p->code_exec; + func (ex); +} +#endif + + +/* gst_bayer_merge_bg_bgra */ +#ifdef DISABLE_ORC +void +gst_bayer_merge_bg_bgra (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n) +{ + int i; + orc_union64 *ORC_RESTRICT ptr0; + const orc_union16 *ORC_RESTRICT ptr4; + const orc_union16 *ORC_RESTRICT ptr5; + const orc_union16 *ORC_RESTRICT ptr6; + const orc_union16 *ORC_RESTRICT ptr7; + const orc_union16 *ORC_RESTRICT ptr8; + const orc_union16 *ORC_RESTRICT ptr9; + orc_union16 var37; + orc_union16 var38; + orc_union16 var39; + orc_union16 var40; + orc_union16 var41; + orc_union16 var42; + orc_union16 var43; + orc_union16 var44; + orc_union16 var45; + orc_union64 var46; + orc_union16 var47; + orc_union16 var48; + orc_union16 var49; + orc_union16 var50; + orc_union16 var51; + orc_union16 var52; + orc_union16 var53; + orc_union32 var54; + orc_union32 var55; + + ptr0 = (orc_union64 *) d1; + ptr4 = (orc_union16 *) s1; + ptr5 = (orc_union16 *) s2; + ptr6 = (orc_union16 *) s3; + ptr7 = (orc_union16 *) s4; + ptr8 = (orc_union16 *) s5; + ptr9 = (orc_union16 *) s6; + + /* 9: loadpw */ + var42.i = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + /* 11: loadpw */ + var43.i = (int) 0x0000ff00; /* 65280 or 3.22526e-319f */ + /* 16: loadpb */ + var45.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var45.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + + for (i = 0; i < n; i++) { + /* 0: loadw */ + var37 = ptr5[i]; + /* 1: loadw */ + var38 = ptr9[i]; + /* 2: avgub */ + var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1; + var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1; + /* 3: loadw */ + var39 = ptr4[i]; + /* 4: loadw */ + var40 = ptr8[i]; + /* 5: avgub */ + var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1; + var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1; + /* 6: loadw */ + var41 = ptr7[i]; + /* 7: copyw */ + var49.i = var41.i; + /* 8: avgub */ + var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1; + var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1; + /* 10: andw */ + var51.i = var50.i & var42.i; + /* 12: andw */ + var52.i = var49.i & var43.i; + /* 13: orw */ + var53.i = var52.i | var51.i; + /* 14: loadw */ + var44 = ptr6[i]; + /* 15: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var53.x2[0]; + var54.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var53.x2[1]; + var54.x2[1] = _dest.i; + } + /* 17: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var47.x2[0]; + _dest.x2[1] = var45.x2[0]; + var55.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var47.x2[1]; + _dest.x2[1] = var45.x2[1]; + var55.x2[1] = _dest.i; + } + /* 18: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[0]; + _dest.x2[1] = var55.x2[0]; + var46.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[1]; + _dest.x2[1] = var55.x2[1]; + var46.x2[1] = _dest.i; + } + /* 19: storeq */ + ptr0[i] = var46; + } + +} + +#else +static void +_backup_gst_bayer_merge_bg_bgra (OrcExecutor * ORC_RESTRICT ex) +{ + int i; + int n = ex->n; + orc_union64 *ORC_RESTRICT ptr0; + const orc_union16 *ORC_RESTRICT ptr4; + const orc_union16 *ORC_RESTRICT ptr5; + const orc_union16 *ORC_RESTRICT ptr6; + const orc_union16 *ORC_RESTRICT ptr7; + const orc_union16 *ORC_RESTRICT ptr8; + const orc_union16 *ORC_RESTRICT ptr9; + orc_union16 var37; + orc_union16 var38; + orc_union16 var39; + orc_union16 var40; + orc_union16 var41; + orc_union16 var42; + orc_union16 var43; + orc_union16 var44; + orc_union16 var45; + orc_union64 var46; + orc_union16 var47; + orc_union16 var48; + orc_union16 var49; + orc_union16 var50; + orc_union16 var51; + orc_union16 var52; + orc_union16 var53; + orc_union32 var54; + orc_union32 var55; + + ptr0 = (orc_union64 *) ex->arrays[0]; + ptr4 = (orc_union16 *) ex->arrays[4]; + ptr5 = (orc_union16 *) ex->arrays[5]; + ptr6 = (orc_union16 *) ex->arrays[6]; + ptr7 = (orc_union16 *) ex->arrays[7]; + ptr8 = (orc_union16 *) ex->arrays[8]; + ptr9 = (orc_union16 *) ex->arrays[9]; + + /* 9: loadpw */ + var42.i = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + /* 11: loadpw */ + var43.i = (int) 0x0000ff00; /* 65280 or 3.22526e-319f */ + /* 16: loadpb */ + var45.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var45.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + + for (i = 0; i < n; i++) { + /* 0: loadw */ + var37 = ptr5[i]; + /* 1: loadw */ + var38 = ptr9[i]; + /* 2: avgub */ + var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1; + var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1; + /* 3: loadw */ + var39 = ptr4[i]; + /* 4: loadw */ + var40 = ptr8[i]; + /* 5: avgub */ + var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1; + var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1; + /* 6: loadw */ + var41 = ptr7[i]; + /* 7: copyw */ + var49.i = var41.i; + /* 8: avgub */ + var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1; + var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1; + /* 10: andw */ + var51.i = var50.i & var42.i; + /* 12: andw */ + var52.i = var49.i & var43.i; + /* 13: orw */ + var53.i = var52.i | var51.i; + /* 14: loadw */ + var44 = ptr6[i]; + /* 15: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var53.x2[0]; + var54.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var53.x2[1]; + var54.x2[1] = _dest.i; + } + /* 17: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var47.x2[0]; + _dest.x2[1] = var45.x2[0]; + var55.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var47.x2[1]; + _dest.x2[1] = var45.x2[1]; + var55.x2[1] = _dest.i; + } + /* 18: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[0]; + _dest.x2[1] = var55.x2[0]; + var46.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[1]; + _dest.x2[1] = var55.x2[1]; + var46.x2[1] = _dest.i; + } + /* 19: storeq */ + ptr0[i] = var46; + } + +} + +void +gst_bayer_merge_bg_bgra (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n) +{ + OrcExecutor _ex, *ex = &_ex; + static int p_inited = 0; + static OrcProgram *p = 0; + void (*func) (OrcExecutor *); + + if (!p_inited) { + orc_once_mutex_lock (); + if (!p_inited) { + + p = orc_program_new (); + orc_program_set_name (p, "gst_bayer_merge_bg_bgra"); + orc_program_set_backup_function (p, _backup_gst_bayer_merge_bg_bgra); + orc_program_add_destination (p, 8, "d1"); + orc_program_add_source (p, 2, "s1"); + orc_program_add_source (p, 2, "s2"); + orc_program_add_source (p, 2, "s3"); + orc_program_add_source (p, 2, "s4"); + orc_program_add_source (p, 2, "s5"); + orc_program_add_source (p, 2, "s6"); + orc_program_add_constant (p, 4, 0x000000ff, "c1"); + orc_program_add_constant (p, 4, 0x0000ff00, "c2"); + orc_program_add_temporary (p, 4, "t1"); + orc_program_add_temporary (p, 4, "t2"); + orc_program_add_temporary (p, 2, "t3"); + orc_program_add_temporary (p, 2, "t4"); + orc_program_add_temporary (p, 2, "t5"); + + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T3, ORC_VAR_S2, ORC_VAR_S6, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S1, ORC_VAR_S5, + ORC_VAR_D1); + orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S4, ORC_VAR_D1, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5, + ORC_VAR_D1); + orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1, + ORC_VAR_D1); + orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2, + ORC_VAR_D1); + orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_S3, ORC_VAR_T4, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_T3, ORC_VAR_C1, + ORC_VAR_D1); + orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1, + ORC_VAR_D1); + + orc_program_compile (p); + } + p_inited = TRUE; + orc_once_mutex_unlock (); + } + ex->program = p; + + ex->n = n; + ex->arrays[ORC_VAR_D1] = d1; + ex->arrays[ORC_VAR_S1] = (void *) s1; + ex->arrays[ORC_VAR_S2] = (void *) s2; + ex->arrays[ORC_VAR_S3] = (void *) s3; + ex->arrays[ORC_VAR_S4] = (void *) s4; + ex->arrays[ORC_VAR_S5] = (void *) s5; + ex->arrays[ORC_VAR_S6] = (void *) s6; + + func = p->code_exec; + func (ex); +} +#endif + + +/* gst_bayer_merge_gr_bgra */ +#ifdef DISABLE_ORC +void +gst_bayer_merge_gr_bgra (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n) +{ + int i; + orc_union64 *ORC_RESTRICT ptr0; + const orc_union16 *ORC_RESTRICT ptr4; + const orc_union16 *ORC_RESTRICT ptr5; + const orc_union16 *ORC_RESTRICT ptr6; + const orc_union16 *ORC_RESTRICT ptr7; + const orc_union16 *ORC_RESTRICT ptr8; + const orc_union16 *ORC_RESTRICT ptr9; + orc_union16 var37; + orc_union16 var38; + orc_union16 var39; + orc_union16 var40; + orc_union16 var41; + orc_union16 var42; + orc_union16 var43; + orc_union16 var44; + orc_union16 var45; + orc_union64 var46; + orc_union16 var47; + orc_union16 var48; + orc_union16 var49; + orc_union16 var50; + orc_union16 var51; + orc_union16 var52; + orc_union16 var53; + orc_union32 var54; + orc_union32 var55; + + ptr0 = (orc_union64 *) d1; + ptr4 = (orc_union16 *) s1; + ptr5 = (orc_union16 *) s2; + ptr6 = (orc_union16 *) s3; + ptr7 = (orc_union16 *) s4; + ptr8 = (orc_union16 *) s5; + ptr9 = (orc_union16 *) s6; + + /* 9: loadpw */ + var42.i = (int) 0x0000ff00; /* 65280 or 3.22526e-319f */ + /* 11: loadpw */ + var43.i = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + /* 16: loadpb */ + var45.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var45.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + + for (i = 0; i < n; i++) { + /* 0: loadw */ + var37 = ptr4[i]; + /* 1: loadw */ + var38 = ptr8[i]; + /* 2: avgub */ + var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1; + var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1; + /* 3: loadw */ + var39 = ptr5[i]; + /* 4: loadw */ + var40 = ptr9[i]; + /* 5: avgub */ + var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1; + var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1; + /* 6: loadw */ + var41 = ptr6[i]; + /* 7: copyw */ + var49.i = var41.i; + /* 8: avgub */ + var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1; + var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1; + /* 10: andw */ + var51.i = var50.i & var42.i; + /* 12: andw */ + var52.i = var49.i & var43.i; + /* 13: orw */ + var53.i = var52.i | var51.i; + /* 14: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var47.x2[0]; + _dest.x2[1] = var53.x2[0]; + var54.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var47.x2[1]; + _dest.x2[1] = var53.x2[1]; + var54.x2[1] = _dest.i; + } + /* 15: loadw */ + var44 = ptr7[i]; + /* 17: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var45.x2[0]; + var55.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var45.x2[1]; + var55.x2[1] = _dest.i; + } + /* 18: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[0]; + _dest.x2[1] = var55.x2[0]; + var46.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[1]; + _dest.x2[1] = var55.x2[1]; + var46.x2[1] = _dest.i; + } + /* 19: storeq */ + ptr0[i] = var46; + } + +} + +#else +static void +_backup_gst_bayer_merge_gr_bgra (OrcExecutor * ORC_RESTRICT ex) +{ + int i; + int n = ex->n; + orc_union64 *ORC_RESTRICT ptr0; + const orc_union16 *ORC_RESTRICT ptr4; + const orc_union16 *ORC_RESTRICT ptr5; + const orc_union16 *ORC_RESTRICT ptr6; + const orc_union16 *ORC_RESTRICT ptr7; + const orc_union16 *ORC_RESTRICT ptr8; + const orc_union16 *ORC_RESTRICT ptr9; + orc_union16 var37; + orc_union16 var38; + orc_union16 var39; + orc_union16 var40; + orc_union16 var41; + orc_union16 var42; + orc_union16 var43; + orc_union16 var44; + orc_union16 var45; + orc_union64 var46; + orc_union16 var47; + orc_union16 var48; + orc_union16 var49; + orc_union16 var50; + orc_union16 var51; + orc_union16 var52; + orc_union16 var53; + orc_union32 var54; + orc_union32 var55; + + ptr0 = (orc_union64 *) ex->arrays[0]; + ptr4 = (orc_union16 *) ex->arrays[4]; + ptr5 = (orc_union16 *) ex->arrays[5]; + ptr6 = (orc_union16 *) ex->arrays[6]; + ptr7 = (orc_union16 *) ex->arrays[7]; + ptr8 = (orc_union16 *) ex->arrays[8]; + ptr9 = (orc_union16 *) ex->arrays[9]; + + /* 9: loadpw */ + var42.i = (int) 0x0000ff00; /* 65280 or 3.22526e-319f */ + /* 11: loadpw */ + var43.i = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + /* 16: loadpb */ + var45.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var45.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + + for (i = 0; i < n; i++) { + /* 0: loadw */ + var37 = ptr4[i]; + /* 1: loadw */ + var38 = ptr8[i]; + /* 2: avgub */ + var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1; + var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1; + /* 3: loadw */ + var39 = ptr5[i]; + /* 4: loadw */ + var40 = ptr9[i]; + /* 5: avgub */ + var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1; + var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1; + /* 6: loadw */ + var41 = ptr6[i]; + /* 7: copyw */ + var49.i = var41.i; + /* 8: avgub */ + var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1; + var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1; + /* 10: andw */ + var51.i = var50.i & var42.i; + /* 12: andw */ + var52.i = var49.i & var43.i; + /* 13: orw */ + var53.i = var52.i | var51.i; + /* 14: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var47.x2[0]; + _dest.x2[1] = var53.x2[0]; + var54.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var47.x2[1]; + _dest.x2[1] = var53.x2[1]; + var54.x2[1] = _dest.i; + } + /* 15: loadw */ + var44 = ptr7[i]; + /* 17: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var45.x2[0]; + var55.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var45.x2[1]; + var55.x2[1] = _dest.i; + } + /* 18: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[0]; + _dest.x2[1] = var55.x2[0]; + var46.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[1]; + _dest.x2[1] = var55.x2[1]; + var46.x2[1] = _dest.i; + } + /* 19: storeq */ + ptr0[i] = var46; + } + +} + +void +gst_bayer_merge_gr_bgra (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n) +{ + OrcExecutor _ex, *ex = &_ex; + static int p_inited = 0; + static OrcProgram *p = 0; + void (*func) (OrcExecutor *); + + if (!p_inited) { + orc_once_mutex_lock (); + if (!p_inited) { + + p = orc_program_new (); + orc_program_set_name (p, "gst_bayer_merge_gr_bgra"); + orc_program_set_backup_function (p, _backup_gst_bayer_merge_gr_bgra); + orc_program_add_destination (p, 8, "d1"); + orc_program_add_source (p, 2, "s1"); + orc_program_add_source (p, 2, "s2"); + orc_program_add_source (p, 2, "s3"); + orc_program_add_source (p, 2, "s4"); + orc_program_add_source (p, 2, "s5"); + orc_program_add_source (p, 2, "s6"); + orc_program_add_constant (p, 4, 0x0000ff00, "c1"); + orc_program_add_constant (p, 4, 0x000000ff, "c2"); + orc_program_add_temporary (p, 4, "t1"); + orc_program_add_temporary (p, 4, "t2"); + orc_program_add_temporary (p, 2, "t3"); + orc_program_add_temporary (p, 2, "t4"); + orc_program_add_temporary (p, 2, "t5"); + + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_S5, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S2, ORC_VAR_S6, + ORC_VAR_D1); + orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S3, ORC_VAR_D1, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5, + ORC_VAR_D1); + orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1, + ORC_VAR_D1); + orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2, + ORC_VAR_D1); + orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_T4, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_S4, ORC_VAR_C2, + ORC_VAR_D1); + orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1, + ORC_VAR_D1); + + orc_program_compile (p); + } + p_inited = TRUE; + orc_once_mutex_unlock (); + } + ex->program = p; + + ex->n = n; + ex->arrays[ORC_VAR_D1] = d1; + ex->arrays[ORC_VAR_S1] = (void *) s1; + ex->arrays[ORC_VAR_S2] = (void *) s2; + ex->arrays[ORC_VAR_S3] = (void *) s3; + ex->arrays[ORC_VAR_S4] = (void *) s4; + ex->arrays[ORC_VAR_S5] = (void *) s5; + ex->arrays[ORC_VAR_S6] = (void *) s6; + + func = p->code_exec; + func (ex); +} +#endif + + +/* gst_bayer_merge_bg_abgr */ +#ifdef DISABLE_ORC +void +gst_bayer_merge_bg_abgr (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n) +{ + int i; + orc_union64 *ORC_RESTRICT ptr0; + const orc_union16 *ORC_RESTRICT ptr4; + const orc_union16 *ORC_RESTRICT ptr5; + const orc_union16 *ORC_RESTRICT ptr6; + const orc_union16 *ORC_RESTRICT ptr7; + const orc_union16 *ORC_RESTRICT ptr8; + const orc_union16 *ORC_RESTRICT ptr9; + orc_union16 var37; + orc_union16 var38; + orc_union16 var39; + orc_union16 var40; + orc_union16 var41; + orc_union16 var42; + orc_union16 var43; + orc_union16 var44; + orc_union16 var45; + orc_union64 var46; + orc_union16 var47; + orc_union16 var48; + orc_union16 var49; + orc_union16 var50; + orc_union16 var51; + orc_union16 var52; + orc_union16 var53; + orc_union32 var54; + orc_union32 var55; + + ptr0 = (orc_union64 *) d1; + ptr4 = (orc_union16 *) s1; + ptr5 = (orc_union16 *) s2; + ptr6 = (orc_union16 *) s3; + ptr7 = (orc_union16 *) s4; + ptr8 = (orc_union16 *) s5; + ptr9 = (orc_union16 *) s6; + + /* 9: loadpw */ + var42.i = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + /* 11: loadpw */ + var43.i = (int) 0x0000ff00; /* 65280 or 3.22526e-319f */ + /* 14: loadpb */ + var44.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var44.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + + for (i = 0; i < n; i++) { + /* 0: loadw */ + var37 = ptr5[i]; + /* 1: loadw */ + var38 = ptr9[i]; + /* 2: avgub */ + var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1; + var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1; + /* 3: loadw */ + var39 = ptr4[i]; + /* 4: loadw */ + var40 = ptr8[i]; + /* 5: avgub */ + var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1; + var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1; + /* 6: loadw */ + var41 = ptr7[i]; + /* 7: copyw */ + var49.i = var41.i; + /* 8: avgub */ + var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1; + var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1; + /* 10: andw */ + var51.i = var50.i & var42.i; + /* 12: andw */ + var52.i = var49.i & var43.i; + /* 13: orw */ + var53.i = var52.i | var51.i; + /* 15: loadw */ + var45 = ptr6[i]; + /* 16: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var45.x2[0]; + var54.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var45.x2[1]; + var54.x2[1] = _dest.i; + } + /* 17: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var53.x2[0]; + _dest.x2[1] = var47.x2[0]; + var55.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var53.x2[1]; + _dest.x2[1] = var47.x2[1]; + var55.x2[1] = _dest.i; + } + /* 18: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[0]; + _dest.x2[1] = var55.x2[0]; + var46.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[1]; + _dest.x2[1] = var55.x2[1]; + var46.x2[1] = _dest.i; + } + /* 19: storeq */ + ptr0[i] = var46; + } + +} + +#else +static void +_backup_gst_bayer_merge_bg_abgr (OrcExecutor * ORC_RESTRICT ex) +{ + int i; + int n = ex->n; + orc_union64 *ORC_RESTRICT ptr0; + const orc_union16 *ORC_RESTRICT ptr4; + const orc_union16 *ORC_RESTRICT ptr5; + const orc_union16 *ORC_RESTRICT ptr6; + const orc_union16 *ORC_RESTRICT ptr7; + const orc_union16 *ORC_RESTRICT ptr8; + const orc_union16 *ORC_RESTRICT ptr9; + orc_union16 var37; + orc_union16 var38; + orc_union16 var39; + orc_union16 var40; + orc_union16 var41; + orc_union16 var42; + orc_union16 var43; + orc_union16 var44; + orc_union16 var45; + orc_union64 var46; + orc_union16 var47; + orc_union16 var48; + orc_union16 var49; + orc_union16 var50; + orc_union16 var51; + orc_union16 var52; + orc_union16 var53; + orc_union32 var54; + orc_union32 var55; + + ptr0 = (orc_union64 *) ex->arrays[0]; + ptr4 = (orc_union16 *) ex->arrays[4]; + ptr5 = (orc_union16 *) ex->arrays[5]; + ptr6 = (orc_union16 *) ex->arrays[6]; + ptr7 = (orc_union16 *) ex->arrays[7]; + ptr8 = (orc_union16 *) ex->arrays[8]; + ptr9 = (orc_union16 *) ex->arrays[9]; + + /* 9: loadpw */ + var42.i = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + /* 11: loadpw */ + var43.i = (int) 0x0000ff00; /* 65280 or 3.22526e-319f */ + /* 14: loadpb */ + var44.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var44.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + + for (i = 0; i < n; i++) { + /* 0: loadw */ + var37 = ptr5[i]; + /* 1: loadw */ + var38 = ptr9[i]; + /* 2: avgub */ + var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1; + var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1; + /* 3: loadw */ + var39 = ptr4[i]; + /* 4: loadw */ + var40 = ptr8[i]; + /* 5: avgub */ + var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1; + var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1; + /* 6: loadw */ + var41 = ptr7[i]; + /* 7: copyw */ + var49.i = var41.i; + /* 8: avgub */ + var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1; + var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1; + /* 10: andw */ + var51.i = var50.i & var42.i; + /* 12: andw */ + var52.i = var49.i & var43.i; + /* 13: orw */ + var53.i = var52.i | var51.i; + /* 15: loadw */ + var45 = ptr6[i]; + /* 16: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var45.x2[0]; + var54.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var45.x2[1]; + var54.x2[1] = _dest.i; + } + /* 17: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var53.x2[0]; + _dest.x2[1] = var47.x2[0]; + var55.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var53.x2[1]; + _dest.x2[1] = var47.x2[1]; + var55.x2[1] = _dest.i; + } + /* 18: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[0]; + _dest.x2[1] = var55.x2[0]; + var46.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[1]; + _dest.x2[1] = var55.x2[1]; + var46.x2[1] = _dest.i; + } + /* 19: storeq */ + ptr0[i] = var46; + } + +} + +void +gst_bayer_merge_bg_abgr (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n) +{ + OrcExecutor _ex, *ex = &_ex; + static int p_inited = 0; + static OrcProgram *p = 0; + void (*func) (OrcExecutor *); + + if (!p_inited) { + orc_once_mutex_lock (); + if (!p_inited) { + + p = orc_program_new (); + orc_program_set_name (p, "gst_bayer_merge_bg_abgr"); + orc_program_set_backup_function (p, _backup_gst_bayer_merge_bg_abgr); + orc_program_add_destination (p, 8, "d1"); + orc_program_add_source (p, 2, "s1"); + orc_program_add_source (p, 2, "s2"); + orc_program_add_source (p, 2, "s3"); + orc_program_add_source (p, 2, "s4"); + orc_program_add_source (p, 2, "s5"); + orc_program_add_source (p, 2, "s6"); + orc_program_add_constant (p, 4, 0x000000ff, "c1"); + orc_program_add_constant (p, 4, 0x0000ff00, "c2"); + orc_program_add_temporary (p, 4, "t1"); + orc_program_add_temporary (p, 4, "t2"); + orc_program_add_temporary (p, 2, "t3"); + orc_program_add_temporary (p, 2, "t4"); + orc_program_add_temporary (p, 2, "t5"); + + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T3, ORC_VAR_S2, ORC_VAR_S6, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S1, ORC_VAR_S5, + ORC_VAR_D1); + orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S4, ORC_VAR_D1, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5, + ORC_VAR_D1); + orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1, + ORC_VAR_D1); + orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2, + ORC_VAR_D1); + orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_C1, ORC_VAR_S3, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_T4, ORC_VAR_T3, + ORC_VAR_D1); + orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, + ORC_VAR_D1); + + orc_program_compile (p); + } + p_inited = TRUE; + orc_once_mutex_unlock (); + } + ex->program = p; + + ex->n = n; + ex->arrays[ORC_VAR_D1] = d1; + ex->arrays[ORC_VAR_S1] = (void *) s1; + ex->arrays[ORC_VAR_S2] = (void *) s2; + ex->arrays[ORC_VAR_S3] = (void *) s3; + ex->arrays[ORC_VAR_S4] = (void *) s4; + ex->arrays[ORC_VAR_S5] = (void *) s5; + ex->arrays[ORC_VAR_S6] = (void *) s6; + + func = p->code_exec; + func (ex); +} +#endif + + +/* gst_bayer_merge_gr_abgr */ +#ifdef DISABLE_ORC +void +gst_bayer_merge_gr_abgr (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n) +{ + int i; + orc_union64 *ORC_RESTRICT ptr0; + const orc_union16 *ORC_RESTRICT ptr4; + const orc_union16 *ORC_RESTRICT ptr5; + const orc_union16 *ORC_RESTRICT ptr6; + const orc_union16 *ORC_RESTRICT ptr7; + const orc_union16 *ORC_RESTRICT ptr8; + const orc_union16 *ORC_RESTRICT ptr9; + orc_union16 var37; + orc_union16 var38; + orc_union16 var39; + orc_union16 var40; + orc_union16 var41; + orc_union16 var42; + orc_union16 var43; + orc_union16 var44; + orc_union16 var45; + orc_union64 var46; + orc_union16 var47; + orc_union16 var48; + orc_union16 var49; + orc_union16 var50; + orc_union16 var51; + orc_union16 var52; + orc_union16 var53; + orc_union32 var54; + orc_union32 var55; + + ptr0 = (orc_union64 *) d1; + ptr4 = (orc_union16 *) s1; + ptr5 = (orc_union16 *) s2; + ptr6 = (orc_union16 *) s3; + ptr7 = (orc_union16 *) s4; + ptr8 = (orc_union16 *) s5; + ptr9 = (orc_union16 *) s6; + + /* 9: loadpw */ + var42.i = (int) 0x0000ff00; /* 65280 or 3.22526e-319f */ + /* 11: loadpw */ + var43.i = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + /* 14: loadpb */ + var44.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var44.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + + for (i = 0; i < n; i++) { + /* 0: loadw */ + var37 = ptr4[i]; + /* 1: loadw */ + var38 = ptr8[i]; + /* 2: avgub */ + var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1; + var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1; + /* 3: loadw */ + var39 = ptr5[i]; + /* 4: loadw */ + var40 = ptr9[i]; + /* 5: avgub */ + var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1; + var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1; + /* 6: loadw */ + var41 = ptr6[i]; + /* 7: copyw */ + var49.i = var41.i; + /* 8: avgub */ + var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1; + var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1; + /* 10: andw */ + var51.i = var50.i & var42.i; + /* 12: andw */ + var52.i = var49.i & var43.i; + /* 13: orw */ + var53.i = var52.i | var51.i; + /* 15: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var47.x2[0]; + var54.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var47.x2[1]; + var54.x2[1] = _dest.i; + } + /* 16: loadw */ + var45 = ptr7[i]; + /* 17: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var53.x2[0]; + _dest.x2[1] = var45.x2[0]; + var55.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var53.x2[1]; + _dest.x2[1] = var45.x2[1]; + var55.x2[1] = _dest.i; + } + /* 18: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[0]; + _dest.x2[1] = var55.x2[0]; + var46.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[1]; + _dest.x2[1] = var55.x2[1]; + var46.x2[1] = _dest.i; + } + /* 19: storeq */ + ptr0[i] = var46; + } + +} + +#else +static void +_backup_gst_bayer_merge_gr_abgr (OrcExecutor * ORC_RESTRICT ex) +{ + int i; + int n = ex->n; + orc_union64 *ORC_RESTRICT ptr0; + const orc_union16 *ORC_RESTRICT ptr4; + const orc_union16 *ORC_RESTRICT ptr5; + const orc_union16 *ORC_RESTRICT ptr6; + const orc_union16 *ORC_RESTRICT ptr7; + const orc_union16 *ORC_RESTRICT ptr8; + const orc_union16 *ORC_RESTRICT ptr9; + orc_union16 var37; + orc_union16 var38; + orc_union16 var39; + orc_union16 var40; + orc_union16 var41; + orc_union16 var42; + orc_union16 var43; + orc_union16 var44; + orc_union16 var45; + orc_union64 var46; + orc_union16 var47; + orc_union16 var48; + orc_union16 var49; + orc_union16 var50; + orc_union16 var51; + orc_union16 var52; + orc_union16 var53; + orc_union32 var54; + orc_union32 var55; + + ptr0 = (orc_union64 *) ex->arrays[0]; + ptr4 = (orc_union16 *) ex->arrays[4]; + ptr5 = (orc_union16 *) ex->arrays[5]; + ptr6 = (orc_union16 *) ex->arrays[6]; + ptr7 = (orc_union16 *) ex->arrays[7]; + ptr8 = (orc_union16 *) ex->arrays[8]; + ptr9 = (orc_union16 *) ex->arrays[9]; + + /* 9: loadpw */ + var42.i = (int) 0x0000ff00; /* 65280 or 3.22526e-319f */ + /* 11: loadpw */ + var43.i = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + /* 14: loadpb */ + var44.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var44.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + + for (i = 0; i < n; i++) { + /* 0: loadw */ + var37 = ptr4[i]; + /* 1: loadw */ + var38 = ptr8[i]; + /* 2: avgub */ + var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1; + var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1; + /* 3: loadw */ + var39 = ptr5[i]; + /* 4: loadw */ + var40 = ptr9[i]; + /* 5: avgub */ + var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1; + var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1; + /* 6: loadw */ + var41 = ptr6[i]; + /* 7: copyw */ + var49.i = var41.i; + /* 8: avgub */ + var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1; + var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1; + /* 10: andw */ + var51.i = var50.i & var42.i; + /* 12: andw */ + var52.i = var49.i & var43.i; + /* 13: orw */ + var53.i = var52.i | var51.i; + /* 15: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var47.x2[0]; + var54.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var47.x2[1]; + var54.x2[1] = _dest.i; + } + /* 16: loadw */ + var45 = ptr7[i]; + /* 17: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var53.x2[0]; + _dest.x2[1] = var45.x2[0]; + var55.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var53.x2[1]; + _dest.x2[1] = var45.x2[1]; + var55.x2[1] = _dest.i; + } + /* 18: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[0]; + _dest.x2[1] = var55.x2[0]; + var46.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[1]; + _dest.x2[1] = var55.x2[1]; + var46.x2[1] = _dest.i; + } + /* 19: storeq */ + ptr0[i] = var46; + } + +} + +void +gst_bayer_merge_gr_abgr (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n) +{ + OrcExecutor _ex, *ex = &_ex; + static int p_inited = 0; + static OrcProgram *p = 0; + void (*func) (OrcExecutor *); + + if (!p_inited) { + orc_once_mutex_lock (); + if (!p_inited) { + + p = orc_program_new (); + orc_program_set_name (p, "gst_bayer_merge_gr_abgr"); + orc_program_set_backup_function (p, _backup_gst_bayer_merge_gr_abgr); + orc_program_add_destination (p, 8, "d1"); + orc_program_add_source (p, 2, "s1"); + orc_program_add_source (p, 2, "s2"); + orc_program_add_source (p, 2, "s3"); + orc_program_add_source (p, 2, "s4"); + orc_program_add_source (p, 2, "s5"); + orc_program_add_source (p, 2, "s6"); + orc_program_add_constant (p, 4, 0x0000ff00, "c1"); + orc_program_add_constant (p, 4, 0x000000ff, "c2"); + orc_program_add_temporary (p, 4, "t1"); + orc_program_add_temporary (p, 4, "t2"); + orc_program_add_temporary (p, 2, "t3"); + orc_program_add_temporary (p, 2, "t4"); + orc_program_add_temporary (p, 2, "t5"); + + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_S5, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S2, ORC_VAR_S6, + ORC_VAR_D1); + orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S3, ORC_VAR_D1, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5, + ORC_VAR_D1); + orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1, + ORC_VAR_D1); + orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2, + ORC_VAR_D1); + orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_C2, ORC_VAR_T3, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_T4, ORC_VAR_S4, + ORC_VAR_D1); + orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, + ORC_VAR_D1); + + orc_program_compile (p); + } + p_inited = TRUE; + orc_once_mutex_unlock (); + } + ex->program = p; + + ex->n = n; + ex->arrays[ORC_VAR_D1] = d1; + ex->arrays[ORC_VAR_S1] = (void *) s1; + ex->arrays[ORC_VAR_S2] = (void *) s2; + ex->arrays[ORC_VAR_S3] = (void *) s3; + ex->arrays[ORC_VAR_S4] = (void *) s4; + ex->arrays[ORC_VAR_S5] = (void *) s5; + ex->arrays[ORC_VAR_S6] = (void *) s6; + + func = p->code_exec; + func (ex); +} +#endif + + +/* gst_bayer_merge_bg_rgba */ +#ifdef DISABLE_ORC +void +gst_bayer_merge_bg_rgba (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n) +{ + int i; + orc_union64 *ORC_RESTRICT ptr0; + const orc_union16 *ORC_RESTRICT ptr4; + const orc_union16 *ORC_RESTRICT ptr5; + const orc_union16 *ORC_RESTRICT ptr6; + const orc_union16 *ORC_RESTRICT ptr7; + const orc_union16 *ORC_RESTRICT ptr8; + const orc_union16 *ORC_RESTRICT ptr9; + orc_union16 var37; + orc_union16 var38; + orc_union16 var39; + orc_union16 var40; + orc_union16 var41; + orc_union16 var42; + orc_union16 var43; + orc_union16 var44; + orc_union16 var45; + orc_union64 var46; + orc_union16 var47; + orc_union16 var48; + orc_union16 var49; + orc_union16 var50; + orc_union16 var51; + orc_union16 var52; + orc_union16 var53; + orc_union32 var54; + orc_union32 var55; + + ptr0 = (orc_union64 *) d1; + ptr4 = (orc_union16 *) s1; + ptr5 = (orc_union16 *) s2; + ptr6 = (orc_union16 *) s3; + ptr7 = (orc_union16 *) s4; + ptr8 = (orc_union16 *) s5; + ptr9 = (orc_union16 *) s6; + + /* 9: loadpw */ + var42.i = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + /* 11: loadpw */ + var43.i = (int) 0x0000ff00; /* 65280 or 3.22526e-319f */ + /* 16: loadpb */ + var45.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var45.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + + for (i = 0; i < n; i++) { + /* 0: loadw */ + var37 = ptr5[i]; + /* 1: loadw */ + var38 = ptr9[i]; + /* 2: avgub */ + var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1; + var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1; + /* 3: loadw */ + var39 = ptr4[i]; + /* 4: loadw */ + var40 = ptr8[i]; + /* 5: avgub */ + var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1; + var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1; + /* 6: loadw */ + var41 = ptr7[i]; + /* 7: copyw */ + var49.i = var41.i; + /* 8: avgub */ + var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1; + var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1; + /* 10: andw */ + var51.i = var50.i & var42.i; + /* 12: andw */ + var52.i = var49.i & var43.i; + /* 13: orw */ + var53.i = var52.i | var51.i; + /* 14: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var47.x2[0]; + _dest.x2[1] = var53.x2[0]; + var54.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var47.x2[1]; + _dest.x2[1] = var53.x2[1]; + var54.x2[1] = _dest.i; + } + /* 15: loadw */ + var44 = ptr6[i]; + /* 17: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var45.x2[0]; + var55.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var45.x2[1]; + var55.x2[1] = _dest.i; + } + /* 18: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[0]; + _dest.x2[1] = var55.x2[0]; + var46.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[1]; + _dest.x2[1] = var55.x2[1]; + var46.x2[1] = _dest.i; + } + /* 19: storeq */ + ptr0[i] = var46; + } + +} + +#else +static void +_backup_gst_bayer_merge_bg_rgba (OrcExecutor * ORC_RESTRICT ex) +{ + int i; + int n = ex->n; + orc_union64 *ORC_RESTRICT ptr0; + const orc_union16 *ORC_RESTRICT ptr4; + const orc_union16 *ORC_RESTRICT ptr5; + const orc_union16 *ORC_RESTRICT ptr6; + const orc_union16 *ORC_RESTRICT ptr7; + const orc_union16 *ORC_RESTRICT ptr8; + const orc_union16 *ORC_RESTRICT ptr9; + orc_union16 var37; + orc_union16 var38; + orc_union16 var39; + orc_union16 var40; + orc_union16 var41; + orc_union16 var42; + orc_union16 var43; + orc_union16 var44; + orc_union16 var45; + orc_union64 var46; + orc_union16 var47; + orc_union16 var48; + orc_union16 var49; + orc_union16 var50; + orc_union16 var51; + orc_union16 var52; + orc_union16 var53; + orc_union32 var54; + orc_union32 var55; + + ptr0 = (orc_union64 *) ex->arrays[0]; + ptr4 = (orc_union16 *) ex->arrays[4]; + ptr5 = (orc_union16 *) ex->arrays[5]; + ptr6 = (orc_union16 *) ex->arrays[6]; + ptr7 = (orc_union16 *) ex->arrays[7]; + ptr8 = (orc_union16 *) ex->arrays[8]; + ptr9 = (orc_union16 *) ex->arrays[9]; + + /* 9: loadpw */ + var42.i = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + /* 11: loadpw */ + var43.i = (int) 0x0000ff00; /* 65280 or 3.22526e-319f */ + /* 16: loadpb */ + var45.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var45.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + + for (i = 0; i < n; i++) { + /* 0: loadw */ + var37 = ptr5[i]; + /* 1: loadw */ + var38 = ptr9[i]; + /* 2: avgub */ + var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1; + var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1; + /* 3: loadw */ + var39 = ptr4[i]; + /* 4: loadw */ + var40 = ptr8[i]; + /* 5: avgub */ + var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1; + var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1; + /* 6: loadw */ + var41 = ptr7[i]; + /* 7: copyw */ + var49.i = var41.i; + /* 8: avgub */ + var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1; + var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1; + /* 10: andw */ + var51.i = var50.i & var42.i; + /* 12: andw */ + var52.i = var49.i & var43.i; + /* 13: orw */ + var53.i = var52.i | var51.i; + /* 14: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var47.x2[0]; + _dest.x2[1] = var53.x2[0]; + var54.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var47.x2[1]; + _dest.x2[1] = var53.x2[1]; + var54.x2[1] = _dest.i; + } + /* 15: loadw */ + var44 = ptr6[i]; + /* 17: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var45.x2[0]; + var55.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var45.x2[1]; + var55.x2[1] = _dest.i; + } + /* 18: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[0]; + _dest.x2[1] = var55.x2[0]; + var46.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[1]; + _dest.x2[1] = var55.x2[1]; + var46.x2[1] = _dest.i; + } + /* 19: storeq */ + ptr0[i] = var46; + } + +} + +void +gst_bayer_merge_bg_rgba (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n) +{ + OrcExecutor _ex, *ex = &_ex; + static int p_inited = 0; + static OrcProgram *p = 0; + void (*func) (OrcExecutor *); + + if (!p_inited) { + orc_once_mutex_lock (); + if (!p_inited) { + + p = orc_program_new (); + orc_program_set_name (p, "gst_bayer_merge_bg_rgba"); + orc_program_set_backup_function (p, _backup_gst_bayer_merge_bg_rgba); + orc_program_add_destination (p, 8, "d1"); + orc_program_add_source (p, 2, "s1"); + orc_program_add_source (p, 2, "s2"); + orc_program_add_source (p, 2, "s3"); + orc_program_add_source (p, 2, "s4"); + orc_program_add_source (p, 2, "s5"); + orc_program_add_source (p, 2, "s6"); + orc_program_add_constant (p, 4, 0x000000ff, "c1"); + orc_program_add_constant (p, 4, 0x0000ff00, "c2"); + orc_program_add_temporary (p, 4, "t1"); + orc_program_add_temporary (p, 4, "t2"); + orc_program_add_temporary (p, 2, "t3"); + orc_program_add_temporary (p, 2, "t4"); + orc_program_add_temporary (p, 2, "t5"); + + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T3, ORC_VAR_S2, ORC_VAR_S6, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S1, ORC_VAR_S5, + ORC_VAR_D1); + orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S4, ORC_VAR_D1, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5, + ORC_VAR_D1); + orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1, + ORC_VAR_D1); + orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2, + ORC_VAR_D1); + orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_T3, ORC_VAR_T4, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_S3, ORC_VAR_C1, + ORC_VAR_D1); + orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, + ORC_VAR_D1); + + orc_program_compile (p); + } + p_inited = TRUE; + orc_once_mutex_unlock (); + } + ex->program = p; + + ex->n = n; + ex->arrays[ORC_VAR_D1] = d1; + ex->arrays[ORC_VAR_S1] = (void *) s1; + ex->arrays[ORC_VAR_S2] = (void *) s2; + ex->arrays[ORC_VAR_S3] = (void *) s3; + ex->arrays[ORC_VAR_S4] = (void *) s4; + ex->arrays[ORC_VAR_S5] = (void *) s5; + ex->arrays[ORC_VAR_S6] = (void *) s6; + + func = p->code_exec; + func (ex); +} +#endif + + +/* gst_bayer_merge_gr_rgba */ +#ifdef DISABLE_ORC +void +gst_bayer_merge_gr_rgba (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n) +{ + int i; + orc_union64 *ORC_RESTRICT ptr0; + const orc_union16 *ORC_RESTRICT ptr4; + const orc_union16 *ORC_RESTRICT ptr5; + const orc_union16 *ORC_RESTRICT ptr6; + const orc_union16 *ORC_RESTRICT ptr7; + const orc_union16 *ORC_RESTRICT ptr8; + const orc_union16 *ORC_RESTRICT ptr9; + orc_union16 var37; + orc_union16 var38; + orc_union16 var39; + orc_union16 var40; + orc_union16 var41; + orc_union16 var42; + orc_union16 var43; + orc_union16 var44; + orc_union16 var45; + orc_union64 var46; + orc_union16 var47; + orc_union16 var48; + orc_union16 var49; + orc_union16 var50; + orc_union16 var51; + orc_union16 var52; + orc_union16 var53; + orc_union32 var54; + orc_union32 var55; + + ptr0 = (orc_union64 *) d1; + ptr4 = (orc_union16 *) s1; + ptr5 = (orc_union16 *) s2; + ptr6 = (orc_union16 *) s3; + ptr7 = (orc_union16 *) s4; + ptr8 = (orc_union16 *) s5; + ptr9 = (orc_union16 *) s6; + + /* 9: loadpw */ + var42.i = (int) 0x0000ff00; /* 65280 or 3.22526e-319f */ + /* 11: loadpw */ + var43.i = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + /* 16: loadpb */ + var45.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var45.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + + for (i = 0; i < n; i++) { + /* 0: loadw */ + var37 = ptr4[i]; + /* 1: loadw */ + var38 = ptr8[i]; + /* 2: avgub */ + var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1; + var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1; + /* 3: loadw */ + var39 = ptr5[i]; + /* 4: loadw */ + var40 = ptr9[i]; + /* 5: avgub */ + var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1; + var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1; + /* 6: loadw */ + var41 = ptr6[i]; + /* 7: copyw */ + var49.i = var41.i; + /* 8: avgub */ + var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1; + var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1; + /* 10: andw */ + var51.i = var50.i & var42.i; + /* 12: andw */ + var52.i = var49.i & var43.i; + /* 13: orw */ + var53.i = var52.i | var51.i; + /* 14: loadw */ + var44 = ptr7[i]; + /* 15: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var53.x2[0]; + var54.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var53.x2[1]; + var54.x2[1] = _dest.i; + } + /* 17: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var47.x2[0]; + _dest.x2[1] = var45.x2[0]; + var55.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var47.x2[1]; + _dest.x2[1] = var45.x2[1]; + var55.x2[1] = _dest.i; + } + /* 18: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[0]; + _dest.x2[1] = var55.x2[0]; + var46.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[1]; + _dest.x2[1] = var55.x2[1]; + var46.x2[1] = _dest.i; + } + /* 19: storeq */ + ptr0[i] = var46; + } + +} + +#else +static void +_backup_gst_bayer_merge_gr_rgba (OrcExecutor * ORC_RESTRICT ex) +{ + int i; + int n = ex->n; + orc_union64 *ORC_RESTRICT ptr0; + const orc_union16 *ORC_RESTRICT ptr4; + const orc_union16 *ORC_RESTRICT ptr5; + const orc_union16 *ORC_RESTRICT ptr6; + const orc_union16 *ORC_RESTRICT ptr7; + const orc_union16 *ORC_RESTRICT ptr8; + const orc_union16 *ORC_RESTRICT ptr9; + orc_union16 var37; + orc_union16 var38; + orc_union16 var39; + orc_union16 var40; + orc_union16 var41; + orc_union16 var42; + orc_union16 var43; + orc_union16 var44; + orc_union16 var45; + orc_union64 var46; + orc_union16 var47; + orc_union16 var48; + orc_union16 var49; + orc_union16 var50; + orc_union16 var51; + orc_union16 var52; + orc_union16 var53; + orc_union32 var54; + orc_union32 var55; + + ptr0 = (orc_union64 *) ex->arrays[0]; + ptr4 = (orc_union16 *) ex->arrays[4]; + ptr5 = (orc_union16 *) ex->arrays[5]; + ptr6 = (orc_union16 *) ex->arrays[6]; + ptr7 = (orc_union16 *) ex->arrays[7]; + ptr8 = (orc_union16 *) ex->arrays[8]; + ptr9 = (orc_union16 *) ex->arrays[9]; + + /* 9: loadpw */ + var42.i = (int) 0x0000ff00; /* 65280 or 3.22526e-319f */ + /* 11: loadpw */ + var43.i = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + /* 16: loadpb */ + var45.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var45.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + + for (i = 0; i < n; i++) { + /* 0: loadw */ + var37 = ptr4[i]; + /* 1: loadw */ + var38 = ptr8[i]; + /* 2: avgub */ + var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1; + var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1; + /* 3: loadw */ + var39 = ptr5[i]; + /* 4: loadw */ + var40 = ptr9[i]; + /* 5: avgub */ + var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1; + var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1; + /* 6: loadw */ + var41 = ptr6[i]; + /* 7: copyw */ + var49.i = var41.i; + /* 8: avgub */ + var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1; + var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1; + /* 10: andw */ + var51.i = var50.i & var42.i; + /* 12: andw */ + var52.i = var49.i & var43.i; + /* 13: orw */ + var53.i = var52.i | var51.i; + /* 14: loadw */ + var44 = ptr7[i]; + /* 15: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var53.x2[0]; + var54.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var53.x2[1]; + var54.x2[1] = _dest.i; + } + /* 17: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var47.x2[0]; + _dest.x2[1] = var45.x2[0]; + var55.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var47.x2[1]; + _dest.x2[1] = var45.x2[1]; + var55.x2[1] = _dest.i; + } + /* 18: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[0]; + _dest.x2[1] = var55.x2[0]; + var46.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[1]; + _dest.x2[1] = var55.x2[1]; + var46.x2[1] = _dest.i; + } + /* 19: storeq */ + ptr0[i] = var46; + } + +} + +void +gst_bayer_merge_gr_rgba (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n) +{ + OrcExecutor _ex, *ex = &_ex; + static int p_inited = 0; + static OrcProgram *p = 0; + void (*func) (OrcExecutor *); + + if (!p_inited) { + orc_once_mutex_lock (); + if (!p_inited) { + + p = orc_program_new (); + orc_program_set_name (p, "gst_bayer_merge_gr_rgba"); + orc_program_set_backup_function (p, _backup_gst_bayer_merge_gr_rgba); + orc_program_add_destination (p, 8, "d1"); + orc_program_add_source (p, 2, "s1"); + orc_program_add_source (p, 2, "s2"); + orc_program_add_source (p, 2, "s3"); + orc_program_add_source (p, 2, "s4"); + orc_program_add_source (p, 2, "s5"); + orc_program_add_source (p, 2, "s6"); + orc_program_add_constant (p, 4, 0x0000ff00, "c1"); + orc_program_add_constant (p, 4, 0x000000ff, "c2"); + orc_program_add_temporary (p, 4, "t1"); + orc_program_add_temporary (p, 4, "t2"); + orc_program_add_temporary (p, 2, "t3"); + orc_program_add_temporary (p, 2, "t4"); + orc_program_add_temporary (p, 2, "t5"); + + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_S5, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S2, ORC_VAR_S6, + ORC_VAR_D1); + orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S3, ORC_VAR_D1, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5, + ORC_VAR_D1); + orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1, + ORC_VAR_D1); + orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2, + ORC_VAR_D1); + orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_S4, ORC_VAR_T4, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_C2, + ORC_VAR_D1); + orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, + ORC_VAR_D1); + + orc_program_compile (p); + } + p_inited = TRUE; + orc_once_mutex_unlock (); + } + ex->program = p; + + ex->n = n; + ex->arrays[ORC_VAR_D1] = d1; + ex->arrays[ORC_VAR_S1] = (void *) s1; + ex->arrays[ORC_VAR_S2] = (void *) s2; + ex->arrays[ORC_VAR_S3] = (void *) s3; + ex->arrays[ORC_VAR_S4] = (void *) s4; + ex->arrays[ORC_VAR_S5] = (void *) s5; + ex->arrays[ORC_VAR_S6] = (void *) s6; + + func = p->code_exec; + func (ex); +} +#endif + + +/* gst_bayer_merge_bg_argb */ +#ifdef DISABLE_ORC +void +gst_bayer_merge_bg_argb (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n) +{ + int i; + orc_union64 *ORC_RESTRICT ptr0; + const orc_union16 *ORC_RESTRICT ptr4; + const orc_union16 *ORC_RESTRICT ptr5; + const orc_union16 *ORC_RESTRICT ptr6; + const orc_union16 *ORC_RESTRICT ptr7; + const orc_union16 *ORC_RESTRICT ptr8; + const orc_union16 *ORC_RESTRICT ptr9; + orc_union16 var37; + orc_union16 var38; + orc_union16 var39; + orc_union16 var40; + orc_union16 var41; + orc_union16 var42; + orc_union16 var43; + orc_union16 var44; + orc_union16 var45; + orc_union64 var46; + orc_union16 var47; + orc_union16 var48; + orc_union16 var49; + orc_union16 var50; + orc_union16 var51; + orc_union16 var52; + orc_union16 var53; + orc_union32 var54; + orc_union32 var55; + + ptr0 = (orc_union64 *) d1; + ptr4 = (orc_union16 *) s1; + ptr5 = (orc_union16 *) s2; + ptr6 = (orc_union16 *) s3; + ptr7 = (orc_union16 *) s4; + ptr8 = (orc_union16 *) s5; + ptr9 = (orc_union16 *) s6; + + /* 9: loadpw */ + var42.i = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + /* 11: loadpw */ + var43.i = (int) 0x0000ff00; /* 65280 or 3.22526e-319f */ + /* 14: loadpb */ + var44.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var44.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + + for (i = 0; i < n; i++) { + /* 0: loadw */ + var37 = ptr5[i]; + /* 1: loadw */ + var38 = ptr9[i]; + /* 2: avgub */ + var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1; + var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1; + /* 3: loadw */ + var39 = ptr4[i]; + /* 4: loadw */ + var40 = ptr8[i]; + /* 5: avgub */ + var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1; + var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1; + /* 6: loadw */ + var41 = ptr7[i]; + /* 7: copyw */ + var49.i = var41.i; + /* 8: avgub */ + var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1; + var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1; + /* 10: andw */ + var51.i = var50.i & var42.i; + /* 12: andw */ + var52.i = var49.i & var43.i; + /* 13: orw */ + var53.i = var52.i | var51.i; + /* 15: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var47.x2[0]; + var54.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var47.x2[1]; + var54.x2[1] = _dest.i; + } + /* 16: loadw */ + var45 = ptr6[i]; + /* 17: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var53.x2[0]; + _dest.x2[1] = var45.x2[0]; + var55.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var53.x2[1]; + _dest.x2[1] = var45.x2[1]; + var55.x2[1] = _dest.i; + } + /* 18: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[0]; + _dest.x2[1] = var55.x2[0]; + var46.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[1]; + _dest.x2[1] = var55.x2[1]; + var46.x2[1] = _dest.i; + } + /* 19: storeq */ + ptr0[i] = var46; + } + +} + +#else +static void +_backup_gst_bayer_merge_bg_argb (OrcExecutor * ORC_RESTRICT ex) +{ + int i; + int n = ex->n; + orc_union64 *ORC_RESTRICT ptr0; + const orc_union16 *ORC_RESTRICT ptr4; + const orc_union16 *ORC_RESTRICT ptr5; + const orc_union16 *ORC_RESTRICT ptr6; + const orc_union16 *ORC_RESTRICT ptr7; + const orc_union16 *ORC_RESTRICT ptr8; + const orc_union16 *ORC_RESTRICT ptr9; + orc_union16 var37; + orc_union16 var38; + orc_union16 var39; + orc_union16 var40; + orc_union16 var41; + orc_union16 var42; + orc_union16 var43; + orc_union16 var44; + orc_union16 var45; + orc_union64 var46; + orc_union16 var47; + orc_union16 var48; + orc_union16 var49; + orc_union16 var50; + orc_union16 var51; + orc_union16 var52; + orc_union16 var53; + orc_union32 var54; + orc_union32 var55; + + ptr0 = (orc_union64 *) ex->arrays[0]; + ptr4 = (orc_union16 *) ex->arrays[4]; + ptr5 = (orc_union16 *) ex->arrays[5]; + ptr6 = (orc_union16 *) ex->arrays[6]; + ptr7 = (orc_union16 *) ex->arrays[7]; + ptr8 = (orc_union16 *) ex->arrays[8]; + ptr9 = (orc_union16 *) ex->arrays[9]; + + /* 9: loadpw */ + var42.i = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + /* 11: loadpw */ + var43.i = (int) 0x0000ff00; /* 65280 or 3.22526e-319f */ + /* 14: loadpb */ + var44.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var44.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + + for (i = 0; i < n; i++) { + /* 0: loadw */ + var37 = ptr5[i]; + /* 1: loadw */ + var38 = ptr9[i]; + /* 2: avgub */ + var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1; + var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1; + /* 3: loadw */ + var39 = ptr4[i]; + /* 4: loadw */ + var40 = ptr8[i]; + /* 5: avgub */ + var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1; + var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1; + /* 6: loadw */ + var41 = ptr7[i]; + /* 7: copyw */ + var49.i = var41.i; + /* 8: avgub */ + var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1; + var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1; + /* 10: andw */ + var51.i = var50.i & var42.i; + /* 12: andw */ + var52.i = var49.i & var43.i; + /* 13: orw */ + var53.i = var52.i | var51.i; + /* 15: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var47.x2[0]; + var54.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var47.x2[1]; + var54.x2[1] = _dest.i; + } + /* 16: loadw */ + var45 = ptr6[i]; + /* 17: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var53.x2[0]; + _dest.x2[1] = var45.x2[0]; + var55.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var53.x2[1]; + _dest.x2[1] = var45.x2[1]; + var55.x2[1] = _dest.i; + } + /* 18: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[0]; + _dest.x2[1] = var55.x2[0]; + var46.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[1]; + _dest.x2[1] = var55.x2[1]; + var46.x2[1] = _dest.i; + } + /* 19: storeq */ + ptr0[i] = var46; + } + +} + +void +gst_bayer_merge_bg_argb (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n) +{ + OrcExecutor _ex, *ex = &_ex; + static int p_inited = 0; + static OrcProgram *p = 0; + void (*func) (OrcExecutor *); + + if (!p_inited) { + orc_once_mutex_lock (); + if (!p_inited) { + + p = orc_program_new (); + orc_program_set_name (p, "gst_bayer_merge_bg_argb"); + orc_program_set_backup_function (p, _backup_gst_bayer_merge_bg_argb); + orc_program_add_destination (p, 8, "d1"); + orc_program_add_source (p, 2, "s1"); + orc_program_add_source (p, 2, "s2"); + orc_program_add_source (p, 2, "s3"); + orc_program_add_source (p, 2, "s4"); + orc_program_add_source (p, 2, "s5"); + orc_program_add_source (p, 2, "s6"); + orc_program_add_constant (p, 4, 0x000000ff, "c1"); + orc_program_add_constant (p, 4, 0x0000ff00, "c2"); + orc_program_add_temporary (p, 4, "t1"); + orc_program_add_temporary (p, 4, "t2"); + orc_program_add_temporary (p, 2, "t3"); + orc_program_add_temporary (p, 2, "t4"); + orc_program_add_temporary (p, 2, "t5"); + + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T3, ORC_VAR_S2, ORC_VAR_S6, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S1, ORC_VAR_S5, + ORC_VAR_D1); + orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S4, ORC_VAR_D1, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5, + ORC_VAR_D1); + orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1, + ORC_VAR_D1); + orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2, + ORC_VAR_D1); + orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_C1, ORC_VAR_T3, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_T4, ORC_VAR_S3, + ORC_VAR_D1); + orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, + ORC_VAR_D1); + + orc_program_compile (p); + } + p_inited = TRUE; + orc_once_mutex_unlock (); + } + ex->program = p; + + ex->n = n; + ex->arrays[ORC_VAR_D1] = d1; + ex->arrays[ORC_VAR_S1] = (void *) s1; + ex->arrays[ORC_VAR_S2] = (void *) s2; + ex->arrays[ORC_VAR_S3] = (void *) s3; + ex->arrays[ORC_VAR_S4] = (void *) s4; + ex->arrays[ORC_VAR_S5] = (void *) s5; + ex->arrays[ORC_VAR_S6] = (void *) s6; + + func = p->code_exec; + func (ex); +} +#endif + + +/* gst_bayer_merge_gr_argb */ +#ifdef DISABLE_ORC +void +gst_bayer_merge_gr_argb (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n) +{ + int i; + orc_union64 *ORC_RESTRICT ptr0; + const orc_union16 *ORC_RESTRICT ptr4; + const orc_union16 *ORC_RESTRICT ptr5; + const orc_union16 *ORC_RESTRICT ptr6; + const orc_union16 *ORC_RESTRICT ptr7; + const orc_union16 *ORC_RESTRICT ptr8; + const orc_union16 *ORC_RESTRICT ptr9; + orc_union16 var37; + orc_union16 var38; + orc_union16 var39; + orc_union16 var40; + orc_union16 var41; + orc_union16 var42; + orc_union16 var43; + orc_union16 var44; + orc_union16 var45; + orc_union64 var46; + orc_union16 var47; + orc_union16 var48; + orc_union16 var49; + orc_union16 var50; + orc_union16 var51; + orc_union16 var52; + orc_union16 var53; + orc_union32 var54; + orc_union32 var55; + + ptr0 = (orc_union64 *) d1; + ptr4 = (orc_union16 *) s1; + ptr5 = (orc_union16 *) s2; + ptr6 = (orc_union16 *) s3; + ptr7 = (orc_union16 *) s4; + ptr8 = (orc_union16 *) s5; + ptr9 = (orc_union16 *) s6; + + /* 9: loadpw */ + var42.i = (int) 0x0000ff00; /* 65280 or 3.22526e-319f */ + /* 11: loadpw */ + var43.i = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + /* 14: loadpb */ + var44.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var44.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + + for (i = 0; i < n; i++) { + /* 0: loadw */ + var37 = ptr4[i]; + /* 1: loadw */ + var38 = ptr8[i]; + /* 2: avgub */ + var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1; + var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1; + /* 3: loadw */ + var39 = ptr5[i]; + /* 4: loadw */ + var40 = ptr9[i]; + /* 5: avgub */ + var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1; + var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1; + /* 6: loadw */ + var41 = ptr6[i]; + /* 7: copyw */ + var49.i = var41.i; + /* 8: avgub */ + var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1; + var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1; + /* 10: andw */ + var51.i = var50.i & var42.i; + /* 12: andw */ + var52.i = var49.i & var43.i; + /* 13: orw */ + var53.i = var52.i | var51.i; + /* 15: loadw */ + var45 = ptr7[i]; + /* 16: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var45.x2[0]; + var54.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var45.x2[1]; + var54.x2[1] = _dest.i; + } + /* 17: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var53.x2[0]; + _dest.x2[1] = var47.x2[0]; + var55.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var53.x2[1]; + _dest.x2[1] = var47.x2[1]; + var55.x2[1] = _dest.i; + } + /* 18: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[0]; + _dest.x2[1] = var55.x2[0]; + var46.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[1]; + _dest.x2[1] = var55.x2[1]; + var46.x2[1] = _dest.i; + } + /* 19: storeq */ + ptr0[i] = var46; + } + +} + +#else +static void +_backup_gst_bayer_merge_gr_argb (OrcExecutor * ORC_RESTRICT ex) +{ + int i; + int n = ex->n; + orc_union64 *ORC_RESTRICT ptr0; + const orc_union16 *ORC_RESTRICT ptr4; + const orc_union16 *ORC_RESTRICT ptr5; + const orc_union16 *ORC_RESTRICT ptr6; + const orc_union16 *ORC_RESTRICT ptr7; + const orc_union16 *ORC_RESTRICT ptr8; + const orc_union16 *ORC_RESTRICT ptr9; + orc_union16 var37; + orc_union16 var38; + orc_union16 var39; + orc_union16 var40; + orc_union16 var41; + orc_union16 var42; + orc_union16 var43; + orc_union16 var44; + orc_union16 var45; + orc_union64 var46; + orc_union16 var47; + orc_union16 var48; + orc_union16 var49; + orc_union16 var50; + orc_union16 var51; + orc_union16 var52; + orc_union16 var53; + orc_union32 var54; + orc_union32 var55; + + ptr0 = (orc_union64 *) ex->arrays[0]; + ptr4 = (orc_union16 *) ex->arrays[4]; + ptr5 = (orc_union16 *) ex->arrays[5]; + ptr6 = (orc_union16 *) ex->arrays[6]; + ptr7 = (orc_union16 *) ex->arrays[7]; + ptr8 = (orc_union16 *) ex->arrays[8]; + ptr9 = (orc_union16 *) ex->arrays[9]; + + /* 9: loadpw */ + var42.i = (int) 0x0000ff00; /* 65280 or 3.22526e-319f */ + /* 11: loadpw */ + var43.i = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + /* 14: loadpb */ + var44.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var44.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + + for (i = 0; i < n; i++) { + /* 0: loadw */ + var37 = ptr4[i]; + /* 1: loadw */ + var38 = ptr8[i]; + /* 2: avgub */ + var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1; + var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1; + /* 3: loadw */ + var39 = ptr5[i]; + /* 4: loadw */ + var40 = ptr9[i]; + /* 5: avgub */ + var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1; + var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1; + /* 6: loadw */ + var41 = ptr6[i]; + /* 7: copyw */ + var49.i = var41.i; + /* 8: avgub */ + var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1; + var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1; + /* 10: andw */ + var51.i = var50.i & var42.i; + /* 12: andw */ + var52.i = var49.i & var43.i; + /* 13: orw */ + var53.i = var52.i | var51.i; + /* 15: loadw */ + var45 = ptr7[i]; + /* 16: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var45.x2[0]; + var54.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var45.x2[1]; + var54.x2[1] = _dest.i; + } + /* 17: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var53.x2[0]; + _dest.x2[1] = var47.x2[0]; + var55.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var53.x2[1]; + _dest.x2[1] = var47.x2[1]; + var55.x2[1] = _dest.i; + } + /* 18: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[0]; + _dest.x2[1] = var55.x2[0]; + var46.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var54.x2[1]; + _dest.x2[1] = var55.x2[1]; + var46.x2[1] = _dest.i; + } + /* 19: storeq */ + ptr0[i] = var46; + } + +} + +void +gst_bayer_merge_gr_argb (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n) +{ + OrcExecutor _ex, *ex = &_ex; + static int p_inited = 0; + static OrcProgram *p = 0; + void (*func) (OrcExecutor *); + + if (!p_inited) { + orc_once_mutex_lock (); + if (!p_inited) { + + p = orc_program_new (); + orc_program_set_name (p, "gst_bayer_merge_gr_argb"); + orc_program_set_backup_function (p, _backup_gst_bayer_merge_gr_argb); + orc_program_add_destination (p, 8, "d1"); + orc_program_add_source (p, 2, "s1"); + orc_program_add_source (p, 2, "s2"); + orc_program_add_source (p, 2, "s3"); + orc_program_add_source (p, 2, "s4"); + orc_program_add_source (p, 2, "s5"); + orc_program_add_source (p, 2, "s6"); + orc_program_add_constant (p, 4, 0x0000ff00, "c1"); + orc_program_add_constant (p, 4, 0x000000ff, "c2"); + orc_program_add_temporary (p, 4, "t1"); + orc_program_add_temporary (p, 4, "t2"); + orc_program_add_temporary (p, 2, "t3"); + orc_program_add_temporary (p, 2, "t4"); + orc_program_add_temporary (p, 2, "t5"); + + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_S5, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S2, ORC_VAR_S6, + ORC_VAR_D1); + orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S3, ORC_VAR_D1, + ORC_VAR_D1); + orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5, + ORC_VAR_D1); + orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1, + ORC_VAR_D1); + orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2, + ORC_VAR_D1); + orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_C2, ORC_VAR_S4, + ORC_VAR_D1); + orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_T4, ORC_VAR_T3, + ORC_VAR_D1); + orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, + ORC_VAR_D1); + + orc_program_compile (p); + } + p_inited = TRUE; + orc_once_mutex_unlock (); + } + ex->program = p; + + ex->n = n; + ex->arrays[ORC_VAR_D1] = d1; + ex->arrays[ORC_VAR_S1] = (void *) s1; + ex->arrays[ORC_VAR_S2] = (void *) s2; + ex->arrays[ORC_VAR_S3] = (void *) s3; + ex->arrays[ORC_VAR_S4] = (void *) s4; + ex->arrays[ORC_VAR_S5] = (void *) s5; + ex->arrays[ORC_VAR_S6] = (void *) s6; + + func = p->code_exec; + func (ex); +} +#endif diff --git a/gst/bayer/gstbayerorc-dist.h b/gst/bayer/gstbayerorc-dist.h new file mode 100644 index 0000000000..5e8b865567 --- /dev/null +++ b/gst/bayer/gstbayerorc-dist.h @@ -0,0 +1,86 @@ + +/* autogenerated from gstbayerorc.orc */ + +#ifndef _GSTBAYERORC_H_ +#define _GSTBAYERORC_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + + +#ifndef _ORC_INTEGER_TYPEDEFS_ +#define _ORC_INTEGER_TYPEDEFS_ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#include +typedef int8_t orc_int8; +typedef int16_t orc_int16; +typedef int32_t orc_int32; +typedef int64_t orc_int64; +typedef uint8_t orc_uint8; +typedef uint16_t orc_uint16; +typedef uint32_t orc_uint32; +typedef uint64_t orc_uint64; +#define ORC_UINT64_C(x) UINT64_C(x) +#elif defined(_MSC_VER) +typedef signed __int8 orc_int8; +typedef signed __int16 orc_int16; +typedef signed __int32 orc_int32; +typedef signed __int64 orc_int64; +typedef unsigned __int8 orc_uint8; +typedef unsigned __int16 orc_uint16; +typedef unsigned __int32 orc_uint32; +typedef unsigned __int64 orc_uint64; +#define ORC_UINT64_C(x) (x##Ui64) +#define inline __inline +#else +#include +typedef signed char orc_int8; +typedef short orc_int16; +typedef int orc_int32; +typedef unsigned char orc_uint8; +typedef unsigned short orc_uint16; +typedef unsigned int orc_uint32; +#if INT_MAX == LONG_MAX +typedef long long orc_int64; +typedef unsigned long long orc_uint64; +#define ORC_UINT64_C(x) (x##ULL) +#else +typedef long orc_int64; +typedef unsigned long orc_uint64; +#define ORC_UINT64_C(x) (x##UL) +#endif +#endif +typedef union { orc_int16 i; orc_int8 x2[2]; } orc_union16; +typedef union { orc_int32 i; float f; orc_int16 x2[2]; orc_int8 x4[4]; } orc_union32; +typedef union { orc_int64 i; double f; orc_int32 x2[2]; float x2f[2]; orc_int16 x4[4]; } orc_union64; +#endif +#ifndef ORC_RESTRICT +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#define ORC_RESTRICT restrict +#elif defined(__GNUC__) && __GNUC__ >= 4 +#define ORC_RESTRICT __restrict__ +#else +#define ORC_RESTRICT +#endif +#endif +void gst_bayer_horiz_upsample_unaligned (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n); +void gst_bayer_horiz_upsample (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n); +void gst_bayer_merge_bg_bgra (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n); +void gst_bayer_merge_gr_bgra (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n); +void gst_bayer_merge_bg_abgr (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n); +void gst_bayer_merge_gr_abgr (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n); +void gst_bayer_merge_bg_rgba (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n); +void gst_bayer_merge_gr_rgba (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n); +void gst_bayer_merge_bg_argb (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n); +void gst_bayer_merge_gr_argb (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/gst/bayer/gstbayerorc.orc b/gst/bayer/gstbayerorc.orc new file mode 100644 index 0000000000..e57436b7f1 --- /dev/null +++ b/gst/bayer/gstbayerorc.orc @@ -0,0 +1,252 @@ + + +.function gst_bayer_horiz_upsample_unaligned +.dest 2 d0 guint8 +.dest 2 d1 guint8 +.source 2 s guint8 +.temp 2 t +.temp 1 b +.temp 1 c +.temp 1 d +.temp 1 e + +splitwb c, b, s +loadoffw t, s, 1 +splitwb e, d, t +avgub e, c, e +mergebw d0, c, e +avgub b, b, d +mergebw d1, b, d + + +.function gst_bayer_horiz_upsample +.dest 2 d0 guint8 +.dest 2 d1 guint8 +.source 2 s guint8 +.temp 2 t +.temp 1 a +.temp 1 b +.temp 1 c +.temp 1 d +.temp 1 e +.temp 1 f + +loadoffw t, s, -1 +splitwb b, a, t +splitwb d, c, s +loadoffw t, s, 1 +splitwb f, e, t +avgub e, c, e +mergebw d0, c, e +avgub b, b, d +mergebw d1, b, d + + +.function gst_bayer_merge_bg_bgra +.dest 8 d guint8 +.source 2 g0 guint8 +.source 2 r0 guint8 +.source 2 b1 guint8 +.source 2 g1 guint8 +.source 2 g2 guint8 +.source 2 r2 guint8 +.temp 4 ra +.temp 4 bg +.temp 2 r +.temp 2 g +.temp 2 t + +x2 avgub r, r0, r2 +x2 avgub g, g0, g2 +copyw t, g1 +x2 avgub g, g, t +andw g, g, 255 +andw t, t, 65280 +orw g, t, g +x2 mergebw bg, b1, g +x2 mergebw ra, r, 255 +x2 mergewl d, bg, ra + + +.function gst_bayer_merge_gr_bgra +.dest 8 d guint8 +.source 2 b0 guint8 +.source 2 g0 guint8 +.source 2 g1 guint8 +.source 2 r1 guint8 +.source 2 b2 guint8 +.source 2 g2 guint8 +.temp 4 ra +.temp 4 bg +.temp 2 b +.temp 2 g +.temp 2 t + +x2 avgub b, b0, b2 +x2 avgub g, g0, g2 +copyw t, g1 +x2 avgub g, g, t +andw g, g, 65280 +andw t, t, 255 +orw g, t, g +x2 mergebw bg, b, g +x2 mergebw ra, r1, 255 +x2 mergewl d, bg, ra + + +.function gst_bayer_merge_bg_abgr +.dest 8 d guint8 +.source 2 g0 guint8 +.source 2 r0 guint8 +.source 2 b1 guint8 +.source 2 g1 guint8 +.source 2 g2 guint8 +.source 2 r2 guint8 +.temp 4 ab +.temp 4 gr +.temp 2 r +.temp 2 g +.temp 2 t + +x2 avgub r, r0, r2 +x2 avgub g, g0, g2 +copyw t, g1 +x2 avgub g, g, t +andw g, g, 255 +andw t, t, 65280 +orw g, t, g +x2 mergebw ab, 255, b1 +x2 mergebw gr, g, r +x2 mergewl d, ab, gr + + +.function gst_bayer_merge_gr_abgr +.dest 8 d guint8 +.source 2 b0 guint8 +.source 2 g0 guint8 +.source 2 g1 guint8 +.source 2 r1 guint8 +.source 2 b2 guint8 +.source 2 g2 guint8 +.temp 4 ab +.temp 4 gr +.temp 2 b +.temp 2 g +.temp 2 t + +x2 avgub b, b0, b2 +x2 avgub g, g0, g2 +copyw t, g1 +x2 avgub g, g, t +andw g, g, 65280 +andw t, t, 255 +orw g, t, g +x2 mergebw ab, 255, b +x2 mergebw gr, g, r1 +x2 mergewl d, ab, gr + + +.function gst_bayer_merge_bg_rgba +.dest 8 d guint8 +.source 2 g0 guint8 +.source 2 r0 guint8 +.source 2 b1 guint8 +.source 2 g1 guint8 +.source 2 g2 guint8 +.source 2 r2 guint8 +.temp 4 rg +.temp 4 ba +.temp 2 r +.temp 2 g +.temp 2 t + +x2 avgub r, r0, r2 +x2 avgub g, g0, g2 +copyw t, g1 +x2 avgub g, g, t +andw g, g, 255 +andw t, t, 65280 +orw g, t, g +x2 mergebw rg, r, g +x2 mergebw ba, b1, 255 +x2 mergewl d, rg, ba + + +.function gst_bayer_merge_gr_rgba +.dest 8 d guint8 +.source 2 b0 guint8 +.source 2 g0 guint8 +.source 2 g1 guint8 +.source 2 r1 guint8 +.source 2 b2 guint8 +.source 2 g2 guint8 +.temp 4 rg +.temp 4 ba +.temp 2 b +.temp 2 g +.temp 2 t + +x2 avgub b, b0, b2 +x2 avgub g, g0, g2 +copyw t, g1 +x2 avgub g, g, t +andw g, g, 65280 +andw t, t, 255 +orw g, t, g +x2 mergebw rg, r1, g +x2 mergebw ba, b, 255 +x2 mergewl d, rg, ba + + +.function gst_bayer_merge_bg_argb +.dest 8 d guint8 +.source 2 g0 guint8 +.source 2 r0 guint8 +.source 2 b1 guint8 +.source 2 g1 guint8 +.source 2 g2 guint8 +.source 2 r2 guint8 +.temp 4 ar +.temp 4 gb +.temp 2 r +.temp 2 g +.temp 2 t + +x2 avgub r, r0, r2 +x2 avgub g, g0, g2 +copyw t, g1 +x2 avgub g, g, t +andw g, g, 255 +andw t, t, 65280 +orw g, t, g +x2 mergebw ar, 255, r +x2 mergebw gb, g, b1 +x2 mergewl d, ar, gb + + +.function gst_bayer_merge_gr_argb +.dest 8 d guint8 +.source 2 b0 guint8 +.source 2 g0 guint8 +.source 2 g1 guint8 +.source 2 r1 guint8 +.source 2 b2 guint8 +.source 2 g2 guint8 +.temp 4 ar +.temp 4 gb +.temp 2 b +.temp 2 g +.temp 2 t + +x2 avgub b, b0, b2 +x2 avgub g, g0, g2 +copyw t, g1 +x2 avgub g, g, t +andw g, g, 65280 +andw t, t, 255 +orw g, t, g +x2 mergebw ar, 255, r1 +x2 mergebw gb, g, b +x2 mergewl d, ar, gb + + diff --git a/gst/bayer/gstrgb2bayer.c b/gst/bayer/gstrgb2bayer.c index 34e6b39068..819d0e6ac6 100644 --- a/gst/bayer/gstrgb2bayer.c +++ b/gst/bayer/gstrgb2bayer.c @@ -30,13 +30,6 @@ #define GST_CAT_DEFAULT gst_rgb2bayer_debug GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); -/* prototypes */ - - -static void gst_rgb2bayer_set_property (GObject * object, - guint property_id, const GValue * value, GParamSpec * pspec); -static void gst_rgb2bayer_get_property (GObject * object, - guint property_id, GValue * value, GParamSpec * pspec); static void gst_rgb2bayer_dispose (GObject * object); static void gst_rgb2bayer_finalize (GObject * object); @@ -57,13 +50,6 @@ static GstFlowReturn gst_rgb2bayer_transform (GstBaseTransform * trans, static gboolean gst_rgb2bayer_src_event (GstBaseTransform * trans, GstEvent * event); -enum -{ - PROP_0 -}; - -/* pad templates */ - static GstStaticPadTemplate gst_rgb2bayer_sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, @@ -125,8 +111,6 @@ gst_rgb2bayer_class_init (GstRGB2BayerClass * klass) GstBaseTransformClass *base_transform_class = GST_BASE_TRANSFORM_CLASS (klass); - gobject_class->set_property = gst_rgb2bayer_set_property; - gobject_class->get_property = gst_rgb2bayer_get_property; gobject_class->dispose = gst_rgb2bayer_dispose; gobject_class->finalize = gst_rgb2bayer_finalize; base_transform_class->transform_caps = @@ -149,61 +133,15 @@ gst_rgb2bayer_init (GstRGB2Bayer * rgb2bayer, } -void -gst_rgb2bayer_set_property (GObject * object, guint property_id, - const GValue * value, GParamSpec * pspec) -{ - GstRGB2Bayer *rgb2bayer; - - g_return_if_fail (GST_IS_RGB_2_BAYER (object)); - rgb2bayer = GST_RGB_2_BAYER (object); - - switch (property_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -void -gst_rgb2bayer_get_property (GObject * object, guint property_id, - GValue * value, GParamSpec * pspec) -{ - GstRGB2Bayer *rgb2bayer; - - g_return_if_fail (GST_IS_RGB_2_BAYER (object)); - rgb2bayer = GST_RGB_2_BAYER (object); - - switch (property_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - void gst_rgb2bayer_dispose (GObject * object) { - GstRGB2Bayer *rgb2bayer; - - g_return_if_fail (GST_IS_RGB_2_BAYER (object)); - rgb2bayer = GST_RGB_2_BAYER (object); - - /* clean up as possible. may be called multiple times */ - G_OBJECT_CLASS (parent_class)->dispose (object); } void gst_rgb2bayer_finalize (GObject * object) { - GstRGB2Bayer *rgb2bayer; - - g_return_if_fail (GST_IS_RGB_2_BAYER (object)); - rgb2bayer = GST_RGB_2_BAYER (object); - - /* clean up object here */ - G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/gst/camerabin/Makefile.am b/gst/camerabin/Makefile.am index 7d7e55576e..b29a54d0cf 100644 --- a/gst/camerabin/Makefile.am +++ b/gst/camerabin/Makefile.am @@ -45,3 +45,19 @@ noinst_HEADERS = gstcamerabin.h \ camerabingeneral.h \ camerabinpreview.h \ gstcamerabin-enum.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstcamerabin -:SHARED libgstcamerabin \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstcamerabin_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstcamerabin_la_CFLAGS) \ + -:LDFLAGS $(libgstcamerabin_la_LDFLAGS) \ + $(libgstcamerabin_la_LIBADD) \ + -ldl \ + -:LIBFILTER_STATIC gstphotography-@GST_MAJORMINOR@ \ + gstbasecamerabinsrc-@GST_MAJORMINOR@ \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/camerabin/camerabinimage.c b/gst/camerabin/camerabinimage.c index 53a495e12a..ab82b40715 100644 --- a/gst/camerabin/camerabinimage.c +++ b/gst/camerabin/camerabinimage.c @@ -61,7 +61,7 @@ #define DEFAULT_SINK "filesink" #define DEFAULT_ENC "jpegenc" -#define DEFAULT_META_MUX "jifmux" +#define DEFAULT_FORMATTER "jifmux" #define DEFAULT_FLAGS GST_CAMERABIN_FLAG_IMAGE_COLOR_CONVERSION enum @@ -150,7 +150,8 @@ gst_camerabin_image_init (GstCameraBinImage * img, img->csp = NULL; img->enc = NULL; img->app_enc = NULL; - img->meta_mux = NULL; + img->formatter = NULL; + img->app_formatter = NULL; img->sink = NULL; /* Create src and sink ghost pads */ @@ -180,12 +181,21 @@ gst_camerabin_image_dispose (GstCameraBinImage * img) img->sink = NULL; } - if (img->meta_mux) { + if (img->formatter) { GST_LOG_OBJECT (img, "disposing %s with refcount %d", - GST_ELEMENT_NAME (img->meta_mux), - GST_OBJECT_REFCOUNT_VALUE (img->meta_mux)); - gst_object_unref (img->meta_mux); - img->meta_mux = NULL; + GST_ELEMENT_NAME (img->formatter), + GST_OBJECT_REFCOUNT_VALUE (img->formatter)); + gst_object_unref (img->formatter); + img->formatter = NULL; + } + + if (img->app_formatter) { + gst_object_sink (img->app_formatter); + GST_LOG_OBJECT (img, "disposing %s with refcount %d", + GST_ELEMENT_NAME (img->app_formatter), + GST_OBJECT_REFCOUNT_VALUE (img->app_formatter)); + gst_object_unref (img->app_formatter); + img->app_formatter = NULL; } if (img->enc) { @@ -195,6 +205,12 @@ gst_camerabin_image_dispose (GstCameraBinImage * img) img->enc = NULL; } + if (img->csp) { + GST_LOG_OBJECT (img, "disposing %s with refcount %d", + GST_ELEMENT_NAME (img->csp), GST_OBJECT_REFCOUNT_VALUE (img->csp)); + gst_object_unref (img->csp); + img->csp = NULL; + } /* Note: if imagebin was never set to READY state the ownership of elements created by application were never @@ -394,12 +410,12 @@ gst_camerabin_image_prepare_elements (GstCameraBinImage * imagebin) } /* Create metadata muxer element */ - if (!prepare_element (&imagebin->elements, DEFAULT_META_MUX, NULL, - &imagebin->meta_mux)) { + if (!prepare_element (&imagebin->elements, DEFAULT_FORMATTER, + imagebin->app_formatter, &imagebin->formatter)) { goto done; } else if (!imagebin->metadata_probe_id) { /* Add probe for default XMP metadata writing */ - sinkpad = gst_element_get_static_pad (imagebin->meta_mux, "sink"); + sinkpad = gst_element_get_static_pad (imagebin->formatter, "sink"); imagebin->metadata_probe_id = gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (metadata_write_probe), imagebin); @@ -463,7 +479,9 @@ metadata_write_probe (GstPad * pad, GstBuffer * buffer, gpointer u_data) g_return_val_if_fail (img != NULL, TRUE); - setter = GST_TAG_SETTER (img->meta_mux); + if (GST_IS_TAG_SETTER (img->formatter)) { + setter = GST_TAG_SETTER (img->formatter); + } if (!setter) { GST_WARNING_OBJECT (img, "setting tags failed"); @@ -711,6 +729,19 @@ gst_camerabin_image_set_postproc (GstCameraBinImage * img, img->post = postproc; } +void +gst_camerabin_image_set_formatter (GstCameraBinImage * img, + GstElement * formatter) +{ + GstElement **app_formatter; + GST_DEBUG ("setting image formatter %" GST_PTR_FORMAT, formatter); + + app_formatter = &img->app_formatter; + GST_OBJECT_LOCK (img); + gst_object_replace ((GstObject **) app_formatter, GST_OBJECT (formatter)); + GST_OBJECT_UNLOCK (img); +} + void gst_camerabin_image_set_flags (GstCameraBinImage * img, GstCameraBinFlags flags) { @@ -732,6 +763,13 @@ gst_camerabin_image_get_encoder (GstCameraBinImage * img) return enc; } +GstElement * +gst_camerabin_image_get_formatter (GstCameraBinImage * img) +{ + /* Prefer formatter that is currently in use */ + return img->formatter ? img->formatter : img->app_formatter; +} + GstElement * gst_camerabin_image_get_postproc (GstCameraBinImage * img) { diff --git a/gst/camerabin/camerabinimage.h b/gst/camerabin/camerabinimage.h index b116d0905e..754c4bbaff 100644 --- a/gst/camerabin/camerabinimage.h +++ b/gst/camerabin/camerabinimage.h @@ -55,7 +55,8 @@ struct _GstCameraBinImage GstElement *csp; GstElement *enc; GstElement *app_enc; - GstElement *meta_mux; + GstElement *formatter; + GstElement *app_formatter; GstElement *sink; GstCameraBinFlags flags; @@ -76,6 +77,9 @@ void gst_camerabin_image_set_postproc (GstCameraBinImage * img, GstElement * postproc); +void +gst_camerabin_image_set_formatter (GstCameraBinImage * img, GstElement * formatter); + void gst_camerabin_image_set_flags (GstCameraBinImage * img, GstCameraBinFlags flags); @@ -84,6 +88,8 @@ GstElement *gst_camerabin_image_get_encoder (GstCameraBinImage * img); GstElement *gst_camerabin_image_get_postproc (GstCameraBinImage * img); +GstElement *gst_camerabin_image_get_formatter (GstCameraBinImage * img); + gboolean gst_camerabin_image_prepare_elements (GstCameraBinImage * imagebin); G_END_DECLS diff --git a/gst/camerabin/camerabinpreview.c b/gst/camerabin/camerabinpreview.c index 5f46d0628a..e7e5fe4a3c 100644 --- a/gst/camerabin/camerabinpreview.c +++ b/gst/camerabin/camerabinpreview.c @@ -206,6 +206,7 @@ gst_camerabin_preview_convert (GstCameraBinPreviewPipelineData * data, GstFlowReturn fret; g_return_val_if_fail (GST_BUFFER_CAPS (buf) != NULL, NULL); + g_return_val_if_fail (data != NULL, NULL); if (data->pipeline == NULL) { GST_WARNING ("pipeline is NULL"); diff --git a/gst/camerabin/camerabinvideo.c b/gst/camerabin/camerabinvideo.c index 90f0e9c1e8..b54e9abdff 100644 --- a/gst/camerabin/camerabinvideo.c +++ b/gst/camerabin/camerabinvideo.c @@ -93,8 +93,6 @@ gst_camerabin_video_change_state (GstElement * element, static gboolean camerabin_video_pad_tee_src0_have_buffer (GstPad * pad, GstBuffer * buffer, gpointer u_data); -static gboolean camerabin_video_pad_aud_src_have_buffer (GstPad * pad, - GstBuffer * buffer, gpointer u_data); static gboolean camerabin_video_sink_have_event (GstPad * pad, GstEvent * event, gpointer u_data); static gboolean gst_camerabin_video_create_elements (GstCameraBinVideo * vid); @@ -185,7 +183,6 @@ gst_camerabin_video_init (GstCameraBinVideo * vid, vid->mute = ARG_DEFAULT_MUTE; vid->flags = DEFAULT_FLAGS; - vid->aud_src_probe_id = 0; vid->vid_src_probe_id = 0; vid->vid_tee_probe_id = 0; vid->vid_sink_probe_id = 0; @@ -317,13 +314,11 @@ gst_camerabin_video_change_state (GstElement * element, break; case GST_STATE_CHANGE_READY_TO_PAUSED: vid->calculate_adjust_ts_video = TRUE; - vid->calculate_adjust_ts_aud = TRUE; g_object_set (G_OBJECT (vid->sink), "async", FALSE, NULL); gst_element_set_locked_state (vid->sink, FALSE); break; case GST_STATE_CHANGE_PAUSED_TO_PLAYING: vid->calculate_adjust_ts_video = TRUE; - vid->calculate_adjust_ts_aud = TRUE; break; case GST_STATE_CHANGE_PAUSED_TO_READY: @@ -356,8 +351,6 @@ gst_camerabin_video_change_state (GstElement * element, /* Reset counters related to timestamp rewriting */ vid->adjust_ts_video = 0; vid->last_ts_video = 0; - vid->adjust_ts_aud = 0; - vid->last_ts_aud = 0; if (vid->pending_eos) { gst_event_unref (vid->pending_eos); @@ -431,53 +424,6 @@ camerabin_video_pad_tee_src0_have_buffer (GstPad * pad, GstBuffer * buffer, return TRUE; } -/* - * camerabin_video_pad_aud_src_have_buffer: - * @pad: audio source src pad - * @event: received buffer - * @u_data: video bin object - * - * Buffer probe for rewriting audio buffer timestamps. - * - * Returns: TRUE always - */ -static gboolean -camerabin_video_pad_aud_src_have_buffer (GstPad * pad, GstBuffer * buffer, - gpointer u_data) -{ - GstCameraBinVideo *vid = (GstCameraBinVideo *) u_data; - - GST_LOG ("buffer in with size %d duration %" G_GINT64_FORMAT " ts %" - GST_TIME_FORMAT, GST_BUFFER_SIZE (buffer), GST_BUFFER_DURATION (buffer), - GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer))); - - if (vid->calculate_adjust_ts_aud) { - GstEvent *event; - GstPad *peerpad = NULL; - - vid->adjust_ts_aud = GST_BUFFER_TIMESTAMP (buffer) - vid->last_ts_aud; - vid->calculate_adjust_ts_aud = FALSE; - event = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, - 0, GST_CLOCK_TIME_NONE, vid->last_ts_aud); - peerpad = gst_pad_get_peer (pad); - if (peerpad) { - gst_pad_send_event (peerpad, event); - gst_object_unref (peerpad); - } - GST_LOG_OBJECT (vid, "aud ts adjustment: %" GST_TIME_FORMAT, - GST_TIME_ARGS (vid->adjust_ts_aud)); - GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT); - } - GST_BUFFER_TIMESTAMP (buffer) -= vid->adjust_ts_aud; - vid->last_ts_aud = GST_BUFFER_TIMESTAMP (buffer); - if (GST_BUFFER_DURATION_IS_VALID (buffer)) - vid->last_ts_aud += GST_BUFFER_DURATION (buffer); - - GST_LOG ("buffer out with size %d ts %" GST_TIME_FORMAT, - GST_BUFFER_SIZE (buffer), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer))); - return TRUE; -} - /* * camerabin_video_sink_have_event: * @pad: video bin sink pad @@ -533,7 +479,7 @@ camerabin_video_sink_have_event (GstPad * pad, GstEvent * event, static gboolean gst_camerabin_video_create_elements (GstCameraBinVideo * vid) { - GstPad *pad = NULL, *vid_sinkpad = NULL, *vid_srcpad = NULL; + GstPad *vid_sinkpad = NULL, *vid_srcpad = NULL; GstBin *vidbin = GST_BIN (vid); GstElement *queue = NULL; @@ -541,10 +487,6 @@ gst_camerabin_video_create_elements (GstCameraBinVideo * vid) vid->last_ts_video = 0; vid->calculate_adjust_ts_video = FALSE; - vid->adjust_ts_aud = 0; - vid->last_ts_aud = 0; - vid->calculate_adjust_ts_aud = FALSE; - /* Add video post processing element if any */ if (vid->app_post) { if (!gst_camerabin_add_element (vidbin, vid->app_post)) { @@ -696,12 +638,6 @@ gst_camerabin_video_create_elements (GstCameraBinVideo * vid) G_CALLBACK (gst_camerabin_drop_eos_probe), vid); gst_object_unref (vid_srcpad); - if (!(vid->flags & GST_CAMERABIN_FLAG_DISABLE_AUDIO)) { - pad = gst_element_get_static_pad (vid->aud_src, "src"); - vid->aud_src_probe_id = gst_pad_add_buffer_probe (pad, - G_CALLBACK (camerabin_video_pad_aud_src_have_buffer), vid); - gst_object_unref (pad); - } GST_DEBUG ("created video elements"); return TRUE; @@ -727,16 +663,6 @@ gst_camerabin_video_destroy_elements (GstCameraBinVideo * vid) { GST_DEBUG ("destroying video elements"); - /* Remove buffer probe from audio src pad */ - if (vid->aud_src_probe_id) { - GstPad *pad = gst_element_get_static_pad (vid->aud_src, "src"); - if (pad) { - gst_pad_remove_buffer_probe (pad, vid->aud_src_probe_id); - gst_object_unref (pad); - } - vid->aud_src_probe_id = 0; - } - /* Remove EOS event probe from videobin srcpad (queue's srcpad) */ if (vid->vid_src_probe_id) { GstPad *pad = gst_ghost_pad_get_target (GST_GHOST_PAD (vid->srcpad)); diff --git a/gst/camerabin/camerabinvideo.h b/gst/camerabin/camerabinvideo.h index 74b41ef9d5..8f9a0f0213 100644 --- a/gst/camerabin/camerabinvideo.h +++ b/gst/camerabin/camerabinvideo.h @@ -52,10 +52,6 @@ struct _GstCameraBinVideo guint64 last_ts_video; gboolean calculate_adjust_ts_video; - guint64 adjust_ts_aud; - guint64 last_ts_aud; - gboolean calculate_adjust_ts_aud; - /* Sink and src pads of video bin */ GstPad *sinkpad; GstPad *srcpad; @@ -84,7 +80,6 @@ struct _GstCameraBinVideo GstEvent *pending_eos; /* Probe IDs */ - gulong aud_src_probe_id; gulong vid_src_probe_id; gulong vid_tee_probe_id; gulong vid_sink_probe_id; diff --git a/gst/camerabin/gstcamerabin-enum.h b/gst/camerabin/gstcamerabin-enum.h index 69d7ba2f8e..b848047e4e 100644 --- a/gst/camerabin/gstcamerabin-enum.h +++ b/gst/camerabin/gstcamerabin-enum.h @@ -35,6 +35,7 @@ enum ARG_ZOOM, ARG_IMAGE_POST, ARG_IMAGE_ENC, + ARG_IMAGE_FORMATTER, ARG_VIDEO_POST, ARG_VIDEO_ENC, ARG_AUDIO_ENC, diff --git a/gst/camerabin/gstcamerabin.c b/gst/camerabin/gstcamerabin.c index 5704513c6b..fe41e38199 100644 --- a/gst/camerabin/gstcamerabin.c +++ b/gst/camerabin/gstcamerabin.c @@ -1811,7 +1811,6 @@ gst_camerabin_have_img_buffer (GstPad * pad, GstMiniObject * obj, if (GST_IS_BUFFER (obj)) { GstBuffer *buffer = GST_BUFFER_CAST (obj); GstStructure *fn_ev_struct = NULL; - gboolean ret = TRUE; GstPad *os_sink = NULL; GST_LOG ("got buffer %p with size %d", buffer, GST_BUFFER_SIZE (buffer)); @@ -1823,7 +1822,6 @@ gst_camerabin_have_img_buffer (GstPad * pad, GstMiniObject * obj, /* Image filename should be set by now */ if (g_str_equal (camera->filename->str, "")) { GST_DEBUG_OBJECT (camera, "filename not set, dropping buffer"); - ret = FALSE; CAMERABIN_PROCESSING_DEC_UNLOCKED (camera); goto done; } @@ -1895,8 +1893,7 @@ gst_camerabin_have_vid_buffer (GstPad * pad, GstBuffer * buffer, GST_LOG ("got video buffer %p with size %d", buffer, GST_BUFFER_SIZE (buffer)); - if (camera->video_preview_caps && - !camera->video_preview_buffer && !camera->stop_requested) { + if (!camera->video_preview_buffer && camera->video_preview_caps) { GST_DEBUG ("storing video preview %p", buffer); camera->video_preview_buffer = gst_buffer_copy (buffer); } @@ -2075,6 +2072,10 @@ gst_camerabin_reset_to_view_finder (GstCameraBin * camera) camera->stop_requested = FALSE; camera->paused = FALSE; camera->eos_handled = FALSE; + if (camera->video_preview_buffer) { + gst_buffer_unref (camera->video_preview_buffer); + camera->video_preview_buffer = NULL; + } /* Enable view finder mode in v4l2camsrc */ if (camera->src_vid_src && @@ -2097,15 +2098,17 @@ gst_camerabin_reset_to_view_finder (GstCameraBin * camera) static void gst_camerabin_do_stop (GstCameraBin * camera) { + gboolean video_preview_sent = FALSE; g_mutex_lock (camera->capture_mutex); if (camera->capturing) { GST_DEBUG_OBJECT (camera, "mark stop"); camera->stop_requested = TRUE; - if (camera->video_preview_caps && camera->video_preview_buffer) { + /* Post preview image ASAP and don't wait that video recording + finishes as it may take time. */ + if (camera->video_preview_buffer) { gst_camerabin_send_preview (camera, camera->video_preview_buffer); - gst_buffer_unref (camera->video_preview_buffer); - camera->video_preview_buffer = NULL; + video_preview_sent = TRUE; } /* Take special care when stopping paused video capture */ @@ -2121,6 +2124,15 @@ gst_camerabin_do_stop (GstCameraBin * camera) GST_DEBUG_OBJECT (camera, "waiting for capturing to finish"); g_cond_wait (camera->cond, camera->capture_mutex); GST_DEBUG_OBJECT (camera, "capturing finished"); + + if (camera->video_preview_buffer) { + /* Double check that preview image has been sent. This is useful + in a corner case where capture-stop is issued immediately after + start before a single video buffer is actually recorded */ + if (video_preview_sent == FALSE) { + gst_camerabin_send_preview (camera, camera->video_preview_buffer); + } + } } g_mutex_unlock (camera->capture_mutex); } @@ -2836,6 +2848,19 @@ gst_camerabin_class_init (GstCameraBinClass * klass) "Image encoder GStreamer element (default is jpegenc)", GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * GstCameraBin:image-formatter: + * + * Set up an image formatter (for example, jifmux) element. + * This property can only be set while #GstCameraBin is in NULL state. + * The ownership of the element will be taken by #GstCameraBin. + */ + + g_object_class_install_property (gobject_class, ARG_IMAGE_FORMATTER, + g_param_spec_object ("image-formatter", "Image formatter", + "Image formatter GStreamer element (default is jifmux)", + GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** * GstCameraBin:video-post-processing: * @@ -3320,6 +3345,8 @@ gst_camerabin_init (GstCameraBin * camera, GstCameraBinClass * gclass) camera->pad_view_vid = NULL; camera->video_preview_buffer = NULL; + camera->preview_caps = NULL; + camera->video_preview_caps = NULL; /* image capture bin */ camera->imgbin = g_object_new (GST_TYPE_CAMERABIN_IMAGE, NULL); @@ -3466,6 +3493,14 @@ gst_camerabin_set_property (GObject * object, guint prop_id, gst_camerabin_image_set_encoder (GST_CAMERABIN_IMAGE (camera->imgbin), g_value_get_object (value)); break; + case ARG_IMAGE_FORMATTER: + if (GST_STATE (camera->imgbin) != GST_STATE_NULL) { + GST_WARNING_OBJECT (camera, + "can't use set element until next image bin NULL to READY state change"); + } + gst_camerabin_image_set_formatter (GST_CAMERABIN_IMAGE (camera->imgbin), + g_value_get_object (value)); + break; case ARG_VF_SINK: if (GST_STATE (camera) != GST_STATE_NULL) { GST_ELEMENT_ERROR (camera, CORE, FAILED, @@ -3708,6 +3743,11 @@ gst_camerabin_get_property (GObject * object, guint prop_id, gst_camerabin_image_get_encoder (GST_CAMERABIN_IMAGE (camera->imgbin))); break; + case ARG_IMAGE_FORMATTER: + g_value_set_object (value, + gst_camerabin_image_get_formatter (GST_CAMERABIN_IMAGE + (camera->imgbin))); + break; case ARG_VIDEO_POST: g_value_set_object (value, gst_camerabin_video_get_post (GST_CAMERABIN_VIDEO (camera->vidbin))); @@ -3832,6 +3872,16 @@ gst_camerabin_change_state (GstElement * element, GstStateChange transition) now that actual sink has been created. */ camerabin_setup_view_elements (camera); break; + case GST_STATE_CHANGE_PAUSED_TO_READY: + /* all processing should stop and those elements could have their state + * locked, so set them explicitly here */ + if (GST_STATE (camera->imgbin) != GST_STATE_NULL) { + gst_element_set_state (camera->imgbin, GST_STATE_READY); + } + if (GST_STATE (camera->vidbin) != GST_STATE_NULL) { + gst_element_set_state (camera->vidbin, GST_STATE_READY); + } + break; case GST_STATE_CHANGE_READY_TO_NULL: gst_element_set_locked_state (camera->imgbin, FALSE); gst_element_set_locked_state (camera->vidbin, FALSE); @@ -3923,17 +3973,20 @@ gst_camerabin_provide_clock (GstElement * element) return clock; } -static gboolean +static gpointer gst_camerabin_imgbin_finished (gpointer u_data) { GstCameraBin *camera = GST_CAMERABIN (u_data); gchar *filename = NULL; - /* Get the filename of the finished image */ - g_object_get (G_OBJECT (camera->imgbin), "filename", &filename, NULL); + /* FIXME: should set a flag (and take a lock) when going to NULL, so we + * short-circuit this bit if we got shut down between thread create and now */ GST_DEBUG_OBJECT (camera, "Image encoding finished"); + /* Get the filename of the finished image */ + g_object_get (G_OBJECT (camera->imgbin), "filename", &filename, NULL); + /* Close the file of saved image */ gst_element_set_state (camera->imgbin, GST_STATE_READY); GST_DEBUG_OBJECT (camera, "Image pipeline set to READY"); @@ -3943,26 +3996,35 @@ gst_camerabin_imgbin_finished (gpointer u_data) CAMERABIN_PROCESSING_DEC_UNLOCKED (camera); } else { /* Camerabin state change to READY may have reset processing counter to - * zero. This is possible as this functions is scheduled from g_idle_add + * zero. This is possible as this functions is scheduled from another + * thread. */ GST_WARNING_OBJECT (camera, "camerabin has been forced to idle"); } g_mutex_unlock (camera->capture_mutex); - /* Send image-done signal */ - gst_camerabin_image_capture_continue (camera, filename); - g_free (filename); - /* Set image bin back to PAUSED so that buffer-allocs don't fail */ gst_element_set_state (camera->imgbin, GST_STATE_PAUSED); /* Unblock image queue pad to process next buffer */ - gst_pad_set_blocked_async (camera->pad_src_queue, FALSE, - (GstPadBlockCallback) camerabin_pad_blocked, camera); - GST_DEBUG_OBJECT (camera, "Queue srcpad unblocked"); + GST_STATE_LOCK (camera); + if (camera->pad_src_queue) { + gst_pad_set_blocked_async (camera->pad_src_queue, FALSE, + (GstPadBlockCallback) camerabin_pad_blocked, camera); + GST_DEBUG_OBJECT (camera, "Queue srcpad unblocked"); + } else { + GST_DEBUG_OBJECT (camera, "Queue srcpad unreffed already, doesn't need " + "to unblock"); + } + GST_STATE_UNLOCK (camera); - /* disconnect automatically */ - return FALSE; + /* Send image-done signal */ + gst_camerabin_image_capture_continue (camera, filename); + g_free (filename); + + GST_INFO_OBJECT (camera, "leaving helper thread"); + gst_object_unref (camera); + return NULL; } /* @@ -3990,10 +4052,12 @@ gst_camerabin_handle_message_func (GstBin * bin, GstMessage * msg) } else if (GST_MESSAGE_SRC (msg) == GST_OBJECT (camera->imgbin)) { /* Image eos */ GST_DEBUG_OBJECT (camera, "got image eos message"); - /* Calling callback directly will deadlock in - imagebin state change functions */ - g_idle_add_full (G_PRIORITY_HIGH_IDLE, gst_camerabin_imgbin_finished, - camera, NULL); + /* Can't change state here, since we're in the streaming thread */ + if (!g_thread_create (gst_camerabin_imgbin_finished, + gst_object_ref (camera), FALSE, NULL)) { + /* FIXME: what do do if this fails? */ + gst_object_unref (camera); + } } break; case GST_MESSAGE_ERROR: diff --git a/gst/camerabin2/Makefile.am b/gst/camerabin2/Makefile.am index 24f497ed57..3433263ad5 100644 --- a/gst/camerabin2/Makefile.am +++ b/gst/camerabin2/Makefile.am @@ -1,7 +1,6 @@ plugin_LTLIBRARIES = libgstcamerabin2.la libgstcamerabin2_la_SOURCES = gstviewfinderbin.c \ - gstimagecapturebin.c \ camerabingeneral.c \ gstwrappercamerabinsrc.c \ gstcamerabin2.c \ @@ -23,7 +22,22 @@ libgstcamerabin2_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstcamerabin2_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstviewfinderbin.h \ - gstimagecapturebin.h \ camerabingeneral.h \ gstwrappercamerabinsrc.h \ gstcamerabin2.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstcamerabin2 -:SHARED libgstcamerabin2 \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstcamerabin2_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstcamerabin2_la_CFLAGS) \ + -:LDFLAGS $(libgstcamerabin2_la_LDFLAGS) \ + $(libgstcamerabin2_la_LIBADD) \ + -ldl \ + -:LIBFILTER_STATIC gstphotography-@GST_MAJORMINOR@ \ + gstbasecamerabinsrc-@GST_MAJORMINOR@ \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/camerabin2/PORTING b/gst/camerabin2/PORTING index c9b6dd8256..be99ffce5d 100644 --- a/gst/camerabin2/PORTING +++ b/gst/camerabin2/PORTING @@ -8,10 +8,13 @@ each capture. Camerabin2 allows the application to use a multifilesink-like approach, the application can set a file with a '%d' marker, this marker will be automatically replaced by a number and be autoincremented after each capture. +The property is now called 'location' instead of 'filename' * Capture signals The signals were renamed from capture-start/stop to start/stop-capture as this is the usual naming on actions. +Additionally, stop-capture is now async, the user should check 'idle' property +to be sure that it can shut camerabin2. * image-done In camerabin, image-done is a signal, in camerabin2, it is a bus message @@ -20,3 +23,15 @@ In camerabin, image-done is a signal, in camerabin2, it is a bus message In camerabin, video/audio encoder/muxer are selected by passing GstElements to camerabin properties. In camerabin2, a GstEncodingProfile is passed as a property and encodebin manages to instantiate the elements for the format. + +* Previews +new "post-previews" property for enabling/disabling preview image posting + +* Configuring resolution and framerate +Camerabin2 has new GstCaps type properties for configuring capture and +viewfinder formats: + video-capture-caps + image-capture-caps + audio-capture-caps + viewfinder-caps + diff --git a/gst/camerabin2/camerabin2-src.txt b/gst/camerabin2/camerabin2-src.txt new file mode 100644 index 0000000000..ef031f9806 --- /dev/null +++ b/gst/camerabin2/camerabin2-src.txt @@ -0,0 +1,81 @@ +=== Camerabin2 Source Requirements (draft) === + +This small document contains a collection of notes on different requirements +of a camerabin2 source element. + + +-- General -- +It is recommended that camerabin2 source elements inherit from basecamerasrc +from gst-plugins-bad. + + +-- Pads -- +Camerabin2 sources must have 3 static pads named 'vfsrc', 'imgsrc' and +'vidsrc'. + +From an external point of view, all 3 pads work independently and camerabin2 +makes no assumptions about relations about them (caps they can produce, or if +the same buffer is pushed to 2 different pads). + +'vfsrc' is the pad where the viewfinder buffers should be pushed, it will +be feeding a video sink. This is the same scenario as a 'regular' source +feeding a video sink. Buffers should be continuously pushed on this pad. + +'imgsrc' is the pad where image capture buffers are pushed. Timestamps aren't +really important here as the images are going to be encoded and saved +separately from each other. For each capture in image mode, one buffer should +be pushed on this pad. + +'vidsrc' is the pad where video capture buffers are pushed. Once capture is +started, buffers should start being pushed on this pad until the capture is +stopped. +-> TODO - define how segments/timestamps should work here +-> TODO - How to make audio and video sync properly + + +-- Capture -- +The sources should have a 'mode' property that informs the source of the +current capturing mode. The available options are image or video. + +There are 2 signals that should be implemented, start-capture and +stop-capture, they take no arguments. + +On image mode, start-capture tells the source to push an image capture +buffer on its imgsrc pad. For video mode, start-capture tells the source +to start pushing buffers on the vidsrc pad, it should only stop +pushing when a stop-capture signal is received. In either case, it is +recommended that the viewfinder pad keeps pushing buffers so the user +has a smooth experience. + +Note that basecamerasrc already has the mode property and start/stop-capture +signals. It has functions that should be overriden by its child classes to +implement the handling of these actions. + + +-- Previews -- +Camerabin2 sources must have a post-previews boolean property that the user +can select if we wants or not preview images. + +Previews are posted on the bus as custom 'preview-image' messages. This message +must have a 'buffer' field that contains a GstBuffer, the preview. + +Additionally, there should be a preview-caps property that is used to inform the +camera source what is the expected format of the preview image. + +A preview image should be posted for each capture. + + +-- Negotiation -- +Capture caps selection on camerabin2 works just like gstreamer's default +caps negotiation. Camerabin2 puts capsfilters downstream from each of the +camera source pads. The camera source can simply get_caps on the peer of +each of its pads to know what are the allowed caps for that pad. + + +-- Renegotiation -- +Easy renegotiation isn't supported on gstreamer yet (there is some ongoing work +currently). Camerabin2 will use a custom 'renegotiate' event, no fields to +indicate that a certain pad should renegotiate its caps. + +Upon receiving this event, a pad should get_caps on its peer and do the caps +negotiation again. It is likely that a new format was requested. diff --git a/gst/camerabin2/camerabingeneral.c b/gst/camerabin2/camerabingeneral.c index 2f5bd05b1a..8758935a45 100644 --- a/gst/camerabin2/camerabingeneral.c +++ b/gst/camerabin2/camerabingeneral.c @@ -26,12 +26,16 @@ * #GstCameraBinVideo. * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include -#include -#include #include +#include + #include "camerabingeneral.h" /** @@ -157,8 +161,9 @@ gst_camerabin_create_and_add_element (GstBin * bin, const gchar * elem_name, new_elem = gst_element_factory_make (elem_name, instance_name); if (!new_elem) { - GST_ELEMENT_ERROR (bin, CORE, MISSING_PLUGIN, (NULL), - ("could not create \"%s\" element.", elem_name)); + GST_ELEMENT_ERROR (bin, CORE, MISSING_PLUGIN, + (_("Missing element '%s' - check your GStreamer installation."), + elem_name), (NULL)); } else if (!gst_camerabin_add_element (bin, new_elem)) { new_elem = NULL; } @@ -278,197 +283,3 @@ gst_camerabin_drop_eos_probe (GstPad * pad, GstEvent * event, gpointer u_data) } return ret; } - -static GstFlowReturn -gst_camerabin_preview_pipeline_new_preroll (GstAppSink * appsink, - gpointer user_data) -{ - GstBuffer *buffer; - - buffer = gst_app_sink_pull_preroll (appsink); - gst_buffer_unref (buffer); - - return GST_FLOW_OK; -} - -static GstFlowReturn -gst_camerabin_preview_pipeline_new_buffer (GstAppSink * appsink, - gpointer user_data) -{ - GstBuffer *buffer; - GstStructure *s; - GstMessage *msg; - GstCameraBinPreviewPipelineData *data; - - data = user_data; - - buffer = gst_app_sink_pull_buffer (appsink); - s = gst_structure_new (GST_BASE_CAMERA_SRC_PREVIEW_MESSAGE_NAME, - "buffer", GST_TYPE_BUFFER, buffer, NULL); - gst_buffer_unref (buffer); - msg = gst_message_new_element (GST_OBJECT (data->element), s); - - GST_DEBUG_OBJECT (data->element, "sending message with preview image"); - if (gst_element_post_message (data->element, msg) == FALSE) { - GST_WARNING_OBJECT (data->element, - "This element has no bus, therefore no message sent!"); - } - - return GST_FLOW_OK; -} - -/** - * gst_camerabin_create_preview_pipeline: - * @element: Owner of this pipeline - * @filter: Custom filter to process preview data (an extra ref is taken) - * - * Creates a new previewing pipeline that can receive buffers - * to be posted as camerabin preview messages for @element - * - * Returns: The newly created #GstCameraBinPreviewPipelineData - */ -GstCameraBinPreviewPipelineData * -gst_camerabin_create_preview_pipeline (GstElement * element, - GstElement * filter) -{ - GstCameraBinPreviewPipelineData *data; - GstElement *csp; - GstElement *csp2; - GstElement *vscale; - gboolean added = FALSE; - GstAppSinkCallbacks callbacks = { 0, }; - - data = g_new (GstCameraBinPreviewPipelineData, 1); - - data->pipeline = gst_pipeline_new ("preview-pipeline"); - data->appsrc = gst_element_factory_make ("appsrc", "preview-appsrc"); - data->capsfilter = gst_element_factory_make ("capsfilter", - "preview-capsfilter"); - data->appsink = gst_element_factory_make ("appsink", "preview-appsink"); - csp = gst_element_factory_make ("ffmpegcolorspace", "preview-csp0"); - csp2 = gst_element_factory_make ("ffmpegcolorspace", "preview-csp1"); - vscale = gst_element_factory_make ("videoscale", "preview-vscale"); - - if (!data->appsrc || !data->capsfilter || !data->appsink || !csp || - !csp2 || !vscale) { - goto error; - } - - gst_bin_add_many (GST_BIN (data->pipeline), data->appsrc, data->capsfilter, - data->appsink, csp, csp2, vscale, NULL); - if (filter) - gst_bin_add (GST_BIN (data->pipeline), gst_object_ref (filter)); - added = TRUE; - - if (filter) { - if (!gst_element_link_many (data->appsrc, filter, csp, vscale, csp2, - data->capsfilter, data->appsink, NULL)) - goto error; - } else { - if (!gst_element_link_many (data->appsrc, csp, vscale, csp2, - data->capsfilter, data->appsink, NULL)) - goto error; - } - - callbacks.new_preroll = gst_camerabin_preview_pipeline_new_preroll; - callbacks.new_buffer = gst_camerabin_preview_pipeline_new_buffer; - gst_app_sink_set_callbacks ((GstAppSink *) data->appsink, &callbacks, data, - NULL); - - g_object_set (data->appsink, "sync", FALSE, NULL); - - data->element = element; - data->filter = filter; - - return data; -error: - GST_WARNING ("Failed to create camerabin's preview pipeline"); - if (!added) { - if (csp) - gst_object_unref (csp); - if (csp2) - gst_object_unref (csp2); - if (vscale) - gst_object_unref (vscale); - if (data->appsrc) - gst_object_unref (data->appsrc); - if (data->capsfilter) - gst_object_unref (data->capsfilter); - if (data->appsink) - gst_object_unref (data->appsink); - } - gst_camerabin_destroy_preview_pipeline (data); - return NULL; -} - -/** - * gst_camerabin_destroy_preview_pipeline: - * @preview: the #GstCameraBinPreviewPipelineData - * - * Frees a #GstCameraBinPreviewPipelineData - */ -void -gst_camerabin_destroy_preview_pipeline (GstCameraBinPreviewPipelineData * - preview) -{ - if (preview->pipeline) { - gst_element_set_state (preview->pipeline, GST_STATE_NULL); - gst_object_unref (preview->pipeline); - } - g_free (preview); -} - -/** - * gst_camerabin_preview_pipeline_post: - * @preview: the #GstCameraBinPreviewPipelineData - * @buffer: the buffer to be posted as a preview - * - * Converts the @buffer to the desired format and posts the preview - * message to the bus. - * - * Returns: %TRUE on success - */ -gboolean -gst_camerabin_preview_pipeline_post (GstCameraBinPreviewPipelineData * preview, - GstBuffer * buffer) -{ - g_return_val_if_fail (preview != NULL, FALSE); - g_return_val_if_fail (preview->pipeline != NULL, FALSE); - g_return_val_if_fail (buffer, FALSE); - - gst_app_src_push_buffer ((GstAppSrc *) preview->appsrc, - gst_buffer_ref (buffer)); - - return TRUE; -} - -/** - * gst_camerabin_preview_set_caps: - * @preview: the #GstCameraBinPreviewPipelineData - * @caps: the #GstCaps to be set - * - * The caps that preview buffers should have when posted - * on the bus - */ -void -gst_camerabin_preview_set_caps (GstCameraBinPreviewPipelineData * preview, - GstCaps * caps) -{ - GstState state, pending; - GstStateChangeReturn ret; - - g_return_if_fail (preview != NULL); - - ret = gst_element_get_state (preview->pipeline, &state, &pending, 0); - if (ret == GST_STATE_CHANGE_FAILURE) { - /* make it try again */ - state = GST_STATE_PLAYING; - pending = GST_STATE_VOID_PENDING; - } - - gst_element_set_state (preview->pipeline, GST_STATE_NULL); - g_object_set (preview->capsfilter, "caps", caps, NULL); - if (pending != GST_STATE_VOID_PENDING) - state = pending; - gst_element_set_state (preview->pipeline, state); -} diff --git a/gst/camerabin2/camerabingeneral.h b/gst/camerabin2/camerabingeneral.h index f39cbd77ef..5c0815411c 100644 --- a/gst/camerabin2/camerabingeneral.h +++ b/gst/camerabin2/camerabingeneral.h @@ -23,23 +23,6 @@ #include -typedef struct -{ - GstElement *pipeline; - - GstElement *appsrc; - GstElement *filter; - GstElement *capsfilter; - GstElement *appsink; - - GstElement *element; -} GstCameraBinPreviewPipelineData; - -GstCameraBinPreviewPipelineData *gst_camerabin_create_preview_pipeline (GstElement * element, GstElement * filter); -void gst_camerabin_destroy_preview_pipeline (GstCameraBinPreviewPipelineData * preview); -gboolean gst_camerabin_preview_pipeline_post (GstCameraBinPreviewPipelineData * preview, GstBuffer * buffer); -void gst_camerabin_preview_set_caps (GstCameraBinPreviewPipelineData * preview, GstCaps * caps); - gboolean gst_camerabin_try_add_element (GstBin * bin, const gchar * srcpad, GstElement * new_elem, const gchar * dstpad); gboolean gst_camerabin_add_element (GstBin * bin, GstElement * new_elem); gboolean gst_camerabin_add_element_full (GstBin * bin, const gchar * srcpad, GstElement * new_elem, const gchar * dstpad); diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c index d7139a4ab6..9df16a1ddc 100644 --- a/gst/camerabin2/gstcamerabin2.c +++ b/gst/camerabin2/gstcamerabin2.c @@ -52,8 +52,34 @@ #include "config.h" #endif +#include + #include #include "gstcamerabin2.h" +#include +#include + +#define GST_CAMERA_BIN_PROCESSING_INC(c) \ +{ \ + gint bef = g_atomic_int_exchange_and_add (&c->processing_counter, 1); \ + if (bef == 0) \ + g_object_notify (G_OBJECT (c), "idle"); \ + GST_DEBUG_OBJECT ((c), "Processing counter incremented to: %d", \ + bef + 1); \ +} + +#define GST_CAMERA_BIN_PROCESSING_DEC(c) \ +{ \ + if (g_atomic_int_dec_and_test (&c->processing_counter)) \ + g_object_notify (G_OBJECT (c), "idle"); \ + GST_DEBUG_OBJECT ((c), "Processing counter decremented"); \ +} + +#define GST_CAMERA_BIN_RESET_PROCESSING_COUNTER(c) \ +{ \ + g_atomic_int_set (&c->processing_counter, 0); \ + GST_DEBUG_OBJECT ((c), "Processing counter reset"); \ +} GST_DEBUG_CATEGORY_STATIC (gst_camera_bin_debug); #define GST_CAT_DEFAULT gst_camera_bin_debug @@ -76,7 +102,18 @@ enum PROP_IMAGE_FILTER, PROP_VIDEO_FILTER, PROP_VIEWFINDER_FILTER, - PROP_PREVIEW_FILTER + PROP_PREVIEW_FILTER, + PROP_VIEWFINDER_SINK, + PROP_VIEWFINDER_SUPPORTED_CAPS, + PROP_VIEWFINDER_CAPS, + PROP_AUDIO_SRC, + PROP_MUTE_AUDIO, + PROP_AUDIO_CAPTURE_SUPPORTED_CAPS, + PROP_AUDIO_CAPTURE_CAPS, + PROP_ZOOM, + PROP_MAX_ZOOM, + PROP_IMAGE_ENCODING_PROFILE, + PROP_IDLE }; enum @@ -93,6 +130,10 @@ static guint camerabin_signals[LAST_SIGNAL]; #define DEFAULT_VID_LOCATION "vid_%d" #define DEFAULT_IMG_LOCATION "img_%d" #define DEFAULT_POST_PREVIEWS TRUE +#define DEFAULT_MUTE_AUDIO FALSE +#define DEFAULT_IDLE TRUE + +#define DEFAULT_AUDIO_SRC "autoaudiosrc" /******************************** * Standard GObject boilerplate * @@ -107,6 +148,8 @@ static void gst_camera_bin_dispose (GObject * object); static void gst_camera_bin_finalize (GObject * object); static void gst_camera_bin_handle_message (GstBin * bin, GstMessage * message); +static gboolean gst_camera_bin_send_event (GstElement * element, + GstEvent * event); GType gst_camera_bin_get_type (void) @@ -170,6 +213,40 @@ gst_camera_bin_start_capture (GstCameraBin * camerabin) GST_DEBUG_OBJECT (camerabin, "Received start-capture"); + /* check that we have a valid location */ + if ((camerabin->mode == MODE_VIDEO && camerabin->video_location == NULL) + || (camerabin->mode == MODE_IMAGE && camerabin->image_location == NULL)) { + GST_ELEMENT_ERROR (camerabin, RESOURCE, OPEN_WRITE, + (_("File location is set to NULL, please set it to a valid filename")), + (NULL)); + return; + } + + GST_CAMERA_BIN_PROCESSING_INC (camerabin); + + if (camerabin->mode == MODE_VIDEO && camerabin->audio_src) { + gst_element_set_state (camerabin->audio_src, GST_STATE_READY); + /* need to reset eos status (pads could be flushing) */ + gst_element_set_state (camerabin->audio_queue, GST_STATE_READY); + gst_element_set_state (camerabin->audio_convert, GST_STATE_READY); + gst_element_set_state (camerabin->audio_capsfilter, GST_STATE_READY); + gst_element_set_state (camerabin->audio_volume, GST_STATE_READY); + + gst_element_sync_state_with_parent (camerabin->audio_queue); + gst_element_sync_state_with_parent (camerabin->audio_convert); + gst_element_sync_state_with_parent (camerabin->audio_capsfilter); + gst_element_sync_state_with_parent (camerabin->audio_volume); + } + + g_signal_emit_by_name (camerabin->src, "start-capture", NULL); + if (camerabin->mode == MODE_VIDEO && camerabin->audio_src) + gst_element_set_state (camerabin->audio_src, GST_STATE_PLAYING); + + /* + * We have to push tags after start capture because the video elements + * might be flushing from the previous capture and are reset only on the + * notify from ready for capture going to FALSE + */ taglist = gst_tag_setter_get_tag_list (GST_TAG_SETTER (camerabin)); if (taglist) { GstPad *active_pad; @@ -190,14 +267,18 @@ gst_camera_bin_start_capture (GstCameraBin * camerabin) gst_object_unref (active_pad); } - g_signal_emit_by_name (camerabin->src, "start-capture", NULL); } static void gst_camera_bin_stop_capture (GstCameraBin * camerabin) { + GST_DEBUG_OBJECT (camerabin, "Received stop-capture"); if (camerabin->src) g_signal_emit_by_name (camerabin->src, "stop-capture", NULL); + + if (camerabin->mode == MODE_VIDEO && camerabin->audio_src) { + gst_element_send_event (camerabin->audio_src, gst_event_new_eos ()); + } } static void @@ -222,27 +303,40 @@ gst_camera_bin_src_notify_readyforcapture (GObject * obj, GParamSpec * pspec, GstCameraBin *camera = GST_CAMERA_BIN_CAST (user_data); gboolean ready; - if (camera->mode == MODE_VIDEO) { - g_object_get (camera->src, "ready-for-capture", &ready, NULL); - if (!ready) { - gchar *location; + g_object_get (camera->src, "ready-for-capture", &ready, NULL); + if (!ready) { + gchar *location = NULL; + if (camera->mode == MODE_VIDEO) { /* a video recording is about to start, we reset the videobin to clear eos/flushing state * also need to clean the queue ! capsfilter before it */ - gst_element_set_state (camera->encodebin, GST_STATE_NULL); gst_element_set_state (camera->videosink, GST_STATE_NULL); - gst_element_set_state (camera->videobin_queue, GST_STATE_NULL); + gst_element_set_state (camera->video_encodebin, GST_STATE_NULL); gst_element_set_state (camera->videobin_capsfilter, GST_STATE_NULL); + gst_element_set_state (camera->videobin_queue, GST_STATE_NULL); location = g_strdup_printf (camera->video_location, camera->video_index++); GST_DEBUG_OBJECT (camera, "Switching videobin location to %s", location); g_object_set (camera->videosink, "location", location, NULL); g_free (location); - gst_element_set_state (camera->encodebin, GST_STATE_PLAYING); gst_element_set_state (camera->videosink, GST_STATE_PLAYING); + gst_element_set_state (camera->video_encodebin, GST_STATE_PLAYING); gst_element_set_state (camera->videobin_capsfilter, GST_STATE_PLAYING); gst_element_set_state (camera->videobin_queue, GST_STATE_PLAYING); + } else if (camera->mode == MODE_IMAGE) { + gst_element_set_state (camera->imagesink, GST_STATE_NULL); + gst_element_set_state (camera->image_encodebin, GST_STATE_NULL); + gst_element_set_state (camera->imagebin_queue, GST_STATE_NULL); + gst_element_set_state (camera->imagebin_capsfilter, GST_STATE_NULL); + GST_DEBUG_OBJECT (camera, "Switching imagebin location to %s", location); + g_object_set (camera->imagesink, "location", camera->image_location, + NULL); + gst_element_set_state (camera->imagesink, GST_STATE_PLAYING); + gst_element_set_state (camera->image_encodebin, GST_STATE_PLAYING); + gst_element_set_state (camera->imagebin_capsfilter, GST_STATE_PLAYING); + gst_element_set_state (camera->imagebin_queue, GST_STATE_PLAYING); } + } } @@ -262,6 +356,20 @@ gst_camera_bin_dispose (GObject * object) if (camerabin->user_src) gst_object_unref (camerabin->user_src); + if (camerabin->audio_src) + gst_object_unref (camerabin->audio_src); + if (camerabin->user_audio_src) + gst_object_unref (camerabin->user_audio_src); + + if (camerabin->audio_capsfilter) + gst_object_unref (camerabin->audio_capsfilter); + if (camerabin->audio_queue) + gst_object_unref (camerabin->audio_queue); + if (camerabin->audio_convert) + gst_object_unref (camerabin->audio_convert); + if (camerabin->audio_volume) + gst_object_unref (camerabin->audio_volume); + if (camerabin->viewfinderbin) gst_object_unref (camerabin->viewfinderbin); if (camerabin->viewfinderbin_queue) @@ -269,17 +377,32 @@ gst_camera_bin_dispose (GObject * object) if (camerabin->viewfinderbin_capsfilter) gst_object_unref (camerabin->viewfinderbin_capsfilter); + if (camerabin->video_encodebin_signal_id) + g_signal_handler_disconnect (camerabin->video_encodebin, + camerabin->video_encodebin_signal_id); + + if (camerabin->videosink_probe) { + GstPad *pad = gst_element_get_static_pad (camerabin->videosink, "sink"); + gst_pad_remove_data_probe (pad, camerabin->videosink_probe); + gst_object_unref (pad); + } + if (camerabin->videosink) gst_object_unref (camerabin->videosink); - if (camerabin->encodebin) - gst_object_unref (camerabin->encodebin); + if (camerabin->video_encodebin) + gst_object_unref (camerabin->video_encodebin); if (camerabin->videobin_queue) gst_object_unref (camerabin->videobin_queue); if (camerabin->videobin_capsfilter) gst_object_unref (camerabin->videobin_capsfilter); - if (camerabin->imagebin) - gst_object_unref (camerabin->imagebin); + if (camerabin->image_encodebin_signal_id) + g_signal_handler_disconnect (camerabin->image_encodebin, + camerabin->image_encodebin_signal_id); + if (camerabin->imagesink) + gst_object_unref (camerabin->imagesink); + if (camerabin->image_encodebin) + gst_object_unref (camerabin->image_encodebin); if (camerabin->imagebin_queue) gst_object_unref (camerabin->imagebin_queue); if (camerabin->imagebin_capsfilter) @@ -301,6 +424,8 @@ gst_camera_bin_dispose (GObject * object) if (camerabin->video_profile) gst_encoding_profile_unref (camerabin->video_profile); + if (camerabin->image_profile) + gst_encoding_profile_unref (camerabin->image_profile); if (camerabin->preview_caps) gst_caps_replace (&camerabin->preview_caps, NULL); @@ -346,6 +471,7 @@ gst_camera_bin_class_init (GstCameraBinClass * klass) object_class->get_property = gst_camera_bin_get_property; element_class->change_state = GST_DEBUG_FUNCPTR (gst_camera_bin_change_state); + element_class->send_event = GST_DEBUG_FUNCPTR (gst_camera_bin_send_event); bin_class->handle_message = gst_camera_bin_handle_message; @@ -371,10 +497,38 @@ gst_camera_bin_class_init (GstCameraBinClass * klass) DEFAULT_IMG_LOCATION, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_CAMERA_SRC, - g_param_spec_object ("camera-src", "Camera source", - "The camera source element to be used", + g_param_spec_object ("camera-source", "Camera source", + "The camera source element to be used. It is only taken into use on" + " the next null to ready transition", GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (object_class, PROP_AUDIO_SRC, + g_param_spec_object ("audio-source", "Audio source", + "The audio source element to be used on video recordings. It is only" + " taken into use on the next null to ready transition", + GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (object_class, PROP_MUTE_AUDIO, + g_param_spec_boolean ("mute", "Mute", + "If the audio recording should be muted. Note that this still " + "saves audio data to the resulting file, but they are silent. Use " + "a video-profile without audio to disable audio completely", + DEFAULT_MUTE_AUDIO, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (object_class, + PROP_AUDIO_CAPTURE_SUPPORTED_CAPS, + g_param_spec_boxed ("audio-capture-supported-caps", + "Audio capture supported caps", + "Formats supported for capturing audio represented as GstCaps", + GST_TYPE_CAPS, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (object_class, + PROP_AUDIO_CAPTURE_CAPS, + g_param_spec_boxed ("audio-capture-caps", + "Audio capture caps", + "Format to capture audio for video recording represented as GstCaps", + GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (object_class, PROP_IMAGE_CAPTURE_SUPPORTED_CAPS, g_param_spec_boxed ("image-capture-supported-caps", @@ -415,8 +569,8 @@ gst_camera_bin_class_init (GstCameraBinClass * klass) g_object_class_install_property (object_class, PROP_VIDEO_ENCODING_PROFILE, gst_param_spec_mini_object ("video-profile", "Video Profile", - "The GstEncodingProfile to use for video recording", - GST_TYPE_ENCODING_PROFILE, + "The GstEncodingProfile to use for video recording. Audio is enabled " + "when this profile supports audio.", GST_TYPE_ENCODING_PROFILE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_IMAGE_FILTER, @@ -443,6 +597,69 @@ gst_camera_bin_class_init (GstCameraBinClass * klass) " (Should be set on NULL state)", GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (object_class, PROP_VIEWFINDER_SINK, + g_param_spec_object ("viewfinder-sink", "Viewfinder sink", + "The video sink of the viewfinder. It is only taken into use" + " on the next null to ready transition", + GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (object_class, + PROP_VIEWFINDER_CAPS, + g_param_spec_boxed ("viewfinder-caps", + "Viewfinder caps", + "Restricts the caps that can be used on the viewfinder", + GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (object_class, PROP_ZOOM, + g_param_spec_float ("zoom", "Zoom", + "Digital zoom factor (e.g. 1.5 means 1.5x)", MIN_ZOOM, MAX_ZOOM, + DEFAULT_ZOOM, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (object_class, PROP_MAX_ZOOM, + g_param_spec_float ("max-zoom", "Maximum zoom level (note: may change " + "depending on resolution/implementation)", + "Digital zoom factor (e.g. 1.5 means 1.5x)", MIN_ZOOM, G_MAXFLOAT, + MAX_ZOOM, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + + /* TODO + * Review before stable + * - We use a profile for video recording properties and here we have + * elements for image capture. This is slightly inconsistent. + * - One problem with using encodebin for images here is how jifmux + * autoplugging works. We need to give it a higher rank and fix its + * caps (it has image/jpeg on sink and src pads). Preliminary tests + * show that jifmux is picked if image/jpeg is the caps of a container + * profile. So this could work. + * - There seems to be a problem with encodebin for images currently as + * it autoplugs a videorate that ony starts outputing buffers after + * getting the 2nd buffer. + */ + g_object_class_install_property (object_class, PROP_IMAGE_ENCODING_PROFILE, + gst_param_spec_mini_object ("image-profile", "Image Profile", + "The GstEncodingProfile to use for image captures.", + GST_TYPE_ENCODING_PROFILE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + + g_object_class_install_property (object_class, PROP_IDLE, + g_param_spec_boolean ("idle", "Idle", + "If camerabin2 is idle (not doing captures).", DEFAULT_IDLE, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + + /* TODO review before going stable + * We have viewfinder-supported-caps that returns the caps that the + * camerasrc can produce on its viewfinder pad, this could easily be + * confused with what the viewfinder-sink accepts. + * + * Do we want to add a 'viewfinder-sink-supported-caps' or maybe change + * the name of this property? + */ + g_object_class_install_property (object_class, + PROP_VIEWFINDER_SUPPORTED_CAPS, + g_param_spec_boxed ("viewfinder-supported-caps", + "Camera source Viewfinder pad supported caps", + "The caps that the camera source can produce on the viewfinder pad", + GST_TYPE_CAPS, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); /** * GstCameraBin::capture-start: @@ -477,6 +694,8 @@ gst_camera_bin_init (GstCameraBin * camera) camera->video_location = g_strdup (DEFAULT_VID_LOCATION); camera->image_location = g_strdup (DEFAULT_IMG_LOCATION); camera->viewfinderbin = gst_element_factory_make ("viewfinderbin", "vf-bin"); + camera->zoom = DEFAULT_ZOOM; + camera->max_zoom = MAX_ZOOM; /* capsfilters are created here as we proxy their caps properties and * this way we avoid having to store the caps while on NULL state to @@ -493,6 +712,11 @@ gst_camera_bin_init (GstCameraBin * camera) gst_object_ref (camera->videobin_capsfilter), gst_object_ref (camera->imagebin_capsfilter), gst_object_ref (camera->viewfinderbin_capsfilter), NULL); + + /* these elements are only added if they are going to be used */ + camera->audio_capsfilter = gst_element_factory_make ("capsfilter", + "audio-capsfilter"); + camera->audio_volume = gst_element_factory_make ("volume", "audio-volume"); } static void @@ -514,19 +738,45 @@ gst_image_capture_bin_post_image_done (GstCameraBin * camera, static void gst_camera_bin_handle_message (GstBin * bin, GstMessage * message) { - if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT) { - const GstStructure *structure = gst_message_get_structure (message); - const gchar *filename; + switch (GST_MESSAGE_TYPE (message)) { + case GST_MESSAGE_ELEMENT:{ + const GstStructure *structure = gst_message_get_structure (message); + const gchar *filename; - if (gst_structure_has_name (structure, "GstMultiFileSink")) { - filename = gst_structure_get_string (structure, "filename"); - if (filename) { - gst_image_capture_bin_post_image_done (GST_CAMERA_BIN_CAST (bin), - filename); + if (gst_structure_has_name (structure, "GstMultiFileSink")) { + GST_CAMERA_BIN_PROCESSING_DEC (GST_CAMERA_BIN_CAST (bin)); + filename = gst_structure_get_string (structure, "filename"); + if (filename) { + gst_image_capture_bin_post_image_done (GST_CAMERA_BIN_CAST (bin), + filename); + } } } + break; + case GST_MESSAGE_WARNING:{ + GError *err = NULL; + gchar *debug = NULL; + + gst_message_parse_warning (message, &err, &debug); + if (err->domain == GST_RESOURCE_ERROR) { + /* some capturing failed */ + GST_CAMERA_BIN_PROCESSING_DEC (GST_CAMERA_BIN_CAST (bin)); + } + } + break; + case GST_MESSAGE_EOS:{ + GstElement *src = GST_ELEMENT (GST_MESSAGE_SRC (message)); + if (src == GST_CAMERA_BIN_CAST (bin)->videosink) { + GST_DEBUG_OBJECT (bin, "EOS from video branch"); + GST_CAMERA_BIN_PROCESSING_DEC (GST_CAMERA_BIN_CAST (bin)); + } + } + break; + default: + break; } - GST_BIN_CLASS (parent_class)->handle_message (bin, message); + if (message) + GST_BIN_CLASS (parent_class)->handle_message (bin, message); } /* @@ -571,6 +821,147 @@ gst_camera_bin_check_and_replace_filter (GstCameraBin * camera, } } +static void +encodebin_element_added (GstElement * encodebin, GstElement * new_element, + GstCameraBin * camera) +{ + GstElementFactory *factory = gst_element_get_factory (new_element); + + if (factory != NULL) { + if (strcmp (GST_PLUGIN_FEATURE_NAME (factory), "audiorate") == 0 || + strcmp (GST_PLUGIN_FEATURE_NAME (factory), "videorate") == 0) { + g_object_set (new_element, "skip-to-first", TRUE, NULL); + } + } +} + +#define VIDEO_PAD 1 +#define AUDIO_PAD 2 +static GstPad * +encodebin_find_pad (GstCameraBin * camera, GstElement * encodebin, + gint pad_type) +{ + GstPad *pad = NULL; + GstIterator *iter; + gboolean done; + + GST_DEBUG_OBJECT (camera, "Looking at encodebin pads, searching for %s pad", + pad_type == VIDEO_PAD ? "video" : "audio"); + + iter = gst_element_iterate_sink_pads (encodebin); + done = FALSE; + while (!done) { + switch (gst_iterator_next (iter, (gpointer *) & pad)) { + case GST_ITERATOR_OK: + if (pad_type == VIDEO_PAD) { + if (strstr (GST_PAD_NAME (pad), "video") != NULL) { + GST_DEBUG_OBJECT (camera, "Found video pad %s", GST_PAD_NAME (pad)); + done = TRUE; + break; + } + } else if (pad_type == AUDIO_PAD) { + if (strstr (GST_PAD_NAME (pad), "audio") != NULL) { + GST_DEBUG_OBJECT (camera, "Found audio pad %s", GST_PAD_NAME (pad)); + done = TRUE; + break; + } + } + gst_object_unref (pad); + pad = NULL; + break; + case GST_ITERATOR_RESYNC: + gst_iterator_resync (iter); + break; + case GST_ITERATOR_ERROR: + pad = NULL; + done = TRUE; + break; + case GST_ITERATOR_DONE: + pad = NULL; + done = TRUE; + break; + } + } + gst_iterator_free (iter); + + /* no static pad, try requesting one */ + if (pad == NULL) { + GstElementClass *klass; + GstPadTemplate *tmpl; + + GST_DEBUG_OBJECT (camera, "No pads found, trying to request one"); + + klass = GST_ELEMENT_GET_CLASS (encodebin); + tmpl = gst_element_class_get_pad_template (klass, pad_type == VIDEO_PAD ? + "video_%d" : "audio_%d"); + + pad = gst_element_request_pad (encodebin, tmpl, NULL, NULL); + GST_DEBUG_OBJECT (camera, "Got pad: %s", pad ? GST_PAD_NAME (pad) : "null"); + } + + return pad; +} + +static gboolean +gst_camera_bin_video_profile_has_audio (GstCameraBin * camera) +{ + const GList *list; + + g_return_val_if_fail (camera->video_profile != NULL, FALSE); + + if (GST_IS_ENCODING_VIDEO_PROFILE (camera->video_profile)) + return FALSE; + + for (list = + gst_encoding_container_profile_get_profiles ((GstEncodingContainerProfile + *) camera->video_profile); list; list = g_list_next (list)) { + GstEncodingProfile *profile = (GstEncodingProfile *) list->data; + + if (GST_IS_ENCODING_AUDIO_PROFILE (profile)) + return TRUE; + } + + return FALSE; +} + +static GstPadLinkReturn +gst_camera_bin_link_encodebin (GstCameraBin * camera, GstElement * encodebin, + GstElement * element, gint padtype) +{ + GstPadLinkReturn ret; + GstPad *srcpad; + GstPad *sinkpad = NULL; + + srcpad = gst_element_get_static_pad (element, "src"); + g_assert (srcpad != NULL); + + sinkpad = encodebin_find_pad (camera, encodebin, padtype); + + /* there may be no available sink pad for encodebin in some situations: + * e.g. missing elements or incompatible padtype */ + if (sinkpad == NULL) { + gst_object_unref (srcpad); + return GST_PAD_LINK_REFUSED; + } + + ret = gst_pad_link (srcpad, sinkpad); + gst_object_unref (sinkpad); + gst_object_unref (srcpad); + + return ret; +} + +static void +gst_camera_bin_src_notify_max_zoom_cb (GObject * self, GParamSpec * pspec, + gpointer user_data) +{ + GstCameraBin *camera = (GstCameraBin *) user_data; + + g_object_get (self, "max-zoom", &camera->max_zoom, NULL); + GST_DEBUG_OBJECT (camera, "Max zoom updated to %f", camera->max_zoom); + g_object_notify (G_OBJECT (camera), "max-zoom"); +} + /** * gst_camera_bin_create_elements: * @param camera: the #GstCameraBin @@ -587,22 +978,47 @@ static gboolean gst_camera_bin_create_elements (GstCameraBin * camera) { gboolean new_src = FALSE; + gboolean new_audio_src = FALSE; + gboolean has_audio; + gboolean profile_switched = FALSE; + const gchar *missing_element_name; if (!camera->elements_created) { + /* TODO check that elements created in _init were really created */ + + camera->video_encodebin = gst_element_factory_make ("encodebin", NULL); + if (!camera->video_encodebin) { + missing_element_name = "encodebin"; + goto missing_element; + } + camera->video_encodebin_signal_id = + g_signal_connect (camera->video_encodebin, "element-added", + (GCallback) encodebin_element_added, camera); - camera->encodebin = gst_element_factory_make ("encodebin", NULL); camera->videosink = gst_element_factory_make ("filesink", "videobin-filesink"); - camera->imagebin = gst_element_factory_make ("imagecapturebin", "imagebin"); g_object_set (camera->videosink, "async", FALSE, NULL); + /* audio elements */ + camera->audio_queue = gst_element_factory_make ("queue", "audio-queue"); + camera->audio_convert = gst_element_factory_make ("audioconvert", + "audio-convert"); + if (!camera->audio_convert) { + missing_element_name = "audioconvert"; + goto missing_element; + } + if (!camera->audio_volume) { + missing_element_name = "volume"; + goto missing_element; + } + if (camera->video_profile == NULL) { GstEncodingContainerProfile *prof; GstCaps *caps; caps = gst_caps_new_simple ("application/ogg", NULL); - prof = gst_encoding_container_profile_new ("ogg", "theora+ogg", caps, - NULL); + prof = gst_encoding_container_profile_new ("ogg", "theora+vorbis+ogg", + caps, NULL); gst_caps_unref (caps); caps = gst_caps_new_simple ("video/x-theora", NULL); @@ -613,9 +1029,54 @@ gst_camera_bin_create_elements (GstCameraBin * camera) } gst_caps_unref (caps); + caps = gst_caps_new_simple ("audio/x-vorbis", NULL); + if (!gst_encoding_container_profile_add_profile (prof, + (GstEncodingProfile *) gst_encoding_audio_profile_new (caps, + NULL, NULL, 1))) { + GST_WARNING_OBJECT (camera, "Failed to create encoding profiles"); + } + gst_caps_unref (caps); + camera->video_profile = (GstEncodingProfile *) prof; + camera->video_profile_switch = TRUE; + } + + camera->image_encodebin = gst_element_factory_make ("encodebin", NULL); + if (!camera->image_encodebin) { + missing_element_name = "encodebin"; + goto missing_element; + } + camera->image_encodebin_signal_id = + g_signal_connect (camera->image_encodebin, "element-added", + (GCallback) encodebin_element_added, camera); + + camera->imagesink = + gst_element_factory_make ("multifilesink", "imagebin-filesink"); + if (!camera->imagesink) { + missing_element_name = "multifilesink"; + goto missing_element; + } + g_object_set (camera->imagesink, "async", FALSE, "post-messages", TRUE, + NULL); + + if (camera->image_profile == NULL) { + GstEncodingContainerProfile *prof; + GstEncodingVideoProfile *vprof; + GstCaps *caps; + + caps = gst_caps_new_simple ("image/jpeg", NULL); + vprof = gst_encoding_video_profile_new (caps, NULL, NULL, 1); + gst_encoding_video_profile_set_variableframerate (vprof, TRUE); + + prof = gst_encoding_container_profile_new ("jpeg", "jpeg container", caps, + NULL); + gst_encoding_container_profile_add_profile (prof, + (GstEncodingProfile *) vprof); + + gst_caps_unref (caps); + camera->image_profile = (GstEncodingProfile *) prof; + camera->image_profile_switch = TRUE; } - g_object_set (camera->encodebin, "profile", camera->video_profile, NULL); camera->videobin_queue = gst_element_factory_make ("queue", "videobin-queue"); @@ -624,10 +1085,17 @@ gst_camera_bin_create_elements (GstCameraBin * camera) camera->viewfinderbin_queue = gst_element_factory_make ("queue", "viewfinderbin-queue"); + g_object_set (camera->viewfinderbin_queue, "leaky", 2, "silent", TRUE, + NULL); + g_object_set (camera->imagebin_queue, "max-size-time", (guint64) 0, + "silent", TRUE, NULL); + g_object_set (camera->videobin_queue, "silent", TRUE, NULL); + gst_bin_add_many (GST_BIN_CAST (camera), - gst_object_ref (camera->encodebin), + gst_object_ref (camera->video_encodebin), gst_object_ref (camera->videosink), - gst_object_ref (camera->imagebin), + gst_object_ref (camera->image_encodebin), + gst_object_ref (camera->imagesink), gst_object_ref (camera->videobin_queue), gst_object_ref (camera->imagebin_queue), gst_object_ref (camera->viewfinderbin_queue), NULL); @@ -635,11 +1103,11 @@ gst_camera_bin_create_elements (GstCameraBin * camera) /* Linking can be optimized TODO */ gst_element_link_many (camera->videobin_queue, camera->videobin_capsfilter, NULL); - gst_element_link (camera->encodebin, camera->videosink); - gst_element_link (camera->videobin_capsfilter, camera->encodebin); + gst_element_link (camera->video_encodebin, camera->videosink); gst_element_link_many (camera->imagebin_queue, camera->imagebin_capsfilter, - camera->imagebin, NULL); + NULL); + gst_element_link (camera->image_encodebin, camera->imagesink); gst_element_link_many (camera->viewfinderbin_queue, camera->viewfinderbin_capsfilter, camera->viewfinderbin, NULL); /* @@ -652,13 +1120,40 @@ gst_camera_bin_create_elements (GstCameraBin * camera) * starting recording, so we should prepare the video bin. */ gst_element_set_locked_state (camera->videosink, TRUE); + gst_element_set_locked_state (camera->imagesink, TRUE); g_object_set (camera->videosink, "location", camera->video_location, NULL); - g_object_set (camera->imagebin, "location", camera->image_location, NULL); + g_object_set (camera->imagesink, "location", camera->image_location, NULL); + } + + if (camera->video_profile_switch) { + GST_DEBUG_OBJECT (camera, "Switching encodebin's profile"); + g_object_set (camera->video_encodebin, "profile", camera->video_profile, + NULL); + if (GST_PAD_LINK_FAILED (gst_camera_bin_link_encodebin (camera, + camera->video_encodebin, camera->videobin_capsfilter, + VIDEO_PAD))) { + goto fail; + } + camera->video_profile_switch = FALSE; + + /* used to trigger relinking further down */ + profile_switched = TRUE; + } + + if (camera->image_profile_switch) { + GST_DEBUG_OBJECT (camera, "Switching encodebin's profile"); + g_object_set (camera->image_encodebin, "profile", camera->image_profile, + NULL); + if (GST_PAD_LINK_FAILED (gst_camera_bin_link_encodebin (camera, + camera->image_encodebin, camera->imagebin_capsfilter, + VIDEO_PAD))) { + goto fail; + } + camera->image_profile_switch = FALSE; } /* check if we need to replace the camera src */ - if (camera->src) { if (camera->user_src && camera->user_src != camera->src) { @@ -685,12 +1180,16 @@ gst_camera_bin_create_elements (GstCameraBin * camera) g_assert (camera->src != NULL); g_object_set (camera->src, "mode", camera->mode, NULL); - if (camera->src - && g_object_class_find_property (G_OBJECT_GET_CLASS (camera->src), - "preview-caps")) { - g_object_set (camera->src, "post-previews", camera->post_previews, - "preview-caps", camera->preview_caps, "preview-filter", - camera->preview_filter, NULL); + if (camera->src) { + if (g_object_class_find_property (G_OBJECT_GET_CLASS (camera->src), + "preview-caps")) { + g_object_set (camera->src, "post-previews", camera->post_previews, + "preview-caps", camera->preview_caps, "preview-filter", + camera->preview_filter, NULL); + } + g_object_set (camera->src, "zoom", camera->zoom, NULL); + g_signal_connect (G_OBJECT (camera->src), "notify::max-zoom", + (GCallback) gst_camera_bin_src_notify_max_zoom_cb, camera); } if (new_src) { gst_bin_add (GST_BIN_CAST (camera), gst_object_ref (camera->src)); @@ -715,8 +1214,68 @@ gst_camera_bin_create_elements (GstCameraBin * camera) camera->user_viewfinder_filter, camera->viewfinderbin_queue, camera->viewfinderbin_capsfilter); + /* check if we need to replace the camera audio src */ + has_audio = gst_camera_bin_video_profile_has_audio (camera); + if (camera->audio_src) { + if ((camera->user_audio_src && camera->user_audio_src != camera->audio_src) + || !has_audio) { + gst_bin_remove (GST_BIN_CAST (camera), camera->audio_src); + gst_bin_remove (GST_BIN_CAST (camera), camera->audio_queue); + gst_bin_remove (GST_BIN_CAST (camera), camera->audio_volume); + gst_bin_remove (GST_BIN_CAST (camera), camera->audio_capsfilter); + gst_bin_remove (GST_BIN_CAST (camera), camera->audio_convert); + gst_object_unref (camera->audio_src); + camera->audio_src = NULL; + } + } + + if (!camera->audio_src && has_audio) { + if (camera->user_audio_src) { + camera->audio_src = gst_object_ref (camera->user_audio_src); + } else { + camera->audio_src = + gst_element_factory_make (DEFAULT_AUDIO_SRC, "audiosrc"); + } + + gst_element_set_locked_state (camera->audio_src, TRUE); + new_audio_src = TRUE; + } + + if (new_audio_src) { + gst_bin_add (GST_BIN_CAST (camera), gst_object_ref (camera->audio_src)); + gst_bin_add (GST_BIN_CAST (camera), gst_object_ref (camera->audio_queue)); + gst_bin_add (GST_BIN_CAST (camera), gst_object_ref (camera->audio_volume)); + gst_bin_add (GST_BIN_CAST (camera), + gst_object_ref (camera->audio_capsfilter)); + gst_bin_add (GST_BIN_CAST (camera), gst_object_ref (camera->audio_convert)); + + gst_element_link_many (camera->audio_src, camera->audio_queue, + camera->audio_volume, + camera->audio_capsfilter, camera->audio_convert, NULL); + } + + if ((profile_switched && has_audio) || new_audio_src) { + if (GST_PAD_LINK_FAILED (gst_camera_bin_link_encodebin (camera, + camera->video_encodebin, camera->audio_convert, AUDIO_PAD))) { + goto fail; + } + } + camera->elements_created = TRUE; return TRUE; + +missing_element: + gst_element_post_message (GST_ELEMENT_CAST (camera), + gst_missing_element_message_new (GST_ELEMENT_CAST (camera), + missing_element_name)); + GST_ELEMENT_ERROR (camera, CORE, MISSING_PLUGIN, + (_("Missing element '%s' - check your GStreamer installation."), + missing_element_name), (NULL)); + goto fail; + +fail: + /* FIXME properly clean up */ + return FALSE; } static GstStateChangeReturn @@ -731,6 +1290,19 @@ gst_camera_bin_change_state (GstElement * element, GstStateChange trans) return GST_STATE_CHANGE_FAILURE; } break; + case GST_STATE_CHANGE_READY_TO_PAUSED: + GST_CAMERA_BIN_RESET_PROCESSING_COUNTER (camera); + break; + case GST_STATE_CHANGE_PAUSED_TO_READY: + if (GST_STATE (camera->videosink) >= GST_STATE_PAUSED) + gst_element_set_state (camera->videosink, GST_STATE_READY); + if (GST_STATE (camera->imagesink) >= GST_STATE_PAUSED) + gst_element_set_state (camera->imagesink, GST_STATE_READY); + break; + case GST_STATE_CHANGE_READY_TO_NULL: + gst_element_set_state (camera->videosink, GST_STATE_NULL); + gst_element_set_state (camera->imagesink, GST_STATE_NULL); + break; default: break; } @@ -739,13 +1311,28 @@ gst_camera_bin_change_state (GstElement * element, GstStateChange trans) switch (trans) { case GST_STATE_CHANGE_PAUSED_TO_READY: - if (GST_STATE (camera->videosink) >= GST_STATE_PAUSED) - gst_element_set_state (camera->videosink, GST_STATE_READY); + if (camera->audio_src && GST_STATE (camera->audio_src) >= GST_STATE_READY) + gst_element_set_state (camera->audio_src, GST_STATE_READY); gst_tag_setter_reset_tags (GST_TAG_SETTER (camera)); + GST_CAMERA_BIN_RESET_PROCESSING_COUNTER (camera); + + /* explicitly set to READY as they might be outside of the bin */ + gst_element_set_state (camera->audio_queue, GST_STATE_READY); + gst_element_set_state (camera->audio_volume, GST_STATE_READY); + gst_element_set_state (camera->audio_capsfilter, GST_STATE_READY); + gst_element_set_state (camera->audio_convert, GST_STATE_READY); break; case GST_STATE_CHANGE_READY_TO_NULL: - gst_element_set_state (camera->videosink, GST_STATE_NULL); + if (camera->audio_src) + gst_element_set_state (camera->audio_src, GST_STATE_NULL); + + /* explicitly set to NULL as they might be outside of the bin */ + gst_element_set_state (camera->audio_queue, GST_STATE_NULL); + gst_element_set_state (camera->audio_volume, GST_STATE_NULL); + gst_element_set_state (camera->audio_capsfilter, GST_STATE_NULL); + gst_element_set_state (camera->audio_convert, GST_STATE_NULL); + break; default: break; @@ -754,14 +1341,46 @@ gst_camera_bin_change_state (GstElement * element, GstStateChange trans) return ret; } +static gboolean +gst_camera_bin_send_event (GstElement * element, GstEvent * event) +{ + GstCameraBin *camera = GST_CAMERA_BIN_CAST (element); + gboolean res; + + res = GST_ELEMENT_CLASS (parent_class)->send_event (element, event); + switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_EOS: + { + GstState current; + + if (camera->videosink) { + gst_element_get_state (camera->videosink, ¤t, NULL, 0); + if (current <= GST_STATE_READY) + gst_element_post_message (camera->videosink, + gst_message_new_eos (GST_OBJECT (camera->videosink))); + } + if (camera->imagesink) { + gst_element_get_state (camera->imagesink, ¤t, NULL, 0); + if (current <= GST_STATE_READY) + gst_element_post_message (camera->imagesink, + gst_message_new_eos (GST_OBJECT (camera->imagesink))); + } + break; + } + + default: + break; + } + + return res; +} + static void gst_camera_bin_set_location (GstCameraBin * camera, const gchar * location) { GST_DEBUG_OBJECT (camera, "Setting mode %d location to %s", camera->mode, location); if (camera->mode == MODE_IMAGE) { - if (camera->imagebin) - g_object_set (camera->imagebin, "location", location, NULL); g_free (camera->image_location); camera->image_location = g_strdup (location); } else { @@ -770,6 +1389,20 @@ gst_camera_bin_set_location (GstCameraBin * camera, const gchar * location) } } +static void +gst_camera_bin_set_audio_src (GstCameraBin * camera, GstElement * src) +{ + GST_DEBUG_OBJECT (GST_OBJECT (camera), + "Setting audio source %" GST_PTR_FORMAT, src); + + if (camera->user_audio_src) + g_object_unref (camera->user_audio_src); + + if (src) + g_object_ref (src); + camera->user_audio_src = src; +} + static void gst_camera_bin_set_camera_src (GstCameraBin * camera, GstElement * src) { @@ -800,6 +1433,22 @@ gst_camera_bin_set_property (GObject * object, guint prop_id, case PROP_CAMERA_SRC: gst_camera_bin_set_camera_src (camera, g_value_get_object (value)); break; + case PROP_AUDIO_SRC: + gst_camera_bin_set_audio_src (camera, g_value_get_object (value)); + break; + case PROP_MUTE_AUDIO: + g_object_set (camera->audio_volume, "mute", g_value_get_boolean (value), + NULL); + break; + case PROP_AUDIO_CAPTURE_CAPS:{ + GST_DEBUG_OBJECT (camera, + "Setting audio capture caps to %" GST_PTR_FORMAT, + gst_value_get_caps (value)); + + g_object_set (camera->audio_capsfilter, "caps", + gst_value_get_caps (value), NULL); + } + break; case PROP_IMAGE_CAPTURE_CAPS:{ GstPad *pad = NULL; @@ -846,6 +1495,29 @@ gst_camera_bin_set_property (GObject * object, guint prop_id, } } break; + case PROP_VIEWFINDER_CAPS:{ + GstPad *pad = NULL; + + if (camera->src) + pad = + gst_element_get_static_pad (camera->src, + GST_BASE_CAMERA_SRC_VIEWFINDER_PAD_NAME); + + GST_DEBUG_OBJECT (camera, + "Setting viewfinder capture caps to %" GST_PTR_FORMAT, + gst_value_get_caps (value)); + + /* set the capsfilter caps and notify the src to renegotiate */ + g_object_set (camera->viewfinderbin_capsfilter, "caps", + gst_value_get_caps (value), NULL); + if (pad) { + GST_DEBUG_OBJECT (camera, "Pushing renegotiate on %s", + GST_PAD_NAME (pad)); + GST_PAD_EVENTFUNC (pad) (pad, gst_camera_bin_new_event_renegotiate ()); + gst_object_unref (pad); + } + } + break; case PROP_POST_PREVIEWS: camera->post_previews = g_value_get_boolean (value); if (camera->src @@ -863,8 +1535,11 @@ gst_camera_bin_set_property (GObject * object, guint prop_id, g_object_set (camera->src, "preview-caps", camera->preview_caps, NULL); break; case PROP_VIDEO_ENCODING_PROFILE: + if (camera->video_profile) + gst_encoding_profile_unref (camera->video_profile); camera->video_profile = (GstEncodingProfile *) gst_value_dup_mini_object (value); + camera->video_profile_switch = TRUE; break; case PROP_IMAGE_FILTER: if (camera->user_image_filter) @@ -895,6 +1570,28 @@ gst_camera_bin_set_property (GObject * object, guint prop_id, g_object_set (camera->src, "preview-filter", camera->preview_filter, NULL); break; + case PROP_VIEWFINDER_SINK: + g_object_set (camera->viewfinderbin, "video-sink", + g_value_get_object (value), NULL); + break; + case PROP_ZOOM: + camera->zoom = g_value_get_float (value); + /* limit to max-zoom */ + if (camera->zoom > camera->max_zoom) { + GST_DEBUG_OBJECT (camera, "Clipping zoom %f to max-zoom %f", + camera->zoom, camera->max_zoom); + camera->zoom = camera->max_zoom; + } + if (camera->src) + g_object_set (camera->src, "zoom", camera->zoom, NULL); + break; + case PROP_IMAGE_ENCODING_PROFILE: + if (camera->image_profile) + gst_encoding_profile_unref (camera->image_profile); + camera->image_profile = + (GstEncodingProfile *) gst_value_dup_mini_object (value); + camera->image_profile_switch = TRUE; + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -919,22 +1616,43 @@ gst_camera_bin_get_property (GObject * object, guint prop_id, } break; case PROP_CAMERA_SRC: - g_value_set_object (value, camera->src); + g_value_set_object (value, camera->user_src); break; + case PROP_AUDIO_SRC: + g_value_set_object (value, camera->user_audio_src); + break; + case PROP_MUTE_AUDIO:{ + gboolean mute; + + g_object_get (camera->audio_volume, "mute", &mute, NULL); + g_value_set_boolean (value, mute); + break; + } + case PROP_AUDIO_CAPTURE_SUPPORTED_CAPS: case PROP_VIDEO_CAPTURE_SUPPORTED_CAPS: + case PROP_VIEWFINDER_SUPPORTED_CAPS: case PROP_IMAGE_CAPTURE_SUPPORTED_CAPS:{ GstPad *pad; + GstElement *element; GstCaps *caps; const gchar *padname; if (prop_id == PROP_VIDEO_CAPTURE_SUPPORTED_CAPS) { + element = camera->src; padname = GST_BASE_CAMERA_SRC_VIDEO_PAD_NAME; - } else { + } else if (prop_id == PROP_IMAGE_CAPTURE_SUPPORTED_CAPS) { + element = camera->src; padname = GST_BASE_CAMERA_SRC_IMAGE_PAD_NAME; + } else if (prop_id == PROP_VIEWFINDER_SUPPORTED_CAPS) { + element = camera->src; + padname = GST_BASE_CAMERA_SRC_VIEWFINDER_PAD_NAME; + } else { + element = camera->audio_src; + padname = "src"; } - if (camera->src) { - pad = gst_element_get_static_pad (camera->src, padname); + if (element) { + pad = gst_element_get_static_pad (element, padname); g_assert (pad != NULL); @@ -951,11 +1669,18 @@ gst_camera_bin_get_property (GObject * object, guint prop_id, gst_object_unref (pad); } else { - GST_DEBUG_OBJECT (camera, "Camera source not created, can't get " + GST_DEBUG_OBJECT (camera, "Source not created, can't get " "supported caps"); } } break; + case PROP_AUDIO_CAPTURE_CAPS:{ + GstCaps *caps = NULL; + g_object_get (camera->audio_capsfilter, "caps", &caps, NULL); + gst_value_set_caps (value, caps); + gst_caps_unref (caps); + } + break; case PROP_IMAGE_CAPTURE_CAPS:{ GstCaps *caps = NULL; g_object_get (camera->imagebin_capsfilter, "caps", &caps, NULL); @@ -970,6 +1695,13 @@ gst_camera_bin_get_property (GObject * object, guint prop_id, gst_caps_unref (caps); } break; + case PROP_VIEWFINDER_CAPS:{ + GstCaps *caps = NULL; + g_object_get (camera->viewfinderbin_capsfilter, "caps", &caps, NULL); + gst_value_set_caps (value, caps); + gst_caps_unref (caps); + } + break; case PROP_POST_PREVIEWS: g_value_set_boolean (value, camera->post_previews); break; @@ -984,21 +1716,44 @@ gst_camera_bin_get_property (GObject * object, guint prop_id, } break; case PROP_VIDEO_FILTER: - if (camera->video_filter) - g_value_set_object (value, camera->video_filter); + if (camera->user_video_filter) + g_value_set_object (value, camera->user_video_filter); break; case PROP_IMAGE_FILTER: - if (camera->image_filter) - g_value_set_object (value, camera->image_filter); + if (camera->user_image_filter) + g_value_set_object (value, camera->user_image_filter); break; case PROP_VIEWFINDER_FILTER: - if (camera->viewfinder_filter) - g_value_set_object (value, camera->viewfinder_filter); + if (camera->user_viewfinder_filter) + g_value_set_object (value, camera->user_viewfinder_filter); break; case PROP_PREVIEW_FILTER: if (camera->preview_filter) g_value_set_object (value, camera->preview_filter); break; + case PROP_VIEWFINDER_SINK:{ + GstElement *sink; + + g_object_get (camera->viewfinderbin, "video-sink", &sink, NULL); + g_value_take_object (value, sink); + break; + } + case PROP_ZOOM: + g_value_set_float (value, camera->zoom); + break; + case PROP_MAX_ZOOM: + g_value_set_float (value, camera->max_zoom); + break; + case PROP_IMAGE_ENCODING_PROFILE: + if (camera->image_profile) { + gst_value_set_mini_object (value, + (GstMiniObject *) camera->image_profile); + } + break; + case PROP_IDLE: + g_value_set_boolean (value, + g_atomic_int_get (&camera->processing_counter) == 0); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; diff --git a/gst/camerabin2/gstcamerabin2.h b/gst/camerabin2/gstcamerabin2.h index 64828b49e0..59e3723dff 100644 --- a/gst/camerabin2/gstcamerabin2.h +++ b/gst/camerabin2/gstcamerabin2.h @@ -42,8 +42,10 @@ struct _GstCameraBin GstElement *user_src; gulong src_capture_notify_id; - GstElement *encodebin; + GstElement *video_encodebin; + gulong video_encodebin_signal_id; GstElement *videosink; + gulong videosink_probe; GstElement *videobin_queue; GstElement *videobin_capsfilter; @@ -51,7 +53,9 @@ struct _GstCameraBin GstElement *viewfinderbin_queue; GstElement *viewfinderbin_capsfilter; - GstElement *imagebin; + GstElement *image_encodebin; + gulong image_encodebin_signal_id; + GstElement *imagesink; GstElement *imagebin_queue; GstElement *imagebin_capsfilter; @@ -62,9 +66,21 @@ struct _GstCameraBin GstElement *user_image_filter; GstElement *user_viewfinder_filter; + GstElement *audio_src; + GstElement *user_audio_src; + GstElement *audio_queue; + GstElement *audio_volume; + GstElement *audio_capsfilter; + GstElement *audio_convert; + + gint processing_counter; /* atomic int */ + /* Index of the auto incrementing file index for video recordings */ gint video_index; + gboolean video_profile_switch; + gboolean image_profile_switch; + /* properties */ gint mode; gchar *video_location; @@ -73,6 +89,9 @@ struct _GstCameraBin GstCaps *preview_caps; GstElement *preview_filter; GstEncodingProfile *video_profile; + GstEncodingProfile *image_profile; + gfloat zoom; + gfloat max_zoom; gboolean elements_created; }; diff --git a/gst/camerabin2/gstimagecapturebin.c b/gst/camerabin2/gstimagecapturebin.c deleted file mode 100644 index b4aba2aa08..0000000000 --- a/gst/camerabin2/gstimagecapturebin.c +++ /dev/null @@ -1,352 +0,0 @@ -/* GStreamer - * Copyright (C) 2010 Thiago Santos - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/** - * SECTION:element-gstimagecapturebin - * - * The gstimagecapturebin element does FIXME stuff. - * - * - * Example launch line - * |[ - * gst-launch -v videotestsrc num-buffers=3 ! imagecapturebin - * ]| - * FIXME Describe what the pipeline does. - * - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "gstimagecapturebin.h" -#include "camerabingeneral.h" - -/* prototypes */ - - -enum -{ - PROP_0, - PROP_LOCATION, - PROP_ENCODER, - PROP_MUXER -}; - -#define DEFAULT_LOCATION "img_%d" -#define DEFAULT_COLORSPACE "ffmpegcolorspace" -#define DEFAULT_ENCODER "jpegenc" -#define DEFAULT_MUXER "jifmux" -#define DEFAULT_SINK "multifilesink" - -/* pad templates */ - -static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("video/x-raw-yuv; video/x-raw-rgb") - ); - -/* class initialization */ - -GST_BOILERPLATE (GstImageCaptureBin, gst_image_capture_bin, GstBin, - GST_TYPE_BIN); - -/* GObject callbacks */ -static void gst_image_capture_bin_dispose (GObject * object); -static void gst_image_capture_bin_finalize (GObject * object); - -/* Element class functions */ -static GstStateChangeReturn -gst_image_capture_bin_change_state (GstElement * element, GstStateChange trans); - -static void -gst_image_capture_bin_set_encoder (GstImageCaptureBin * imagebin, - GstElement * encoder) -{ - GST_DEBUG_OBJECT (GST_OBJECT (imagebin), - "Setting image encoder %" GST_PTR_FORMAT, encoder); - - if (imagebin->user_encoder) - g_object_unref (imagebin->user_encoder); - - if (encoder) - g_object_ref (encoder); - - imagebin->user_encoder = encoder; -} - -static void -gst_image_capture_bin_set_muxer (GstImageCaptureBin * imagebin, - GstElement * muxer) -{ - GST_DEBUG_OBJECT (GST_OBJECT (imagebin), - "Setting image muxer %" GST_PTR_FORMAT, muxer); - - if (imagebin->user_muxer) - g_object_unref (imagebin->user_muxer); - - if (muxer) - g_object_ref (muxer); - - imagebin->user_muxer = muxer; -} - -static void -gst_image_capture_bin_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstImageCaptureBin *imagebin = GST_IMAGE_CAPTURE_BIN_CAST (object); - - switch (prop_id) { - case PROP_LOCATION: - g_free (imagebin->location); - imagebin->location = g_value_dup_string (value); - GST_DEBUG_OBJECT (imagebin, "setting location to %s", imagebin->location); - if (imagebin->sink) { - g_object_set (imagebin->sink, "location", imagebin->location, NULL); - } - break; - case PROP_ENCODER: - gst_image_capture_bin_set_encoder (imagebin, g_value_get_object (value)); - break; - case PROP_MUXER: - gst_image_capture_bin_set_muxer (imagebin, g_value_get_object (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_image_capture_bin_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec) -{ - GstImageCaptureBin *imagebin = GST_IMAGE_CAPTURE_BIN_CAST (object); - - switch (prop_id) { - case PROP_LOCATION: - g_value_set_string (value, imagebin->location); - break; - case PROP_ENCODER: - g_value_set_object (value, imagebin->encoder); - break; - case PROP_MUXER: - g_value_set_object (value, imagebin->muxer); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_image_capture_bin_finalize (GObject * object) -{ - GstImageCaptureBin *imgbin = GST_IMAGE_CAPTURE_BIN_CAST (object); - - g_free (imgbin->location); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -gst_image_capture_bin_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sink_template)); - - gst_element_class_set_details_simple (element_class, "Image Capture Bin", - "Sink/Video", "Image Capture Bin used in camerabin2", - "Thiago Santos "); -} - -static void -gst_image_capture_bin_class_init (GstImageCaptureBinClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *element_class; - - gobject_class = G_OBJECT_CLASS (klass); - element_class = GST_ELEMENT_CLASS (klass); - - gobject_class->dispose = gst_image_capture_bin_dispose; - gobject_class->finalize = gst_image_capture_bin_finalize; - gobject_class->set_property = gst_image_capture_bin_set_property; - gobject_class->get_property = gst_image_capture_bin_get_property; - - element_class->change_state = - GST_DEBUG_FUNCPTR (gst_image_capture_bin_change_state); - - g_object_class_install_property (gobject_class, PROP_LOCATION, - g_param_spec_string ("location", "Location", - "Location to save the captured files. A %%d can be used as a " - "placeholder for a capture count", - DEFAULT_LOCATION, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (gobject_class, PROP_ENCODER, - g_param_spec_object ("image-encoder", "Image encoder", - "Image encoder GStreamer element (default is jpegenc)", - GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (gobject_class, PROP_MUXER, - g_param_spec_object ("image-muxer", "Image muxer", - "Image muxer GStreamer element (default is jifmux)", - GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -} - -static void -gst_image_capture_bin_init (GstImageCaptureBin * imagebin, - GstImageCaptureBinClass * imagebin_class) -{ - GstPadTemplate *tmpl; - - tmpl = gst_static_pad_template_get (&sink_template); - imagebin->ghostpad = gst_ghost_pad_new_no_target_from_template ("sink", tmpl); - gst_object_unref (tmpl); - gst_element_add_pad (GST_ELEMENT_CAST (imagebin), imagebin->ghostpad); - - imagebin->sink = NULL; - - imagebin->location = g_strdup (DEFAULT_LOCATION); - imagebin->encoder = NULL; - imagebin->user_encoder = NULL; - imagebin->muxer = NULL; - imagebin->user_muxer = NULL; -} - -static void -gst_image_capture_bin_dispose (GObject * object) -{ - GstImageCaptureBin *imagebin = GST_IMAGE_CAPTURE_BIN_CAST (object); - - if (imagebin->user_encoder) { - gst_object_unref (imagebin->user_encoder); - imagebin->user_encoder = NULL; - } - - if (imagebin->user_muxer) { - gst_object_unref (imagebin->user_muxer); - imagebin->user_muxer = NULL; - } - G_OBJECT_CLASS (parent_class)->dispose ((GObject *) imagebin); -} - -static gboolean -gst_image_capture_bin_create_elements (GstImageCaptureBin * imagebin) -{ - GstElement *colorspace; - GstPad *pad = NULL; - - if (imagebin->elements_created) - return TRUE; - - /* create elements */ - colorspace = - gst_camerabin_create_and_add_element (GST_BIN (imagebin), - DEFAULT_COLORSPACE, "imagebin-colorspace"); - if (!colorspace) - goto error; - - if (imagebin->user_encoder) { - imagebin->encoder = imagebin->user_encoder; - if (!gst_camerabin_add_element (GST_BIN (imagebin), imagebin->encoder)) { - goto error; - } - } else { - imagebin->encoder = - gst_camerabin_create_and_add_element (GST_BIN (imagebin), - DEFAULT_ENCODER, "imagebin-encoder"); - if (!imagebin->encoder) - goto error; - } - - if (imagebin->user_muxer) { - imagebin->muxer = imagebin->user_muxer; - if (!gst_camerabin_add_element (GST_BIN (imagebin), imagebin->muxer)) { - goto error; - } - } else { - imagebin->muxer = - gst_camerabin_create_and_add_element (GST_BIN (imagebin), - DEFAULT_MUXER, "imagebin-muxer"); - if (!imagebin->muxer) - goto error; - } - - imagebin->sink = - gst_camerabin_create_and_add_element (GST_BIN (imagebin), DEFAULT_SINK, - "imagebin-sink"); - if (!imagebin->sink) - goto error; - - g_object_set (imagebin->sink, "location", imagebin->location, "async", FALSE, - "post-messages", TRUE, NULL); - - /* add ghostpad */ - pad = gst_element_get_static_pad (colorspace, "sink"); - if (!gst_ghost_pad_set_target (GST_GHOST_PAD (imagebin->ghostpad), pad)) - goto error; - gst_object_unref (pad); - - imagebin->elements_created = TRUE; - return TRUE; - -error: - if (pad) - gst_object_unref (pad); - return FALSE; -} - -static GstStateChangeReturn -gst_image_capture_bin_change_state (GstElement * element, GstStateChange trans) -{ - GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; - GstImageCaptureBin *imagebin = GST_IMAGE_CAPTURE_BIN_CAST (element); - - switch (trans) { - case GST_STATE_CHANGE_NULL_TO_READY: - if (!gst_image_capture_bin_create_elements (imagebin)) { - return GST_STATE_CHANGE_FAILURE; - } - break; - default: - break; - } - - ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, trans); - - switch (trans) { - case GST_STATE_CHANGE_READY_TO_NULL: - break; - default: - break; - } - - return ret; -} - -gboolean -gst_image_capture_bin_plugin_init (GstPlugin * plugin) -{ - return gst_element_register (plugin, "imagecapturebin", GST_RANK_NONE, - gst_image_capture_bin_get_type ()); -} diff --git a/gst/camerabin2/gstimagecapturebin.h b/gst/camerabin2/gstimagecapturebin.h deleted file mode 100644 index 98a28e9831..0000000000 --- a/gst/camerabin2/gstimagecapturebin.h +++ /dev/null @@ -1,63 +0,0 @@ -/* GStreamer - * Copyright (C) 2010 Thiago Santos - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef _GST_IMAGE_CAPTURE_BIN_H_ -#define _GST_IMAGE_CAPTURE_BIN_H_ - -#include - -G_BEGIN_DECLS - -#define GST_TYPE_IMAGE_CAPTURE_BIN (gst_image_capture_bin_get_type()) -#define GST_IMAGE_CAPTURE_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_IMAGE_CAPTURE_BIN,GstImageCaptureBin)) -#define GST_IMAGE_CAPTURE_BIN_CAST(obj) ((GstImageCaptureBin *) obj) -#define GST_IMAGE_CAPTURE_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_IMAGE_CAPTURE_BIN,GstImageCaptureBinClass)) -#define GST_IS_IMAGE_CAPTURE_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_IMAGE_CAPTURE_BIN)) -#define GST_IS_IMAGE_CAPTURE_BIN_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_IMAGE_CAPTURE_BIN)) - -typedef struct _GstImageCaptureBin GstImageCaptureBin; -typedef struct _GstImageCaptureBinClass GstImageCaptureBinClass; - -struct _GstImageCaptureBin -{ - GstBin bin; - - GstPad *ghostpad; - GstElement *sink; - - /* props */ - gchar *location; - GstElement *encoder; - GstElement *user_encoder; - GstElement *muxer; - GstElement *user_muxer; - - gboolean elements_created; -}; - -struct _GstImageCaptureBinClass -{ - GstBinClass bin_class; -}; - -GType gst_image_capture_bin_get_type (void); -gboolean gst_image_capture_bin_plugin_init (GstPlugin * plugin); - -G_END_DECLS - -#endif diff --git a/gst/camerabin2/gstplugin.c b/gst/camerabin2/gstplugin.c index 56fa78f800..6053521468 100644 --- a/gst/camerabin2/gstplugin.c +++ b/gst/camerabin2/gstplugin.c @@ -24,7 +24,6 @@ #endif #include "gstviewfinderbin.h" -#include "gstimagecapturebin.h" #include "gstwrappercamerabinsrc.h" #include "gstcamerabin2.h" @@ -33,8 +32,6 @@ plugin_init (GstPlugin * plugin) { if (!gst_viewfinder_bin_plugin_init (plugin)) return FALSE; - if (!gst_image_capture_bin_plugin_init (plugin)) - return FALSE; if (!gst_wrapper_camera_bin_src_plugin_init (plugin)) return FALSE; if (!gst_camera_bin_plugin_init (plugin)) diff --git a/gst/camerabin2/gstviewfinderbin.c b/gst/camerabin2/gstviewfinderbin.c index e03631e328..672e1fe145 100644 --- a/gst/camerabin2/gstviewfinderbin.c +++ b/gst/camerabin2/gstviewfinderbin.c @@ -35,6 +35,10 @@ #endif #include "gstviewfinderbin.h" +#include "camerabingeneral.h" +#include + +#include GST_DEBUG_CATEGORY_STATIC (gst_viewfinder_bin_debug); #define GST_CAT_DEFAULT gst_viewfinder_bin_debug @@ -144,33 +148,34 @@ gst_viewfinder_bin_create_elements (GstViewfinderBin * vfbin) GstElement *csp = NULL; GstElement *videoscale = NULL; GstPad *pad = NULL; - gboolean added = FALSE; + const gchar *missing_element_name; GST_DEBUG_OBJECT (vfbin, "Creating internal elements"); if (!vfbin->elements_created) { /* create elements */ - csp = gst_element_factory_make ("ffmpegcolorspace", "vfbin-csp"); - if (!csp) - goto error; + csp = + gst_camerabin_create_and_add_element (GST_BIN (vfbin), + "ffmpegcolorspace", "vfbin-csp"); + if (!csp) { + missing_element_name = "ffmpegcolorspace"; + goto missing_element; + } - videoscale = gst_element_factory_make ("videoscale", "vfbin-videoscale"); - if (!videoscale) - goto error; - - GST_DEBUG_OBJECT (vfbin, "Internal elements created, proceding to linking"); - - /* add and link */ - gst_bin_add_many (GST_BIN_CAST (vfbin), csp, videoscale, NULL); - added = TRUE; - if (!gst_element_link (csp, videoscale)) - goto error; + videoscale = + gst_camerabin_create_and_add_element (GST_BIN (vfbin), "videoscale", + "vfbin-videoscale"); + if (!videoscale) { + missing_element_name = "videoscale"; + goto missing_element; + } /* add ghostpad */ pad = gst_element_get_static_pad (csp, "sink"); if (!gst_ghost_pad_set_target (GST_GHOST_PAD (vfbin->ghostpad), pad)) goto error; gst_object_unref (pad); + pad = NULL; vfbin->elements_created = TRUE; GST_DEBUG_OBJECT (vfbin, "Elements succesfully created and linked"); @@ -188,9 +193,14 @@ gst_viewfinder_bin_create_elements (GstViewfinderBin * vfbin) if (!vfbin->video_sink) { if (vfbin->user_video_sink) vfbin->video_sink = gst_object_ref (vfbin->user_video_sink); - else + else { vfbin->video_sink = gst_element_factory_make ("autovideosink", "vfbin-sink"); + if (!vfbin->video_sink) { + missing_element_name = "autovideosink"; + goto missing_element; + } + } gst_bin_add (GST_BIN_CAST (vfbin), gst_object_ref (vfbin->video_sink)); @@ -199,24 +209,29 @@ gst_viewfinder_bin_create_elements (GstViewfinderBin * vfbin) "vfbin-videoscale"); if (!gst_element_link_pads (videoscale, "src", vfbin->video_sink, "sink")) { - GST_WARNING_OBJECT (vfbin, "Failed to link the new sink"); + GST_ELEMENT_ERROR (vfbin, CORE, NEGOTIATION, (NULL), + ("linking videoscale and viewfindersink failed")); } + + /* prevent it from being removed from the bin at this point */ + videoscale = NULL; } return TRUE; +missing_element: + gst_element_post_message (GST_ELEMENT_CAST (vfbin), + gst_missing_element_message_new (GST_ELEMENT_CAST (vfbin), + missing_element_name)); + GST_ELEMENT_ERROR (vfbin, CORE, MISSING_PLUGIN, + (_("Missing element '%s' - check your GStreamer installation."), + missing_element_name), (NULL)); + goto error; + error: GST_WARNING_OBJECT (vfbin, "Creating internal elements failed"); if (pad) gst_object_unref (pad); - if (!added) { - if (csp) - gst_object_unref (csp); - if (videoscale) - gst_object_unref (videoscale); - } else { - gst_bin_remove_many (GST_BIN_CAST (vfbin), csp, videoscale, NULL); - } return FALSE; } diff --git a/gst/camerabin2/gstwrappercamerabinsrc.c b/gst/camerabin2/gstwrappercamerabinsrc.c index 811479493c..6a003a0b4e 100644 --- a/gst/camerabin2/gstwrappercamerabinsrc.c +++ b/gst/camerabin2/gstwrappercamerabinsrc.c @@ -38,16 +38,9 @@ enum { PROP_0, PROP_VIDEO_SRC, - PROP_POST_PREVIEWS, - PROP_PREVIEW_CAPS, - PROP_PREVIEW_FILTER + PROP_VIDEO_SRC_FILTER }; -#define DEFAULT_POST_PREVIEWS TRUE - -/* Using "bilinear" as default zoom method */ -#define CAMERABIN_DEFAULT_ZOOM_METHOD 1 - GST_DEBUG_CATEGORY (wrapper_camera_bin_src_debug); #define GST_CAT_DEFAULT wrapper_camera_bin_src_debug @@ -66,19 +59,11 @@ gst_wrapper_camera_bin_src_dispose (GObject * object) gst_object_unref (self->app_vid_src); self->app_vid_src = NULL; } - - if (self->preview_pipeline) { - gst_camerabin_destroy_preview_pipeline (self->preview_pipeline); - self->preview_pipeline = NULL; - } - - if (self->preview_caps) - gst_caps_replace (&self->preview_caps, NULL); - - if (self->preview_filter) { - gst_object_unref (self->preview_filter); - self->preview_filter = NULL; + if (self->app_vid_filter) { + gst_object_unref (self->app_vid_filter); + self->app_vid_filter = NULL; } + gst_caps_replace (&self->image_capture_caps, NULL); G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -109,26 +94,19 @@ gst_wrapper_camera_bin_src_set_property (GObject * object, gst_object_ref (self->app_vid_src); } break; - case PROP_POST_PREVIEWS: - self->post_previews = g_value_get_boolean (value); - break; - case PROP_PREVIEW_CAPS: - gst_caps_replace (&self->preview_caps, - (GstCaps *) gst_value_get_caps (value)); - if (self->preview_pipeline) { - GST_DEBUG_OBJECT (self, - "Setting preview pipeline caps %" GST_PTR_FORMAT, - self->preview_caps); - gst_camerabin_preview_set_caps (self->preview_pipeline, - (GstCaps *) gst_value_get_caps (value)); + case PROP_VIDEO_SRC_FILTER: + if (GST_STATE (self) != GST_STATE_NULL) { + GST_ELEMENT_ERROR (self, CORE, FAILED, + ("camerasrc must be in NULL state when setting the video source filter element"), + (NULL)); + } else { + if (self->app_vid_filter) + gst_object_unref (self->app_vid_filter); + self->app_vid_filter = g_value_get_object (value); + if (self->app_vid_filter) + gst_object_ref (self->app_vid_filter); } break; - case PROP_PREVIEW_FILTER: - if (self->preview_filter) - gst_object_unref (self->preview_filter); - self->preview_filter = g_value_dup_object (value); - self->preview_filter_changed = TRUE; - break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec); break; @@ -148,16 +126,11 @@ gst_wrapper_camera_bin_src_get_property (GObject * object, else g_value_set_object (value, self->app_vid_src); break; - case PROP_POST_PREVIEWS: - g_value_set_boolean (value, self->post_previews); - break; - case PROP_PREVIEW_CAPS: - if (self->preview_caps) - gst_value_set_caps (value, self->preview_caps); - break; - case PROP_PREVIEW_FILTER: - if (self->preview_filter) - g_value_set_object (value, self->preview_filter); + case PROP_VIDEO_SRC_FILTER: + if (self->video_filter) + g_value_set_object (value, self->video_filter); + else + g_value_set_object (value, self->app_vid_filter); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec); @@ -177,7 +150,7 @@ gst_wrapper_camera_bin_reset_video_src_caps (GstWrapperCameraBinSrc * self, clock = gst_element_get_clock (self->src_vid_src); base_time = gst_element_get_base_time (self->src_vid_src); - gst_element_set_state (self->src_vid_src, GST_STATE_NULL); + gst_element_set_state (self->src_vid_src, GST_STATE_READY); set_capsfilter_caps (self, caps); self->drop_newseg = TRUE; @@ -243,10 +216,8 @@ gst_wrapper_camera_bin_src_imgsrc_probe (GstPad * pad, GstBuffer * buffer, /* post preview */ /* TODO This can likely be optimized if the viewfinder caps is the same as * the preview caps, avoiding another scaling of the same buffer. */ - if (self->post_previews) { - GST_DEBUG_OBJECT (self, "Posting preview for image"); - gst_camerabin_preview_pipeline_post (self->preview_pipeline, buffer); - } + GST_DEBUG_OBJECT (self, "Posting preview for image"); + gst_base_camera_src_post_preview (camerasrc, buffer); if (self->image_capture_count == 0) { gst_base_camera_src_finish_capture (camerasrc); @@ -282,22 +253,12 @@ gst_wrapper_camera_bin_src_vidsrc_probe (GstPad * pad, GstBuffer * buffer, if (self->video_rec_status == GST_VIDEO_RECORDING_STATUS_DONE) { /* NOP */ } else if (self->video_rec_status == GST_VIDEO_RECORDING_STATUS_STARTING) { - gint64 start = 0; - - if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buffer))) - start = GST_BUFFER_TIMESTAMP (buffer); - - /* send the newseg */ - GST_DEBUG_OBJECT (self, "Starting video recording, pushing newsegment"); - gst_pad_push_event (pad, gst_event_new_new_segment (FALSE, 1.0, - GST_FORMAT_TIME, start, -1, 0)); + GST_DEBUG_OBJECT (self, "Starting video recording"); self->video_rec_status = GST_VIDEO_RECORDING_STATUS_RUNNING; /* post preview */ - if (self->post_previews) { - GST_DEBUG_OBJECT (self, "Posting preview for video"); - gst_camerabin_preview_pipeline_post (self->preview_pipeline, buffer); - } + GST_DEBUG_OBJECT (self, "Posting preview for video"); + gst_base_camera_src_post_preview (camerasrc, buffer); ret = TRUE; } else if (self->video_rec_status == GST_VIDEO_RECORDING_STATUS_FINISHING) { @@ -359,12 +320,64 @@ gst_wrapper_camera_src_src_event_probe (GstPad * pad, GstEvent * evt, return ret; } +static void +gst_wrapper_camera_bin_src_caps_cb (GObject * gobject, GParamSpec * pspec, + gpointer user_data) +{ + GstBaseCameraSrc *bcamsrc = GST_BASE_CAMERA_SRC (user_data); + GstWrapperCameraBinSrc *self = GST_WRAPPER_CAMERA_BIN_SRC (user_data); + GstPad *src_caps_src_pad; + GstCaps *caps = NULL; + GstStructure *in_st = NULL; + + /* get the new caps that were set on the capsfilter that configures the + * source */ + src_caps_src_pad = gst_element_get_static_pad (self->src_filter, "src"); + caps = gst_pad_get_caps_reffed (src_caps_src_pad); + gst_object_unref (src_caps_src_pad); + GST_DEBUG_OBJECT (self, "src-filter caps changed to %s", + gst_caps_to_string (caps)); + + if (gst_caps_get_size (caps)) { + in_st = gst_caps_get_structure (caps, 0); + if (in_st) { + gst_structure_get_int (in_st, "width", &bcamsrc->width); + gst_structure_get_int (in_st, "height", &bcamsrc->height); + + GST_DEBUG_OBJECT (self, "Source dimensions now: %dx%d", bcamsrc->width, + bcamsrc->height); + } + } + + /* Update zoom */ + gst_base_camera_src_setup_zoom (bcamsrc); + + /* Update post-zoom capsfilter */ + if (self->src_zoom_filter) + g_object_set (G_OBJECT (self->src_zoom_filter), "caps", caps, NULL); + + /* drop our ref on the caps */ + gst_caps_unref (caps); +}; + +static void +gst_wrapper_camera_bin_src_max_zoom_cb (GObject * self, GParamSpec * pspec, + gpointer user_data) +{ + GstBaseCameraSrc *bcamsrc = (GstBaseCameraSrc *) user_data; + + g_object_get (self, "max-zoom", &bcamsrc->max_zoom, NULL); + g_object_notify (G_OBJECT (bcamsrc), "max-zoom"); +} + + /** * gst_wrapper_camera_bin_src_construct_pipeline: * @bcamsrc: camerasrc object * * This function creates and links the elements of the camerasrc bin - * videosrc ! cspconv ! capsfilter ! crop ! scale ! capsfilter ! tee name=t ! + * videosrc ! cspconv ! srcfilter ! cspconv ! capsfilter ! crop ! scale ! \ + * capsfilter ! tee name=t * t. ! ... (viewfinder pad) * t. ! output-selector name=outsel * outsel. ! (image pad) @@ -378,10 +391,14 @@ gst_wrapper_camera_bin_src_construct_pipeline (GstBaseCameraSrc * bcamsrc) GstWrapperCameraBinSrc *self = GST_WRAPPER_CAMERA_BIN_SRC (bcamsrc); GstBin *cbin = GST_BIN (bcamsrc); GstElement *tee; + GstElement *filter_csp; + GstElement *src_csp; + GstElement *capsfilter; gboolean ret = FALSE; GstElement *videoscale; GstPad *vf_pad; GstPad *tee_capture_pad; + GstPad *src_caps_src_pad; if (!self->elements_created) { @@ -401,6 +418,13 @@ gst_wrapper_camera_bin_src_construct_pipeline (GstBaseCameraSrc * bcamsrc) /* we lost the reference */ self->app_vid_src = NULL; + /* we listen for changes to max-zoom in the video src so that + * we can proxy them to the basecamerasrc property */ + if (g_object_class_find_property (G_OBJECT_GET_CLASS (bcamsrc), "max-zoom")) { + g_signal_connect (G_OBJECT (self->src_vid_src), "notify::max-zoom", + (GCallback) gst_wrapper_camera_bin_src_max_zoom_cb, bcamsrc); + } + /* add a buffer probe to the src elemento to drop EOS from READY->NULL */ { GstPad *pad; @@ -420,6 +444,14 @@ gst_wrapper_camera_bin_src_construct_pipeline (GstBaseCameraSrc * bcamsrc) "src-capsfilter"))) goto done; + /* attach to notify::caps on the first capsfilter and use a callback + * to recalculate the zoom properties when these caps change and to + * propagate the caps to the second capsfilter */ + src_caps_src_pad = gst_element_get_static_pad (self->src_filter, "src"); + g_signal_connect (src_caps_src_pad, "notify::caps", + G_CALLBACK (gst_wrapper_camera_bin_src_caps_cb), self); + gst_object_unref (src_caps_src_pad); + if (!(self->src_zoom_crop = gst_camerabin_create_and_add_element (cbin, "videocrop", "zoom-crop"))) @@ -503,24 +535,37 @@ gst_wrapper_camera_bin_src_construct_pipeline (GstBaseCameraSrc * bcamsrc) gst_pad_set_active (self->imgsrc, TRUE); /* XXX ??? */ gst_pad_set_active (self->vidsrc, TRUE); /* XXX ??? */ } - /* recreate the preview pipeline */ - if (self->preview_pipeline && self->preview_filter_changed) { - gst_camerabin_destroy_preview_pipeline (self->preview_pipeline); + + /* Do this even if pipeline is constructed */ + + if (self->video_filter) { + /* check if we need to replace the current one */ + if (self->video_filter != self->app_vid_filter) { + gst_bin_remove (cbin, self->video_filter); + gst_object_unref (self->video_filter); + self->video_filter = NULL; + filter_csp = gst_bin_get_by_name (cbin, "filter-colorspace"); + gst_bin_remove (cbin, filter_csp); + gst_object_unref (filter_csp); + filter_csp = NULL; + } } - if (self->preview_pipeline == NULL) - self->preview_pipeline = - gst_camerabin_create_preview_pipeline (GST_ELEMENT_CAST (self), - self->preview_filter); - - g_assert (self->preview_pipeline != NULL); - self->preview_filter_changed = FALSE; - if (self->preview_caps) { - GST_DEBUG_OBJECT (self, "Setting preview pipeline caps %" GST_PTR_FORMAT, - self->preview_caps); - gst_camerabin_preview_set_caps (self->preview_pipeline, self->preview_caps); + if (!self->video_filter) { + if (self->app_vid_filter) { + self->video_filter = gst_object_ref (self->app_vid_filter); + filter_csp = gst_element_factory_make ("ffmpegcolorspace", + "filter-colorspace"); + gst_bin_add_many (cbin, self->video_filter, filter_csp, NULL); + src_csp = gst_bin_get_by_name (cbin, "src-colorspace"); + capsfilter = gst_bin_get_by_name (cbin, "src-capsfilter"); + if (gst_pad_is_linked (gst_element_get_static_pad (src_csp, "src"))) + gst_element_unlink (src_csp, capsfilter); + if (!gst_element_link_many (src_csp, self->video_filter, filter_csp, + capsfilter, NULL)) + goto done; + } } - ret = TRUE; self->elements_created = TRUE; done: @@ -676,9 +721,6 @@ start_image_capture (GstWrapperCameraBinSrc * self) caps = gst_pad_get_allowed_caps (self->imgsrc); - caps = gst_caps_make_writable (caps); - gst_pad_fixate_caps (self->imgsrc, caps); - gst_caps_replace (&self->image_capture_caps, caps); gst_caps_unref (caps); @@ -709,17 +751,18 @@ gst_wrapper_camera_bin_src_set_mode (GstBaseCameraSrc * bcamsrc, GstPhotography *photography = gst_base_camera_src_get_photography (bcamsrc); GstWrapperCameraBinSrc *self = GST_WRAPPER_CAMERA_BIN_SRC (bcamsrc); - self->mode = mode; - if (self->output_selector) { if (mode == MODE_IMAGE) { + self->image_renegotiate = TRUE; g_object_set (self->output_selector, "active-pad", self->outsel_imgpad, NULL); } else { + self->video_renegotiate = TRUE; g_object_set (self->output_selector, "active-pad", self->outsel_vidpad, NULL); } } + self->mode = mode; if (photography) { if (g_object_class_find_property (G_OBJECT_GET_CLASS (photography), @@ -734,21 +777,20 @@ gst_wrapper_camera_bin_src_set_mode (GstBaseCameraSrc * bcamsrc, } static gboolean -set_videosrc_zoom (GstWrapperCameraBinSrc * self, gint zoom) +set_videosrc_zoom (GstWrapperCameraBinSrc * self, gfloat zoom) { gboolean ret = FALSE; if (g_object_class_find_property (G_OBJECT_GET_CLASS (self->src_vid_src), "zoom")) { - g_object_set (G_OBJECT (self->src_vid_src), "zoom", - (gfloat) zoom / 100, NULL); + g_object_set (G_OBJECT (self->src_vid_src), "zoom", zoom, NULL); ret = TRUE; } return ret; } static gboolean -set_element_zoom (GstWrapperCameraBinSrc * self, gint zoom) +set_element_zoom (GstWrapperCameraBinSrc * self, gfloat zoom) { gboolean ret = FALSE; GstBaseCameraSrc *bcamsrc = GST_BASE_CAMERA_SRC (self); @@ -761,12 +803,13 @@ set_element_zoom (GstWrapperCameraBinSrc * self, gint zoom) if (self->src_zoom_crop) { /* Update capsfilters to apply the zoom */ - GST_INFO_OBJECT (self, "zoom: %d, orig size: %dx%d", zoom, + GST_INFO_OBJECT (self, "zoom: %f, orig size: %dx%d", zoom, bcamsrc->width, bcamsrc->height); if (zoom != ZOOM_1X) { - w2_crop = (bcamsrc->width - (bcamsrc->width * ZOOM_1X / zoom)) / 2; - h2_crop = (bcamsrc->height - (bcamsrc->height * ZOOM_1X / zoom)) / 2; + w2_crop = (bcamsrc->width - (gint) (bcamsrc->width * ZOOM_1X / zoom)) / 2; + h2_crop = + (bcamsrc->height - (gint) (bcamsrc->height * ZOOM_1X / zoom)) / 2; left += w2_crop; right += w2_crop; @@ -795,11 +838,11 @@ set_element_zoom (GstWrapperCameraBinSrc * self, gint zoom) } static void -gst_wrapper_camera_bin_src_set_zoom (GstBaseCameraSrc * bcamsrc, gint zoom) +gst_wrapper_camera_bin_src_set_zoom (GstBaseCameraSrc * bcamsrc, gfloat zoom) { GstWrapperCameraBinSrc *self = GST_WRAPPER_CAMERA_BIN_SRC (bcamsrc); - GST_INFO_OBJECT (self, "setting zoom %d", zoom); + GST_INFO_OBJECT (self, "setting zoom %f", zoom); if (set_videosrc_zoom (self, zoom)) { set_element_zoom (self, ZOOM_1X); @@ -988,7 +1031,7 @@ set_capsfilter_caps (GstWrapperCameraBinSrc * self, GstCaps * new_caps) if (self->src_zoom_filter) g_object_set (G_OBJECT (self->src_zoom_filter), "caps", new_caps, NULL); update_aspect_filter (self, new_caps); - GST_INFO_OBJECT (self, "udpated"); + GST_INFO_OBJECT (self, "updated"); } static gboolean @@ -1003,20 +1046,19 @@ gst_wrapper_camera_bin_src_start_capture (GstBaseCameraSrc * camerasrc) } else if (src->mode == MODE_VIDEO) { GstCaps *caps = NULL; - g_mutex_unlock (camerasrc->capturing_mutex); - gst_wrapper_camera_bin_reset_video_src_caps (src, NULL); - g_mutex_lock (camerasrc->capturing_mutex); - if (src->video_renegotiate) { + g_mutex_unlock (camerasrc->capturing_mutex); + gst_wrapper_camera_bin_reset_video_src_caps (src, NULL); + g_mutex_lock (camerasrc->capturing_mutex); + /* clean capsfilter caps so they don't interfere here */ g_object_set (src->src_filter, "caps", NULL, NULL); if (src->src_zoom_filter) g_object_set (src->src_zoom_filter, "caps", NULL, NULL); + GST_DEBUG_OBJECT (src, "Getting allowed videosrc caps"); caps = gst_pad_get_allowed_caps (src->vidsrc); - caps = gst_caps_make_writable (caps); - gst_pad_fixate_caps (src->vidsrc, caps); - GST_DEBUG_OBJECT (src, "Vidsrc caps fixated to %" GST_PTR_FORMAT, caps); + GST_DEBUG_OBJECT (src, "Video src caps %" GST_PTR_FORMAT, caps); src->video_renegotiate = FALSE; g_mutex_unlock (camerasrc->capturing_mutex); @@ -1068,14 +1110,13 @@ gst_wrapper_camera_bin_src_change_state (GstElement * element, switch (trans) { case GST_STATE_CHANGE_PAUSED_TO_READY: + self->video_renegotiate = TRUE; + self->image_renegotiate = TRUE; self->drop_newseg = FALSE; break; case GST_STATE_CHANGE_READY_TO_NULL: - gst_element_set_state (self->preview_pipeline->pipeline, GST_STATE_NULL); break; case GST_STATE_CHANGE_NULL_TO_READY: - gst_element_set_state (self->preview_pipeline->pipeline, - GST_STATE_PLAYING); break; default: break; @@ -1117,23 +1158,12 @@ gst_wrapper_camera_bin_src_class_init (GstWrapperCameraBinSrcClass * klass) /* g_object_class_install_property .... */ g_object_class_install_property (gobject_class, PROP_VIDEO_SRC, - g_param_spec_object ("video-src", "Video source", + g_param_spec_object ("video-source", "Video source", "The video source element to be used", GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (gobject_class, PROP_POST_PREVIEWS, - g_param_spec_boolean ("post-previews", "Post Previews", - "If capture preview images should be posted to the bus", - DEFAULT_POST_PREVIEWS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (gobject_class, PROP_PREVIEW_CAPS, - g_param_spec_boxed ("preview-caps", "Preview caps", - "The caps of the preview image to be posted", - GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (gobject_class, PROP_PREVIEW_FILTER, - g_param_spec_object ("preview-filter", "Preview filter", - "A custom preview filter to process preview image data", + g_object_class_install_property (gobject_class, PROP_VIDEO_SRC_FILTER, + g_param_spec_object ("video-source-filter", "Video source filter", + "Optional video source filter element", GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); gstelement_class->change_state = gst_wrapper_camera_bin_src_change_state; @@ -1178,10 +1208,10 @@ gst_wrapper_camera_bin_src_init (GstWrapperCameraBinSrc * self, /* TODO where are variables reset? */ self->image_capture_count = 0; self->video_rec_status = GST_VIDEO_RECORDING_STATUS_DONE; - self->video_renegotiate = FALSE; - self->image_renegotiate = FALSE; + self->video_renegotiate = TRUE; + self->image_renegotiate = TRUE; self->mode = GST_BASE_CAMERA_SRC_CAST (self)->mode; - self->post_previews = DEFAULT_POST_PREVIEWS; + self->app_vid_filter = NULL; } gboolean diff --git a/gst/camerabin2/gstwrappercamerabinsrc.h b/gst/camerabin2/gstwrappercamerabinsrc.h index d937321a88..71f3451596 100644 --- a/gst/camerabin2/gstwrappercamerabinsrc.h +++ b/gst/camerabin2/gstwrappercamerabinsrc.h @@ -25,6 +25,7 @@ #include #include +#include #include "camerabingeneral.h" G_BEGIN_DECLS @@ -73,6 +74,7 @@ struct _GstWrapperCameraBinSrc /* source elements */ GstElement *src_vid_src; + GstElement *video_filter; GstElement *src_filter; GstElement *src_zoom_crop; GstElement *src_zoom_scale; @@ -93,6 +95,7 @@ struct _GstWrapperCameraBinSrc /* Application configurable elements */ GstElement *app_vid_src; + GstElement *app_vid_filter; /* Caps that videosrc supports */ GstCaps *allowed_caps; @@ -111,13 +114,6 @@ struct _GstWrapperCameraBinSrc GstCaps *image_capture_caps; gboolean image_renegotiate; gboolean video_renegotiate; - - /* Preview convert pipeline */ - GstCameraBinPreviewPipelineData *preview_pipeline; - gboolean post_previews; - GstCaps *preview_caps; - GstElement *preview_filter; - gboolean preview_filter_changed; }; diff --git a/gst/cdxaparse/Makefile.am b/gst/cdxaparse/Makefile.am index 58b289af8a..f7a11db3b5 100644 --- a/gst/cdxaparse/Makefile.am +++ b/gst/cdxaparse/Makefile.am @@ -23,3 +23,16 @@ libgstcdxaparse_la_LIBADD = \ libgstcdxaparse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstcdxaparse_la_LIBTOOLFLAGS = --tag=disable-static +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstcdxaparse -:SHARED libgstcdxaparse \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstcdxaparse_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstcdxaparse_la_CFLAGS) \ + -:LDFLAGS $(libgstcdxaparse_la_LDFLAGS) \ + $(libgstcdxaparse_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ \ No newline at end of file diff --git a/gst/coloreffects/Makefile.am b/gst/coloreffects/Makefile.am index 11cc4660a4..2dcbdd8e17 100644 --- a/gst/coloreffects/Makefile.am +++ b/gst/coloreffects/Makefile.am @@ -18,3 +18,17 @@ libgstcoloreffects_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstcoloreffects_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstcoloreffects.h gstchromahold.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstcoloreffects -:SHARED libgstcoloreffects \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstcoloreffects_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstcoloreffects_la_CFLAGS) \ + -:LDFLAGS $(libgstcoloreffects_la_LDFLAGS) \ + $(libgstcoloreffects_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/coloreffects/gstchromahold.c b/gst/coloreffects/gstchromahold.c index 3e8c1fa8f7..a563ab3a61 100644 --- a/gst/coloreffects/gstchromahold.c +++ b/gst/coloreffects/gstchromahold.c @@ -91,7 +91,8 @@ static GstStaticPadTemplate gst_chroma_hold_sink_template = } G_STMT_END #define GST_CHROMA_HOLD_UNLOCK(self) G_STMT_START { \ - GST_LOG_OBJECT (self, "Unlocking chromahold from thread %p", g_thread_self ()); \ + GST_LOG_OBJECT (self, "Unlocking chromahold from thread %p", \ + g_thread_self ()); \ g_static_mutex_unlock (&self->lock); \ } G_STMT_END diff --git a/gst/coloreffects/gstchromahold.h b/gst/coloreffects/gstchromahold.h index a1891139aa..429db13df3 100644 --- a/gst/coloreffects/gstchromahold.h +++ b/gst/coloreffects/gstchromahold.h @@ -31,7 +31,6 @@ #include G_BEGIN_DECLS - #define GST_TYPE_CHROMA_HOLD \ (gst_chroma_hold_get_type()) #define GST_CHROMA_HOLD(obj) \ @@ -42,7 +41,6 @@ G_BEGIN_DECLS (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CHROMA_HOLD)) #define GST_IS_CHROMA_HOLD_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CHROMA_HOLD)) - typedef struct _GstChromaHold GstChromaHold; typedef struct _GstChromaHoldClass GstChromaHoldClass; @@ -64,7 +62,8 @@ struct _GstChromaHold guint tolerance; /* processing function */ - void (*process) (guint8 *dest, gint width, gint height, GstChromaHold *chroma_hold); + void (*process) (guint8 * dest, gint width, gint height, + GstChromaHold * chroma_hold); /* pre-calculated values */ gint hue; @@ -78,5 +77,4 @@ struct _GstChromaHoldClass GType gst_chroma_hold_get_type (void); G_END_DECLS - #endif /* __GST_CHROMA_HOLD_H__ */ diff --git a/gst/coloreffects/gstcoloreffects.c b/gst/coloreffects/gstcoloreffects.c index 4c872c67a1..df78b86601 100644 --- a/gst/coloreffects/gstcoloreffects.c +++ b/gst/coloreffects/gstcoloreffects.c @@ -25,7 +25,8 @@ * * Example launch line * |[ - * gst-launch -v videotestsrc ! coloreffects preset=heat ! ffmpegcolorspace ! autovideosink + * gst-launch -v videotestsrc ! coloreffects preset=heat ! ffmpegcolorspace ! + * autovideosink * ]| This pipeline shows the effect of coloreffects on a test stream. * */ @@ -264,7 +265,8 @@ static const gint cog_rgb_to_ycbcr_matrix_8bit_sdtv[] = { 112, -94, -18, 32768, }; -#define APPLY_MATRIX(m,o,v1,v2,v3) ((m[o*4] * v1 + m[o*4+1] * v2 + m[o*4+2] * v3 + m[o*4+3]) >> 8) +#define APPLY_MATRIX(m,o,v1,v2,v3) ((m[o*4] * v1 + m[o*4+1] * v2 + \ + m[o*4+2] * v3 + m[o*4+3]) >> 8) static void gst_color_effects_transform_rgb (GstColorEffects * filter, guint8 * data) @@ -306,7 +308,8 @@ gst_color_effects_transform_rgb (GstColorEffects * filter, guint8 * data) /* 0.2126 R + 0.7152 G + 0.0722 B */ luma = ((r << 8) * 54) + ((g << 8) * 183) + ((b << 8) * 19); luma >>= 16; /* get integer part */ - luma *= 3; /* times 3 to retrieve the correct pixel from the lut */ + luma *= 3; /* times 3 to retrieve the correct pixel from + * the lut */ /* map luma to lookup table */ /* src.luma |-> table[luma].rgb */ data[offsets[0]] = filter->table[luma]; diff --git a/gst/coloreffects/gstcoloreffects.h b/gst/coloreffects/gstcoloreffects.h index b549ff1d49..04e52a9038 100644 --- a/gst/coloreffects/gstcoloreffects.h +++ b/gst/coloreffects/gstcoloreffects.h @@ -77,7 +77,7 @@ struct _GstColorEffects gint height; gint size; - void (*process) (GstColorEffects *filter, guint8 *data); + void (*process) (GstColorEffects * filter, guint8 * data); }; struct _GstColorEffectsClass diff --git a/gst/colorspace/Makefile.am b/gst/colorspace/Makefile.am index a297f31fa2..c5f5bd4cba 100644 --- a/gst/colorspace/Makefile.am +++ b/gst/colorspace/Makefile.am @@ -19,4 +19,17 @@ libgstcolorspace_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstcolorspace.h colorspace.h - +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstcolorspace -:SHARED libgstcolorspace \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstcolorspace_la_SOURCES) \ + $(nodist_libgstcolorspace_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstcolorspace_la_CFLAGS) \ + -:LDFLAGS $(libgstcolorspace_la_LDFLAGS) \ + $(libgstcolorspace_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/colorspace/gstcolorspace.c b/gst/colorspace/gstcolorspace.c index 3d934a5ed3..6b512b5b2f 100644 --- a/gst/colorspace/gstcolorspace.c +++ b/gst/colorspace/gstcolorspace.c @@ -430,13 +430,6 @@ gst_csp_base_init (gpointer klass) void gst_csp_dispose (GObject * object) { - GstCsp *csp; - - g_return_if_fail (GST_IS_CSP (object)); - csp = GST_CSP (object); - - /* clean up as possible. may be called multiple times */ - G_OBJECT_CLASS (parent_class)->dispose (object); } diff --git a/gst/colorspace/gstcolorspaceorc-dist.c b/gst/colorspace/gstcolorspaceorc-dist.c index f7ee2f5509..06d75b2423 100644 --- a/gst/colorspace/gstcolorspaceorc-dist.c +++ b/gst/colorspace/gstcolorspaceorc-dist.c @@ -4,9 +4,6 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#ifndef DISABLE_ORC -#include -#endif #include #ifndef _ORC_INTEGER_TYPEDEFS_ @@ -32,6 +29,7 @@ typedef unsigned __int16 orc_uint16; typedef unsigned __int32 orc_uint32; typedef unsigned __int64 orc_uint64; #define ORC_UINT64_C(x) (x##Ui64) +#define inline __inline #else #include typedef signed char orc_int8; @@ -71,184 +69,260 @@ typedef union orc_int16 x4[4]; } orc_union64; #endif +#ifndef ORC_RESTRICT +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#define ORC_RESTRICT restrict +#elif defined(__GNUC__) && __GNUC__ >= 4 +#define ORC_RESTRICT __restrict__ +#else +#define ORC_RESTRICT +#endif +#endif -void cogorc_memcpy_2d (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m); -void cogorc_downsample_horiz_cosite_1tap (guint8 * d1, const guint8 * s1, +#ifndef DISABLE_ORC +#include +#endif +void cogorc_memcpy_2d (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_downsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_downsample_horiz_cosite_3tap (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); +void cogorc_downsample_420_jpeg (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); +void cogorc_downsample_vert_halfsite_2tap (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); +void cogorc_downsample_vert_cosite_3tap (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int n); +void cogorc_downsample_vert_halfsite_4tap (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n); +void cogorc_upsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_upsample_horiz_cosite (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); +void cogorc_upsample_vert_avgub (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); +void orc_unpack_yuyv_y (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void orc_unpack_yuyv_u (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void orc_unpack_yuyv_v (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void orc_pack_yuyv (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n); +void orc_unpack_uyvy_y (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void orc_unpack_uyvy_u (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void orc_unpack_uyvy_v (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void orc_pack_uyvy (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n); +void orc_matrix2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int p1, int p2, int p3, int n); +void orc_matrix2_11_u8 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, + int p2, int n); +void orc_matrix2_12_u8 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, + int p2, int n); +void orc_matrix3_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, + int p2, int p3, int p4, int n); +void orc_matrix3_100_u8 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int n); +void orc_matrix3_100_offset_u8 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, int n); -void cogorc_downsample_horiz_cosite_3tap (guint8 * d1, const guint8 * s1, - const guint8 * s2, int n); -void cogorc_downsample_420_jpeg (guint8 * d1, const guint8 * s1, - const guint8 * s2, int n); -void cogorc_downsample_vert_halfsite_2tap (guint8 * d1, const guint8 * s1, - const guint8 * s2, int n); -void cogorc_downsample_vert_cosite_3tap (guint8 * d1, const guint8 * s1, - const guint8 * s2, const guint8 * s3, int n); -void cogorc_downsample_vert_halfsite_4tap (guint8 * d1, const guint8 * s1, - const guint8 * s2, const guint8 * s3, const guint8 * s4, int n); -void cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const guint8 * s1, int n); -void cogorc_upsample_horiz_cosite (guint8 * d1, const guint8 * s1, - const guint8 * s2, int n); -void cogorc_upsample_vert_avgub (guint8 * d1, const guint8 * s1, - const guint8 * s2, int n); -void orc_unpack_yuyv_y (guint8 * d1, const guint8 * s1, int n); -void orc_unpack_yuyv_u (guint8 * d1, const guint8 * s1, int n); -void orc_unpack_yuyv_v (guint8 * d1, const guint8 * s1, int n); -void orc_pack_yuyv (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n); -void orc_unpack_uyvy_y (guint8 * d1, const guint8 * s1, int n); -void orc_unpack_uyvy_u (guint8 * d1, const guint8 * s1, int n); -void orc_unpack_uyvy_v (guint8 * d1, const guint8 * s1, int n); -void orc_pack_uyvy (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n); -void orc_matrix2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, - int p2, int p3, int n); -void orc_matrix2_11_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - int p1, int p2, int n); -void orc_matrix2_12_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - int p1, int p2, int n); -void orc_matrix3_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int p4, int n); -void orc_matrix3_100_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int n); -void orc_matrix3_100_offset_u8 (guint8 * d1, const guint8 * s1, - const guint8 * s2, const guint8 * s3, int p1, int p2, int p3, int p4, - int p5, int n); -void orc_matrix3_000_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int p4, int p5, int n); -void orc_pack_123x (guint32 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int n); -void orc_pack_x123 (guint32 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int n); -void cogorc_combine2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - int p1, int p2, int n); -void cogorc_convert_I420_UYVY (guint8 * d1, guint8 * d2, const guint8 * s1, - const guint8 * s2, const guint8 * s3, const guint8 * s4, int n); -void cogorc_convert_I420_YUY2 (guint8 * d1, guint8 * d2, const guint8 * s1, - const guint8 * s2, const guint8 * s3, const guint8 * s4, int n); -void cogorc_convert_I420_AYUV (guint8 * d1, guint8 * d2, const guint8 * s1, - const guint8 * s2, const guint8 * s3, const guint8 * s4, int n); -void cogorc_convert_YUY2_I420 (guint8 * d1, guint8 * d2, guint8 * d3, - guint8 * d4, const guint8 * s1, const guint8 * s2, int n); -void cogorc_convert_UYVY_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m); -void cogorc_planar_chroma_420_422 (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_420_444 (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_422_444 (guint8 * d1, int d1_stride, - const guint8 * s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_444_422 (guint8 * d1, int d1_stride, - const guint8 * s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_444_420 (guint8 * d1, int d1_stride, - const guint8 * s1, int s1_stride, const guint8 * s2, int s2_stride, int n, - int m); -void cogorc_planar_chroma_422_420 (guint8 * d1, int d1_stride, - const guint8 * s1, int s1_stride, const guint8 * s2, int s2_stride, int n, - int m); -void cogorc_convert_YUY2_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m); -void cogorc_convert_UYVY_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m); -void cogorc_convert_YUY2_Y42B (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, - int n, int m); -void cogorc_convert_UYVY_Y42B (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, - int n, int m); -void cogorc_convert_YUY2_Y444 (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, - int n, int m); -void cogorc_convert_UYVY_Y444 (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, - int n, int m); -void cogorc_convert_UYVY_I420 (guint8 * d1, guint8 * d2, guint8 * d3, - guint8 * d4, const guint8 * s1, const guint8 * s2, int n); -void cogorc_convert_AYUV_I420 (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, guint8 * d4, int d4_stride, - const guint8 * s1, int s1_stride, const guint8 * s2, int s2_stride, int n, - int m); -void cogorc_convert_AYUV_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m); -void cogorc_convert_AYUV_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m); -void cogorc_convert_AYUV_Y42B (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, - int n, int m); -void cogorc_convert_AYUV_Y444 (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, - int n, int m); -void cogorc_convert_Y42B_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, - int s3_stride, int n, int m); -void cogorc_convert_Y42B_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, - int s3_stride, int n, int m); -void cogorc_convert_Y42B_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, - int s3_stride, int n, int m); -void cogorc_convert_Y444_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, - int s3_stride, int n, int m); -void cogorc_convert_Y444_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, - int s3_stride, int n, int m); -void cogorc_convert_Y444_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, - int s3_stride, int n, int m); -void cogorc_convert_AYUV_ARGB (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m); -void cogorc_convert_AYUV_BGRA (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m); -void cogorc_convert_AYUV_ABGR (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m); -void cogorc_convert_AYUV_RGBA (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m); -void cogorc_convert_I420_BGRA (guint8 * d1, const guint8 * s1, - const guint8 * s2, const guint8 * s3, int n); -void cogorc_convert_I420_BGRA_avg (guint8 * d1, const guint8 * s1, - const guint8 * s2, const guint8 * s3, const guint8 * s4, const guint8 * s5, +void orc_matrix3_000_u8 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, int n); -void cogorc_getline_I420 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n); -void cogorc_getline_YUV9 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n); -void cogorc_getline_YUY2 (guint8 * d1, const guint8 * s1, int n); -void cogorc_getline_UYVY (guint8 * d1, const guint8 * s1, int n); -void cogorc_getline_YVYU (guint8 * d1, const guint8 * s1, int n); -void cogorc_getline_Y42B (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n); -void cogorc_getline_Y444 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n); -void cogorc_getline_Y800 (guint8 * d1, const guint8 * s1, int n); -void cogorc_getline_Y16 (guint8 * d1, const guint8 * s1, int n); -void cogorc_getline_BGRA (guint8 * d1, const guint8 * s1, int n); -void cogorc_getline_ABGR (guint8 * d1, const guint8 * s1, int n); -void cogorc_getline_RGBA (guint8 * d1, const guint8 * s1, int n); -void cogorc_getline_NV12 (guint8 * d1, const guint8 * s1, const guint8 * s2, +void orc_pack_123x (guint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int n); -void cogorc_getline_NV21 (guint8 * d1, const guint8 * s1, const guint8 * s2, +void orc_pack_x123 (guint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int n); -void cogorc_getline_A420 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, const guint8 * s4, int n); -void cogorc_putline_I420 (guint8 * d1, guint8 * d2, guint8 * d3, - const guint8 * s1, int n); -void cogorc_putline_YUY2 (guint8 * d1, const guint8 * s1, int n); -void cogorc_putline_YVYU (guint8 * d1, const guint8 * s1, int n); -void cogorc_putline_UYVY (guint8 * d1, const guint8 * s1, int n); -void cogorc_putline_Y42B (guint8 * d1, guint8 * d2, guint8 * d3, - const guint8 * s1, int n); -void cogorc_putline_Y444 (guint8 * d1, guint8 * d2, guint8 * d3, - const guint8 * s1, int n); -void cogorc_putline_Y800 (guint8 * d1, const guint8 * s1, int n); -void cogorc_putline_Y16 (guint8 * d1, const guint8 * s1, int n); -void cogorc_putline_BGRA (guint8 * d1, const guint8 * s1, int n); -void cogorc_putline_ABGR (guint8 * d1, const guint8 * s1, int n); -void cogorc_putline_RGBA (guint8 * d1, const guint8 * s1, int n); -void cogorc_putline_NV12 (guint8 * d1, guint8 * d2, const guint8 * s1, int n); -void cogorc_putline_NV21 (guint8 * d1, guint8 * d2, const guint8 * s1, int n); -void cogorc_putline_A420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, - const guint8 * s1, int n); +void cogorc_combine2_u8 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, + int p2, int n); +void cogorc_convert_I420_UYVY (guint8 * ORC_RESTRICT d1, + guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, + const guint8 * ORC_RESTRICT s4, int n); +void cogorc_convert_I420_YUY2 (guint8 * ORC_RESTRICT d1, + guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, + const guint8 * ORC_RESTRICT s4, int n); +void cogorc_convert_I420_AYUV (guint8 * ORC_RESTRICT d1, + guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, + const guint8 * ORC_RESTRICT s4, int n); +void cogorc_convert_YUY2_I420 (guint8 * ORC_RESTRICT d1, + guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, + guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int n); +void cogorc_convert_UYVY_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_planar_chroma_420_422 (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, + int s1_stride, int n, int m); +void cogorc_planar_chroma_420_444 (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, + int s1_stride, int n, int m); +void cogorc_planar_chroma_422_444 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_planar_chroma_444_422 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_planar_chroma_444_420 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m); +void cogorc_planar_chroma_422_420 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m); +void cogorc_convert_YUY2_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_UYVY_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_YUY2_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_UYVY_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_YUY2_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_UYVY_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_UYVY_I420 (guint8 * ORC_RESTRICT d1, + guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, + guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int n); +void cogorc_convert_AYUV_I420 (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, guint8 * ORC_RESTRICT d4, int d4_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m); +void cogorc_convert_AYUV_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_Y42B_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, + const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y42B_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, + const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y42B_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, + const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y444_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, + const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y444_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, + const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y444_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, + const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_AYUV_ARGB (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_BGRA (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_ABGR (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_RGBA (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_I420_BGRA (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int n); +void cogorc_convert_I420_BGRA_avg (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, int n); +void cogorc_getline_I420 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int n); +void cogorc_getline_YUV9 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int n); +void cogorc_getline_YUY2 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_getline_UYVY (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_getline_YVYU (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_getline_Y42B (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int n); +void cogorc_getline_Y444 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int n); +void cogorc_getline_Y800 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_getline_Y16 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_getline_BGRA (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_getline_ABGR (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_getline_RGBA (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_getline_NV12 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); +void cogorc_getline_NV21 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); +void cogorc_getline_A420 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n); +void cogorc_putline_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_YUY2 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_YVYU (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_UYVY (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_Y42B (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_Y444 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_Y800 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_Y16 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_BGRA (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_ABGR (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_RGBA (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_NV12 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_NV21 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_A420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, + const guint8 * ORC_RESTRICT s1, int n); /* begin Orc C target preamble */ @@ -282,6 +356,7 @@ void cogorc_putline_A420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, #define ORC_ISNAN(x) ((((x)&0x7f800000) == 0x7f800000) && (((x)&0x007fffff) != 0)) #define ORC_DENORMAL_DOUBLE(x) ((x) & ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == 0) ? ORC_UINT64_C(0xfff0000000000000) : ORC_UINT64_C(0xffffffffffffffff))) #define ORC_ISNAN_DOUBLE(x) ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == ORC_UINT64_C(0x7ff0000000000000)) && (((x)&ORC_UINT64_C(0x000fffffffffffff)) != 0)) +#ifndef ORC_RESTRICT #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define ORC_RESTRICT restrict #elif defined(__GNUC__) && __GNUC__ >= 4 @@ -289,6 +364,7 @@ void cogorc_putline_A420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, #else #define ORC_RESTRICT #endif +#endif /* end Orc C target preamble */ @@ -296,8 +372,8 @@ void cogorc_putline_A420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, /* cogorc_memcpy_2d */ #ifdef DISABLE_ORC void -cogorc_memcpy_2d (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, - int n, int m) +cogorc_memcpy_2d (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -325,7 +401,7 @@ cogorc_memcpy_2d (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, #else static void -_backup_cogorc_memcpy_2d (OrcExecutor * ex) +_backup_cogorc_memcpy_2d (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -354,8 +430,8 @@ _backup_cogorc_memcpy_2d (OrcExecutor * ex) } void -cogorc_memcpy_2d (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, - int n, int m) +cogorc_memcpy_2d (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -365,7 +441,6 @@ cogorc_memcpy_2d (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -377,7 +452,7 @@ cogorc_memcpy_2d (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, orc_program_append_2 (p, "copyb", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -400,7 +475,8 @@ cogorc_memcpy_2d (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, /* cogorc_downsample_horiz_cosite_1tap */ #ifdef DISABLE_ORC void -cogorc_downsample_horiz_cosite_1tap (guint8 * d1, const guint8 * s1, int n) +cogorc_downsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -416,7 +492,11 @@ cogorc_downsample_horiz_cosite_1tap (guint8 * d1, const guint8 * s1, int n) /* 0: loadw */ var32 = ptr4[i]; /* 1: select0wb */ - var33 = (orc_uint16) var32.i & 0xff; + { + orc_union16 _src; + _src.i = var32.i; + var33 = _src.x2[0]; + } /* 2: storeb */ ptr0[i] = var33; } @@ -425,7 +505,7 @@ cogorc_downsample_horiz_cosite_1tap (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_cogorc_downsample_horiz_cosite_1tap (OrcExecutor * ex) +_backup_cogorc_downsample_horiz_cosite_1tap (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -442,7 +522,11 @@ _backup_cogorc_downsample_horiz_cosite_1tap (OrcExecutor * ex) /* 0: loadw */ var32 = ptr4[i]; /* 1: select0wb */ - var33 = (orc_uint16) var32.i & 0xff; + { + orc_union16 _src; + _src.i = var32.i; + var33 = _src.x2[0]; + } /* 2: storeb */ ptr0[i] = var33; } @@ -450,7 +534,8 @@ _backup_cogorc_downsample_horiz_cosite_1tap (OrcExecutor * ex) } void -cogorc_downsample_horiz_cosite_1tap (guint8 * d1, const guint8 * s1, int n) +cogorc_downsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -460,7 +545,6 @@ cogorc_downsample_horiz_cosite_1tap (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_downsample_horiz_cosite_1tap"); @@ -472,7 +556,7 @@ cogorc_downsample_horiz_cosite_1tap (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "select0wb", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -492,8 +576,8 @@ cogorc_downsample_horiz_cosite_1tap (guint8 * d1, const guint8 * s1, int n) /* cogorc_downsample_horiz_cosite_3tap */ #ifdef DISABLE_ORC void -cogorc_downsample_horiz_cosite_3tap (guint8 * d1, const guint8 * s1, - const guint8 * s2, int n) +cogorc_downsample_horiz_cosite_3tap (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -522,9 +606,9 @@ cogorc_downsample_horiz_cosite_3tap (guint8 * d1, const guint8 * s1, ptr5 = (orc_union16 *) s2; /* 9: loadpw */ - var40.i = 0x00000002; /* 2 or 9.88131e-324f */ + var40.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ /* 13: loadpw */ - var41.i = 0x00000002; /* 2 or 9.88131e-324f */ + var41.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ for (i = 0; i < n; i++) { /* 0: loadw */ @@ -532,13 +616,25 @@ cogorc_downsample_horiz_cosite_3tap (guint8 * d1, const guint8 * s1, /* 1: copyw */ var43.i = var38.i; /* 2: select0wb */ - var44 = (orc_uint16) var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var44 = _src.x2[0]; + } /* 3: select1wb */ - var45 = ((orc_uint16) var43.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var45 = _src.x2[1]; + } /* 4: loadw */ var39 = ptr5[i]; /* 5: select0wb */ - var46 = (orc_uint16) var39.i & 0xff; + { + orc_union16 _src; + _src.i = var39.i; + var46 = _src.x2[0]; + } /* 6: convubw */ var47.i = (orc_uint8) var44; /* 7: convubw */ @@ -565,7 +661,7 @@ cogorc_downsample_horiz_cosite_3tap (guint8 * d1, const guint8 * s1, #else static void -_backup_cogorc_downsample_horiz_cosite_3tap (OrcExecutor * ex) +_backup_cogorc_downsample_horiz_cosite_3tap (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -595,9 +691,9 @@ _backup_cogorc_downsample_horiz_cosite_3tap (OrcExecutor * ex) ptr5 = (orc_union16 *) ex->arrays[5]; /* 9: loadpw */ - var40.i = 0x00000002; /* 2 or 9.88131e-324f */ + var40.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ /* 13: loadpw */ - var41.i = 0x00000002; /* 2 or 9.88131e-324f */ + var41.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ for (i = 0; i < n; i++) { /* 0: loadw */ @@ -605,13 +701,25 @@ _backup_cogorc_downsample_horiz_cosite_3tap (OrcExecutor * ex) /* 1: copyw */ var43.i = var38.i; /* 2: select0wb */ - var44 = (orc_uint16) var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var44 = _src.x2[0]; + } /* 3: select1wb */ - var45 = ((orc_uint16) var43.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var45 = _src.x2[1]; + } /* 4: loadw */ var39 = ptr5[i]; /* 5: select0wb */ - var46 = (orc_uint16) var39.i & 0xff; + { + orc_union16 _src; + _src.i = var39.i; + var46 = _src.x2[0]; + } /* 6: convubw */ var47.i = (orc_uint8) var44; /* 7: convubw */ @@ -637,8 +745,8 @@ _backup_cogorc_downsample_horiz_cosite_3tap (OrcExecutor * ex) } void -cogorc_downsample_horiz_cosite_3tap (guint8 * d1, const guint8 * s1, - const guint8 * s2, int n) +cogorc_downsample_horiz_cosite_3tap (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -648,7 +756,6 @@ cogorc_downsample_horiz_cosite_3tap (guint8 * d1, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_downsample_horiz_cosite_3tap"); @@ -692,7 +799,7 @@ cogorc_downsample_horiz_cosite_3tap (guint8 * d1, const guint8 * s1, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T4, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -713,8 +820,8 @@ cogorc_downsample_horiz_cosite_3tap (guint8 * d1, const guint8 * s1, /* cogorc_downsample_420_jpeg */ #ifdef DISABLE_ORC void -cogorc_downsample_420_jpeg (guint8 * d1, const guint8 * s1, const guint8 * s2, - int n) +cogorc_downsample_420_jpeg (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -743,9 +850,17 @@ cogorc_downsample_420_jpeg (guint8 * d1, const guint8 * s1, const guint8 * s2, /* 1: copyw */ var40.i = var37.i; /* 2: select0wb */ - var41 = (orc_uint16) var40.i & 0xff; + { + orc_union16 _src; + _src.i = var40.i; + var41 = _src.x2[0]; + } /* 3: select1wb */ - var42 = ((orc_uint16) var40.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.i; + var42 = _src.x2[1]; + } /* 4: avgub */ var43 = ((orc_uint8) var41 + (orc_uint8) var42 + 1) >> 1; /* 5: loadw */ @@ -753,9 +868,17 @@ cogorc_downsample_420_jpeg (guint8 * d1, const guint8 * s1, const guint8 * s2, /* 6: copyw */ var44.i = var38.i; /* 7: select0wb */ - var45 = (orc_uint16) var44.i & 0xff; + { + orc_union16 _src; + _src.i = var44.i; + var45 = _src.x2[0]; + } /* 8: select1wb */ - var46 = ((orc_uint16) var44.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var44.i; + var46 = _src.x2[1]; + } /* 9: avgub */ var47 = ((orc_uint8) var45 + (orc_uint8) var46 + 1) >> 1; /* 10: avgub */ @@ -768,7 +891,7 @@ cogorc_downsample_420_jpeg (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_cogorc_downsample_420_jpeg (OrcExecutor * ex) +_backup_cogorc_downsample_420_jpeg (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -798,9 +921,17 @@ _backup_cogorc_downsample_420_jpeg (OrcExecutor * ex) /* 1: copyw */ var40.i = var37.i; /* 2: select0wb */ - var41 = (orc_uint16) var40.i & 0xff; + { + orc_union16 _src; + _src.i = var40.i; + var41 = _src.x2[0]; + } /* 3: select1wb */ - var42 = ((orc_uint16) var40.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.i; + var42 = _src.x2[1]; + } /* 4: avgub */ var43 = ((orc_uint8) var41 + (orc_uint8) var42 + 1) >> 1; /* 5: loadw */ @@ -808,9 +939,17 @@ _backup_cogorc_downsample_420_jpeg (OrcExecutor * ex) /* 6: copyw */ var44.i = var38.i; /* 7: select0wb */ - var45 = (orc_uint16) var44.i & 0xff; + { + orc_union16 _src; + _src.i = var44.i; + var45 = _src.x2[0]; + } /* 8: select1wb */ - var46 = ((orc_uint16) var44.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var44.i; + var46 = _src.x2[1]; + } /* 9: avgub */ var47 = ((orc_uint8) var45 + (orc_uint8) var46 + 1) >> 1; /* 10: avgub */ @@ -822,8 +961,8 @@ _backup_cogorc_downsample_420_jpeg (OrcExecutor * ex) } void -cogorc_downsample_420_jpeg (guint8 * d1, const guint8 * s1, const guint8 * s2, - int n) +cogorc_downsample_420_jpeg (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -833,7 +972,6 @@ cogorc_downsample_420_jpeg (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_downsample_420_jpeg"); @@ -866,7 +1004,7 @@ cogorc_downsample_420_jpeg (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T4, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -887,8 +1025,8 @@ cogorc_downsample_420_jpeg (guint8 * d1, const guint8 * s1, const guint8 * s2, /* cogorc_downsample_vert_halfsite_2tap */ #ifdef DISABLE_ORC void -cogorc_downsample_vert_halfsite_2tap (guint8 * d1, const guint8 * s1, - const guint8 * s2, int n) +cogorc_downsample_vert_halfsite_2tap (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -918,7 +1056,7 @@ cogorc_downsample_vert_halfsite_2tap (guint8 * d1, const guint8 * s1, #else static void -_backup_cogorc_downsample_vert_halfsite_2tap (OrcExecutor * ex) +_backup_cogorc_downsample_vert_halfsite_2tap (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -948,8 +1086,8 @@ _backup_cogorc_downsample_vert_halfsite_2tap (OrcExecutor * ex) } void -cogorc_downsample_vert_halfsite_2tap (guint8 * d1, const guint8 * s1, - const guint8 * s2, int n) +cogorc_downsample_vert_halfsite_2tap (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -959,7 +1097,6 @@ cogorc_downsample_vert_halfsite_2tap (guint8 * d1, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_downsample_vert_halfsite_2tap"); @@ -972,7 +1109,7 @@ cogorc_downsample_vert_halfsite_2tap (guint8 * d1, const guint8 * s1, orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_S2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -993,8 +1130,9 @@ cogorc_downsample_vert_halfsite_2tap (guint8 * d1, const guint8 * s1, /* cogorc_downsample_vert_cosite_3tap */ #ifdef DISABLE_ORC void -cogorc_downsample_vert_cosite_3tap (guint8 * d1, const guint8 * s1, - const guint8 * s2, const guint8 * s3, int n) +cogorc_downsample_vert_cosite_3tap (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -1022,9 +1160,9 @@ cogorc_downsample_vert_cosite_3tap (guint8 * d1, const guint8 * s1, ptr6 = (orc_int8 *) s3; /* 6: loadpw */ - var38.i = 0x00000002; /* 2 or 9.88131e-324f */ + var38.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ /* 10: loadpw */ - var39.i = 0x00000002; /* 2 or 9.88131e-324f */ + var39.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -1059,7 +1197,7 @@ cogorc_downsample_vert_cosite_3tap (guint8 * d1, const guint8 * s1, #else static void -_backup_cogorc_downsample_vert_cosite_3tap (OrcExecutor * ex) +_backup_cogorc_downsample_vert_cosite_3tap (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -1088,9 +1226,9 @@ _backup_cogorc_downsample_vert_cosite_3tap (OrcExecutor * ex) ptr6 = (orc_int8 *) ex->arrays[6]; /* 6: loadpw */ - var38.i = 0x00000002; /* 2 or 9.88131e-324f */ + var38.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ /* 10: loadpw */ - var39.i = 0x00000002; /* 2 or 9.88131e-324f */ + var39.i = (int) 0x00000002; /* 2 or 9.88131e-324f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -1124,8 +1262,9 @@ _backup_cogorc_downsample_vert_cosite_3tap (OrcExecutor * ex) } void -cogorc_downsample_vert_cosite_3tap (guint8 * d1, const guint8 * s1, - const guint8 * s2, const guint8 * s3, int n) +cogorc_downsample_vert_cosite_3tap (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -1135,7 +1274,6 @@ cogorc_downsample_vert_cosite_3tap (guint8 * d1, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_downsample_vert_cosite_3tap"); @@ -1169,7 +1307,7 @@ cogorc_downsample_vert_cosite_3tap (guint8 * d1, const guint8 * s1, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -1191,8 +1329,9 @@ cogorc_downsample_vert_cosite_3tap (guint8 * d1, const guint8 * s1, /* cogorc_downsample_vert_halfsite_4tap */ #ifdef DISABLE_ORC void -cogorc_downsample_vert_halfsite_4tap (guint8 * d1, const guint8 * s1, - const guint8 * s2, const guint8 * s3, const guint8 * s4, int n) +cogorc_downsample_vert_halfsite_4tap (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -1227,11 +1366,11 @@ cogorc_downsample_vert_halfsite_4tap (guint8 * d1, const guint8 * s1, ptr7 = (orc_int8 *) s4; /* 9: loadpw */ - var40.i = 0x0000001a; /* 26 or 1.28457e-322f */ + var40.i = (int) 0x0000001a; /* 26 or 1.28457e-322f */ /* 12: loadpw */ - var41.i = 0x00000006; /* 6 or 2.96439e-323f */ + var41.i = (int) 0x00000006; /* 6 or 2.96439e-323f */ /* 15: loadpw */ - var42.i = 0x00000020; /* 32 or 1.58101e-322f */ + var42.i = (int) 0x00000020; /* 32 or 1.58101e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -1274,7 +1413,7 @@ cogorc_downsample_vert_halfsite_4tap (guint8 * d1, const guint8 * s1, #else static void -_backup_cogorc_downsample_vert_halfsite_4tap (OrcExecutor * ex) +_backup_cogorc_downsample_vert_halfsite_4tap (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -1310,11 +1449,11 @@ _backup_cogorc_downsample_vert_halfsite_4tap (OrcExecutor * ex) ptr7 = (orc_int8 *) ex->arrays[7]; /* 9: loadpw */ - var40.i = 0x0000001a; /* 26 or 1.28457e-322f */ + var40.i = (int) 0x0000001a; /* 26 or 1.28457e-322f */ /* 12: loadpw */ - var41.i = 0x00000006; /* 6 or 2.96439e-323f */ + var41.i = (int) 0x00000006; /* 6 or 2.96439e-323f */ /* 15: loadpw */ - var42.i = 0x00000020; /* 32 or 1.58101e-322f */ + var42.i = (int) 0x00000020; /* 32 or 1.58101e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -1356,8 +1495,9 @@ _backup_cogorc_downsample_vert_halfsite_4tap (OrcExecutor * ex) } void -cogorc_downsample_vert_halfsite_4tap (guint8 * d1, const guint8 * s1, - const guint8 * s2, const guint8 * s3, const guint8 * s4, int n) +cogorc_downsample_vert_halfsite_4tap (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -1367,7 +1507,6 @@ cogorc_downsample_vert_halfsite_4tap (guint8 * d1, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_downsample_vert_halfsite_4tap"); @@ -1411,7 +1550,7 @@ cogorc_downsample_vert_halfsite_4tap (guint8 * d1, const guint8 * s1, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -1434,7 +1573,8 @@ cogorc_downsample_vert_halfsite_4tap (guint8 * d1, const guint8 * s1, /* cogorc_upsample_horiz_cosite_1tap */ #ifdef DISABLE_ORC void -cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const guint8 * s1, int n) +cogorc_upsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n) { int i; orc_union16 *ORC_RESTRICT ptr0; @@ -1453,7 +1593,12 @@ cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const guint8 * s1, int n) /* 1: copyb */ var35 = var33; /* 2: mergebw */ - var34.i = ((orc_uint8) var35 & 0x00ff) | ((orc_uint8) var35 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var35; + _dest.x2[1] = var35; + var34.i = _dest.i; + } /* 3: storew */ ptr0[i] = var34; } @@ -1462,7 +1607,7 @@ cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_cogorc_upsample_horiz_cosite_1tap (OrcExecutor * ex) +_backup_cogorc_upsample_horiz_cosite_1tap (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -1482,7 +1627,12 @@ _backup_cogorc_upsample_horiz_cosite_1tap (OrcExecutor * ex) /* 1: copyb */ var35 = var33; /* 2: mergebw */ - var34.i = ((orc_uint8) var35 & 0x00ff) | ((orc_uint8) var35 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var35; + _dest.x2[1] = var35; + var34.i = _dest.i; + } /* 3: storew */ ptr0[i] = var34; } @@ -1490,7 +1640,8 @@ _backup_cogorc_upsample_horiz_cosite_1tap (OrcExecutor * ex) } void -cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const guint8 * s1, int n) +cogorc_upsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -1500,7 +1651,6 @@ cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_upsample_horiz_cosite_1tap"); @@ -1515,7 +1665,7 @@ cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "mergebw", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -1535,8 +1685,8 @@ cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const guint8 * s1, int n) /* cogorc_upsample_horiz_cosite */ #ifdef DISABLE_ORC void -cogorc_upsample_horiz_cosite (guint8 * d1, const guint8 * s1, const guint8 * s2, - int n) +cogorc_upsample_horiz_cosite (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) { int i; orc_union16 *ORC_RESTRICT ptr0; @@ -1563,7 +1713,12 @@ cogorc_upsample_horiz_cosite (guint8 * d1, const guint8 * s1, const guint8 * s2, /* 3: avgub */ var38 = ((orc_uint8) var37 + (orc_uint8) var35 + 1) >> 1; /* 4: mergebw */ - var36.i = ((orc_uint8) var37 & 0x00ff) | ((orc_uint8) var38 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37; + _dest.x2[1] = var38; + var36.i = _dest.i; + } /* 5: storew */ ptr0[i] = var36; } @@ -1572,7 +1727,7 @@ cogorc_upsample_horiz_cosite (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_cogorc_upsample_horiz_cosite (OrcExecutor * ex) +_backup_cogorc_upsample_horiz_cosite (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -1600,7 +1755,12 @@ _backup_cogorc_upsample_horiz_cosite (OrcExecutor * ex) /* 3: avgub */ var38 = ((orc_uint8) var37 + (orc_uint8) var35 + 1) >> 1; /* 4: mergebw */ - var36.i = ((orc_uint8) var37 & 0x00ff) | ((orc_uint8) var38 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37; + _dest.x2[1] = var38; + var36.i = _dest.i; + } /* 5: storew */ ptr0[i] = var36; } @@ -1608,8 +1768,8 @@ _backup_cogorc_upsample_horiz_cosite (OrcExecutor * ex) } void -cogorc_upsample_horiz_cosite (guint8 * d1, const guint8 * s1, const guint8 * s2, - int n) +cogorc_upsample_horiz_cosite (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -1619,7 +1779,6 @@ cogorc_upsample_horiz_cosite (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_upsample_horiz_cosite"); @@ -1637,7 +1796,7 @@ cogorc_upsample_horiz_cosite (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "mergebw", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -1658,8 +1817,8 @@ cogorc_upsample_horiz_cosite (guint8 * d1, const guint8 * s1, const guint8 * s2, /* cogorc_upsample_vert_avgub */ #ifdef DISABLE_ORC void -cogorc_upsample_vert_avgub (guint8 * d1, const guint8 * s1, const guint8 * s2, - int n) +cogorc_upsample_vert_avgub (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -1689,7 +1848,7 @@ cogorc_upsample_vert_avgub (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_cogorc_upsample_vert_avgub (OrcExecutor * ex) +_backup_cogorc_upsample_vert_avgub (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -1719,8 +1878,8 @@ _backup_cogorc_upsample_vert_avgub (OrcExecutor * ex) } void -cogorc_upsample_vert_avgub (guint8 * d1, const guint8 * s1, const guint8 * s2, - int n) +cogorc_upsample_vert_avgub (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -1730,7 +1889,6 @@ cogorc_upsample_vert_avgub (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_upsample_vert_avgub"); @@ -1742,7 +1900,7 @@ cogorc_upsample_vert_avgub (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_S2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -1763,7 +1921,8 @@ cogorc_upsample_vert_avgub (guint8 * d1, const guint8 * s1, const guint8 * s2, /* orc_unpack_yuyv_y */ #ifdef DISABLE_ORC void -orc_unpack_yuyv_y (guint8 * d1, const guint8 * s1, int n) +orc_unpack_yuyv_y (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -1779,7 +1938,11 @@ orc_unpack_yuyv_y (guint8 * d1, const guint8 * s1, int n) /* 0: loadw */ var32 = ptr4[i]; /* 1: select0wb */ - var33 = (orc_uint16) var32.i & 0xff; + { + orc_union16 _src; + _src.i = var32.i; + var33 = _src.x2[0]; + } /* 2: storeb */ ptr0[i] = var33; } @@ -1788,7 +1951,7 @@ orc_unpack_yuyv_y (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_orc_unpack_yuyv_y (OrcExecutor * ex) +_backup_orc_unpack_yuyv_y (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -1805,7 +1968,11 @@ _backup_orc_unpack_yuyv_y (OrcExecutor * ex) /* 0: loadw */ var32 = ptr4[i]; /* 1: select0wb */ - var33 = (orc_uint16) var32.i & 0xff; + { + orc_union16 _src; + _src.i = var32.i; + var33 = _src.x2[0]; + } /* 2: storeb */ ptr0[i] = var33; } @@ -1813,7 +1980,8 @@ _backup_orc_unpack_yuyv_y (OrcExecutor * ex) } void -orc_unpack_yuyv_y (guint8 * d1, const guint8 * s1, int n) +orc_unpack_yuyv_y (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -1823,7 +1991,6 @@ orc_unpack_yuyv_y (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_unpack_yuyv_y"); @@ -1834,7 +2001,7 @@ orc_unpack_yuyv_y (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "select0wb", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -1854,7 +2021,8 @@ orc_unpack_yuyv_y (guint8 * d1, const guint8 * s1, int n) /* orc_unpack_yuyv_u */ #ifdef DISABLE_ORC void -orc_unpack_yuyv_u (guint8 * d1, const guint8 * s1, int n) +orc_unpack_yuyv_u (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -1871,9 +2039,17 @@ orc_unpack_yuyv_u (guint8 * d1, const guint8 * s1, int n) /* 0: loadl */ var33 = ptr4[i]; /* 1: select0lw */ - var35.i = (orc_uint32) var33.i & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[0]; + } /* 2: select1wb */ - var34 = ((orc_uint16) var35.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[1]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -1882,7 +2058,7 @@ orc_unpack_yuyv_u (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_orc_unpack_yuyv_u (OrcExecutor * ex) +_backup_orc_unpack_yuyv_u (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -1900,9 +2076,17 @@ _backup_orc_unpack_yuyv_u (OrcExecutor * ex) /* 0: loadl */ var33 = ptr4[i]; /* 1: select0lw */ - var35.i = (orc_uint32) var33.i & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[0]; + } /* 2: select1wb */ - var34 = ((orc_uint16) var35.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[1]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -1910,7 +2094,8 @@ _backup_orc_unpack_yuyv_u (OrcExecutor * ex) } void -orc_unpack_yuyv_u (guint8 * d1, const guint8 * s1, int n) +orc_unpack_yuyv_u (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -1920,7 +2105,6 @@ orc_unpack_yuyv_u (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_unpack_yuyv_u"); @@ -1934,7 +2118,7 @@ orc_unpack_yuyv_u (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -1954,7 +2138,8 @@ orc_unpack_yuyv_u (guint8 * d1, const guint8 * s1, int n) /* orc_unpack_yuyv_v */ #ifdef DISABLE_ORC void -orc_unpack_yuyv_v (guint8 * d1, const guint8 * s1, int n) +orc_unpack_yuyv_v (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -1971,9 +2156,17 @@ orc_unpack_yuyv_v (guint8 * d1, const guint8 * s1, int n) /* 0: loadl */ var33 = ptr4[i]; /* 1: select1lw */ - var35.i = ((orc_uint32) var33.i >> 16) & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[1]; + } /* 2: select1wb */ - var34 = ((orc_uint16) var35.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[1]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -1982,7 +2175,7 @@ orc_unpack_yuyv_v (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_orc_unpack_yuyv_v (OrcExecutor * ex) +_backup_orc_unpack_yuyv_v (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -2000,9 +2193,17 @@ _backup_orc_unpack_yuyv_v (OrcExecutor * ex) /* 0: loadl */ var33 = ptr4[i]; /* 1: select1lw */ - var35.i = ((orc_uint32) var33.i >> 16) & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[1]; + } /* 2: select1wb */ - var34 = ((orc_uint16) var35.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[1]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -2010,7 +2211,8 @@ _backup_orc_unpack_yuyv_v (OrcExecutor * ex) } void -orc_unpack_yuyv_v (guint8 * d1, const guint8 * s1, int n) +orc_unpack_yuyv_v (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -2020,7 +2222,6 @@ orc_unpack_yuyv_v (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_unpack_yuyv_v"); @@ -2034,7 +2235,7 @@ orc_unpack_yuyv_v (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -2054,8 +2255,8 @@ orc_unpack_yuyv_v (guint8 * d1, const guint8 * s1, int n) /* orc_pack_yuyv */ #ifdef DISABLE_ORC void -orc_pack_yuyv (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n) +orc_pack_yuyv (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -2084,20 +2285,42 @@ orc_pack_yuyv (guint8 * d1, const guint8 * s1, const guint8 * s2, /* 1: copyw */ var41.i = var37.i; /* 2: select0wb */ - var42 = (orc_uint16) var41.i & 0xff; + { + orc_union16 _src; + _src.i = var41.i; + var42 = _src.x2[0]; + } /* 3: select1wb */ - var43 = ((orc_uint16) var41.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var41.i; + var43 = _src.x2[1]; + } /* 4: loadb */ var38 = ptr5[i]; /* 5: mergebw */ - var44.i = ((orc_uint8) var42 & 0x00ff) | ((orc_uint8) var38 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var42; + _dest.x2[1] = var38; + var44.i = _dest.i; + } /* 6: loadb */ var39 = ptr6[i]; /* 7: mergebw */ - var45.i = ((orc_uint8) var43 & 0x00ff) | ((orc_uint8) var39 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var43; + _dest.x2[1] = var39; + var45.i = _dest.i; + } /* 8: mergewl */ - var40.i = - ((orc_uint16) var44.i & 0x0000ffff) | ((orc_uint16) var45.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var44.i; + _dest.x2[1] = var45.i; + var40.i = _dest.i; + } /* 9: storel */ ptr0[i] = var40; } @@ -2106,7 +2329,7 @@ orc_pack_yuyv (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_orc_pack_yuyv (OrcExecutor * ex) +_backup_orc_pack_yuyv (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -2136,20 +2359,42 @@ _backup_orc_pack_yuyv (OrcExecutor * ex) /* 1: copyw */ var41.i = var37.i; /* 2: select0wb */ - var42 = (orc_uint16) var41.i & 0xff; + { + orc_union16 _src; + _src.i = var41.i; + var42 = _src.x2[0]; + } /* 3: select1wb */ - var43 = ((orc_uint16) var41.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var41.i; + var43 = _src.x2[1]; + } /* 4: loadb */ var38 = ptr5[i]; /* 5: mergebw */ - var44.i = ((orc_uint8) var42 & 0x00ff) | ((orc_uint8) var38 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var42; + _dest.x2[1] = var38; + var44.i = _dest.i; + } /* 6: loadb */ var39 = ptr6[i]; /* 7: mergebw */ - var45.i = ((orc_uint8) var43 & 0x00ff) | ((orc_uint8) var39 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var43; + _dest.x2[1] = var39; + var45.i = _dest.i; + } /* 8: mergewl */ - var40.i = - ((orc_uint16) var44.i & 0x0000ffff) | ((orc_uint16) var45.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var44.i; + _dest.x2[1] = var45.i; + var40.i = _dest.i; + } /* 9: storel */ ptr0[i] = var40; } @@ -2157,8 +2402,8 @@ _backup_orc_pack_yuyv (OrcExecutor * ex) } void -orc_pack_yuyv (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n) +orc_pack_yuyv (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -2168,7 +2413,6 @@ orc_pack_yuyv (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_pack_yuyv"); @@ -2196,7 +2440,7 @@ orc_pack_yuyv (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -2218,7 +2462,8 @@ orc_pack_yuyv (guint8 * d1, const guint8 * s1, const guint8 * s2, /* orc_unpack_uyvy_y */ #ifdef DISABLE_ORC void -orc_unpack_uyvy_y (guint8 * d1, const guint8 * s1, int n) +orc_unpack_uyvy_y (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -2234,7 +2479,11 @@ orc_unpack_uyvy_y (guint8 * d1, const guint8 * s1, int n) /* 0: loadw */ var32 = ptr4[i]; /* 1: select1wb */ - var33 = ((orc_uint16) var32.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var32.i; + var33 = _src.x2[1]; + } /* 2: storeb */ ptr0[i] = var33; } @@ -2243,7 +2492,7 @@ orc_unpack_uyvy_y (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_orc_unpack_uyvy_y (OrcExecutor * ex) +_backup_orc_unpack_uyvy_y (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -2260,7 +2509,11 @@ _backup_orc_unpack_uyvy_y (OrcExecutor * ex) /* 0: loadw */ var32 = ptr4[i]; /* 1: select1wb */ - var33 = ((orc_uint16) var32.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var32.i; + var33 = _src.x2[1]; + } /* 2: storeb */ ptr0[i] = var33; } @@ -2268,7 +2521,8 @@ _backup_orc_unpack_uyvy_y (OrcExecutor * ex) } void -orc_unpack_uyvy_y (guint8 * d1, const guint8 * s1, int n) +orc_unpack_uyvy_y (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -2278,7 +2532,6 @@ orc_unpack_uyvy_y (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_unpack_uyvy_y"); @@ -2289,7 +2542,7 @@ orc_unpack_uyvy_y (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -2309,7 +2562,8 @@ orc_unpack_uyvy_y (guint8 * d1, const guint8 * s1, int n) /* orc_unpack_uyvy_u */ #ifdef DISABLE_ORC void -orc_unpack_uyvy_u (guint8 * d1, const guint8 * s1, int n) +orc_unpack_uyvy_u (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -2326,9 +2580,17 @@ orc_unpack_uyvy_u (guint8 * d1, const guint8 * s1, int n) /* 0: loadl */ var33 = ptr4[i]; /* 1: select0lw */ - var35.i = (orc_uint32) var33.i & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[0]; + } /* 2: select0wb */ - var34 = (orc_uint16) var35.i & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[0]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -2337,7 +2599,7 @@ orc_unpack_uyvy_u (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_orc_unpack_uyvy_u (OrcExecutor * ex) +_backup_orc_unpack_uyvy_u (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -2355,9 +2617,17 @@ _backup_orc_unpack_uyvy_u (OrcExecutor * ex) /* 0: loadl */ var33 = ptr4[i]; /* 1: select0lw */ - var35.i = (orc_uint32) var33.i & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[0]; + } /* 2: select0wb */ - var34 = (orc_uint16) var35.i & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[0]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -2365,7 +2635,8 @@ _backup_orc_unpack_uyvy_u (OrcExecutor * ex) } void -orc_unpack_uyvy_u (guint8 * d1, const guint8 * s1, int n) +orc_unpack_uyvy_u (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -2375,7 +2646,6 @@ orc_unpack_uyvy_u (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_unpack_uyvy_u"); @@ -2389,7 +2659,7 @@ orc_unpack_uyvy_u (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "select0wb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -2409,7 +2679,8 @@ orc_unpack_uyvy_u (guint8 * d1, const guint8 * s1, int n) /* orc_unpack_uyvy_v */ #ifdef DISABLE_ORC void -orc_unpack_uyvy_v (guint8 * d1, const guint8 * s1, int n) +orc_unpack_uyvy_v (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -2426,9 +2697,17 @@ orc_unpack_uyvy_v (guint8 * d1, const guint8 * s1, int n) /* 0: loadl */ var33 = ptr4[i]; /* 1: select1lw */ - var35.i = ((orc_uint32) var33.i >> 16) & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[1]; + } /* 2: select0wb */ - var34 = (orc_uint16) var35.i & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[0]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -2437,7 +2716,7 @@ orc_unpack_uyvy_v (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_orc_unpack_uyvy_v (OrcExecutor * ex) +_backup_orc_unpack_uyvy_v (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -2455,9 +2734,17 @@ _backup_orc_unpack_uyvy_v (OrcExecutor * ex) /* 0: loadl */ var33 = ptr4[i]; /* 1: select1lw */ - var35.i = ((orc_uint32) var33.i >> 16) & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[1]; + } /* 2: select0wb */ - var34 = (orc_uint16) var35.i & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[0]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -2465,7 +2752,8 @@ _backup_orc_unpack_uyvy_v (OrcExecutor * ex) } void -orc_unpack_uyvy_v (guint8 * d1, const guint8 * s1, int n) +orc_unpack_uyvy_v (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -2475,7 +2763,6 @@ orc_unpack_uyvy_v (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_unpack_uyvy_v"); @@ -2489,7 +2776,7 @@ orc_unpack_uyvy_v (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "select0wb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -2509,8 +2796,8 @@ orc_unpack_uyvy_v (guint8 * d1, const guint8 * s1, int n) /* orc_pack_uyvy */ #ifdef DISABLE_ORC void -orc_pack_uyvy (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n) +orc_pack_uyvy (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -2539,20 +2826,42 @@ orc_pack_uyvy (guint8 * d1, const guint8 * s1, const guint8 * s2, /* 1: copyw */ var41.i = var37.i; /* 2: select0wb */ - var42 = (orc_uint16) var41.i & 0xff; + { + orc_union16 _src; + _src.i = var41.i; + var42 = _src.x2[0]; + } /* 3: select1wb */ - var43 = ((orc_uint16) var41.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var41.i; + var43 = _src.x2[1]; + } /* 4: loadb */ var38 = ptr5[i]; /* 5: mergebw */ - var44.i = ((orc_uint8) var38 & 0x00ff) | ((orc_uint8) var42 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var38; + _dest.x2[1] = var42; + var44.i = _dest.i; + } /* 6: loadb */ var39 = ptr6[i]; /* 7: mergebw */ - var45.i = ((orc_uint8) var39 & 0x00ff) | ((orc_uint8) var43 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39; + _dest.x2[1] = var43; + var45.i = _dest.i; + } /* 8: mergewl */ - var40.i = - ((orc_uint16) var44.i & 0x0000ffff) | ((orc_uint16) var45.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var44.i; + _dest.x2[1] = var45.i; + var40.i = _dest.i; + } /* 9: storel */ ptr0[i] = var40; } @@ -2561,7 +2870,7 @@ orc_pack_uyvy (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_orc_pack_uyvy (OrcExecutor * ex) +_backup_orc_pack_uyvy (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -2591,20 +2900,42 @@ _backup_orc_pack_uyvy (OrcExecutor * ex) /* 1: copyw */ var41.i = var37.i; /* 2: select0wb */ - var42 = (orc_uint16) var41.i & 0xff; + { + orc_union16 _src; + _src.i = var41.i; + var42 = _src.x2[0]; + } /* 3: select1wb */ - var43 = ((orc_uint16) var41.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var41.i; + var43 = _src.x2[1]; + } /* 4: loadb */ var38 = ptr5[i]; /* 5: mergebw */ - var44.i = ((orc_uint8) var38 & 0x00ff) | ((orc_uint8) var42 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var38; + _dest.x2[1] = var42; + var44.i = _dest.i; + } /* 6: loadb */ var39 = ptr6[i]; /* 7: mergebw */ - var45.i = ((orc_uint8) var39 & 0x00ff) | ((orc_uint8) var43 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39; + _dest.x2[1] = var43; + var45.i = _dest.i; + } /* 8: mergewl */ - var40.i = - ((orc_uint16) var44.i & 0x0000ffff) | ((orc_uint16) var45.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var44.i; + _dest.x2[1] = var45.i; + var40.i = _dest.i; + } /* 9: storel */ ptr0[i] = var40; } @@ -2612,8 +2943,8 @@ _backup_orc_pack_uyvy (OrcExecutor * ex) } void -orc_pack_uyvy (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n) +orc_pack_uyvy (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -2623,7 +2954,6 @@ orc_pack_uyvy (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_pack_uyvy"); @@ -2651,7 +2981,7 @@ orc_pack_uyvy (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -2673,8 +3003,8 @@ orc_pack_uyvy (guint8 * d1, const guint8 * s1, const guint8 * s2, /* orc_matrix2_u8 */ #ifdef DISABLE_ORC void -orc_matrix2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, - int p2, int p3, int n) +orc_matrix2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int p1, int p2, int p3, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -2734,7 +3064,7 @@ orc_matrix2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, #else static void -_backup_orc_matrix2_u8 (OrcExecutor * ex) +_backup_orc_matrix2_u8 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -2794,8 +3124,8 @@ _backup_orc_matrix2_u8 (OrcExecutor * ex) } void -orc_matrix2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, - int p2, int p3, int n) +orc_matrix2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int p1, int p2, int p3, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -2805,7 +3135,6 @@ orc_matrix2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_matrix2_u8"); @@ -2837,7 +3166,7 @@ orc_matrix2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -2861,8 +3190,8 @@ orc_matrix2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, /* orc_matrix2_11_u8 */ #ifdef DISABLE_ORC void -orc_matrix2_11_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, - int p2, int n) +orc_matrix2_11_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int p1, int p2, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -2893,15 +3222,15 @@ orc_matrix2_11_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, ptr5 = (orc_int8 *) s2; /* 2: loadpw */ - var37.i = 0x00000010; /* 16 or 7.90505e-323f */ + var37.i = (int) 0x00000010; /* 16 or 7.90505e-323f */ /* 4: loadpw */ var38.i = p1; /* 8: loadpw */ - var40.i = 0x00000080; /* 128 or 6.32404e-322f */ + var40.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 10: loadpw */ var41.i = p2; /* 13: loadpw */ - var42.i = 0x00000080; /* 128 or 6.32404e-322f */ + var42.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -2940,7 +3269,7 @@ orc_matrix2_11_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, #else static void -_backup_orc_matrix2_11_u8 (OrcExecutor * ex) +_backup_orc_matrix2_11_u8 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -2972,15 +3301,15 @@ _backup_orc_matrix2_11_u8 (OrcExecutor * ex) ptr5 = (orc_int8 *) ex->arrays[5]; /* 2: loadpw */ - var37.i = 0x00000010; /* 16 or 7.90505e-323f */ + var37.i = (int) 0x00000010; /* 16 or 7.90505e-323f */ /* 4: loadpw */ var38.i = ex->params[24]; /* 8: loadpw */ - var40.i = 0x00000080; /* 128 or 6.32404e-322f */ + var40.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 10: loadpw */ var41.i = ex->params[25]; /* 13: loadpw */ - var42.i = 0x00000080; /* 128 or 6.32404e-322f */ + var42.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -3018,8 +3347,8 @@ _backup_orc_matrix2_11_u8 (OrcExecutor * ex) } void -orc_matrix2_11_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, - int p2, int n) +orc_matrix2_11_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int p1, int p2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -3029,7 +3358,6 @@ orc_matrix2_11_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_matrix2_11_u8"); @@ -3072,7 +3400,7 @@ orc_matrix2_11_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -3095,8 +3423,8 @@ orc_matrix2_11_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, /* orc_matrix2_12_u8 */ #ifdef DISABLE_ORC void -orc_matrix2_12_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, - int p2, int n) +orc_matrix2_12_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int p1, int p2, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -3128,15 +3456,15 @@ orc_matrix2_12_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, ptr5 = (orc_int8 *) s2; /* 2: loadpw */ - var37.i = 0x00000010; /* 16 or 7.90505e-323f */ + var37.i = (int) 0x00000010; /* 16 or 7.90505e-323f */ /* 4: loadpw */ var38.i = p1; /* 8: loadpw */ - var40.i = 0x00000080; /* 128 or 6.32404e-322f */ + var40.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 10: loadpw */ var41.i = p2; /* 13: loadpw */ - var42.i = 0x00000080; /* 128 or 6.32404e-322f */ + var42.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -3177,7 +3505,7 @@ orc_matrix2_12_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, #else static void -_backup_orc_matrix2_12_u8 (OrcExecutor * ex) +_backup_orc_matrix2_12_u8 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -3210,15 +3538,15 @@ _backup_orc_matrix2_12_u8 (OrcExecutor * ex) ptr5 = (orc_int8 *) ex->arrays[5]; /* 2: loadpw */ - var37.i = 0x00000010; /* 16 or 7.90505e-323f */ + var37.i = (int) 0x00000010; /* 16 or 7.90505e-323f */ /* 4: loadpw */ var38.i = ex->params[24]; /* 8: loadpw */ - var40.i = 0x00000080; /* 128 or 6.32404e-322f */ + var40.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 10: loadpw */ var41.i = ex->params[25]; /* 13: loadpw */ - var42.i = 0x00000080; /* 128 or 6.32404e-322f */ + var42.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -3258,8 +3586,8 @@ _backup_orc_matrix2_12_u8 (OrcExecutor * ex) } void -orc_matrix2_12_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, - int p2, int n) +orc_matrix2_12_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int p1, int p2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -3269,7 +3597,6 @@ orc_matrix2_12_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_matrix2_12_u8"); @@ -3314,7 +3641,7 @@ orc_matrix2_12_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -3337,8 +3664,9 @@ orc_matrix2_12_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, /* orc_matrix3_u8 */ #ifdef DISABLE_ORC void -orc_matrix3_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int p4, int n) +orc_matrix3_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, + int p2, int p3, int p4, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -3415,7 +3743,7 @@ orc_matrix3_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_orc_matrix3_u8 (OrcExecutor * ex) +_backup_orc_matrix3_u8 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -3492,8 +3820,9 @@ _backup_orc_matrix3_u8 (OrcExecutor * ex) } void -orc_matrix3_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int p4, int n) +orc_matrix3_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, + int p2, int p3, int p4, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -3503,7 +3832,6 @@ orc_matrix3_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_matrix3_u8"); @@ -3543,7 +3871,7 @@ orc_matrix3_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -3569,8 +3897,9 @@ orc_matrix3_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, /* orc_matrix3_100_u8 */ #ifdef DISABLE_ORC void -orc_matrix3_100_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int n) +orc_matrix3_100_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, + int p2, int p3, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -3609,19 +3938,19 @@ orc_matrix3_100_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, ptr6 = (orc_int8 *) s3; /* 2: loadpw */ - var36.i = 0x00000010; /* 16 or 7.90505e-323f */ + var36.i = (int) 0x00000010; /* 16 or 7.90505e-323f */ /* 4: loadpw */ var37.i = p1; /* 8: loadpw */ - var39.i = 0x00000080; /* 128 or 6.32404e-322f */ + var39.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 10: loadpw */ var40.i = p2; /* 15: loadpw */ - var42.i = 0x00000080; /* 128 or 6.32404e-322f */ + var42.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 17: loadpw */ var43.i = p3; /* 20: loadpw */ - var44.i = 0x00000080; /* 128 or 6.32404e-322f */ + var44.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -3668,7 +3997,7 @@ orc_matrix3_100_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_orc_matrix3_100_u8 (OrcExecutor * ex) +_backup_orc_matrix3_100_u8 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -3708,19 +4037,19 @@ _backup_orc_matrix3_100_u8 (OrcExecutor * ex) ptr6 = (orc_int8 *) ex->arrays[6]; /* 2: loadpw */ - var36.i = 0x00000010; /* 16 or 7.90505e-323f */ + var36.i = (int) 0x00000010; /* 16 or 7.90505e-323f */ /* 4: loadpw */ var37.i = ex->params[24]; /* 8: loadpw */ - var39.i = 0x00000080; /* 128 or 6.32404e-322f */ + var39.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 10: loadpw */ var40.i = ex->params[25]; /* 15: loadpw */ - var42.i = 0x00000080; /* 128 or 6.32404e-322f */ + var42.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 17: loadpw */ var43.i = ex->params[26]; /* 20: loadpw */ - var44.i = 0x00000080; /* 128 or 6.32404e-322f */ + var44.i = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -3766,8 +4095,9 @@ _backup_orc_matrix3_100_u8 (OrcExecutor * ex) } void -orc_matrix3_100_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int n) +orc_matrix3_100_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, + int p2, int p3, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -3777,7 +4107,6 @@ orc_matrix3_100_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_matrix3_100_u8"); @@ -3827,7 +4156,7 @@ orc_matrix3_100_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -3852,8 +4181,10 @@ orc_matrix3_100_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, /* orc_matrix3_100_offset_u8 */ #ifdef DISABLE_ORC void -orc_matrix3_100_offset_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int p4, int p5, int n) +orc_matrix3_100_offset_u8 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, + int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -3933,7 +4264,7 @@ orc_matrix3_100_offset_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_orc_matrix3_100_offset_u8 (OrcExecutor * ex) +_backup_orc_matrix3_100_offset_u8 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -4013,8 +4344,10 @@ _backup_orc_matrix3_100_offset_u8 (OrcExecutor * ex) } void -orc_matrix3_100_offset_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int p4, int p5, int n) +orc_matrix3_100_offset_u8 (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -4024,7 +4357,6 @@ orc_matrix3_100_offset_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_matrix3_100_offset_u8"); @@ -4067,7 +4399,7 @@ orc_matrix3_100_offset_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -4094,8 +4426,9 @@ orc_matrix3_100_offset_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, /* orc_matrix3_000_u8 */ #ifdef DISABLE_ORC void -orc_matrix3_000_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int p4, int p5, int n) +orc_matrix3_000_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, + int p2, int p3, int p4, int p5, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -4172,7 +4505,7 @@ orc_matrix3_000_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_orc_matrix3_000_u8 (OrcExecutor * ex) +_backup_orc_matrix3_000_u8 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -4249,8 +4582,9 @@ _backup_orc_matrix3_000_u8 (OrcExecutor * ex) } void -orc_matrix3_000_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int p2, int p3, int p4, int p5, int n) +orc_matrix3_000_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, + int p2, int p3, int p4, int p5, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -4260,7 +4594,6 @@ orc_matrix3_000_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_matrix3_000_u8"); @@ -4300,7 +4633,7 @@ orc_matrix3_000_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "convwb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -4327,8 +4660,9 @@ orc_matrix3_000_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, /* orc_pack_123x */ #ifdef DISABLE_ORC void -orc_pack_123x (guint32 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int n) +orc_pack_123x (guint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, + int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -4357,14 +4691,28 @@ orc_pack_123x (guint32 * d1, const guint8 * s1, const guint8 * s2, /* 1: loadb */ var35 = ptr5[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var34; + _dest.x2[1] = var35; + var39.i = _dest.i; + } /* 3: loadb */ var36 = ptr6[i]; /* 5: mergebw */ - var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var40.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var40.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var39.i; + _dest.x2[1] = var40.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -4373,7 +4721,7 @@ orc_pack_123x (guint32 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_orc_pack_123x (OrcExecutor * ex) +_backup_orc_pack_123x (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -4403,14 +4751,28 @@ _backup_orc_pack_123x (OrcExecutor * ex) /* 1: loadb */ var35 = ptr5[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var34; + _dest.x2[1] = var35; + var39.i = _dest.i; + } /* 3: loadb */ var36 = ptr6[i]; /* 5: mergebw */ - var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var40.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var40.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var39.i; + _dest.x2[1] = var40.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -4418,8 +4780,9 @@ _backup_orc_pack_123x (OrcExecutor * ex) } void -orc_pack_123x (guint32 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int n) +orc_pack_123x (guint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -4429,7 +4792,6 @@ orc_pack_123x (guint32 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_pack_123x"); @@ -4449,7 +4811,7 @@ orc_pack_123x (guint32 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -4472,8 +4834,9 @@ orc_pack_123x (guint32 * d1, const guint8 * s1, const guint8 * s2, /* orc_pack_x123 */ #ifdef DISABLE_ORC void -orc_pack_x123 (guint32 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int n) +orc_pack_x123 (guint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, + int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -4500,16 +4863,30 @@ orc_pack_x123 (guint32 * d1, const guint8 * s1, const guint8 * s2, /* 1: loadb */ var35 = ptr4[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var34; + _dest.x2[1] = var35; + var39.i = _dest.i; + } /* 3: loadb */ var36 = ptr5[i]; /* 4: loadb */ var37 = ptr6[i]; /* 5: mergebw */ - var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var40.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var40.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var39.i; + _dest.x2[1] = var40.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -4518,7 +4895,7 @@ orc_pack_x123 (guint32 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_orc_pack_x123 (OrcExecutor * ex) +_backup_orc_pack_x123 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -4546,16 +4923,30 @@ _backup_orc_pack_x123 (OrcExecutor * ex) /* 1: loadb */ var35 = ptr4[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var34; + _dest.x2[1] = var35; + var39.i = _dest.i; + } /* 3: loadb */ var36 = ptr5[i]; /* 4: loadb */ var37 = ptr6[i]; /* 5: mergebw */ - var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var40.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var40.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var39.i; + _dest.x2[1] = var40.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -4563,8 +4954,9 @@ _backup_orc_pack_x123 (OrcExecutor * ex) } void -orc_pack_x123 (guint32 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int p1, int n) +orc_pack_x123 (guint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -4574,7 +4966,6 @@ orc_pack_x123 (guint32 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_pack_x123"); @@ -4594,7 +4985,7 @@ orc_pack_x123 (guint32 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -4617,8 +5008,8 @@ orc_pack_x123 (guint32 * d1, const guint8 * s1, const guint8 * s2, /* cogorc_combine2_u8 */ #ifdef DISABLE_ORC void -cogorc_combine2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, - int p2, int n) +cogorc_combine2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int p1, int p2, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -4672,7 +5063,7 @@ cogorc_combine2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, #else static void -_backup_cogorc_combine2_u8 (OrcExecutor * ex) +_backup_cogorc_combine2_u8 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -4726,8 +5117,8 @@ _backup_cogorc_combine2_u8 (OrcExecutor * ex) } void -cogorc_combine2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, - int p2, int n) +cogorc_combine2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int p1, int p2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -4737,7 +5128,6 @@ cogorc_combine2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_combine2_u8"); @@ -4766,7 +5156,7 @@ cogorc_combine2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, orc_program_append_2 (p, "convsuswb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -4789,8 +5179,9 @@ cogorc_combine2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, /* cogorc_convert_I420_UYVY */ #ifdef DISABLE_ORC void -cogorc_convert_I420_UYVY (guint8 * d1, guint8 * d2, const guint8 * s1, - const guint8 * s2, const guint8 * s3, const guint8 * s4, int n) +cogorc_convert_I420_UYVY (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -4821,23 +5212,44 @@ cogorc_convert_I420_UYVY (guint8 * d1, guint8 * d2, const guint8 * s1, /* 1: loadb */ var34 = ptr7[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var39.i = _dest.i; + } /* 3: loadw */ var35 = ptr4[i]; /* 4: mergebw */ - var36.x2[0] = - ((orc_uint8) var39.x2[0] & 0x00ff) | ((orc_uint8) var35.x2[0] << 8); - var36.x2[1] = - ((orc_uint8) var39.x2[1] & 0x00ff) | ((orc_uint8) var35.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39.x2[0]; + _dest.x2[1] = var35.x2[0]; + var36.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var39.x2[1]; + _dest.x2[1] = var35.x2[1]; + var36.x2[1] = _dest.i; + } /* 5: storel */ ptr0[i] = var36; /* 6: loadw */ var37 = ptr5[i]; /* 7: mergebw */ - var38.x2[0] = - ((orc_uint8) var39.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var39.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39.x2[0]; + _dest.x2[1] = var37.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var39.x2[1]; + _dest.x2[1] = var37.x2[1]; + var38.x2[1] = _dest.i; + } /* 8: storel */ ptr1[i] = var38; } @@ -4846,7 +5258,7 @@ cogorc_convert_I420_UYVY (guint8 * d1, guint8 * d2, const guint8 * s1, #else static void -_backup_cogorc_convert_I420_UYVY (OrcExecutor * ex) +_backup_cogorc_convert_I420_UYVY (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -4878,23 +5290,44 @@ _backup_cogorc_convert_I420_UYVY (OrcExecutor * ex) /* 1: loadb */ var34 = ptr7[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var39.i = _dest.i; + } /* 3: loadw */ var35 = ptr4[i]; /* 4: mergebw */ - var36.x2[0] = - ((orc_uint8) var39.x2[0] & 0x00ff) | ((orc_uint8) var35.x2[0] << 8); - var36.x2[1] = - ((orc_uint8) var39.x2[1] & 0x00ff) | ((orc_uint8) var35.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39.x2[0]; + _dest.x2[1] = var35.x2[0]; + var36.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var39.x2[1]; + _dest.x2[1] = var35.x2[1]; + var36.x2[1] = _dest.i; + } /* 5: storel */ ptr0[i] = var36; /* 6: loadw */ var37 = ptr5[i]; /* 7: mergebw */ - var38.x2[0] = - ((orc_uint8) var39.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var39.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39.x2[0]; + _dest.x2[1] = var37.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var39.x2[1]; + _dest.x2[1] = var37.x2[1]; + var38.x2[1] = _dest.i; + } /* 8: storel */ ptr1[i] = var38; } @@ -4902,8 +5335,9 @@ _backup_cogorc_convert_I420_UYVY (OrcExecutor * ex) } void -cogorc_convert_I420_UYVY (guint8 * d1, guint8 * d2, const guint8 * s1, - const guint8 * s2, const guint8 * s3, const guint8 * s4, int n) +cogorc_convert_I420_UYVY (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -4913,7 +5347,6 @@ cogorc_convert_I420_UYVY (guint8 * d1, guint8 * d2, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_convert_I420_UYVY"); @@ -4933,7 +5366,7 @@ cogorc_convert_I420_UYVY (guint8 * d1, guint8 * d2, const guint8 * s1, orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D2, ORC_VAR_T1, ORC_VAR_S2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -4957,8 +5390,9 @@ cogorc_convert_I420_UYVY (guint8 * d1, guint8 * d2, const guint8 * s1, /* cogorc_convert_I420_YUY2 */ #ifdef DISABLE_ORC void -cogorc_convert_I420_YUY2 (guint8 * d1, guint8 * d2, const guint8 * s1, - const guint8 * s2, const guint8 * s3, const guint8 * s4, int n) +cogorc_convert_I420_YUY2 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -4989,23 +5423,44 @@ cogorc_convert_I420_YUY2 (guint8 * d1, guint8 * d2, const guint8 * s1, /* 1: loadb */ var34 = ptr7[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var39.i = _dest.i; + } /* 3: loadw */ var35 = ptr4[i]; /* 4: mergebw */ - var36.x2[0] = - ((orc_uint8) var35.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var36.x2[1] = - ((orc_uint8) var35.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var35.x2[0]; + _dest.x2[1] = var39.x2[0]; + var36.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var35.x2[1]; + _dest.x2[1] = var39.x2[1]; + var36.x2[1] = _dest.i; + } /* 5: storel */ ptr0[i] = var36; /* 6: loadw */ var37 = ptr5[i]; /* 7: mergebw */ - var38.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var39.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var39.x2[1]; + var38.x2[1] = _dest.i; + } /* 8: storel */ ptr1[i] = var38; } @@ -5014,7 +5469,7 @@ cogorc_convert_I420_YUY2 (guint8 * d1, guint8 * d2, const guint8 * s1, #else static void -_backup_cogorc_convert_I420_YUY2 (OrcExecutor * ex) +_backup_cogorc_convert_I420_YUY2 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -5046,23 +5501,44 @@ _backup_cogorc_convert_I420_YUY2 (OrcExecutor * ex) /* 1: loadb */ var34 = ptr7[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var39.i = _dest.i; + } /* 3: loadw */ var35 = ptr4[i]; /* 4: mergebw */ - var36.x2[0] = - ((orc_uint8) var35.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var36.x2[1] = - ((orc_uint8) var35.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var35.x2[0]; + _dest.x2[1] = var39.x2[0]; + var36.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var35.x2[1]; + _dest.x2[1] = var39.x2[1]; + var36.x2[1] = _dest.i; + } /* 5: storel */ ptr0[i] = var36; /* 6: loadw */ var37 = ptr5[i]; /* 7: mergebw */ - var38.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var39.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var39.x2[1]; + var38.x2[1] = _dest.i; + } /* 8: storel */ ptr1[i] = var38; } @@ -5070,8 +5546,9 @@ _backup_cogorc_convert_I420_YUY2 (OrcExecutor * ex) } void -cogorc_convert_I420_YUY2 (guint8 * d1, guint8 * d2, const guint8 * s1, - const guint8 * s2, const guint8 * s3, const guint8 * s4, int n) +cogorc_convert_I420_YUY2 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -5081,7 +5558,6 @@ cogorc_convert_I420_YUY2 (guint8 * d1, guint8 * d2, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_convert_I420_YUY2"); @@ -5101,7 +5577,7 @@ cogorc_convert_I420_YUY2 (guint8 * d1, guint8 * d2, const guint8 * s1, orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D2, ORC_VAR_S2, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -5125,8 +5601,9 @@ cogorc_convert_I420_YUY2 (guint8 * d1, guint8 * d2, const guint8 * s1, /* cogorc_convert_I420_AYUV */ #ifdef DISABLE_ORC void -cogorc_convert_I420_AYUV (guint8 * d1, guint8 * d2, const guint8 * s1, - const guint8 * s2, const guint8 * s3, const guint8 * s4, int n) +cogorc_convert_I420_AYUV (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -5155,9 +5632,9 @@ cogorc_convert_I420_AYUV (guint8 * d1, guint8 * d2, const guint8 * s1, ptr7 = (orc_int8 *) s4; /* 3: loadpb */ - var36 = 0x000000ff; /* 255 or 1.25987e-321f */ + var36 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ /* 8: loadpb */ - var39 = 0x000000ff; /* 255 or 1.25987e-321f */ + var39 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadupdb */ @@ -5165,23 +5642,46 @@ cogorc_convert_I420_AYUV (guint8 * d1, guint8 * d2, const guint8 * s1, /* 1: loadupdb */ var43 = ptr7[i >> 1]; /* 2: mergebw */ - var44.i = ((orc_uint8) var42 & 0x00ff) | ((orc_uint8) var43 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var42; + _dest.x2[1] = var43; + var44.i = _dest.i; + } /* 4: loadb */ var37 = ptr4[i]; /* 5: mergebw */ - var45.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var45.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var45.i & 0x0000ffff) | ((orc_uint16) var44.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var45.i; + _dest.x2[1] = var44.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; /* 9: loadb */ var40 = ptr5[i]; /* 10: mergebw */ - var46.i = ((orc_uint8) var39 & 0x00ff) | ((orc_uint8) var40 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39; + _dest.x2[1] = var40; + var46.i = _dest.i; + } /* 11: mergewl */ - var41.i = - ((orc_uint16) var46.i & 0x0000ffff) | ((orc_uint16) var44.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var46.i; + _dest.x2[1] = var44.i; + var41.i = _dest.i; + } /* 12: storel */ ptr1[i] = var41; } @@ -5190,7 +5690,7 @@ cogorc_convert_I420_AYUV (guint8 * d1, guint8 * d2, const guint8 * s1, #else static void -_backup_cogorc_convert_I420_AYUV (OrcExecutor * ex) +_backup_cogorc_convert_I420_AYUV (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -5220,9 +5720,9 @@ _backup_cogorc_convert_I420_AYUV (OrcExecutor * ex) ptr7 = (orc_int8 *) ex->arrays[7]; /* 3: loadpb */ - var36 = 0x000000ff; /* 255 or 1.25987e-321f */ + var36 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ /* 8: loadpb */ - var39 = 0x000000ff; /* 255 or 1.25987e-321f */ + var39 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadupdb */ @@ -5230,23 +5730,46 @@ _backup_cogorc_convert_I420_AYUV (OrcExecutor * ex) /* 1: loadupdb */ var43 = ptr7[i >> 1]; /* 2: mergebw */ - var44.i = ((orc_uint8) var42 & 0x00ff) | ((orc_uint8) var43 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var42; + _dest.x2[1] = var43; + var44.i = _dest.i; + } /* 4: loadb */ var37 = ptr4[i]; /* 5: mergebw */ - var45.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var45.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var45.i & 0x0000ffff) | ((orc_uint16) var44.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var45.i; + _dest.x2[1] = var44.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; /* 9: loadb */ var40 = ptr5[i]; /* 10: mergebw */ - var46.i = ((orc_uint8) var39 & 0x00ff) | ((orc_uint8) var40 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39; + _dest.x2[1] = var40; + var46.i = _dest.i; + } /* 11: mergewl */ - var41.i = - ((orc_uint16) var46.i & 0x0000ffff) | ((orc_uint16) var44.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var46.i; + _dest.x2[1] = var44.i; + var41.i = _dest.i; + } /* 12: storel */ ptr1[i] = var41; } @@ -5254,8 +5777,9 @@ _backup_cogorc_convert_I420_AYUV (OrcExecutor * ex) } void -cogorc_convert_I420_AYUV (guint8 * d1, guint8 * d2, const guint8 * s1, - const guint8 * s2, const guint8 * s3, const guint8 * s4, int n) +cogorc_convert_I420_AYUV (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -5265,7 +5789,6 @@ cogorc_convert_I420_AYUV (guint8 * d1, guint8 * d2, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_convert_I420_AYUV"); @@ -5297,7 +5820,7 @@ cogorc_convert_I420_AYUV (guint8 * d1, guint8 * d2, const guint8 * s1, orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D2, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -5321,8 +5844,9 @@ cogorc_convert_I420_AYUV (guint8 * d1, guint8 * d2, const guint8 * s1, /* cogorc_convert_YUY2_I420 */ #ifdef DISABLE_ORC void -cogorc_convert_YUY2_I420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, - const guint8 * s1, const guint8 * s2, int n) +cogorc_convert_YUY2_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) { int i; orc_union16 *ORC_RESTRICT ptr0; @@ -5353,27 +5877,47 @@ cogorc_convert_YUY2_I420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, /* 0: loadl */ var35 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var35.x2[0] >> 8) & 0xff; - var40.x2[0] = var35.x2[0] & 0xff; - var39.x2[1] = (var35.x2[1] >> 8) & 0xff; - var40.x2[1] = var35.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var35.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var35.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var40; /* 3: loadl */ var36 = ptr5[i]; /* 4: splitwb */ - var41.x2[0] = (var36.x2[0] >> 8) & 0xff; - var42.x2[0] = var36.x2[0] & 0xff; - var41.x2[1] = (var36.x2[1] >> 8) & 0xff; - var42.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var41.x2[0] = _src.x2[1]; + var42.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var41.x2[1] = _src.x2[1]; + var42.x2[1] = _src.x2[0]; + } /* 5: storew */ ptr1[i] = var42; /* 6: avgub */ var43.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var41.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var41.x2[1] + 1) >> 1; /* 7: splitwb */ - var37 = (var43.i >> 8) & 0xff; - var38 = var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var37 = _src.x2[1]; + var38 = _src.x2[0]; + } /* 8: storeb */ ptr3[i] = var37; /* 9: storeb */ @@ -5384,7 +5928,7 @@ cogorc_convert_YUY2_I420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, #else static void -_backup_cogorc_convert_YUY2_I420 (OrcExecutor * ex) +_backup_cogorc_convert_YUY2_I420 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -5416,27 +5960,47 @@ _backup_cogorc_convert_YUY2_I420 (OrcExecutor * ex) /* 0: loadl */ var35 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var35.x2[0] >> 8) & 0xff; - var40.x2[0] = var35.x2[0] & 0xff; - var39.x2[1] = (var35.x2[1] >> 8) & 0xff; - var40.x2[1] = var35.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var35.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var35.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var40; /* 3: loadl */ var36 = ptr5[i]; /* 4: splitwb */ - var41.x2[0] = (var36.x2[0] >> 8) & 0xff; - var42.x2[0] = var36.x2[0] & 0xff; - var41.x2[1] = (var36.x2[1] >> 8) & 0xff; - var42.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var41.x2[0] = _src.x2[1]; + var42.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var41.x2[1] = _src.x2[1]; + var42.x2[1] = _src.x2[0]; + } /* 5: storew */ ptr1[i] = var42; /* 6: avgub */ var43.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var41.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var41.x2[1] + 1) >> 1; /* 7: splitwb */ - var37 = (var43.i >> 8) & 0xff; - var38 = var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var37 = _src.x2[1]; + var38 = _src.x2[0]; + } /* 8: storeb */ ptr3[i] = var37; /* 9: storeb */ @@ -5446,8 +6010,9 @@ _backup_cogorc_convert_YUY2_I420 (OrcExecutor * ex) } void -cogorc_convert_YUY2_I420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, - const guint8 * s1, const guint8 * s2, int n) +cogorc_convert_YUY2_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -5457,7 +6022,6 @@ cogorc_convert_YUY2_I420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_convert_YUY2_I420"); @@ -5485,7 +6049,7 @@ cogorc_convert_YUY2_I420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D4, ORC_VAR_D3, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -5509,8 +6073,8 @@ cogorc_convert_YUY2_I420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, /* cogorc_convert_UYVY_YUY2 */ #ifdef DISABLE_ORC void -cogorc_convert_UYVY_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_convert_UYVY_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -5539,7 +6103,7 @@ cogorc_convert_UYVY_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, #else static void -_backup_cogorc_convert_UYVY_YUY2 (OrcExecutor * ex) +_backup_cogorc_convert_UYVY_YUY2 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -5569,8 +6133,8 @@ _backup_cogorc_convert_UYVY_YUY2 (OrcExecutor * ex) } void -cogorc_convert_UYVY_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_convert_UYVY_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -5580,7 +6144,6 @@ cogorc_convert_UYVY_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -5592,7 +6155,7 @@ cogorc_convert_UYVY_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, orc_program_append_2 (p, "swapw", 1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -5615,8 +6178,9 @@ cogorc_convert_UYVY_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, /* cogorc_planar_chroma_420_422 */ #ifdef DISABLE_ORC void -cogorc_planar_chroma_420_422 (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, const guint8 * s1, int s1_stride, int n, int m) +cogorc_planar_chroma_420_422 (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, + int s1_stride, int n, int m) { int i; int j; @@ -5654,7 +6218,7 @@ cogorc_planar_chroma_420_422 (guint8 * d1, int d1_stride, guint8 * d2, #else static void -_backup_cogorc_planar_chroma_420_422 (OrcExecutor * ex) +_backup_cogorc_planar_chroma_420_422 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -5693,8 +6257,9 @@ _backup_cogorc_planar_chroma_420_422 (OrcExecutor * ex) } void -cogorc_planar_chroma_420_422 (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, const guint8 * s1, int s1_stride, int n, int m) +cogorc_planar_chroma_420_422 (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, + int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -5704,7 +6269,6 @@ cogorc_planar_chroma_420_422 (guint8 * d1, int d1_stride, guint8 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -5719,7 +6283,7 @@ cogorc_planar_chroma_420_422 (guint8 * d1, int d1_stride, guint8 * d2, orc_program_append_2 (p, "copyb", 0, ORC_VAR_D2, ORC_VAR_S1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -5744,8 +6308,9 @@ cogorc_planar_chroma_420_422 (guint8 * d1, int d1_stride, guint8 * d2, /* cogorc_planar_chroma_420_444 */ #ifdef DISABLE_ORC void -cogorc_planar_chroma_420_444 (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, const guint8 * s1, int s1_stride, int n, int m) +cogorc_planar_chroma_420_444 (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, + int s1_stride, int n, int m) { int i; int j; @@ -5777,7 +6342,7 @@ cogorc_planar_chroma_420_444 (guint8 * d1, int d1_stride, guint8 * d2, #else static void -_backup_cogorc_planar_chroma_420_444 (OrcExecutor * ex) +_backup_cogorc_planar_chroma_420_444 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -5810,8 +6375,9 @@ _backup_cogorc_planar_chroma_420_444 (OrcExecutor * ex) } void -cogorc_planar_chroma_420_444 (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, const guint8 * s1, int s1_stride, int n, int m) +cogorc_planar_chroma_420_444 (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, + int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -5821,7 +6387,6 @@ cogorc_planar_chroma_420_444 (guint8 * d1, int d1_stride, guint8 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -5839,7 +6404,7 @@ cogorc_planar_chroma_420_444 (guint8 * d1, int d1_stride, guint8 * d2, orc_program_append_2 (p, "storew", 0, ORC_VAR_D2, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -5864,8 +6429,8 @@ cogorc_planar_chroma_420_444 (guint8 * d1, int d1_stride, guint8 * d2, /* cogorc_planar_chroma_422_444 */ #ifdef DISABLE_ORC void -cogorc_planar_chroma_422_444 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_planar_chroma_422_444 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -5893,7 +6458,7 @@ cogorc_planar_chroma_422_444 (guint8 * d1, int d1_stride, const guint8 * s1, #else static void -_backup_cogorc_planar_chroma_422_444 (OrcExecutor * ex) +_backup_cogorc_planar_chroma_422_444 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -5922,8 +6487,8 @@ _backup_cogorc_planar_chroma_422_444 (OrcExecutor * ex) } void -cogorc_planar_chroma_422_444 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_planar_chroma_422_444 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -5933,7 +6498,6 @@ cogorc_planar_chroma_422_444 (guint8 * d1, int d1_stride, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -5948,7 +6512,7 @@ cogorc_planar_chroma_422_444 (guint8 * d1, int d1_stride, const guint8 * s1, orc_program_append_2 (p, "storew", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -5971,8 +6535,8 @@ cogorc_planar_chroma_422_444 (guint8 * d1, int d1_stride, const guint8 * s1, /* cogorc_planar_chroma_444_422 */ #ifdef DISABLE_ORC void -cogorc_planar_chroma_444_422 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_planar_chroma_444_422 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -5992,8 +6556,12 @@ cogorc_planar_chroma_444_422 (guint8 * d1, int d1_stride, const guint8 * s1, /* 0: loadw */ var34 = ptr4[i]; /* 1: splitwb */ - var36 = (var34.i >> 8) & 0xff; - var37 = var34.i & 0xff; + { + orc_union16 _src; + _src.i = var34.i; + var36 = _src.x2[1]; + var37 = _src.x2[0]; + } /* 2: avgub */ var35 = ((orc_uint8) var36 + (orc_uint8) var37 + 1) >> 1; /* 3: storeb */ @@ -6005,7 +6573,7 @@ cogorc_planar_chroma_444_422 (guint8 * d1, int d1_stride, const guint8 * s1, #else static void -_backup_cogorc_planar_chroma_444_422 (OrcExecutor * ex) +_backup_cogorc_planar_chroma_444_422 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -6027,8 +6595,12 @@ _backup_cogorc_planar_chroma_444_422 (OrcExecutor * ex) /* 0: loadw */ var34 = ptr4[i]; /* 1: splitwb */ - var36 = (var34.i >> 8) & 0xff; - var37 = var34.i & 0xff; + { + orc_union16 _src; + _src.i = var34.i; + var36 = _src.x2[1]; + var37 = _src.x2[0]; + } /* 2: avgub */ var35 = ((orc_uint8) var36 + (orc_uint8) var37 + 1) >> 1; /* 3: storeb */ @@ -6039,8 +6611,8 @@ _backup_cogorc_planar_chroma_444_422 (OrcExecutor * ex) } void -cogorc_planar_chroma_444_422 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_planar_chroma_444_422 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -6050,7 +6622,6 @@ cogorc_planar_chroma_444_422 (guint8 * d1, int d1_stride, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -6066,7 +6637,7 @@ cogorc_planar_chroma_444_422 (guint8 * d1, int d1_stride, const guint8 * s1, orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -6089,8 +6660,9 @@ cogorc_planar_chroma_444_422 (guint8 * d1, int d1_stride, const guint8 * s1, /* cogorc_planar_chroma_444_420 */ #ifdef DISABLE_ORC void -cogorc_planar_chroma_444_420 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, int n, int m) +cogorc_planar_chroma_444_420 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m) { int i; int j; @@ -6121,8 +6693,12 @@ cogorc_planar_chroma_444_420 (guint8 * d1, int d1_stride, const guint8 * s1, var38.x2[1] = ((orc_uint8) var35.x2[1] + (orc_uint8) var36.x2[1] + 1) >> 1; /* 3: splitwb */ - var39 = (var38.i >> 8) & 0xff; - var40 = var38.i & 0xff; + { + orc_union16 _src; + _src.i = var38.i; + var39 = _src.x2[1]; + var40 = _src.x2[0]; + } /* 4: avgub */ var37 = ((orc_uint8) var39 + (orc_uint8) var40 + 1) >> 1; /* 5: storeb */ @@ -6134,7 +6710,7 @@ cogorc_planar_chroma_444_420 (guint8 * d1, int d1_stride, const guint8 * s1, #else static void -_backup_cogorc_planar_chroma_444_420 (OrcExecutor * ex) +_backup_cogorc_planar_chroma_444_420 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -6167,8 +6743,12 @@ _backup_cogorc_planar_chroma_444_420 (OrcExecutor * ex) var38.x2[1] = ((orc_uint8) var35.x2[1] + (orc_uint8) var36.x2[1] + 1) >> 1; /* 3: splitwb */ - var39 = (var38.i >> 8) & 0xff; - var40 = var38.i & 0xff; + { + orc_union16 _src; + _src.i = var38.i; + var39 = _src.x2[1]; + var40 = _src.x2[0]; + } /* 4: avgub */ var37 = ((orc_uint8) var39 + (orc_uint8) var40 + 1) >> 1; /* 5: storeb */ @@ -6179,8 +6759,9 @@ _backup_cogorc_planar_chroma_444_420 (OrcExecutor * ex) } void -cogorc_planar_chroma_444_420 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, int n, int m) +cogorc_planar_chroma_444_420 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -6190,7 +6771,6 @@ cogorc_planar_chroma_444_420 (guint8 * d1, int d1_stride, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -6210,7 +6790,7 @@ cogorc_planar_chroma_444_420 (guint8 * d1, int d1_stride, const guint8 * s1, orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -6235,8 +6815,9 @@ cogorc_planar_chroma_444_420 (guint8 * d1, int d1_stride, const guint8 * s1, /* cogorc_planar_chroma_422_420 */ #ifdef DISABLE_ORC void -cogorc_planar_chroma_422_420 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, int n, int m) +cogorc_planar_chroma_422_420 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m) { int i; int j; @@ -6269,7 +6850,7 @@ cogorc_planar_chroma_422_420 (guint8 * d1, int d1_stride, const guint8 * s1, #else static void -_backup_cogorc_planar_chroma_422_420 (OrcExecutor * ex) +_backup_cogorc_planar_chroma_422_420 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -6303,8 +6884,9 @@ _backup_cogorc_planar_chroma_422_420 (OrcExecutor * ex) } void -cogorc_planar_chroma_422_420 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, int n, int m) +cogorc_planar_chroma_422_420 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -6314,7 +6896,6 @@ cogorc_planar_chroma_422_420 (guint8 * d1, int d1_stride, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -6327,7 +6908,7 @@ cogorc_planar_chroma_422_420 (guint8 * d1, int d1_stride, const guint8 * s1, orc_program_append_2 (p, "avgub", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_S2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -6352,8 +6933,8 @@ cogorc_planar_chroma_422_420 (guint8 * d1, int d1_stride, const guint8 * s1, /* cogorc_convert_YUY2_AYUV */ #ifdef DISABLE_ORC void -cogorc_convert_YUY2_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_convert_YUY2_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -6372,32 +6953,58 @@ cogorc_convert_YUY2_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); /* 2: loadpb */ - var37.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var37.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadl */ var36 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var36.x2[0] >> 8) & 0xff; - var40.x2[0] = var36.x2[0] & 0xff; - var39.x2[1] = (var36.x2[1] >> 8) & 0xff; - var40.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 3: mergebw */ - var41.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var40.x2[0] << 8); - var41.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var40.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var40.x2[0]; + var41.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var40.x2[1]; + var41.x2[1] = _dest.i; + } /* 4: mergewl */ - var42.i = - ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var39.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var39.i; + _dest.x2[1] = var39.i; + var42.i = _dest.i; + } /* 5: mergewl */ - var38.x2[0] = - ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var42. - x2[0] << 16); - var38.x2[1] = - ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var42. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[0]; + _dest.x2[1] = var42.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[1]; + _dest.x2[1] = var42.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storeq */ ptr0[i] = var38; } @@ -6407,7 +7014,7 @@ cogorc_convert_YUY2_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, #else static void -_backup_cogorc_convert_YUY2_AYUV (OrcExecutor * ex) +_backup_cogorc_convert_YUY2_AYUV (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -6428,32 +7035,58 @@ _backup_cogorc_convert_YUY2_AYUV (OrcExecutor * ex) ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); /* 2: loadpb */ - var37.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var37.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadl */ var36 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var36.x2[0] >> 8) & 0xff; - var40.x2[0] = var36.x2[0] & 0xff; - var39.x2[1] = (var36.x2[1] >> 8) & 0xff; - var40.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 3: mergebw */ - var41.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var40.x2[0] << 8); - var41.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var40.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var40.x2[0]; + var41.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var40.x2[1]; + var41.x2[1] = _dest.i; + } /* 4: mergewl */ - var42.i = - ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var39.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var39.i; + _dest.x2[1] = var39.i; + var42.i = _dest.i; + } /* 5: mergewl */ - var38.x2[0] = - ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var42. - x2[0] << 16); - var38.x2[1] = - ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var42. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[0]; + _dest.x2[1] = var42.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[1]; + _dest.x2[1] = var42.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storeq */ ptr0[i] = var38; } @@ -6462,8 +7095,8 @@ _backup_cogorc_convert_YUY2_AYUV (OrcExecutor * ex) } void -cogorc_convert_YUY2_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_convert_YUY2_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -6473,7 +7106,6 @@ cogorc_convert_YUY2_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -6496,7 +7128,7 @@ cogorc_convert_YUY2_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -6519,8 +7151,8 @@ cogorc_convert_YUY2_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, /* cogorc_convert_UYVY_AYUV */ #ifdef DISABLE_ORC void -cogorc_convert_UYVY_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_convert_UYVY_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -6539,32 +7171,58 @@ cogorc_convert_UYVY_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); /* 2: loadpb */ - var37.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var37.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadl */ var36 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var36.x2[0] >> 8) & 0xff; - var40.x2[0] = var36.x2[0] & 0xff; - var39.x2[1] = (var36.x2[1] >> 8) & 0xff; - var40.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 3: mergebw */ - var41.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var41.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var39.x2[0]; + var41.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var39.x2[1]; + var41.x2[1] = _dest.i; + } /* 4: mergewl */ - var42.i = - ((orc_uint16) var40.i & 0x0000ffff) | ((orc_uint16) var40.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var40.i; + _dest.x2[1] = var40.i; + var42.i = _dest.i; + } /* 5: mergewl */ - var38.x2[0] = - ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var42. - x2[0] << 16); - var38.x2[1] = - ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var42. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[0]; + _dest.x2[1] = var42.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[1]; + _dest.x2[1] = var42.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storeq */ ptr0[i] = var38; } @@ -6574,7 +7232,7 @@ cogorc_convert_UYVY_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, #else static void -_backup_cogorc_convert_UYVY_AYUV (OrcExecutor * ex) +_backup_cogorc_convert_UYVY_AYUV (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -6595,32 +7253,58 @@ _backup_cogorc_convert_UYVY_AYUV (OrcExecutor * ex) ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); /* 2: loadpb */ - var37.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var37.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadl */ var36 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var36.x2[0] >> 8) & 0xff; - var40.x2[0] = var36.x2[0] & 0xff; - var39.x2[1] = (var36.x2[1] >> 8) & 0xff; - var40.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 3: mergebw */ - var41.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var41.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var39.x2[0]; + var41.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var39.x2[1]; + var41.x2[1] = _dest.i; + } /* 4: mergewl */ - var42.i = - ((orc_uint16) var40.i & 0x0000ffff) | ((orc_uint16) var40.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var40.i; + _dest.x2[1] = var40.i; + var42.i = _dest.i; + } /* 5: mergewl */ - var38.x2[0] = - ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var42. - x2[0] << 16); - var38.x2[1] = - ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var42. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[0]; + _dest.x2[1] = var42.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[1]; + _dest.x2[1] = var42.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storeq */ ptr0[i] = var38; } @@ -6629,8 +7313,8 @@ _backup_cogorc_convert_UYVY_AYUV (OrcExecutor * ex) } void -cogorc_convert_UYVY_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_convert_UYVY_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -6640,7 +7324,6 @@ cogorc_convert_UYVY_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -6663,7 +7346,7 @@ cogorc_convert_UYVY_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -6686,9 +7369,9 @@ cogorc_convert_UYVY_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, /* cogorc_convert_YUY2_Y42B */ #ifdef DISABLE_ORC void -cogorc_convert_YUY2_Y42B (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, - int n, int m) +cogorc_convert_YUY2_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -6713,15 +7396,27 @@ cogorc_convert_YUY2_Y42B (guint8 * d1, int d1_stride, guint8 * d2, /* 0: loadl */ var33 = ptr4[i]; /* 1: splitwb */ - var37.x2[0] = (var33.x2[0] >> 8) & 0xff; - var34.x2[0] = var33.x2[0] & 0xff; - var37.x2[1] = (var33.x2[1] >> 8) & 0xff; - var34.x2[1] = var33.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var33.x2[0]; + var37.x2[0] = _src.x2[1]; + var34.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var33.x2[1]; + var37.x2[1] = _src.x2[1]; + var34.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var34; /* 3: splitwb */ - var35 = (var37.i >> 8) & 0xff; - var36 = var37.i & 0xff; + { + orc_union16 _src; + _src.i = var37.i; + var35 = _src.x2[1]; + var36 = _src.x2[0]; + } /* 4: storeb */ ptr2[i] = var35; /* 5: storeb */ @@ -6733,7 +7428,7 @@ cogorc_convert_YUY2_Y42B (guint8 * d1, int d1_stride, guint8 * d2, #else static void -_backup_cogorc_convert_YUY2_Y42B (OrcExecutor * ex) +_backup_cogorc_convert_YUY2_Y42B (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -6760,15 +7455,27 @@ _backup_cogorc_convert_YUY2_Y42B (OrcExecutor * ex) /* 0: loadl */ var33 = ptr4[i]; /* 1: splitwb */ - var37.x2[0] = (var33.x2[0] >> 8) & 0xff; - var34.x2[0] = var33.x2[0] & 0xff; - var37.x2[1] = (var33.x2[1] >> 8) & 0xff; - var34.x2[1] = var33.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var33.x2[0]; + var37.x2[0] = _src.x2[1]; + var34.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var33.x2[1]; + var37.x2[1] = _src.x2[1]; + var34.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var34; /* 3: splitwb */ - var35 = (var37.i >> 8) & 0xff; - var36 = var37.i & 0xff; + { + orc_union16 _src; + _src.i = var37.i; + var35 = _src.x2[1]; + var36 = _src.x2[0]; + } /* 4: storeb */ ptr2[i] = var35; /* 5: storeb */ @@ -6779,9 +7486,9 @@ _backup_cogorc_convert_YUY2_Y42B (OrcExecutor * ex) } void -cogorc_convert_YUY2_Y42B (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, - int n, int m) +cogorc_convert_YUY2_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -6791,7 +7498,6 @@ cogorc_convert_YUY2_Y42B (guint8 * d1, int d1_stride, guint8 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -6808,7 +7514,7 @@ cogorc_convert_YUY2_Y42B (guint8 * d1, int d1_stride, guint8 * d2, orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D3, ORC_VAR_D2, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -6835,9 +7541,9 @@ cogorc_convert_YUY2_Y42B (guint8 * d1, int d1_stride, guint8 * d2, /* cogorc_convert_UYVY_Y42B */ #ifdef DISABLE_ORC void -cogorc_convert_UYVY_Y42B (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, - int n, int m) +cogorc_convert_UYVY_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -6862,15 +7568,27 @@ cogorc_convert_UYVY_Y42B (guint8 * d1, int d1_stride, guint8 * d2, /* 0: loadl */ var33 = ptr4[i]; /* 1: splitwb */ - var34.x2[0] = (var33.x2[0] >> 8) & 0xff; - var37.x2[0] = var33.x2[0] & 0xff; - var34.x2[1] = (var33.x2[1] >> 8) & 0xff; - var37.x2[1] = var33.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var33.x2[0]; + var34.x2[0] = _src.x2[1]; + var37.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var33.x2[1]; + var34.x2[1] = _src.x2[1]; + var37.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var34; /* 3: splitwb */ - var35 = (var37.i >> 8) & 0xff; - var36 = var37.i & 0xff; + { + orc_union16 _src; + _src.i = var37.i; + var35 = _src.x2[1]; + var36 = _src.x2[0]; + } /* 4: storeb */ ptr2[i] = var35; /* 5: storeb */ @@ -6882,7 +7600,7 @@ cogorc_convert_UYVY_Y42B (guint8 * d1, int d1_stride, guint8 * d2, #else static void -_backup_cogorc_convert_UYVY_Y42B (OrcExecutor * ex) +_backup_cogorc_convert_UYVY_Y42B (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -6909,15 +7627,27 @@ _backup_cogorc_convert_UYVY_Y42B (OrcExecutor * ex) /* 0: loadl */ var33 = ptr4[i]; /* 1: splitwb */ - var34.x2[0] = (var33.x2[0] >> 8) & 0xff; - var37.x2[0] = var33.x2[0] & 0xff; - var34.x2[1] = (var33.x2[1] >> 8) & 0xff; - var37.x2[1] = var33.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var33.x2[0]; + var34.x2[0] = _src.x2[1]; + var37.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var33.x2[1]; + var34.x2[1] = _src.x2[1]; + var37.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var34; /* 3: splitwb */ - var35 = (var37.i >> 8) & 0xff; - var36 = var37.i & 0xff; + { + orc_union16 _src; + _src.i = var37.i; + var35 = _src.x2[1]; + var36 = _src.x2[0]; + } /* 4: storeb */ ptr2[i] = var35; /* 5: storeb */ @@ -6928,9 +7658,9 @@ _backup_cogorc_convert_UYVY_Y42B (OrcExecutor * ex) } void -cogorc_convert_UYVY_Y42B (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, - int n, int m) +cogorc_convert_UYVY_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -6940,7 +7670,6 @@ cogorc_convert_UYVY_Y42B (guint8 * d1, int d1_stride, guint8 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -6957,7 +7686,7 @@ cogorc_convert_UYVY_Y42B (guint8 * d1, int d1_stride, guint8 * d2, orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D3, ORC_VAR_D2, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -6984,9 +7713,9 @@ cogorc_convert_UYVY_Y42B (guint8 * d1, int d1_stride, guint8 * d2, /* cogorc_convert_YUY2_Y444 */ #ifdef DISABLE_ORC void -cogorc_convert_YUY2_Y444 (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, - int n, int m) +cogorc_convert_YUY2_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -7013,15 +7742,27 @@ cogorc_convert_YUY2_Y444 (guint8 * d1, int d1_stride, guint8 * d2, /* 0: loadl */ var35 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var35.x2[0] >> 8) & 0xff; - var36.x2[0] = var35.x2[0] & 0xff; - var39.x2[1] = (var35.x2[1] >> 8) & 0xff; - var36.x2[1] = var35.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var35.x2[0]; + var39.x2[0] = _src.x2[1]; + var36.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var35.x2[1]; + var39.x2[1] = _src.x2[1]; + var36.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var36; /* 3: splitwb */ - var40 = (var39.i >> 8) & 0xff; - var41 = var39.i & 0xff; + { + orc_union16 _src; + _src.i = var39.i; + var40 = _src.x2[1]; + var41 = _src.x2[0]; + } /* 4: splatbw */ var37.i = ((var41 & 0xff) << 8) | (var41 & 0xff); /* 5: storew */ @@ -7037,7 +7778,7 @@ cogorc_convert_YUY2_Y444 (guint8 * d1, int d1_stride, guint8 * d2, #else static void -_backup_cogorc_convert_YUY2_Y444 (OrcExecutor * ex) +_backup_cogorc_convert_YUY2_Y444 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -7066,15 +7807,27 @@ _backup_cogorc_convert_YUY2_Y444 (OrcExecutor * ex) /* 0: loadl */ var35 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var35.x2[0] >> 8) & 0xff; - var36.x2[0] = var35.x2[0] & 0xff; - var39.x2[1] = (var35.x2[1] >> 8) & 0xff; - var36.x2[1] = var35.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var35.x2[0]; + var39.x2[0] = _src.x2[1]; + var36.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var35.x2[1]; + var39.x2[1] = _src.x2[1]; + var36.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var36; /* 3: splitwb */ - var40 = (var39.i >> 8) & 0xff; - var41 = var39.i & 0xff; + { + orc_union16 _src; + _src.i = var39.i; + var40 = _src.x2[1]; + var41 = _src.x2[0]; + } /* 4: splatbw */ var37.i = ((var41 & 0xff) << 8) | (var41 & 0xff); /* 5: storew */ @@ -7089,9 +7842,9 @@ _backup_cogorc_convert_YUY2_Y444 (OrcExecutor * ex) } void -cogorc_convert_YUY2_Y444 (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, - int n, int m) +cogorc_convert_YUY2_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -7101,7 +7854,6 @@ cogorc_convert_YUY2_Y444 (guint8 * d1, int d1_stride, guint8 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -7124,7 +7876,7 @@ cogorc_convert_YUY2_Y444 (guint8 * d1, int d1_stride, guint8 * d2, orc_program_append_2 (p, "splatbw", 0, ORC_VAR_D3, ORC_VAR_T3, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -7151,9 +7903,9 @@ cogorc_convert_YUY2_Y444 (guint8 * d1, int d1_stride, guint8 * d2, /* cogorc_convert_UYVY_Y444 */ #ifdef DISABLE_ORC void -cogorc_convert_UYVY_Y444 (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, - int n, int m) +cogorc_convert_UYVY_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -7180,15 +7932,27 @@ cogorc_convert_UYVY_Y444 (guint8 * d1, int d1_stride, guint8 * d2, /* 0: loadl */ var35 = ptr4[i]; /* 1: splitwb */ - var36.x2[0] = (var35.x2[0] >> 8) & 0xff; - var39.x2[0] = var35.x2[0] & 0xff; - var36.x2[1] = (var35.x2[1] >> 8) & 0xff; - var39.x2[1] = var35.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var35.x2[0]; + var36.x2[0] = _src.x2[1]; + var39.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var35.x2[1]; + var36.x2[1] = _src.x2[1]; + var39.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var36; /* 3: splitwb */ - var40 = (var39.i >> 8) & 0xff; - var41 = var39.i & 0xff; + { + orc_union16 _src; + _src.i = var39.i; + var40 = _src.x2[1]; + var41 = _src.x2[0]; + } /* 4: splatbw */ var37.i = ((var41 & 0xff) << 8) | (var41 & 0xff); /* 5: storew */ @@ -7204,7 +7968,7 @@ cogorc_convert_UYVY_Y444 (guint8 * d1, int d1_stride, guint8 * d2, #else static void -_backup_cogorc_convert_UYVY_Y444 (OrcExecutor * ex) +_backup_cogorc_convert_UYVY_Y444 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -7233,15 +7997,27 @@ _backup_cogorc_convert_UYVY_Y444 (OrcExecutor * ex) /* 0: loadl */ var35 = ptr4[i]; /* 1: splitwb */ - var36.x2[0] = (var35.x2[0] >> 8) & 0xff; - var39.x2[0] = var35.x2[0] & 0xff; - var36.x2[1] = (var35.x2[1] >> 8) & 0xff; - var39.x2[1] = var35.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var35.x2[0]; + var36.x2[0] = _src.x2[1]; + var39.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var35.x2[1]; + var36.x2[1] = _src.x2[1]; + var39.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var36; /* 3: splitwb */ - var40 = (var39.i >> 8) & 0xff; - var41 = var39.i & 0xff; + { + orc_union16 _src; + _src.i = var39.i; + var40 = _src.x2[1]; + var41 = _src.x2[0]; + } /* 4: splatbw */ var37.i = ((var41 & 0xff) << 8) | (var41 & 0xff); /* 5: storew */ @@ -7256,9 +8032,9 @@ _backup_cogorc_convert_UYVY_Y444 (OrcExecutor * ex) } void -cogorc_convert_UYVY_Y444 (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, - int n, int m) +cogorc_convert_UYVY_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -7268,7 +8044,6 @@ cogorc_convert_UYVY_Y444 (guint8 * d1, int d1_stride, guint8 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -7291,7 +8066,7 @@ cogorc_convert_UYVY_Y444 (guint8 * d1, int d1_stride, guint8 * d2, orc_program_append_2 (p, "splatbw", 0, ORC_VAR_D3, ORC_VAR_T3, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -7318,8 +8093,9 @@ cogorc_convert_UYVY_Y444 (guint8 * d1, int d1_stride, guint8 * d2, /* cogorc_convert_UYVY_I420 */ #ifdef DISABLE_ORC void -cogorc_convert_UYVY_I420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, - const guint8 * s1, const guint8 * s2, int n) +cogorc_convert_UYVY_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) { int i; orc_union16 *ORC_RESTRICT ptr0; @@ -7350,27 +8126,47 @@ cogorc_convert_UYVY_I420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, /* 0: loadl */ var35 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var35.x2[0] >> 8) & 0xff; - var40.x2[0] = var35.x2[0] & 0xff; - var39.x2[1] = (var35.x2[1] >> 8) & 0xff; - var40.x2[1] = var35.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var35.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var35.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var39; /* 3: loadl */ var36 = ptr5[i]; /* 4: splitwb */ - var41.x2[0] = (var36.x2[0] >> 8) & 0xff; - var42.x2[0] = var36.x2[0] & 0xff; - var41.x2[1] = (var36.x2[1] >> 8) & 0xff; - var42.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var41.x2[0] = _src.x2[1]; + var42.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var41.x2[1] = _src.x2[1]; + var42.x2[1] = _src.x2[0]; + } /* 5: storew */ ptr1[i] = var41; /* 6: avgub */ var43.x2[0] = ((orc_uint8) var40.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var40.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; /* 7: splitwb */ - var37 = (var43.i >> 8) & 0xff; - var38 = var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var37 = _src.x2[1]; + var38 = _src.x2[0]; + } /* 8: storeb */ ptr3[i] = var37; /* 9: storeb */ @@ -7381,7 +8177,7 @@ cogorc_convert_UYVY_I420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, #else static void -_backup_cogorc_convert_UYVY_I420 (OrcExecutor * ex) +_backup_cogorc_convert_UYVY_I420 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -7413,27 +8209,47 @@ _backup_cogorc_convert_UYVY_I420 (OrcExecutor * ex) /* 0: loadl */ var35 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var35.x2[0] >> 8) & 0xff; - var40.x2[0] = var35.x2[0] & 0xff; - var39.x2[1] = (var35.x2[1] >> 8) & 0xff; - var40.x2[1] = var35.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var35.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var35.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: storew */ ptr0[i] = var39; /* 3: loadl */ var36 = ptr5[i]; /* 4: splitwb */ - var41.x2[0] = (var36.x2[0] >> 8) & 0xff; - var42.x2[0] = var36.x2[0] & 0xff; - var41.x2[1] = (var36.x2[1] >> 8) & 0xff; - var42.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var41.x2[0] = _src.x2[1]; + var42.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var41.x2[1] = _src.x2[1]; + var42.x2[1] = _src.x2[0]; + } /* 5: storew */ ptr1[i] = var41; /* 6: avgub */ var43.x2[0] = ((orc_uint8) var40.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var40.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; /* 7: splitwb */ - var37 = (var43.i >> 8) & 0xff; - var38 = var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var37 = _src.x2[1]; + var38 = _src.x2[0]; + } /* 8: storeb */ ptr3[i] = var37; /* 9: storeb */ @@ -7443,8 +8259,9 @@ _backup_cogorc_convert_UYVY_I420 (OrcExecutor * ex) } void -cogorc_convert_UYVY_I420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, - const guint8 * s1, const guint8 * s2, int n) +cogorc_convert_UYVY_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -7454,7 +8271,6 @@ cogorc_convert_UYVY_I420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_convert_UYVY_I420"); @@ -7482,7 +8298,7 @@ cogorc_convert_UYVY_I420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, orc_program_append_2 (p, "splitwb", 0, ORC_VAR_D4, ORC_VAR_D3, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -7506,10 +8322,11 @@ cogorc_convert_UYVY_I420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, /* cogorc_convert_AYUV_I420 */ #ifdef DISABLE_ORC void -cogorc_convert_AYUV_I420 (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, guint8 * d4, int d4_stride, - const guint8 * s1, int s1_stride, const guint8 * s2, int s2_stride, int n, - int m) +cogorc_convert_AYUV_I420 (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, guint8 * ORC_RESTRICT d4, int d4_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m) { int i; int j; @@ -7550,25 +8367,57 @@ cogorc_convert_AYUV_I420 (guint8 * d1, int d1_stride, guint8 * d2, /* 0: loadq */ var40 = ptr4[i]; /* 1: splitlw */ - var46.x2[0] = (var40.x2[0] >> 16) & 0xffff; - var47.x2[0] = var40.x2[0] & 0xffff; - var46.x2[1] = (var40.x2[1] >> 16) & 0xffff; - var47.x2[1] = var40.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var40.x2[0]; + var46.x2[0] = _src.x2[1]; + var47.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var40.x2[1]; + var46.x2[1] = _src.x2[1]; + var47.x2[1] = _src.x2[0]; + } /* 2: select1wb */ - var41.x2[0] = ((orc_uint16) var47.x2[0] >> 8) & 0xff; - var41.x2[1] = ((orc_uint16) var47.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var47.x2[0]; + var41.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var47.x2[1]; + var41.x2[1] = _src.x2[1]; + } /* 3: storew */ ptr0[i] = var41; /* 4: loadq */ var42 = ptr5[i]; /* 5: splitlw */ - var48.x2[0] = (var42.x2[0] >> 16) & 0xffff; - var49.x2[0] = var42.x2[0] & 0xffff; - var48.x2[1] = (var42.x2[1] >> 16) & 0xffff; - var49.x2[1] = var42.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var42.x2[0]; + var48.x2[0] = _src.x2[1]; + var49.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var42.x2[1]; + var48.x2[1] = _src.x2[1]; + var49.x2[1] = _src.x2[0]; + } /* 6: select1wb */ - var43.x2[0] = ((orc_uint16) var49.x2[0] >> 8) & 0xff; - var43.x2[1] = ((orc_uint16) var49.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var49.x2[0]; + var43.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var49.x2[1]; + var43.x2[1] = _src.x2[1]; + } /* 7: storew */ ptr1[i] = var43; /* 8: avgub */ @@ -7581,20 +8430,36 @@ cogorc_convert_AYUV_I420 (guint8 * d1, int d1_stride, guint8 * d2, var50.x4[3] = ((orc_uint8) var46.x4[3] + (orc_uint8) var48.x4[3] + 1) >> 1; /* 9: splitwb */ - var51.x2[0] = (var50.x2[0] >> 8) & 0xff; - var52.x2[0] = var50.x2[0] & 0xff; - var51.x2[1] = (var50.x2[1] >> 8) & 0xff; - var52.x2[1] = var50.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var50.x2[0]; + var51.x2[0] = _src.x2[1]; + var52.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var50.x2[1]; + var51.x2[1] = _src.x2[1]; + var52.x2[1] = _src.x2[0]; + } /* 10: splitwb */ - var53 = (var52.i >> 8) & 0xff; - var54 = var52.i & 0xff; + { + orc_union16 _src; + _src.i = var52.i; + var53 = _src.x2[1]; + var54 = _src.x2[0]; + } /* 11: avgub */ var44 = ((orc_uint8) var53 + (orc_uint8) var54 + 1) >> 1; /* 12: storeb */ ptr2[i] = var44; /* 13: splitwb */ - var55 = (var51.i >> 8) & 0xff; - var56 = var51.i & 0xff; + { + orc_union16 _src; + _src.i = var51.i; + var55 = _src.x2[1]; + var56 = _src.x2[0]; + } /* 14: avgub */ var45 = ((orc_uint8) var55 + (orc_uint8) var56 + 1) >> 1; /* 15: storeb */ @@ -7606,7 +8471,7 @@ cogorc_convert_AYUV_I420 (guint8 * d1, int d1_stride, guint8 * d2, #else static void -_backup_cogorc_convert_AYUV_I420 (OrcExecutor * ex) +_backup_cogorc_convert_AYUV_I420 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -7649,25 +8514,57 @@ _backup_cogorc_convert_AYUV_I420 (OrcExecutor * ex) /* 0: loadq */ var40 = ptr4[i]; /* 1: splitlw */ - var46.x2[0] = (var40.x2[0] >> 16) & 0xffff; - var47.x2[0] = var40.x2[0] & 0xffff; - var46.x2[1] = (var40.x2[1] >> 16) & 0xffff; - var47.x2[1] = var40.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var40.x2[0]; + var46.x2[0] = _src.x2[1]; + var47.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var40.x2[1]; + var46.x2[1] = _src.x2[1]; + var47.x2[1] = _src.x2[0]; + } /* 2: select1wb */ - var41.x2[0] = ((orc_uint16) var47.x2[0] >> 8) & 0xff; - var41.x2[1] = ((orc_uint16) var47.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var47.x2[0]; + var41.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var47.x2[1]; + var41.x2[1] = _src.x2[1]; + } /* 3: storew */ ptr0[i] = var41; /* 4: loadq */ var42 = ptr5[i]; /* 5: splitlw */ - var48.x2[0] = (var42.x2[0] >> 16) & 0xffff; - var49.x2[0] = var42.x2[0] & 0xffff; - var48.x2[1] = (var42.x2[1] >> 16) & 0xffff; - var49.x2[1] = var42.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var42.x2[0]; + var48.x2[0] = _src.x2[1]; + var49.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var42.x2[1]; + var48.x2[1] = _src.x2[1]; + var49.x2[1] = _src.x2[0]; + } /* 6: select1wb */ - var43.x2[0] = ((orc_uint16) var49.x2[0] >> 8) & 0xff; - var43.x2[1] = ((orc_uint16) var49.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var49.x2[0]; + var43.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var49.x2[1]; + var43.x2[1] = _src.x2[1]; + } /* 7: storew */ ptr1[i] = var43; /* 8: avgub */ @@ -7680,20 +8577,36 @@ _backup_cogorc_convert_AYUV_I420 (OrcExecutor * ex) var50.x4[3] = ((orc_uint8) var46.x4[3] + (orc_uint8) var48.x4[3] + 1) >> 1; /* 9: splitwb */ - var51.x2[0] = (var50.x2[0] >> 8) & 0xff; - var52.x2[0] = var50.x2[0] & 0xff; - var51.x2[1] = (var50.x2[1] >> 8) & 0xff; - var52.x2[1] = var50.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var50.x2[0]; + var51.x2[0] = _src.x2[1]; + var52.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var50.x2[1]; + var51.x2[1] = _src.x2[1]; + var52.x2[1] = _src.x2[0]; + } /* 10: splitwb */ - var53 = (var52.i >> 8) & 0xff; - var54 = var52.i & 0xff; + { + orc_union16 _src; + _src.i = var52.i; + var53 = _src.x2[1]; + var54 = _src.x2[0]; + } /* 11: avgub */ var44 = ((orc_uint8) var53 + (orc_uint8) var54 + 1) >> 1; /* 12: storeb */ ptr2[i] = var44; /* 13: splitwb */ - var55 = (var51.i >> 8) & 0xff; - var56 = var51.i & 0xff; + { + orc_union16 _src; + _src.i = var51.i; + var55 = _src.x2[1]; + var56 = _src.x2[0]; + } /* 14: avgub */ var45 = ((orc_uint8) var55 + (orc_uint8) var56 + 1) >> 1; /* 15: storeb */ @@ -7704,10 +8617,11 @@ _backup_cogorc_convert_AYUV_I420 (OrcExecutor * ex) } void -cogorc_convert_AYUV_I420 (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, guint8 * d4, int d4_stride, - const guint8 * s1, int s1_stride, const guint8 * s2, int s2_stride, int n, - int m) +cogorc_convert_AYUV_I420 (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, guint8 * ORC_RESTRICT d4, int d4_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -7717,7 +8631,6 @@ cogorc_convert_AYUV_I420 (guint8 * d1, int d1_stride, guint8 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -7759,7 +8672,7 @@ cogorc_convert_AYUV_I420 (guint8 * d1, int d1_stride, guint8 * d2, orc_program_append_2 (p, "avgub", 0, ORC_VAR_D4, ORC_VAR_T7, ORC_VAR_T8, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -7790,8 +8703,8 @@ cogorc_convert_AYUV_I420 (guint8 * d1, int d1_stride, guint8 * d2, /* cogorc_convert_AYUV_YUY2 */ #ifdef DISABLE_ORC void -cogorc_convert_AYUV_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -7815,26 +8728,54 @@ cogorc_convert_AYUV_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, /* 0: loadq */ var37 = ptr4[i]; /* 1: splitlw */ - var39.x2[0] = (var37.x2[0] >> 16) & 0xffff; - var40.x2[0] = var37.x2[0] & 0xffff; - var39.x2[1] = (var37.x2[1] >> 16) & 0xffff; - var40.x2[1] = var37.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var37.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var37.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var41.i = (var39.i >> 16) & 0xffff; - var42.i = var39.i & 0xffff; + { + orc_union32 _src; + _src.i = var39.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 3: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; /* 4: select1wb */ - var44.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff; - var44.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.x2[0]; + var44.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var40.x2[1]; + var44.x2[1] = _src.x2[1]; + } /* 5: mergebw */ - var38.x2[0] = - ((orc_uint8) var44.x2[0] & 0x00ff) | ((orc_uint8) var43.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var44.x2[1] & 0x00ff) | ((orc_uint8) var43.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var43.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var43.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storel */ ptr0[i] = var38; } @@ -7844,7 +8785,7 @@ cogorc_convert_AYUV_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, #else static void -_backup_cogorc_convert_AYUV_YUY2 (OrcExecutor * ex) +_backup_cogorc_convert_AYUV_YUY2 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -7870,26 +8811,54 @@ _backup_cogorc_convert_AYUV_YUY2 (OrcExecutor * ex) /* 0: loadq */ var37 = ptr4[i]; /* 1: splitlw */ - var39.x2[0] = (var37.x2[0] >> 16) & 0xffff; - var40.x2[0] = var37.x2[0] & 0xffff; - var39.x2[1] = (var37.x2[1] >> 16) & 0xffff; - var40.x2[1] = var37.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var37.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var37.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var41.i = (var39.i >> 16) & 0xffff; - var42.i = var39.i & 0xffff; + { + orc_union32 _src; + _src.i = var39.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 3: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; /* 4: select1wb */ - var44.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff; - var44.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.x2[0]; + var44.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var40.x2[1]; + var44.x2[1] = _src.x2[1]; + } /* 5: mergebw */ - var38.x2[0] = - ((orc_uint8) var44.x2[0] & 0x00ff) | ((orc_uint8) var43.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var44.x2[1] & 0x00ff) | ((orc_uint8) var43.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var43.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var43.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storel */ ptr0[i] = var38; } @@ -7898,8 +8867,8 @@ _backup_cogorc_convert_AYUV_YUY2 (OrcExecutor * ex) } void -cogorc_convert_AYUV_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -7909,7 +8878,6 @@ cogorc_convert_AYUV_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -7934,7 +8902,7 @@ cogorc_convert_AYUV_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -7957,8 +8925,8 @@ cogorc_convert_AYUV_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, /* cogorc_convert_AYUV_UYVY */ #ifdef DISABLE_ORC void -cogorc_convert_AYUV_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -7982,26 +8950,54 @@ cogorc_convert_AYUV_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, /* 0: loadq */ var37 = ptr4[i]; /* 1: splitlw */ - var39.x2[0] = (var37.x2[0] >> 16) & 0xffff; - var40.x2[0] = var37.x2[0] & 0xffff; - var39.x2[1] = (var37.x2[1] >> 16) & 0xffff; - var40.x2[1] = var37.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var37.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var37.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var41.i = (var39.i >> 16) & 0xffff; - var42.i = var39.i & 0xffff; + { + orc_union32 _src; + _src.i = var39.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 3: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; /* 4: select1wb */ - var44.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff; - var44.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.x2[0]; + var44.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var40.x2[1]; + var44.x2[1] = _src.x2[1]; + } /* 5: mergebw */ - var38.x2[0] = - ((orc_uint8) var43.x2[0] & 0x00ff) | ((orc_uint8) var44.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var43.x2[1] & 0x00ff) | ((orc_uint8) var44.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[0]; + _dest.x2[1] = var44.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[1]; + _dest.x2[1] = var44.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storel */ ptr0[i] = var38; } @@ -8011,7 +9007,7 @@ cogorc_convert_AYUV_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, #else static void -_backup_cogorc_convert_AYUV_UYVY (OrcExecutor * ex) +_backup_cogorc_convert_AYUV_UYVY (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -8037,26 +9033,54 @@ _backup_cogorc_convert_AYUV_UYVY (OrcExecutor * ex) /* 0: loadq */ var37 = ptr4[i]; /* 1: splitlw */ - var39.x2[0] = (var37.x2[0] >> 16) & 0xffff; - var40.x2[0] = var37.x2[0] & 0xffff; - var39.x2[1] = (var37.x2[1] >> 16) & 0xffff; - var40.x2[1] = var37.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var37.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var37.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var41.i = (var39.i >> 16) & 0xffff; - var42.i = var39.i & 0xffff; + { + orc_union32 _src; + _src.i = var39.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 3: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; /* 4: select1wb */ - var44.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff; - var44.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.x2[0]; + var44.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var40.x2[1]; + var44.x2[1] = _src.x2[1]; + } /* 5: mergebw */ - var38.x2[0] = - ((orc_uint8) var43.x2[0] & 0x00ff) | ((orc_uint8) var44.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var43.x2[1] & 0x00ff) | ((orc_uint8) var44.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[0]; + _dest.x2[1] = var44.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[1]; + _dest.x2[1] = var44.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storel */ ptr0[i] = var38; } @@ -8065,8 +9089,8 @@ _backup_cogorc_convert_AYUV_UYVY (OrcExecutor * ex) } void -cogorc_convert_AYUV_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -8076,7 +9100,6 @@ cogorc_convert_AYUV_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -8101,7 +9124,7 @@ cogorc_convert_AYUV_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -8124,9 +9147,9 @@ cogorc_convert_AYUV_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, /* cogorc_convert_AYUV_Y42B */ #ifdef DISABLE_ORC void -cogorc_convert_AYUV_Y42B (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, - int n, int m) +cogorc_convert_AYUV_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -8155,28 +9178,52 @@ cogorc_convert_AYUV_Y42B (guint8 * d1, int d1_stride, guint8 * d2, /* 0: loadq */ var36 = ptr4[i]; /* 1: splitlw */ - var40.x2[0] = (var36.x2[0] >> 16) & 0xffff; - var41.x2[0] = var36.x2[0] & 0xffff; - var40.x2[1] = (var36.x2[1] >> 16) & 0xffff; - var41.x2[1] = var36.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var36.x2[0]; + var40.x2[0] = _src.x2[1]; + var41.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var36.x2[1]; + var40.x2[1] = _src.x2[1]; + var41.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var42.i = (var40.i >> 16) & 0xffff; - var43.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var42.i = _src.x2[1]; + var43.i = _src.x2[0]; + } /* 3: avgub */ var44.x2[0] = ((orc_uint8) var42.x2[0] + (orc_uint8) var43.x2[0] + 1) >> 1; var44.x2[1] = ((orc_uint8) var42.x2[1] + (orc_uint8) var43.x2[1] + 1) >> 1; /* 4: splitwb */ - var37 = (var44.i >> 8) & 0xff; - var38 = var44.i & 0xff; + { + orc_union16 _src; + _src.i = var44.i; + var37 = _src.x2[1]; + var38 = _src.x2[0]; + } /* 5: storeb */ ptr2[i] = var37; /* 6: storeb */ ptr1[i] = var38; /* 7: select1wb */ - var39.x2[0] = ((orc_uint16) var41.x2[0] >> 8) & 0xff; - var39.x2[1] = ((orc_uint16) var41.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var41.x2[0]; + var39.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var41.x2[1]; + var39.x2[1] = _src.x2[1]; + } /* 8: storew */ ptr0[i] = var39; } @@ -8186,7 +9233,7 @@ cogorc_convert_AYUV_Y42B (guint8 * d1, int d1_stride, guint8 * d2, #else static void -_backup_cogorc_convert_AYUV_Y42B (OrcExecutor * ex) +_backup_cogorc_convert_AYUV_Y42B (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -8217,28 +9264,52 @@ _backup_cogorc_convert_AYUV_Y42B (OrcExecutor * ex) /* 0: loadq */ var36 = ptr4[i]; /* 1: splitlw */ - var40.x2[0] = (var36.x2[0] >> 16) & 0xffff; - var41.x2[0] = var36.x2[0] & 0xffff; - var40.x2[1] = (var36.x2[1] >> 16) & 0xffff; - var41.x2[1] = var36.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var36.x2[0]; + var40.x2[0] = _src.x2[1]; + var41.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var36.x2[1]; + var40.x2[1] = _src.x2[1]; + var41.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var42.i = (var40.i >> 16) & 0xffff; - var43.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var42.i = _src.x2[1]; + var43.i = _src.x2[0]; + } /* 3: avgub */ var44.x2[0] = ((orc_uint8) var42.x2[0] + (orc_uint8) var43.x2[0] + 1) >> 1; var44.x2[1] = ((orc_uint8) var42.x2[1] + (orc_uint8) var43.x2[1] + 1) >> 1; /* 4: splitwb */ - var37 = (var44.i >> 8) & 0xff; - var38 = var44.i & 0xff; + { + orc_union16 _src; + _src.i = var44.i; + var37 = _src.x2[1]; + var38 = _src.x2[0]; + } /* 5: storeb */ ptr2[i] = var37; /* 6: storeb */ ptr1[i] = var38; /* 7: select1wb */ - var39.x2[0] = ((orc_uint16) var41.x2[0] >> 8) & 0xff; - var39.x2[1] = ((orc_uint16) var41.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var41.x2[0]; + var39.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var41.x2[1]; + var39.x2[1] = _src.x2[1]; + } /* 8: storew */ ptr0[i] = var39; } @@ -8247,9 +9318,9 @@ _backup_cogorc_convert_AYUV_Y42B (OrcExecutor * ex) } void -cogorc_convert_AYUV_Y42B (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, - int n, int m) +cogorc_convert_AYUV_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -8259,7 +9330,6 @@ cogorc_convert_AYUV_Y42B (guint8 * d1, int d1_stride, guint8 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -8285,7 +9355,7 @@ cogorc_convert_AYUV_Y42B (guint8 * d1, int d1_stride, guint8 * d2, orc_program_append_2 (p, "select1wb", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -8312,9 +9382,9 @@ cogorc_convert_AYUV_Y42B (guint8 * d1, int d1_stride, guint8 * d2, /* cogorc_convert_AYUV_Y444 */ #ifdef DISABLE_ORC void -cogorc_convert_AYUV_Y444 (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, - int n, int m) +cogorc_convert_AYUV_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -8340,17 +9410,29 @@ cogorc_convert_AYUV_Y444 (guint8 * d1, int d1_stride, guint8 * d2, /* 0: loadl */ var34 = ptr4[i]; /* 1: splitlw */ - var38.i = (var34.i >> 16) & 0xffff; - var39.i = var34.i & 0xffff; + { + orc_union32 _src; + _src.i = var34.i; + var38.i = _src.x2[1]; + var39.i = _src.x2[0]; + } /* 2: splitwb */ - var35 = (var38.i >> 8) & 0xff; - var36 = var38.i & 0xff; + { + orc_union16 _src; + _src.i = var38.i; + var35 = _src.x2[1]; + var36 = _src.x2[0]; + } /* 3: storeb */ ptr2[i] = var35; /* 4: storeb */ ptr1[i] = var36; /* 5: select1wb */ - var37 = ((orc_uint16) var39.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var39.i; + var37 = _src.x2[1]; + } /* 6: storeb */ ptr0[i] = var37; } @@ -8360,7 +9442,7 @@ cogorc_convert_AYUV_Y444 (guint8 * d1, int d1_stride, guint8 * d2, #else static void -_backup_cogorc_convert_AYUV_Y444 (OrcExecutor * ex) +_backup_cogorc_convert_AYUV_Y444 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -8388,17 +9470,29 @@ _backup_cogorc_convert_AYUV_Y444 (OrcExecutor * ex) /* 0: loadl */ var34 = ptr4[i]; /* 1: splitlw */ - var38.i = (var34.i >> 16) & 0xffff; - var39.i = var34.i & 0xffff; + { + orc_union32 _src; + _src.i = var34.i; + var38.i = _src.x2[1]; + var39.i = _src.x2[0]; + } /* 2: splitwb */ - var35 = (var38.i >> 8) & 0xff; - var36 = var38.i & 0xff; + { + orc_union16 _src; + _src.i = var38.i; + var35 = _src.x2[1]; + var36 = _src.x2[0]; + } /* 3: storeb */ ptr2[i] = var35; /* 4: storeb */ ptr1[i] = var36; /* 5: select1wb */ - var37 = ((orc_uint16) var39.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var39.i; + var37 = _src.x2[1]; + } /* 6: storeb */ ptr0[i] = var37; } @@ -8407,9 +9501,9 @@ _backup_cogorc_convert_AYUV_Y444 (OrcExecutor * ex) } void -cogorc_convert_AYUV_Y444 (guint8 * d1, int d1_stride, guint8 * d2, - int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, - int n, int m) +cogorc_convert_AYUV_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, + guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, + int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -8419,7 +9513,6 @@ cogorc_convert_AYUV_Y444 (guint8 * d1, int d1_stride, guint8 * d2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -8439,7 +9532,7 @@ cogorc_convert_AYUV_Y444 (guint8 * d1, int d1_stride, guint8 * d2, orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -8466,9 +9559,10 @@ cogorc_convert_AYUV_Y444 (guint8 * d1, int d1_stride, guint8 * d2, /* cogorc_convert_Y42B_YUY2 */ #ifdef DISABLE_ORC void -cogorc_convert_Y42B_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y42B_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, + const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { int i; int j; @@ -8495,14 +9589,27 @@ cogorc_convert_Y42B_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, /* 1: loadb */ var34 = ptr6[i]; /* 2: mergebw */ - var37.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var37.i = _dest.i; + } /* 3: loadw */ var35 = ptr4[i]; /* 4: mergebw */ - var36.x2[0] = - ((orc_uint8) var35.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var36.x2[1] = - ((orc_uint8) var35.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var35.x2[0]; + _dest.x2[1] = var37.x2[0]; + var36.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var35.x2[1]; + _dest.x2[1] = var37.x2[1]; + var36.x2[1] = _dest.i; + } /* 5: storel */ ptr0[i] = var36; } @@ -8512,7 +9619,7 @@ cogorc_convert_Y42B_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, #else static void -_backup_cogorc_convert_Y42B_YUY2 (OrcExecutor * ex) +_backup_cogorc_convert_Y42B_YUY2 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -8541,14 +9648,27 @@ _backup_cogorc_convert_Y42B_YUY2 (OrcExecutor * ex) /* 1: loadb */ var34 = ptr6[i]; /* 2: mergebw */ - var37.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var37.i = _dest.i; + } /* 3: loadw */ var35 = ptr4[i]; /* 4: mergebw */ - var36.x2[0] = - ((orc_uint8) var35.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var36.x2[1] = - ((orc_uint8) var35.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var35.x2[0]; + _dest.x2[1] = var37.x2[0]; + var36.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var35.x2[1]; + _dest.x2[1] = var37.x2[1]; + var36.x2[1] = _dest.i; + } /* 5: storel */ ptr0[i] = var36; } @@ -8557,9 +9677,10 @@ _backup_cogorc_convert_Y42B_YUY2 (OrcExecutor * ex) } void -cogorc_convert_Y42B_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y42B_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, + const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -8569,7 +9690,6 @@ cogorc_convert_Y42B_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -8586,7 +9706,7 @@ cogorc_convert_Y42B_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -8613,9 +9733,10 @@ cogorc_convert_Y42B_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, /* cogorc_convert_Y42B_UYVY */ #ifdef DISABLE_ORC void -cogorc_convert_Y42B_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y42B_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, + const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { int i; int j; @@ -8642,14 +9763,27 @@ cogorc_convert_Y42B_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, /* 1: loadb */ var34 = ptr6[i]; /* 2: mergebw */ - var37.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var37.i = _dest.i; + } /* 3: loadw */ var35 = ptr4[i]; /* 4: mergebw */ - var36.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var35.x2[0] << 8); - var36.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var35.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var35.x2[0]; + var36.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var35.x2[1]; + var36.x2[1] = _dest.i; + } /* 5: storel */ ptr0[i] = var36; } @@ -8659,7 +9793,7 @@ cogorc_convert_Y42B_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, #else static void -_backup_cogorc_convert_Y42B_UYVY (OrcExecutor * ex) +_backup_cogorc_convert_Y42B_UYVY (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -8688,14 +9822,27 @@ _backup_cogorc_convert_Y42B_UYVY (OrcExecutor * ex) /* 1: loadb */ var34 = ptr6[i]; /* 2: mergebw */ - var37.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var37.i = _dest.i; + } /* 3: loadw */ var35 = ptr4[i]; /* 4: mergebw */ - var36.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var35.x2[0] << 8); - var36.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var35.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var35.x2[0]; + var36.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var35.x2[1]; + var36.x2[1] = _dest.i; + } /* 5: storel */ ptr0[i] = var36; } @@ -8704,9 +9851,10 @@ _backup_cogorc_convert_Y42B_UYVY (OrcExecutor * ex) } void -cogorc_convert_Y42B_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y42B_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, + const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -8716,7 +9864,6 @@ cogorc_convert_Y42B_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -8733,7 +9880,7 @@ cogorc_convert_Y42B_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -8760,9 +9907,10 @@ cogorc_convert_Y42B_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, /* cogorc_convert_Y42B_AYUV */ #ifdef DISABLE_ORC void -cogorc_convert_Y42B_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y42B_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, + const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { int i; int j; @@ -8786,8 +9934,8 @@ cogorc_convert_Y42B_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, ptr6 = ORC_PTR_OFFSET (s3, s3_stride * j); /* 3: loadpb */ - var38.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var38.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var38.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var38.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -8795,24 +9943,47 @@ cogorc_convert_Y42B_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, /* 1: loadb */ var37 = ptr6[i]; /* 2: mergebw */ - var41.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var41.i = _dest.i; + } /* 4: loadw */ var39 = ptr4[i]; /* 5: mergebw */ - var42.x2[0] = - ((orc_uint8) var38.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var42.x2[1] = - ((orc_uint8) var38.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[0]; + _dest.x2[1] = var39.x2[0]; + var42.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[1]; + _dest.x2[1] = var39.x2[1]; + var42.x2[1] = _dest.i; + } /* 6: mergewl */ - var43.i = - ((orc_uint16) var41.i & 0x0000ffff) | ((orc_uint16) var41.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.i; + _dest.x2[1] = var41.i; + var43.i = _dest.i; + } /* 7: mergewl */ - var40.x2[0] = - ((orc_uint16) var42.x2[0] & 0x0000ffff) | ((orc_uint16) var43. - x2[0] << 16); - var40.x2[1] = - ((orc_uint16) var42.x2[1] & 0x0000ffff) | ((orc_uint16) var43. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var42.x2[0]; + _dest.x2[1] = var43.x2[0]; + var40.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var42.x2[1]; + _dest.x2[1] = var43.x2[1]; + var40.x2[1] = _dest.i; + } /* 8: storeq */ ptr0[i] = var40; } @@ -8822,7 +9993,7 @@ cogorc_convert_Y42B_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, #else static void -_backup_cogorc_convert_Y42B_AYUV (OrcExecutor * ex) +_backup_cogorc_convert_Y42B_AYUV (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -8848,8 +10019,8 @@ _backup_cogorc_convert_Y42B_AYUV (OrcExecutor * ex) ptr6 = ORC_PTR_OFFSET (ex->arrays[6], ex->params[6] * j); /* 3: loadpb */ - var38.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var38.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var38.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var38.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -8857,24 +10028,47 @@ _backup_cogorc_convert_Y42B_AYUV (OrcExecutor * ex) /* 1: loadb */ var37 = ptr6[i]; /* 2: mergebw */ - var41.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var41.i = _dest.i; + } /* 4: loadw */ var39 = ptr4[i]; /* 5: mergebw */ - var42.x2[0] = - ((orc_uint8) var38.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var42.x2[1] = - ((orc_uint8) var38.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[0]; + _dest.x2[1] = var39.x2[0]; + var42.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[1]; + _dest.x2[1] = var39.x2[1]; + var42.x2[1] = _dest.i; + } /* 6: mergewl */ - var43.i = - ((orc_uint16) var41.i & 0x0000ffff) | ((orc_uint16) var41.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.i; + _dest.x2[1] = var41.i; + var43.i = _dest.i; + } /* 7: mergewl */ - var40.x2[0] = - ((orc_uint16) var42.x2[0] & 0x0000ffff) | ((orc_uint16) var43. - x2[0] << 16); - var40.x2[1] = - ((orc_uint16) var42.x2[1] & 0x0000ffff) | ((orc_uint16) var43. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var42.x2[0]; + _dest.x2[1] = var43.x2[0]; + var40.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var42.x2[1]; + _dest.x2[1] = var43.x2[1]; + var40.x2[1] = _dest.i; + } /* 8: storeq */ ptr0[i] = var40; } @@ -8883,9 +10077,10 @@ _backup_cogorc_convert_Y42B_AYUV (OrcExecutor * ex) } void -cogorc_convert_Y42B_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y42B_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, + const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -8895,7 +10090,6 @@ cogorc_convert_Y42B_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -8920,7 +10114,7 @@ cogorc_convert_Y42B_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -8947,9 +10141,10 @@ cogorc_convert_Y42B_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, /* cogorc_convert_Y444_YUY2 */ #ifdef DISABLE_ORC void -cogorc_convert_Y444_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y444_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, + const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { int i; int j; @@ -8979,13 +10174,25 @@ cogorc_convert_Y444_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, /* 1: loadw */ var37 = ptr6[i]; /* 2: mergebw */ - var40.x2[0] = - ((orc_uint8) var36.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var40.x2[1] = - ((orc_uint8) var36.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[0]; + _dest.x2[1] = var37.x2[0]; + var40.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[1]; + _dest.x2[1] = var37.x2[1]; + var40.x2[1] = _dest.i; + } /* 3: splitlw */ - var41.i = (var40.i >> 16) & 0xffff; - var42.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 4: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; @@ -8994,10 +10201,18 @@ cogorc_convert_Y444_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, /* 5: loadw */ var38 = ptr4[i]; /* 6: mergebw */ - var39.x2[0] = - ((orc_uint8) var38.x2[0] & 0x00ff) | ((orc_uint8) var43.x2[0] << 8); - var39.x2[1] = - ((orc_uint8) var38.x2[1] & 0x00ff) | ((orc_uint8) var43.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[0]; + _dest.x2[1] = var43.x2[0]; + var39.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[1]; + _dest.x2[1] = var43.x2[1]; + var39.x2[1] = _dest.i; + } /* 7: storel */ ptr0[i] = var39; } @@ -9007,7 +10222,7 @@ cogorc_convert_Y444_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, #else static void -_backup_cogorc_convert_Y444_YUY2 (OrcExecutor * ex) +_backup_cogorc_convert_Y444_YUY2 (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -9039,13 +10254,25 @@ _backup_cogorc_convert_Y444_YUY2 (OrcExecutor * ex) /* 1: loadw */ var37 = ptr6[i]; /* 2: mergebw */ - var40.x2[0] = - ((orc_uint8) var36.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var40.x2[1] = - ((orc_uint8) var36.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[0]; + _dest.x2[1] = var37.x2[0]; + var40.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[1]; + _dest.x2[1] = var37.x2[1]; + var40.x2[1] = _dest.i; + } /* 3: splitlw */ - var41.i = (var40.i >> 16) & 0xffff; - var42.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 4: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; @@ -9054,10 +10281,18 @@ _backup_cogorc_convert_Y444_YUY2 (OrcExecutor * ex) /* 5: loadw */ var38 = ptr4[i]; /* 6: mergebw */ - var39.x2[0] = - ((orc_uint8) var38.x2[0] & 0x00ff) | ((orc_uint8) var43.x2[0] << 8); - var39.x2[1] = - ((orc_uint8) var38.x2[1] & 0x00ff) | ((orc_uint8) var43.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[0]; + _dest.x2[1] = var43.x2[0]; + var39.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[1]; + _dest.x2[1] = var43.x2[1]; + var39.x2[1] = _dest.i; + } /* 7: storel */ ptr0[i] = var39; } @@ -9066,9 +10301,10 @@ _backup_cogorc_convert_Y444_YUY2 (OrcExecutor * ex) } void -cogorc_convert_Y444_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y444_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, + const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -9078,7 +10314,6 @@ cogorc_convert_Y444_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -9102,7 +10337,7 @@ cogorc_convert_Y444_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -9129,9 +10364,10 @@ cogorc_convert_Y444_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, /* cogorc_convert_Y444_UYVY */ #ifdef DISABLE_ORC void -cogorc_convert_Y444_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y444_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, + const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { int i; int j; @@ -9161,13 +10397,25 @@ cogorc_convert_Y444_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, /* 1: loadw */ var37 = ptr6[i]; /* 2: mergebw */ - var40.x2[0] = - ((orc_uint8) var36.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var40.x2[1] = - ((orc_uint8) var36.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[0]; + _dest.x2[1] = var37.x2[0]; + var40.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[1]; + _dest.x2[1] = var37.x2[1]; + var40.x2[1] = _dest.i; + } /* 3: splitlw */ - var41.i = (var40.i >> 16) & 0xffff; - var42.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 4: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; @@ -9176,10 +10424,18 @@ cogorc_convert_Y444_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, /* 5: loadw */ var38 = ptr4[i]; /* 6: mergebw */ - var39.x2[0] = - ((orc_uint8) var43.x2[0] & 0x00ff) | ((orc_uint8) var38.x2[0] << 8); - var39.x2[1] = - ((orc_uint8) var43.x2[1] & 0x00ff) | ((orc_uint8) var38.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[0]; + _dest.x2[1] = var38.x2[0]; + var39.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[1]; + _dest.x2[1] = var38.x2[1]; + var39.x2[1] = _dest.i; + } /* 7: storel */ ptr0[i] = var39; } @@ -9189,7 +10445,7 @@ cogorc_convert_Y444_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, #else static void -_backup_cogorc_convert_Y444_UYVY (OrcExecutor * ex) +_backup_cogorc_convert_Y444_UYVY (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -9221,13 +10477,25 @@ _backup_cogorc_convert_Y444_UYVY (OrcExecutor * ex) /* 1: loadw */ var37 = ptr6[i]; /* 2: mergebw */ - var40.x2[0] = - ((orc_uint8) var36.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var40.x2[1] = - ((orc_uint8) var36.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[0]; + _dest.x2[1] = var37.x2[0]; + var40.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[1]; + _dest.x2[1] = var37.x2[1]; + var40.x2[1] = _dest.i; + } /* 3: splitlw */ - var41.i = (var40.i >> 16) & 0xffff; - var42.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 4: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; @@ -9236,10 +10504,18 @@ _backup_cogorc_convert_Y444_UYVY (OrcExecutor * ex) /* 5: loadw */ var38 = ptr4[i]; /* 6: mergebw */ - var39.x2[0] = - ((orc_uint8) var43.x2[0] & 0x00ff) | ((orc_uint8) var38.x2[0] << 8); - var39.x2[1] = - ((orc_uint8) var43.x2[1] & 0x00ff) | ((orc_uint8) var38.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[0]; + _dest.x2[1] = var38.x2[0]; + var39.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[1]; + _dest.x2[1] = var38.x2[1]; + var39.x2[1] = _dest.i; + } /* 7: storel */ ptr0[i] = var39; } @@ -9248,9 +10524,10 @@ _backup_cogorc_convert_Y444_UYVY (OrcExecutor * ex) } void -cogorc_convert_Y444_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y444_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, + const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -9260,7 +10537,6 @@ cogorc_convert_Y444_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -9284,7 +10560,7 @@ cogorc_convert_Y444_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_S1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -9311,9 +10587,10 @@ cogorc_convert_Y444_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, /* cogorc_convert_Y444_AYUV */ #ifdef DISABLE_ORC void -cogorc_convert_Y444_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y444_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, + const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { int i; int j; @@ -9336,7 +10613,7 @@ cogorc_convert_Y444_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, ptr6 = ORC_PTR_OFFSET (s3, s3_stride * j); /* 3: loadpb */ - var36 = 0x000000ff; /* 255 or 1.25987e-321f */ + var36 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -9344,14 +10621,28 @@ cogorc_convert_Y444_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, /* 1: loadb */ var35 = ptr6[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var34; + _dest.x2[1] = var35; + var39.i = _dest.i; + } /* 4: loadb */ var37 = ptr4[i]; /* 5: mergebw */ - var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var40.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var40.i & 0x0000ffff) | ((orc_uint16) var39.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var40.i; + _dest.x2[1] = var39.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -9361,7 +10652,7 @@ cogorc_convert_Y444_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, #else static void -_backup_cogorc_convert_Y444_AYUV (OrcExecutor * ex) +_backup_cogorc_convert_Y444_AYUV (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -9386,7 +10677,7 @@ _backup_cogorc_convert_Y444_AYUV (OrcExecutor * ex) ptr6 = ORC_PTR_OFFSET (ex->arrays[6], ex->params[6] * j); /* 3: loadpb */ - var36 = 0x000000ff; /* 255 or 1.25987e-321f */ + var36 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -9394,14 +10685,28 @@ _backup_cogorc_convert_Y444_AYUV (OrcExecutor * ex) /* 1: loadb */ var35 = ptr6[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var34; + _dest.x2[1] = var35; + var39.i = _dest.i; + } /* 4: loadb */ var37 = ptr4[i]; /* 5: mergebw */ - var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var40.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var40.i & 0x0000ffff) | ((orc_uint16) var39.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var40.i; + _dest.x2[1] = var39.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -9410,9 +10715,10 @@ _backup_cogorc_convert_Y444_AYUV (OrcExecutor * ex) } void -cogorc_convert_Y444_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, - int s3_stride, int n, int m) +cogorc_convert_Y444_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, + const guint8 * ORC_RESTRICT s2, int s2_stride, + const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -9422,7 +10728,6 @@ cogorc_convert_Y444_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -9443,7 +10748,7 @@ cogorc_convert_Y444_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -9470,8 +10775,8 @@ cogorc_convert_Y444_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, /* cogorc_convert_AYUV_ARGB */ #ifdef DISABLE_ORC void -cogorc_convert_AYUV_ARGB (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_ARGB (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -9528,25 +10833,25 @@ cogorc_convert_AYUV_ARGB (guint8 * d1, int d1_stride, const guint8 * s1, ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); /* 1: loadpb */ - var49.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 14: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 21: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 25: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 29: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 40: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadl */ @@ -9557,14 +10862,26 @@ cogorc_convert_AYUV_ARGB (guint8 * d1, int d1_stride, const guint8 * s1, var57.x4[2] = var48.x4[2] - var49.x4[2]; var57.x4[3] = var48.x4[3] - var49.x4[3]; /* 3: splitlw */ - var58.i = (var57.i >> 16) & 0xffff; - var59.i = var57.i & 0xffff; + { + orc_union32 _src; + _src.i = var57.i; + var58.i = _src.x2[1]; + var59.i = _src.x2[0]; + } /* 4: splitwb */ - var60 = (var59.i >> 8) & 0xff; - var61 = var59.i & 0xff; + { + orc_union16 _src; + _src.i = var59.i; + var60 = _src.x2[1]; + var61 = _src.x2[0]; + } /* 5: splitwb */ - var62 = (var58.i >> 8) & 0xff; - var63 = var58.i & 0xff; + { + orc_union16 _src; + _src.i = var58.i; + var62 = _src.x2[1]; + var63 = _src.x2[0]; + } /* 6: convsbw */ var64.i = var60; /* 7: convsbw */ @@ -9618,12 +10935,26 @@ cogorc_convert_AYUV_ARGB (guint8 * d1, int d1_stride, const guint8 * s1, /* 36: convssswb */ var89 = ORC_CLAMP_SB (var79.i); /* 37: mergebw */ - var90.i = ((orc_uint8) var61 & 0x00ff) | ((orc_uint8) var87 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var61; + _dest.x2[1] = var87; + var90.i = _dest.i; + } /* 38: mergebw */ - var91.i = ((orc_uint8) var88 & 0x00ff) | ((orc_uint8) var89 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var88; + _dest.x2[1] = var89; + var91.i = _dest.i; + } /* 39: mergewl */ - var92.i = - ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var90.i; + _dest.x2[1] = var91.i; + var92.i = _dest.i; + } /* 41: addb */ var56.x4[0] = var92.x4[0] + var55.x4[0]; var56.x4[1] = var92.x4[1] + var55.x4[1]; @@ -9638,7 +10969,7 @@ cogorc_convert_AYUV_ARGB (guint8 * d1, int d1_stride, const guint8 * s1, #else static void -_backup_cogorc_convert_AYUV_ARGB (OrcExecutor * ex) +_backup_cogorc_convert_AYUV_ARGB (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -9697,25 +11028,25 @@ _backup_cogorc_convert_AYUV_ARGB (OrcExecutor * ex) ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); /* 1: loadpb */ - var49.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 14: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 21: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 25: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 29: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 40: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadl */ @@ -9726,14 +11057,26 @@ _backup_cogorc_convert_AYUV_ARGB (OrcExecutor * ex) var57.x4[2] = var48.x4[2] - var49.x4[2]; var57.x4[3] = var48.x4[3] - var49.x4[3]; /* 3: splitlw */ - var58.i = (var57.i >> 16) & 0xffff; - var59.i = var57.i & 0xffff; + { + orc_union32 _src; + _src.i = var57.i; + var58.i = _src.x2[1]; + var59.i = _src.x2[0]; + } /* 4: splitwb */ - var60 = (var59.i >> 8) & 0xff; - var61 = var59.i & 0xff; + { + orc_union16 _src; + _src.i = var59.i; + var60 = _src.x2[1]; + var61 = _src.x2[0]; + } /* 5: splitwb */ - var62 = (var58.i >> 8) & 0xff; - var63 = var58.i & 0xff; + { + orc_union16 _src; + _src.i = var58.i; + var62 = _src.x2[1]; + var63 = _src.x2[0]; + } /* 6: convsbw */ var64.i = var60; /* 7: convsbw */ @@ -9787,12 +11130,26 @@ _backup_cogorc_convert_AYUV_ARGB (OrcExecutor * ex) /* 36: convssswb */ var89 = ORC_CLAMP_SB (var79.i); /* 37: mergebw */ - var90.i = ((orc_uint8) var61 & 0x00ff) | ((orc_uint8) var87 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var61; + _dest.x2[1] = var87; + var90.i = _dest.i; + } /* 38: mergebw */ - var91.i = ((orc_uint8) var88 & 0x00ff) | ((orc_uint8) var89 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var88; + _dest.x2[1] = var89; + var91.i = _dest.i; + } /* 39: mergewl */ - var92.i = - ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var90.i; + _dest.x2[1] = var91.i; + var92.i = _dest.i; + } /* 41: addb */ var56.x4[0] = var92.x4[0] + var55.x4[0]; var56.x4[1] = var92.x4[1] + var55.x4[1]; @@ -9806,8 +11163,8 @@ _backup_cogorc_convert_AYUV_ARGB (OrcExecutor * ex) } void -cogorc_convert_AYUV_ARGB (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_ARGB (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -9817,7 +11174,6 @@ cogorc_convert_AYUV_ARGB (guint8 * d1, int d1_stride, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -9918,7 +11274,7 @@ cogorc_convert_AYUV_ARGB (guint8 * d1, int d1_stride, const guint8 * s1, orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, 47, ORC_VAR_C2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -9941,8 +11297,8 @@ cogorc_convert_AYUV_ARGB (guint8 * d1, int d1_stride, const guint8 * s1, /* cogorc_convert_AYUV_BGRA */ #ifdef DISABLE_ORC void -cogorc_convert_AYUV_BGRA (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_BGRA (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -9999,25 +11355,25 @@ cogorc_convert_AYUV_BGRA (guint8 * d1, int d1_stride, const guint8 * s1, ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); /* 1: loadpb */ - var49.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 14: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 21: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 25: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 29: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 40: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadl */ @@ -10028,14 +11384,26 @@ cogorc_convert_AYUV_BGRA (guint8 * d1, int d1_stride, const guint8 * s1, var57.x4[2] = var48.x4[2] - var49.x4[2]; var57.x4[3] = var48.x4[3] - var49.x4[3]; /* 3: splitlw */ - var58.i = (var57.i >> 16) & 0xffff; - var59.i = var57.i & 0xffff; + { + orc_union32 _src; + _src.i = var57.i; + var58.i = _src.x2[1]; + var59.i = _src.x2[0]; + } /* 4: splitwb */ - var60 = (var59.i >> 8) & 0xff; - var61 = var59.i & 0xff; + { + orc_union16 _src; + _src.i = var59.i; + var60 = _src.x2[1]; + var61 = _src.x2[0]; + } /* 5: splitwb */ - var62 = (var58.i >> 8) & 0xff; - var63 = var58.i & 0xff; + { + orc_union16 _src; + _src.i = var58.i; + var62 = _src.x2[1]; + var63 = _src.x2[0]; + } /* 6: convsbw */ var64.i = var60; /* 7: convsbw */ @@ -10089,12 +11457,26 @@ cogorc_convert_AYUV_BGRA (guint8 * d1, int d1_stride, const guint8 * s1, /* 36: convssswb */ var89 = ORC_CLAMP_SB (var79.i); /* 37: mergebw */ - var90.i = ((orc_uint8) var89 & 0x00ff) | ((orc_uint8) var88 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var89; + _dest.x2[1] = var88; + var90.i = _dest.i; + } /* 38: mergebw */ - var91.i = ((orc_uint8) var87 & 0x00ff) | ((orc_uint8) var61 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var87; + _dest.x2[1] = var61; + var91.i = _dest.i; + } /* 39: mergewl */ - var92.i = - ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var90.i; + _dest.x2[1] = var91.i; + var92.i = _dest.i; + } /* 41: addb */ var56.x4[0] = var92.x4[0] + var55.x4[0]; var56.x4[1] = var92.x4[1] + var55.x4[1]; @@ -10109,7 +11491,7 @@ cogorc_convert_AYUV_BGRA (guint8 * d1, int d1_stride, const guint8 * s1, #else static void -_backup_cogorc_convert_AYUV_BGRA (OrcExecutor * ex) +_backup_cogorc_convert_AYUV_BGRA (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -10168,25 +11550,25 @@ _backup_cogorc_convert_AYUV_BGRA (OrcExecutor * ex) ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); /* 1: loadpb */ - var49.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 14: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 21: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 25: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 29: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 40: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadl */ @@ -10197,14 +11579,26 @@ _backup_cogorc_convert_AYUV_BGRA (OrcExecutor * ex) var57.x4[2] = var48.x4[2] - var49.x4[2]; var57.x4[3] = var48.x4[3] - var49.x4[3]; /* 3: splitlw */ - var58.i = (var57.i >> 16) & 0xffff; - var59.i = var57.i & 0xffff; + { + orc_union32 _src; + _src.i = var57.i; + var58.i = _src.x2[1]; + var59.i = _src.x2[0]; + } /* 4: splitwb */ - var60 = (var59.i >> 8) & 0xff; - var61 = var59.i & 0xff; + { + orc_union16 _src; + _src.i = var59.i; + var60 = _src.x2[1]; + var61 = _src.x2[0]; + } /* 5: splitwb */ - var62 = (var58.i >> 8) & 0xff; - var63 = var58.i & 0xff; + { + orc_union16 _src; + _src.i = var58.i; + var62 = _src.x2[1]; + var63 = _src.x2[0]; + } /* 6: convsbw */ var64.i = var60; /* 7: convsbw */ @@ -10258,12 +11652,26 @@ _backup_cogorc_convert_AYUV_BGRA (OrcExecutor * ex) /* 36: convssswb */ var89 = ORC_CLAMP_SB (var79.i); /* 37: mergebw */ - var90.i = ((orc_uint8) var89 & 0x00ff) | ((orc_uint8) var88 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var89; + _dest.x2[1] = var88; + var90.i = _dest.i; + } /* 38: mergebw */ - var91.i = ((orc_uint8) var87 & 0x00ff) | ((orc_uint8) var61 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var87; + _dest.x2[1] = var61; + var91.i = _dest.i; + } /* 39: mergewl */ - var92.i = - ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var90.i; + _dest.x2[1] = var91.i; + var92.i = _dest.i; + } /* 41: addb */ var56.x4[0] = var92.x4[0] + var55.x4[0]; var56.x4[1] = var92.x4[1] + var55.x4[1]; @@ -10277,8 +11685,8 @@ _backup_cogorc_convert_AYUV_BGRA (OrcExecutor * ex) } void -cogorc_convert_AYUV_BGRA (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_BGRA (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -10288,7 +11696,6 @@ cogorc_convert_AYUV_BGRA (guint8 * d1, int d1_stride, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -10389,7 +11796,7 @@ cogorc_convert_AYUV_BGRA (guint8 * d1, int d1_stride, const guint8 * s1, orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, 47, ORC_VAR_C2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -10412,8 +11819,8 @@ cogorc_convert_AYUV_BGRA (guint8 * d1, int d1_stride, const guint8 * s1, /* cogorc_convert_AYUV_ABGR */ #ifdef DISABLE_ORC void -cogorc_convert_AYUV_ABGR (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_ABGR (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -10470,25 +11877,25 @@ cogorc_convert_AYUV_ABGR (guint8 * d1, int d1_stride, const guint8 * s1, ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); /* 1: loadpb */ - var49.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 14: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 21: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 25: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 29: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 40: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadl */ @@ -10499,14 +11906,26 @@ cogorc_convert_AYUV_ABGR (guint8 * d1, int d1_stride, const guint8 * s1, var57.x4[2] = var48.x4[2] - var49.x4[2]; var57.x4[3] = var48.x4[3] - var49.x4[3]; /* 3: splitlw */ - var58.i = (var57.i >> 16) & 0xffff; - var59.i = var57.i & 0xffff; + { + orc_union32 _src; + _src.i = var57.i; + var58.i = _src.x2[1]; + var59.i = _src.x2[0]; + } /* 4: splitwb */ - var60 = (var59.i >> 8) & 0xff; - var61 = var59.i & 0xff; + { + orc_union16 _src; + _src.i = var59.i; + var60 = _src.x2[1]; + var61 = _src.x2[0]; + } /* 5: splitwb */ - var62 = (var58.i >> 8) & 0xff; - var63 = var58.i & 0xff; + { + orc_union16 _src; + _src.i = var58.i; + var62 = _src.x2[1]; + var63 = _src.x2[0]; + } /* 6: convsbw */ var64.i = var60; /* 7: convsbw */ @@ -10560,12 +11979,26 @@ cogorc_convert_AYUV_ABGR (guint8 * d1, int d1_stride, const guint8 * s1, /* 36: convssswb */ var89 = ORC_CLAMP_SB (var79.i); /* 37: mergebw */ - var90.i = ((orc_uint8) var61 & 0x00ff) | ((orc_uint8) var89 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var61; + _dest.x2[1] = var89; + var90.i = _dest.i; + } /* 38: mergebw */ - var91.i = ((orc_uint8) var88 & 0x00ff) | ((orc_uint8) var87 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var88; + _dest.x2[1] = var87; + var91.i = _dest.i; + } /* 39: mergewl */ - var92.i = - ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var90.i; + _dest.x2[1] = var91.i; + var92.i = _dest.i; + } /* 41: addb */ var56.x4[0] = var92.x4[0] + var55.x4[0]; var56.x4[1] = var92.x4[1] + var55.x4[1]; @@ -10580,7 +12013,7 @@ cogorc_convert_AYUV_ABGR (guint8 * d1, int d1_stride, const guint8 * s1, #else static void -_backup_cogorc_convert_AYUV_ABGR (OrcExecutor * ex) +_backup_cogorc_convert_AYUV_ABGR (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -10639,25 +12072,25 @@ _backup_cogorc_convert_AYUV_ABGR (OrcExecutor * ex) ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); /* 1: loadpb */ - var49.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 14: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 21: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 25: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 29: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 40: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadl */ @@ -10668,14 +12101,26 @@ _backup_cogorc_convert_AYUV_ABGR (OrcExecutor * ex) var57.x4[2] = var48.x4[2] - var49.x4[2]; var57.x4[3] = var48.x4[3] - var49.x4[3]; /* 3: splitlw */ - var58.i = (var57.i >> 16) & 0xffff; - var59.i = var57.i & 0xffff; + { + orc_union32 _src; + _src.i = var57.i; + var58.i = _src.x2[1]; + var59.i = _src.x2[0]; + } /* 4: splitwb */ - var60 = (var59.i >> 8) & 0xff; - var61 = var59.i & 0xff; + { + orc_union16 _src; + _src.i = var59.i; + var60 = _src.x2[1]; + var61 = _src.x2[0]; + } /* 5: splitwb */ - var62 = (var58.i >> 8) & 0xff; - var63 = var58.i & 0xff; + { + orc_union16 _src; + _src.i = var58.i; + var62 = _src.x2[1]; + var63 = _src.x2[0]; + } /* 6: convsbw */ var64.i = var60; /* 7: convsbw */ @@ -10729,12 +12174,26 @@ _backup_cogorc_convert_AYUV_ABGR (OrcExecutor * ex) /* 36: convssswb */ var89 = ORC_CLAMP_SB (var79.i); /* 37: mergebw */ - var90.i = ((orc_uint8) var61 & 0x00ff) | ((orc_uint8) var89 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var61; + _dest.x2[1] = var89; + var90.i = _dest.i; + } /* 38: mergebw */ - var91.i = ((orc_uint8) var88 & 0x00ff) | ((orc_uint8) var87 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var88; + _dest.x2[1] = var87; + var91.i = _dest.i; + } /* 39: mergewl */ - var92.i = - ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var90.i; + _dest.x2[1] = var91.i; + var92.i = _dest.i; + } /* 41: addb */ var56.x4[0] = var92.x4[0] + var55.x4[0]; var56.x4[1] = var92.x4[1] + var55.x4[1]; @@ -10748,8 +12207,8 @@ _backup_cogorc_convert_AYUV_ABGR (OrcExecutor * ex) } void -cogorc_convert_AYUV_ABGR (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_ABGR (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -10759,7 +12218,6 @@ cogorc_convert_AYUV_ABGR (guint8 * d1, int d1_stride, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -10860,7 +12318,7 @@ cogorc_convert_AYUV_ABGR (guint8 * d1, int d1_stride, const guint8 * s1, orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, 47, ORC_VAR_C2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -10883,8 +12341,8 @@ cogorc_convert_AYUV_ABGR (guint8 * d1, int d1_stride, const guint8 * s1, /* cogorc_convert_AYUV_RGBA */ #ifdef DISABLE_ORC void -cogorc_convert_AYUV_RGBA (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_RGBA (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { int i; int j; @@ -10941,25 +12399,25 @@ cogorc_convert_AYUV_RGBA (guint8 * d1, int d1_stride, const guint8 * s1, ptr4 = ORC_PTR_OFFSET (s1, s1_stride * j); /* 1: loadpb */ - var49.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 14: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 21: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 25: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 29: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 40: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadl */ @@ -10970,14 +12428,26 @@ cogorc_convert_AYUV_RGBA (guint8 * d1, int d1_stride, const guint8 * s1, var57.x4[2] = var48.x4[2] - var49.x4[2]; var57.x4[3] = var48.x4[3] - var49.x4[3]; /* 3: splitlw */ - var58.i = (var57.i >> 16) & 0xffff; - var59.i = var57.i & 0xffff; + { + orc_union32 _src; + _src.i = var57.i; + var58.i = _src.x2[1]; + var59.i = _src.x2[0]; + } /* 4: splitwb */ - var60 = (var59.i >> 8) & 0xff; - var61 = var59.i & 0xff; + { + orc_union16 _src; + _src.i = var59.i; + var60 = _src.x2[1]; + var61 = _src.x2[0]; + } /* 5: splitwb */ - var62 = (var58.i >> 8) & 0xff; - var63 = var58.i & 0xff; + { + orc_union16 _src; + _src.i = var58.i; + var62 = _src.x2[1]; + var63 = _src.x2[0]; + } /* 6: convsbw */ var64.i = var60; /* 7: convsbw */ @@ -11031,12 +12501,26 @@ cogorc_convert_AYUV_RGBA (guint8 * d1, int d1_stride, const guint8 * s1, /* 36: convssswb */ var89 = ORC_CLAMP_SB (var79.i); /* 37: mergebw */ - var90.i = ((orc_uint8) var87 & 0x00ff) | ((orc_uint8) var88 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var87; + _dest.x2[1] = var88; + var90.i = _dest.i; + } /* 38: mergebw */ - var91.i = ((orc_uint8) var89 & 0x00ff) | ((orc_uint8) var61 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var89; + _dest.x2[1] = var61; + var91.i = _dest.i; + } /* 39: mergewl */ - var92.i = - ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var90.i; + _dest.x2[1] = var91.i; + var92.i = _dest.i; + } /* 41: addb */ var56.x4[0] = var92.x4[0] + var55.x4[0]; var56.x4[1] = var92.x4[1] + var55.x4[1]; @@ -11051,7 +12535,7 @@ cogorc_convert_AYUV_RGBA (guint8 * d1, int d1_stride, const guint8 * s1, #else static void -_backup_cogorc_convert_AYUV_RGBA (OrcExecutor * ex) +_backup_cogorc_convert_AYUV_RGBA (OrcExecutor * ORC_RESTRICT ex) { int i; int j; @@ -11110,25 +12594,25 @@ _backup_cogorc_convert_AYUV_RGBA (OrcExecutor * ex) ptr4 = ORC_PTR_OFFSET (ex->arrays[4], ex->params[4] * j); /* 1: loadpb */ - var49.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var49.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var49.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 14: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 21: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 25: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 29: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 40: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadl */ @@ -11139,14 +12623,26 @@ _backup_cogorc_convert_AYUV_RGBA (OrcExecutor * ex) var57.x4[2] = var48.x4[2] - var49.x4[2]; var57.x4[3] = var48.x4[3] - var49.x4[3]; /* 3: splitlw */ - var58.i = (var57.i >> 16) & 0xffff; - var59.i = var57.i & 0xffff; + { + orc_union32 _src; + _src.i = var57.i; + var58.i = _src.x2[1]; + var59.i = _src.x2[0]; + } /* 4: splitwb */ - var60 = (var59.i >> 8) & 0xff; - var61 = var59.i & 0xff; + { + orc_union16 _src; + _src.i = var59.i; + var60 = _src.x2[1]; + var61 = _src.x2[0]; + } /* 5: splitwb */ - var62 = (var58.i >> 8) & 0xff; - var63 = var58.i & 0xff; + { + orc_union16 _src; + _src.i = var58.i; + var62 = _src.x2[1]; + var63 = _src.x2[0]; + } /* 6: convsbw */ var64.i = var60; /* 7: convsbw */ @@ -11200,12 +12696,26 @@ _backup_cogorc_convert_AYUV_RGBA (OrcExecutor * ex) /* 36: convssswb */ var89 = ORC_CLAMP_SB (var79.i); /* 37: mergebw */ - var90.i = ((orc_uint8) var87 & 0x00ff) | ((orc_uint8) var88 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var87; + _dest.x2[1] = var88; + var90.i = _dest.i; + } /* 38: mergebw */ - var91.i = ((orc_uint8) var89 & 0x00ff) | ((orc_uint8) var61 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var89; + _dest.x2[1] = var61; + var91.i = _dest.i; + } /* 39: mergewl */ - var92.i = - ((orc_uint16) var90.i & 0x0000ffff) | ((orc_uint16) var91.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var90.i; + _dest.x2[1] = var91.i; + var92.i = _dest.i; + } /* 41: addb */ var56.x4[0] = var92.x4[0] + var55.x4[0]; var56.x4[1] = var92.x4[1] + var55.x4[1]; @@ -11219,8 +12729,8 @@ _backup_cogorc_convert_AYUV_RGBA (OrcExecutor * ex) } void -cogorc_convert_AYUV_RGBA (guint8 * d1, int d1_stride, const guint8 * s1, - int s1_stride, int n, int m) +cogorc_convert_AYUV_RGBA (guint8 * ORC_RESTRICT d1, int d1_stride, + const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -11230,7 +12740,6 @@ cogorc_convert_AYUV_RGBA (guint8 * d1, int d1_stride, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_2d (p); @@ -11331,7 +12840,7 @@ cogorc_convert_AYUV_RGBA (guint8 * d1, int d1_stride, const guint8 * s1, orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, 47, ORC_VAR_C2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -11354,8 +12863,9 @@ cogorc_convert_AYUV_RGBA (guint8 * d1, int d1_stride, const guint8 * s1, /* cogorc_convert_I420_BGRA */ #ifdef DISABLE_ORC void -cogorc_convert_I420_BGRA (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n) +cogorc_convert_I420_BGRA (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -11415,28 +12925,28 @@ cogorc_convert_I420_BGRA (guint8 * d1, const guint8 * s1, const guint8 * s2, ptr6 = (orc_int8 *) s3; /* 1: loadpb */ - var46 = 0x00000080; /* 128 or 6.32404e-322f */ + var46 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 5: loadpb */ - var47 = 0x00000080; /* 128 or 6.32404e-322f */ + var47 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpb */ - var48 = 0x00000080; /* 128 or 6.32404e-322f */ + var48 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 12: loadpw */ - var49.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var49.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 17: loadpw */ - var50.i = 0x00000067; /* 103 or 5.08888e-322f */ + var50.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 24: loadpw */ - var51.i = 0x00000004; /* 4 or 1.97626e-323f */ + var51.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 28: loadpw */ - var52.i = 0x00000064; /* 100 or 4.94066e-322f */ + var52.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 32: loadpw */ - var53.i = 0x00000068; /* 104 or 5.13828e-322f */ + var53.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 41: loadpb */ - var54 = 0x000000ff; /* 255 or 1.25987e-321f */ + var54 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ /* 44: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -11508,12 +13018,26 @@ cogorc_convert_I420_BGRA (guint8 * d1, const guint8 * s1, const guint8 * s2, /* 39: convssswb */ var87 = ORC_CLAMP_SB (var77.i); /* 40: mergebw */ - var88.i = ((orc_uint8) var87 & 0x00ff) | ((orc_uint8) var86 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var87; + _dest.x2[1] = var86; + var88.i = _dest.i; + } /* 42: mergebw */ - var89.i = ((orc_uint8) var85 & 0x00ff) | ((orc_uint8) var54 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var85; + _dest.x2[1] = var54; + var89.i = _dest.i; + } /* 43: mergewl */ - var90.i = - ((orc_uint16) var88.i & 0x0000ffff) | ((orc_uint16) var89.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var88.i; + _dest.x2[1] = var89.i; + var90.i = _dest.i; + } /* 45: addb */ var56.x4[0] = var90.x4[0] + var55.x4[0]; var56.x4[1] = var90.x4[1] + var55.x4[1]; @@ -11527,7 +13051,7 @@ cogorc_convert_I420_BGRA (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_cogorc_convert_I420_BGRA (OrcExecutor * ex) +_backup_cogorc_convert_I420_BGRA (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -11588,28 +13112,28 @@ _backup_cogorc_convert_I420_BGRA (OrcExecutor * ex) ptr6 = (orc_int8 *) ex->arrays[6]; /* 1: loadpb */ - var46 = 0x00000080; /* 128 or 6.32404e-322f */ + var46 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 5: loadpb */ - var47 = 0x00000080; /* 128 or 6.32404e-322f */ + var47 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 9: loadpb */ - var48 = 0x00000080; /* 128 or 6.32404e-322f */ + var48 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 12: loadpw */ - var49.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var49.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 17: loadpw */ - var50.i = 0x00000067; /* 103 or 5.08888e-322f */ + var50.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 24: loadpw */ - var51.i = 0x00000004; /* 4 or 1.97626e-323f */ + var51.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 28: loadpw */ - var52.i = 0x00000064; /* 100 or 4.94066e-322f */ + var52.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 32: loadpw */ - var53.i = 0x00000068; /* 104 or 5.13828e-322f */ + var53.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 41: loadpb */ - var54 = 0x000000ff; /* 255 or 1.25987e-321f */ + var54 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ /* 44: loadpb */ - var55.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var55.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var55.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -11681,12 +13205,26 @@ _backup_cogorc_convert_I420_BGRA (OrcExecutor * ex) /* 39: convssswb */ var87 = ORC_CLAMP_SB (var77.i); /* 40: mergebw */ - var88.i = ((orc_uint8) var87 & 0x00ff) | ((orc_uint8) var86 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var87; + _dest.x2[1] = var86; + var88.i = _dest.i; + } /* 42: mergebw */ - var89.i = ((orc_uint8) var85 & 0x00ff) | ((orc_uint8) var54 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var85; + _dest.x2[1] = var54; + var89.i = _dest.i; + } /* 43: mergewl */ - var90.i = - ((orc_uint16) var88.i & 0x0000ffff) | ((orc_uint16) var89.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var88.i; + _dest.x2[1] = var89.i; + var90.i = _dest.i; + } /* 45: addb */ var56.x4[0] = var90.x4[0] + var55.x4[0]; var56.x4[1] = var90.x4[1] + var55.x4[1]; @@ -11699,8 +13237,9 @@ _backup_cogorc_convert_I420_BGRA (OrcExecutor * ex) } void -cogorc_convert_I420_BGRA (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n) +cogorc_convert_I420_BGRA (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -11710,7 +13249,6 @@ cogorc_convert_I420_BGRA (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_convert_I420_BGRA"); @@ -11812,7 +13350,7 @@ cogorc_convert_I420_BGRA (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, ORC_VAR_T13, ORC_VAR_C2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -11834,8 +13372,10 @@ cogorc_convert_I420_BGRA (guint8 * d1, const guint8 * s1, const guint8 * s2, /* cogorc_convert_I420_BGRA_avg */ #ifdef DISABLE_ORC void -cogorc_convert_I420_BGRA_avg (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, const guint8 * s4, const guint8 * s5, int n) +cogorc_convert_I420_BGRA_avg (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -11903,28 +13443,28 @@ cogorc_convert_I420_BGRA_avg (guint8 * d1, const guint8 * s1, const guint8 * s2, ptr8 = (orc_int8 *) s5; /* 1: loadpb */ - var47 = 0x00000080; /* 128 or 6.32404e-322f */ + var47 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 7: loadpb */ - var48 = 0x00000080; /* 128 or 6.32404e-322f */ + var48 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 13: loadpb */ - var49 = 0x00000080; /* 128 or 6.32404e-322f */ + var49 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 16: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 21: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 28: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 32: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 36: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 45: loadpb */ - var55 = 0x000000ff; /* 255 or 1.25987e-321f */ + var55 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ /* 48: loadpb */ - var56.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var56.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var56.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var56.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var56.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var56.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var56.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var56.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -12008,12 +13548,26 @@ cogorc_convert_I420_BGRA_avg (guint8 * d1, const guint8 * s1, const guint8 * s2, /* 43: convssswb */ var92 = ORC_CLAMP_SB (var82.i); /* 44: mergebw */ - var93.i = ((orc_uint8) var92 & 0x00ff) | ((orc_uint8) var91 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var92; + _dest.x2[1] = var91; + var93.i = _dest.i; + } /* 46: mergebw */ - var94.i = ((orc_uint8) var90 & 0x00ff) | ((orc_uint8) var55 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var90; + _dest.x2[1] = var55; + var94.i = _dest.i; + } /* 47: mergewl */ - var95.i = - ((orc_uint16) var93.i & 0x0000ffff) | ((orc_uint16) var94.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var93.i; + _dest.x2[1] = var94.i; + var95.i = _dest.i; + } /* 49: addb */ var57.x4[0] = var95.x4[0] + var56.x4[0]; var57.x4[1] = var95.x4[1] + var56.x4[1]; @@ -12027,7 +13581,7 @@ cogorc_convert_I420_BGRA_avg (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_cogorc_convert_I420_BGRA_avg (OrcExecutor * ex) +_backup_cogorc_convert_I420_BGRA_avg (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -12096,28 +13650,28 @@ _backup_cogorc_convert_I420_BGRA_avg (OrcExecutor * ex) ptr8 = (orc_int8 *) ex->arrays[8]; /* 1: loadpb */ - var47 = 0x00000080; /* 128 or 6.32404e-322f */ + var47 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 7: loadpb */ - var48 = 0x00000080; /* 128 or 6.32404e-322f */ + var48 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 13: loadpb */ - var49 = 0x00000080; /* 128 or 6.32404e-322f */ + var49 = (int) 0x00000080; /* 128 or 6.32404e-322f */ /* 16: loadpw */ - var50.i = 0x0000002a; /* 42 or 2.07508e-322f */ + var50.i = (int) 0x0000002a; /* 42 or 2.07508e-322f */ /* 21: loadpw */ - var51.i = 0x00000067; /* 103 or 5.08888e-322f */ + var51.i = (int) 0x00000067; /* 103 or 5.08888e-322f */ /* 28: loadpw */ - var52.i = 0x00000004; /* 4 or 1.97626e-323f */ + var52.i = (int) 0x00000004; /* 4 or 1.97626e-323f */ /* 32: loadpw */ - var53.i = 0x00000064; /* 100 or 4.94066e-322f */ + var53.i = (int) 0x00000064; /* 100 or 4.94066e-322f */ /* 36: loadpw */ - var54.i = 0x00000068; /* 104 or 5.13828e-322f */ + var54.i = (int) 0x00000068; /* 104 or 5.13828e-322f */ /* 45: loadpb */ - var55 = 0x000000ff; /* 255 or 1.25987e-321f */ + var55 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ /* 48: loadpb */ - var56.x4[0] = 0x00000080; /* 128 or 6.32404e-322f */ - var56.x4[1] = 0x00000080; /* 128 or 6.32404e-322f */ - var56.x4[2] = 0x00000080; /* 128 or 6.32404e-322f */ - var56.x4[3] = 0x00000080; /* 128 or 6.32404e-322f */ + var56.x4[0] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var56.x4[1] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var56.x4[2] = (int) 0x00000080; /* 128 or 6.32404e-322f */ + var56.x4[3] = (int) 0x00000080; /* 128 or 6.32404e-322f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -12201,12 +13755,26 @@ _backup_cogorc_convert_I420_BGRA_avg (OrcExecutor * ex) /* 43: convssswb */ var92 = ORC_CLAMP_SB (var82.i); /* 44: mergebw */ - var93.i = ((orc_uint8) var92 & 0x00ff) | ((orc_uint8) var91 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var92; + _dest.x2[1] = var91; + var93.i = _dest.i; + } /* 46: mergebw */ - var94.i = ((orc_uint8) var90 & 0x00ff) | ((orc_uint8) var55 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var90; + _dest.x2[1] = var55; + var94.i = _dest.i; + } /* 47: mergewl */ - var95.i = - ((orc_uint16) var93.i & 0x0000ffff) | ((orc_uint16) var94.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var93.i; + _dest.x2[1] = var94.i; + var95.i = _dest.i; + } /* 49: addb */ var57.x4[0] = var95.x4[0] + var56.x4[0]; var57.x4[1] = var95.x4[1] + var56.x4[1]; @@ -12219,8 +13787,10 @@ _backup_cogorc_convert_I420_BGRA_avg (OrcExecutor * ex) } void -cogorc_convert_I420_BGRA_avg (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, const guint8 * s4, const guint8 * s5, int n) +cogorc_convert_I420_BGRA_avg (guint8 * ORC_RESTRICT d1, + const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, + const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, + const guint8 * ORC_RESTRICT s5, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -12230,7 +13800,6 @@ cogorc_convert_I420_BGRA_avg (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_convert_I420_BGRA_avg"); @@ -12343,7 +13912,7 @@ cogorc_convert_I420_BGRA_avg (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "addb", 2, ORC_VAR_D1, ORC_VAR_T14, ORC_VAR_C2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -12367,8 +13936,8 @@ cogorc_convert_I420_BGRA_avg (guint8 * d1, const guint8 * s1, const guint8 * s2, /* cogorc_getline_I420 */ #ifdef DISABLE_ORC void -cogorc_getline_I420 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n) +cogorc_getline_I420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -12389,7 +13958,7 @@ cogorc_getline_I420 (guint8 * d1, const guint8 * s1, const guint8 * s2, ptr6 = (orc_int8 *) s3; /* 3: loadpb */ - var36 = 0x000000ff; /* 255 or 1.25987e-321f */ + var36 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadupdb */ @@ -12397,14 +13966,28 @@ cogorc_getline_I420 (guint8 * d1, const guint8 * s1, const guint8 * s2, /* 1: loadupdb */ var40 = ptr6[i >> 1]; /* 2: mergebw */ - var41.i = ((orc_uint8) var39 & 0x00ff) | ((orc_uint8) var40 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39; + _dest.x2[1] = var40; + var41.i = _dest.i; + } /* 4: loadb */ var37 = ptr4[i]; /* 5: mergebw */ - var42.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var42.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var42.i & 0x0000ffff) | ((orc_uint16) var41.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var42.i; + _dest.x2[1] = var41.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -12413,7 +13996,7 @@ cogorc_getline_I420 (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_cogorc_getline_I420 (OrcExecutor * ex) +_backup_cogorc_getline_I420 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -12435,7 +14018,7 @@ _backup_cogorc_getline_I420 (OrcExecutor * ex) ptr6 = (orc_int8 *) ex->arrays[6]; /* 3: loadpb */ - var36 = 0x000000ff; /* 255 or 1.25987e-321f */ + var36 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadupdb */ @@ -12443,14 +14026,28 @@ _backup_cogorc_getline_I420 (OrcExecutor * ex) /* 1: loadupdb */ var40 = ptr6[i >> 1]; /* 2: mergebw */ - var41.i = ((orc_uint8) var39 & 0x00ff) | ((orc_uint8) var40 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39; + _dest.x2[1] = var40; + var41.i = _dest.i; + } /* 4: loadb */ var37 = ptr4[i]; /* 5: mergebw */ - var42.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var42.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var42.i & 0x0000ffff) | ((orc_uint16) var41.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var42.i; + _dest.x2[1] = var41.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -12458,8 +14055,8 @@ _backup_cogorc_getline_I420 (OrcExecutor * ex) } void -cogorc_getline_I420 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n) +cogorc_getline_I420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -12469,7 +14066,6 @@ cogorc_getline_I420 (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_getline_I420"); @@ -12495,7 +14091,7 @@ cogorc_getline_I420 (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -12517,8 +14113,8 @@ cogorc_getline_I420 (guint8 * d1, const guint8 * s1, const guint8 * s2, /* cogorc_getline_YUV9 */ #ifdef DISABLE_ORC void -cogorc_getline_YUV9 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n) +cogorc_getline_YUV9 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n) { int i; orc_union64 *ORC_RESTRICT ptr0; @@ -12540,8 +14136,8 @@ cogorc_getline_YUV9 (guint8 * d1, const guint8 * s1, const guint8 * s2, ptr6 = (orc_int8 *) s3; /* 4: loadpb */ - var37.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var37.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadupdb */ @@ -12549,24 +14145,47 @@ cogorc_getline_YUV9 (guint8 * d1, const guint8 * s1, const guint8 * s2, /* 1: loadupdb */ var41 = ptr6[i >> 1]; /* 2: mergebw */ - var42.i = ((orc_uint8) var40 & 0x00ff) | ((orc_uint8) var41 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var40; + _dest.x2[1] = var41; + var42.i = _dest.i; + } /* 3: mergewl */ - var43.i = - ((orc_uint16) var42.i & 0x0000ffff) | ((orc_uint16) var42.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var42.i; + _dest.x2[1] = var42.i; + var43.i = _dest.i; + } /* 5: loadw */ var38 = ptr4[i]; /* 6: mergebw */ - var44.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var38.x2[0] << 8); - var44.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var38.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var38.x2[0]; + var44.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var38.x2[1]; + var44.x2[1] = _dest.i; + } /* 7: mergewl */ - var39.x2[0] = - ((orc_uint16) var44.x2[0] & 0x0000ffff) | ((orc_uint16) var43. - x2[0] << 16); - var39.x2[1] = - ((orc_uint16) var44.x2[1] & 0x0000ffff) | ((orc_uint16) var43. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var43.x2[0]; + var39.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var43.x2[1]; + var39.x2[1] = _dest.i; + } /* 8: storeq */ ptr0[i] = var39; } @@ -12575,7 +14194,7 @@ cogorc_getline_YUV9 (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_cogorc_getline_YUV9 (OrcExecutor * ex) +_backup_cogorc_getline_YUV9 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -12598,8 +14217,8 @@ _backup_cogorc_getline_YUV9 (OrcExecutor * ex) ptr6 = (orc_int8 *) ex->arrays[6]; /* 4: loadpb */ - var37.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var37.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadupdb */ @@ -12607,24 +14226,47 @@ _backup_cogorc_getline_YUV9 (OrcExecutor * ex) /* 1: loadupdb */ var41 = ptr6[i >> 1]; /* 2: mergebw */ - var42.i = ((orc_uint8) var40 & 0x00ff) | ((orc_uint8) var41 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var40; + _dest.x2[1] = var41; + var42.i = _dest.i; + } /* 3: mergewl */ - var43.i = - ((orc_uint16) var42.i & 0x0000ffff) | ((orc_uint16) var42.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var42.i; + _dest.x2[1] = var42.i; + var43.i = _dest.i; + } /* 5: loadw */ var38 = ptr4[i]; /* 6: mergebw */ - var44.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var38.x2[0] << 8); - var44.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var38.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var38.x2[0]; + var44.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var38.x2[1]; + var44.x2[1] = _dest.i; + } /* 7: mergewl */ - var39.x2[0] = - ((orc_uint16) var44.x2[0] & 0x0000ffff) | ((orc_uint16) var43. - x2[0] << 16); - var39.x2[1] = - ((orc_uint16) var44.x2[1] & 0x0000ffff) | ((orc_uint16) var43. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var43.x2[0]; + var39.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var43.x2[1]; + var39.x2[1] = _dest.i; + } /* 8: storeq */ ptr0[i] = var39; } @@ -12632,8 +14274,8 @@ _backup_cogorc_getline_YUV9 (OrcExecutor * ex) } void -cogorc_getline_YUV9 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n) +cogorc_getline_YUV9 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -12643,7 +14285,6 @@ cogorc_getline_YUV9 (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_getline_YUV9"); @@ -12672,7 +14313,7 @@ cogorc_getline_YUV9 (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -12694,7 +14335,8 @@ cogorc_getline_YUV9 (guint8 * d1, const guint8 * s1, const guint8 * s2, /* cogorc_getline_YUY2 */ #ifdef DISABLE_ORC void -cogorc_getline_YUY2 (guint8 * d1, const guint8 * s1, int n) +cogorc_getline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_union64 *ORC_RESTRICT ptr0; @@ -12711,32 +14353,58 @@ cogorc_getline_YUY2 (guint8 * d1, const guint8 * s1, int n) ptr4 = (orc_union32 *) s1; /* 2: loadpb */ - var37.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var37.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadl */ var36 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var36.x2[0] >> 8) & 0xff; - var40.x2[0] = var36.x2[0] & 0xff; - var39.x2[1] = (var36.x2[1] >> 8) & 0xff; - var40.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 3: mergebw */ - var41.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var40.x2[0] << 8); - var41.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var40.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var40.x2[0]; + var41.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var40.x2[1]; + var41.x2[1] = _dest.i; + } /* 4: mergewl */ - var42.i = - ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var39.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var39.i; + _dest.x2[1] = var39.i; + var42.i = _dest.i; + } /* 5: mergewl */ - var38.x2[0] = - ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var42. - x2[0] << 16); - var38.x2[1] = - ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var42. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[0]; + _dest.x2[1] = var42.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[1]; + _dest.x2[1] = var42.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storeq */ ptr0[i] = var38; } @@ -12745,7 +14413,7 @@ cogorc_getline_YUY2 (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_cogorc_getline_YUY2 (OrcExecutor * ex) +_backup_cogorc_getline_YUY2 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -12763,32 +14431,58 @@ _backup_cogorc_getline_YUY2 (OrcExecutor * ex) ptr4 = (orc_union32 *) ex->arrays[4]; /* 2: loadpb */ - var37.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var37.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadl */ var36 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var36.x2[0] >> 8) & 0xff; - var40.x2[0] = var36.x2[0] & 0xff; - var39.x2[1] = (var36.x2[1] >> 8) & 0xff; - var40.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 3: mergebw */ - var41.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var40.x2[0] << 8); - var41.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var40.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var40.x2[0]; + var41.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var40.x2[1]; + var41.x2[1] = _dest.i; + } /* 4: mergewl */ - var42.i = - ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var39.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var39.i; + _dest.x2[1] = var39.i; + var42.i = _dest.i; + } /* 5: mergewl */ - var38.x2[0] = - ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var42. - x2[0] << 16); - var38.x2[1] = - ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var42. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[0]; + _dest.x2[1] = var42.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[1]; + _dest.x2[1] = var42.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storeq */ ptr0[i] = var38; } @@ -12796,7 +14490,8 @@ _backup_cogorc_getline_YUY2 (OrcExecutor * ex) } void -cogorc_getline_YUY2 (guint8 * d1, const guint8 * s1, int n) +cogorc_getline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -12806,7 +14501,6 @@ cogorc_getline_YUY2 (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_getline_YUY2"); @@ -12828,7 +14522,7 @@ cogorc_getline_YUY2 (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -12848,7 +14542,8 @@ cogorc_getline_YUY2 (guint8 * d1, const guint8 * s1, int n) /* cogorc_getline_UYVY */ #ifdef DISABLE_ORC void -cogorc_getline_UYVY (guint8 * d1, const guint8 * s1, int n) +cogorc_getline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_union64 *ORC_RESTRICT ptr0; @@ -12865,32 +14560,58 @@ cogorc_getline_UYVY (guint8 * d1, const guint8 * s1, int n) ptr4 = (orc_union32 *) s1; /* 2: loadpb */ - var37.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var37.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadl */ var36 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var36.x2[0] >> 8) & 0xff; - var40.x2[0] = var36.x2[0] & 0xff; - var39.x2[1] = (var36.x2[1] >> 8) & 0xff; - var40.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 3: mergebw */ - var41.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var41.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var39.x2[0]; + var41.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var39.x2[1]; + var41.x2[1] = _dest.i; + } /* 4: mergewl */ - var42.i = - ((orc_uint16) var40.i & 0x0000ffff) | ((orc_uint16) var40.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var40.i; + _dest.x2[1] = var40.i; + var42.i = _dest.i; + } /* 5: mergewl */ - var38.x2[0] = - ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var42. - x2[0] << 16); - var38.x2[1] = - ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var42. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[0]; + _dest.x2[1] = var42.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[1]; + _dest.x2[1] = var42.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storeq */ ptr0[i] = var38; } @@ -12899,7 +14620,7 @@ cogorc_getline_UYVY (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_cogorc_getline_UYVY (OrcExecutor * ex) +_backup_cogorc_getline_UYVY (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -12917,32 +14638,58 @@ _backup_cogorc_getline_UYVY (OrcExecutor * ex) ptr4 = (orc_union32 *) ex->arrays[4]; /* 2: loadpb */ - var37.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var37.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadl */ var36 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var36.x2[0] >> 8) & 0xff; - var40.x2[0] = var36.x2[0] & 0xff; - var39.x2[1] = (var36.x2[1] >> 8) & 0xff; - var40.x2[1] = var36.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var36.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 3: mergebw */ - var41.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var41.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var39.x2[0]; + var41.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var39.x2[1]; + var41.x2[1] = _dest.i; + } /* 4: mergewl */ - var42.i = - ((orc_uint16) var40.i & 0x0000ffff) | ((orc_uint16) var40.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var40.i; + _dest.x2[1] = var40.i; + var42.i = _dest.i; + } /* 5: mergewl */ - var38.x2[0] = - ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var42. - x2[0] << 16); - var38.x2[1] = - ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var42. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[0]; + _dest.x2[1] = var42.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[1]; + _dest.x2[1] = var42.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storeq */ ptr0[i] = var38; } @@ -12950,7 +14697,8 @@ _backup_cogorc_getline_UYVY (OrcExecutor * ex) } void -cogorc_getline_UYVY (guint8 * d1, const guint8 * s1, int n) +cogorc_getline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -12960,7 +14708,6 @@ cogorc_getline_UYVY (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_getline_UYVY"); @@ -12982,7 +14729,7 @@ cogorc_getline_UYVY (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -13002,7 +14749,8 @@ cogorc_getline_UYVY (guint8 * d1, const guint8 * s1, int n) /* cogorc_getline_YVYU */ #ifdef DISABLE_ORC void -cogorc_getline_YVYU (guint8 * d1, const guint8 * s1, int n) +cogorc_getline_YVYU (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_union64 *ORC_RESTRICT ptr0; @@ -13012,40 +14760,69 @@ cogorc_getline_YVYU (guint8 * d1, const guint8 * s1, int n) orc_union64 var38; orc_union16 var39; orc_union16 var40; - orc_union32 var41; + orc_union16 var41; orc_union32 var42; + orc_union32 var43; ptr0 = (orc_union64 *) d1; ptr4 = (orc_union32 *) s1; - /* 2: loadpb */ - var37.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var37.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + /* 3: loadpb */ + var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadl */ var36 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var36.x2[0] >> 8) & 0xff; - var40.x2[0] = var36.x2[0] & 0xff; - var39.x2[1] = (var36.x2[1] >> 8) & 0xff; - var40.x2[1] = var36.x2[1] & 0xff; - /* 3: mergebw */ - var41.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var41.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); - /* 4: mergewl */ - var42.i = - ((orc_uint16) var40.i & 0x0000ffff) | ((orc_uint16) var40.i << 16); + { + orc_union16 _src; + _src.i = var36.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } + /* 2: swapw */ + var41.i = ORC_SWAP_W (var39.i); + /* 4: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var40.x2[0]; + var42.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var40.x2[1]; + var42.x2[1] = _dest.i; + } /* 5: mergewl */ - var38.x2[0] = - ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var42. - x2[0] << 16); - var38.x2[1] = - ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var42. - x2[1] << 16); - /* 6: storeq */ + { + orc_union32 _dest; + _dest.x2[0] = var41.i; + _dest.x2[1] = var41.i; + var43.i = _dest.i; + } + /* 6: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var42.x2[0]; + _dest.x2[1] = var43.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var42.x2[1]; + _dest.x2[1] = var43.x2[1]; + var38.x2[1] = _dest.i; + } + /* 7: storeq */ ptr0[i] = var38; } @@ -13053,7 +14830,7 @@ cogorc_getline_YVYU (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_cogorc_getline_YVYU (OrcExecutor * ex) +_backup_cogorc_getline_YVYU (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -13064,47 +14841,77 @@ _backup_cogorc_getline_YVYU (OrcExecutor * ex) orc_union64 var38; orc_union16 var39; orc_union16 var40; - orc_union32 var41; + orc_union16 var41; orc_union32 var42; + orc_union32 var43; ptr0 = (orc_union64 *) ex->arrays[0]; ptr4 = (orc_union32 *) ex->arrays[4]; - /* 2: loadpb */ - var37.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var37.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + /* 3: loadpb */ + var37.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var37.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadl */ var36 = ptr4[i]; /* 1: splitwb */ - var39.x2[0] = (var36.x2[0] >> 8) & 0xff; - var40.x2[0] = var36.x2[0] & 0xff; - var39.x2[1] = (var36.x2[1] >> 8) & 0xff; - var40.x2[1] = var36.x2[1] & 0xff; - /* 3: mergebw */ - var41.x2[0] = - ((orc_uint8) var37.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var41.x2[1] = - ((orc_uint8) var37.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); - /* 4: mergewl */ - var42.i = - ((orc_uint16) var40.i & 0x0000ffff) | ((orc_uint16) var40.i << 16); + { + orc_union16 _src; + _src.i = var36.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var36.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } + /* 2: swapw */ + var41.i = ORC_SWAP_W (var39.i); + /* 4: mergebw */ + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[0]; + _dest.x2[1] = var40.x2[0]; + var42.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var37.x2[1]; + _dest.x2[1] = var40.x2[1]; + var42.x2[1] = _dest.i; + } /* 5: mergewl */ - var38.x2[0] = - ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var42. - x2[0] << 16); - var38.x2[1] = - ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var42. - x2[1] << 16); - /* 6: storeq */ + { + orc_union32 _dest; + _dest.x2[0] = var41.i; + _dest.x2[1] = var41.i; + var43.i = _dest.i; + } + /* 6: mergewl */ + { + orc_union32 _dest; + _dest.x2[0] = var42.x2[0]; + _dest.x2[1] = var43.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var42.x2[1]; + _dest.x2[1] = var43.x2[1]; + var38.x2[1] = _dest.i; + } + /* 7: storeq */ ptr0[i] = var38; } } void -cogorc_getline_YVYU (guint8 * d1, const guint8 * s1, int n) +cogorc_getline_YVYU (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -13114,7 +14921,6 @@ cogorc_getline_YVYU (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_getline_YVYU"); @@ -13127,7 +14933,9 @@ cogorc_getline_YVYU (guint8 * d1, const guint8 * s1, int n) orc_program_add_temporary (p, 4, "t3"); orc_program_add_temporary (p, 4, "t4"); - orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_S1, + orc_program_append_2 (p, "splitwb", 1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_S1, + ORC_VAR_D1); + orc_program_append_2 (p, "swapw", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_D1, ORC_VAR_D1); orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T3, ORC_VAR_C1, ORC_VAR_T1, ORC_VAR_D1); @@ -13136,7 +14944,7 @@ cogorc_getline_YVYU (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -13156,8 +14964,8 @@ cogorc_getline_YVYU (guint8 * d1, const guint8 * s1, int n) /* cogorc_getline_Y42B */ #ifdef DISABLE_ORC void -cogorc_getline_Y42B (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n) +cogorc_getline_Y42B (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n) { int i; orc_union64 *ORC_RESTRICT ptr0; @@ -13179,8 +14987,8 @@ cogorc_getline_Y42B (guint8 * d1, const guint8 * s1, const guint8 * s2, ptr6 = (orc_int8 *) s3; /* 3: loadpb */ - var38.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var38.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var38.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var38.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -13188,24 +14996,47 @@ cogorc_getline_Y42B (guint8 * d1, const guint8 * s1, const guint8 * s2, /* 1: loadb */ var37 = ptr6[i]; /* 2: mergebw */ - var41.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var41.i = _dest.i; + } /* 4: loadw */ var39 = ptr4[i]; /* 5: mergebw */ - var42.x2[0] = - ((orc_uint8) var38.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var42.x2[1] = - ((orc_uint8) var38.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[0]; + _dest.x2[1] = var39.x2[0]; + var42.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[1]; + _dest.x2[1] = var39.x2[1]; + var42.x2[1] = _dest.i; + } /* 6: mergewl */ - var43.i = - ((orc_uint16) var41.i & 0x0000ffff) | ((orc_uint16) var41.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.i; + _dest.x2[1] = var41.i; + var43.i = _dest.i; + } /* 7: mergewl */ - var40.x2[0] = - ((orc_uint16) var42.x2[0] & 0x0000ffff) | ((orc_uint16) var43. - x2[0] << 16); - var40.x2[1] = - ((orc_uint16) var42.x2[1] & 0x0000ffff) | ((orc_uint16) var43. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var42.x2[0]; + _dest.x2[1] = var43.x2[0]; + var40.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var42.x2[1]; + _dest.x2[1] = var43.x2[1]; + var40.x2[1] = _dest.i; + } /* 8: storeq */ ptr0[i] = var40; } @@ -13214,7 +15045,7 @@ cogorc_getline_Y42B (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_cogorc_getline_Y42B (OrcExecutor * ex) +_backup_cogorc_getline_Y42B (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -13237,8 +15068,8 @@ _backup_cogorc_getline_Y42B (OrcExecutor * ex) ptr6 = (orc_int8 *) ex->arrays[6]; /* 3: loadpb */ - var38.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var38.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var38.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var38.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -13246,24 +15077,47 @@ _backup_cogorc_getline_Y42B (OrcExecutor * ex) /* 1: loadb */ var37 = ptr6[i]; /* 2: mergebw */ - var41.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var41.i = _dest.i; + } /* 4: loadw */ var39 = ptr4[i]; /* 5: mergebw */ - var42.x2[0] = - ((orc_uint8) var38.x2[0] & 0x00ff) | ((orc_uint8) var39.x2[0] << 8); - var42.x2[1] = - ((orc_uint8) var38.x2[1] & 0x00ff) | ((orc_uint8) var39.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[0]; + _dest.x2[1] = var39.x2[0]; + var42.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var38.x2[1]; + _dest.x2[1] = var39.x2[1]; + var42.x2[1] = _dest.i; + } /* 6: mergewl */ - var43.i = - ((orc_uint16) var41.i & 0x0000ffff) | ((orc_uint16) var41.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.i; + _dest.x2[1] = var41.i; + var43.i = _dest.i; + } /* 7: mergewl */ - var40.x2[0] = - ((orc_uint16) var42.x2[0] & 0x0000ffff) | ((orc_uint16) var43. - x2[0] << 16); - var40.x2[1] = - ((orc_uint16) var42.x2[1] & 0x0000ffff) | ((orc_uint16) var43. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var42.x2[0]; + _dest.x2[1] = var43.x2[0]; + var40.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var42.x2[1]; + _dest.x2[1] = var43.x2[1]; + var40.x2[1] = _dest.i; + } /* 8: storeq */ ptr0[i] = var40; } @@ -13271,8 +15125,8 @@ _backup_cogorc_getline_Y42B (OrcExecutor * ex) } void -cogorc_getline_Y42B (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n) +cogorc_getline_Y42B (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -13282,7 +15136,6 @@ cogorc_getline_Y42B (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_getline_Y42B"); @@ -13306,7 +15159,7 @@ cogorc_getline_Y42B (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -13328,8 +15181,8 @@ cogorc_getline_Y42B (guint8 * d1, const guint8 * s1, const guint8 * s2, /* cogorc_getline_Y444 */ #ifdef DISABLE_ORC void -cogorc_getline_Y444 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n) +cogorc_getline_Y444 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -13350,7 +15203,7 @@ cogorc_getline_Y444 (guint8 * d1, const guint8 * s1, const guint8 * s2, ptr6 = (orc_int8 *) s3; /* 3: loadpb */ - var36 = 0x000000ff; /* 255 or 1.25987e-321f */ + var36 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -13358,14 +15211,28 @@ cogorc_getline_Y444 (guint8 * d1, const guint8 * s1, const guint8 * s2, /* 1: loadb */ var35 = ptr6[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var34; + _dest.x2[1] = var35; + var39.i = _dest.i; + } /* 4: loadb */ var37 = ptr4[i]; /* 5: mergebw */ - var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var40.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var40.i & 0x0000ffff) | ((orc_uint16) var39.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var40.i; + _dest.x2[1] = var39.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -13374,7 +15241,7 @@ cogorc_getline_Y444 (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_cogorc_getline_Y444 (OrcExecutor * ex) +_backup_cogorc_getline_Y444 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -13396,7 +15263,7 @@ _backup_cogorc_getline_Y444 (OrcExecutor * ex) ptr6 = (orc_int8 *) ex->arrays[6]; /* 3: loadpb */ - var36 = 0x000000ff; /* 255 or 1.25987e-321f */ + var36 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadb */ @@ -13404,14 +15271,28 @@ _backup_cogorc_getline_Y444 (OrcExecutor * ex) /* 1: loadb */ var35 = ptr6[i]; /* 2: mergebw */ - var39.i = ((orc_uint8) var34 & 0x00ff) | ((orc_uint8) var35 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var34; + _dest.x2[1] = var35; + var39.i = _dest.i; + } /* 4: loadb */ var37 = ptr4[i]; /* 5: mergebw */ - var40.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var40.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var40.i & 0x0000ffff) | ((orc_uint16) var39.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var40.i; + _dest.x2[1] = var39.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -13419,8 +15300,8 @@ _backup_cogorc_getline_Y444 (OrcExecutor * ex) } void -cogorc_getline_Y444 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, int n) +cogorc_getline_Y444 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -13430,7 +15311,6 @@ cogorc_getline_Y444 (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_getline_Y444"); @@ -13450,7 +15330,7 @@ cogorc_getline_Y444 (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -13472,7 +15352,8 @@ cogorc_getline_Y444 (guint8 * d1, const guint8 * s1, const guint8 * s2, /* cogorc_getline_Y800 */ #ifdef DISABLE_ORC void -cogorc_getline_Y800 (guint8 * d1, const guint8 * s1, int n) +cogorc_getline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -13487,18 +15368,27 @@ cogorc_getline_Y800 (guint8 * d1, const guint8 * s1, int n) ptr4 = (orc_int8 *) s1; /* 0: loadpb */ - var33 = 0x000000ff; /* 255 or 1.25987e-321f */ + var33 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ /* 3: loadpw */ - var35.i = 0x00008080; /* 32896 or 1.62528e-319f */ + var35.i = (int) 0x00008080; /* 32896 or 1.62528e-319f */ for (i = 0; i < n; i++) { /* 1: loadb */ var34 = ptr4[i]; /* 2: mergebw */ - var37.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var37.i = _dest.i; + } /* 4: mergewl */ - var36.i = - ((orc_uint16) var37.i & 0x0000ffff) | ((orc_uint16) var35.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var37.i; + _dest.x2[1] = var35.i; + var36.i = _dest.i; + } /* 5: storel */ ptr0[i] = var36; } @@ -13507,7 +15397,7 @@ cogorc_getline_Y800 (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_cogorc_getline_Y800 (OrcExecutor * ex) +_backup_cogorc_getline_Y800 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -13523,18 +15413,27 @@ _backup_cogorc_getline_Y800 (OrcExecutor * ex) ptr4 = (orc_int8 *) ex->arrays[4]; /* 0: loadpb */ - var33 = 0x000000ff; /* 255 or 1.25987e-321f */ + var33 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ /* 3: loadpw */ - var35.i = 0x00008080; /* 32896 or 1.62528e-319f */ + var35.i = (int) 0x00008080; /* 32896 or 1.62528e-319f */ for (i = 0; i < n; i++) { /* 1: loadb */ var34 = ptr4[i]; /* 2: mergebw */ - var37.i = ((orc_uint8) var33 & 0x00ff) | ((orc_uint8) var34 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var33; + _dest.x2[1] = var34; + var37.i = _dest.i; + } /* 4: mergewl */ - var36.i = - ((orc_uint16) var37.i & 0x0000ffff) | ((orc_uint16) var35.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var37.i; + _dest.x2[1] = var35.i; + var36.i = _dest.i; + } /* 5: storel */ ptr0[i] = var36; } @@ -13542,7 +15441,8 @@ _backup_cogorc_getline_Y800 (OrcExecutor * ex) } void -cogorc_getline_Y800 (guint8 * d1, const guint8 * s1, int n) +cogorc_getline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -13552,7 +15452,6 @@ cogorc_getline_Y800 (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_getline_Y800"); @@ -13568,7 +15467,7 @@ cogorc_getline_Y800 (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_C2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -13588,7 +15487,8 @@ cogorc_getline_Y800 (guint8 * d1, const guint8 * s1, int n) /* cogorc_getline_Y16 */ #ifdef DISABLE_ORC void -cogorc_getline_Y16 (guint8 * d1, const guint8 * s1, int n) +cogorc_getline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -13604,9 +15504,9 @@ cogorc_getline_Y16 (guint8 * d1, const guint8 * s1, int n) ptr4 = (orc_union16 *) s1; /* 2: loadpb */ - var35 = 0x000000ff; /* 255 or 1.25987e-321f */ + var35 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ /* 4: loadpw */ - var36.i = 0x00008080; /* 32896 or 1.62528e-319f */ + var36.i = (int) 0x00008080; /* 32896 or 1.62528e-319f */ for (i = 0; i < n; i++) { /* 0: loadw */ @@ -13614,10 +15514,19 @@ cogorc_getline_Y16 (guint8 * d1, const guint8 * s1, int n) /* 1: convhwb */ var38 = ((orc_uint16) var34.i) >> 8; /* 3: mergebw */ - var39.i = ((orc_uint8) var35 & 0x00ff) | ((orc_uint8) var38 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var35; + _dest.x2[1] = var38; + var39.i = _dest.i; + } /* 5: mergewl */ - var37.i = - ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var36.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var39.i; + _dest.x2[1] = var36.i; + var37.i = _dest.i; + } /* 6: storel */ ptr0[i] = var37; } @@ -13626,7 +15535,7 @@ cogorc_getline_Y16 (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_cogorc_getline_Y16 (OrcExecutor * ex) +_backup_cogorc_getline_Y16 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -13643,9 +15552,9 @@ _backup_cogorc_getline_Y16 (OrcExecutor * ex) ptr4 = (orc_union16 *) ex->arrays[4]; /* 2: loadpb */ - var35 = 0x000000ff; /* 255 or 1.25987e-321f */ + var35 = (int) 0x000000ff; /* 255 or 1.25987e-321f */ /* 4: loadpw */ - var36.i = 0x00008080; /* 32896 or 1.62528e-319f */ + var36.i = (int) 0x00008080; /* 32896 or 1.62528e-319f */ for (i = 0; i < n; i++) { /* 0: loadw */ @@ -13653,10 +15562,19 @@ _backup_cogorc_getline_Y16 (OrcExecutor * ex) /* 1: convhwb */ var38 = ((orc_uint16) var34.i) >> 8; /* 3: mergebw */ - var39.i = ((orc_uint8) var35 & 0x00ff) | ((orc_uint8) var38 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var35; + _dest.x2[1] = var38; + var39.i = _dest.i; + } /* 5: mergewl */ - var37.i = - ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var36.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var39.i; + _dest.x2[1] = var36.i; + var37.i = _dest.i; + } /* 6: storel */ ptr0[i] = var37; } @@ -13664,7 +15582,8 @@ _backup_cogorc_getline_Y16 (OrcExecutor * ex) } void -cogorc_getline_Y16 (guint8 * d1, const guint8 * s1, int n) +cogorc_getline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -13674,7 +15593,6 @@ cogorc_getline_Y16 (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_getline_Y16"); @@ -13693,7 +15611,7 @@ cogorc_getline_Y16 (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_C2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -13713,7 +15631,8 @@ cogorc_getline_Y16 (guint8 * d1, const guint8 * s1, int n) /* cogorc_getline_BGRA */ #ifdef DISABLE_ORC void -cogorc_getline_BGRA (guint8 * d1, const guint8 * s1, int n) +cogorc_getline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -13738,7 +15657,7 @@ cogorc_getline_BGRA (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_cogorc_getline_BGRA (OrcExecutor * ex) +_backup_cogorc_getline_BGRA (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -13763,7 +15682,8 @@ _backup_cogorc_getline_BGRA (OrcExecutor * ex) } void -cogorc_getline_BGRA (guint8 * d1, const guint8 * s1, int n) +cogorc_getline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -13773,7 +15693,6 @@ cogorc_getline_BGRA (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_getline_BGRA"); @@ -13784,7 +15703,7 @@ cogorc_getline_BGRA (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -13804,7 +15723,8 @@ cogorc_getline_BGRA (guint8 * d1, const guint8 * s1, int n) /* cogorc_getline_ABGR */ #ifdef DISABLE_ORC void -cogorc_getline_ABGR (guint8 * d1, const guint8 * s1, int n) +cogorc_getline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -13828,21 +15748,47 @@ cogorc_getline_ABGR (guint8 * d1, const guint8 * s1, int n) /* 0: loadl */ var40 = ptr4[i]; /* 1: splitlw */ - var42.i = (var40.i >> 16) & 0xffff; - var43.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var42.i = _src.x2[1]; + var43.i = _src.x2[0]; + } /* 2: splitwb */ - var44 = (var42.i >> 8) & 0xff; - var45 = var42.i & 0xff; + { + orc_union16 _src; + _src.i = var42.i; + var44 = _src.x2[1]; + var45 = _src.x2[0]; + } /* 3: splitwb */ - var46 = (var43.i >> 8) & 0xff; - var47 = var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var46 = _src.x2[1]; + var47 = _src.x2[0]; + } /* 4: mergebw */ - var48.i = ((orc_uint8) var47 & 0x00ff) | ((orc_uint8) var44 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var47; + _dest.x2[1] = var44; + var48.i = _dest.i; + } /* 5: mergebw */ - var49.i = ((orc_uint8) var45 & 0x00ff) | ((orc_uint8) var46 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var45; + _dest.x2[1] = var46; + var49.i = _dest.i; + } /* 6: mergewl */ - var41.i = - ((orc_uint16) var48.i & 0x0000ffff) | ((orc_uint16) var49.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var48.i; + _dest.x2[1] = var49.i; + var41.i = _dest.i; + } /* 7: storel */ ptr0[i] = var41; } @@ -13851,7 +15797,7 @@ cogorc_getline_ABGR (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_cogorc_getline_ABGR (OrcExecutor * ex) +_backup_cogorc_getline_ABGR (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -13876,21 +15822,47 @@ _backup_cogorc_getline_ABGR (OrcExecutor * ex) /* 0: loadl */ var40 = ptr4[i]; /* 1: splitlw */ - var42.i = (var40.i >> 16) & 0xffff; - var43.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var42.i = _src.x2[1]; + var43.i = _src.x2[0]; + } /* 2: splitwb */ - var44 = (var42.i >> 8) & 0xff; - var45 = var42.i & 0xff; + { + orc_union16 _src; + _src.i = var42.i; + var44 = _src.x2[1]; + var45 = _src.x2[0]; + } /* 3: splitwb */ - var46 = (var43.i >> 8) & 0xff; - var47 = var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var46 = _src.x2[1]; + var47 = _src.x2[0]; + } /* 4: mergebw */ - var48.i = ((orc_uint8) var47 & 0x00ff) | ((orc_uint8) var44 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var47; + _dest.x2[1] = var44; + var48.i = _dest.i; + } /* 5: mergebw */ - var49.i = ((orc_uint8) var45 & 0x00ff) | ((orc_uint8) var46 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var45; + _dest.x2[1] = var46; + var49.i = _dest.i; + } /* 6: mergewl */ - var41.i = - ((orc_uint16) var48.i & 0x0000ffff) | ((orc_uint16) var49.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var48.i; + _dest.x2[1] = var49.i; + var41.i = _dest.i; + } /* 7: storel */ ptr0[i] = var41; } @@ -13898,7 +15870,8 @@ _backup_cogorc_getline_ABGR (OrcExecutor * ex) } void -cogorc_getline_ABGR (guint8 * d1, const guint8 * s1, int n) +cogorc_getline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -13908,7 +15881,6 @@ cogorc_getline_ABGR (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_getline_ABGR"); @@ -13937,7 +15909,7 @@ cogorc_getline_ABGR (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T7, ORC_VAR_T8, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -13957,7 +15929,8 @@ cogorc_getline_ABGR (guint8 * d1, const guint8 * s1, int n) /* cogorc_getline_RGBA */ #ifdef DISABLE_ORC void -cogorc_getline_RGBA (guint8 * d1, const guint8 * s1, int n) +cogorc_getline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -13981,21 +15954,47 @@ cogorc_getline_RGBA (guint8 * d1, const guint8 * s1, int n) /* 0: loadl */ var40 = ptr4[i]; /* 1: splitlw */ - var42.i = (var40.i >> 16) & 0xffff; - var43.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var42.i = _src.x2[1]; + var43.i = _src.x2[0]; + } /* 2: splitwb */ - var44 = (var43.i >> 8) & 0xff; - var45 = var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var44 = _src.x2[1]; + var45 = _src.x2[0]; + } /* 3: splitwb */ - var46 = (var42.i >> 8) & 0xff; - var47 = var42.i & 0xff; + { + orc_union16 _src; + _src.i = var42.i; + var46 = _src.x2[1]; + var47 = _src.x2[0]; + } /* 4: mergebw */ - var48.i = ((orc_uint8) var46 & 0x00ff) | ((orc_uint8) var45 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var46; + _dest.x2[1] = var45; + var48.i = _dest.i; + } /* 5: mergebw */ - var49.i = ((orc_uint8) var44 & 0x00ff) | ((orc_uint8) var47 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var44; + _dest.x2[1] = var47; + var49.i = _dest.i; + } /* 6: mergewl */ - var41.i = - ((orc_uint16) var48.i & 0x0000ffff) | ((orc_uint16) var49.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var48.i; + _dest.x2[1] = var49.i; + var41.i = _dest.i; + } /* 7: storel */ ptr0[i] = var41; } @@ -14004,7 +16003,7 @@ cogorc_getline_RGBA (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_cogorc_getline_RGBA (OrcExecutor * ex) +_backup_cogorc_getline_RGBA (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -14029,21 +16028,47 @@ _backup_cogorc_getline_RGBA (OrcExecutor * ex) /* 0: loadl */ var40 = ptr4[i]; /* 1: splitlw */ - var42.i = (var40.i >> 16) & 0xffff; - var43.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var42.i = _src.x2[1]; + var43.i = _src.x2[0]; + } /* 2: splitwb */ - var44 = (var43.i >> 8) & 0xff; - var45 = var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var44 = _src.x2[1]; + var45 = _src.x2[0]; + } /* 3: splitwb */ - var46 = (var42.i >> 8) & 0xff; - var47 = var42.i & 0xff; + { + orc_union16 _src; + _src.i = var42.i; + var46 = _src.x2[1]; + var47 = _src.x2[0]; + } /* 4: mergebw */ - var48.i = ((orc_uint8) var46 & 0x00ff) | ((orc_uint8) var45 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var46; + _dest.x2[1] = var45; + var48.i = _dest.i; + } /* 5: mergebw */ - var49.i = ((orc_uint8) var44 & 0x00ff) | ((orc_uint8) var47 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var44; + _dest.x2[1] = var47; + var49.i = _dest.i; + } /* 6: mergewl */ - var41.i = - ((orc_uint16) var48.i & 0x0000ffff) | ((orc_uint16) var49.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var48.i; + _dest.x2[1] = var49.i; + var41.i = _dest.i; + } /* 7: storel */ ptr0[i] = var41; } @@ -14051,7 +16076,8 @@ _backup_cogorc_getline_RGBA (OrcExecutor * ex) } void -cogorc_getline_RGBA (guint8 * d1, const guint8 * s1, int n) +cogorc_getline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -14061,7 +16087,6 @@ cogorc_getline_RGBA (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_getline_RGBA"); @@ -14090,7 +16115,7 @@ cogorc_getline_RGBA (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T7, ORC_VAR_T8, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -14110,7 +16135,8 @@ cogorc_getline_RGBA (guint8 * d1, const guint8 * s1, int n) /* cogorc_getline_NV12 */ #ifdef DISABLE_ORC void -cogorc_getline_NV12 (guint8 * d1, const guint8 * s1, const guint8 * s2, int n) +cogorc_getline_NV12 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int n) { int i; orc_union64 *ORC_RESTRICT ptr0; @@ -14129,8 +16155,8 @@ cogorc_getline_NV12 (guint8 * d1, const guint8 * s1, const guint8 * s2, int n) ptr5 = (orc_union16 *) s2; /* 3: loadpb */ - var36.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var36.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var36.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var36.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadw */ @@ -14138,22 +16164,40 @@ cogorc_getline_NV12 (guint8 * d1, const guint8 * s1, const guint8 * s2, int n) /* 1: loadw */ var35 = ptr5[i]; /* 2: mergewl */ - var39.i = - ((orc_uint16) var34.i & 0x0000ffff) | ((orc_uint16) var35.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var34.i; + _dest.x2[1] = var35.i; + var39.i = _dest.i; + } /* 4: loadw */ var37 = ptr4[i]; /* 5: mergebw */ - var40.x2[0] = - ((orc_uint8) var36.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var40.x2[1] = - ((orc_uint8) var36.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[0]; + _dest.x2[1] = var37.x2[0]; + var40.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[1]; + _dest.x2[1] = var37.x2[1]; + var40.x2[1] = _dest.i; + } /* 6: mergewl */ - var38.x2[0] = - ((orc_uint16) var40.x2[0] & 0x0000ffff) | ((orc_uint16) var39. - x2[0] << 16); - var38.x2[1] = - ((orc_uint16) var40.x2[1] & 0x0000ffff) | ((orc_uint16) var39. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var40.x2[0]; + _dest.x2[1] = var39.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var40.x2[1]; + _dest.x2[1] = var39.x2[1]; + var38.x2[1] = _dest.i; + } /* 7: storeq */ ptr0[i] = var38; } @@ -14162,7 +16206,7 @@ cogorc_getline_NV12 (guint8 * d1, const guint8 * s1, const guint8 * s2, int n) #else static void -_backup_cogorc_getline_NV12 (OrcExecutor * ex) +_backup_cogorc_getline_NV12 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -14182,8 +16226,8 @@ _backup_cogorc_getline_NV12 (OrcExecutor * ex) ptr5 = (orc_union16 *) ex->arrays[5]; /* 3: loadpb */ - var36.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var36.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var36.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var36.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadw */ @@ -14191,22 +16235,40 @@ _backup_cogorc_getline_NV12 (OrcExecutor * ex) /* 1: loadw */ var35 = ptr5[i]; /* 2: mergewl */ - var39.i = - ((orc_uint16) var34.i & 0x0000ffff) | ((orc_uint16) var35.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var34.i; + _dest.x2[1] = var35.i; + var39.i = _dest.i; + } /* 4: loadw */ var37 = ptr4[i]; /* 5: mergebw */ - var40.x2[0] = - ((orc_uint8) var36.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var40.x2[1] = - ((orc_uint8) var36.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[0]; + _dest.x2[1] = var37.x2[0]; + var40.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[1]; + _dest.x2[1] = var37.x2[1]; + var40.x2[1] = _dest.i; + } /* 6: mergewl */ - var38.x2[0] = - ((orc_uint16) var40.x2[0] & 0x0000ffff) | ((orc_uint16) var39. - x2[0] << 16); - var38.x2[1] = - ((orc_uint16) var40.x2[1] & 0x0000ffff) | ((orc_uint16) var39. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var40.x2[0]; + _dest.x2[1] = var39.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var40.x2[1]; + _dest.x2[1] = var39.x2[1]; + var38.x2[1] = _dest.i; + } /* 7: storeq */ ptr0[i] = var38; } @@ -14214,7 +16276,8 @@ _backup_cogorc_getline_NV12 (OrcExecutor * ex) } void -cogorc_getline_NV12 (guint8 * d1, const guint8 * s1, const guint8 * s2, int n) +cogorc_getline_NV12 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -14224,7 +16287,6 @@ cogorc_getline_NV12 (guint8 * d1, const guint8 * s1, const guint8 * s2, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_getline_NV12"); @@ -14243,7 +16305,7 @@ cogorc_getline_NV12 (guint8 * d1, const guint8 * s1, const guint8 * s2, int n) orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -14264,7 +16326,8 @@ cogorc_getline_NV12 (guint8 * d1, const guint8 * s1, const guint8 * s2, int n) /* cogorc_getline_NV21 */ #ifdef DISABLE_ORC void -cogorc_getline_NV21 (guint8 * d1, const guint8 * s1, const guint8 * s2, int n) +cogorc_getline_NV21 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int n) { int i; orc_union64 *ORC_RESTRICT ptr0; @@ -14283,8 +16346,8 @@ cogorc_getline_NV21 (guint8 * d1, const guint8 * s1, const guint8 * s2, int n) ptr5 = (orc_union16 *) s2; /* 3: loadpb */ - var36.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var36.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var36.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var36.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadw */ @@ -14292,22 +16355,40 @@ cogorc_getline_NV21 (guint8 * d1, const guint8 * s1, const guint8 * s2, int n) /* 1: swapw */ var39.i = ORC_SWAP_W (var35.i); /* 2: mergewl */ - var40.i = - ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var39.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var39.i; + _dest.x2[1] = var39.i; + var40.i = _dest.i; + } /* 4: loadw */ var37 = ptr4[i]; /* 5: mergebw */ - var41.x2[0] = - ((orc_uint8) var36.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var41.x2[1] = - ((orc_uint8) var36.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[0]; + _dest.x2[1] = var37.x2[0]; + var41.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[1]; + _dest.x2[1] = var37.x2[1]; + var41.x2[1] = _dest.i; + } /* 6: mergewl */ - var38.x2[0] = - ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var40. - x2[0] << 16); - var38.x2[1] = - ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var40. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[0]; + _dest.x2[1] = var40.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[1]; + _dest.x2[1] = var40.x2[1]; + var38.x2[1] = _dest.i; + } /* 7: storeq */ ptr0[i] = var38; } @@ -14316,7 +16397,7 @@ cogorc_getline_NV21 (guint8 * d1, const guint8 * s1, const guint8 * s2, int n) #else static void -_backup_cogorc_getline_NV21 (OrcExecutor * ex) +_backup_cogorc_getline_NV21 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -14336,8 +16417,8 @@ _backup_cogorc_getline_NV21 (OrcExecutor * ex) ptr5 = (orc_union16 *) ex->arrays[5]; /* 3: loadpb */ - var36.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */ - var36.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */ + var36.x2[0] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ + var36.x2[1] = (int) 0x000000ff; /* 255 or 1.25987e-321f */ for (i = 0; i < n; i++) { /* 0: loadw */ @@ -14345,22 +16426,40 @@ _backup_cogorc_getline_NV21 (OrcExecutor * ex) /* 1: swapw */ var39.i = ORC_SWAP_W (var35.i); /* 2: mergewl */ - var40.i = - ((orc_uint16) var39.i & 0x0000ffff) | ((orc_uint16) var39.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var39.i; + _dest.x2[1] = var39.i; + var40.i = _dest.i; + } /* 4: loadw */ var37 = ptr4[i]; /* 5: mergebw */ - var41.x2[0] = - ((orc_uint8) var36.x2[0] & 0x00ff) | ((orc_uint8) var37.x2[0] << 8); - var41.x2[1] = - ((orc_uint8) var36.x2[1] & 0x00ff) | ((orc_uint8) var37.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[0]; + _dest.x2[1] = var37.x2[0]; + var41.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var36.x2[1]; + _dest.x2[1] = var37.x2[1]; + var41.x2[1] = _dest.i; + } /* 6: mergewl */ - var38.x2[0] = - ((orc_uint16) var41.x2[0] & 0x0000ffff) | ((orc_uint16) var40. - x2[0] << 16); - var38.x2[1] = - ((orc_uint16) var41.x2[1] & 0x0000ffff) | ((orc_uint16) var40. - x2[1] << 16); + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[0]; + _dest.x2[1] = var40.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union32 _dest; + _dest.x2[0] = var41.x2[1]; + _dest.x2[1] = var40.x2[1]; + var38.x2[1] = _dest.i; + } /* 7: storeq */ ptr0[i] = var38; } @@ -14368,7 +16467,8 @@ _backup_cogorc_getline_NV21 (OrcExecutor * ex) } void -cogorc_getline_NV21 (guint8 * d1, const guint8 * s1, const guint8 * s2, int n) +cogorc_getline_NV21 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -14378,7 +16478,6 @@ cogorc_getline_NV21 (guint8 * d1, const guint8 * s1, const guint8 * s2, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_getline_NV21"); @@ -14400,7 +16499,7 @@ cogorc_getline_NV21 (guint8 * d1, const guint8 * s1, const guint8 * s2, int n) orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -14421,8 +16520,9 @@ cogorc_getline_NV21 (guint8 * d1, const guint8 * s1, const guint8 * s2, int n) /* cogorc_getline_A420 */ #ifdef DISABLE_ORC void -cogorc_getline_A420 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, const guint8 * s4, int n) +cogorc_getline_A420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, + const guint8 * ORC_RESTRICT s4, int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -14451,16 +16551,30 @@ cogorc_getline_A420 (guint8 * d1, const guint8 * s1, const guint8 * s2, /* 1: loadupdb */ var40 = ptr6[i >> 1]; /* 2: mergebw */ - var41.i = ((orc_uint8) var39 & 0x00ff) | ((orc_uint8) var40 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39; + _dest.x2[1] = var40; + var41.i = _dest.i; + } /* 3: loadb */ var36 = ptr7[i]; /* 4: loadb */ var37 = ptr4[i]; /* 5: mergebw */ - var42.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var42.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var42.i & 0x0000ffff) | ((orc_uint16) var41.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var42.i; + _dest.x2[1] = var41.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -14469,7 +16583,7 @@ cogorc_getline_A420 (guint8 * d1, const guint8 * s1, const guint8 * s2, #else static void -_backup_cogorc_getline_A420 (OrcExecutor * ex) +_backup_cogorc_getline_A420 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -14499,16 +16613,30 @@ _backup_cogorc_getline_A420 (OrcExecutor * ex) /* 1: loadupdb */ var40 = ptr6[i >> 1]; /* 2: mergebw */ - var41.i = ((orc_uint8) var39 & 0x00ff) | ((orc_uint8) var40 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var39; + _dest.x2[1] = var40; + var41.i = _dest.i; + } /* 3: loadb */ var36 = ptr7[i]; /* 4: loadb */ var37 = ptr4[i]; /* 5: mergebw */ - var42.i = ((orc_uint8) var36 & 0x00ff) | ((orc_uint8) var37 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var36; + _dest.x2[1] = var37; + var42.i = _dest.i; + } /* 6: mergewl */ - var38.i = - ((orc_uint16) var42.i & 0x0000ffff) | ((orc_uint16) var41.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var42.i; + _dest.x2[1] = var41.i; + var38.i = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -14516,8 +16644,9 @@ _backup_cogorc_getline_A420 (OrcExecutor * ex) } void -cogorc_getline_A420 (guint8 * d1, const guint8 * s1, const guint8 * s2, - const guint8 * s3, const guint8 * s4, int n) +cogorc_getline_A420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, + const guint8 * ORC_RESTRICT s4, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -14527,7 +16656,6 @@ cogorc_getline_A420 (guint8 * d1, const guint8 * s1, const guint8 * s2, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_getline_A420"); @@ -14553,7 +16681,7 @@ cogorc_getline_A420 (guint8 * d1, const guint8 * s1, const guint8 * s2, orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -14576,8 +16704,8 @@ cogorc_getline_A420 (guint8 * d1, const guint8 * s1, const guint8 * s2, /* cogorc_putline_I420 */ #ifdef DISABLE_ORC void -cogorc_putline_I420 (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, - int n) +cogorc_putline_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n) { int i; orc_union16 *ORC_RESTRICT ptr0; @@ -14607,30 +16735,62 @@ cogorc_putline_I420 (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, /* 0: loadq */ var38 = ptr4[i]; /* 1: splitlw */ - var42.x2[0] = (var38.x2[0] >> 16) & 0xffff; - var43.x2[0] = var38.x2[0] & 0xffff; - var42.x2[1] = (var38.x2[1] >> 16) & 0xffff; - var43.x2[1] = var38.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var38.x2[0]; + var42.x2[0] = _src.x2[1]; + var43.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var38.x2[1]; + var42.x2[1] = _src.x2[1]; + var43.x2[1] = _src.x2[0]; + } /* 2: select1wb */ - var39.x2[0] = ((orc_uint16) var43.x2[0] >> 8) & 0xff; - var39.x2[1] = ((orc_uint16) var43.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var43.x2[0]; + var39.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var43.x2[1]; + var39.x2[1] = _src.x2[1]; + } /* 3: storew */ ptr0[i] = var39; /* 4: splitwb */ - var44.x2[0] = (var42.x2[0] >> 8) & 0xff; - var45.x2[0] = var42.x2[0] & 0xff; - var44.x2[1] = (var42.x2[1] >> 8) & 0xff; - var45.x2[1] = var42.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var42.x2[0]; + var44.x2[0] = _src.x2[1]; + var45.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var42.x2[1]; + var44.x2[1] = _src.x2[1]; + var45.x2[1] = _src.x2[0]; + } /* 5: splitwb */ - var46 = (var45.i >> 8) & 0xff; - var47 = var45.i & 0xff; + { + orc_union16 _src; + _src.i = var45.i; + var46 = _src.x2[1]; + var47 = _src.x2[0]; + } /* 6: avgub */ var40 = ((orc_uint8) var46 + (orc_uint8) var47 + 1) >> 1; /* 7: storeb */ ptr1[i] = var40; /* 8: splitwb */ - var48 = (var44.i >> 8) & 0xff; - var49 = var44.i & 0xff; + { + orc_union16 _src; + _src.i = var44.i; + var48 = _src.x2[1]; + var49 = _src.x2[0]; + } /* 9: avgub */ var41 = ((orc_uint8) var48 + (orc_uint8) var49 + 1) >> 1; /* 10: storeb */ @@ -14641,7 +16801,7 @@ cogorc_putline_I420 (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, #else static void -_backup_cogorc_putline_I420 (OrcExecutor * ex) +_backup_cogorc_putline_I420 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -14672,30 +16832,62 @@ _backup_cogorc_putline_I420 (OrcExecutor * ex) /* 0: loadq */ var38 = ptr4[i]; /* 1: splitlw */ - var42.x2[0] = (var38.x2[0] >> 16) & 0xffff; - var43.x2[0] = var38.x2[0] & 0xffff; - var42.x2[1] = (var38.x2[1] >> 16) & 0xffff; - var43.x2[1] = var38.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var38.x2[0]; + var42.x2[0] = _src.x2[1]; + var43.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var38.x2[1]; + var42.x2[1] = _src.x2[1]; + var43.x2[1] = _src.x2[0]; + } /* 2: select1wb */ - var39.x2[0] = ((orc_uint16) var43.x2[0] >> 8) & 0xff; - var39.x2[1] = ((orc_uint16) var43.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var43.x2[0]; + var39.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var43.x2[1]; + var39.x2[1] = _src.x2[1]; + } /* 3: storew */ ptr0[i] = var39; /* 4: splitwb */ - var44.x2[0] = (var42.x2[0] >> 8) & 0xff; - var45.x2[0] = var42.x2[0] & 0xff; - var44.x2[1] = (var42.x2[1] >> 8) & 0xff; - var45.x2[1] = var42.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var42.x2[0]; + var44.x2[0] = _src.x2[1]; + var45.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var42.x2[1]; + var44.x2[1] = _src.x2[1]; + var45.x2[1] = _src.x2[0]; + } /* 5: splitwb */ - var46 = (var45.i >> 8) & 0xff; - var47 = var45.i & 0xff; + { + orc_union16 _src; + _src.i = var45.i; + var46 = _src.x2[1]; + var47 = _src.x2[0]; + } /* 6: avgub */ var40 = ((orc_uint8) var46 + (orc_uint8) var47 + 1) >> 1; /* 7: storeb */ ptr1[i] = var40; /* 8: splitwb */ - var48 = (var44.i >> 8) & 0xff; - var49 = var44.i & 0xff; + { + orc_union16 _src; + _src.i = var44.i; + var48 = _src.x2[1]; + var49 = _src.x2[0]; + } /* 9: avgub */ var41 = ((orc_uint8) var48 + (orc_uint8) var49 + 1) >> 1; /* 10: storeb */ @@ -14705,8 +16897,8 @@ _backup_cogorc_putline_I420 (OrcExecutor * ex) } void -cogorc_putline_I420 (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, - int n) +cogorc_putline_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -14716,7 +16908,6 @@ cogorc_putline_I420 (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_putline_I420"); @@ -14747,7 +16938,7 @@ cogorc_putline_I420 (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, orc_program_append_2 (p, "avgub", 0, ORC_VAR_D3, ORC_VAR_T5, ORC_VAR_T6, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -14769,7 +16960,8 @@ cogorc_putline_I420 (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, /* cogorc_putline_YUY2 */ #ifdef DISABLE_ORC void -cogorc_putline_YUY2 (guint8 * d1, const guint8 * s1, int n) +cogorc_putline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -14791,24 +16983,52 @@ cogorc_putline_YUY2 (guint8 * d1, const guint8 * s1, int n) /* 0: loadq */ var37 = ptr4[i]; /* 1: splitlw */ - var39.x2[0] = (var37.x2[0] >> 16) & 0xffff; - var40.x2[0] = var37.x2[0] & 0xffff; - var39.x2[1] = (var37.x2[1] >> 16) & 0xffff; - var40.x2[1] = var37.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var37.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var37.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var41.i = (var39.i >> 16) & 0xffff; - var42.i = var39.i & 0xffff; + { + orc_union32 _src; + _src.i = var39.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 3: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; /* 4: select1wb */ - var44.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff; - var44.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.x2[0]; + var44.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var40.x2[1]; + var44.x2[1] = _src.x2[1]; + } /* 5: mergebw */ - var38.x2[0] = - ((orc_uint8) var44.x2[0] & 0x00ff) | ((orc_uint8) var43.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var44.x2[1] & 0x00ff) | ((orc_uint8) var43.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var43.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var43.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storel */ ptr0[i] = var38; } @@ -14817,7 +17037,7 @@ cogorc_putline_YUY2 (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_cogorc_putline_YUY2 (OrcExecutor * ex) +_backup_cogorc_putline_YUY2 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -14840,24 +17060,52 @@ _backup_cogorc_putline_YUY2 (OrcExecutor * ex) /* 0: loadq */ var37 = ptr4[i]; /* 1: splitlw */ - var39.x2[0] = (var37.x2[0] >> 16) & 0xffff; - var40.x2[0] = var37.x2[0] & 0xffff; - var39.x2[1] = (var37.x2[1] >> 16) & 0xffff; - var40.x2[1] = var37.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var37.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var37.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var41.i = (var39.i >> 16) & 0xffff; - var42.i = var39.i & 0xffff; + { + orc_union32 _src; + _src.i = var39.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 3: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; /* 4: select1wb */ - var44.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff; - var44.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.x2[0]; + var44.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var40.x2[1]; + var44.x2[1] = _src.x2[1]; + } /* 5: mergebw */ - var38.x2[0] = - ((orc_uint8) var44.x2[0] & 0x00ff) | ((orc_uint8) var43.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var44.x2[1] & 0x00ff) | ((orc_uint8) var43.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var43.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var43.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storel */ ptr0[i] = var38; } @@ -14865,7 +17113,8 @@ _backup_cogorc_putline_YUY2 (OrcExecutor * ex) } void -cogorc_putline_YUY2 (guint8 * d1, const guint8 * s1, int n) +cogorc_putline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -14875,7 +17124,6 @@ cogorc_putline_YUY2 (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_putline_YUY2"); @@ -14899,7 +17147,7 @@ cogorc_putline_YUY2 (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -14919,7 +17167,8 @@ cogorc_putline_YUY2 (guint8 * d1, const guint8 * s1, int n) /* cogorc_putline_YVYU */ #ifdef DISABLE_ORC void -cogorc_putline_YVYU (guint8 * d1, const guint8 * s1, int n) +cogorc_putline_YVYU (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -14942,26 +17191,54 @@ cogorc_putline_YVYU (guint8 * d1, const guint8 * s1, int n) /* 0: loadq */ var37 = ptr4[i]; /* 1: splitlw */ - var39.x2[0] = (var37.x2[0] >> 16) & 0xffff; - var40.x2[0] = var37.x2[0] & 0xffff; - var39.x2[1] = (var37.x2[1] >> 16) & 0xffff; - var40.x2[1] = var37.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var37.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var37.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var41.i = (var39.i >> 16) & 0xffff; - var42.i = var39.i & 0xffff; + { + orc_union32 _src; + _src.i = var39.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 3: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; /* 4: select1wb */ - var44.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff; - var44.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.x2[0]; + var44.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var40.x2[1]; + var44.x2[1] = _src.x2[1]; + } /* 5: swapw */ var45.i = ORC_SWAP_W (var43.i); /* 6: mergebw */ - var38.x2[0] = - ((orc_uint8) var44.x2[0] & 0x00ff) | ((orc_uint8) var45.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var44.x2[1] & 0x00ff) | ((orc_uint8) var45.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var45.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var45.x2[1]; + var38.x2[1] = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -14970,7 +17247,7 @@ cogorc_putline_YVYU (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_cogorc_putline_YVYU (OrcExecutor * ex) +_backup_cogorc_putline_YVYU (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -14994,26 +17271,54 @@ _backup_cogorc_putline_YVYU (OrcExecutor * ex) /* 0: loadq */ var37 = ptr4[i]; /* 1: splitlw */ - var39.x2[0] = (var37.x2[0] >> 16) & 0xffff; - var40.x2[0] = var37.x2[0] & 0xffff; - var39.x2[1] = (var37.x2[1] >> 16) & 0xffff; - var40.x2[1] = var37.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var37.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var37.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var41.i = (var39.i >> 16) & 0xffff; - var42.i = var39.i & 0xffff; + { + orc_union32 _src; + _src.i = var39.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 3: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; /* 4: select1wb */ - var44.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff; - var44.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.x2[0]; + var44.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var40.x2[1]; + var44.x2[1] = _src.x2[1]; + } /* 5: swapw */ var45.i = ORC_SWAP_W (var43.i); /* 6: mergebw */ - var38.x2[0] = - ((orc_uint8) var44.x2[0] & 0x00ff) | ((orc_uint8) var45.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var44.x2[1] & 0x00ff) | ((orc_uint8) var45.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[0]; + _dest.x2[1] = var45.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var44.x2[1]; + _dest.x2[1] = var45.x2[1]; + var38.x2[1] = _dest.i; + } /* 7: storel */ ptr0[i] = var38; } @@ -15021,7 +17326,8 @@ _backup_cogorc_putline_YVYU (OrcExecutor * ex) } void -cogorc_putline_YVYU (guint8 * d1, const guint8 * s1, int n) +cogorc_putline_YVYU (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -15031,7 +17337,6 @@ cogorc_putline_YVYU (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_putline_YVYU"); @@ -15057,7 +17362,7 @@ cogorc_putline_YVYU (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -15077,7 +17382,8 @@ cogorc_putline_YVYU (guint8 * d1, const guint8 * s1, int n) /* cogorc_putline_UYVY */ #ifdef DISABLE_ORC void -cogorc_putline_UYVY (guint8 * d1, const guint8 * s1, int n) +cogorc_putline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -15099,24 +17405,52 @@ cogorc_putline_UYVY (guint8 * d1, const guint8 * s1, int n) /* 0: loadq */ var37 = ptr4[i]; /* 1: splitlw */ - var39.x2[0] = (var37.x2[0] >> 16) & 0xffff; - var40.x2[0] = var37.x2[0] & 0xffff; - var39.x2[1] = (var37.x2[1] >> 16) & 0xffff; - var40.x2[1] = var37.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var37.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var37.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var41.i = (var39.i >> 16) & 0xffff; - var42.i = var39.i & 0xffff; + { + orc_union32 _src; + _src.i = var39.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 3: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; /* 4: select1wb */ - var44.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff; - var44.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.x2[0]; + var44.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var40.x2[1]; + var44.x2[1] = _src.x2[1]; + } /* 5: mergebw */ - var38.x2[0] = - ((orc_uint8) var43.x2[0] & 0x00ff) | ((orc_uint8) var44.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var43.x2[1] & 0x00ff) | ((orc_uint8) var44.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[0]; + _dest.x2[1] = var44.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[1]; + _dest.x2[1] = var44.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storel */ ptr0[i] = var38; } @@ -15125,7 +17459,7 @@ cogorc_putline_UYVY (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_cogorc_putline_UYVY (OrcExecutor * ex) +_backup_cogorc_putline_UYVY (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -15148,24 +17482,52 @@ _backup_cogorc_putline_UYVY (OrcExecutor * ex) /* 0: loadq */ var37 = ptr4[i]; /* 1: splitlw */ - var39.x2[0] = (var37.x2[0] >> 16) & 0xffff; - var40.x2[0] = var37.x2[0] & 0xffff; - var39.x2[1] = (var37.x2[1] >> 16) & 0xffff; - var40.x2[1] = var37.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var37.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var37.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var41.i = (var39.i >> 16) & 0xffff; - var42.i = var39.i & 0xffff; + { + orc_union32 _src; + _src.i = var39.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 3: avgub */ var43.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var43.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; /* 4: select1wb */ - var44.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff; - var44.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.x2[0]; + var44.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var40.x2[1]; + var44.x2[1] = _src.x2[1]; + } /* 5: mergebw */ - var38.x2[0] = - ((orc_uint8) var43.x2[0] & 0x00ff) | ((orc_uint8) var44.x2[0] << 8); - var38.x2[1] = - ((orc_uint8) var43.x2[1] & 0x00ff) | ((orc_uint8) var44.x2[1] << 8); + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[0]; + _dest.x2[1] = var44.x2[0]; + var38.x2[0] = _dest.i; + } + { + orc_union16 _dest; + _dest.x2[0] = var43.x2[1]; + _dest.x2[1] = var44.x2[1]; + var38.x2[1] = _dest.i; + } /* 6: storel */ ptr0[i] = var38; } @@ -15173,7 +17535,8 @@ _backup_cogorc_putline_UYVY (OrcExecutor * ex) } void -cogorc_putline_UYVY (guint8 * d1, const guint8 * s1, int n) +cogorc_putline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -15183,7 +17546,6 @@ cogorc_putline_UYVY (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_putline_UYVY"); @@ -15207,7 +17569,7 @@ cogorc_putline_UYVY (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "mergebw", 1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -15227,8 +17589,8 @@ cogorc_putline_UYVY (guint8 * d1, const guint8 * s1, int n) /* cogorc_putline_Y42B */ #ifdef DISABLE_ORC void -cogorc_putline_Y42B (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, - int n) +cogorc_putline_Y42B (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n) { int i; orc_union16 *ORC_RESTRICT ptr0; @@ -15255,26 +17617,50 @@ cogorc_putline_Y42B (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, /* 0: loadq */ var36 = ptr4[i]; /* 1: splitlw */ - var40.x2[0] = (var36.x2[0] >> 16) & 0xffff; - var41.x2[0] = var36.x2[0] & 0xffff; - var40.x2[1] = (var36.x2[1] >> 16) & 0xffff; - var41.x2[1] = var36.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var36.x2[0]; + var40.x2[0] = _src.x2[1]; + var41.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var36.x2[1]; + var40.x2[1] = _src.x2[1]; + var41.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var42.i = (var40.i >> 16) & 0xffff; - var43.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var42.i = _src.x2[1]; + var43.i = _src.x2[0]; + } /* 3: avgub */ var44.x2[0] = ((orc_uint8) var42.x2[0] + (orc_uint8) var43.x2[0] + 1) >> 1; var44.x2[1] = ((orc_uint8) var42.x2[1] + (orc_uint8) var43.x2[1] + 1) >> 1; /* 4: splitwb */ - var37 = (var44.i >> 8) & 0xff; - var38 = var44.i & 0xff; + { + orc_union16 _src; + _src.i = var44.i; + var37 = _src.x2[1]; + var38 = _src.x2[0]; + } /* 5: storeb */ ptr2[i] = var37; /* 6: storeb */ ptr1[i] = var38; /* 7: select1wb */ - var39.x2[0] = ((orc_uint16) var41.x2[0] >> 8) & 0xff; - var39.x2[1] = ((orc_uint16) var41.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var41.x2[0]; + var39.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var41.x2[1]; + var39.x2[1] = _src.x2[1]; + } /* 8: storew */ ptr0[i] = var39; } @@ -15283,7 +17669,7 @@ cogorc_putline_Y42B (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, #else static void -_backup_cogorc_putline_Y42B (OrcExecutor * ex) +_backup_cogorc_putline_Y42B (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -15311,26 +17697,50 @@ _backup_cogorc_putline_Y42B (OrcExecutor * ex) /* 0: loadq */ var36 = ptr4[i]; /* 1: splitlw */ - var40.x2[0] = (var36.x2[0] >> 16) & 0xffff; - var41.x2[0] = var36.x2[0] & 0xffff; - var40.x2[1] = (var36.x2[1] >> 16) & 0xffff; - var41.x2[1] = var36.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var36.x2[0]; + var40.x2[0] = _src.x2[1]; + var41.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var36.x2[1]; + var40.x2[1] = _src.x2[1]; + var41.x2[1] = _src.x2[0]; + } /* 2: splitlw */ - var42.i = (var40.i >> 16) & 0xffff; - var43.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var42.i = _src.x2[1]; + var43.i = _src.x2[0]; + } /* 3: avgub */ var44.x2[0] = ((orc_uint8) var42.x2[0] + (orc_uint8) var43.x2[0] + 1) >> 1; var44.x2[1] = ((orc_uint8) var42.x2[1] + (orc_uint8) var43.x2[1] + 1) >> 1; /* 4: splitwb */ - var37 = (var44.i >> 8) & 0xff; - var38 = var44.i & 0xff; + { + orc_union16 _src; + _src.i = var44.i; + var37 = _src.x2[1]; + var38 = _src.x2[0]; + } /* 5: storeb */ ptr2[i] = var37; /* 6: storeb */ ptr1[i] = var38; /* 7: select1wb */ - var39.x2[0] = ((orc_uint16) var41.x2[0] >> 8) & 0xff; - var39.x2[1] = ((orc_uint16) var41.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var41.x2[0]; + var39.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var41.x2[1]; + var39.x2[1] = _src.x2[1]; + } /* 8: storew */ ptr0[i] = var39; } @@ -15338,8 +17748,8 @@ _backup_cogorc_putline_Y42B (OrcExecutor * ex) } void -cogorc_putline_Y42B (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, - int n) +cogorc_putline_Y42B (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -15349,7 +17759,6 @@ cogorc_putline_Y42B (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_putline_Y42B"); @@ -15374,7 +17783,7 @@ cogorc_putline_Y42B (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, orc_program_append_2 (p, "select1wb", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -15396,8 +17805,8 @@ cogorc_putline_Y42B (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, /* cogorc_putline_Y444 */ #ifdef DISABLE_ORC void -cogorc_putline_Y444 (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, - int n) +cogorc_putline_Y444 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -15421,17 +17830,29 @@ cogorc_putline_Y444 (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, /* 0: loadl */ var34 = ptr4[i]; /* 1: splitlw */ - var38.i = (var34.i >> 16) & 0xffff; - var39.i = var34.i & 0xffff; + { + orc_union32 _src; + _src.i = var34.i; + var38.i = _src.x2[1]; + var39.i = _src.x2[0]; + } /* 2: splitwb */ - var35 = (var38.i >> 8) & 0xff; - var36 = var38.i & 0xff; + { + orc_union16 _src; + _src.i = var38.i; + var35 = _src.x2[1]; + var36 = _src.x2[0]; + } /* 3: storeb */ ptr2[i] = var35; /* 4: storeb */ ptr1[i] = var36; /* 5: select1wb */ - var37 = ((orc_uint16) var39.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var39.i; + var37 = _src.x2[1]; + } /* 6: storeb */ ptr0[i] = var37; } @@ -15440,7 +17861,7 @@ cogorc_putline_Y444 (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, #else static void -_backup_cogorc_putline_Y444 (OrcExecutor * ex) +_backup_cogorc_putline_Y444 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -15465,17 +17886,29 @@ _backup_cogorc_putline_Y444 (OrcExecutor * ex) /* 0: loadl */ var34 = ptr4[i]; /* 1: splitlw */ - var38.i = (var34.i >> 16) & 0xffff; - var39.i = var34.i & 0xffff; + { + orc_union32 _src; + _src.i = var34.i; + var38.i = _src.x2[1]; + var39.i = _src.x2[0]; + } /* 2: splitwb */ - var35 = (var38.i >> 8) & 0xff; - var36 = var38.i & 0xff; + { + orc_union16 _src; + _src.i = var38.i; + var35 = _src.x2[1]; + var36 = _src.x2[0]; + } /* 3: storeb */ ptr2[i] = var35; /* 4: storeb */ ptr1[i] = var36; /* 5: select1wb */ - var37 = ((orc_uint16) var39.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var39.i; + var37 = _src.x2[1]; + } /* 6: storeb */ ptr0[i] = var37; } @@ -15483,8 +17916,8 @@ _backup_cogorc_putline_Y444 (OrcExecutor * ex) } void -cogorc_putline_Y444 (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, - int n) +cogorc_putline_Y444 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -15494,7 +17927,6 @@ cogorc_putline_Y444 (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_putline_Y444"); @@ -15513,7 +17945,7 @@ cogorc_putline_Y444 (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -15535,7 +17967,8 @@ cogorc_putline_Y444 (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, /* cogorc_putline_Y800 */ #ifdef DISABLE_ORC void -cogorc_putline_Y800 (guint8 * d1, const guint8 * s1, int n) +cogorc_putline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_int8 *ORC_RESTRICT ptr0; @@ -15552,9 +17985,17 @@ cogorc_putline_Y800 (guint8 * d1, const guint8 * s1, int n) /* 0: loadl */ var33 = ptr4[i]; /* 1: select0lw */ - var35.i = (orc_uint32) var33.i & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[0]; + } /* 2: select1wb */ - var34 = ((orc_uint16) var35.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[1]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -15563,7 +18004,7 @@ cogorc_putline_Y800 (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_cogorc_putline_Y800 (OrcExecutor * ex) +_backup_cogorc_putline_Y800 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -15581,9 +18022,17 @@ _backup_cogorc_putline_Y800 (OrcExecutor * ex) /* 0: loadl */ var33 = ptr4[i]; /* 1: select0lw */ - var35.i = (orc_uint32) var33.i & 0xffff; + { + orc_union32 _src; + _src.i = var33.i; + var35.i = _src.x2[0]; + } /* 2: select1wb */ - var34 = ((orc_uint16) var35.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var35.i; + var34 = _src.x2[1]; + } /* 3: storeb */ ptr0[i] = var34; } @@ -15591,7 +18040,8 @@ _backup_cogorc_putline_Y800 (OrcExecutor * ex) } void -cogorc_putline_Y800 (guint8 * d1, const guint8 * s1, int n) +cogorc_putline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -15601,7 +18051,6 @@ cogorc_putline_Y800 (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_putline_Y800"); @@ -15615,7 +18064,7 @@ cogorc_putline_Y800 (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "select1wb", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -15635,7 +18084,8 @@ cogorc_putline_Y800 (guint8 * d1, const guint8 * s1, int n) /* cogorc_putline_Y16 */ #ifdef DISABLE_ORC void -cogorc_putline_Y16 (guint8 * d1, const guint8 * s1, int n) +cogorc_putline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_union16 *ORC_RESTRICT ptr0; @@ -15654,9 +18104,17 @@ cogorc_putline_Y16 (guint8 * d1, const guint8 * s1, int n) /* 0: loadl */ var34 = ptr4[i]; /* 1: select0lw */ - var36.i = (orc_uint32) var34.i & 0xffff; + { + orc_union32 _src; + _src.i = var34.i; + var36.i = _src.x2[0]; + } /* 2: select1wb */ - var37 = ((orc_uint16) var36.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var36.i; + var37 = _src.x2[1]; + } /* 3: convubw */ var38.i = (orc_uint8) var37; /* 4: shlw */ @@ -15669,7 +18127,7 @@ cogorc_putline_Y16 (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_cogorc_putline_Y16 (OrcExecutor * ex) +_backup_cogorc_putline_Y16 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -15689,9 +18147,17 @@ _backup_cogorc_putline_Y16 (OrcExecutor * ex) /* 0: loadl */ var34 = ptr4[i]; /* 1: select0lw */ - var36.i = (orc_uint32) var34.i & 0xffff; + { + orc_union32 _src; + _src.i = var34.i; + var36.i = _src.x2[0]; + } /* 2: select1wb */ - var37 = ((orc_uint16) var36.i >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var36.i; + var37 = _src.x2[1]; + } /* 3: convubw */ var38.i = (orc_uint8) var37; /* 4: shlw */ @@ -15703,7 +18169,8 @@ _backup_cogorc_putline_Y16 (OrcExecutor * ex) } void -cogorc_putline_Y16 (guint8 * d1, const guint8 * s1, int n) +cogorc_putline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -15713,7 +18180,6 @@ cogorc_putline_Y16 (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_putline_Y16"); @@ -15733,7 +18199,7 @@ cogorc_putline_Y16 (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "shlw", 0, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_C1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -15753,7 +18219,8 @@ cogorc_putline_Y16 (guint8 * d1, const guint8 * s1, int n) /* cogorc_putline_BGRA */ #ifdef DISABLE_ORC void -cogorc_putline_BGRA (guint8 * d1, const guint8 * s1, int n) +cogorc_putline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -15778,7 +18245,7 @@ cogorc_putline_BGRA (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_cogorc_putline_BGRA (OrcExecutor * ex) +_backup_cogorc_putline_BGRA (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -15803,7 +18270,8 @@ _backup_cogorc_putline_BGRA (OrcExecutor * ex) } void -cogorc_putline_BGRA (guint8 * d1, const guint8 * s1, int n) +cogorc_putline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -15813,7 +18281,6 @@ cogorc_putline_BGRA (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_putline_BGRA"); @@ -15824,7 +18291,7 @@ cogorc_putline_BGRA (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "swapl", 0, ORC_VAR_D1, ORC_VAR_S1, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -15844,7 +18311,8 @@ cogorc_putline_BGRA (guint8 * d1, const guint8 * s1, int n) /* cogorc_putline_ABGR */ #ifdef DISABLE_ORC void -cogorc_putline_ABGR (guint8 * d1, const guint8 * s1, int n) +cogorc_putline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -15868,21 +18336,47 @@ cogorc_putline_ABGR (guint8 * d1, const guint8 * s1, int n) /* 0: loadl */ var40 = ptr4[i]; /* 1: splitlw */ - var42.i = (var40.i >> 16) & 0xffff; - var43.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var42.i = _src.x2[1]; + var43.i = _src.x2[0]; + } /* 2: splitwb */ - var44 = (var42.i >> 8) & 0xff; - var45 = var42.i & 0xff; + { + orc_union16 _src; + _src.i = var42.i; + var44 = _src.x2[1]; + var45 = _src.x2[0]; + } /* 3: splitwb */ - var46 = (var43.i >> 8) & 0xff; - var47 = var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var46 = _src.x2[1]; + var47 = _src.x2[0]; + } /* 4: mergebw */ - var48.i = ((orc_uint8) var47 & 0x00ff) | ((orc_uint8) var44 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var47; + _dest.x2[1] = var44; + var48.i = _dest.i; + } /* 5: mergebw */ - var49.i = ((orc_uint8) var45 & 0x00ff) | ((orc_uint8) var46 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var45; + _dest.x2[1] = var46; + var49.i = _dest.i; + } /* 6: mergewl */ - var41.i = - ((orc_uint16) var48.i & 0x0000ffff) | ((orc_uint16) var49.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var48.i; + _dest.x2[1] = var49.i; + var41.i = _dest.i; + } /* 7: storel */ ptr0[i] = var41; } @@ -15891,7 +18385,7 @@ cogorc_putline_ABGR (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_cogorc_putline_ABGR (OrcExecutor * ex) +_backup_cogorc_putline_ABGR (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -15916,21 +18410,47 @@ _backup_cogorc_putline_ABGR (OrcExecutor * ex) /* 0: loadl */ var40 = ptr4[i]; /* 1: splitlw */ - var42.i = (var40.i >> 16) & 0xffff; - var43.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var42.i = _src.x2[1]; + var43.i = _src.x2[0]; + } /* 2: splitwb */ - var44 = (var42.i >> 8) & 0xff; - var45 = var42.i & 0xff; + { + orc_union16 _src; + _src.i = var42.i; + var44 = _src.x2[1]; + var45 = _src.x2[0]; + } /* 3: splitwb */ - var46 = (var43.i >> 8) & 0xff; - var47 = var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var46 = _src.x2[1]; + var47 = _src.x2[0]; + } /* 4: mergebw */ - var48.i = ((orc_uint8) var47 & 0x00ff) | ((orc_uint8) var44 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var47; + _dest.x2[1] = var44; + var48.i = _dest.i; + } /* 5: mergebw */ - var49.i = ((orc_uint8) var45 & 0x00ff) | ((orc_uint8) var46 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var45; + _dest.x2[1] = var46; + var49.i = _dest.i; + } /* 6: mergewl */ - var41.i = - ((orc_uint16) var48.i & 0x0000ffff) | ((orc_uint16) var49.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var48.i; + _dest.x2[1] = var49.i; + var41.i = _dest.i; + } /* 7: storel */ ptr0[i] = var41; } @@ -15938,7 +18458,8 @@ _backup_cogorc_putline_ABGR (OrcExecutor * ex) } void -cogorc_putline_ABGR (guint8 * d1, const guint8 * s1, int n) +cogorc_putline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -15948,7 +18469,6 @@ cogorc_putline_ABGR (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_putline_ABGR"); @@ -15977,7 +18497,7 @@ cogorc_putline_ABGR (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T6, ORC_VAR_T5, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -15997,7 +18517,8 @@ cogorc_putline_ABGR (guint8 * d1, const guint8 * s1, int n) /* cogorc_putline_RGBA */ #ifdef DISABLE_ORC void -cogorc_putline_RGBA (guint8 * d1, const guint8 * s1, int n) +cogorc_putline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { int i; orc_union32 *ORC_RESTRICT ptr0; @@ -16021,21 +18542,47 @@ cogorc_putline_RGBA (guint8 * d1, const guint8 * s1, int n) /* 0: loadl */ var40 = ptr4[i]; /* 1: splitlw */ - var42.i = (var40.i >> 16) & 0xffff; - var43.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var42.i = _src.x2[1]; + var43.i = _src.x2[0]; + } /* 2: splitwb */ - var44 = (var42.i >> 8) & 0xff; - var45 = var42.i & 0xff; + { + orc_union16 _src; + _src.i = var42.i; + var44 = _src.x2[1]; + var45 = _src.x2[0]; + } /* 3: splitwb */ - var46 = (var43.i >> 8) & 0xff; - var47 = var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var46 = _src.x2[1]; + var47 = _src.x2[0]; + } /* 4: mergebw */ - var48.i = ((orc_uint8) var44 & 0x00ff) | ((orc_uint8) var47 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var44; + _dest.x2[1] = var47; + var48.i = _dest.i; + } /* 5: mergebw */ - var49.i = ((orc_uint8) var46 & 0x00ff) | ((orc_uint8) var45 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var46; + _dest.x2[1] = var45; + var49.i = _dest.i; + } /* 6: mergewl */ - var41.i = - ((orc_uint16) var49.i & 0x0000ffff) | ((orc_uint16) var48.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var49.i; + _dest.x2[1] = var48.i; + var41.i = _dest.i; + } /* 7: storel */ ptr0[i] = var41; } @@ -16044,7 +18591,7 @@ cogorc_putline_RGBA (guint8 * d1, const guint8 * s1, int n) #else static void -_backup_cogorc_putline_RGBA (OrcExecutor * ex) +_backup_cogorc_putline_RGBA (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -16069,21 +18616,47 @@ _backup_cogorc_putline_RGBA (OrcExecutor * ex) /* 0: loadl */ var40 = ptr4[i]; /* 1: splitlw */ - var42.i = (var40.i >> 16) & 0xffff; - var43.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var42.i = _src.x2[1]; + var43.i = _src.x2[0]; + } /* 2: splitwb */ - var44 = (var42.i >> 8) & 0xff; - var45 = var42.i & 0xff; + { + orc_union16 _src; + _src.i = var42.i; + var44 = _src.x2[1]; + var45 = _src.x2[0]; + } /* 3: splitwb */ - var46 = (var43.i >> 8) & 0xff; - var47 = var43.i & 0xff; + { + orc_union16 _src; + _src.i = var43.i; + var46 = _src.x2[1]; + var47 = _src.x2[0]; + } /* 4: mergebw */ - var48.i = ((orc_uint8) var44 & 0x00ff) | ((orc_uint8) var47 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var44; + _dest.x2[1] = var47; + var48.i = _dest.i; + } /* 5: mergebw */ - var49.i = ((orc_uint8) var46 & 0x00ff) | ((orc_uint8) var45 << 8); + { + orc_union16 _dest; + _dest.x2[0] = var46; + _dest.x2[1] = var45; + var49.i = _dest.i; + } /* 6: mergewl */ - var41.i = - ((orc_uint16) var49.i & 0x0000ffff) | ((orc_uint16) var48.i << 16); + { + orc_union32 _dest; + _dest.x2[0] = var49.i; + _dest.x2[1] = var48.i; + var41.i = _dest.i; + } /* 7: storel */ ptr0[i] = var41; } @@ -16091,7 +18664,8 @@ _backup_cogorc_putline_RGBA (OrcExecutor * ex) } void -cogorc_putline_RGBA (guint8 * d1, const guint8 * s1, int n) +cogorc_putline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, + int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -16101,7 +18675,6 @@ cogorc_putline_RGBA (guint8 * d1, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_putline_RGBA"); @@ -16130,7 +18703,7 @@ cogorc_putline_RGBA (guint8 * d1, const guint8 * s1, int n) orc_program_append_2 (p, "mergewl", 0, ORC_VAR_D1, ORC_VAR_T5, ORC_VAR_T6, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -16150,7 +18723,8 @@ cogorc_putline_RGBA (guint8 * d1, const guint8 * s1, int n) /* cogorc_putline_NV12 */ #ifdef DISABLE_ORC void -cogorc_putline_NV12 (guint8 * d1, guint8 * d2, const guint8 * s1, int n) +cogorc_putline_NV12 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + const guint8 * ORC_RESTRICT s1, int n) { int i; orc_union16 *ORC_RESTRICT ptr0; @@ -16173,18 +18747,38 @@ cogorc_putline_NV12 (guint8 * d1, guint8 * d2, const guint8 * s1, int n) /* 0: loadq */ var36 = ptr4[i]; /* 1: splitlw */ - var39.x2[0] = (var36.x2[0] >> 16) & 0xffff; - var40.x2[0] = var36.x2[0] & 0xffff; - var39.x2[1] = (var36.x2[1] >> 16) & 0xffff; - var40.x2[1] = var36.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var36.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var36.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: select1wb */ - var37.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff; - var37.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.x2[0]; + var37.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var40.x2[1]; + var37.x2[1] = _src.x2[1]; + } /* 3: storew */ ptr0[i] = var37; /* 4: splitlw */ - var41.i = (var39.i >> 16) & 0xffff; - var42.i = var39.i & 0xffff; + { + orc_union32 _src; + _src.i = var39.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 5: avgub */ var38.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var38.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; @@ -16196,7 +18790,7 @@ cogorc_putline_NV12 (guint8 * d1, guint8 * d2, const guint8 * s1, int n) #else static void -_backup_cogorc_putline_NV12 (OrcExecutor * ex) +_backup_cogorc_putline_NV12 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -16220,18 +18814,38 @@ _backup_cogorc_putline_NV12 (OrcExecutor * ex) /* 0: loadq */ var36 = ptr4[i]; /* 1: splitlw */ - var39.x2[0] = (var36.x2[0] >> 16) & 0xffff; - var40.x2[0] = var36.x2[0] & 0xffff; - var39.x2[1] = (var36.x2[1] >> 16) & 0xffff; - var40.x2[1] = var36.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var36.x2[0]; + var39.x2[0] = _src.x2[1]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var36.x2[1]; + var39.x2[1] = _src.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 2: select1wb */ - var37.x2[0] = ((orc_uint16) var40.x2[0] >> 8) & 0xff; - var37.x2[1] = ((orc_uint16) var40.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var40.x2[0]; + var37.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var40.x2[1]; + var37.x2[1] = _src.x2[1]; + } /* 3: storew */ ptr0[i] = var37; /* 4: splitlw */ - var41.i = (var39.i >> 16) & 0xffff; - var42.i = var39.i & 0xffff; + { + orc_union32 _src; + _src.i = var39.i; + var41.i = _src.x2[1]; + var42.i = _src.x2[0]; + } /* 5: avgub */ var38.x2[0] = ((orc_uint8) var41.x2[0] + (orc_uint8) var42.x2[0] + 1) >> 1; var38.x2[1] = ((orc_uint8) var41.x2[1] + (orc_uint8) var42.x2[1] + 1) >> 1; @@ -16242,7 +18856,8 @@ _backup_cogorc_putline_NV12 (OrcExecutor * ex) } void -cogorc_putline_NV12 (guint8 * d1, guint8 * d2, const guint8 * s1, int n) +cogorc_putline_NV12 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + const guint8 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -16252,7 +18867,6 @@ cogorc_putline_NV12 (guint8 * d1, guint8 * d2, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_putline_NV12"); @@ -16274,7 +18888,7 @@ cogorc_putline_NV12 (guint8 * d1, guint8 * d2, const guint8 * s1, int n) orc_program_append_2 (p, "avgub", 1, ORC_VAR_D2, ORC_VAR_T3, ORC_VAR_T4, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -16295,7 +18909,8 @@ cogorc_putline_NV12 (guint8 * d1, guint8 * d2, const guint8 * s1, int n) /* cogorc_putline_NV21 */ #ifdef DISABLE_ORC void -cogorc_putline_NV21 (guint8 * d1, guint8 * d2, const guint8 * s1, int n) +cogorc_putline_NV21 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + const guint8 * ORC_RESTRICT s1, int n) { int i; orc_union16 *ORC_RESTRICT ptr0; @@ -16319,18 +18934,38 @@ cogorc_putline_NV21 (guint8 * d1, guint8 * d2, const guint8 * s1, int n) /* 0: loadq */ var37 = ptr4[i]; /* 1: splitlw */ - var40.x2[0] = (var37.x2[0] >> 16) & 0xffff; - var41.x2[0] = var37.x2[0] & 0xffff; - var40.x2[1] = (var37.x2[1] >> 16) & 0xffff; - var41.x2[1] = var37.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var37.x2[0]; + var40.x2[0] = _src.x2[1]; + var41.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var37.x2[1]; + var40.x2[1] = _src.x2[1]; + var41.x2[1] = _src.x2[0]; + } /* 2: select1wb */ - var38.x2[0] = ((orc_uint16) var41.x2[0] >> 8) & 0xff; - var38.x2[1] = ((orc_uint16) var41.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var41.x2[0]; + var38.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var41.x2[1]; + var38.x2[1] = _src.x2[1]; + } /* 3: storew */ ptr0[i] = var38; /* 4: splitlw */ - var42.i = (var40.i >> 16) & 0xffff; - var43.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var42.i = _src.x2[1]; + var43.i = _src.x2[0]; + } /* 5: avgub */ var44.x2[0] = ((orc_uint8) var42.x2[0] + (orc_uint8) var43.x2[0] + 1) >> 1; var44.x2[1] = ((orc_uint8) var42.x2[1] + (orc_uint8) var43.x2[1] + 1) >> 1; @@ -16344,7 +18979,7 @@ cogorc_putline_NV21 (guint8 * d1, guint8 * d2, const guint8 * s1, int n) #else static void -_backup_cogorc_putline_NV21 (OrcExecutor * ex) +_backup_cogorc_putline_NV21 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -16369,18 +19004,38 @@ _backup_cogorc_putline_NV21 (OrcExecutor * ex) /* 0: loadq */ var37 = ptr4[i]; /* 1: splitlw */ - var40.x2[0] = (var37.x2[0] >> 16) & 0xffff; - var41.x2[0] = var37.x2[0] & 0xffff; - var40.x2[1] = (var37.x2[1] >> 16) & 0xffff; - var41.x2[1] = var37.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var37.x2[0]; + var40.x2[0] = _src.x2[1]; + var41.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var37.x2[1]; + var40.x2[1] = _src.x2[1]; + var41.x2[1] = _src.x2[0]; + } /* 2: select1wb */ - var38.x2[0] = ((orc_uint16) var41.x2[0] >> 8) & 0xff; - var38.x2[1] = ((orc_uint16) var41.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var41.x2[0]; + var38.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var41.x2[1]; + var38.x2[1] = _src.x2[1]; + } /* 3: storew */ ptr0[i] = var38; /* 4: splitlw */ - var42.i = (var40.i >> 16) & 0xffff; - var43.i = var40.i & 0xffff; + { + orc_union32 _src; + _src.i = var40.i; + var42.i = _src.x2[1]; + var43.i = _src.x2[0]; + } /* 5: avgub */ var44.x2[0] = ((orc_uint8) var42.x2[0] + (orc_uint8) var43.x2[0] + 1) >> 1; var44.x2[1] = ((orc_uint8) var42.x2[1] + (orc_uint8) var43.x2[1] + 1) >> 1; @@ -16393,7 +19048,8 @@ _backup_cogorc_putline_NV21 (OrcExecutor * ex) } void -cogorc_putline_NV21 (guint8 * d1, guint8 * d2, const guint8 * s1, int n) +cogorc_putline_NV21 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + const guint8 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -16403,7 +19059,6 @@ cogorc_putline_NV21 (guint8 * d1, guint8 * d2, const guint8 * s1, int n) if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_putline_NV21"); @@ -16428,7 +19083,7 @@ cogorc_putline_NV21 (guint8 * d1, guint8 * d2, const guint8 * s1, int n) orc_program_append_2 (p, "swapw", 0, ORC_VAR_D2, ORC_VAR_T5, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); @@ -16449,8 +19104,9 @@ cogorc_putline_NV21 (guint8 * d1, guint8 * d2, const guint8 * s1, int n) /* cogorc_putline_A420 */ #ifdef DISABLE_ORC void -cogorc_putline_A420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, - const guint8 * s1, int n) +cogorc_putline_A420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, + const guint8 * ORC_RESTRICT s1, int n) { int i; orc_union16 *ORC_RESTRICT ptr0; @@ -16483,35 +19139,75 @@ cogorc_putline_A420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, /* 0: loadq */ var38 = ptr4[i]; /* 1: splitlw */ - var43.x2[0] = (var38.x2[0] >> 16) & 0xffff; - var44.x2[0] = var38.x2[0] & 0xffff; - var43.x2[1] = (var38.x2[1] >> 16) & 0xffff; - var44.x2[1] = var38.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var38.x2[0]; + var43.x2[0] = _src.x2[1]; + var44.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var38.x2[1]; + var43.x2[1] = _src.x2[1]; + var44.x2[1] = _src.x2[0]; + } /* 2: select1wb */ - var39.x2[0] = ((orc_uint16) var44.x2[0] >> 8) & 0xff; - var39.x2[1] = ((orc_uint16) var44.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var44.x2[0]; + var39.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var44.x2[1]; + var39.x2[1] = _src.x2[1]; + } /* 3: storew */ ptr0[i] = var39; /* 4: select0wb */ - var40.x2[0] = (orc_uint16) var44.x2[0] & 0xff; - var40.x2[1] = (orc_uint16) var44.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var44.x2[0]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var44.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 5: storew */ ptr3[i] = var40; /* 6: splitwb */ - var45.x2[0] = (var43.x2[0] >> 8) & 0xff; - var46.x2[0] = var43.x2[0] & 0xff; - var45.x2[1] = (var43.x2[1] >> 8) & 0xff; - var46.x2[1] = var43.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var43.x2[0]; + var45.x2[0] = _src.x2[1]; + var46.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var43.x2[1]; + var45.x2[1] = _src.x2[1]; + var46.x2[1] = _src.x2[0]; + } /* 7: splitwb */ - var47 = (var46.i >> 8) & 0xff; - var48 = var46.i & 0xff; + { + orc_union16 _src; + _src.i = var46.i; + var47 = _src.x2[1]; + var48 = _src.x2[0]; + } /* 8: avgub */ var41 = ((orc_uint8) var47 + (orc_uint8) var48 + 1) >> 1; /* 9: storeb */ ptr1[i] = var41; /* 10: splitwb */ - var49 = (var45.i >> 8) & 0xff; - var50 = var45.i & 0xff; + { + orc_union16 _src; + _src.i = var45.i; + var49 = _src.x2[1]; + var50 = _src.x2[0]; + } /* 11: avgub */ var42 = ((orc_uint8) var49 + (orc_uint8) var50 + 1) >> 1; /* 12: storeb */ @@ -16522,7 +19218,7 @@ cogorc_putline_A420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, #else static void -_backup_cogorc_putline_A420 (OrcExecutor * ex) +_backup_cogorc_putline_A420 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -16556,35 +19252,75 @@ _backup_cogorc_putline_A420 (OrcExecutor * ex) /* 0: loadq */ var38 = ptr4[i]; /* 1: splitlw */ - var43.x2[0] = (var38.x2[0] >> 16) & 0xffff; - var44.x2[0] = var38.x2[0] & 0xffff; - var43.x2[1] = (var38.x2[1] >> 16) & 0xffff; - var44.x2[1] = var38.x2[1] & 0xffff; + { + orc_union32 _src; + _src.i = var38.x2[0]; + var43.x2[0] = _src.x2[1]; + var44.x2[0] = _src.x2[0]; + } + { + orc_union32 _src; + _src.i = var38.x2[1]; + var43.x2[1] = _src.x2[1]; + var44.x2[1] = _src.x2[0]; + } /* 2: select1wb */ - var39.x2[0] = ((orc_uint16) var44.x2[0] >> 8) & 0xff; - var39.x2[1] = ((orc_uint16) var44.x2[1] >> 8) & 0xff; + { + orc_union16 _src; + _src.i = var44.x2[0]; + var39.x2[0] = _src.x2[1]; + } + { + orc_union16 _src; + _src.i = var44.x2[1]; + var39.x2[1] = _src.x2[1]; + } /* 3: storew */ ptr0[i] = var39; /* 4: select0wb */ - var40.x2[0] = (orc_uint16) var44.x2[0] & 0xff; - var40.x2[1] = (orc_uint16) var44.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var44.x2[0]; + var40.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var44.x2[1]; + var40.x2[1] = _src.x2[0]; + } /* 5: storew */ ptr3[i] = var40; /* 6: splitwb */ - var45.x2[0] = (var43.x2[0] >> 8) & 0xff; - var46.x2[0] = var43.x2[0] & 0xff; - var45.x2[1] = (var43.x2[1] >> 8) & 0xff; - var46.x2[1] = var43.x2[1] & 0xff; + { + orc_union16 _src; + _src.i = var43.x2[0]; + var45.x2[0] = _src.x2[1]; + var46.x2[0] = _src.x2[0]; + } + { + orc_union16 _src; + _src.i = var43.x2[1]; + var45.x2[1] = _src.x2[1]; + var46.x2[1] = _src.x2[0]; + } /* 7: splitwb */ - var47 = (var46.i >> 8) & 0xff; - var48 = var46.i & 0xff; + { + orc_union16 _src; + _src.i = var46.i; + var47 = _src.x2[1]; + var48 = _src.x2[0]; + } /* 8: avgub */ var41 = ((orc_uint8) var47 + (orc_uint8) var48 + 1) >> 1; /* 9: storeb */ ptr1[i] = var41; /* 10: splitwb */ - var49 = (var45.i >> 8) & 0xff; - var50 = var45.i & 0xff; + { + orc_union16 _src; + _src.i = var45.i; + var49 = _src.x2[1]; + var50 = _src.x2[0]; + } /* 11: avgub */ var42 = ((orc_uint8) var49 + (orc_uint8) var50 + 1) >> 1; /* 12: storeb */ @@ -16594,8 +19330,9 @@ _backup_cogorc_putline_A420 (OrcExecutor * ex) } void -cogorc_putline_A420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, - const guint8 * s1, int n) +cogorc_putline_A420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, + guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, + const guint8 * ORC_RESTRICT s1, int n) { OrcExecutor _ex, *ex = &_ex; static int p_inited = 0; @@ -16605,7 +19342,6 @@ cogorc_putline_A420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, if (!p_inited) { orc_once_mutex_lock (); if (!p_inited) { - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "cogorc_putline_A420"); @@ -16639,7 +19375,7 @@ cogorc_putline_A420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, orc_program_append_2 (p, "avgub", 0, ORC_VAR_D3, ORC_VAR_T5, ORC_VAR_T6, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); } p_inited = TRUE; orc_once_mutex_unlock (); diff --git a/gst/colorspace/gstcolorspaceorc-dist.h b/gst/colorspace/gstcolorspaceorc-dist.h index 0e71351e05..2384b522d7 100644 --- a/gst/colorspace/gstcolorspaceorc-dist.h +++ b/gst/colorspace/gstcolorspaceorc-dist.h @@ -35,6 +35,7 @@ typedef unsigned __int16 orc_uint16; typedef unsigned __int32 orc_uint32; typedef unsigned __int64 orc_uint64; #define ORC_UINT64_C(x) (x##Ui64) +#define inline __inline #else #include typedef signed char orc_int8; @@ -57,98 +58,107 @@ typedef union { orc_int16 i; orc_int8 x2[2]; } orc_union16; typedef union { orc_int32 i; float f; orc_int16 x2[2]; orc_int8 x4[4]; } orc_union32; typedef union { orc_int64 i; double f; orc_int32 x2[2]; float x2f[2]; orc_int16 x4[4]; } orc_union64; #endif -void cogorc_memcpy_2d (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_downsample_horiz_cosite_1tap (guint8 * d1, const guint8 * s1, int n); -void cogorc_downsample_horiz_cosite_3tap (guint8 * d1, const guint8 * s1, const guint8 * s2, int n); -void cogorc_downsample_420_jpeg (guint8 * d1, const guint8 * s1, const guint8 * s2, int n); -void cogorc_downsample_vert_halfsite_2tap (guint8 * d1, const guint8 * s1, const guint8 * s2, int n); -void cogorc_downsample_vert_cosite_3tap (guint8 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, int n); -void cogorc_downsample_vert_halfsite_4tap (guint8 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, const guint8 * s4, int n); -void cogorc_upsample_horiz_cosite_1tap (guint8 * d1, const guint8 * s1, int n); -void cogorc_upsample_horiz_cosite (guint8 * d1, const guint8 * s1, const guint8 * s2, int n); -void cogorc_upsample_vert_avgub (guint8 * d1, const guint8 * s1, const guint8 * s2, int n); -void orc_unpack_yuyv_y (guint8 * d1, const guint8 * s1, int n); -void orc_unpack_yuyv_u (guint8 * d1, const guint8 * s1, int n); -void orc_unpack_yuyv_v (guint8 * d1, const guint8 * s1, int n); -void orc_pack_yuyv (guint8 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, int n); -void orc_unpack_uyvy_y (guint8 * d1, const guint8 * s1, int n); -void orc_unpack_uyvy_u (guint8 * d1, const guint8 * s1, int n); -void orc_unpack_uyvy_v (guint8 * d1, const guint8 * s1, int n); -void orc_pack_uyvy (guint8 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, int n); -void orc_matrix2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, int p2, int p3, int n); -void orc_matrix2_11_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, int p2, int n); -void orc_matrix2_12_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, int p2, int n); -void orc_matrix3_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, int p1, int p2, int p3, int p4, int n); -void orc_matrix3_100_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, int p1, int p2, int p3, int n); -void orc_matrix3_100_offset_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, int p1, int p2, int p3, int p4, int p5, int n); -void orc_matrix3_000_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, int p1, int p2, int p3, int p4, int p5, int n); -void orc_pack_123x (guint32 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, int p1, int n); -void orc_pack_x123 (guint32 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, int p1, int n); -void cogorc_combine2_u8 (guint8 * d1, const guint8 * s1, const guint8 * s2, int p1, int p2, int n); -void cogorc_convert_I420_UYVY (guint8 * d1, guint8 * d2, const guint8 * s1, const guint8 * s2, const guint8 * s3, const guint8 * s4, int n); -void cogorc_convert_I420_YUY2 (guint8 * d1, guint8 * d2, const guint8 * s1, const guint8 * s2, const guint8 * s3, const guint8 * s4, int n); -void cogorc_convert_I420_AYUV (guint8 * d1, guint8 * d2, const guint8 * s1, const guint8 * s2, const guint8 * s3, const guint8 * s4, int n); -void cogorc_convert_YUY2_I420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, const guint8 * s1, const guint8 * s2, int n); -void cogorc_convert_UYVY_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_420_422 (guint8 * d1, int d1_stride, guint8 * d2, int d2_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_420_444 (guint8 * d1, int d1_stride, guint8 * d2, int d2_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_422_444 (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_444_422 (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_planar_chroma_444_420 (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, const guint8 * s2, int s2_stride, int n, int m); -void cogorc_planar_chroma_422_420 (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, const guint8 * s2, int s2_stride, int n, int m); -void cogorc_convert_YUY2_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_convert_UYVY_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_convert_YUY2_Y42B (guint8 * d1, int d1_stride, guint8 * d2, int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_convert_UYVY_Y42B (guint8 * d1, int d1_stride, guint8 * d2, int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_convert_YUY2_Y444 (guint8 * d1, int d1_stride, guint8 * d2, int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_convert_UYVY_Y444 (guint8 * d1, int d1_stride, guint8 * d2, int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_convert_UYVY_I420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, const guint8 * s1, const guint8 * s2, int n); -void cogorc_convert_AYUV_I420 (guint8 * d1, int d1_stride, guint8 * d2, int d2_stride, guint8 * d3, int d3_stride, guint8 * d4, int d4_stride, const guint8 * s1, int s1_stride, const guint8 * s2, int s2_stride, int n, int m); -void cogorc_convert_AYUV_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_Y42B (guint8 * d1, int d1_stride, guint8 * d2, int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_Y444 (guint8 * d1, int d1_stride, guint8 * d2, int d2_stride, guint8 * d3, int d3_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_convert_Y42B_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, int s3_stride, int n, int m); -void cogorc_convert_Y42B_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, int s3_stride, int n, int m); -void cogorc_convert_Y42B_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, int s3_stride, int n, int m); -void cogorc_convert_Y444_YUY2 (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, int s3_stride, int n, int m); -void cogorc_convert_Y444_UYVY (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, int s3_stride, int n, int m); -void cogorc_convert_Y444_AYUV (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, const guint8 * s2, int s2_stride, const guint8 * s3, int s3_stride, int n, int m); -void cogorc_convert_AYUV_ARGB (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_BGRA (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_ABGR (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_convert_AYUV_RGBA (guint8 * d1, int d1_stride, const guint8 * s1, int s1_stride, int n, int m); -void cogorc_convert_I420_BGRA (guint8 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, int n); -void cogorc_convert_I420_BGRA_avg (guint8 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, const guint8 * s4, const guint8 * s5, int n); -void cogorc_getline_I420 (guint8 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, int n); -void cogorc_getline_YUV9 (guint8 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, int n); -void cogorc_getline_YUY2 (guint8 * d1, const guint8 * s1, int n); -void cogorc_getline_UYVY (guint8 * d1, const guint8 * s1, int n); -void cogorc_getline_YVYU (guint8 * d1, const guint8 * s1, int n); -void cogorc_getline_Y42B (guint8 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, int n); -void cogorc_getline_Y444 (guint8 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, int n); -void cogorc_getline_Y800 (guint8 * d1, const guint8 * s1, int n); -void cogorc_getline_Y16 (guint8 * d1, const guint8 * s1, int n); -void cogorc_getline_BGRA (guint8 * d1, const guint8 * s1, int n); -void cogorc_getline_ABGR (guint8 * d1, const guint8 * s1, int n); -void cogorc_getline_RGBA (guint8 * d1, const guint8 * s1, int n); -void cogorc_getline_NV12 (guint8 * d1, const guint8 * s1, const guint8 * s2, int n); -void cogorc_getline_NV21 (guint8 * d1, const guint8 * s1, const guint8 * s2, int n); -void cogorc_getline_A420 (guint8 * d1, const guint8 * s1, const guint8 * s2, const guint8 * s3, const guint8 * s4, int n); -void cogorc_putline_I420 (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, int n); -void cogorc_putline_YUY2 (guint8 * d1, const guint8 * s1, int n); -void cogorc_putline_YVYU (guint8 * d1, const guint8 * s1, int n); -void cogorc_putline_UYVY (guint8 * d1, const guint8 * s1, int n); -void cogorc_putline_Y42B (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, int n); -void cogorc_putline_Y444 (guint8 * d1, guint8 * d2, guint8 * d3, const guint8 * s1, int n); -void cogorc_putline_Y800 (guint8 * d1, const guint8 * s1, int n); -void cogorc_putline_Y16 (guint8 * d1, const guint8 * s1, int n); -void cogorc_putline_BGRA (guint8 * d1, const guint8 * s1, int n); -void cogorc_putline_ABGR (guint8 * d1, const guint8 * s1, int n); -void cogorc_putline_RGBA (guint8 * d1, const guint8 * s1, int n); -void cogorc_putline_NV12 (guint8 * d1, guint8 * d2, const guint8 * s1, int n); -void cogorc_putline_NV21 (guint8 * d1, guint8 * d2, const guint8 * s1, int n); -void cogorc_putline_A420 (guint8 * d1, guint8 * d2, guint8 * d3, guint8 * d4, const guint8 * s1, int n); +#ifndef ORC_RESTRICT +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#define ORC_RESTRICT restrict +#elif defined(__GNUC__) && __GNUC__ >= 4 +#define ORC_RESTRICT __restrict__ +#else +#define ORC_RESTRICT +#endif +#endif +void cogorc_memcpy_2d (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_downsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_downsample_horiz_cosite_3tap (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); +void cogorc_downsample_420_jpeg (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); +void cogorc_downsample_vert_halfsite_2tap (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); +void cogorc_downsample_vert_cosite_3tap (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n); +void cogorc_downsample_vert_halfsite_4tap (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n); +void cogorc_upsample_horiz_cosite_1tap (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_upsample_horiz_cosite (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); +void cogorc_upsample_vert_avgub (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); +void orc_unpack_yuyv_y (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void orc_unpack_yuyv_u (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void orc_unpack_yuyv_v (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void orc_pack_yuyv (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n); +void orc_unpack_uyvy_y (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void orc_unpack_uyvy_u (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void orc_unpack_uyvy_v (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void orc_pack_uyvy (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n); +void orc_matrix2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, int p2, int p3, int n); +void orc_matrix2_11_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, int p2, int n); +void orc_matrix2_12_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, int p2, int n); +void orc_matrix3_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int n); +void orc_matrix3_100_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int n); +void orc_matrix3_100_offset_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, int n); +void orc_matrix3_000_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, int n); +void orc_pack_123x (guint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int n); +void orc_pack_x123 (guint32 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int n); +void cogorc_combine2_u8 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int p1, int p2, int n); +void cogorc_convert_I420_UYVY (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n); +void cogorc_convert_I420_YUY2 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n); +void cogorc_convert_I420_AYUV (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n); +void cogorc_convert_YUY2_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); +void cogorc_convert_UYVY_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_planar_chroma_420_422 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_planar_chroma_420_444 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_planar_chroma_422_444 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_planar_chroma_444_422 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_planar_chroma_444_420 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m); +void cogorc_planar_chroma_422_420 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m); +void cogorc_convert_YUY2_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_UYVY_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_YUY2_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_UYVY_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_YUY2_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_UYVY_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_UYVY_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); +void cogorc_convert_AYUV_I420 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, guint8 * ORC_RESTRICT d4, int d4_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m); +void cogorc_convert_AYUV_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_Y42B_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y42B_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y42B_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y444_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y444_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_Y444_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m); +void cogorc_convert_AYUV_ARGB (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_BGRA (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_ABGR (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_AYUV_RGBA (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m); +void cogorc_convert_I420_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n); +void cogorc_convert_I420_BGRA_avg (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, const guint8 * ORC_RESTRICT s5, int n); +void cogorc_getline_I420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n); +void cogorc_getline_YUV9 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n); +void cogorc_getline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_getline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_getline_YVYU (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_getline_Y42B (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n); +void cogorc_getline_Y444 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int n); +void cogorc_getline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_getline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_getline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_getline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_getline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_getline_NV12 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); +void cogorc_getline_NV21 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n); +void cogorc_getline_A420 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n); +void cogorc_putline_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_YUY2 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_YVYU (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_UYVY (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_Y42B (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_Y444 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_Y800 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_Y16 (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_ABGR (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_RGBA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_NV12 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_NV21 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n); +void cogorc_putline_A420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1, int n); #ifdef __cplusplus } diff --git a/gst/dataurisrc/Makefile.am b/gst/dataurisrc/Makefile.am index 558aaab7a0..810ae0cfec 100644 --- a/gst/dataurisrc/Makefile.am +++ b/gst/dataurisrc/Makefile.am @@ -7,3 +7,16 @@ libgstdataurisrc_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) libgstdataurisrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstdataurisrc_la_LIBTOOLFLAGS = --tag=disable-static +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstdataurisrc -:SHARED libgstdataurisrc \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstdataurisrc_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstdataurisrc_la_CFLAGS) \ + -:LDFLAGS $(libgstdataurisrc_la_LDFLAGS) \ + $(libgstdataurisrc_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ \ No newline at end of file diff --git a/gst/dccp/gstdccp_common.h b/gst/dccp/gstdccp_common.h index a2c2ca2a36..cc4c16a1a3 100644 --- a/gst/dccp/gstdccp_common.h +++ b/gst/dccp/gstdccp_common.h @@ -29,7 +29,9 @@ #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 # include #ifndef socklen_t @@ -37,6 +39,7 @@ #endif #endif #include +#include <_stdint.h> #include #include diff --git a/gst/dccp/gstdccpserversink.c b/gst/dccp/gstdccpserversink.c index 1913b8be9a..089fe3a66b 100644 --- a/gst/dccp/gstdccpserversink.c +++ b/gst/dccp/gstdccpserversink.c @@ -168,12 +168,13 @@ static void * gst_dccp_server_delete_dead_clients (void *arg) { GstDCCPServerSink *sink = (GstDCCPServerSink *) arg; - int i; GList *tmp = NULL; + GList *l; pthread_mutex_lock (&lock); - for (i = 0; i < g_list_length (sink->clients); i++) { - Client *client = (Client *) g_list_nth_data (sink->clients, i); + 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 { @@ -272,20 +273,26 @@ gst_dccp_server_sink_render (GstBaseSink * bsink, GstBuffer * buf) GstDCCPServerSink *sink = GST_DCCP_SERVER_SINK (bsink); pthread_t thread_id; - int i; + GList *l; pthread_mutex_lock (&lock); - for (i = 0; i < g_list_length (sink->clients); i++) { - Client *client = (Client *) g_list_nth_data (sink->clients, i); + 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); @@ -300,7 +307,8 @@ static gboolean gst_dccp_server_sink_stop (GstBaseSink * bsink) { GstDCCPServerSink *sink; - int i; + GList *l; + sink = GST_DCCP_SERVER_SINK (bsink); if (sink->wait_connections == TRUE) { @@ -310,8 +318,9 @@ gst_dccp_server_sink_stop (GstBaseSink * bsink) gst_dccp_socket_close (GST_ELEMENT (sink), &(sink->sock_fd)); pthread_mutex_lock (&lock); - for (i = 0; i < g_list_length (sink->clients); i++) { - Client *client = (Client *) g_list_nth_data (sink->clients, i); + 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)); } diff --git a/gst/debugutils/Makefile.am b/gst/debugutils/Makefile.am index 15060467fa..9d237a3251 100644 --- a/gst/debugutils/Makefile.am +++ b/gst/debugutils/Makefile.am @@ -15,12 +15,14 @@ EXTRA_DIST = debugutils-marshal.list plugin_LTLIBRARIES = libgstdebugutilsbad.la libgstdebugutilsbad_la_SOURCES = \ + gstdebugspy.c \ fpsdisplaysink.c \ debugutilsbad.c \ gstchecksumsink.c \ gstchecksumsink.h \ gstchopmydata.c \ - gstchopmydata.h + gstchopmydata.h \ + gstdebugspy.h nodist_libgstdebugutilsbad_la_SOURCES = $(BUILT_SOURCES) libgstdebugutilsbad_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) libgstdebugutilsbad_la_LIBADD = $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) \ @@ -30,3 +32,16 @@ libgstdebugutilsbad_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = fpsdisplaysink.h +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstdebugutils -:SHARED libgstdebugutils \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstdebugutils_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstdebugutils_la_CFLAGS) \ + -:LDFLAGS $(libgstdebugutils_la_LDFLAGS) \ + $(libgstdebugutils_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/debugutils/debugutilsbad.c b/gst/debugutils/debugutilsbad.c index 3ceec512ab..09082a72db 100644 --- a/gst/debugutils/debugutilsbad.c +++ b/gst/debugutils/debugutilsbad.c @@ -26,6 +26,7 @@ GType gst_checksum_sink_get_type (void); GType fps_display_sink_get_type (void); GType gst_chop_my_data_get_type (void); +GType gst_debug_spy_get_type (void); static gboolean plugin_init (GstPlugin * plugin) @@ -36,6 +37,8 @@ plugin_init (GstPlugin * plugin) fps_display_sink_get_type ()); gst_element_register (plugin, "chopmydata", GST_RANK_NONE, gst_chop_my_data_get_type ()); + gst_element_register (plugin, "debugspy", GST_RANK_NONE, + gst_debug_spy_get_type ()); return TRUE; } diff --git a/gst/debugutils/fpsdisplaysink.c b/gst/debugutils/fpsdisplaysink.c index 92f9b019fc..489d88183a 100644 --- a/gst/debugutils/fpsdisplaysink.c +++ b/gst/debugutils/fpsdisplaysink.c @@ -54,6 +54,8 @@ #define DEFAULT_SIGNAL_FPS_MEASUREMENTS FALSE #define DEFAULT_FPS_UPDATE_INTERVAL_MS 500 /* 500 ms */ #define DEFAULT_FONT "Sans 15" +#define DEFAULT_SILENT FALSE +#define DEFAULT_LAST_MESSAGE NULL /* generic templates */ static GstStaticPadTemplate fps_display_sink_template = @@ -76,14 +78,18 @@ enum enum { - ARG_0, - ARG_SYNC, - ARG_TEXT_OVERLAY, - ARG_VIDEO_SINK, - ARG_FPS_UPDATE_INTERVAL, - ARG_MAX_FPS, - ARG_MIN_FPS, - ARG_SIGNAL_FPS_MEASUREMENTS + PROP_0, + PROP_SYNC, + PROP_TEXT_OVERLAY, + PROP_VIDEO_SINK, + PROP_FPS_UPDATE_INTERVAL, + PROP_MAX_FPS, + PROP_MIN_FPS, + PROP_SIGNAL_FPS_MEASUREMENTS, + PROP_FRAMES_DROPPED, + PROP_FRAMES_RENDERED, + PROP_SILENT, + PROP_LAST_MESSAGE /* FILL ME */ }; @@ -101,6 +107,8 @@ static gboolean display_current_fps (gpointer data); static guint fpsdisplaysink_signals[LAST_SIGNAL] = { 0 }; +static GParamSpec *pspec_last_message = NULL; + static void fps_display_sink_class_init (GstFPSDisplaySinkClass * klass) { @@ -113,50 +121,71 @@ fps_display_sink_class_init (GstFPSDisplaySinkClass * klass) gobject_klass->get_property = fps_display_sink_get_property; gobject_klass->dispose = fps_display_sink_dispose; - g_object_class_install_property (gobject_klass, ARG_SYNC, + g_object_class_install_property (gobject_klass, PROP_SYNC, g_param_spec_boolean ("sync", "Sync", "Sync on the clock (if the internally used sink doesn't " "have this property it will be ignored", DEFAULT_SYNC, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)); - g_object_class_install_property (gobject_klass, ARG_TEXT_OVERLAY, + g_object_class_install_property (gobject_klass, PROP_TEXT_OVERLAY, g_param_spec_boolean ("text-overlay", "text-overlay", "Whether to use text-overlay", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)); - g_object_class_install_property (gobject_klass, ARG_VIDEO_SINK, + g_object_class_install_property (gobject_klass, PROP_VIDEO_SINK, g_param_spec_object ("video-sink", "video-sink", "Video sink to use (Must only be called on NULL state)", GST_TYPE_ELEMENT, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)); - g_object_class_install_property (gobject_klass, ARG_FPS_UPDATE_INTERVAL, + g_object_class_install_property (gobject_klass, PROP_FPS_UPDATE_INTERVAL, g_param_spec_int ("fps-update-interval", "Fps update interval", "Time between consecutive frames per second measures and update " " (in ms). Should be set on NULL state", 1, G_MAXINT, DEFAULT_FPS_UPDATE_INTERVAL_MS, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)); - g_object_class_install_property (gobject_klass, ARG_MAX_FPS, + g_object_class_install_property (gobject_klass, PROP_MAX_FPS, g_param_spec_double ("max-fps", "Max fps", "Maximum fps rate measured. Reset when going from NULL to READY." "-1 means no measurement has yet been done", -1, G_MAXDOUBLE, -1, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); - g_object_class_install_property (gobject_klass, ARG_MIN_FPS, + g_object_class_install_property (gobject_klass, PROP_MIN_FPS, g_param_spec_double ("min-fps", "Min fps", "Minimum fps rate measured. Reset when going from NULL to READY." "-1 means no measurement has yet been done", -1, G_MAXDOUBLE, -1, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); - g_object_class_install_property (gobject_klass, ARG_SIGNAL_FPS_MEASUREMENTS, + g_object_class_install_property (gobject_klass, PROP_FRAMES_DROPPED, + g_param_spec_uint ("frames-dropped", "dropped frames", + "Number of frames dropped by the sink", 0, G_MAXUINT, 0, + G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); + + g_object_class_install_property (gobject_klass, PROP_FRAMES_RENDERED, + g_param_spec_uint ("frames-rendered", "rendered frames", + "Number of frames rendered", 0, G_MAXUINT, 0, + G_PARAM_STATIC_STRINGS | G_PARAM_READABLE)); + + g_object_class_install_property (gobject_klass, PROP_SILENT, + g_param_spec_boolean ("silent", "enable stdout output", + "Don't produce last_message events", DEFAULT_SILENT, + G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_klass, PROP_SIGNAL_FPS_MEASUREMENTS, g_param_spec_boolean ("signal-fps-measurements", "Signal fps measurements", "If the fps-measurements signal should be emited.", DEFAULT_SIGNAL_FPS_MEASUREMENTS, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE)); + pspec_last_message = g_param_spec_string ("last-message", "Last Message", + "The message describing current status", DEFAULT_LAST_MESSAGE, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (gobject_klass, PROP_LAST_MESSAGE, + pspec_last_message); + /** * GstFPSDisplaySink::fps-measurements: * @fpsdisplaysink: a #GstFPSDisplaySink @@ -219,9 +248,9 @@ on_video_sink_data_flow (GstPad * pad, GstMiniObject * mini_obj, gst_event_parse_qos (ev, NULL, &diff, &ts); if (diff <= 0.0) { - self->frames_rendered++; + g_atomic_int_inc (&self->frames_rendered); } else { - self->frames_dropped++; + g_atomic_int_inc (&self->frames_dropped); } ts = gst_util_get_timestamp (); @@ -319,6 +348,8 @@ fps_display_sink_init (GstFPSDisplaySink * self, self->video_sink = NULL; self->max_fps = -1; self->min_fps = -1; + self->silent = DEFAULT_SILENT; + self->last_message = g_strdup (DEFAULT_LAST_MESSAGE); self->ghost_pad = gst_ghost_pad_new_no_target ("sink", GST_PAD_SINK); gst_element_add_pad (GST_ELEMENT (self), self->ghost_pad); @@ -334,8 +365,8 @@ display_current_fps (gpointer data) gdouble time_diff, time_elapsed; GstClockTime current_ts = gst_util_get_timestamp (); - frames_rendered = self->frames_rendered; - frames_dropped = self->frames_dropped; + frames_rendered = g_atomic_int_get (&self->frames_rendered); + frames_dropped = g_atomic_int_get (&self->frames_dropped); if ((frames_rendered + frames_dropped) == 0) { /* in case timer fired and we didn't yet get any QOS events */ @@ -375,20 +406,30 @@ display_current_fps (gpointer data) */ if (dr == 0.0) { g_snprintf (fps_message, 255, - "rendered: %" G_GUINT64_FORMAT "\t dropped: %" G_GUINT64_FORMAT - "\t current: %.2f\t average: %.2f", frames_rendered, frames_dropped, rr, + "rendered: %" G_GUINT64_FORMAT ", dropped: %" G_GUINT64_FORMAT + ", current: %.2f, average: %.2f", frames_rendered, frames_dropped, rr, average_fps); } else { g_snprintf (fps_message, 255, - "rendered: %" G_GUINT64_FORMAT "\t dropped: %" G_GUINT64_FORMAT - "\t fps: %.2f\t drop rate: %.2f", frames_rendered, frames_dropped, rr, + "rendered: %" G_GUINT64_FORMAT ", dropped: %" G_GUINT64_FORMAT + ", fps: %.2f, drop rate: %.2f", frames_rendered, frames_dropped, rr, dr); } if (self->use_text_overlay) { g_object_set (self->text_overlay, "text", fps_message, NULL); - } else { - g_print ("%s\n", fps_message); + } + + if (!self->silent) { + GST_OBJECT_LOCK (self); + g_free (self->last_message); + self->last_message = g_strdup (fps_message); + GST_OBJECT_UNLOCK (self); +#if !GLIB_CHECK_VERSION(2,26,0) + g_object_notify ((GObject *) self, "last-message"); +#else + g_object_notify_by_pspec ((GObject *) self, pspec_last_message); +#endif } self->last_frames_rendered = frames_rendered; @@ -404,8 +445,8 @@ fps_display_sink_start (GstFPSDisplaySink * self) GstPad *target_pad = NULL; /* Init counters */ - self->frames_rendered = G_GUINT64_CONSTANT (0); - self->frames_dropped = G_GUINT64_CONSTANT (0); + self->frames_rendered = 0; + self->frames_dropped = 0; self->last_frames_rendered = G_GUINT64_CONSTANT (0); self->last_frames_dropped = G_GUINT64_CONSTANT (0); self->max_fps = -1; @@ -457,10 +498,30 @@ fps_display_sink_stop (GstFPSDisplaySink * self) gst_bin_remove (GST_BIN (self), self->text_overlay); gst_object_unref (self->text_overlay); self->text_overlay = NULL; - } else { - /* print the max and minimum fps values */ - g_print ("Max-fps: %0.2f\nMin-fps: %0.2f\n", self->max_fps, self->min_fps); } + + if (!self->silent) { + gchar *str; + + /* print the max and minimum fps values */ + str = + g_strdup_printf ("Max-fps: %0.2f, Min-fps: %0.2f", self->max_fps, + self->min_fps); + GST_OBJECT_LOCK (self); + g_free (self->last_message); + self->last_message = str; + GST_OBJECT_UNLOCK (self); +#if !GLIB_CHECK_VERSION(2,26,0) + g_object_notify ((GObject *) self, "last-message"); +#else + g_object_notify_by_pspec ((GObject *) self, pspec_last_message); +#endif + } + + GST_OBJECT_LOCK (self); + g_free (self->last_message); + self->last_message = NULL; + GST_OBJECT_UNLOCK (self); } static void @@ -478,6 +539,11 @@ fps_display_sink_dispose (GObject * object) self->text_overlay = NULL; } + GST_OBJECT_LOCK (self); + g_free (self->last_message); + self->last_message = NULL; + GST_OBJECT_UNLOCK (self); + G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -488,11 +554,11 @@ fps_display_sink_set_property (GObject * object, guint prop_id, GstFPSDisplaySink *self = GST_FPS_DISPLAY_SINK (object); switch (prop_id) { - case ARG_SYNC: + case PROP_SYNC: self->sync = g_value_get_boolean (value); fps_display_sink_update_sink_sync (self); break; - case ARG_TEXT_OVERLAY: + case PROP_TEXT_OVERLAY: self->use_text_overlay = g_value_get_boolean (value); if (self->text_overlay) { @@ -505,7 +571,7 @@ fps_display_sink_set_property (GObject * object, guint prop_id, } } break; - case ARG_VIDEO_SINK: + case PROP_VIDEO_SINK: /* FIXME should we add a state-lock or a lock around here? * need to check if it is possible that a state change NULL->READY can * happen while this code is executing on a different thread */ @@ -516,13 +582,16 @@ fps_display_sink_set_property (GObject * object, guint prop_id, } update_video_sink (self, (GstElement *) g_value_get_object (value)); break; - case ARG_FPS_UPDATE_INTERVAL: + case PROP_FPS_UPDATE_INTERVAL: self->fps_update_interval = GST_MSECOND * (GstClockTime) g_value_get_int (value); break; - case ARG_SIGNAL_FPS_MEASUREMENTS: + case PROP_SIGNAL_FPS_MEASUREMENTS: self->signal_measurements = g_value_get_boolean (value); break; + case PROP_SILENT: + self->silent = g_value_get_boolean (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -536,27 +605,41 @@ fps_display_sink_get_property (GObject * object, guint prop_id, GstFPSDisplaySink *self = GST_FPS_DISPLAY_SINK (object); switch (prop_id) { - case ARG_SYNC: + case PROP_SYNC: g_value_set_boolean (value, self->sync); break; - case ARG_TEXT_OVERLAY: + case PROP_TEXT_OVERLAY: g_value_set_boolean (value, self->use_text_overlay); break; - case ARG_VIDEO_SINK: + case PROP_VIDEO_SINK: g_value_set_object (value, self->video_sink); break; - case ARG_FPS_UPDATE_INTERVAL: + case PROP_FPS_UPDATE_INTERVAL: g_value_set_int (value, (gint) (self->fps_update_interval / GST_MSECOND)); break; - case ARG_MAX_FPS: + case PROP_MAX_FPS: g_value_set_double (value, self->max_fps); break; - case ARG_MIN_FPS: + case PROP_MIN_FPS: g_value_set_double (value, self->min_fps); break; - case ARG_SIGNAL_FPS_MEASUREMENTS: + case PROP_FRAMES_DROPPED: + g_value_set_uint (value, g_atomic_int_get (&self->frames_dropped)); + break; + case PROP_FRAMES_RENDERED: + g_value_set_uint (value, g_atomic_int_get (&self->frames_rendered)); + break; + case PROP_SIGNAL_FPS_MEASUREMENTS: g_value_set_boolean (value, self->signal_measurements); break; + case PROP_SILENT: + g_value_set_boolean (value, self->silent); + break; + case PROP_LAST_MESSAGE: + GST_OBJECT_LOCK (self); + g_value_set_string (value, self->last_message); + GST_OBJECT_UNLOCK (self); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; diff --git a/gst/debugutils/fpsdisplaysink.h b/gst/debugutils/fpsdisplaysink.h index 6a016633c6..901ebae413 100644 --- a/gst/debugutils/fpsdisplaysink.h +++ b/gst/debugutils/fpsdisplaysink.h @@ -51,8 +51,8 @@ struct _GstFPSDisplaySink GstPad *ghost_pad; /* statistics */ - guint64 frames_rendered, last_frames_rendered; - guint64 frames_dropped, last_frames_dropped; + gint frames_rendered, frames_dropped; /* ATOMIC */ + guint64 last_frames_rendered, last_frames_dropped; GstClockTime start_ts; GstClockTime last_ts; @@ -66,6 +66,8 @@ struct _GstFPSDisplaySink GstClockTime fps_update_interval; gdouble max_fps; gdouble min_fps; + gboolean silent; + gchar *last_message; }; struct _GstFPSDisplaySinkClass diff --git a/gst/debugutils/gstchecksumsink.c b/gst/debugutils/gstchecksumsink.c index 7e6cb5ed40..bf9fba6f21 100644 --- a/gst/debugutils/gstchecksumsink.c +++ b/gst/debugutils/gstchecksumsink.c @@ -25,13 +25,6 @@ #include #include "gstchecksumsink.h" -/* prototypes */ - - -static void gst_checksum_sink_set_property (GObject * object, - guint property_id, const GValue * value, GParamSpec * pspec); -static void gst_checksum_sink_get_property (GObject * object, - guint property_id, GValue * value, GParamSpec * pspec); static void gst_checksum_sink_dispose (GObject * object); static void gst_checksum_sink_finalize (GObject * object); @@ -40,14 +33,6 @@ static gboolean gst_checksum_sink_stop (GstBaseSink * sink); static GstFlowReturn gst_checksum_sink_render (GstBaseSink * sink, GstBuffer * buffer); -enum -{ - PROP_0, - PROP_SYNC -}; - -/* pad templates */ - static GstStaticPadTemplate gst_checksum_sink_sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, @@ -86,8 +71,6 @@ gst_checksum_sink_class_init (GstChecksumSinkClass * klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GstBaseSinkClass *base_sink_class = GST_BASE_SINK_CLASS (klass); - gobject_class->set_property = gst_checksum_sink_set_property; - gobject_class->get_property = gst_checksum_sink_get_property; gobject_class->dispose = gst_checksum_sink_dispose; gobject_class->finalize = gst_checksum_sink_finalize; base_sink_class->start = GST_DEBUG_FUNCPTR (gst_checksum_sink_start); @@ -100,80 +83,29 @@ gst_checksum_sink_init (GstChecksumSink * checksumsink, GstChecksumSinkClass * checksumsink_class) { gst_base_sink_set_sync (GST_BASE_SINK (checksumsink), FALSE); - -} - -void -gst_checksum_sink_set_property (GObject * object, guint property_id, - const GValue * value, GParamSpec * pspec) -{ - GstChecksumSink *checksumsink; - - g_return_if_fail (GST_IS_CHECKSUM_SINK (object)); - checksumsink = GST_CHECKSUM_SINK (object); - - switch (property_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -void -gst_checksum_sink_get_property (GObject * object, guint property_id, - GValue * value, GParamSpec * pspec) -{ - GstChecksumSink *checksumsink; - - g_return_if_fail (GST_IS_CHECKSUM_SINK (object)); - checksumsink = GST_CHECKSUM_SINK (object); - - switch (property_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } } void gst_checksum_sink_dispose (GObject * object) { - GstChecksumSink *checksumsink; - - g_return_if_fail (GST_IS_CHECKSUM_SINK (object)); - checksumsink = GST_CHECKSUM_SINK (object); - - /* clean up as possible. may be called multiple times */ - G_OBJECT_CLASS (parent_class)->dispose (object); } void gst_checksum_sink_finalize (GObject * object) { - GstChecksumSink *checksumsink; - - g_return_if_fail (GST_IS_CHECKSUM_SINK (object)); - checksumsink = GST_CHECKSUM_SINK (object); - - /* clean up object here */ - G_OBJECT_CLASS (parent_class)->finalize (object); } - - static gboolean gst_checksum_sink_start (GstBaseSink * sink) { - return TRUE; } static gboolean gst_checksum_sink_stop (GstBaseSink * sink) { - return TRUE; } diff --git a/gst/debugutils/gstchopmydata.c b/gst/debugutils/gstchopmydata.c index 22eb2ca49c..16109ad813 100644 --- a/gst/debugutils/gstchopmydata.c +++ b/gst/debugutils/gstchopmydata.c @@ -55,8 +55,6 @@ static void gst_chop_my_data_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); static void gst_chop_my_data_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void gst_chop_my_data_dispose (GObject * object); -static void gst_chop_my_data_finalize (GObject * object); static GstStateChangeReturn gst_chop_my_data_change_state (GstElement * element, GstStateChange transition); @@ -117,8 +115,6 @@ gst_chop_my_data_class_init (GstChopMyDataClass * klass) gobject_class->set_property = gst_chop_my_data_set_property; gobject_class->get_property = gst_chop_my_data_get_property; - gobject_class->dispose = gst_chop_my_data_dispose; - gobject_class->finalize = gst_chop_my_data_finalize; element_class->change_state = GST_DEBUG_FUNCPTR (gst_chop_my_data_change_state); @@ -215,32 +211,6 @@ gst_chop_my_data_get_property (GObject * object, guint property_id, } } -void -gst_chop_my_data_dispose (GObject * object) -{ - GstChopMyData *chopmydata; - - g_return_if_fail (GST_IS_CHOP_MY_DATA (object)); - chopmydata = GST_CHOP_MY_DATA (object); - - /* clean up as possible. may be called multiple times */ - - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -void -gst_chop_my_data_finalize (GObject * object) -{ - GstChopMyData *chopmydata; - - g_return_if_fail (GST_IS_CHOP_MY_DATA (object)); - chopmydata = GST_CHOP_MY_DATA (object); - - /* clean up object here */ - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - static GstStateChangeReturn gst_chop_my_data_change_state (GstElement * element, GstStateChange transition) { @@ -330,9 +300,15 @@ gst_chop_my_data_process (GstChopMyData * chopmydata, gboolean flush) } if (flush) { - buffer = gst_adapter_take_buffer (chopmydata->adapter, - gst_adapter_available (chopmydata->adapter)); - ret = gst_pad_push (chopmydata->srcpad, buffer); + guint min_size = chopmydata->min_size; + + while (gst_adapter_available (chopmydata->adapter) >= min_size) { + buffer = gst_adapter_take_buffer (chopmydata->adapter, min_size); + ret = gst_pad_push (chopmydata->srcpad, buffer); + if (ret != GST_FLOW_OK) + break; + } + gst_adapter_clear (chopmydata->adapter); } return ret; @@ -358,7 +334,6 @@ gst_chop_my_data_chain (GstPad * pad, GstBuffer * buffer) static gboolean gst_chop_my_data_sink_event (GstPad * pad, GstEvent * event) { - GstFlowReturn ret = GST_FLOW_OK; gboolean res; GstChopMyData *chopmydata; @@ -368,17 +343,17 @@ gst_chop_my_data_sink_event (GstPad * pad, GstEvent * event) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_FLUSH_START: - ret = gst_chop_my_data_process (chopmydata, TRUE); res = gst_pad_push_event (chopmydata->srcpad, event); break; case GST_EVENT_FLUSH_STOP: + gst_adapter_clear (chopmydata->adapter); res = gst_pad_push_event (chopmydata->srcpad, event); break; case GST_EVENT_NEWSEGMENT: res = gst_pad_push_event (chopmydata->srcpad, event); break; case GST_EVENT_EOS: - ret = gst_chop_my_data_process (chopmydata, TRUE); + gst_chop_my_data_process (chopmydata, TRUE); res = gst_pad_push_event (chopmydata->srcpad, event); break; default: @@ -387,7 +362,7 @@ gst_chop_my_data_sink_event (GstPad * pad, GstEvent * event) } gst_object_unref (chopmydata); - return TRUE; + return res; } static gboolean @@ -410,5 +385,5 @@ gst_chop_my_data_src_event (GstPad * pad, GstEvent * event) } gst_object_unref (chopmydata); - return TRUE; + return res; } diff --git a/gst/debugutils/gstdebugspy.c b/gst/debugutils/gstdebugspy.c new file mode 100644 index 0000000000..0c9e3300f9 --- /dev/null +++ b/gst/debugutils/gstdebugspy.c @@ -0,0 +1,238 @@ +/* + * GStreamer + * Copyright (C) 2005 Thomas Vander Stichele + * Copyright (C) 2005 Ronald S. Bultje + * Copyright (C) 2011 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/** + * SECTION:element-debugspy + * + * A spy element that can provide information on buffers going through it, with + * bus messages. + * + * + * Example launch line + * |[ + * gst-launch -m videotestsrc ! debugspy ! fakesink + * ]| + * + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "gstdebugspy.h" + +GST_DEBUG_CATEGORY_STATIC (gst_debug_spy_debug); +#define GST_CAT_DEFAULT gst_debug_spy_debug + +/* Filter signals and args */ +enum +{ + /* FILL ME */ + LAST_SIGNAL +}; + +enum +{ + PROP_0, + PROP_SILENT, + PROP_CHECKSUM_TYPE +}; + +/* create a GType for GChecksumType */ +#define GST_DEBUG_SPY_CHECKSUM_TYPE (gst_debug_spy_checksum_get_type()) +static GType +gst_debug_spy_checksum_get_type (void) +{ + static GType checksum_type = 0; + + static const GEnumValue checksum_values[] = { + {G_CHECKSUM_MD5, "Use the MD5 hashing algorithm", "md5"}, + {G_CHECKSUM_SHA1, "Use the SHA-1 hashing algorithm", "sha1"}, + {G_CHECKSUM_SHA256, "Use the SHA-256 hashing algorithm", "sha256"}, + {0, NULL, NULL} + }; + + if (!checksum_type) + checksum_type = g_enum_register_static ("GChecksumType", checksum_values); + + return checksum_type; +} + +/* the capabilities of the inputs and outputs. + * + * describe the real formats here. + */ +static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("ANY") + ); + +static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("ANY") + ); + +GST_BOILERPLATE (GstDebugSpy, gst_debug_spy, GstBaseTransform, + GST_TYPE_BASE_TRANSFORM); + +static void gst_debug_spy_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec); +static void gst_debug_spy_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec); +static GstFlowReturn gst_debug_spy_transform_ip (GstBaseTransform * transform, + GstBuffer * buf); + +/* GObject vmethod implementations */ + +static void +gst_debug_spy_base_init (gpointer gclass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); + + GST_DEBUG_CATEGORY_INIT (gst_debug_spy_debug, "debugspy", 0, "debugspy"); + + gst_element_class_set_details_simple (element_class, + "DebugSpy", + "Filter/Analyzer/Debug", + "DebugSpy provides information on buffers with bus messages", + "Guillaume Emont "); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&src_factory)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_factory)); +} + +/* initialize the debugspy's class */ +static void +gst_debug_spy_class_init (GstDebugSpyClass * klass) +{ + GObjectClass *gobject_class; + GstBaseTransformClass *base_transform_class; + + gobject_class = (GObjectClass *) klass; + base_transform_class = (GstBaseTransformClass *) klass; + + gobject_class->set_property = gst_debug_spy_set_property; + gobject_class->get_property = gst_debug_spy_get_property; + + base_transform_class->passthrough_on_same_caps = TRUE; + base_transform_class->transform_ip = gst_debug_spy_transform_ip; + + g_object_class_install_property (gobject_class, PROP_SILENT, + g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?", + FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (gobject_class, PROP_CHECKSUM_TYPE, + g_param_spec_enum ("checksum-type", "Checksum TYpe", + "Checksum algorithm to use", GST_DEBUG_SPY_CHECKSUM_TYPE, + G_CHECKSUM_SHA1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + +} + +/* initialize the new element + * instantiate pads and add them to element + * set pad calback functions + * initialize instance structure + */ +static void +gst_debug_spy_init (GstDebugSpy * debugspy, GstDebugSpyClass * gclass) +{ + debugspy->silent = FALSE; + debugspy->checksum_type = G_CHECKSUM_SHA1; +} + +static void +gst_debug_spy_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) +{ + GstDebugSpy *debugspy = GST_DEBUGSPY (object); + + switch (prop_id) { + case PROP_SILENT: + debugspy->silent = g_value_get_boolean (value); + break; + case PROP_CHECKSUM_TYPE: + debugspy->checksum_type = g_value_get_enum (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gst_debug_spy_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec) +{ + GstDebugSpy *debugspy = GST_DEBUGSPY (object); + + switch (prop_id) { + case PROP_SILENT: + g_value_set_boolean (value, debugspy->silent); + break; + case PROP_CHECKSUM_TYPE: + g_value_set_enum (value, debugspy->checksum_type); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +/* GstBaseTransform vmethod implementations */ + +static GstFlowReturn +gst_debug_spy_transform_ip (GstBaseTransform * transform, GstBuffer * buf) +{ + GstDebugSpy *debugspy = GST_DEBUGSPY (transform); + + if (debugspy->silent == FALSE) { + gchar *checksum; + GstMessage *message; + GstStructure *message_structure; + + checksum = g_compute_checksum_for_data (debugspy->checksum_type, + GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); + + message_structure = gst_structure_new ("buffer", + "checksum", G_TYPE_STRING, checksum, + "timestamp", GST_TYPE_CLOCK_TIME, GST_BUFFER_TIMESTAMP (buf), + "duration", GST_TYPE_CLOCK_TIME, GST_BUFFER_DURATION (buf), + "offset", G_TYPE_UINT64, GST_BUFFER_OFFSET (buf), + "offset_end", G_TYPE_UINT64, GST_BUFFER_OFFSET_END (buf), + "size", G_TYPE_UINT, GST_BUFFER_SIZE (buf), + "caps", GST_TYPE_CAPS, GST_BUFFER_CAPS (buf), NULL); + + message = + gst_message_new_element (GST_OBJECT (transform), message_structure); + + gst_element_post_message (GST_ELEMENT (transform), message); + + } + + return GST_FLOW_OK; +} diff --git a/gst/debugutils/gstdebugspy.h b/gst/debugutils/gstdebugspy.h new file mode 100644 index 0000000000..3f59b6309c --- /dev/null +++ b/gst/debugutils/gstdebugspy.h @@ -0,0 +1,63 @@ +/* + * GStreamer + * Copyright (C) 2005 Thomas Vander Stichele + * Copyright (C) 2005 Ronald S. Bultje + * Copyright (C) 2011 Igalia S.L. +* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GST_DEBUGSPY_H__ +#define __GST_DEBUGSPY_H__ + +#include +#include + +G_BEGIN_DECLS + +/* #defines don't like whitespacey bits */ +#define GST_TYPE_DEBUGSPY \ + (gst_debug_spy_get_type()) +#define GST_DEBUGSPY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DEBUGSPY,GstDebugSpy)) +#define GST_DEBUGSPY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DEBUGSPY,GstDebugSpyClass)) +#define GST_IS_DEBUGSPY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DEBUGSPY)) +#define GST_IS_DEBUGSPY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DEBUGSPY)) + +typedef struct _GstDebugSpy GstDebugSpy; +typedef struct _GstDebugSpyClass GstDebugSpyClass; + +struct _GstDebugSpy +{ + GstBaseTransform transform; + + gboolean silent; + GChecksumType checksum_type; +}; + +struct _GstDebugSpyClass +{ + GstBaseTransformClass parent_class; +}; + +GType gst_debug_spy_get_type (void); + +G_END_DECLS + +#endif /* __GST_DEBUGSPY_H__ */ diff --git a/gst/dtmf/Makefile.am b/gst/dtmf/Makefile.am index 049518ea6c..d574323637 100644 --- a/gst/dtmf/Makefile.am +++ b/gst/dtmf/Makefile.am @@ -11,7 +11,7 @@ noinst_HEADERS = gstdtmfsrc.h \ gstdtmfdetect.h \ gstrtpdtmfsrc.h \ gstrtpdtmfdepay.h \ - gstrtpdtmfcommon.h \ + gstdtmfcommon.h \ tone_detect.h libgstdtmf_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) \ @@ -21,3 +21,16 @@ libgstdtmf_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstrtp-@GST_MAJORMINOR@ \ libgstdtmf_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstdtmf_la_LIBTOOLFLAGS = --tag=disable-static +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstdtmf -:SHARED libgstdtmf \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstdtmf_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstdtmf_la_CFLAGS) \ + -:LDFLAGS $(libgstdtmf_la_LDFLAGS) \ + $(libgstdtmf_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ \ No newline at end of file diff --git a/gst/dtmf/gstrtpdtmfcommon.h b/gst/dtmf/gstdtmfcommon.h similarity index 65% rename from gst/dtmf/gstrtpdtmfcommon.h rename to gst/dtmf/gstdtmfcommon.h index c1ab82e0a9..aff881b987 100644 --- a/gst/dtmf/gstrtpdtmfcommon.h +++ b/gst/dtmf/gstdtmfcommon.h @@ -2,6 +2,20 @@ #ifndef __GST_RTP_DTMF_COMMON_H__ #define __GST_RTP_DTMF_COMMON_H__ +#define MIN_INTER_DIGIT_INTERVAL 100 /* ms */ +#define MIN_PULSE_DURATION 250 /* ms */ + +#define MIN_VOLUME 0 +#define MAX_VOLUME 36 + +#define MIN_EVENT 0 +#define MAX_EVENT 16 +#define MIN_EVENT_STRING "0" +#define MAX_EVENT_STRING "16" + +#ifndef M_PI +#define M_PI 3.14159265358979323846 /* pi */ +#endif typedef struct { diff --git a/gst/dtmf/gstdtmfsrc.c b/gst/dtmf/gstdtmfsrc.c index 9951c16668..79525b5729 100644 --- a/gst/dtmf/gstdtmfsrc.c +++ b/gst/dtmf/gstdtmfsrc.c @@ -113,7 +113,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif #include @@ -122,10 +122,7 @@ #include -#ifndef M_PI -# define M_PI 3.14159265358979323846 /* pi */ -#endif - +#include "gstdtmfcommon.h" #include "gstdtmfsrc.h" @@ -136,12 +133,6 @@ #define DEFAULT_SAMPLE_RATE 8000 #define SAMPLE_SIZE 16 #define CHANNELS 1 -#define MIN_EVENT 0 -#define MAX_EVENT 16 -#define MIN_VOLUME 0 -#define MAX_VOLUME 36 -#define MIN_INTER_DIGIT_INTERVAL 100 -#define MIN_PULSE_DURATION 250 #define MIN_DUTY_CYCLE (MIN_INTER_DIGIT_INTERVAL + MIN_PULSE_DURATION) @@ -457,17 +448,11 @@ static void gst_dtmf_prepare_timestamps (GstDTMFSrc * dtmfsrc) { GstClock *clock; - GstClockTime base_time; - - base_time = gst_element_get_base_time (GST_ELEMENT (dtmfsrc)); clock = gst_element_get_clock (GST_ELEMENT (dtmfsrc)); if (clock != NULL) { -#ifdef MAEMO_BROKEN - dtmfsrc->timestamp = gst_clock_get_time (clock); -#else - dtmfsrc->timestamp = gst_clock_get_time (clock) - base_time; -#endif + dtmfsrc->timestamp = gst_clock_get_time (clock) + - gst_element_get_base_time (GST_ELEMENT (dtmfsrc)); gst_object_unref (clock); } else { gchar *dtmf_name = gst_element_get_name (dtmfsrc); @@ -696,12 +681,8 @@ gst_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset, clock = gst_element_get_clock (GST_ELEMENT (basesrc)); -#ifdef MAEMO_BROKEN - clockid = gst_clock_new_single_shot_id (clock, dtmfsrc->timestamp); -#else clockid = gst_clock_new_single_shot_id (clock, dtmfsrc->timestamp + gst_element_get_base_time (GST_ELEMENT (dtmfsrc))); -#endif gst_object_unref (clock); GST_OBJECT_LOCK (dtmfsrc); diff --git a/gst/dtmf/gstrtpdtmfdepay.c b/gst/dtmf/gstrtpdtmfdepay.c index ccf2b02fb0..603416dd6f 100644 --- a/gst/dtmf/gstrtpdtmfdepay.c +++ b/gst/dtmf/gstrtpdtmfdepay.c @@ -81,7 +81,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif #include @@ -90,23 +90,12 @@ #include #include "gstrtpdtmfdepay.h" -#ifndef M_PI -# define M_PI 3.14159265358979323846 /* pi */ -#endif - - #define DEFAULT_PACKET_INTERVAL 50 /* ms */ #define MIN_PACKET_INTERVAL 10 /* ms */ #define MAX_PACKET_INTERVAL 50 /* ms */ #define SAMPLE_RATE 8000 #define SAMPLE_SIZE 16 #define CHANNELS 1 -#define MIN_EVENT 0 -#define MAX_EVENT 16 -#define MIN_VOLUME 0 -#define MAX_VOLUME 36 -#define MIN_INTER_DIGIT_INTERVAL 100 -#define MIN_PULSE_DURATION 250 #define MIN_DUTY_CYCLE (MIN_INTER_DIGIT_INTERVAL + MIN_PULSE_DURATION) #define MIN_UNIT_TIME 0 diff --git a/gst/dtmf/gstrtpdtmfdepay.h b/gst/dtmf/gstrtpdtmfdepay.h index 172cb8414f..65d94549fe 100644 --- a/gst/dtmf/gstrtpdtmfdepay.h +++ b/gst/dtmf/gstrtpdtmfdepay.h @@ -27,7 +27,7 @@ #include #include -#include "gstrtpdtmfcommon.h" +#include "gstdtmfcommon.h" G_BEGIN_DECLS #define GST_TYPE_RTP_DTMF_DEPAY \ diff --git a/gst/dtmf/gstrtpdtmfsrc.c b/gst/dtmf/gstrtpdtmfsrc.c index 22fc59c25e..c7e1c1fb2a 100644 --- a/gst/dtmf/gstrtpdtmfsrc.c +++ b/gst/dtmf/gstrtpdtmfsrc.c @@ -111,7 +111,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif #include @@ -130,15 +130,6 @@ #define DEFAULT_TIMESTAMP_OFFSET -1 #define DEFAULT_SEQNUM_OFFSET -1 #define DEFAULT_CLOCK_RATE 8000 -#define MIN_EVENT 0 -#define MAX_EVENT 16 -#define MIN_EVENT_STRING "0" -#define MAX_EVENT_STRING "16" -#define MIN_VOLUME 0 -#define MAX_VOLUME 36 - -#define MIN_INTER_DIGIT_INTERVAL 50 /* ms */ -#define MIN_PULSE_DURATION 70 /* ms */ #define DEFAULT_PACKET_REDUNDANCY 1 #define MIN_PACKET_REDUNDANCY 1 @@ -515,18 +506,12 @@ static void gst_rtp_dtmf_prepare_timestamps (GstRTPDTMFSrc * dtmfsrc) { GstClock *clock; - GstClockTime base_time; - -#ifdef MAEMO_BROKEN - base_time = 0; -#else - base_time = gst_element_get_base_time (GST_ELEMENT (dtmfsrc)); -#endif clock = gst_element_get_clock (GST_ELEMENT (dtmfsrc)); if (clock != NULL) { dtmfsrc->timestamp = gst_clock_get_time (clock) - + (MIN_INTER_DIGIT_INTERVAL * GST_MSECOND) - base_time; + + (MIN_INTER_DIGIT_INTERVAL * GST_MSECOND) + - gst_element_get_base_time (GST_ELEMENT (dtmfsrc)); dtmfsrc->start_timestamp = dtmfsrc->timestamp; gst_object_unref (clock); } else { @@ -742,13 +727,8 @@ gst_rtp_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset, GST_DEBUG_OBJECT (dtmfsrc, "Processed events, now lets wait on the clock"); clock = gst_element_get_clock (GST_ELEMENT (basesrc)); - -#ifdef MAEMO_BROKEN - clockid = gst_clock_new_single_shot_id (clock, dtmfsrc->timestamp); -#else clockid = gst_clock_new_single_shot_id (clock, dtmfsrc->timestamp + gst_element_get_base_time (GST_ELEMENT (dtmfsrc))); -#endif gst_object_unref (clock); GST_OBJECT_LOCK (dtmfsrc); diff --git a/gst/dtmf/gstrtpdtmfsrc.h b/gst/dtmf/gstrtpdtmfsrc.h index b1a483a102..d04c6ecb7c 100644 --- a/gst/dtmf/gstrtpdtmfsrc.h +++ b/gst/dtmf/gstrtpdtmfsrc.h @@ -29,7 +29,7 @@ #include #include -#include "gstrtpdtmfcommon.h" +#include "gstdtmfcommon.h" G_BEGIN_DECLS #define GST_TYPE_RTP_DTMF_SRC (gst_rtp_dtmf_src_get_type()) diff --git a/gst/dvbsuboverlay/Makefile.am b/gst/dvbsuboverlay/Makefile.am index 531685e04b..8598612784 100644 --- a/gst/dvbsuboverlay/Makefile.am +++ b/gst/dvbsuboverlay/Makefile.am @@ -8,3 +8,17 @@ libgstdvbsuboverlay_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstdvbsuboverlay_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstdvbsuboverlay.h dvb-sub.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstdvbsuboverlay -:SHARED libgstdvbsuboverlay \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstdvbsuboverlay_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstdvbsuboverlay_la_CFLAGS) \ + -:LDFLAGS $(libgstdvbsuboverlay_la_LDFLAGS) \ + $(libgstdvbsuboverlay_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/dvbsuboverlay/gstdvbsuboverlay.c b/gst/dvbsuboverlay/gstdvbsuboverlay.c index 9962ff0237..5dc04cb95b 100644 --- a/gst/dvbsuboverlay/gstdvbsuboverlay.c +++ b/gst/dvbsuboverlay/gstdvbsuboverlay.c @@ -444,13 +444,13 @@ blit_i420 (GstDVBSubOverlay * overlay, DVBSubtitles * subs, GstBuffer * buffer) const guint8 *src; guint8 *dst_y, *dst_y2, *dst_u, *dst_v; gint x, y; - gint w2, h2; + gint w2; gint width = overlay->width; gint height = overlay->height; gint src_stride; - gint y_offset, y_height, y_width, y_stride; - gint u_offset, u_height, u_width, u_stride; - gint v_offset, v_height, v_width, v_stride; + gint y_offset, y_stride; + gint u_offset, u_stride; + gint v_offset, v_stride; gint scale = 0; gint scale_x = 0, scale_y = 0; /* 16.16 fixed point */ @@ -464,20 +464,6 @@ blit_i420 (GstDVBSubOverlay * overlay, DVBSubtitles * subs, GstBuffer * buffer) gst_video_format_get_component_offset (GST_VIDEO_FORMAT_I420, 2, width, height); - y_height = - gst_video_format_get_component_height (GST_VIDEO_FORMAT_I420, 0, height); - u_height = - gst_video_format_get_component_height (GST_VIDEO_FORMAT_I420, 1, height); - v_height = - gst_video_format_get_component_height (GST_VIDEO_FORMAT_I420, 2, height); - - y_width = - gst_video_format_get_component_width (GST_VIDEO_FORMAT_I420, 0, width); - u_width = - gst_video_format_get_component_width (GST_VIDEO_FORMAT_I420, 1, width); - v_width = - gst_video_format_get_component_width (GST_VIDEO_FORMAT_I420, 2, width); - y_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_I420, 0, width); u_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_I420, 1, width); v_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_I420, 2, width); @@ -528,7 +514,6 @@ blit_i420 (GstDVBSubOverlay * overlay, DVBSubtitles * subs, GstBuffer * buffer) ystep = (sub_region->h << 16) / dh; w2 = (dw + 1) / 2; - h2 = (dh + 1) / 2; src_stride = sub_region->pict.rowstride; @@ -547,32 +532,32 @@ blit_i420 (GstDVBSubOverlay * overlay, DVBSubtitles * subs, GstBuffer * buffer) sub_region->pict.palette[src[(sy >> 16) * src_stride + (sx >> 16)]]; a1 = (color >> 24) & 0xff; y1 = (color >> 16) & 0xff; - u1 = (color >> 8) & 0xff; - v1 = color & 0xff; + u1 = ((color >> 8) & 0xff) * a1; + v1 = (color & 0xff) * a1; color = sub_region->pict.palette[src[(sy >> 16) * src_stride + ((sx + xstep) >> 16)]]; a2 = (color >> 24) & 0xff; y2 = (color >> 16) & 0xff; - u2 = (color >> 8) & 0xff; - v2 = color & 0xff; + u2 = ((color >> 8) & 0xff) * a2; + v2 = (color & 0xff) * a2; color = sub_region->pict.palette[src[((sy + ystep) >> 16) * src_stride + (sx >> 16)]]; a3 = (color >> 24) & 0xff; y3 = (color >> 16) & 0xff; - u3 = (color >> 8) & 0xff; - v3 = color & 0xff; + u3 = ((color >> 8) & 0xff) * a3; + v3 = (color & 0xff) * a3; color = sub_region->pict.palette[src[((sy + ystep) >> 16) * src_stride + ((sx + xstep) >> 16)]]; a4 = (color >> 24) & 0xff; y4 = (color >> 16) & 0xff; - u4 = (color >> 8) & 0xff; - v4 = color & 0xff; + u4 = ((color >> 8) & 0xff) * a4; + v4 = (color & 0xff) * a4; dst_y[0] = (a1 * y1 + (255 - a1) * dst_y[0]) / 255; dst_y[1] = (a2 * y2 + (255 - a2) * dst_y[1]) / 255; @@ -580,10 +565,8 @@ blit_i420 (GstDVBSubOverlay * overlay, DVBSubtitles * subs, GstBuffer * buffer) dst_y2[1] = (a4 * y4 + (255 - a4) * dst_y2[1]) / 255; a1 = (a1 + a2 + a3 + a4) / 4; - dst_u[0] = - (a1 * ((u1 + u2 + u3 + u4) / 4) + (255 - a1) * dst_u[0]) / 255; - dst_v[0] = - (a1 * ((v1 + v2 + v3 + v4) / 4) + (255 - a1) * dst_v[0]) / 255; + dst_u[0] = ((u1 + u2 + u3 + u4) / 4 + (255 - a1) * dst_u[0]) / 255; + dst_v[0] = ((v1 + v2 + v3 + v4) / 4 + (255 - a1) * dst_v[0]) / 255; dst_y += 2; dst_y2 += 2; @@ -598,23 +581,23 @@ blit_i420 (GstDVBSubOverlay * overlay, DVBSubtitles * subs, GstBuffer * buffer) sub_region->pict.palette[src[(sy >> 16) * src_stride + (sx >> 16)]]; a1 = (color >> 24) & 0xff; y1 = (color >> 16) & 0xff; - u1 = (color >> 8) & 0xff; - v1 = color & 0xff; + u1 = ((color >> 8) & 0xff) * a1; + v1 = (color & 0xff) * a1; color = sub_region->pict.palette[src[((sy + ystep) >> 16) * src_stride + (sx >> 16)]]; a3 = (color >> 24) & 0xff; y3 = (color >> 16) & 0xff; - u3 = (color >> 8) & 0xff; - v3 = color & 0xff; + u3 = ((color >> 8) & 0xff) * a3; + v3 = (color & 0xff) * a3; dst_y[0] = (a1 * y1 + (255 - a1) * dst_y[0]) / 255; dst_y2[0] = (a3 * y3 + (255 - a3) * dst_y2[0]) / 255; a1 = (a1 + a3) / 2; - dst_u[0] = (a1 * ((u1 + u3) / 2) + (255 - a1) * dst_u[0]) / 255; - dst_v[0] = (a1 * ((v1 + v3) / 2) + (255 - a1) * dst_v[0]) / 255; + dst_u[0] = ((u1 + u3) / 2 + (255 - a1) * dst_u[0]) / 255; + dst_v[0] = ((v1 + v3) / 2 + (255 - a1) * dst_v[0]) / 255; dst_y += 1; dst_y2 += 1; @@ -639,23 +622,23 @@ blit_i420 (GstDVBSubOverlay * overlay, DVBSubtitles * subs, GstBuffer * buffer) sub_region->pict.palette[src[(sy >> 16) * src_stride + (sx >> 16)]]; a1 = (color >> 24) & 0xff; y1 = (color >> 16) & 0xff; - u1 = (color >> 8) & 0xff; - v1 = color & 0xff; + u1 = ((color >> 8) & 0xff) * a1; + v1 = (color & 0xff) * a1; color = sub_region->pict.palette[src[(sy >> 16) * src_stride + ((sx + xstep) >> 16)]]; a2 = (color >> 24) & 0xff; y2 = (color >> 16) & 0xff; - u2 = (color >> 8) & 0xff; - v2 = color & 0xff; + u2 = ((color >> 8) & 0xff) * a2; + v2 = (color & 0xff) * a2; dst_y[0] = (a1 * y1 + (255 - a1) * dst_y[0]) / 255; dst_y[1] = (a2 * y2 + (255 - a2) * dst_y[1]) / 255; a1 = (a1 + a2) / 2; - dst_u[0] = (a1 * ((u1 + u2) / 2) + (255 - a1) * dst_u[0]) / 255; - dst_v[0] = (a1 * ((v1 + v2) / 2) + (255 - a1) * dst_v[0]) / 255; + dst_u[0] = ((u1 + u2) / 2 + (255 - a1) * dst_u[0]) / 255; + dst_v[0] = ((v1 + v2) / 2 + (255 - a1) * dst_v[0]) / 255; dst_y += 2; dst_u += 1; @@ -669,13 +652,13 @@ blit_i420 (GstDVBSubOverlay * overlay, DVBSubtitles * subs, GstBuffer * buffer) sub_region->pict.palette[src[(sy >> 16) * src_stride + (sx >> 16)]]; a1 = (color >> 24) & 0xff; y1 = (color >> 16) & 0xff; - u1 = (color >> 8) & 0xff; - v1 = color & 0xff; + u1 = ((color >> 8) & 0xff) * a1; + v1 = (color & 0xff) * a1; dst_y[0] = (a1 * y1 + (255 - a1) * dst_y[0]) / 255; - dst_u[0] = (a1 * u1 + (255 - a1) * dst_u[0]) / 255; - dst_v[0] = (a1 * v1 + (255 - a1) * dst_v[0]) / 255; + dst_u[0] = (u1 + (255 - a1) * dst_u[0]) / 255; + dst_v[0] = (v1 + (255 - a1) * dst_v[0]) / 255; dst_y += 1; dst_u += 1; diff --git a/gst/dvdspu/Makefile.am b/gst/dvdspu/Makefile.am index 28fbc1bb4c..0acbcb9adb 100644 --- a/gst/dvdspu/Makefile.am +++ b/gst/dvdspu/Makefile.am @@ -12,3 +12,17 @@ libgstdvdspu_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstdvdspu.h gstspu-pgs.h gstspu-vobsub.h gstspu-common.h EXTRA_DIST = Notes.txt + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstdvdspu -:SHARED libgstdvdspu \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstdvdspu_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstdvdspu_la_CFLAGS) \ + -:LDFLAGS $(libgstdvdspu_la_LDFLAGS) \ + $(libgstdvdspu_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/dvdspu/gstspu-pgs.c b/gst/dvdspu/gstspu-pgs.c index b860b290b9..a244ac9932 100644 --- a/gst/dvdspu/gstspu-pgs.c +++ b/gst/dvdspu/gstspu-pgs.c @@ -81,8 +81,9 @@ dump_bytes (guint8 * data, guint16 len) static void dump_rle_data (GstDVDSpu * dvdspu, guint8 * data, guint32 len) { + guint16 obj_h G_GNUC_UNUSED; + guint16 obj_w; guint8 *end = data + len; - guint16 obj_w, obj_h; guint x = 0; if (data + 4 > end) @@ -175,7 +176,8 @@ pgs_composition_object_render (PgsCompositionObject * obj, SpuState * state, SpuColour *colour; guint8 *planes[3]; /* YUV frame pointers */ guint8 *data, *end; - guint16 obj_w, obj_h; + guint16 obj_w; + guint16 obj_h G_GNUC_UNUSED; guint x, y, i, min_x, max_x; if (G_UNLIKELY (obj->rle_data == NULL || obj->rle_data_size == 0 @@ -461,8 +463,8 @@ parse_set_palette (GstDVDSpu * dvdspu, guint8 type, guint8 * payload, const gint PGS_PALETTE_ENTRY_SIZE = 5; guint8 *end = payload + len; - guint8 palette_id; - guint8 palette_version; + guint8 palette_id G_GNUC_UNUSED; + guint8 palette_version G_GNUC_UNUSED; gint n_entries, i; if (len < 2) /* Palette command too short */ @@ -520,7 +522,7 @@ parse_set_window (GstDVDSpu * dvdspu, guint8 type, guint8 * payload, { SpuState *state = &dvdspu->spu_state; guint8 *end = payload + len; - guint8 win_count, win_id; + guint8 win_count, win_id G_GNUC_UNUSED; gint i; if (payload + 1 > end) diff --git a/gst/faceoverlay/Makefile.am b/gst/faceoverlay/Makefile.am new file mode 100644 index 0000000000..30b780c20b --- /dev/null +++ b/gst/faceoverlay/Makefile.am @@ -0,0 +1,13 @@ +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_MAJORMINOR@ $(GST_LIBS) +libgstfaceoverlay_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstfaceoverlay_la_LIBTOOLFLAGS = --tag=disable-static + +# headers we need but don't want installed +noinst_HEADERS = gstfaceoverlay.h diff --git a/gst/faceoverlay/gstfaceoverlay.c b/gst/faceoverlay/gstfaceoverlay.c new file mode 100644 index 0000000000..feb07b5bd3 --- /dev/null +++ b/gst/faceoverlay/gstfaceoverlay.c @@ -0,0 +1,500 @@ +/* + * GStreamer faceoverlay plugin + * Copyright (C) 2011 Laura Lucas Alday + * + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, 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. + * + * + * Example launch line + * |[ + * gst-launch autovideosrc ! ffmpegcolorspace ! faceoverlay location=/path/to/gnome-video-effects/pixmaps/bow.svg x=-5 y=-15 w=0.3 h=0.1 ! ffmpegcolorspace ! autovideosink + + * ]| + * + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include + +#include "gstfaceoverlay.h" + +GST_DEBUG_CATEGORY_STATIC (gst_face_overlay_debug); +#define GST_CAT_DEFAULT gst_face_overlay_debug + +#if G_BYTE_ORDER == G_LITTLE_ENDIAN +#define GST_STR_VIDEO_CAPS GST_VIDEO_CAPS_BGRA +#else +#define GST_STR_VIDEO_CAPS GST_VIDEO_CAPS_ARGB +#endif + +/* Filter signals and args */ +enum +{ + /* FILL ME */ + LAST_SIGNAL +}; + +enum +{ + PROP_0, + PROP_LOCATION, + PROP_X, + PROP_Y, + PROP_W, + PROP_H +}; + +/* the capabilities of the inputs and outputs. */ +static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_STR_VIDEO_CAPS) + ); + +static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_STR_VIDEO_CAPS) + ); + +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_reset (GstFaceOverlay * filter); +static gboolean gst_face_overlay_create_pad (GstFaceOverlay * filter, + GstPad * filter_pad, const char *pad_name, GstElement * child_element); +static gboolean toggle_pads_link_state (GstPad * pad1, GstPad * pad2); + + +static gboolean +toggle_pads_link_state (GstPad * pad1, GstPad * pad2) +{ + gboolean ok = TRUE; + + if (gst_pad_is_linked (pad1)) { + if (gst_pad_get_direction (pad1) == GST_PAD_SINK) + gst_pad_unlink (pad2, pad1); + else + gst_pad_unlink (pad1, pad2); + } else { + if (gst_pad_get_direction (pad1) == GST_PAD_SINK) + ok &= (gst_pad_link (pad2, pad1) == 0); + else + ok &= (gst_pad_link (pad1, pad2) == 0); + } + + return ok; +} + +/* Unlinks and removes the pad that was created in gst_face_overlay_init () + * and adds the internal element ghost pad instead */ +static gboolean +gst_face_overlay_create_pad (GstFaceOverlay * filter, GstPad * filter_pad, + const char *pad_name, GstElement * child_element) +{ + GstPad *peer = NULL; + GstPad *pad = NULL; + gboolean ok = TRUE; + + /* get the outside world pad connected to faceoverlay src/sink pad */ + peer = gst_pad_get_peer (filter_pad); + + /* unlink and remove the faceoverlay src/sink pad */ + toggle_pads_link_state (peer, filter_pad); + + gst_element_remove_pad (GST_ELEMENT (filter), filter_pad); + + /* add a ghost pad pointing to the child element pad (facedetect sink or + * svg_overlay src depending on filter_pad direction) and add it to + * faceoverlay bin */ + pad = gst_element_get_static_pad (child_element, pad_name); + filter_pad = gst_ghost_pad_new (pad_name, pad); + gst_object_unref (GST_OBJECT (pad)); + + gst_element_add_pad (GST_ELEMENT (filter), filter_pad); + + /* link the child element pad to the outside world thru the ghost pad */ + toggle_pads_link_state (peer, filter_pad); + + g_object_unref (peer); + + return ok; +} + +static gboolean +gst_face_overlay_reset (GstFaceOverlay * filter) +{ + gst_element_set_state (filter->face_detect, GST_STATE_NULL); + gst_bin_remove (GST_BIN (filter), filter->face_detect); + filter->face_detect = NULL; + + gst_element_set_state (filter->svg_overlay, GST_STATE_NULL); + gst_bin_remove (GST_BIN (filter), filter->svg_overlay); + filter->svg_overlay = NULL; + + gst_element_set_state (filter->colorspace, GST_STATE_NULL); + gst_bin_remove (GST_BIN (filter), filter->colorspace); + filter->colorspace = NULL; + + return TRUE; +} + +static gboolean +gst_face_overlay_create_children (GstFaceOverlay * filter) +{ + gboolean ret = TRUE; + + if ((filter->colorspace = gst_element_factory_make ("ffmpegcolorspace", + NULL)) == NULL) { + return FALSE; + } + + if ((filter->face_detect = gst_element_factory_make ("facedetect", + NULL)) == NULL) { + return FALSE; + } + g_object_set (filter->face_detect, "display", 0, NULL); + + if ((filter->svg_overlay = gst_element_factory_make ("rsvgoverlay", + NULL)) == NULL) { + return FALSE; + } + + gst_bin_add_many (GST_BIN (filter), + filter->face_detect, filter->colorspace, filter->svg_overlay, NULL); + + ret &= gst_element_link_pads (filter->face_detect, "src", + filter->colorspace, "sink"); + ret &= gst_element_link_pads (filter->colorspace, "src", + filter->svg_overlay, "sink"); + + ret &= gst_face_overlay_create_pad (filter, filter->sinkpad, "sink", + filter->face_detect); + ret &= gst_face_overlay_create_pad (filter, filter->srcpad, "src", + filter->svg_overlay); + + return ret; + +} + +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 (!gst_face_overlay_create_children (filter)) + return GST_STATE_CHANGE_FAILURE; + break; + default: + break; + } + + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + + switch (transition) { + case GST_STATE_CHANGE_READY_TO_NULL: + gst_face_overlay_reset (filter); + break; + default: + break; + } + + return ret; +} + +static void +gst_face_overlay_message_handler (GstBin * bin, GstMessage * message) +{ + if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT && + strcmp (gst_structure_get_name (message->structure), "facedetect") == 0) { + GstFaceOverlay *filter = GST_FACEOVERLAY (bin); + + /* optionally draw the image once every two messages for better performance + * filter->process_message = !filter->process_message; + * if(!filter->process_message) + * return; + */ + + guint x, y, width, height; + int delta_x, delta_y, svg_x, svg_y, svg_width, svg_height; + const GstStructure *face; + int face_count; + + face_count = + gst_value_list_get_size (gst_structure_get_value (message->structure, + "faces")); + + /* 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 = + gst_value_get_structure (gst_value_list_get_value + (gst_structure_get_value (message->structure, "faces"), + face_count - 1)); + 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 */ + + delta_x = (int) (filter->x * (int) width); + svg_x = (int) x + delta_x; + + delta_y = (int) (filter->y * (int) height); + svg_y = (int) y + delta_y; + + svg_width = (int) width *filter->w; + svg_height = (int) height *filter->h; + + g_object_set (filter->svg_overlay, + "location", filter->location, + "x", svg_x, "y", svg_y, "width", svg_width, "height", svg_height, NULL); + + } + + GST_BIN_CLASS (parent_class)->handle_message (bin, message); +} + +/* GObject vmethod implementations */ +/* the _base_init() function is meant to initialize class and child class + * properties during each new child class creation */ +static void +gst_face_overlay_base_init (gpointer gclass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); + + gst_element_class_set_details_simple (element_class, + "faceoverlay", + "Filter/Editor/Video", + "Overlays SVG graphics over a detected face in a video stream", + "Laura Lucas Alday "); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&src_factory)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_factory)); +} + +/* initialize the faceoverlay's class */ +/* the _class_init() function is used to initialise the class only once + * (specifying what signals, arguments and virtual functions the class has and + * setting up global state) */ +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); + +} + +/* initialize the new element + * instantiate pads and add them to element + * set pad calback functions + * initialize instance structure + * the _init() function is used to initialise a specific instance of this type. + */ +static void +gst_face_overlay_init (GstFaceOverlay * filter, GstFaceOverlayClass * gclass) +{ + filter->x = 0; + filter->y = 0; + filter->w = 1; + filter->h = 1; + filter->colorspace = NULL; + filter->svg_overlay = NULL; + filter->face_detect = NULL; + filter->location = NULL; + filter->process_message = TRUE; + + filter->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink"); + gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad); + + filter->srcpad = gst_pad_new_from_static_template (&src_factory, "src"); + gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad); + +} + +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: + filter->location = g_value_dup_string (value); + break; + case PROP_X: + filter->x = g_value_get_float (value); + break; + case PROP_Y: + filter->y = g_value_get_float (value); + break; + case PROP_W: + filter->w = g_value_get_float (value); + break; + case PROP_H: + filter->h = g_value_get_float (value); + 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: + g_value_set_string (value, filter->location); + break; + case PROP_X: + g_value_set_float (value, filter->x); + break; + case PROP_Y: + g_value_set_float (value, filter->y); + break; + case PROP_W: + g_value_set_float (value, filter->w); + break; + case PROP_H: + g_value_set_float (value, filter->h); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +/* entry point to initialize the plug-in + * initialize the plug-in itself + * register the element factories and other features + */ +static gboolean +faceoverlay_init (GstPlugin * faceoverlay) +{ + /* debug category for fltering log messages */ + 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); +} + +/* 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 "faceoverlay" +#endif + +/* gstreamer looks for this structure to register plugins */ +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "faceoverlay", + "SVG Face Overlay", + faceoverlay_init, VERSION, "LGPL", "GStreamer", "http://gstreamer.net/") diff --git a/gst/faceoverlay/gstfaceoverlay.h b/gst/faceoverlay/gstfaceoverlay.h new file mode 100644 index 0000000000..7b8e50c00b --- /dev/null +++ b/gst/faceoverlay/gstfaceoverlay.h @@ -0,0 +1,91 @@ +/* + * GStreamer faceoverlay plugin + * Copyright (C) 2011 Laura Lucas Alday + * + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GST_FACEOVERLAY_H__ +#define __GST_FACEOVERLAY_H__ + +#include + +G_BEGIN_DECLS +/* #defines don't like whitespacey bits */ +#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; + + 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/festival/Makefile.am b/gst/festival/Makefile.am index 9401a77fae..e1a62ac270 100644 --- a/gst/festival/Makefile.am +++ b/gst/festival/Makefile.am @@ -17,3 +17,17 @@ libgstfestival_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstfestival_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstfestival.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstfestival -:SHARED libgstfestival \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstfestival_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstfestival_la_CFLAGS) \ + -:LDFLAGS $(libgstfestival_la_LDFLAGS) \ + $(libgstfestival_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/festival/gstfestival.c b/gst/festival/gstfestival.c index dbecfdbe56..6423bf5b97 100644 --- a/gst/festival/gstfestival.c +++ b/gst/festival/gstfestival.c @@ -311,6 +311,7 @@ gst_festival_chain (GstPad * pad, GstBuffer * buf) GST_DEBUG_OBJECT (festival, "issued Parameter.set command"); if (read_response (festival) == FALSE) { ret = GST_FLOW_ERROR; + fclose (fd); goto out; } diff --git a/gst/fieldanalysis/gstfieldanalysis.c b/gst/fieldanalysis/gstfieldanalysis.c index 5f093320f1..21b2e0d6cc 100644 --- a/gst/fieldanalysis/gstfieldanalysis.c +++ b/gst/fieldanalysis/gstfieldanalysis.c @@ -333,7 +333,9 @@ gst_field_analysis_reset (GstFieldAnalysis * filter) filter->first_buffer = TRUE; filter->width = 0; g_free (filter->comb_mask); + filter->comb_mask = NULL; g_free (filter->block_scores); + filter->block_scores = NULL; } static void @@ -630,7 +632,7 @@ gst_field_analysis_set_caps (GstPad * pad, GstCaps * caps) * returns it */ static GstBuffer * gst_field_analysis_decorate (GstFieldAnalysis * filter, gboolean tff, - gboolean onefield, FieldAnalysisConclusion conclusion, gboolean gap) + gboolean onefield, FieldAnalysisConclusion conclusion, gboolean drop) { GstBuffer *buf = NULL; GstCaps *caps; @@ -674,10 +676,11 @@ gst_field_analysis_decorate (GstFieldAnalysis * filter, gboolean tff, GST_BUFFER_FLAG_UNSET (buf, GST_VIDEO_BUFFER_ONEFIELD); } - GST_BUFFER_FLAG_UNSET (buf, GST_VIDEO_BUFFER_RFF); - - if (gap) - GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_GAP); + if (drop) { + GST_BUFFER_FLAG_SET (buf, GST_VIDEO_BUFFER_RFF); + } else { + GST_BUFFER_FLAG_UNSET (buf, GST_VIDEO_BUFFER_RFF); + } if (conclusion == FIELD_ANALYSIS_TELECINE_PROGRESSIVE || (filter->is_telecine && conclusion == FIELD_ANALYSIS_PROGRESSIVE)) @@ -704,12 +707,12 @@ gst_field_analysis_decorate (GstFieldAnalysis * filter, gboolean tff, gst_caps_unref (caps); GST_DEBUG_OBJECT (filter, - "Pushing buffer with flags: %p (%p), p %d, tff %d, 1f %d, gap %d; conc %d", + "Pushing buffer with flags: %p (%p), p %d, tff %d, 1f %d, drop %d; conc %d", GST_BUFFER_DATA (buf), buf, GST_BUFFER_FLAG_IS_SET (buf, GST_VIDEO_BUFFER_PROGRESSIVE), GST_BUFFER_FLAG_IS_SET (buf, GST_VIDEO_BUFFER_TFF), GST_BUFFER_FLAG_IS_SET (buf, GST_VIDEO_BUFFER_ONEFIELD), - GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_GAP), conclusion); + GST_BUFFER_FLAG_IS_SET (buf, GST_VIDEO_BUFFER_RFF), conclusion); return buf; } @@ -1397,7 +1400,7 @@ gst_field_analysis_process_buffer (GstFieldAnalysis * filter, res0->conclusion = FIELD_ANALYSIS_INTERLACED; } res0->holding = -1; /* needed fields unknown */ - res0->gap = FALSE; + res0->drop = FALSE; } if (n_queued >= 2) { @@ -1452,11 +1455,11 @@ gst_field_analysis_process_buffer (GstFieldAnalysis * filter, /* prev P, cur repeated => cur P */ res0->conclusion = FIELD_ANALYSIS_TELECINE_PROGRESSIVE; res0->holding = 1 + BOTH_FIELDS; - /* push prev P, GAP */ - res1->gap = TRUE; + /* push prev P, RFF */ + res1->drop = TRUE; outbuf = gst_field_analysis_decorate (filter, -1, FALSE, res1->conclusion, - res1->gap); + res1->drop); } else { /* prev P, cur t xor b matches => cur TCM */ res0->conclusion = FIELD_ANALYSIS_TELECINE_MIXED; @@ -1465,7 +1468,7 @@ gst_field_analysis_process_buffer (GstFieldAnalysis * filter, /* push prev P */ outbuf = gst_field_analysis_decorate (filter, -1, FALSE, res1->conclusion, - res1->gap); + res1->drop); } } else { /* prev !P */ @@ -1506,7 +1509,7 @@ gst_field_analysis_process_buffer (GstFieldAnalysis * filter, /* push 1F held field */ outbuf = gst_field_analysis_decorate (filter, !(res1->holding - 1), TRUE, - res1->conclusion, res1->gap); + res1->conclusion, res1->drop); } else if (res0->f > filter->frame_thresh && ((t && telecine_matches & FIELD_ANALYSIS_BOTTOM_TOP) || (b && telecine_matches & FIELD_ANALYSIS_TOP_BOTTOM))) { @@ -1521,7 +1524,7 @@ gst_field_analysis_process_buffer (GstFieldAnalysis * filter, /* push 1F held field */ outbuf = gst_field_analysis_decorate (filter, !(res1->holding - 1), TRUE, - res1->conclusion, res1->gap); + res1->conclusion, res1->drop); } else if (first_buffer && (telecine_matches & FIELD_ANALYSIS_BOTTOM_TOP || telecine_matches & FIELD_ANALYSIS_TOP_BOTTOM)) { /* non-matched field is an orphan in the first buffer - push orphan as 1F */ @@ -1531,18 +1534,18 @@ gst_field_analysis_process_buffer (GstFieldAnalysis * filter, /* push 1F held field */ outbuf = gst_field_analysis_decorate (filter, !(res1->holding - 1), TRUE, - res1->conclusion, res1->gap); + res1->conclusion, res1->drop); } else if (res1->holding == 1 + BOTH_FIELDS || res1->holding == -1) { /* holding both fields, push prev as is */ outbuf = gst_field_analysis_decorate (filter, -1, FALSE, res1->conclusion, - res1->gap); + res1->drop); } else { - /* push prev as is with GAP */ - res1->gap = TRUE; + /* push prev as is with RFF */ + res1->drop = TRUE; outbuf = gst_field_analysis_decorate (filter, -1, FALSE, res1->conclusion, - res1->gap); + res1->drop); } } } else if (res0->f <= filter->frame_thresh) { @@ -1553,19 +1556,19 @@ gst_field_analysis_process_buffer (GstFieldAnalysis * filter, /* holding both fields, push prev as is */ outbuf = gst_field_analysis_decorate (filter, -1, FALSE, res1->conclusion, - res1->gap); + res1->drop); } else if (res1->holding > 0) { /* holding one field, push prev 1F held */ outbuf = gst_field_analysis_decorate (filter, !(res1->holding - 1), TRUE, - res1->conclusion, res1->gap); + res1->conclusion, res1->drop); } else { - /* unknown or no fields held, push prev as is with GAP */ - /* this will push unknown as gap - should be pushed as not gap? */ - res1->gap = TRUE; + /* unknown or no fields held, push prev as is with RFF */ + /* this will push unknown as drop - should be pushed as not drop? */ + res1->drop = TRUE; outbuf = gst_field_analysis_decorate (filter, -1, FALSE, res1->conclusion, - res1->gap); + res1->drop); } } else { /* cur !P */ @@ -1588,57 +1591,57 @@ gst_field_analysis_process_buffer (GstFieldAnalysis * filter, /* push prev as is */ outbuf = gst_field_analysis_decorate (filter, -1, FALSE, res1->conclusion, - res1->gap); + res1->drop); } else if ((t && telecine_matches & FIELD_ANALYSIS_TOP_BOTTOM) || (b && telecine_matches & FIELD_ANALYSIS_BOTTOM_TOP)) { /* held is opposite to matched => need both field from prev */ /* if t_b, hold bottom from prev and top from current, else vice-versa */ - res1->holding = 1 + ! !(telecine_matches & FIELD_ANALYSIS_TOP_BOTTOM); + res1->holding = 1 + !!(telecine_matches & FIELD_ANALYSIS_TOP_BOTTOM); res0->holding = 1 + !(telecine_matches & FIELD_ANALYSIS_TOP_BOTTOM); /* push prev TCM */ outbuf = gst_field_analysis_decorate (filter, -1, FALSE, res1->conclusion, - res1->gap); + res1->drop); } else if ((res1->holding > 0 && res1->holding != 1 + BOTH_FIELDS) || (t && telecine_matches & FIELD_ANALYSIS_BOTTOM_TOP) || (b && telecine_matches & FIELD_ANALYSIS_TOP_BOTTOM)) { /* held field is needed, push prev 1F held */ outbuf = gst_field_analysis_decorate (filter, !(res1->holding - 1), TRUE, - res1->conclusion, res1->gap); + res1->conclusion, res1->drop); } else { /* holding none or unknown */ - /* push prev as is with GAP */ - res1->gap = TRUE; + /* push prev as is with RFF */ + res1->drop = TRUE; outbuf = gst_field_analysis_decorate (filter, -1, FALSE, res1->conclusion, - res1->gap); + res1->drop); } } else { /* cur I */ res0->conclusion = FIELD_ANALYSIS_INTERLACED; res0->holding = 1 + BOTH_FIELDS; /* push prev appropriately */ - res1->gap = res1->holding <= 0; + res1->drop = res1->holding <= 0; if (res1->holding != 0) { - res1->gap = FALSE; + res1->drop = FALSE; if (res1->holding == 1 + BOTH_FIELDS || res1->holding == -1) { /* push prev as is */ outbuf = gst_field_analysis_decorate (filter, -1, FALSE, - res1->conclusion, res1->gap); + res1->conclusion, res1->drop); } else { /* push prev 1F held */ outbuf = gst_field_analysis_decorate (filter, !(res1->holding - 1), TRUE, - res1->conclusion, res1->gap); + res1->conclusion, res1->drop); } } else { - /* push prev as is with GAP */ - res1->gap = TRUE; + /* push prev as is with RFF */ + res1->drop = TRUE; outbuf = gst_field_analysis_decorate (filter, -1, FALSE, res1->conclusion, - res1->gap); + res1->drop); } } } diff --git a/gst/fieldanalysis/gstfieldanalysis.h b/gst/fieldanalysis/gstfieldanalysis.h index 7b95871af2..a7a638d152 100644 --- a/gst/fieldanalysis/gstfieldanalysis.h +++ b/gst/fieldanalysis/gstfieldanalysis.h @@ -91,7 +91,7 @@ struct _FieldAnalysis FieldAnalysisConclusion conclusion; /* -1 - unknown; 0 - holding none; 1 - top field; 2 - bottom field; 3 - both */ gint holding; - gboolean gap; + gboolean drop; }; typedef enum diff --git a/gst/fieldanalysis/gstfieldanalysisorc-dist.c b/gst/fieldanalysis/gstfieldanalysisorc-dist.c index 969916376e..9b4e39abd6 100644 --- a/gst/fieldanalysis/gstfieldanalysisorc-dist.c +++ b/gst/fieldanalysis/gstfieldanalysisorc-dist.c @@ -4,9 +4,6 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#ifndef DISABLE_ORC -#include -#endif #include #ifndef _ORC_INTEGER_TYPEDEFS_ @@ -32,6 +29,7 @@ typedef unsigned __int16 orc_uint16; typedef unsigned __int32 orc_uint32; typedef unsigned __int64 orc_uint64; #define ORC_UINT64_C(x) (x##Ui64) +#define inline __inline #else #include typedef signed char orc_int8; @@ -71,17 +69,34 @@ typedef union orc_int16 x4[4]; } orc_union64; #endif +#ifndef ORC_RESTRICT +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#define ORC_RESTRICT restrict +#elif defined(__GNUC__) && __GNUC__ >= 4 +#define ORC_RESTRICT __restrict__ +#else +#define ORC_RESTRICT +#endif +#endif -void orc_same_parity_sad_planar_yuv (guint32 * a1, const orc_uint8 * s1, - const orc_uint8 * s2, int p2, int n); -void orc_same_parity_ssd_planar_yuv (guint32 * a1, const orc_uint8 * s1, - const orc_uint8 * s2, int p2, int n); -void orc_same_parity_3_tap_planar_yuv (guint32 * a1, const orc_uint8 * s1, - const orc_uint8 * s2, const orc_uint8 * s3, const orc_uint8 * s4, - const orc_uint8 * s5, const orc_uint8 * s6, int p2, int n); -void orc_opposite_parity_5_tap_planar_yuv (guint32 * a1, const orc_uint8 * s1, - const orc_uint8 * s2, const orc_uint8 * s3, const orc_uint8 * s4, - const orc_uint8 * s5, int p2, int n); +#ifndef DISABLE_ORC +#include +#endif +void orc_same_parity_sad_planar_yuv (guint32 * ORC_RESTRICT a1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + int p2, int n); +void orc_same_parity_ssd_planar_yuv (guint32 * ORC_RESTRICT a1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + int p2, int n); +void orc_same_parity_3_tap_planar_yuv (guint32 * ORC_RESTRICT a1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, + const orc_uint8 * ORC_RESTRICT s5, const orc_uint8 * ORC_RESTRICT s6, + int p2, int n); +void orc_opposite_parity_5_tap_planar_yuv (guint32 * ORC_RESTRICT a1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, + const orc_uint8 * ORC_RESTRICT s5, int p2, int n); void gst_fieldanalysis_orc_init (void); @@ -117,6 +132,7 @@ void gst_fieldanalysis_orc_init (void); #define ORC_ISNAN(x) ((((x)&0x7f800000) == 0x7f800000) && (((x)&0x007fffff) != 0)) #define ORC_DENORMAL_DOUBLE(x) ((x) & ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == 0) ? ORC_UINT64_C(0xfff0000000000000) : ORC_UINT64_C(0xffffffffffffffff))) #define ORC_ISNAN_DOUBLE(x) ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == ORC_UINT64_C(0x7ff0000000000000)) && (((x)&ORC_UINT64_C(0x000fffffffffffff)) != 0)) +#ifndef ORC_RESTRICT #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define ORC_RESTRICT restrict #elif defined(__GNUC__) && __GNUC__ >= 4 @@ -124,6 +140,7 @@ void gst_fieldanalysis_orc_init (void); #else #define ORC_RESTRICT #endif +#endif /* end Orc C target preamble */ @@ -131,8 +148,9 @@ void gst_fieldanalysis_orc_init (void); /* orc_same_parity_sad_planar_yuv */ #ifdef DISABLE_ORC void -orc_same_parity_sad_planar_yuv (guint32 * a1, const orc_uint8 * s1, - const orc_uint8 * s2, int p2, int n) +orc_same_parity_sad_planar_yuv (guint32 * ORC_RESTRICT a1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + int p2, int n) { int i; const orc_int8 *ORC_RESTRICT ptr4; @@ -183,7 +201,7 @@ orc_same_parity_sad_planar_yuv (guint32 * a1, const orc_uint8 * s1, #else static void -_backup_orc_same_parity_sad_planar_yuv (OrcExecutor * ex) +_backup_orc_same_parity_sad_planar_yuv (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -235,8 +253,9 @@ _backup_orc_same_parity_sad_planar_yuv (OrcExecutor * ex) static OrcProgram *_orc_program_orc_same_parity_sad_planar_yuv; void -orc_same_parity_sad_planar_yuv (guint32 * a1, const orc_uint8 * s1, - const orc_uint8 * s2, int p2, int n) +orc_same_parity_sad_planar_yuv (guint32 * ORC_RESTRICT a1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + int p2, int n) { OrcExecutor _ex, *ex = &_ex; OrcProgram *p = _orc_program_orc_same_parity_sad_planar_yuv; @@ -259,8 +278,9 @@ orc_same_parity_sad_planar_yuv (guint32 * a1, const orc_uint8 * s1, /* orc_same_parity_ssd_planar_yuv */ #ifdef DISABLE_ORC void -orc_same_parity_ssd_planar_yuv (guint32 * a1, const orc_uint8 * s1, - const orc_uint8 * s2, int p2, int n) +orc_same_parity_ssd_planar_yuv (guint32 * ORC_RESTRICT a1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + int p2, int n) { int i; const orc_int8 *ORC_RESTRICT ptr4; @@ -308,7 +328,7 @@ orc_same_parity_ssd_planar_yuv (guint32 * a1, const orc_uint8 * s1, #else static void -_backup_orc_same_parity_ssd_planar_yuv (OrcExecutor * ex) +_backup_orc_same_parity_ssd_planar_yuv (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -357,8 +377,9 @@ _backup_orc_same_parity_ssd_planar_yuv (OrcExecutor * ex) static OrcProgram *_orc_program_orc_same_parity_ssd_planar_yuv; void -orc_same_parity_ssd_planar_yuv (guint32 * a1, const orc_uint8 * s1, - const orc_uint8 * s2, int p2, int n) +orc_same_parity_ssd_planar_yuv (guint32 * ORC_RESTRICT a1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + int p2, int n) { OrcExecutor _ex, *ex = &_ex; OrcProgram *p = _orc_program_orc_same_parity_ssd_planar_yuv; @@ -381,9 +402,11 @@ orc_same_parity_ssd_planar_yuv (guint32 * a1, const orc_uint8 * s1, /* orc_same_parity_3_tap_planar_yuv */ #ifdef DISABLE_ORC void -orc_same_parity_3_tap_planar_yuv (guint32 * a1, const orc_uint8 * s1, - const orc_uint8 * s2, const orc_uint8 * s3, const orc_uint8 * s4, - const orc_uint8 * s5, const orc_uint8 * s6, int p2, int n) +orc_same_parity_3_tap_planar_yuv (guint32 * ORC_RESTRICT a1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, + const orc_uint8 * ORC_RESTRICT s5, const orc_uint8 * ORC_RESTRICT s6, + int p2, int n) { int i; const orc_int8 *ORC_RESTRICT ptr4; @@ -484,7 +507,7 @@ orc_same_parity_3_tap_planar_yuv (guint32 * a1, const orc_uint8 * s1, #else static void -_backup_orc_same_parity_3_tap_planar_yuv (OrcExecutor * ex) +_backup_orc_same_parity_3_tap_planar_yuv (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -586,9 +609,11 @@ _backup_orc_same_parity_3_tap_planar_yuv (OrcExecutor * ex) static OrcProgram *_orc_program_orc_same_parity_3_tap_planar_yuv; void -orc_same_parity_3_tap_planar_yuv (guint32 * a1, const orc_uint8 * s1, - const orc_uint8 * s2, const orc_uint8 * s3, const orc_uint8 * s4, - const orc_uint8 * s5, const orc_uint8 * s6, int p2, int n) +orc_same_parity_3_tap_planar_yuv (guint32 * ORC_RESTRICT a1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, + const orc_uint8 * ORC_RESTRICT s5, const orc_uint8 * ORC_RESTRICT s6, + int p2, int n) { OrcExecutor _ex, *ex = &_ex; OrcProgram *p = _orc_program_orc_same_parity_3_tap_planar_yuv; @@ -615,9 +640,10 @@ orc_same_parity_3_tap_planar_yuv (guint32 * a1, const orc_uint8 * s1, /* orc_opposite_parity_5_tap_planar_yuv */ #ifdef DISABLE_ORC void -orc_opposite_parity_5_tap_planar_yuv (guint32 * a1, const orc_uint8 * s1, - const orc_uint8 * s2, const orc_uint8 * s3, const orc_uint8 * s4, - const orc_uint8 * s5, int p2, int n) +orc_opposite_parity_5_tap_planar_yuv (guint32 * ORC_RESTRICT a1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, + const orc_uint8 * ORC_RESTRICT s5, int p2, int n) { int i; const orc_int8 *ORC_RESTRICT ptr4; @@ -658,9 +684,9 @@ orc_opposite_parity_5_tap_planar_yuv (guint32 * a1, const orc_uint8 * s1, ptr8 = (orc_int8 *) s5; /* 11: loadpw */ - var44.i = 0x00000003; /* 3 or 1.4822e-323f */ + var44.i = (int) 0x00000003; /* 3 or 1.4822e-323f */ /* 13: loadpw */ - var45.i = 0x00000003; /* 3 or 1.4822e-323f */ + var45.i = (int) 0x00000003; /* 3 or 1.4822e-323f */ /* 21: loadpl */ var46.i = p2; @@ -716,7 +742,7 @@ orc_opposite_parity_5_tap_planar_yuv (guint32 * a1, const orc_uint8 * s1, #else static void -_backup_orc_opposite_parity_5_tap_planar_yuv (OrcExecutor * ex) +_backup_orc_opposite_parity_5_tap_planar_yuv (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; @@ -758,9 +784,9 @@ _backup_orc_opposite_parity_5_tap_planar_yuv (OrcExecutor * ex) ptr8 = (orc_int8 *) ex->arrays[8]; /* 11: loadpw */ - var44.i = 0x00000003; /* 3 or 1.4822e-323f */ + var44.i = (int) 0x00000003; /* 3 or 1.4822e-323f */ /* 13: loadpw */ - var45.i = 0x00000003; /* 3 or 1.4822e-323f */ + var45.i = (int) 0x00000003; /* 3 or 1.4822e-323f */ /* 21: loadpl */ var46.i = ex->params[25]; @@ -816,9 +842,10 @@ _backup_orc_opposite_parity_5_tap_planar_yuv (OrcExecutor * ex) static OrcProgram *_orc_program_orc_opposite_parity_5_tap_planar_yuv; void -orc_opposite_parity_5_tap_planar_yuv (guint32 * a1, const orc_uint8 * s1, - const orc_uint8 * s2, const orc_uint8 * s3, const orc_uint8 * s4, - const orc_uint8 * s5, int p2, int n) +orc_opposite_parity_5_tap_planar_yuv (guint32 * ORC_RESTRICT a1, + const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, + const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, + const orc_uint8 * ORC_RESTRICT s5, int p2, int n) { OrcExecutor _ex, *ex = &_ex; OrcProgram *p = _orc_program_orc_opposite_parity_5_tap_planar_yuv; @@ -848,7 +875,6 @@ gst_fieldanalysis_orc_init (void) { /* orc_same_parity_sad_planar_yuv */ OrcProgram *p; - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_same_parity_sad_planar_yuv"); @@ -879,14 +905,13 @@ gst_fieldanalysis_orc_init (void) orc_program_append_2 (p, "accl", 0, ORC_VAR_A1, ORC_VAR_T3, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); _orc_program_orc_same_parity_sad_planar_yuv = p; } { /* orc_same_parity_ssd_planar_yuv */ OrcProgram *p; - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_same_parity_ssd_planar_yuv"); @@ -915,14 +940,13 @@ gst_fieldanalysis_orc_init (void) orc_program_append_2 (p, "accl", 0, ORC_VAR_A1, ORC_VAR_T3, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); _orc_program_orc_same_parity_ssd_planar_yuv = p; } { /* orc_same_parity_3_tap_planar_yuv */ OrcProgram *p; - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_same_parity_3_tap_planar_yuv"); @@ -983,14 +1007,13 @@ gst_fieldanalysis_orc_init (void) orc_program_append_2 (p, "accl", 0, ORC_VAR_A1, ORC_VAR_T7, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); _orc_program_orc_same_parity_3_tap_planar_yuv = p; } { /* orc_opposite_parity_5_tap_planar_yuv */ OrcProgram *p; - OrcCompileResult result; p = orc_program_new (); orc_program_set_name (p, "orc_opposite_parity_5_tap_planar_yuv"); @@ -1048,7 +1071,7 @@ gst_fieldanalysis_orc_init (void) orc_program_append_2 (p, "accl", 0, ORC_VAR_A1, ORC_VAR_T6, ORC_VAR_D1, ORC_VAR_D1); - result = orc_program_compile (p); + orc_program_compile (p); _orc_program_orc_opposite_parity_5_tap_planar_yuv = p; } diff --git a/gst/fieldanalysis/gstfieldanalysisorc-dist.h b/gst/fieldanalysis/gstfieldanalysisorc-dist.h index b46b6fa60a..a901a2ae54 100644 --- a/gst/fieldanalysis/gstfieldanalysisorc-dist.h +++ b/gst/fieldanalysis/gstfieldanalysisorc-dist.h @@ -37,6 +37,7 @@ typedef unsigned __int16 orc_uint16; typedef unsigned __int32 orc_uint32; typedef unsigned __int64 orc_uint64; #define ORC_UINT64_C(x) (x##Ui64) +#define inline __inline #else #include typedef signed char orc_int8; @@ -59,10 +60,19 @@ typedef union { orc_int16 i; orc_int8 x2[2]; } orc_union16; typedef union { orc_int32 i; float f; orc_int16 x2[2]; orc_int8 x4[4]; } orc_union32; typedef union { orc_int64 i; double f; orc_int32 x2[2]; float x2f[2]; orc_int16 x4[4]; } orc_union64; #endif -void orc_same_parity_sad_planar_yuv (guint32 * a1, const orc_uint8 * s1, const orc_uint8 * s2, int p2, int n); -void orc_same_parity_ssd_planar_yuv (guint32 * a1, const orc_uint8 * s1, const orc_uint8 * s2, int p2, int n); -void orc_same_parity_3_tap_planar_yuv (guint32 * a1, const orc_uint8 * s1, const orc_uint8 * s2, const orc_uint8 * s3, const orc_uint8 * s4, const orc_uint8 * s5, const orc_uint8 * s6, int p2, int n); -void orc_opposite_parity_5_tap_planar_yuv (guint32 * a1, const orc_uint8 * s1, const orc_uint8 * s2, const orc_uint8 * s3, const orc_uint8 * s4, const orc_uint8 * s5, int p2, int n); +#ifndef ORC_RESTRICT +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#define ORC_RESTRICT restrict +#elif defined(__GNUC__) && __GNUC__ >= 4 +#define ORC_RESTRICT __restrict__ +#else +#define ORC_RESTRICT +#endif +#endif +void orc_same_parity_sad_planar_yuv (guint32 * ORC_RESTRICT a1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int p2, int n); +void orc_same_parity_ssd_planar_yuv (guint32 * ORC_RESTRICT a1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, int p2, int n); +void orc_same_parity_3_tap_planar_yuv (guint32 * ORC_RESTRICT a1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, const orc_uint8 * ORC_RESTRICT s5, const orc_uint8 * ORC_RESTRICT s6, int p2, int n); +void orc_opposite_parity_5_tap_planar_yuv (guint32 * ORC_RESTRICT a1, const orc_uint8 * ORC_RESTRICT s1, const orc_uint8 * ORC_RESTRICT s2, const orc_uint8 * ORC_RESTRICT s3, const orc_uint8 * ORC_RESTRICT s4, const orc_uint8 * ORC_RESTRICT s5, int p2, int n); #ifdef __cplusplus } diff --git a/gst/freeze/Makefile.am b/gst/freeze/Makefile.am index 9d07aa84f5..5f40e1c0f1 100644 --- a/gst/freeze/Makefile.am +++ b/gst/freeze/Makefile.am @@ -8,3 +8,16 @@ libgstfreeze_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstfreeze.h +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstfreeze -:SHARED libgstfreeze \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstfreeze_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstfreeze_la_CFLAGS) \ + -:LDFLAGS $(libgstfreeze_la_LDFLAGS) \ + $(libgstfreeze_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ \ No newline at end of file diff --git a/gst/frei0r/Makefile.am b/gst/frei0r/Makefile.am index 8135f5c324..5c876e5e9b 100644 --- a/gst/frei0r/Makefile.am +++ b/gst/frei0r/Makefile.am @@ -13,3 +13,17 @@ libgstfrei0r_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstfrei0r_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstfrei0r.h gstfrei0rfilter.h gstfrei0rsrc.h gstfrei0rmixer.h frei0r.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstfrei0r -:SHARED libgstfrei0r \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstfrei0r_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstfrei0r_la_CFLAGS) \ + -:LDFLAGS $(libgstfrei0r_la_LDFLAGS) \ + $(libgstfrei0r_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/gaudieffects/Makefile.am b/gst/gaudieffects/Makefile.am index e34e71c503..54e7477226 100644 --- a/gst/gaudieffects/Makefile.am +++ b/gst/gaudieffects/Makefile.am @@ -13,3 +13,17 @@ noinst_HEADERS = \ gstexclusion.h gstgaussblur.h gstplugin.h gstsolarize.h EXTRA_DIST = blur-example.py burn-example.py + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstgaudieffects -:SHARED libgstgaudieffects \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstgaudieffects_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstgaudieffects_la_CFLAGS) \ + -:LDFLAGS $(libgstgaudieffects_la_LDFLAGS) \ + $(libgstgaudieffects_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/geometrictransform/Makefile.am b/gst/geometrictransform/Makefile.am index 307afef048..e304ed0b09 100644 --- a/gst/geometrictransform/Makefile.am +++ b/gst/geometrictransform/Makefile.am @@ -50,3 +50,17 @@ noinst_HEADERS = gstgeometrictransform.h \ gstsquare.h \ gstmirror.h \ gstfisheye.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstgeometrictransform -:SHARED libgstgeometrictransform \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstgeometrictransform_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstgeometrictransform_la_CFLAGS) \ + -:LDFLAGS $(libgstgeometrictransform_la_LDFLAGS) \ + $(libgstgeometrictransform_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/geometrictransform/gstfisheye.c b/gst/geometrictransform/gstfisheye.c index 39be190e84..46318b0430 100644 --- a/gst/geometrictransform/gstfisheye.c +++ b/gst/geometrictransform/gstfisheye.c @@ -67,7 +67,7 @@ gst_fisheye_base_init (gpointer gclass) "fisheye", "Transform/Effect/Video", "Split the image into two halves and reflect one over each other", - "Filippo Argiolas "); } static gboolean @@ -123,10 +123,8 @@ fisheye_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x, static void gst_fisheye_class_init (GstFisheyeClass * klass) { - GObjectClass *gobject_class; GstGeometricTransformClass *gstgt_class; - gobject_class = (GObjectClass *) klass; gstgt_class = (GstGeometricTransformClass *) klass; parent_class = g_type_class_peek_parent (klass); diff --git a/gst/geometrictransform/gstmirror.c b/gst/geometrictransform/gstmirror.c index 43d102cc25..a06adf0822 100644 --- a/gst/geometrictransform/gstmirror.c +++ b/gst/geometrictransform/gstmirror.c @@ -132,7 +132,7 @@ gst_mirror_base_init (gpointer gclass) "mirror", "Transform/Effect/Video", "Split the image into two halves and reflect one over each other", - "Filippo Argiolas "); } static gboolean diff --git a/gst/geometrictransform/gstsquare.c b/gst/geometrictransform/gstsquare.c index eda6f43c57..a7b2fc59ba 100644 --- a/gst/geometrictransform/gstsquare.c +++ b/gst/geometrictransform/gstsquare.c @@ -146,7 +146,7 @@ gst_square_base_init (gpointer gclass) "square", "Transform/Effect/Video", "Distort center part of the image into a square", - "Filippo Argiolas "); } static gboolean diff --git a/gst/h264parse/Makefile.am b/gst/h264parse/Makefile.am index 6fc43c6113..746e1a86e0 100644 --- a/gst/h264parse/Makefile.am +++ b/gst/h264parse/Makefile.am @@ -11,3 +11,16 @@ libgsth264parse_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) libgsth264parse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgsth264parse_la_LIBTOOLFLAGS = --tag=disable-static +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgsth264parse -:SHARED libgsth264parse \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgsth264parse_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgsth264parse_la_CFLAGS) \ + -:LDFLAGS $(libgsth264parse_la_LDFLAGS) \ + $(libgsth264parse_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/h264parse/gsth264parse.c b/gst/h264parse/gsth264parse.c index 5ad43f2fcc..514a739450 100644 --- a/gst/h264parse/gsth264parse.c +++ b/gst/h264parse/gsth264parse.c @@ -358,10 +358,7 @@ gst_h264_parse_get_pps (GstH264Parse * h, guint8 pps_id) { GstH264Pps *pps; g_return_val_if_fail (h != NULL, NULL); - if (pps_id >= MAX_PPS_COUNT) { - GST_DEBUG_OBJECT (h, "requested pps_id=%04x out of range", pps_id); - return NULL; - } + pps = h->pps_buffers[pps_id]; if (pps == NULL) { GST_DEBUG_OBJECT (h, "Creating pps with pps_id=%04x", pps_id); @@ -665,10 +662,15 @@ gst_nal_decode_sps (GstH264Parse * h, GstNalBs * bs) static gboolean gst_nal_decode_pps (GstH264Parse * h, GstNalBs * bs) { - guint8 pps_id; + gint pps_id; GstH264Pps *pps = NULL; pps_id = gst_nal_bs_read_ue (bs); + if (pps_id >= MAX_PPS_COUNT) { + GST_DEBUG_OBJECT (h, "requested pps_id=%04x out of range", pps_id); + return FALSE; + } + pps = gst_h264_parse_get_pps (h, pps_id); if (pps == NULL) { return FALSE; @@ -1600,7 +1602,7 @@ gst_h264_parse_push_codec_buffer (GstH264Parse * h264parse, GstBuffer * nal, static GstFlowReturn gst_h264_parse_push_buffer (GstH264Parse * h264parse, GstBuffer * buf) { - GstFlowReturn ret = GST_FLOW_OK; + GstFlowReturn res = GST_FLOW_OK; /* We can send pending events if this is the first call, since we now have * caps for the srcpad */ @@ -1619,6 +1621,33 @@ gst_h264_parse_push_buffer (GstH264Parse * h264parse, GstBuffer * buf) } } + if (G_UNLIKELY (h264parse->width == 0 || h264parse->height == 0)) { + GST_DEBUG ("Delaying actual push until we are configured"); + h264parse->gather = g_list_append (h264parse->gather, buf); + goto beach; + } + + if (G_UNLIKELY (h264parse->gather)) { + GList *pendingbuffers = h264parse->gather; + GList *tmp; + + GST_DEBUG ("Pushing out pending buffers"); + + /* Yes, we're recursively calling in... */ + h264parse->gather = NULL; + for (tmp = pendingbuffers; tmp; tmp = tmp->next) { + res = gst_h264_parse_push_buffer (h264parse, (GstBuffer *) tmp->data); + if (res != GST_FLOW_OK && res != GST_FLOW_NOT_LINKED) + break; + } + g_list_free (pendingbuffers); + + if (res != GST_FLOW_OK && res != GST_FLOW_NOT_LINKED) { + gst_buffer_unref (buf); + goto beach; + } + } + /* start of picture is good time to slip in codec_data NALUs * (when outputting NALS and transforming to bytestream) */ if (G_UNLIKELY (h264parse->codec_nals && h264parse->picture_start)) { @@ -1630,7 +1659,7 @@ gst_h264_parse_push_buffer (GstH264Parse * h264parse, GstBuffer * buf) GST_BUFFER_DURATION (nals->data) = 0; gst_buffer_set_caps (nals->data, h264parse->src_caps); - ret = gst_pad_push (h264parse->srcpad, nals->data); + (void) gst_pad_push (h264parse->srcpad, nals->data); nals = g_slist_delete_link (nals, nals); } h264parse->codec_nals = NULL; @@ -1740,7 +1769,10 @@ gst_h264_parse_push_buffer (GstH264Parse * h264parse, GstBuffer * buf) } gst_buffer_set_caps (buf, h264parse->src_caps); - return gst_pad_push (h264parse->srcpad, buf); + res = gst_pad_push (h264parse->srcpad, buf); + +beach: + return res; } /* takes over ownership of nal and returns fresh buffer */ @@ -2445,7 +2477,7 @@ gst_h264_parse_chain_reverse (GstH264Parse * h264parse, gboolean discont, /* if we have a discont, move buffers to the decode list */ if (G_UNLIKELY (discont)) { - guint start, stop, last; + guint start, last; guint32 code; GstBuffer *prev; GstClockTime timestamp; @@ -2454,7 +2486,6 @@ gst_h264_parse_chain_reverse (GstH264Parse * h264parse, gboolean discont, "received discont, copy gathered buffers for decoding"); /* init start code accumulator */ - stop = -1; prev = h264parse->prev; h264parse->prev = NULL; diff --git a/gst/h264parse/gsth264parse.h b/gst/h264parse/gsth264parse.h index e245ea0015..e2fae841ba 100644 --- a/gst/h264parse/gsth264parse.h +++ b/gst/h264parse/gsth264parse.h @@ -48,7 +48,7 @@ typedef struct _GstH264Sps GstH264Sps; typedef struct _GstH264Pps GstH264Pps; #define MAX_SPS_COUNT 32 -#define MAX_PPS_COUNT 32 +#define MAX_PPS_COUNT 256 #define CLOCK_BASE 9LL #define CLOCK_FREQ (CLOCK_BASE * 10000) diff --git a/gst/hdvparse/Makefile.am b/gst/hdvparse/Makefile.am index a77d53878d..20b09228d6 100644 --- a/gst/hdvparse/Makefile.am +++ b/gst/hdvparse/Makefile.am @@ -11,3 +11,16 @@ libgsthdvparse_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(LIBM) libgsthdvparse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgsthdvparse_la_LIBTOOLFLAGS = --tag=disable-static +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgsthdvparse -:SHARED libgsthdvparse \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgsthdvparse_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgsthdvparse_la_CFLAGS) \ + -:LDFLAGS $(libgsthdvparse_la_LDFLAGS) \ + $(libgsthdvparse_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ \ No newline at end of file diff --git a/gst/hls/Makefile.am b/gst/hls/Makefile.am new file mode 100644 index 0000000000..687b568e02 --- /dev/null +++ b/gst/hls/Makefile.am @@ -0,0 +1,32 @@ + +plugin_LTLIBRARIES = libgstfragmented.la + +libgstfragmented_la_SOURCES = \ + m3u8.c \ + gsthlsdemux.c \ + gstfragmentedplugin.c + +libgstfragmented_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(SOUP_CFLAGS) +libgstfragmented_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(SOUP_LIBS) +libgstfragmented_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -no-undefined +libgstfragmented_la_LIBTOOLFLAGS = --tag=disable-static + +# headers we need but don't want installed +noinst_HEADERS = \ + gstfragmented.h \ + gsthlsdemux.h \ + m3u8.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgsthls -:SHARED libgsthls \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgsthls_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgsthls_la_CFLAGS) \ + -:LDFLAGS $(libgsthls_la_LDFLAGS) \ + $(libgsthls_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/hls/gstfragmented.h b/gst/hls/gstfragmented.h new file mode 100644 index 0000000000..c1c7a2b0f0 --- /dev/null +++ b/gst/hls/gstfragmented.h @@ -0,0 +1,14 @@ +#ifndef __GST_FRAGMENTED_H__ +#define __GST_FRAGMENTED_H__ + +#include + +G_BEGIN_DECLS + +GST_DEBUG_CATEGORY_EXTERN (fragmented_debug); + +#define LOG_CAPS(obj, caps) GST_DEBUG_OBJECT (obj, "%s: %" GST_PTR_FORMAT, #caps, caps) + +G_END_DECLS + +#endif /* __GST_FRAGMENTED_H__ */ diff --git a/gst/hls/gstfragmentedplugin.c b/gst/hls/gstfragmentedplugin.c new file mode 100644 index 0000000000..84e3a4c5e7 --- /dev/null +++ b/gst/hls/gstfragmentedplugin.c @@ -0,0 +1,27 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "gstfragmented.h" +#include "gsthlsdemux.h" + +GST_DEBUG_CATEGORY (fragmented_debug); + +static gboolean +fragmented_init (GstPlugin * plugin) +{ + GST_DEBUG_CATEGORY_INIT (fragmented_debug, "fragmented", 0, "fragmented"); + + if (!gst_element_register (plugin, "hlsdemux", GST_RANK_PRIMARY, + GST_TYPE_HLS_DEMUX) || FALSE) + return FALSE; + return TRUE; +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "fragmented", + "Fragmented streaming plugins", + fragmented_init, VERSION, "LGPL", PACKAGE_NAME, "http://www.gstreamer.org/") diff --git a/gst/hls/gsthlsdemux.c b/gst/hls/gsthlsdemux.c new file mode 100644 index 0000000000..ce1f409c31 --- /dev/null +++ b/gst/hls/gsthlsdemux.c @@ -0,0 +1,1056 @@ +/* GStreamer + * Copyright (C) 2010 Marc-Andre Lureau + * Copyright (C) 2010 Andoni Morales Alastruey + * + * Gsthlsdemux.c: + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +/** + * SECTION:element-hlsdemux + * + * HTTP Live Streaming demuxer element. + * + * + * Example launch line + * |[ + * gst-launch souphttpsrc location=http://devimages.apple.com/iphone/samples/bipbop/gear4/prog_index.m3u8 ! hlsdemux ! decodebin2 ! ffmpegcolorspace ! videoscale ! autovideosink + * ]| + * + * + * Last reviewed on 2010-10-07 + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + + +#include +#include +#include "gsthlsdemux.h" + +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("application/x-hls")); + +static GstStaticPadTemplate fetchertemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +GST_DEBUG_CATEGORY_STATIC (gst_hls_demux_debug); +#define GST_CAT_DEFAULT gst_hls_demux_debug + +enum +{ + PROP_0, + + PROP_FRAGMENTS_CACHE, + PROP_BITRATE_SWITCH_TOLERANCE, + PROP_LAST +}; + +static const float update_interval_factor[] = { 1, 0.5, 1.5, 3 }; + +#define DEFAULT_FRAGMENTS_CACHE 3 +#define DEFAULT_FAILED_COUNT 3 +#define DEFAULT_BITRATE_SWITCH_TOLERANCE 0.4 + +/* GObject */ +static void gst_hls_demux_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec); +static void gst_hls_demux_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec); +static void gst_hls_demux_dispose (GObject * obj); + +/* GstElement */ +static GstStateChangeReturn +gst_hls_demux_change_state (GstElement * element, GstStateChange transition); + +/* GstHLSDemux */ +static GstBusSyncReply gst_hls_demux_fetcher_bus_handler (GstBus * bus, + GstMessage * message, gpointer data); +static GstFlowReturn gst_hls_demux_chain (GstPad * pad, GstBuffer * buf); +static gboolean gst_hls_demux_sink_event (GstPad * pad, GstEvent * event); +static gboolean gst_hls_demux_src_event (GstPad * pad, GstEvent * event); +static gboolean gst_hls_demux_src_query (GstPad * pad, GstQuery * query); +static GstFlowReturn gst_hls_demux_fetcher_chain (GstPad * pad, + GstBuffer * buf); +static gboolean gst_hls_demux_fetcher_sink_event (GstPad * pad, + GstEvent * event); +static void gst_hls_demux_loop (GstHLSDemux * demux); +static void gst_hls_demux_stop (GstHLSDemux * demux); +static void gst_hls_demux_stop_fetcher (GstHLSDemux * demux, + gboolean cancelled); +static gboolean gst_hls_demux_start_update (GstHLSDemux * demux); +static gboolean gst_hls_demux_cache_fragments (GstHLSDemux * demux); +static gboolean gst_hls_demux_schedule (GstHLSDemux * demux); +static gboolean gst_hls_demux_switch_playlist (GstHLSDemux * demux); +static gboolean gst_hls_demux_get_next_fragment (GstHLSDemux * demux, + gboolean retry); +static gboolean gst_hls_demux_update_playlist (GstHLSDemux * demux, + gboolean retry); +static void gst_hls_demux_reset (GstHLSDemux * demux, gboolean dispose); +static gboolean gst_hls_demux_set_location (GstHLSDemux * demux, + const gchar * uri); +static gchar *gst_hls_src_buf_to_utf8_playlist (gchar * string, guint size); + +static void +_do_init (GType type) +{ + GST_DEBUG_CATEGORY_INIT (gst_hls_demux_debug, "hlsdemux", 0, + "hlsdemux element"); +} + +GST_BOILERPLATE_FULL (GstHLSDemux, gst_hls_demux, GstElement, + GST_TYPE_ELEMENT, _do_init); + +static void +gst_hls_demux_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&srctemplate)); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sinktemplate)); + + gst_element_class_set_details_simple (element_class, + "HLS Demuxer", + "Demuxer/URIList", + "HTTP Live Streaming demuxer", + "Marc-Andre Lureau \n" + "Andoni Morales Alastruey "); +} + +static void +gst_hls_demux_dispose (GObject * obj) +{ + GstHLSDemux *demux = GST_HLS_DEMUX (obj); + + g_cond_free (demux->fetcher_cond); + g_mutex_free (demux->fetcher_lock); + + g_cond_free (demux->thread_cond); + g_mutex_free (demux->thread_lock); + + if (GST_TASK_STATE (demux->task) != GST_TASK_STOPPED) { + gst_task_stop (demux->task); + gst_task_join (demux->task); + } + gst_object_unref (demux->task); + g_static_rec_mutex_free (&demux->task_lock); + + gst_object_unref (demux->fetcher_bus); + gst_object_unref (demux->fetcherpad); + + gst_hls_demux_reset (demux, TRUE); + + gst_object_unref (demux->download); + + G_OBJECT_CLASS (parent_class)->dispose (obj); +} + +static void +gst_hls_demux_class_init (GstHLSDemuxClass * klass) +{ + GObjectClass *gobject_class; + GstElementClass *gstelement_class; + + gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; + + gobject_class->set_property = gst_hls_demux_set_property; + gobject_class->get_property = gst_hls_demux_get_property; + gobject_class->dispose = gst_hls_demux_dispose; + + g_object_class_install_property (gobject_class, PROP_FRAGMENTS_CACHE, + g_param_spec_uint ("fragments-cache", "Fragments cache", + "Number of fragments needed to be cached to start playing", + 2, G_MAXUINT, DEFAULT_FRAGMENTS_CACHE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (gobject_class, PROP_BITRATE_SWITCH_TOLERANCE, + g_param_spec_float ("bitrate-switch-tolerance", + "Bitrate switch tolerance", + "Tolerance with respect of the fragment duration to switch to " + "a different bitrate if the client is too slow/fast.", + 0, 1, DEFAULT_BITRATE_SWITCH_TOLERANCE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + gstelement_class->change_state = + GST_DEBUG_FUNCPTR (gst_hls_demux_change_state); +} + +static void +gst_hls_demux_init (GstHLSDemux * demux, GstHLSDemuxClass * klass) +{ + /* sink pad */ + demux->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink"); + gst_pad_set_chain_function (demux->sinkpad, + GST_DEBUG_FUNCPTR (gst_hls_demux_chain)); + gst_pad_set_event_function (demux->sinkpad, + GST_DEBUG_FUNCPTR (gst_hls_demux_sink_event)); + gst_element_add_pad (GST_ELEMENT (demux), demux->sinkpad); + + /* demux pad */ + demux->srcpad = gst_pad_new_from_static_template (&srctemplate, "src"); + gst_pad_set_event_function (demux->srcpad, + GST_DEBUG_FUNCPTR (gst_hls_demux_src_event)); + gst_pad_set_query_function (demux->srcpad, + GST_DEBUG_FUNCPTR (gst_hls_demux_src_query)); + gst_pad_set_element_private (demux->srcpad, demux); + gst_element_add_pad (GST_ELEMENT (demux), demux->srcpad); + + /* fetcher pad */ + demux->fetcherpad = + gst_pad_new_from_static_template (&fetchertemplate, "sink"); + gst_pad_set_chain_function (demux->fetcherpad, + GST_DEBUG_FUNCPTR (gst_hls_demux_fetcher_chain)); + gst_pad_set_event_function (demux->fetcherpad, + GST_DEBUG_FUNCPTR (gst_hls_demux_fetcher_sink_event)); + gst_pad_set_element_private (demux->fetcherpad, demux); + gst_pad_activate_push (demux->fetcherpad, TRUE); + + /* Properties */ + demux->fragments_cache = DEFAULT_FRAGMENTS_CACHE; + demux->bitrate_switch_tol = DEFAULT_BITRATE_SWITCH_TOLERANCE; + + demux->download = gst_adapter_new (); + demux->fetcher_bus = gst_bus_new (); + gst_bus_set_sync_handler (demux->fetcher_bus, + gst_hls_demux_fetcher_bus_handler, demux); + demux->thread_cond = g_cond_new (); + demux->thread_lock = g_mutex_new (); + demux->fetcher_cond = g_cond_new (); + demux->fetcher_lock = g_mutex_new (); + demux->queue = g_queue_new (); + g_static_rec_mutex_init (&demux->task_lock); + demux->task = gst_task_create ((GstTaskFunction) gst_hls_demux_loop, demux); + gst_task_set_lock (demux->task, &demux->task_lock); +} + +static void +gst_hls_demux_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) +{ + GstHLSDemux *demux = GST_HLS_DEMUX (object); + + switch (prop_id) { + case PROP_FRAGMENTS_CACHE: + demux->fragments_cache = g_value_get_uint (value); + break; + case PROP_BITRATE_SWITCH_TOLERANCE: + demux->bitrate_switch_tol = g_value_get_float (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gst_hls_demux_get_property (GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec) +{ + GstHLSDemux *demux = GST_HLS_DEMUX (object); + + switch (prop_id) { + case PROP_FRAGMENTS_CACHE: + g_value_set_uint (value, demux->fragments_cache); + break; + case PROP_BITRATE_SWITCH_TOLERANCE: + g_value_set_float (value, demux->bitrate_switch_tol); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static GstStateChangeReturn +gst_hls_demux_change_state (GstElement * element, GstStateChange transition) +{ + GstStateChangeReturn ret; + GstHLSDemux *demux = GST_HLS_DEMUX (element); + + switch (transition) { + case GST_STATE_CHANGE_NULL_TO_READY: + gst_hls_demux_reset (demux, FALSE); + break; + default: + break; + } + + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + + switch (transition) { + case GST_STATE_CHANGE_PAUSED_TO_READY: + demux->cancelled = TRUE; + g_cond_signal (demux->fetcher_cond); + break; + default: + break; + } + return ret; +} + +static gboolean +gst_hls_demux_src_event (GstPad * pad, GstEvent * event) +{ + switch (event->type) { + /* FIXME: ignore seek event for the moment */ + case GST_EVENT_SEEK: + gst_event_unref (event); + return FALSE; + default: + break; + } + + return gst_pad_event_default (pad, event); +} + +static gboolean +gst_hls_demux_sink_event (GstPad * pad, GstEvent * event) +{ + GstHLSDemux *demux = GST_HLS_DEMUX (gst_pad_get_parent (pad)); + GstQuery *query; + gboolean ret; + gchar *uri; + + + switch (event->type) { + case GST_EVENT_EOS:{ + gchar *playlist; + + if (demux->playlist == NULL) { + GST_WARNING_OBJECT (demux, "Received EOS without a playlist."); + break; + } + + GST_DEBUG_OBJECT (demux, + "Got EOS on the sink pad: main playlist fetched"); + + query = gst_query_new_uri (); + ret = gst_pad_peer_query (demux->sinkpad, query); + if (ret) { + gst_query_parse_uri (query, &uri); + gst_hls_demux_set_location (demux, uri); + g_free (uri); + } + gst_query_unref (query); + + playlist = gst_hls_src_buf_to_utf8_playlist ((gchar *) + GST_BUFFER_DATA (demux->playlist), GST_BUFFER_SIZE (demux->playlist)); + gst_buffer_unref (demux->playlist); + if (playlist == NULL) { + GST_WARNING_OBJECT (demux, "Error validating first playlist."); + } else if (!gst_m3u8_client_update (demux->client, playlist)) { + /* In most cases, this will happen if we set a wrong url in the + * source element and we have received the 404 HTML response instead of + * the playlist */ + GST_ELEMENT_ERROR (demux, STREAM, DECODE, ("Invalid playlist."), NULL); + return FALSE; + } + + if (!ret && gst_m3u8_client_is_live (demux->client)) { + GST_ELEMENT_ERROR (demux, RESOURCE, NOT_FOUND, + ("Failed querying the playlist uri, " + "required for live sources."), NULL); + return FALSE; + } + + gst_task_start (demux->task); + gst_event_unref (event); + return TRUE; + } + default: + break; + } + + return gst_pad_event_default (pad, event); +} + +static gboolean +gst_hls_demux_src_query (GstPad * pad, GstQuery * query) +{ + GstHLSDemux *hlsdemux; + gboolean ret = FALSE; + + if (query == NULL) + return FALSE; + + hlsdemux = GST_HLS_DEMUX (gst_pad_get_element_private (pad)); + + switch (query->type) { + case GST_QUERY_DURATION:{ + GstClockTime duration; + GstFormat fmt; + + gst_query_parse_duration (query, &fmt, NULL); + if (fmt == GST_FORMAT_TIME) { + duration = gst_m3u8_client_get_duration (hlsdemux->client); + if (GST_CLOCK_TIME_IS_VALID (duration) && duration > 0) { + gst_query_set_duration (query, GST_FORMAT_TIME, duration); + ret = TRUE; + } + } + break; + } + case GST_QUERY_URI: + if (hlsdemux->client) { + /* FIXME: Do we answer with the variant playlist, with the current + * playlist or the the uri of the least downlowaded fragment? */ + gst_query_set_uri (query, hlsdemux->client->current->uri); + ret = TRUE; + } + break; + case GST_QUERY_SEEKING:{ + GstFormat fmt; + gint stop = -1; + + gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL); + if (fmt == GST_FORMAT_TIME) { + GstClockTime duration; + + duration = gst_m3u8_client_get_duration (hlsdemux->client); + if (GST_CLOCK_TIME_IS_VALID (duration) && duration > 0) + stop = duration; + } + gst_query_set_seeking (query, fmt, FALSE, 0, stop); + ret = TRUE; + break; + } + default: + /* Don't fordward queries upstream because of the special nature of this + * "demuxer", which relies on the upstream element only to be fed with the + * first playlist */ + break; + } + + return ret; +} + +static gboolean +gst_hls_demux_fetcher_sink_event (GstPad * pad, GstEvent * event) +{ + GstHLSDemux *demux = GST_HLS_DEMUX (gst_pad_get_element_private (pad)); + + switch (event->type) { + case GST_EVENT_EOS:{ + GST_DEBUG_OBJECT (demux, "Got EOS on the fetcher pad"); + /* signal we have fetched the URI */ + if (!demux->cancelled) + g_cond_signal (demux->fetcher_cond); + } + default: + break; + } + + gst_event_unref (event); + return FALSE; +} + +static GstFlowReturn +gst_hls_demux_chain (GstPad * pad, GstBuffer * buf) +{ + GstHLSDemux *demux = GST_HLS_DEMUX (gst_pad_get_parent (pad)); + + if (demux->playlist == NULL) + demux->playlist = buf; + else + demux->playlist = gst_buffer_join (demux->playlist, buf); + + gst_object_unref (demux); + + return GST_FLOW_OK; +} + +static GstFlowReturn +gst_hls_demux_fetcher_chain (GstPad * pad, GstBuffer * buf) +{ + GstHLSDemux *demux = GST_HLS_DEMUX (gst_pad_get_element_private (pad)); + + /* The source element can be an http source element. In case we get a 404, + * the html response will be sent downstream and the adapter + * will not be null, which might make us think that the request proceed + * successfully. But it will also post an error message in the bus that + * is handled synchronously and that will set demux->fetcher_error to TRUE, + * which is used to discard this buffer with the html response. */ + if (demux->fetcher_error) { + goto done; + } + + GST_LOG_OBJECT (demux, "The uri fetcher received a new buffer of size %u", + GST_BUFFER_SIZE (buf)); + gst_adapter_push (demux->download, buf); + +done: + { + return GST_FLOW_OK; + } +} + +static void +gst_hls_demux_stop_fetcher (GstHLSDemux * demux, gboolean cancelled) +{ + GstPad *pad; + + /* When the fetcher is stopped while it's downloading, we will get an EOS that + * unblocks the fetcher thread and tries to stop it again from that thread. + * Here we check if the fetcher as already been stopped before continuing */ + if (demux->fetcher == NULL || demux->stopping_fetcher) + return; + + GST_DEBUG_OBJECT (demux, "Stopping fetcher."); + demux->stopping_fetcher = TRUE; + /* set the element state to NULL */ + gst_element_set_state (demux->fetcher, GST_STATE_NULL); + gst_element_get_state (demux->fetcher, NULL, NULL, GST_CLOCK_TIME_NONE); + /* unlink it from the internal pad */ + pad = gst_pad_get_peer (demux->fetcherpad); + if (pad) { + gst_pad_unlink (pad, demux->fetcherpad); + gst_object_unref (pad); + } + /* and finally unref it */ + gst_object_unref (demux->fetcher); + demux->fetcher = NULL; + + /* if we stopped it to cancell a download, free the cached buffer */ + if (cancelled && !gst_adapter_available (demux->download)) { + gst_adapter_clear (demux->download); + /* signal the fetcher thread that the download has finished/cancelled */ + g_cond_signal (demux->fetcher_cond); + } +} + +static void +gst_hls_demux_stop (GstHLSDemux * demux) +{ + gst_hls_demux_stop_fetcher (demux, TRUE); + if (GST_TASK_STATE (demux->task) != GST_TASK_STOPPED) + gst_task_stop (demux->task); + g_cond_signal (demux->thread_cond); +} + +static void +gst_hls_demux_loop (GstHLSDemux * demux) +{ + GstBuffer *buf; + GstFlowReturn ret; + + /* Loop for the source pad task. The task is started when we have + * received the main playlist from the source element. It tries first to + * cache the first fragments and then it waits until it has more data in the + * queue. This task is woken up when we push a new fragment to the queue or + * when we reached the end of the playlist */ + + if (G_UNLIKELY (demux->need_cache)) { + if (!gst_hls_demux_cache_fragments (demux)) + goto cache_error; + + /* we can start now the updates thread */ + gst_hls_demux_start_update (demux); + GST_INFO_OBJECT (demux, "First fragments cached successfully"); + } + + if (g_queue_is_empty (demux->queue)) { + if (demux->end_of_playlist) + goto end_of_playlist; + + GST_TASK_WAIT (demux->task); + /* If the queue is still empty check again if it's the end of the + * playlist in case we reached it after beeing woken up */ + if (g_queue_is_empty (demux->queue) && demux->end_of_playlist) + goto end_of_playlist; + } + + buf = g_queue_pop_head (demux->queue); + ret = gst_pad_push (demux->srcpad, buf); + if (ret != GST_FLOW_OK) + goto error; + + return; + +end_of_playlist: + { + GST_DEBUG_OBJECT (demux, "Reached end of playlist, sending EOS"); + gst_pad_push_event (demux->srcpad, gst_event_new_eos ()); + gst_hls_demux_stop (demux); + return; + } + +cache_error: + { + GST_ELEMENT_ERROR (demux, RESOURCE, NOT_FOUND, + ("Could not cache the first fragments"), NULL); + gst_hls_demux_stop (demux); + return; + } + +error: + { + /* FIXME: handle error */ + gst_hls_demux_stop (demux); + return; + } +} + +static GstBusSyncReply +gst_hls_demux_fetcher_bus_handler (GstBus * bus, + GstMessage * message, gpointer data) +{ + GstHLSDemux *demux = GST_HLS_DEMUX (data); + + if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR) { + demux->fetcher_error = TRUE; + g_cond_signal (demux->fetcher_cond); + } + + gst_message_unref (message); + return GST_BUS_DROP; +} + +static gboolean +gst_hls_demux_make_fetcher (GstHLSDemux * demux, const gchar * uri) +{ + GstPad *pad; + + if (!gst_uri_is_valid (uri)) + return FALSE; + + GST_DEBUG_OBJECT (demux, "Creating fetcher for the URI:%s", uri); + demux->fetcher = gst_element_make_from_uri (GST_URI_SRC, uri, NULL); + if (!demux->fetcher) + return FALSE; + + demux->fetcher_error = FALSE; + demux->stopping_fetcher = FALSE; + gst_element_set_bus (GST_ELEMENT (demux->fetcher), demux->fetcher_bus); + + g_object_set (G_OBJECT (demux->fetcher), "location", uri, NULL); + pad = gst_element_get_static_pad (demux->fetcher, "src"); + if (pad) { + gst_pad_link (pad, demux->fetcherpad); + gst_object_unref (pad); + } + return TRUE; +} + +static void +gst_hls_demux_reset (GstHLSDemux * demux, gboolean dispose) +{ + demux->need_cache = TRUE; + demux->thread_return = FALSE; + demux->accumulated_delay = 0; + demux->end_of_playlist = FALSE; + demux->cancelled = FALSE; + + if (demux->input_caps) { + gst_caps_unref (demux->input_caps); + demux->input_caps = NULL; + } + + if (demux->playlist) { + gst_buffer_unref (demux->playlist); + demux->playlist = NULL; + } + + gst_adapter_clear (demux->download); + + if (demux->client) + gst_m3u8_client_free (demux->client); + + if (!dispose) { + demux->client = gst_m3u8_client_new (""); + } + + while (!g_queue_is_empty (demux->queue)) { + GstBuffer *buf = g_queue_pop_head (demux->queue); + gst_buffer_unref (buf); + } + g_queue_clear (demux->queue); +} + +static gboolean +gst_hls_demux_set_location (GstHLSDemux * demux, const gchar * uri) +{ + if (demux->client) + gst_m3u8_client_free (demux->client); + demux->client = gst_m3u8_client_new (uri); + GST_INFO_OBJECT (demux, "Changed location: %s", uri); + return TRUE; +} + +static gboolean +gst_hls_demux_update_thread (GstHLSDemux * demux) +{ + /* Loop for the updates. It's started when the first fragments are cached and + * schedules the next update of the playlist (for lives sources) and the next + * update of fragments. When a new fragment is downloaded, it compares the + * download time with the next scheduled update to check if we can or should + * switch to a different bitrate */ + + g_mutex_lock (demux->thread_lock); + while (TRUE) { + /* block until the next scheduled update or the signal to quit this thread */ + if (g_cond_timed_wait (demux->thread_cond, demux->thread_lock, + &demux->next_update)) { + goto quit; + } + + /* update the playlist for live sources */ + if (gst_m3u8_client_is_live (demux->client)) { + if (!gst_hls_demux_update_playlist (demux, TRUE)) { + GST_ERROR_OBJECT (demux, "Could not update the playlist"); + goto quit; + } + } + + /* schedule the next update */ + gst_hls_demux_schedule (demux); + + /* if it's a live source and the playlist couldn't be updated, there aren't + * more fragments in the playlist, so we just wait for the next schedulled + * update */ + if (gst_m3u8_client_is_live (demux->client) && + demux->client->update_failed_count > 0) { + GST_WARNING_OBJECT (demux, + "The playlist hasn't been updated, failed count is %d", + demux->client->update_failed_count); + continue; + } + + /* fetch the next fragment */ + if (!gst_hls_demux_get_next_fragment (demux, TRUE)) { + if (!demux->end_of_playlist && !demux->cancelled) + GST_ERROR_OBJECT (demux, "Could not fetch the next fragment"); + goto quit; + } + + /* try to switch to another bitrate if needed */ + gst_hls_demux_switch_playlist (demux); + } + +quit: + { + g_mutex_unlock (demux->thread_lock); + return TRUE; + } +} + +static gboolean +gst_hls_demux_start_update (GstHLSDemux * demux) +{ + GError *error; + + /* creates a new thread for the updates */ + demux->updates_thread = g_thread_create ( + (GThreadFunc) gst_hls_demux_update_thread, demux, TRUE, &error); + return (error != NULL); +} + +static gboolean +gst_hls_demux_cache_fragments (GstHLSDemux * demux) +{ + gint i; + + /* Start parsing the main playlist */ + gst_m3u8_client_set_current (demux->client, demux->client->main); + + if (gst_m3u8_client_is_live (demux->client)) { + if (!gst_hls_demux_update_playlist (demux, FALSE)) { + GST_ERROR_OBJECT (demux, "Could not fetch the main playlist %s", + demux->client->main->uri); + return FALSE; + } + } + + /* If this playlist is a variant playlist, select the first one + * and update it */ + if (gst_m3u8_client_has_variant_playlist (demux->client)) { + GstM3U8 *child = demux->client->main->lists->data; + gst_m3u8_client_set_current (demux->client, child); + if (!gst_hls_demux_update_playlist (demux, FALSE)) { + GST_ERROR_OBJECT (demux, "Could not fetch the child playlist %s", + child->uri); + return FALSE; + } + } + + /* If it's a live source, set the sequence number to the end of the list + * and substract the 'fragmets_cache' to start from the last fragment*/ + if (gst_m3u8_client_is_live (demux->client)) { + demux->client->sequence += g_list_length (demux->client->current->files); + if (demux->client->sequence >= demux->fragments_cache) + demux->client->sequence -= demux->fragments_cache; + else + demux->client->sequence = 0; + } + + /* Cache the first fragments */ + for (i = 0; i < demux->fragments_cache - 1; i++) { + if (!gst_hls_demux_get_next_fragment (demux, FALSE)) { + if (!demux->cancelled) + GST_ERROR_OBJECT (demux, "Error caching the first fragments"); + return FALSE; + } + /* make sure we stop caching fragments if something cancelled it */ + if (demux->cancelled) + return FALSE; + } + + g_get_current_time (&demux->next_update); + + demux->need_cache = FALSE; + return TRUE; +} + +static gboolean +gst_hls_demux_fetch_location (GstHLSDemux * demux, const gchar * uri) +{ + GstStateChangeReturn ret; + gboolean bret = FALSE; + + g_mutex_lock (demux->fetcher_lock); + + if (!gst_hls_demux_make_fetcher (demux, uri)) { + goto uri_error; + } + + ret = gst_element_set_state (demux->fetcher, GST_STATE_PLAYING); + if (ret == GST_STATE_CHANGE_FAILURE) + goto state_change_error; + + /* wait until we have fetched the uri */ + GST_DEBUG_OBJECT (demux, "Waiting to fetch the URI"); + g_cond_wait (demux->fetcher_cond, demux->fetcher_lock); + + gst_hls_demux_stop_fetcher (demux, FALSE); + + if (gst_adapter_available (demux->download)) { + GST_INFO_OBJECT (demux, "URI fetched successfully"); + bret = TRUE; + } + goto quit; + +uri_error: + { + GST_ELEMENT_ERROR (demux, RESOURCE, OPEN_READ, + ("Could not create an element to fetch the given URI."), ("URI: \"%s\"", + uri)); + bret = FALSE; + goto quit; + } + +state_change_error: + { + GST_ELEMENT_ERROR (demux, CORE, STATE_CHANGE, + ("Error changing state of the fetcher element."), NULL); + bret = FALSE; + goto quit; + } + +quit: + { + g_mutex_unlock (demux->fetcher_lock); + return bret; + } +} + +static gchar * +gst_hls_src_buf_to_utf8_playlist (gchar * data, guint size) +{ + gchar *playlist; + + if (!g_utf8_validate (data, size, NULL)) + return NULL; + + /* alloc size + 1 to end with a null character */ + playlist = g_malloc0 (size + 1); + memcpy (playlist, data, size + 1); + return playlist; +} + +static gboolean +gst_hls_demux_update_playlist (GstHLSDemux * demux, gboolean retry) +{ + const guint8 *data; + gchar *playlist; + guint avail; + + GST_INFO_OBJECT (demux, "Updating the playlist %s", + demux->client->current->uri); + if (!gst_hls_demux_fetch_location (demux, demux->client->current->uri)) + return FALSE; + + avail = gst_adapter_available (demux->download); + data = gst_adapter_peek (demux->download, avail); + playlist = gst_hls_src_buf_to_utf8_playlist ((gchar *) data, avail); + gst_adapter_clear (demux->download); + if (playlist == NULL) { + GST_WARNING_OBJECT (demux, "Couldn't not validate playlist encoding"); + return FALSE; + } + gst_m3u8_client_update (demux->client, playlist); + return TRUE; +} + +static gboolean +gst_hls_demux_change_playlist (GstHLSDemux * demux, gboolean is_fast) +{ + GList *list; + GstStructure *s; + + if (is_fast) + list = g_list_next (demux->client->main->lists); + else + list = g_list_previous (demux->client->main->lists); + + /* Don't do anything else if the playlist is the same */ + if (!list || list->data == demux->client->current) + return TRUE; + + demux->client->main->lists = list; + + gst_m3u8_client_set_current (demux->client, demux->client->main->lists->data); + gst_hls_demux_update_playlist (demux, TRUE); + GST_INFO_OBJECT (demux, "Client is %s, switching to bitrate %d", + is_fast ? "fast" : "slow", demux->client->current->bandwidth); + + s = gst_structure_new ("playlist", + "uri", G_TYPE_STRING, demux->client->current->uri, + "bitrate", G_TYPE_INT, demux->client->current->bandwidth, NULL); + gst_element_post_message (GST_ELEMENT_CAST (demux), + gst_message_new_element (GST_OBJECT_CAST (demux), s)); + + return TRUE; +} + +static gboolean +gst_hls_demux_schedule (GstHLSDemux * demux) +{ + gfloat update_factor; + gint count; + + /* As defined in §6.3.4. Reloading the Playlist file: + * "If the client reloads a Playlist file and finds that it has not + * changed then it MUST wait for a period of time before retrying. The + * minimum delay is a multiple of the target duration. This multiple is + * 0.5 for the first attempt, 1.5 for the second, and 3.0 thereafter." + */ + count = demux->client->update_failed_count; + if (count < 3) + update_factor = update_interval_factor[count]; + else + update_factor = update_interval_factor[3]; + + /* schedule the next update using the target duration field of the + * playlist */ + g_time_val_add (&demux->next_update, + demux->client->current->targetduration * update_factor * 1000000); + GST_DEBUG_OBJECT (demux, "Next update scheduled at %s", + g_time_val_to_iso8601 (&demux->next_update)); + + return TRUE; +} + +static gboolean +gst_hls_demux_switch_playlist (GstHLSDemux * demux) +{ + GTimeVal now; + gint64 diff, limit; + + g_get_current_time (&now); + if (!demux->client->main->lists) + return TRUE; + + /* compare the time when the fragment was downloaded with the time when it was + * scheduled */ + diff = (GST_TIMEVAL_TO_TIME (demux->next_update) - GST_TIMEVAL_TO_TIME (now)); + limit = demux->client->current->targetduration * GST_SECOND * + demux->bitrate_switch_tol; + + /* if we are on time switch to a higher bitrate */ + if (diff > limit) { + gst_hls_demux_change_playlist (demux, TRUE); + } else if (diff < 0) { + /* if the client is too slow wait until it has accumulated a certain delay to + * switch to a lower bitrate */ + demux->accumulated_delay -= diff; + if (demux->accumulated_delay >= limit) { + gst_hls_demux_change_playlist (demux, FALSE); + } else if (demux->accumulated_delay < 0) { + demux->accumulated_delay = 0; + } + } + return TRUE; +} + +static gboolean +gst_hls_demux_get_next_fragment (GstHLSDemux * demux, gboolean retry) +{ + GstBuffer *buf; + guint avail; + const gchar *next_fragment_uri; + GstClockTime duration; + gboolean discont; + + if (!gst_m3u8_client_get_next_fragment (demux->client, &discont, + &next_fragment_uri, &duration)) { + GST_INFO_OBJECT (demux, "This playlist doesn't contain more fragments"); + demux->end_of_playlist = TRUE; + GST_TASK_SIGNAL (demux->task); + return FALSE; + } + + GST_INFO_OBJECT (demux, "Fetching next fragment %s", next_fragment_uri); + + if (!gst_hls_demux_fetch_location (demux, next_fragment_uri)) + return FALSE; + + avail = gst_adapter_available (demux->download); + buf = gst_adapter_take_buffer (demux->download, avail); + GST_BUFFER_DURATION (buf) = duration; + + if (G_UNLIKELY (demux->input_caps == NULL)) { + demux->input_caps = gst_type_find_helper_for_buffer (NULL, buf, NULL); + if (demux->input_caps) { + gst_pad_set_caps (demux->srcpad, demux->input_caps); + GST_INFO_OBJECT (demux, "Input source caps: %" GST_PTR_FORMAT, + demux->input_caps); + } + } + + if (discont) { + GST_DEBUG_OBJECT (demux, "Marking fragment as discontinuous"); + GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT); + } + + g_queue_push_tail (demux->queue, buf); + GST_TASK_SIGNAL (demux->task); + gst_adapter_clear (demux->download); + return TRUE; +} diff --git a/gst/hls/gsthlsdemux.h b/gst/hls/gsthlsdemux.h new file mode 100644 index 0000000000..caf6437207 --- /dev/null +++ b/gst/hls/gsthlsdemux.h @@ -0,0 +1,100 @@ +/* GStreamer + * Copyright (C) 2010 Marc-Andre Lureau + * Copyright (C) 2010 Andoni Morales Alastruey + * + * gsthlsdemux.h: + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + + +#ifndef __GST_HLS_DEMUX_H__ +#define __GST_HLS_DEMUX_H__ + +#include +#include +#include "m3u8.h" + +G_BEGIN_DECLS +#define GST_TYPE_HLS_DEMUX \ + (gst_hls_demux_get_type()) +#define GST_HLS_DEMUX(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_HLS_DEMUX,GstHLSDemux)) +#define GST_HLS_DEMUX_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_HLS_DEMUX,GstHLSDemuxClass)) +#define GST_IS_HLS_DEMUX(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_HLS_DEMUX)) +#define GST_IS_HLS_DEMUX_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_HLS_DEMUX)) +typedef struct _GstHLSDemux GstHLSDemux; +typedef struct _GstHLSDemuxClass GstHLSDemuxClass; + +/** + * GstHLSDemux: + * + * Opaque #GstHLSDemux data structure. + */ +struct _GstHLSDemux +{ + GstElement parent; + + GstTask *task; + GStaticRecMutex task_lock; + GstPad *srcpad; + GstPad *sinkpad; + GstBuffer *playlist; + GstCaps *input_caps; + GstM3U8Client *client; /* M3U8 client */ + GQueue *queue; /* Queue storing the fetched fragments */ + gboolean need_cache; /* Wheter we need to cache some fragments before starting to push data */ + gboolean end_of_playlist; + + + /* Properties */ + guint fragments_cache; /* number of fragments needed to be cached to start playing */ + gfloat bitrate_switch_tol; /* tolerance with respect to the fragment duration to switch the bitarate*/ + + /* Updates thread */ + GThread *updates_thread; /* Thread handling the playlist and fragments updates */ + GMutex *thread_lock; /* Thread lock */ + GCond *thread_cond; /* Signals the thread to quit */ + gboolean thread_return; /* Instructs the thread to return after the thread_quit condition is meet */ + GTimeVal next_update; /* Time of the next update */ + gint64 accumulated_delay; /* Delay accumulated fetching fragments, used to decide a playlist switch */ + + /* Fragments fetcher */ + GstElement *fetcher; + GstBus *fetcher_bus; + GstPad *fetcherpad; + GMutex *fetcher_lock; + GCond *fetcher_cond; + GTimeVal *timeout; + gboolean fetcher_error; + gboolean stopping_fetcher; + gboolean cancelled; + GstAdapter *download; + +}; + +struct _GstHLSDemuxClass +{ + GstElementClass parent_class; +}; + +GType gst_hls_demux_get_type (void); + +G_END_DECLS +#endif /* __GST_HLS_DEMUX_H__ */ diff --git a/gst/hls/m3u8.c b/gst/hls/m3u8.c new file mode 100644 index 0000000000..20252f01df --- /dev/null +++ b/gst/hls/m3u8.c @@ -0,0 +1,516 @@ +/* GStreamer + * Copyright (C) 2010 Marc-Andre Lureau + * + * m3u8.c: + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include +#include + +#include "gstfragmented.h" +#include "m3u8.h" + +#define GST_CAT_DEFAULT fragmented_debug + +static GstM3U8 *gst_m3u8_new (void); +static void gst_m3u8_free (GstM3U8 * m3u8); +static gboolean gst_m3u8_update (GstM3U8 * m3u8, gchar * data, + gboolean * updated); +static GstM3U8MediaFile *gst_m3u8_media_file_new (gchar * uri, + gchar * title, gint duration, guint sequence); +static void gst_m3u8_media_file_free (GstM3U8MediaFile * self); + +static GstM3U8 * +gst_m3u8_new (void) +{ + GstM3U8 *m3u8; + + m3u8 = g_new0 (GstM3U8, 1); + + return m3u8; +} + +static void +gst_m3u8_set_uri (GstM3U8 * self, gchar * uri) +{ + g_return_if_fail (self != NULL); + + if (self->uri) + g_free (self->uri); + self->uri = uri; +} + +static void +gst_m3u8_free (GstM3U8 * self) +{ + g_return_if_fail (self != NULL); + + g_free (self->uri); + g_free (self->allowcache); + g_free (self->codecs); + + g_list_foreach (self->files, (GFunc) gst_m3u8_media_file_free, NULL); + g_list_free (self->files); + + g_free (self->last_data); + g_list_foreach (self->lists, (GFunc) gst_m3u8_free, NULL); + g_list_free (self->lists); + + g_free (self); +} + +static GstM3U8MediaFile * +gst_m3u8_media_file_new (gchar * uri, gchar * title, gint duration, + guint sequence) +{ + GstM3U8MediaFile *file; + + file = g_new0 (GstM3U8MediaFile, 1); + file->uri = uri; + file->title = title; + file->duration = duration; + file->sequence = sequence; + + return file; +} + +static void +gst_m3u8_media_file_free (GstM3U8MediaFile * self) +{ + g_return_if_fail (self != NULL); + + g_free (self->title); + g_free (self->uri); + g_free (self); +} + +static gboolean +int_from_string (gchar * ptr, gchar ** endptr, gint * val) +{ + gchar *end; + glong ret; + + g_return_val_if_fail (ptr != NULL, FALSE); + g_return_val_if_fail (val != NULL, FALSE); + + errno = 0; + ret = strtol (ptr, &end, 10); + if ((errno == ERANGE && (ret == LONG_MAX || ret == LONG_MIN)) + || (errno != 0 && ret == 0)) { + GST_WARNING ("%s", g_strerror (errno)); + return FALSE; + } + + if (ret > G_MAXINT) { + GST_WARNING ("%s", g_strerror (ERANGE)); + return FALSE; + } + + if (endptr) + *endptr = end; + + *val = (gint) ret; + + return end != ptr; +} + +static gboolean +parse_attributes (gchar ** ptr, gchar ** a, gchar ** v) +{ + gchar *end, *p; + + g_return_val_if_fail (ptr != NULL, FALSE); + g_return_val_if_fail (*ptr != NULL, FALSE); + g_return_val_if_fail (a != NULL, FALSE); + g_return_val_if_fail (v != NULL, FALSE); + + /* [attribute=value,]* */ + + *a = *ptr; + end = p = g_utf8_strchr (*ptr, -1, ','); + if (end) { + do { + end = g_utf8_next_char (end); + } while (end && *end == ' '); + *p = '\0'; + } + + *v = p = g_utf8_strchr (*ptr, -1, '='); + if (*v) { + *v = g_utf8_next_char (*v); + *p = '\0'; + } else { + GST_WARNING ("missing = after attribute"); + return FALSE; + } + + *ptr = end; + return TRUE; +} + +static gint +_m3u8_compare_uri (GstM3U8 * a, gchar * uri) +{ + g_return_val_if_fail (a != NULL, 0); + g_return_val_if_fail (uri != NULL, 0); + + return g_strcmp0 (a->uri, uri); +} + +static gint +gst_m3u8_compare_playlist_by_bitrate (gconstpointer a, gconstpointer b) +{ + return ((GstM3U8 *) (a))->bandwidth - ((GstM3U8 *) (b))->bandwidth; +} + +/* + * @data: a m3u8 playlist text data, taking ownership + */ +static gboolean +gst_m3u8_update (GstM3U8 * self, gchar * data, gboolean * updated) +{ + gint val, duration; + gchar *title, *end; +// gboolean discontinuity; + GstM3U8 *list; + + g_return_val_if_fail (self != NULL, FALSE); + g_return_val_if_fail (data != NULL, FALSE); + g_return_val_if_fail (updated != NULL, FALSE); + + *updated = TRUE; + + /* check if the data changed since last update */ + if (self->last_data && g_str_equal (self->last_data, data)) { + GST_DEBUG ("Playlist is the same as previous one"); + *updated = FALSE; + g_free (data); + return TRUE; + } + + if (!g_str_has_prefix (data, "#EXTM3U")) { + GST_WARNING ("Data doesn't start with #EXTM3U"); + g_free (data); + return FALSE; + } + + g_free (self->last_data); + self->last_data = data; + + if (self->files) { + g_list_foreach (self->files, (GFunc) gst_m3u8_media_file_free, NULL); + g_list_free (self->files); + self->files = NULL; + } + + list = NULL; + duration = -1; + title = NULL; + data += 7; + while (TRUE) { + end = g_utf8_strchr (data, -1, '\n'); /* FIXME: support \r\n */ + if (end) + *end = '\0'; + + if (data[0] != '#') { + if (duration < 0 && list == NULL) { + GST_LOG ("%s: got line without EXTINF or EXTSTREAMINF, dropping", data); + goto next_line; + } + + if (!gst_uri_is_valid (data)) { + gchar *slash; + if (!self->uri) { + GST_WARNING ("uri not set, can't build a valid uri"); + goto next_line; + } + slash = g_utf8_strrchr (self->uri, -1, '/'); + if (!slash) { + GST_WARNING ("Can't build a valid uri"); + goto next_line; + } + + *slash = '\0'; + data = g_strdup_printf ("%s/%s", self->uri, data); + *slash = '/'; + } else + data = g_strdup (data); + + if (list != NULL) { + if (g_list_find_custom (self->lists, data, + (GCompareFunc) _m3u8_compare_uri)) { + GST_DEBUG ("Already have a list with this URI"); + gst_m3u8_free (list); + g_free (data); + } else { + gst_m3u8_set_uri (list, data); + self->lists = g_list_append (self->lists, list); + } + list = NULL; + } else { + GstM3U8MediaFile *file; + file = + gst_m3u8_media_file_new (data, title, duration, + self->mediasequence++); + duration = -1; + title = NULL; + self->files = g_list_append (self->files, file); + } + + } else if (g_str_has_prefix (data, "#EXT-X-ENDLIST")) { + self->endlist = TRUE; + } else if (g_str_has_prefix (data, "#EXT-X-VERSION:")) { + if (int_from_string (data + 15, &data, &val)) + self->version = val; + } else if (g_str_has_prefix (data, "#EXT-X-STREAM-INF:")) { + gchar *v, *a; + + if (list != NULL) { + GST_WARNING ("Found a list without a uri..., dropping"); + gst_m3u8_free (list); + } + + list = gst_m3u8_new (); + data = data + 18; + while (data && parse_attributes (&data, &a, &v)) { + if (g_str_equal (a, "BANDWIDTH")) { + if (!int_from_string (v, NULL, &list->bandwidth)) + GST_WARNING ("Error while reading BANDWIDTH"); + } else if (g_str_equal (a, "PROGRAM-ID")) { + if (!int_from_string (v, NULL, &list->program_id)) + GST_WARNING ("Error while reading PROGRAM-ID"); + } else if (g_str_equal (a, "CODECS")) { + g_free (list->codecs); + list->codecs = g_strdup (v); + } else if (g_str_equal (a, "RESOLUTION")) { + if (!int_from_string (v, &v, &list->width)) + GST_WARNING ("Error while reading RESOLUTION width"); + if (!v || *v != '=') { + GST_WARNING ("Missing height"); + } else { + v = g_utf8_next_char (v); + if (!int_from_string (v, NULL, &list->height)) + GST_WARNING ("Error while reading RESOLUTION height"); + } + } + } + } else if (g_str_has_prefix (data, "#EXT-X-TARGETDURATION:")) { + if (int_from_string (data + 22, &data, &val)) + self->targetduration = val; + } else if (g_str_has_prefix (data, "#EXT-X-MEDIA-SEQUENCE:")) { + if (int_from_string (data + 22, &data, &val)) + self->mediasequence = val; + } else if (g_str_has_prefix (data, "#EXT-X-DISCONTINUITY")) { + /* discontinuity = TRUE; */ + } else if (g_str_has_prefix (data, "#EXT-X-PROGRAM-DATE-TIME:")) { + /* */ + GST_DEBUG ("FIXME parse date"); + } else if (g_str_has_prefix (data, "#EXT-X-ALLOW-CACHE:")) { + g_free (self->allowcache); + self->allowcache = g_strdup (data + 19); + } else if (g_str_has_prefix (data, "#EXTINF:")) { + if (!int_from_string (data + 8, &data, &val)) { + GST_WARNING ("Can't read EXTINF duration"); + goto next_line; + } + duration = val; + if (duration > self->targetduration) + GST_WARNING ("EXTINF duration > TARGETDURATION"); + if (!data || *data != ',') + goto next_line; + data = g_utf8_next_char (data); + if (data != end) { + g_free (title); + title = g_strdup (data); + } + } else { + GST_LOG ("Ignored line: %s", data); + } + + next_line: + if (!end) + break; + data = g_utf8_next_char (end); /* skip \n */ + } + + /* redorder playlists by bitrate */ + if (self->lists) + self->lists = + g_list_sort (self->lists, + (GCompareFunc) gst_m3u8_compare_playlist_by_bitrate); + + return TRUE; +} + +GstM3U8Client * +gst_m3u8_client_new (const gchar * uri) +{ + GstM3U8Client *client; + + g_return_val_if_fail (uri != NULL, NULL); + + client = g_new0 (GstM3U8Client, 1); + client->main = gst_m3u8_new (); + client->current = NULL; + client->sequence = -1; + client->update_failed_count = 0; + gst_m3u8_set_uri (client->main, g_strdup (uri)); + + return client; +} + +void +gst_m3u8_client_free (GstM3U8Client * self) +{ + g_return_if_fail (self != NULL); + + gst_m3u8_free (self->main); + g_free (self); +} + +void +gst_m3u8_client_set_current (GstM3U8Client * self, GstM3U8 * m3u8) +{ + g_return_if_fail (self != NULL); + + if (m3u8 != self->current) { + self->current = m3u8; + self->update_failed_count = 0; + } +} + +gboolean +gst_m3u8_client_update (GstM3U8Client * self, gchar * data) +{ + GstM3U8 *m3u8; + gboolean updated = FALSE; + + g_return_val_if_fail (self != NULL, FALSE); + + m3u8 = self->current ? self->current : self->main; + + if (!gst_m3u8_update (m3u8, data, &updated)) + return FALSE; + + if (!updated) { + self->update_failed_count++; + return FALSE; + } + + /* select the first playlist, for now */ + if (!self->current) { + if (self->main->lists) { + self->current = g_list_first (self->main->lists)->data; + } else { + self->current = self->main; + } + } + + if (m3u8->files && self->sequence == -1) { + self->sequence = + GST_M3U8_MEDIA_FILE (g_list_first (m3u8->files)->data)->sequence; + GST_DEBUG ("Setting first sequence at %d", self->sequence); + } + + return TRUE; +} + +static gboolean +_find_next (GstM3U8MediaFile * file, GstM3U8Client * client) +{ + GST_DEBUG ("Found fragment %d", file->sequence); + if (file->sequence >= client->sequence) + return FALSE; + return TRUE; +} + +gboolean +gst_m3u8_client_get_next_fragment (GstM3U8Client * client, + gboolean * discontinuity, const gchar ** uri, GstClockTime * duration) +{ + GList *l; + GstM3U8MediaFile *file; + + g_return_val_if_fail (client != NULL, FALSE); + g_return_val_if_fail (client->current != NULL, FALSE); + g_return_val_if_fail (discontinuity != NULL, FALSE); + + GST_DEBUG ("Looking for fragment %d", client->sequence); + l = g_list_find_custom (client->current->files, client, + (GCompareFunc) _find_next); + if (l == NULL) + return FALSE; + + file = GST_M3U8_MEDIA_FILE (l->data); + + *discontinuity = client->sequence != file->sequence; + client->sequence = file->sequence + 1; + + *uri = file->uri; + *duration = file->duration * GST_SECOND; + return TRUE; +} + +static void +_sum_duration (GstM3U8MediaFile * self, GstClockTime * duration) +{ + *duration += self->duration; +} + +GstClockTime +gst_m3u8_client_get_duration (GstM3U8Client * client) +{ + GstClockTime duration = 0; + + g_return_val_if_fail (client != NULL, GST_CLOCK_TIME_NONE); + + /* We can only get the duration for on-demand streams */ + if (!client->current->endlist) + return GST_CLOCK_TIME_NONE; + + g_list_foreach (client->current->files, (GFunc) _sum_duration, &duration); + return duration * GST_SECOND; +} + +const gchar * +gst_m3u8_client_get_uri (GstM3U8Client * client) +{ + g_return_val_if_fail (client != NULL, NULL); + + return client->main->uri; +} + +gboolean +gst_m3u8_client_has_variant_playlist (GstM3U8Client * client) +{ + g_return_val_if_fail (client != NULL, FALSE); + + return client->main->lists != NULL; +} + +gboolean +gst_m3u8_client_is_live (GstM3U8Client * client) +{ + g_return_val_if_fail (client != NULL, FALSE); + + if (!client->current || client->current->endlist) + return FALSE; + + return TRUE; +} diff --git a/gst/hls/m3u8.h b/gst/hls/m3u8.h new file mode 100644 index 0000000000..7f37cdd739 --- /dev/null +++ b/gst/hls/m3u8.h @@ -0,0 +1,86 @@ +/* GStreamer + * Copyright (C) 2010 Marc-Andre Lureau + * Copyright (C) 2010 Andoni Morales Alastruey + * + * m3u8.h: + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __M3U8_H__ +#define __M3U8_H__ + +#include + +G_BEGIN_DECLS typedef struct _GstM3U8 GstM3U8; +typedef struct _GstM3U8MediaFile GstM3U8MediaFile; +typedef struct _GstM3U8Client GstM3U8Client; + +#define GST_M3U8_MEDIA_FILE(f) ((GstM3U8MediaFile*)f) + +struct _GstM3U8 +{ + gchar *uri; + + gboolean endlist; /* if ENDLIST has been reached */ + gint version; /* last EXT-X-VERSION */ + gint targetduration; /* last EXT-X-TARGETDURATION */ + gchar *allowcache; /* last EXT-X-ALLOWCACHE */ + + gint bandwidth; + gint program_id; + gchar *codecs; + gint width; + gint height; + GList *files; + + /*< private > */ + gchar *last_data; + GList *lists; /* list of GstM3U8 from the main playlist */ + GstM3U8 *parent; /* main playlist (if any) */ + guint mediasequence; /* EXT-X-MEDIA-SEQUENCE & increased with new media file */ +}; + +struct _GstM3U8MediaFile +{ + gchar *title; + gint duration; + gchar *uri; + guint sequence; /* the sequence nb of this file */ +}; + +struct _GstM3U8Client +{ + GstM3U8 *main; /* main playlist */ + GstM3U8 *current; + guint update_failed_count; + gint sequence; /* the next sequence for this client */ +}; + + +GstM3U8Client *gst_m3u8_client_new (const gchar * uri); +void gst_m3u8_client_free (GstM3U8Client * client); +gboolean gst_m3u8_client_update (GstM3U8Client * client, gchar * data); +void gst_m3u8_client_set_current (GstM3U8Client * client, GstM3U8 * m3u8); +gboolean gst_m3u8_client_get_next_fragment (GstM3U8Client * client, + gboolean * discontinuity, const gchar ** uri, GstClockTime * duration); +GstClockTime gst_m3u8_client_get_duration (GstM3U8Client * client); +const gchar *gst_m3u8_client_get_uri(GstM3U8Client * client); +gboolean gst_m3u8_client_has_variant_playlist(GstM3U8Client * client); +gboolean gst_m3u8_client_is_live(GstM3U8Client * client); + +G_END_DECLS +#endif /* __M3U8_H__ */ diff --git a/gst/id3tag/Makefile.am b/gst/id3tag/Makefile.am index 108a227bbe..bb9c150ce9 100644 --- a/gst/id3tag/Makefile.am +++ b/gst/id3tag/Makefile.am @@ -17,3 +17,17 @@ libgstid3tag_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstid3tag_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstid3mux.h gsttagmux.h id3tag.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstid3tag -:SHARED libgstid3tag \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstid3tag_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstid3tag_la_CFLAGS) \ + -:LDFLAGS $(libgstid3tag_la_LDFLAGS) \ + $(libgstid3tag_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/interlace/Makefile.am b/gst/interlace/Makefile.am index 2411040ce5..5e29e8b176 100644 --- a/gst/interlace/Makefile.am +++ b/gst/interlace/Makefile.am @@ -15,3 +15,16 @@ libgstinterlace_la_LIBADD = \ libgstinterlace_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstinterlace_la_LIBTOOLFLAGS = --tag=disable-static +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstinterlace -:SHARED libgstinterlace \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstinterlace_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstinterlace_la_CFLAGS) \ + -:LDFLAGS $(libgstinterlace_la_LDFLAGS) \ + $(libgstinterlace_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ \ No newline at end of file diff --git a/gst/invtelecine/Makefile.am b/gst/invtelecine/Makefile.am deleted file mode 100644 index 2f8c33f30c..0000000000 --- a/gst/invtelecine/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -plugin_LTLIBRARIES = libgstinvtelecine.la - -libgstinvtelecine_la_SOURCES = \ - gstinvtelecine.c - -libgstinvtelecine_la_CFLAGS = \ - $(GST_CFLAGS) \ - $(GST_PLUGINS_BASE_CFLAGS) - -libgstinvtelecine_la_LIBADD = \ - $(GST_LIBS) \ - $(GST_PLUGINS_BASE_LIBS) -lgstvideo-@GST_MAJORMINOR@ \ - $(LIBM) - -libgstinvtelecine_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -libgstinvtelecine_la_LIBTOOLFLAGS = --tag=disable-static - diff --git a/gst/invtelecine/gstinvtelecine.c b/gst/invtelecine/gstinvtelecine.c deleted file mode 100644 index 50daab9ea8..0000000000 --- a/gst/invtelecine/gstinvtelecine.c +++ /dev/null @@ -1,966 +0,0 @@ -/* GStreamer - * Copyright (C) 2010 David A. Schleef - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include - -GST_DEBUG_CATEGORY (gst_invtelecine_debug); -#define GST_CAT_DEFAULT gst_invtelecine_debug - -#define GST_TYPE_INVTELECINE \ - (gst_invtelecine_get_type()) -#define GST_INVTELECINE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_INVTELECINE,GstInvtelecine)) -#define GST_INVTELECINE_DEC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_INVTELECINE,GstInvtelecineClass)) -#define GST_IS_GST_INVTELECINE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_INVTELECINE)) -#define GST_IS_GST_INVTELECINE_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_INVTELECINE)) - -typedef struct _GstInvtelecine GstInvtelecine; -typedef struct _GstInvtelecineClass GstInvtelecineClass; -typedef struct _Field Field; - -#define FIFO_SIZE 20 - -struct _Field -{ - GstBuffer *buffer; - int field_index; - double prev; - double prev1; - double prev2; - double prev3; - -}; - -struct _GstInvtelecine -{ - GstElement element; - - GstPad *srcpad; - GstPad *sinkpad; - - /* properties */ - gboolean verify_field_flags; - - /* state */ - int next_field; - int num_fields; - int field; - - gboolean locked; - int last_lock; - int phase; - - Field fifo[FIFO_SIZE]; - - int width; - int height; - GstVideoFormat format; - gboolean interlaced; - - double bad_flag_metric; -}; - -struct _GstInvtelecineClass -{ - GstElementClass element_class; - -}; - -enum -{ - ARG_0, - PROP_VERIFY_FIELD_FLAGS -}; - -static GstStaticPadTemplate gst_invtelecine_src_template = -GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{YUY2,UYVY,I420,YV12}") - ) - ); - -static GstStaticPadTemplate gst_invtelecine_sink_template = -GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{YUY2,UYVY,I420,YV12}") - ) - ); - -static void gst_invtelecine_base_init (gpointer g_class); -static void gst_invtelecine_class_init (GstInvtelecineClass * klass); -static void gst_invtelecine_init (GstInvtelecine * invtelecine); -static GstFlowReturn gst_invtelecine_chain (GstPad * pad, GstBuffer * buffer); - -static void gst_invtelecine_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec); -static void gst_invtelecine_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec); - -static gboolean gst_invtelecine_setcaps (GstPad * pad, GstCaps * caps); -static GstStateChangeReturn gst_invtelecine_change_state (GstElement * element, - GstStateChange transition); - -static GstElementClass *parent_class = NULL; - -static GstFlowReturn -gst_invtelecine_output_fields (GstInvtelecine * invtelecine, int num_fields); - - -static GType -gst_invtelecine_get_type (void) -{ - static GType invtelecine_type = 0; - - if (!invtelecine_type) { - static const GTypeInfo invtelecine_info = { - sizeof (GstInvtelecineClass), - gst_invtelecine_base_init, - NULL, - (GClassInitFunc) gst_invtelecine_class_init, - NULL, - NULL, - sizeof (GstInvtelecine), - 0, - (GInstanceInitFunc) gst_invtelecine_init, - }; - - invtelecine_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstInvtelecine", &invtelecine_info, 0); - } - - return invtelecine_type; -} - -static void -gst_invtelecine_base_init (gpointer g_class) -{ - - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details_simple (element_class, - "Inverse Telecine filter", "Filter/Video", - "Detects and reconstructs progressive content from telecine video", - "Entropy Wave "); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_invtelecine_sink_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_invtelecine_src_template)); -} - -static void -gst_invtelecine_class_init (GstInvtelecineClass * klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - - object_class->set_property = gst_invtelecine_set_property; - object_class->get_property = gst_invtelecine_get_property; - - element_class->change_state = gst_invtelecine_change_state; - - g_object_class_install_property (object_class, PROP_VERIFY_FIELD_FLAGS, - g_param_spec_boolean ("verify-field-flags", "verify field flags", - "Verify that field dominance (top/bottom field first) buffer " - "flags are correct", FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - -} - -static void -gst_invtelecine_init (GstInvtelecine * invtelecine) -{ - GST_DEBUG ("gst_invtelecine_init"); - invtelecine->sinkpad = - gst_pad_new_from_static_template (&gst_invtelecine_sink_template, "sink"); - gst_element_add_pad (GST_ELEMENT (invtelecine), invtelecine->sinkpad); - gst_pad_set_chain_function (invtelecine->sinkpad, gst_invtelecine_chain); - gst_pad_set_setcaps_function (invtelecine->sinkpad, gst_invtelecine_setcaps); - - invtelecine->srcpad = - gst_pad_new_from_static_template (&gst_invtelecine_src_template, "src"); - gst_element_add_pad (GST_ELEMENT (invtelecine), invtelecine->srcpad); - - invtelecine->bad_flag_metric = 1.0; - invtelecine->verify_field_flags = FALSE; -} - -static gboolean -gst_invtelecine_setcaps (GstPad * pad, GstCaps * caps) -{ - GstInvtelecine *invtelecine; - gboolean ret; - int width, height; - GstVideoFormat format; - gboolean interlaced = TRUE; - int fps_n, fps_d; - - invtelecine = GST_INVTELECINE (gst_pad_get_parent (pad)); - - ret = gst_video_format_parse_caps (caps, &format, &width, &height); - gst_video_format_parse_caps_interlaced (caps, &interlaced); - ret &= gst_video_parse_caps_framerate (caps, &fps_n, &fps_d); - - if (ret) { - GstCaps *srccaps = gst_caps_copy (caps); - - ret = gst_pad_set_caps (invtelecine->srcpad, srccaps); - - } - - if (ret) { - invtelecine->format = format; - invtelecine->width = width; - invtelecine->height = height; - invtelecine->interlaced = interlaced; - } - - g_object_unref (invtelecine); - - return ret; -} - - - -#define MAX_FIELD_SCORE 100 - -static double -gst_invtelecine_compare_fields (GstInvtelecine * invtelecine, int field1, - int field2) -{ - int i; - int j; - guint8 *data1; - guint8 *data2_1; - guint8 *data2_2; - int field_index; - int have; - int vave; - int hdiff; - int vdiff; - double sum; - double linesum; - double den; - - if (field1 < 0 || field2 < 0) - return MAX_FIELD_SCORE; - if (invtelecine->fifo[field1].buffer == NULL || - invtelecine->fifo[field2].buffer == NULL) - return MAX_FIELD_SCORE; - if (invtelecine->fifo[field1].buffer == invtelecine->fifo[field2].buffer && - invtelecine->fifo[field1].field_index == - invtelecine->fifo[field2].field_index) { - return 0; - } - - sum = 0; - field_index = invtelecine->fifo[field1].field_index; - for (j = field_index; j < invtelecine->height; j += 2) { - if (j == 0 || j == invtelecine->height - 1) - continue; - - if (invtelecine->format == GST_VIDEO_FORMAT_I420 || - invtelecine->format == GST_VIDEO_FORMAT_YV12) { - data1 = GST_BUFFER_DATA (invtelecine->fifo[field1].buffer) + - invtelecine->width * j; - data2_1 = - GST_BUFFER_DATA (invtelecine->fifo[field2].buffer) + - invtelecine->width * (j - 1); - data2_2 = - GST_BUFFER_DATA (invtelecine->fifo[field2].buffer) + - invtelecine->width * (j + 1); - - /* planar 4:2:0 */ - linesum = 0; - for (i = 1; i < invtelecine->width - 1; i++) { - have = data1[i - 1] + data1[i + 1]; - hdiff = abs (data1[i - 1] - data1[i + 1]); - vave = data2_1[i] + data2_2[i]; - vdiff = abs (data2_1[i] - data2_2[i]); - den = MAX (1, MAX (hdiff, vdiff)); - linesum += (have - vave) * (have - vave) / (den * den); - } - } else { - data1 = GST_BUFFER_DATA (invtelecine->fifo[field1].buffer) + - invtelecine->width * 2 * j; - data2_1 = - GST_BUFFER_DATA (invtelecine->fifo[field2].buffer) + - invtelecine->width * 2 * (j - 1); - data2_2 = - GST_BUFFER_DATA (invtelecine->fifo[field2].buffer) + - invtelecine->width * 2 * (j + 1); - if (invtelecine->format == GST_VIDEO_FORMAT_UYVY) { - data1++; - data2_1++; - data2_2++; - } - - /* packed 4:2:2 */ - linesum = 0; - for (i = 1; i < invtelecine->width - 1; i++) { - have = data1[(i - 1) * 2] + data1[(i + 1) * 2]; - hdiff = abs (data1[(i - 1) * 2] - data1[(i + 1) * 2]); - vave = data2_1[i * 2] + data2_2[i * 2]; - vdiff = abs (data2_1[i * 2] - data2_2[i * 2]); - den = MAX (1, MAX (hdiff, vdiff)); - linesum += (have - vave) * (have - vave) / (den * den); - } - } - sum += linesum; - } - - sum /= (invtelecine->width * invtelecine->height / 2); - - return MIN (sum, MAX_FIELD_SCORE); -} - -static double -gst_invtelecine_compare_fields_mse (GstInvtelecine * invtelecine, int field1, - int field2) -{ - int i; - int j; - guint8 *data1; - guint8 *data2; - int field_index1; - int field_index2; - int diff; - double sum; - double linesum; - - if (field1 < 0 || field2 < 0) - return MAX_FIELD_SCORE; - if (invtelecine->fifo[field1].buffer == NULL || - invtelecine->fifo[field2].buffer == NULL) - return MAX_FIELD_SCORE; - if (invtelecine->fifo[field1].buffer == invtelecine->fifo[field2].buffer && - invtelecine->fifo[field1].field_index == - invtelecine->fifo[field2].field_index) { - return 0; - } - - sum = 0; - field_index1 = invtelecine->fifo[field1].field_index; - field_index2 = invtelecine->fifo[field2].field_index; - if (invtelecine->format == GST_VIDEO_FORMAT_I420 || - invtelecine->format == GST_VIDEO_FORMAT_YV12) { - for (j = 0; j < invtelecine->height; j += 2) { - data1 = GST_BUFFER_DATA (invtelecine->fifo[field1].buffer) + - invtelecine->width * (j + field_index1); - data2 = GST_BUFFER_DATA (invtelecine->fifo[field2].buffer) + - invtelecine->width * (j + field_index2); - - linesum = 0; - for (i = 0; i < invtelecine->width; i++) { - diff = (data1[i] - data2[i]); - linesum += diff * diff; - } - sum += linesum; - } - } else { - for (j = 0; j < invtelecine->height; j += 2) { - data1 = GST_BUFFER_DATA (invtelecine->fifo[field1].buffer) + - invtelecine->width * 2 * (j + field_index1); - data2 = GST_BUFFER_DATA (invtelecine->fifo[field2].buffer) + - invtelecine->width * 2 * (j + field_index2); - - if (invtelecine->format == GST_VIDEO_FORMAT_UYVY) { - data1++; - data2++; - } - - linesum = 0; - for (i = 0; i < invtelecine->width; i++) { - diff = (data1[i * 2] - data2[i * 2]); - linesum += diff * diff; - } - sum += linesum; - } - } - - sum /= invtelecine->width * invtelecine->height / 2; - - //return MIN (sum, MAX_FIELD_SCORE); - return sum; -} - -static double -gst_invtelecine_compare_fields_mse_ave (GstInvtelecine * invtelecine, - int field1, int field2) -{ - int i; - int j; - guint8 *data1; - guint8 *data2_1; - guint8 *data2_2; - int field_index1; - int field_index2; - double diff; - double sum; - double linesum; - -#define MAX_FIELD_SCORE_2 1e9 - if (field1 < 0 || field2 < 0) - return MAX_FIELD_SCORE_2; - if (invtelecine->fifo[field1].buffer == NULL || - invtelecine->fifo[field2].buffer == NULL) - return MAX_FIELD_SCORE_2; - if (invtelecine->fifo[field1].buffer == invtelecine->fifo[field2].buffer && - invtelecine->fifo[field1].field_index == - invtelecine->fifo[field2].field_index) { - return 0; - } - - sum = 0; - field_index1 = invtelecine->fifo[field1].field_index; - field_index2 = invtelecine->fifo[field2].field_index; - if (invtelecine->format == GST_VIDEO_FORMAT_I420 || - invtelecine->format == GST_VIDEO_FORMAT_YV12) { - for (j = 0; j < invtelecine->height; j += 2) { - if (j + field_index1 == 0 || j + field_index1 == invtelecine->height - 1) - continue; - - data1 = GST_BUFFER_DATA (invtelecine->fifo[field1].buffer) + - invtelecine->width * (j + field_index1); - data2_1 = GST_BUFFER_DATA (invtelecine->fifo[field2].buffer) + - invtelecine->width * (j + field_index1 - 1); - data2_2 = GST_BUFFER_DATA (invtelecine->fifo[field2].buffer) + - invtelecine->width * (j + field_index1 + 1); - - linesum = 0; - for (i = 0; i < invtelecine->width; i++) { - diff = (data1[i] - (data2_1[i] + data2_2[i]) / 2); - diff *= diff; - linesum += diff * diff; - } - sum += linesum; - } - } else { - for (j = 0; j < invtelecine->height; j += 2) { - if (j + field_index1 == 0 || j + field_index1 == invtelecine->height - 1) - continue; - - data1 = GST_BUFFER_DATA (invtelecine->fifo[field1].buffer) + - invtelecine->width * 2 * (j + field_index1); - data2_1 = GST_BUFFER_DATA (invtelecine->fifo[field2].buffer) + - invtelecine->width * 2 * (j + field_index1 - 1); - data2_2 = GST_BUFFER_DATA (invtelecine->fifo[field2].buffer) + - invtelecine->width * 2 * (j + field_index1 + 1); - - if (invtelecine->format == GST_VIDEO_FORMAT_UYVY) { - data1++; - data2_1++; - data2_2++; - } - - linesum = 0; - for (i = 0; i < invtelecine->width; i++) { - diff = (data1[i] - (data2_1[i] + data2_2[i]) / 2); - diff *= diff; - linesum += diff * diff; - } - sum += linesum; - } - } - - sum /= invtelecine->width * (invtelecine->height / 2 - 1); - - g_assert (sum > 0); - - //return MIN (sum, MAX_FIELD_SCORE); - return sqrt (sum); -} - -static void -gst_invtelecine_push_field (GstInvtelecine * invtelecine, GstBuffer * buffer, - int field_index) -{ - int i; - - g_assert (invtelecine->num_fields < FIFO_SIZE - 1); - g_assert (invtelecine->num_fields >= 0); - - i = invtelecine->num_fields; - invtelecine->num_fields++; - GST_DEBUG ("ref %p", buffer); - invtelecine->fifo[i].buffer = gst_buffer_ref (buffer); - invtelecine->fifo[i].field_index = field_index; - invtelecine->fifo[i].prev = - gst_invtelecine_compare_fields (invtelecine, i, i - 1); - invtelecine->fifo[i].prev2 = - gst_invtelecine_compare_fields_mse (invtelecine, i, i - 2); - - if (invtelecine->verify_field_flags) { - invtelecine->fifo[i].prev3 = - gst_invtelecine_compare_fields_mse_ave (invtelecine, i, i - 3); - invtelecine->fifo[i].prev1 = - gst_invtelecine_compare_fields_mse_ave (invtelecine, i, i - 1); - -#define ALPHA 0.2 - if (invtelecine->fifo[i].prev3 != 0) { - invtelecine->bad_flag_metric *= (1 - ALPHA); - invtelecine->bad_flag_metric += - ALPHA * (invtelecine->fifo[i].prev1 / invtelecine->fifo[i].prev3); - } -#if 0 - g_print ("42 %g %g %g\n", invtelecine->bad_flag_metric, - invtelecine->fifo[i].prev1, invtelecine->fifo[i].prev3); -#endif - - if (invtelecine->bad_flag_metric > 1.2) { - GST_WARNING ("bad field flags? metric %g > 1.2", - invtelecine->bad_flag_metric); - } - } - -} - -int pulldown_2_3[] = { 2, 3 }; - -typedef struct _PulldownFormat PulldownFormat; -struct _PulldownFormat -{ - const char *name; - int cycle_length; - int n_fields[10]; -}; - -static const PulldownFormat formats[] = { - /* interlaced */ - {"interlaced", 1, {1}}, - /* 30p */ - {"2:2", 2, {2}}, - /* 24p */ - {"3:2", 5, {2, 3,}}, -}; - -static int -get_score_2 (GstInvtelecine * invtelecine, int format_index, int phase) -{ - const PulldownFormat *format = formats + format_index; - int field_index; - int k; - int i; - int score; - - GST_DEBUG ("score2 format_index %d phase %d", format_index, phase); - - phase = (invtelecine->field + phase) % format->cycle_length; - - field_index = 0; - k = 0; - while (phase > 0) { - field_index++; - if (field_index >= format->n_fields[k]) { - field_index = 0; - k++; - if (format->n_fields[k] == 0) { - k = 0; - } - } - phase--; - } - - /* k is the frame index in the format */ - /* field_index is the field index in the frame */ - - score = 0; - for (i = 0; i < 15; i++) { - if (field_index == 0) { - if (invtelecine->fifo[i].prev > 50) { - /* Strong picture change signal */ - score++; - } - } else { - if (invtelecine->fifo[i].prev > 50) { - /* A secondary field with visible combing */ - score -= 5; - } else if (field_index == 1) { - if (invtelecine->fifo[i].prev > 5) { - score--; - } else if (invtelecine->fifo[i].prev < 3) { - /* In the noise */ - score++; - } - } else { - if (invtelecine->fifo[i].prev2 < 1) { - score += 2; - } - if (invtelecine->fifo[i].prev2 > 10) { - /* A tertiary field that doesn't match */ - score -= 5; - } - } - } - - GST_DEBUG ("i=%d phase=%d fi=%d prev=%g score=%d", i, phase, field_index, - invtelecine->fifo[i].prev, score); - - field_index++; - if (field_index >= format->n_fields[k]) { - field_index = 0; - k++; - if (format->n_fields[k] == 0) { - k = 0; - } - } - } - - return score; -} - -int format_table[] = { 0, 1, 1, 2, 2, 2, 2, 2 }; -int phase_table[] = { 0, 0, 1, 0, 1, 2, 3, 4 }; - -static void -gst_invtelecine_process (GstInvtelecine * invtelecine, gboolean flush) -{ - //int score; - int num_fields; - int scores[8]; - int i; - int max_i; - //int format; - int phase; - - GST_DEBUG ("process %d", invtelecine->num_fields); - while (invtelecine->num_fields > 15) { - num_fields = 0; - - for (i = 0; i < 8; i++) { - scores[i] = get_score_2 (invtelecine, format_table[i], phase_table[i]); - } - -#if 0 - g_print ("scores %d %d %d %d %d %d %d %d %d\n", invtelecine->field, - scores[0], scores[1], scores[2], scores[3], - scores[4], scores[5], scores[6], scores[7]); -#endif - - max_i = invtelecine->last_lock; - for (i = 0; i < 8; i++) { - int field_index; - int k; - - phase = (invtelecine->field + phase_table[i]) % - formats[format_table[i]].cycle_length; - - field_index = 0; - k = 0; - while (phase > 0) { - field_index++; - if (field_index >= formats[format_table[i]].n_fields[k]) { - field_index = 0; - k++; - if (formats[format_table[i]].n_fields[k] == 0) { - k = 0; - } - } - phase--; - } - - if (field_index == 0) { - if (scores[i] > scores[max_i]) { - max_i = i; - } - } - } - - if (max_i != invtelecine->last_lock) { - - GST_WARNING ("new structure %s, phase %d", - formats[format_table[max_i]].name, phase_table[max_i]); - - invtelecine->last_lock = max_i; - } - - { - int field_index; - int k; - - phase = (invtelecine->field + phase_table[max_i]) % - formats[format_table[max_i]].cycle_length; - - field_index = 0; - k = 0; - while (phase > 0) { - field_index++; - if (field_index >= formats[format_table[max_i]].n_fields[k]) { - field_index = 0; - k++; - if (formats[format_table[max_i]].n_fields[k] == 0) { - k = 0; - } - } - phase--; - } - - num_fields = formats[format_table[max_i]].n_fields[k]; - } - - if (num_fields == 0) { - GST_WARNING ("unlocked"); - num_fields = 1; - } - - gst_invtelecine_output_fields (invtelecine, num_fields); - - while (num_fields > 0) { - GST_DEBUG ("unref %p", invtelecine->fifo[0].buffer); - gst_buffer_unref (invtelecine->fifo[0].buffer); - invtelecine->num_fields--; - memmove (invtelecine->fifo, invtelecine->fifo + 1, - invtelecine->num_fields * sizeof (Field)); - num_fields--; - invtelecine->field++; - } - - invtelecine->phase++; - if (invtelecine->phase == 2) { - invtelecine->phase = 0; - } - } - -} - -static void -copy_field (GstInvtelecine * invtelecine, GstBuffer * d, GstBuffer * s, - int field_index) -{ - int j; - guint8 *dest; - guint8 *src; - int width = invtelecine->width; - int height = invtelecine->height; - - if (invtelecine->format == GST_VIDEO_FORMAT_I420 || - invtelecine->format == GST_VIDEO_FORMAT_YV12) { - /* planar 4:2:0 */ - for (j = field_index; j < height; j += 2) { - dest = GST_BUFFER_DATA (d) + j * width; - src = GST_BUFFER_DATA (s) + j * width; - memcpy (dest, src, width); - } - for (j = field_index; j < height / 2; j += 2) { - dest = GST_BUFFER_DATA (d) + width * height + j * width / 2; - src = GST_BUFFER_DATA (s) + width * height + j * width / 2; - memcpy (dest, src, width / 2); - } - for (j = field_index; j < height / 2; j += 2) { - dest = - GST_BUFFER_DATA (d) + width * height + width / 2 * height / 2 + - j * width / 2; - src = - GST_BUFFER_DATA (s) + width * height + width / 2 * height / 2 + - j * width / 2; - memcpy (dest, src, width / 2); - } - } else { - /* packed 4:2:2 */ - for (j = field_index; j < height; j += 2) { - dest = GST_BUFFER_DATA (d) + j * width * 2; - src = GST_BUFFER_DATA (s) + j * width * 2; - memcpy (dest, src, width * 2); - } - } -} - -static GstFlowReturn -gst_invtelecine_output_fields (GstInvtelecine * invtelecine, int num_fields) -{ - GstBuffer *buffer; - int field_index; - - field_index = invtelecine->fifo[0].field_index; - - if (invtelecine->format == GST_VIDEO_FORMAT_I420 || - invtelecine->format == GST_VIDEO_FORMAT_YV12) { - buffer = - gst_buffer_new_and_alloc (invtelecine->width * invtelecine->height * 3 / - 2); - } else { - buffer = - gst_buffer_new_and_alloc (invtelecine->width * invtelecine->height * 2); - } - - copy_field (invtelecine, buffer, invtelecine->fifo[0].buffer, field_index); - copy_field (invtelecine, buffer, invtelecine->fifo[1].buffer, - field_index ^ 1); - - gst_buffer_set_caps (buffer, GST_BUFFER_CAPS (invtelecine->fifo[0].buffer)); - - GST_BUFFER_TIMESTAMP (buffer) = - GST_BUFFER_TIMESTAMP (invtelecine->fifo[0].buffer); - GST_BUFFER_DURATION (buffer) = - gst_util_uint64_scale (GST_SECOND, num_fields * 1001, 60000); - if (num_fields == 3) { - GST_BUFFER_FLAG_SET (buffer, GST_VIDEO_BUFFER_RFF); - } - if (num_fields == 1) { - GST_BUFFER_FLAG_SET (buffer, GST_VIDEO_BUFFER_ONEFIELD); - } - if (field_index == 0) { - GST_BUFFER_FLAG_SET (buffer, GST_VIDEO_BUFFER_TFF); - } - - return gst_pad_push (invtelecine->srcpad, buffer); -} - -static GstFlowReturn -gst_invtelecine_chain (GstPad * pad, GstBuffer * buffer) -{ - GstInvtelecine *invtelecine = GST_INVTELECINE (gst_pad_get_parent (pad)); - int field_index; - - GST_DEBUG ("Received buffer at %u:%02u:%02u:%09u", - (guint) (GST_BUFFER_TIMESTAMP (buffer) / (GST_SECOND * 60 * 60)), - (guint) ((GST_BUFFER_TIMESTAMP (buffer) / (GST_SECOND * 60)) % 60), - (guint) ((GST_BUFFER_TIMESTAMP (buffer) / GST_SECOND) % 60), - (guint) (GST_BUFFER_TIMESTAMP (buffer) % GST_SECOND)); - - field_index = (GST_BUFFER_FLAGS (buffer) & GST_VIDEO_BUFFER_TFF) ? 0 : 1; -//#define BAD -#ifdef BAD - field_index ^= 1; -#endif - - GST_DEBUG ("duration %" GST_TIME_FORMAT " flags %04x %s %s %s", - GST_TIME_ARGS (GST_BUFFER_DURATION (buffer)), - GST_BUFFER_FLAGS (buffer), - (GST_BUFFER_FLAGS (buffer) & GST_VIDEO_BUFFER_TFF) ? "tff" : "", - (GST_BUFFER_FLAGS (buffer) & GST_VIDEO_BUFFER_RFF) ? "rff" : "", - (GST_BUFFER_FLAGS (buffer) & GST_VIDEO_BUFFER_ONEFIELD) ? "onefield" : - ""); - - if (GST_BUFFER_FLAGS (buffer) & GST_BUFFER_FLAG_DISCONT) { - GST_ERROR ("discont"); - - invtelecine->next_field = field_index; - invtelecine->bad_flag_metric = 1.0; - } - - if (invtelecine->next_field != field_index) { - GST_WARNING ("wrong field first, expecting %d got %d", - invtelecine->next_field, field_index); - invtelecine->next_field = field_index; - } - - gst_invtelecine_push_field (invtelecine, buffer, invtelecine->next_field); - invtelecine->next_field ^= 1; - - if (!(GST_BUFFER_FLAGS (buffer) & GST_VIDEO_BUFFER_ONEFIELD)) { - gst_invtelecine_push_field (invtelecine, buffer, invtelecine->next_field); - invtelecine->next_field ^= 1; - - if ((GST_BUFFER_FLAGS (buffer) & GST_VIDEO_BUFFER_RFF)) { - gst_invtelecine_push_field (invtelecine, buffer, invtelecine->next_field); - invtelecine->next_field ^= 1; - } - } - - gst_invtelecine_process (invtelecine, FALSE); - - gst_buffer_unref (buffer); - - gst_object_unref (invtelecine); - - return GST_FLOW_OK; -} - -static void -gst_invtelecine_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec) -{ - GstInvtelecine *invtelecine = GST_INVTELECINE (object); - - switch (prop_id) { - case PROP_VERIFY_FIELD_FLAGS: - invtelecine->verify_field_flags = g_value_get_boolean (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_invtelecine_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec) -{ - GstInvtelecine *invtelecine = GST_INVTELECINE (object); - - switch (prop_id) { - case PROP_VERIFY_FIELD_FLAGS: - g_value_set_boolean (value, invtelecine->verify_field_flags); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static GstStateChangeReturn -gst_invtelecine_change_state (GstElement * element, GstStateChange transition) -{ - //GstInvtelecine *invtelecine = GST_INVTELECINE (element); - - switch (transition) { - case GST_STATE_CHANGE_PAUSED_TO_READY: - //gst_invtelecine_reset (invtelecine); - break; - default: - break; - } - - if (parent_class->change_state) - return parent_class->change_state (element, transition); - - return GST_STATE_CHANGE_SUCCESS; -} - -static gboolean -plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_invtelecine_debug, "invtelecine", 0, - "Inverse telecine element"); - - return gst_element_register (plugin, "invtelecine", GST_RANK_NONE, - GST_TYPE_INVTELECINE); -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "invtelecine", - "Inverse Telecine", - plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/gst/ivfparse/Makefile.am b/gst/ivfparse/Makefile.am index b41c87f92a..684c4527f5 100644 --- a/gst/ivfparse/Makefile.am +++ b/gst/ivfparse/Makefile.am @@ -12,3 +12,16 @@ libgstivfparse_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstivfparse.h +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstivfparse -:SHARED libgstivfparse \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstivfparse_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstivfparse_la_CFLAGS) \ + -:LDFLAGS $(libgstivfparse_la_LDFLAGS) \ + $(libgstivfparse_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ \ No newline at end of file diff --git a/gst/jp2kdecimator/Makefile.am b/gst/jp2kdecimator/Makefile.am index f967a657f4..ad971b819d 100644 --- a/gst/jp2kdecimator/Makefile.am +++ b/gst/jp2kdecimator/Makefile.am @@ -12,3 +12,17 @@ libgstjp2kdecimator_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstjp2kdecimator_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstjp2kdecimator.h jp2kcodestream.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstjp2kdecimator -:SHARED libgstjp2kdecimator \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstjp2kdecimator_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstjp2kdecimator_la_CFLAGS) \ + -:LDFLAGS $(libgstjp2kdecimator_la_LDFLAGS) \ + $(libgstjp2kdecimator_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/jpegformat/Makefile.am b/gst/jpegformat/Makefile.am index 3ac11d7e01..80355d5df3 100644 --- a/gst/jpegformat/Makefile.am +++ b/gst/jpegformat/Makefile.am @@ -5,9 +5,23 @@ libgstjpegformat_la_CFLAGS = \ $(GST_PLUGINS_BASE_CFLAGS) \ $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) libgstjpegformat_la_LIBADD = \ - $(GST_PLUGINS_BASE_LIBS) -lgsttag-@GST_MAJORMINOR@ \ - $(GST_LIBS) $(GST_BASE_LIBS) + $(GST_PLUGINS_BASE_LIBS) -lgstinterfaces-@GST_MAJORMINOR@ \ + -lgsttag-@GST_MAJORMINOR@ $(GST_LIBS) $(GST_BASE_LIBS) libgstjpegformat_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstjpegformat_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstjpegformat.h gstjpegparse.h gstjifmux.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstjpegformat -:SHARED libgstjpegformat \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstjpegformat_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstjpegformat_la_CFLAGS) \ + -:LDFLAGS $(libgstjpegformat_la_LDFLAGS) \ + $(libgstjpegformat_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/jpegformat/gstjifmux.c b/gst/jpegformat/gstjifmux.c index 5308969bdf..9bfcfc8693 100644 --- a/gst/jpegformat/gstjifmux.c +++ b/gst/jpegformat/gstjifmux.c @@ -58,6 +58,7 @@ gst-launch videotestsrc num-buffers=1 ! jpegenc ! taginject tags="comment=\"test #include #include #include +#include #include "gstjifmux.h" @@ -118,8 +119,11 @@ static void gst_jif_type_init (GType type) { static const GInterfaceInfo tag_setter_info = { NULL, NULL, NULL }; + static const GInterfaceInfo tag_xmp_writer_info = { NULL, NULL, NULL }; g_type_add_interface_static (type, GST_TYPE_TAG_SETTER, &tag_setter_info); + g_type_add_interface_static (type, GST_TYPE_TAG_XMP_WRITER, + &tag_xmp_writer_info); GST_DEBUG_CATEGORY_INIT (jif_mux_debug, "jifmux", 0, "JPEG interchange format muxer"); @@ -139,7 +143,7 @@ gst_jif_mux_base_init (gpointer g_class) gst_static_pad_template_get (&gst_jif_mux_sink_pad_template)); gst_element_class_set_details_simple (element_class, "JPEG stream muxer", - "Video/Muxer", + "Video/Formatter", "Remuxes JPEG images with markers and tags", "Arnout Vandecappelle (Essensium/Mind) "); } @@ -383,8 +387,8 @@ gst_jif_mux_mangle_markers (GstJifMux * self) /* update the APP markers * - put any JFIF APP0 first - * - the Exif APP1 next, - * - the XMP APP1 next, + * - the Exif APP1 next, + * - the XMP APP1 next, * - the PSIR APP13 next, * - followed by all other marker segments */ @@ -570,7 +574,9 @@ gst_jif_mux_mangle_markers (GstJifMux * self) } /* add xmp */ - xmp_data = gst_tag_list_to_xmp_buffer (tags, FALSE); + xmp_data = + gst_tag_xmp_writer_tag_list_to_xmp_buffer (GST_TAG_XMP_WRITER (self), + tags, FALSE); if (xmp_data) { guint8 *data, *xmp = GST_BUFFER_DATA (xmp_data); guint size = GST_BUFFER_SIZE (xmp_data); @@ -581,7 +587,7 @@ gst_jif_mux_mangle_markers (GstJifMux * self) memcpy (&data[29], xmp, size); m = gst_jif_mux_new_marker (APP1, size + 29, data, TRUE); - /* + /* * Replace the old xmp marker and not add a new one. * There shouldn't be a xmp packet in the input, but it is better * to be safe than add another one and end up with 2 packets. @@ -605,12 +611,13 @@ gst_jif_mux_mangle_markers (GstJifMux * self) modified = TRUE; } - /* add jpeg comment */ + /* add jpeg comment from any of those */ (void) (gst_tag_list_get_string (tags, GST_TAG_COMMENT, &str) || gst_tag_list_get_string (tags, GST_TAG_DESCRIPTION, &str) || gst_tag_list_get_string (tags, GST_TAG_TITLE, &str)); if (str) { + GST_DEBUG_OBJECT (self, "set COM marker to '%s'", str); /* insert new marker into self->markers list */ m = gst_jif_mux_new_marker (COM, strlen (str) + 1, (const guint8 *) str, TRUE); diff --git a/gst/jpegformat/gstjpegformat.c b/gst/jpegformat/gstjpegformat.c index dd88e51f04..50573db0cc 100644 --- a/gst/jpegformat/gstjpegformat.c +++ b/gst/jpegformat/gstjpegformat.c @@ -33,7 +33,8 @@ plugin_init (GstPlugin * plugin) if (!gst_element_register (plugin, "jpegparse", GST_RANK_NONE, GST_TYPE_JPEG_PARSE)) return FALSE; - if (!gst_element_register (plugin, "jifmux", GST_RANK_NONE, GST_TYPE_JIF_MUX)) + if (!gst_element_register (plugin, "jifmux", GST_RANK_SECONDARY, + GST_TYPE_JIF_MUX)) return FALSE; return TRUE; diff --git a/gst/jpegformat/gstjpegparse.c b/gst/jpegformat/gstjpegparse.c index ca9ac1f2fa..64b16ae223 100644 --- a/gst/jpegformat/gstjpegparse.c +++ b/gst/jpegformat/gstjpegparse.c @@ -438,8 +438,8 @@ gst_jpeg_parse_sof (GstJpegParse * parse, GstByteReader * reader) guint8 numcomps = 0; /* Number of components in image (1 for gray, 3 for YUV, etc.) */ guint8 precision; /* precision (in bits) for the samples */ - guint8 compId[3]; /* unique value identifying each component */ - guint8 qtId[3]; /* quantization table ID to use for this comp */ + guint8 compId[3] G_GNUC_UNUSED; /* unique value identifying each component */ + guint8 qtId[3] G_GNUC_UNUSED; /* quantization table ID to use for this comp */ guint8 blockWidth[3]; /* Array[numComponents] giving the number of blocks (horiz) in this component */ guint8 blockHeight[3]; /* Same for the vertical part of this component */ @@ -464,7 +464,7 @@ gst_jpeg_parse_sof (GstJpegParse * parse, GstByteReader * reader) if (!gst_byte_reader_get_uint8 (reader, &numcomps)) return FALSE; - if (numcomps > 3) + if (numcomps > 3) /* FIXME */ return FALSE; /* Get decimation and quantization table id for each component */ @@ -511,6 +511,31 @@ gst_jpeg_parse_sof (GstJpegParse * parse, GstByteReader * reader) return TRUE; } +static inline gboolean +gst_jpeg_parse_remove_marker (GstJpegParse * parse, + GstByteReader * reader, guint8 marker, GstBuffer * buffer) +{ + guint16 size = 0; + guint pos = gst_byte_reader_get_pos (reader); + guint8 *data = GST_BUFFER_DATA (buffer); + + if (!gst_byte_reader_peek_uint16_be (reader, &size)) + return FALSE; + if (gst_byte_reader_get_remaining (reader) < size) + return FALSE; + + GST_LOG_OBJECT (parse, "unhandled marker %x removing %u bytes", marker, size); + + memmove (&data[pos], &data[pos + size], + GST_BUFFER_SIZE (buffer) - (pos + size)); + GST_BUFFER_SIZE (buffer) -= size; + + if (!gst_byte_reader_set_pos (reader, pos - size)) + return FALSE; + + return TRUE; +} + static inline gboolean gst_jpeg_parse_skip_marker (GstJpegParse * parse, GstByteReader * reader, guint8 marker) @@ -520,10 +545,156 @@ gst_jpeg_parse_skip_marker (GstJpegParse * parse, if (!gst_byte_reader_get_uint16_be (reader, &size)) return FALSE; +#ifndef GST_DISABLE_DEBUG + /* We'd pry the id of the skipped application segment */ + if (marker >= APP0 && marker <= APP15) { + const gchar *id_str = NULL; + + if (gst_byte_reader_peek_string_utf8 (reader, &id_str)) { + GST_DEBUG_OBJECT (parse, "unhandled marker %x: '%s' skiping %u bytes", + marker, id_str ? id_str : "(NULL)", size); + } else { + GST_DEBUG_OBJECT (parse, "unhandled marker %x skiping %u bytes", marker, + size); + } + } +#else + GST_DEBUG_OBJECT (parse, "unhandled marker %x skiping %u bytes", marker, + size); +#endif // GST_DISABLE_DEBUG + if (!gst_byte_reader_skip (reader, size - 2)) return FALSE; - GST_LOG_OBJECT (parse, "unhandled marker %x skiping %u bytes", marker, size); + return TRUE; +} + +static inline GstTagList * +get_tag_list (GstJpegParse * parse) +{ + if (!parse->priv->tags) + parse->priv->tags = gst_tag_list_new (); + return parse->priv->tags; +} + +static inline void +extract_and_queue_tags (GstJpegParse * parse, guint size, guint8 * data, + GstTagList * (*tag_func) (const GstBuffer * buff)) +{ + GstTagList *tags; + GstBuffer *buf; + + buf = gst_buffer_new (); + GST_BUFFER_DATA (buf) = data; + GST_BUFFER_SIZE (buf) = size; + + tags = tag_func (buf); + gst_buffer_unref (buf); + + if (tags) { + GstTagList *taglist = parse->priv->tags; + if (taglist) { + gst_tag_list_insert (taglist, tags, GST_TAG_MERGE_REPLACE); + gst_tag_list_free (tags); + } else { + parse->priv->tags = tags; + } + GST_DEBUG_OBJECT (parse, "collected tags: %" GST_PTR_FORMAT, + parse->priv->tags); + } +} + +static inline gboolean +gst_jpeg_parse_app1 (GstJpegParse * parse, GstByteReader * reader) +{ + guint16 size = 0; + const gchar *id_str; + const guint8 *data = NULL; + + if (!gst_byte_reader_get_uint16_be (reader, &size)) + return FALSE; + + size -= 2; /* 2 bytes for the mark */ + if (!gst_byte_reader_peek_string_utf8 (reader, &id_str)) + return FALSE; + + if (!strncmp (id_str, "Exif", 4)) { + + /* skip id + NUL + padding */ + if (!gst_byte_reader_skip (reader, 6)) + return FALSE; + size -= 6; + + /* handle exif metadata */ + if (!gst_byte_reader_get_data (reader, size, &data)) + return FALSE; + + extract_and_queue_tags (parse, size, (guint8 *) data, + gst_tag_list_from_exif_buffer_with_tiff_header); + + GST_LOG_OBJECT (parse, "parsed marker %x: '%s' %u bytes", + APP1, id_str, size); + + } else if (!strncmp (id_str, "http://ns.adobe.com/xap/1.0/", 28)) { + + /* skip the id + NUL */ + if (!gst_byte_reader_skip (reader, 29)) + return FALSE; + size -= 29; + + /* handle xmp metadata */ + if (!gst_byte_reader_get_data (reader, size, &data)) + return FALSE; + + extract_and_queue_tags (parse, size, (guint8 *) data, + gst_tag_list_from_xmp_buffer); + + GST_LOG_OBJECT (parse, "parsed marker %x: '%s' %u bytes", + APP1, id_str, size); + + } else { + if (!gst_jpeg_parse_skip_marker (parse, reader, APP1)) + return FALSE; + } + + return TRUE; +} + +static inline gchar * +get_utf8_from_data (const guint8 * data, guint16 size) +{ + const gchar *env_vars[] = { "GST_JPEG_TAG_ENCODING", + "GST_TAG_ENCODING", NULL + }; + const char *str = (gchar *) data; + + return gst_tag_freeform_string_to_utf8 (str, size, env_vars); +} + +/* read comment and post as tag */ +static inline gboolean +gst_jpeg_parse_com (GstJpegParse * parse, GstByteReader * reader) +{ + const guint8 *data = NULL; + guint16 size = 0; + gchar *comment; + + if (!gst_byte_reader_get_uint16_be (reader, &size)) + return FALSE; + + size -= 2; + if (!gst_byte_reader_get_data (reader, size, &data)) + return FALSE; + + comment = get_utf8_from_data (data, size); + + if (comment) { + GstTagList *taglist = get_tag_list (parse); + gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, + GST_TAG_COMMENT, comment, NULL); + GST_DEBUG_OBJECT (parse, "collected tags: %" GST_PTR_FORMAT, taglist); + g_free (comment); + } return TRUE; } @@ -533,7 +704,6 @@ gst_jpeg_parse_read_header (GstJpegParse * parse, GstBuffer * buffer) { GstByteReader reader = GST_BYTE_READER_INIT_FROM_BUFFER (buffer); guint8 marker = 0; - guint16 size = 0; gboolean foundSOF = FALSE; if (!gst_byte_reader_peek_uint8 (&reader, &marker)) @@ -560,123 +730,16 @@ gst_jpeg_parse_read_header (GstJpegParse * parse, GstBuffer * buffer) goto error; break; - case COM:{ /* read comment and post as tag */ - const guint8 *comment = NULL; - gchar *comm; - const gchar *env_vars[] = { "GST_JPEG_TAG_ENCODING", - "GST_TAG_ENCODING", NULL - }; - - if (!gst_byte_reader_get_uint16_be (&reader, &size)) + case COM: + if (!gst_jpeg_parse_com (parse, &reader)) goto error; - if (!gst_byte_reader_get_data (&reader, size - 2, &comment)) - goto error; - - comm = (gchar *) comment; - comm = gst_tag_freeform_string_to_utf8 (comm, size - 2, env_vars); - - if (comm) { - if (!parse->priv->tags) - parse->priv->tags = gst_tag_list_new (); - gst_tag_list_add (parse->priv->tags, GST_TAG_MERGE_REPLACE, - GST_TAG_COMMENT, comm, NULL); - g_free (comm); - } break; - } - case APP1:{ - const gchar *id_str; - if (!gst_byte_reader_get_uint16_be (&reader, &size)) + case APP1: + if (!gst_jpeg_parse_app1 (parse, &reader)) goto error; - if (!gst_byte_reader_get_string_utf8 (&reader, &id_str)) - goto error; - - if (!strcmp (id_str, "Exif")) { - const guint8 *exif_data = NULL; - guint exif_size = size - 2 - 6; /* 6 bytes for "Exif\0\0 id" */ - GstTagList *tags; - GstBuffer *buf; - - /* skip padding */ - gst_byte_reader_skip (&reader, 1); - - /* handle exif metadata */ - if (!gst_byte_reader_get_data (&reader, exif_size, &exif_data)) - goto error; - - buf = gst_buffer_new (); - GST_BUFFER_DATA (buf) = (guint8 *) exif_data; - GST_BUFFER_SIZE (buf) = exif_size; - tags = gst_tag_list_from_exif_buffer_with_tiff_header (buf); - gst_buffer_unref (buf); - - if (tags) { - GST_INFO_OBJECT (parse, "got exif metadata"); - if (parse->priv->tags) { - gst_tag_list_insert (parse->priv->tags, tags, - GST_TAG_MERGE_REPLACE); - gst_tag_list_free (tags); - } else { - parse->priv->tags = tags; - } - } - - GST_LOG_OBJECT (parse, "parsed marker %x: '%s' %u bytes", - marker, id_str, size - 2); - } else if (!strcmp (id_str, "http://ns.adobe.com/xap/1.0/")) { - const guint8 *xmp_data = NULL; - guint xmp_size = size - 2 - 29; /* 29 bytes for the id */ - GstTagList *tags; - GstBuffer *buf; - - /* handle xmp metadata */ - if (!gst_byte_reader_get_data (&reader, xmp_size, &xmp_data)) - goto error; - - buf = gst_buffer_new (); - GST_BUFFER_DATA (buf) = (guint8 *) xmp_data; - GST_BUFFER_SIZE (buf) = xmp_size; - tags = gst_tag_list_from_xmp_buffer (buf); - gst_buffer_unref (buf); - - if (tags) { - GST_INFO_OBJECT (parse, "got xmp metadata"); - if (parse->priv->tags) { - gst_tag_list_insert (parse->priv->tags, tags, - GST_TAG_MERGE_REPLACE); - gst_tag_list_free (tags); - } else { - parse->priv->tags = tags; - } - } - - GST_LOG_OBJECT (parse, "parsed marker %x: '%s' %u bytes", - marker, id_str, size - 2); - } else { - if (!gst_byte_reader_skip (&reader, size - 3 - strlen (id_str))) - goto error; - GST_LOG_OBJECT (parse, "unhandled marker %x: '%s' skiping %u bytes", - marker, id_str, size - 2); - } break; - } - case APP0: - case APP2: - case APP13: - case APP14: - case APP15:{ - const gchar *id_str; - if (!gst_byte_reader_get_uint16_be (&reader, &size)) - goto error; - if (!gst_byte_reader_get_string_utf8 (&reader, &id_str)) - goto error; - if (!gst_byte_reader_skip (&reader, size - 3 - strlen (id_str))) - goto error; - GST_LOG_OBJECT (parse, "unhandled marker %x: '%s' skiping %u bytes", - marker, id_str, size - 2); - break; - } + case DHT: case DQT: /* Ignore these codes */ @@ -698,28 +761,11 @@ gst_jpeg_parse_read_header (GstJpegParse * parse, GstBuffer * buffer) default: if (marker == JPG || (marker >= JPG0 && marker <= JPG13)) { /* we'd like to remove them from the buffer */ -#if 1 - guint pos = gst_byte_reader_get_pos (&reader); - guint8 *data = GST_BUFFER_DATA (buffer); - - if (!gst_byte_reader_peek_uint16_be (&reader, &size)) + if (!gst_jpeg_parse_remove_marker (parse, &reader, marker, buffer)) goto error; - if (gst_byte_reader_get_remaining (&reader) < size) - goto error; - - GST_LOG_OBJECT (parse, "unhandled marker %x removing %u bytes", - marker, size); - - memmove (&data[pos], &data[pos + size], - GST_BUFFER_SIZE (buffer) - (pos + size)); - GST_BUFFER_SIZE (buffer) -= size; - - if (!gst_byte_reader_set_pos (&reader, pos - size)) - goto error; -#else + } else if (marker >= APP0 && marker <= APP15) { if (!gst_jpeg_parse_skip_marker (parse, &reader, marker)) goto error; -#endif } else { GST_WARNING_OBJECT (parse, "unhandled marker %x, leaving", marker); /* Not SOF or SOI. Must not be a JPEG file (or file pointer @@ -823,7 +869,8 @@ gst_jpeg_parse_push_buffer (GstJpegParse * parse, guint len) } if (parse->priv->tags) { - GST_DEBUG_OBJECT (parse, "Pushing tags"); + GST_DEBUG_OBJECT (parse, "Pushing tags: %" GST_PTR_FORMAT, + parse->priv->tags); gst_element_found_tags_for_pad (GST_ELEMENT_CAST (parse), parse->priv->srcpad, parse->priv->tags); parse->priv->tags = NULL; @@ -835,7 +882,6 @@ gst_jpeg_parse_push_buffer (GstJpegParse * parse, guint len) parse->priv->caps_framerate_numerator = parse->priv->framerate_numerator; parse->priv->caps_framerate_denominator = parse->priv->framerate_denominator; - parse->priv->tags = NULL; } GST_BUFFER_TIMESTAMP (outbuf) = parse->priv->next_ts; @@ -941,9 +987,9 @@ gst_jpeg_parse_sink_event (GstPad * pad, GstEvent * event) gst_event_parse_tag (event, &taglist); /* Hold on to the tags till the srcpad caps are definitely set */ - if (!parse->priv->tags) - parse->priv->tags = gst_tag_list_new (); - gst_tag_list_insert (parse->priv->tags, taglist, GST_TAG_MERGE_REPLACE); + gst_tag_list_insert (get_tag_list (parse), taglist, + GST_TAG_MERGE_REPLACE); + GST_DEBUG ("collected tags: %" GST_PTR_FORMAT, parse->priv->tags); gst_event_unref (event); } break; @@ -998,8 +1044,10 @@ gst_jpeg_parse_change_state (GstElement * element, GstStateChange transition) switch (transition) { case GST_STATE_CHANGE_PAUSED_TO_READY: gst_adapter_clear (parse->priv->adapter); - if (parse->priv->tags) + if (parse->priv->tags) { gst_tag_list_free (parse->priv->tags); + parse->priv->tags = NULL; + } break; default: break; diff --git a/gst/legacyresample/Makefile.am b/gst/legacyresample/Makefile.am index 671595995c..13985affe3 100644 --- a/gst/legacyresample/Makefile.am +++ b/gst/legacyresample/Makefile.am @@ -20,3 +20,16 @@ libgstlegacyresample_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(LIBM) libgstlegacyresample_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstlegacyresample_la_LIBTOOLFLAGS = --tag=disable-static +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstlegacyresample -:SHARED libgstlegacyresample \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstlegacyresample_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstlegacyresample_la_CFLAGS) \ + -:LDFLAGS $(libgstlegacyresample_la_LDFLAGS) \ + $(libgstlegacyresample_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ \ No newline at end of file diff --git a/gst/librfb/Makefile.am b/gst/librfb/Makefile.am index 351beeeca8..ad4dd4fb65 100644 --- a/gst/librfb/Makefile.am +++ b/gst/librfb/Makefile.am @@ -26,3 +26,17 @@ noinst_HEADERS = \ gstrfbsrc.h \ d3des.h \ vncauth.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstlibrfb -:SHARED libgstlibrfb \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstlibrfb_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstlibrfb_la_CFLAGS) \ + -:LDFLAGS $(libgstlibrfb_la_LDFLAGS) \ + $(libgstlibrfb_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/librfb/rfbdecoder.c b/gst/librfb/rfbdecoder.c index 53de8d14aa..7122e77d4f 100644 --- a/gst/librfb/rfbdecoder.c +++ b/gst/librfb/rfbdecoder.c @@ -803,8 +803,8 @@ static void rfb_decoder_hextile_encoding (RfbDecoder * decoder, gint start_x, gint start_y, gint rect_w, gint rect_h) { - gint32 x, x_count, x_end, x_max, x_max_16; - gint32 y, y_count, y_end, y_max, y_max_16; + gint32 x, x_count G_GNUC_UNUSED, x_end, x_max, x_max_16; + gint32 y, y_count G_GNUC_UNUSED, y_end, y_max, y_max_16; guint8 subencoding, nr_subrect, xy, wh; guint32 background, foreground; diff --git a/gst/librfb/vncauth.c b/gst/librfb/vncauth.c index d6ce7e4880..dc6817366e 100644 --- a/gst/librfb/vncauth.c +++ b/gst/librfb/vncauth.c @@ -96,15 +96,18 @@ vncDecryptPasswdFromFile (char *fname) { FILE *fp; int32_t i, ch; - unsigned char *passwd = (unsigned char *) malloc (9); + unsigned char *passwd; if ((fp = fopen (fname, "r")) == NULL) return NULL; + passwd = (unsigned char *) malloc (9); + for (i = 0; i < 8; i++) { ch = getc (fp); if (ch == EOF) { fclose (fp); + free (passwd); return NULL; } passwd[i] = ch; diff --git a/gst/liveadder/Makefile.am b/gst/liveadder/Makefile.am index fcc971b6d2..4fe8e29592 100644 --- a/gst/liveadder/Makefile.am +++ b/gst/liveadder/Makefile.am @@ -9,3 +9,17 @@ libgstliveadder_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstliveadder_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = liveadder.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstliveadder -:SHARED libgstliveadder \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstliveadder_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstliveadder_la_CFLAGS) \ + -:LDFLAGS $(libgstliveadder_la_LDFLAGS) \ + $(libgstliveadder_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/liveadder/liveadder.c b/gst/liveadder/liveadder.c index df6cda5de5..01a7b057a8 100644 --- a/gst/liveadder/liveadder.c +++ b/gst/liveadder/liveadder.c @@ -1377,7 +1377,11 @@ gst_live_adder_request_new_pad (GstElement * element, GstPadTemplate * templ, adder = GST_LIVE_ADDER (element); /* increment pad counter */ +#if GLIB_CHECK_VERSION(2,29,5) + padcount = g_atomic_int_add (&adder->padcount, 1); +#else padcount = g_atomic_int_exchange_and_add (&adder->padcount, 1); +#endif name = g_strdup_printf ("sink%d", padcount); newpad = gst_pad_new_from_template (templ, name); diff --git a/gst/mpeg4videoparse/Makefile.am b/gst/mpeg4videoparse/Makefile.am index 9dfbeca51a..8259ed54f2 100644 --- a/gst/mpeg4videoparse/Makefile.am +++ b/gst/mpeg4videoparse/Makefile.am @@ -1,10 +1,24 @@ plugin_LTLIBRARIES = libgstmpeg4videoparse.la -libgstmpeg4videoparse_la_SOURCES = mpeg4videoparse.c -libgstmpeg4videoparse_la_CFLAGS = $(GST_CFLAGS) +libgstmpeg4videoparse_la_SOURCES = mpeg4videoparse.c mpeg4parse.c +libgstmpeg4videoparse_la_CFLAGS = $(GST_BASE_CFLAGS) $(GST_CFLAGS) libgstmpeg4videoparse_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) libgstmpeg4videoparse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstmpeg4videoparse_la_LIBTOOLFLAGS = --tag=disable-static -noinst_HEADERS = mpeg4videoparse.h +noinst_HEADERS = mpeg4videoparse.h mpeg4parse.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstmpeg4videoparse -:SHARED libgstmpeg4videoparse \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstmpeg4videoparse_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstmpeg4videoparse_la_CFLAGS) \ + -:LDFLAGS $(libgstmpeg4videoparse_la_LDFLAGS) \ + $(libgstmpeg4videoparse_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/mpeg4videoparse/mpeg4parse.c b/gst/mpeg4videoparse/mpeg4parse.c new file mode 100644 index 0000000000..bfdb6e4378 --- /dev/null +++ b/gst/mpeg4videoparse/mpeg4parse.c @@ -0,0 +1,293 @@ +/* GStreamer MPEG4-2 video Parser + * Copyright (C) <2008> Mindfruit B.V. + * @author Sjoerd Simons + * Copyright (C) <2007> Julien Moutte + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "mpeg4parse.h" + +#include + +GST_DEBUG_CATEGORY_EXTERN (mpeg4v_parse_debug); +#define GST_CAT_DEFAULT mpeg4v_parse_debug + + +#define GET_BITS(b, num, bits) G_STMT_START { \ + if (!gst_bit_reader_get_bits_uint32(b, bits, num)) \ + goto failed; \ + GST_TRACE ("parsed %d bits: %d", num, *(bits)); \ +} G_STMT_END + +#define MARKER_BIT(b) G_STMT_START { \ + guint32 i; \ + GET_BITS(b, 1, &i); \ + if (i != 0x1) \ + goto failed; \ +} G_STMT_END + +static inline gboolean +next_start_code (GstBitReader * b) +{ + guint32 bits; + + GET_BITS (b, 1, &bits); + if (bits != 0) + goto failed; + + while (b->bit != 0) { + GET_BITS (b, 1, &bits); + if (bits != 0x1) + goto failed; + } + + return TRUE; + +failed: + return FALSE; +} + +static inline gboolean +skip_user_data (GstBitReader * bs, guint32 * bits) +{ + while (*bits == MPEG4_USER_DATA_STARTCODE_MARKER) { + guint32 b; + + do { + GET_BITS (bs, 8, &b); + *bits = (*bits << 8) | b; + } while ((*bits >> 8) != MPEG4_START_MARKER); + } + + return TRUE; + +failed: + return FALSE; +} + + +static gint aspect_ratio_table[6][2] = { + {-1, -1}, {1, 1}, {12, 11}, {10, 11}, {16, 11}, {40, 33} +}; + +static gboolean +gst_mpeg4_params_parse_vo (MPEG4Params * params, GstBitReader * br) +{ + guint32 bits; + guint16 time_increment_resolution = 0; + guint16 fixed_time_increment = 0; + gint aspect_ratio_width = -1, aspect_ratio_height = -1; + gint height = -1, width = -1; + + /* expecting a video object startcode */ + GET_BITS (br, 32, &bits); + if (bits > 0x11F) + goto failed; + + /* expecting a video object layer startcode */ + GET_BITS (br, 32, &bits); + if (bits < 0x120 || bits > 0x12F) + goto failed; + + /* ignore random accessible vol and video object type indication */ + GET_BITS (br, 9, &bits); + + GET_BITS (br, 1, &bits); + if (bits) { + /* skip video object layer verid and priority */ + GET_BITS (br, 7, &bits); + } + + /* aspect ratio info */ + GET_BITS (br, 4, &bits); + if (bits == 0) + goto failed; + + /* check if aspect ratio info is extended par */ + if (bits == 0xf) { + GET_BITS (br, 8, &bits); + aspect_ratio_width = bits; + GET_BITS (br, 8, &bits); + aspect_ratio_height = bits; + } else if (bits < 0x6) { + aspect_ratio_width = aspect_ratio_table[bits][0]; + aspect_ratio_height = aspect_ratio_table[bits][1]; + } + GST_DEBUG ("aspect ratio %d/%d", aspect_ratio_width, aspect_ratio_height); + + GET_BITS (br, 1, &bits); + if (bits) { + /* vol control parameters, skip chroma and low delay */ + GET_BITS (br, 3, &bits); + GET_BITS (br, 1, &bits); + if (bits) { + /* skip vbv_parameters */ + GET_BITS (br, 79, &bits); + } + } + + /* layer shape */ + GET_BITS (br, 2, &bits); + /* only support rectangular */ + if (bits != 0) + goto failed; + + MARKER_BIT (br); + GET_BITS (br, 16, &bits); + time_increment_resolution = bits; + MARKER_BIT (br); + + GST_DEBUG ("time increment resolution %d", time_increment_resolution); + + GET_BITS (br, 1, &bits); + if (bits) { + /* fixed time increment */ + int n; + + /* Length of the time increment is the minimal number of bits needed to + * represent time_increment_resolution */ + for (n = 0; (time_increment_resolution >> n) != 0; n++); + GET_BITS (br, n, &bits); + + fixed_time_increment = bits; + } else { + /* When fixed_vop_rate is not set we can't guess any framerate */ + fixed_time_increment = 0; + } + GST_DEBUG ("fixed time increment %d", fixed_time_increment); + + /* assuming rectangular shape */ + MARKER_BIT (br); + GET_BITS (br, 13, &bits); + width = bits; + MARKER_BIT (br); + GET_BITS (br, 13, &bits); + height = bits; + MARKER_BIT (br); + GST_DEBUG ("width x height: %d x %d", width, height); + + /* so we got it all, report back */ + params->width = width; + params->height = height; + params->time_increment_resolution = time_increment_resolution; + params->fixed_time_increment = fixed_time_increment; + params->aspect_ratio_width = aspect_ratio_width; + params->aspect_ratio_height = aspect_ratio_height; + + return TRUE; + + /* ERRORS */ +failed: + { + GST_WARNING ("Failed to parse config data"); + return FALSE; + } +} + +static gboolean +gst_mpeg4_params_parse_vos (MPEG4Params * params, GstBitReader * br) +{ + guint32 bits; + + GET_BITS (br, 32, &bits); + if (bits != MPEG4_VOS_STARTCODE_MARKER) + goto failed; + + GET_BITS (br, 8, &bits); + params->profile = bits; + + /* invalid profile, warn but carry on */ + if (params->profile == 0) { + GST_WARNING ("Invalid profile in VOS"); + } + + /* Expect Visual Object startcode */ + GET_BITS (br, 32, &bits); + + /* but skip optional user data */ + if (!skip_user_data (br, &bits)) + goto failed; + + if (bits != MPEG4_VISUAL_OBJECT_STARTCODE_MARKER) + goto failed; + + GET_BITS (br, 1, &bits); + if (bits == 0x1) { + /* Skip visual_object_verid and priority */ + GET_BITS (br, 7, &bits); + } + + GET_BITS (br, 4, &bits); + /* Only support video ID */ + if (bits != 0x1) + goto failed; + + /* video signal type */ + GET_BITS (br, 1, &bits); + + if (bits == 0x1) { + /* video signal type, ignore format and range */ + GET_BITS (br, 4, &bits); + + GET_BITS (br, 1, &bits); + if (bits == 0x1) { + /* ignore color description */ + GET_BITS (br, 24, &bits); + } + } + + if (!next_start_code (br)) + goto failed; + + /* skip optional user data */ + GET_BITS (br, 32, &bits); + if (!skip_user_data (br, &bits)) + goto failed; + + /* rewind to start code */ + gst_bit_reader_set_pos (br, gst_bit_reader_get_pos (br) - 32); + + return gst_mpeg4_params_parse_vo (params, br); + + /* ERRORS */ +failed: + { + GST_WARNING ("Failed to parse config data"); + return FALSE; + } +} + +gboolean +gst_mpeg4_params_parse_config (MPEG4Params * params, const guint8 * data, + guint size) +{ + GstBitReader br; + + if (size < 4) + return FALSE; + + gst_bit_reader_init (&br, data, size); + + if (data[3] == MPEG4_VOS_STARTCODE) + return gst_mpeg4_params_parse_vos (params, &br); + else + return gst_mpeg4_params_parse_vo (params, &br); +} diff --git a/gst/mpeg4videoparse/mpeg4parse.h b/gst/mpeg4videoparse/mpeg4parse.h new file mode 100644 index 0000000000..cf79e88722 --- /dev/null +++ b/gst/mpeg4videoparse/mpeg4parse.h @@ -0,0 +1,63 @@ +/* GStreamer MPEG4-2 video Parser + * Copyright (C) <2008> Mindfruit B.V. + * @author Sjoerd Simons + * Copyright (C) <2007> Julien Moutte + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GST_MPEG4_PARAMS_H__ +#define __GST_MPEG4_PARAMS_H__ + +#include + +G_BEGIN_DECLS + +#define MPEG4_VIDEO_OBJECT_STARTCODE_MIN 0x00 +#define MPEG4_VIDEO_OBJECT_STARTCODE_MAX 0x1F +#define MPEG4_VOS_STARTCODE 0xB0 +#define MPEG4_VOS_ENDCODE 0xB1 +#define MPEG4_USER_DATA_STARTCODE 0xB2 +#define MPEG4_GOP_STARTCODE 0xB3 +#define MPEG4_VISUAL_OBJECT_STARTCODE 0xB5 +#define MPEG4_VOP_STARTCODE 0xB6 + +#define MPEG4_START_MARKER 0x000001 +#define MPEG4_VISUAL_OBJECT_STARTCODE_MARKER \ + ((MPEG4_START_MARKER << 8) + MPEG4_VISUAL_OBJECT_STARTCODE) +#define MPEG4_VOS_STARTCODE_MARKER \ + ((MPEG4_START_MARKER << 8) + MPEG4_VOS_STARTCODE) +#define MPEG4_USER_DATA_STARTCODE_MARKER \ + ((MPEG4_START_MARKER << 8) + MPEG4_USER_DATA_STARTCODE) + + +typedef struct _MPEG4Params MPEG4Params; + +struct _MPEG4Params +{ + gint profile; + + gint width, height; + gint aspect_ratio_width, aspect_ratio_height; + gint time_increment_resolution; + gint fixed_time_increment; +}; + +GstFlowReturn gst_mpeg4_params_parse_config (MPEG4Params * params, + const guint8 * data, guint size); + +G_END_DECLS +#endif diff --git a/gst/mpeg4videoparse/mpeg4videoparse.c b/gst/mpeg4videoparse/mpeg4videoparse.c index 254db9fb7d..3040b61ab6 100644 --- a/gst/mpeg4videoparse/mpeg4videoparse.c +++ b/gst/mpeg4videoparse/mpeg4videoparse.c @@ -2,6 +2,9 @@ * Copyright (C) <2008> Mindfruit B.V. * @author Sjoerd Simons * Copyright (C) <2007> Julien Moutte + * Copyright (C) <2011> Mark Nauwelaerts + * Copyright (C) <2011> Collabora Multimedia + * Copyright (C) <2011> Nokia Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -24,9 +27,10 @@ #endif #include +#include #include "mpeg4videoparse.h" -GST_DEBUG_CATEGORY_STATIC (mpeg4v_parse_debug); +GST_DEBUG_CATEGORY (mpeg4v_parse_debug); #define GST_CAT_DEFAULT mpeg4v_parse_debug static GstStaticPadTemplate src_template = @@ -57,914 +61,23 @@ enum PROP_LAST }; -GST_BOILERPLATE (GstMpeg4VParse, gst_mpeg4vparse, GstElement, GST_TYPE_ELEMENT); - -static gboolean -gst_mpeg4vparse_set_new_caps (GstMpeg4VParse * parse, - guint16 time_increment_resolution, guint16 fixed_time_increment, - gint aspect_ratio_width, gint aspect_ratio_height, gint width, gint height) -{ - gboolean res; - GstCaps *out_caps; - - if (parse->sink_caps) { - out_caps = gst_caps_copy (parse->sink_caps); - } else { - out_caps = gst_caps_new_simple ("video/mpeg", - "mpegversion", G_TYPE_INT, 4, NULL); - } - gst_caps_set_simple (out_caps, "systemstream", G_TYPE_BOOLEAN, FALSE, - "parsed", G_TYPE_BOOLEAN, TRUE, NULL); - - if (parse->profile != 0) { - gchar *profile = NULL; - - /* FIXME does it make sense to expose the profile in the caps ? */ - profile = g_strdup_printf ("%d", parse->profile); - gst_caps_set_simple (out_caps, "profile-level-id", - G_TYPE_STRING, profile, NULL); - g_free (profile); - } - - if (parse->config != NULL) { - gst_caps_set_simple (out_caps, "codec_data", - GST_TYPE_BUFFER, parse->config, NULL); - } - - if (fixed_time_increment != 0) { - /* we have a framerate */ - gst_caps_set_simple (out_caps, "framerate", - GST_TYPE_FRACTION, time_increment_resolution, fixed_time_increment, - NULL); - parse->frame_duration = gst_util_uint64_scale_int (GST_SECOND, - fixed_time_increment, time_increment_resolution); - } else { - /* unknown duration */ - parse->frame_duration = 0; - } - - if (aspect_ratio_width > 0 && aspect_ratio_height > 0) { - gst_caps_set_simple (out_caps, "pixel-aspect-ratio", - GST_TYPE_FRACTION, aspect_ratio_width, aspect_ratio_height, NULL); - } - - if (width > 0 && height > 0) { - gst_caps_set_simple (out_caps, - "width", G_TYPE_INT, width, "height", G_TYPE_INT, height, NULL); - } - - GST_DEBUG_OBJECT (parse, "setting downstream caps to %" GST_PTR_FORMAT, - out_caps); - res = gst_pad_set_caps (parse->srcpad, out_caps); - gst_caps_unref (out_caps); - - parse->have_src_caps = TRUE; - if (parse->pending_segment != NULL) { - /* We can send pending events since we now have caps for the srcpad */ - gst_pad_push_event (parse->srcpad, parse->pending_segment); - parse->pending_segment = NULL; - - if (G_UNLIKELY (parse->pending_events != NULL)) { - GList *l; - - for (l = parse->pending_events; l != NULL; l = l->next) - gst_pad_push_event (parse->srcpad, GST_EVENT (l->data)); - - g_list_free (parse->pending_events); - parse->pending_events = NULL; - } - } - return res; -} - -#define VIDEO_OBJECT_STARTCODE_MIN 0x00 -#define VIDEO_OBJECT_STARTCODE_MAX 0x1F -#define VOS_STARTCODE 0xB0 -#define VOS_ENDCODE 0xB1 -#define USER_DATA_STARTCODE 0xB2 -#define GOP_STARTCODE 0xB3 -#define VISUAL_OBJECT_STARTCODE 0xB5 -#define VOP_STARTCODE 0xB6 - -#define START_MARKER 0x000001 -#define VISUAL_OBJECT_STARTCODE_MARKER ((START_MARKER << 8) + VISUAL_OBJECT_STARTCODE) -#define USER_DATA_STARTCODE_MARKER ((START_MARKER << 8) + USER_DATA_STARTCODE) - -typedef struct -{ - const guint8 *data; - /* byte offset */ - gsize offset; - /* bit offset */ - gsize b_offset; - - /* size in bytes */ - gsize size; -} bitstream_t; - -static gboolean -get_bits (bitstream_t * b, int num, guint32 * bits) -{ - *bits = 0; - - if (b->offset + ((b->b_offset + num) / 8) > b->size) - return FALSE; - - if (b->b_offset + num <= 8) { - *bits = b->data[b->offset]; - *bits = (*bits >> (8 - num - b->b_offset)) & (((1 << num)) - 1); - - b->offset += (b->b_offset + num) / 8; - b->b_offset = (b->b_offset + num) % 8; - return TRUE; - } else { - /* going over the edge.. */ - int next; - - next = (8 - b->b_offset); - do { - guint32 t; - - if (!get_bits (b, next, &t)) - return FALSE; - *bits <<= next; - *bits |= t; - num -= next; - next = MIN (8, num); - } while (num > 0); - - return TRUE; - } -} - -#define GET_BITS(b, num, bits) G_STMT_START { \ - if (!get_bits(b, num, bits)) \ - goto failed; \ -} G_STMT_END - -#define MARKER_BIT(b) G_STMT_START { \ - guint32 i; \ - GET_BITS(b, 1, &i); \ - if (i != 0x1) \ - goto failed; \ -} G_STMT_END - -static inline gboolean -next_start_code (bitstream_t * b) -{ - guint32 bits; - - GET_BITS (b, 1, &bits); - if (bits != 0) - goto failed; - - while (b->b_offset != 0) { - GET_BITS (b, 1, &bits); - if (bits != 0x1) - goto failed; - } - - return TRUE; - -failed: - return FALSE; -} - -static gint aspect_ratio_table[6][2] = { {-1, -1}, {1, 1}, {12, 11}, -{10, 11}, {16, 11}, {40, 33} -}; - -static void -gst_mpeg4vparse_set_config (GstMpeg4VParse * parse, const guint8 * data, - gsize size) -{ - /* limit possible caps noise */ - if (parse->config && size == GST_BUFFER_SIZE (parse->config) && - memcmp (GST_BUFFER_DATA (parse->config), data, size) == 0) - return; - - if (parse->config != NULL) - gst_buffer_unref (parse->config); - - parse->config = gst_buffer_new_and_alloc (size); - memcpy (GST_BUFFER_DATA (parse->config), data, size); -} - -/* Handle parsing a video object */ -static gboolean -gst_mpeg4vparse_handle_vo (GstMpeg4VParse * parse, const guint8 * data, - gsize size, gboolean set_codec_data) -{ - guint32 bits; - bitstream_t bs = { data, 0, 0, size }; - guint16 time_increment_resolution = 0; - guint16 fixed_time_increment = 0; - gint aspect_ratio_width = -1, aspect_ratio_height = -1; - gint height = -1, width = -1; - - if (set_codec_data) - gst_mpeg4vparse_set_config (parse, data, size); - - /* expecting a video object startcode */ - GET_BITS (&bs, 32, &bits); - if (bits > 0x11F) - goto failed; - - /* expecting a video object layer startcode */ - GET_BITS (&bs, 32, &bits); - if (bits < 0x120 || bits > 0x12F) - goto failed; - - /* ignore random accessible vol and video object type indication */ - GET_BITS (&bs, 9, &bits); - - GET_BITS (&bs, 1, &bits); - if (bits) { - /* skip video object layer verid and priority */ - GET_BITS (&bs, 7, &bits); - } - - /* aspect ratio info */ - GET_BITS (&bs, 4, &bits); - if (bits == 0) - goto failed; - - /* check if aspect ratio info is extended par */ - if (bits == 0xf) { - GET_BITS (&bs, 8, &bits); - aspect_ratio_width = bits; - GET_BITS (&bs, 8, &bits); - aspect_ratio_height = bits; - } else if (bits < 0x6) { - aspect_ratio_width = aspect_ratio_table[bits][0]; - aspect_ratio_height = aspect_ratio_table[bits][1]; - } - - GET_BITS (&bs, 1, &bits); - if (bits) { - /* vol control parameters, skip chroma and low delay */ - GET_BITS (&bs, 3, &bits); - GET_BITS (&bs, 1, &bits); - if (bits) { - /* skip vbv_parameters */ - GET_BITS (&bs, 79, &bits); - } - } - - /* layer shape */ - GET_BITS (&bs, 2, &bits); - /* only support rectangular */ - if (bits != 0) - goto failed; - - MARKER_BIT (&bs); - GET_BITS (&bs, 16, &bits); - time_increment_resolution = bits; - MARKER_BIT (&bs); - - GST_DEBUG_OBJECT (parse, "time increment resolution %d", - time_increment_resolution); - - GET_BITS (&bs, 1, &bits); - if (bits) { - /* fixed time increment */ - int n; - - /* Length of the time increment is the minimal number of bits needed to - * represent time_increment_resolution */ - for (n = 0; (time_increment_resolution >> n) != 0; n++); - GET_BITS (&bs, n, &bits); - - fixed_time_increment = bits; - } else { - /* When fixed_vop_rate is not set we can't guess any framerate */ - fixed_time_increment = 0; - } - GST_DEBUG_OBJECT (parse, "fixed time increment %d", fixed_time_increment); - - /* assuming rectangular shape */ - MARKER_BIT (&bs); - GET_BITS (&bs, 13, &bits); - width = bits; - MARKER_BIT (&bs); - GET_BITS (&bs, 13, &bits); - height = bits; - MARKER_BIT (&bs); - - /* ok we know there is enough data in the stream to decode it and we can start - * pushing the data */ - parse->have_config = TRUE; - -out: - return gst_mpeg4vparse_set_new_caps (parse, time_increment_resolution, - fixed_time_increment, aspect_ratio_width, aspect_ratio_height, - width, height); - - /* ERRORS */ -failed: - { - GST_WARNING_OBJECT (parse, "Failed to parse config data"); - goto out; - } -} - -static inline gboolean -skip_user_data (bitstream_t * bs, guint32 * bits) -{ - while (*bits == USER_DATA_STARTCODE_MARKER) { - guint32 b; - - do { - GET_BITS (bs, 8, &b); - *bits = (*bits << 8) | b; - } while ((*bits >> 8) != START_MARKER); - } - - return TRUE; - -failed: - return FALSE; -} - -/* Handle parsing a visual object sequence. - Returns whether we successfully set the caps downstream if needed */ -static gboolean -gst_mpeg4vparse_handle_vos (GstMpeg4VParse * parse, const guint8 * data, - gsize size) -{ - /* Skip the startcode */ - guint32 bits; - - guint8 profile; - gboolean equal; - bitstream_t bs = { data, 0, 0, size }; - - if (size < 5) - goto failed; - - /* Parse the config from the VOS frame */ - bs.offset = 5; - - profile = data[4]; - - /* invalid profile, yikes */ - if (profile == 0) { - GST_WARNING_OBJECT (parse, "Invalid profile in VOS"); - return FALSE; - } - - equal = FALSE; - if (G_LIKELY (parse->config && size == GST_BUFFER_SIZE (parse->config) && - memcmp (GST_BUFFER_DATA (parse->config), data, size) == 0)) - equal = TRUE; - - if (G_LIKELY (parse->profile == profile && equal)) { - /* We know this profile and config data, so we can just keep the same caps - */ - return TRUE; - } - - /* Even if we fail to parse, then some other element might succeed, so always - * put the VOS in the config */ - parse->profile = profile; - gst_mpeg4vparse_set_config (parse, data, size); - - parse->have_config = TRUE; - - /* Expect Visual Object startcode */ - GET_BITS (&bs, 32, &bits); - - /* but skip optional user data */ - if (!skip_user_data (&bs, &bits)) - goto failed; - - if (bits != VISUAL_OBJECT_STARTCODE_MARKER) - goto failed; - - GET_BITS (&bs, 1, &bits); - if (bits == 0x1) { - /* Skip visual_object_verid and priority */ - GET_BITS (&bs, 7, &bits); - } - - GET_BITS (&bs, 4, &bits); - /* Only support video ID */ - if (bits != 0x1) - goto failed; - - /* video signal type */ - GET_BITS (&bs, 1, &bits); - - if (bits == 0x1) { - /* video signal type, ignore format and range */ - GET_BITS (&bs, 4, &bits); - - GET_BITS (&bs, 1, &bits); - if (bits == 0x1) { - /* ignore color description */ - GET_BITS (&bs, 24, &bits); - } - } - - if (!next_start_code (&bs)) - goto failed; - - /* skip optional user data */ - GET_BITS (&bs, 32, &bits); - if (!skip_user_data (&bs, &bits)) - goto failed; - /* rewind to start code */ - bs.offset -= 4; - - data = &bs.data[bs.offset]; - size -= bs.offset; - - return gst_mpeg4vparse_handle_vo (parse, data, size, FALSE); - -out: - return gst_mpeg4vparse_set_new_caps (parse, 0, 0, -1, -1, -1, -1); - - /* ERRORS */ -failed: - { - GST_WARNING_OBJECT (parse, "Failed to parse config data"); - goto out; - } -} - -static void -gst_mpeg4vparse_push (GstMpeg4VParse * parse, gsize size) -{ - if (G_UNLIKELY (!parse->have_config && parse->drop)) { - GST_LOG_OBJECT (parse, "Dropping %d bytes", parse->offset); - gst_adapter_flush (parse->adapter, size); - } else { - GstBuffer *out_buf; - - out_buf = gst_adapter_take_buffer (parse->adapter, parse->offset); - - if (G_LIKELY (out_buf)) { - out_buf = gst_buffer_make_metadata_writable (out_buf); - GST_BUFFER_TIMESTAMP (out_buf) = parse->timestamp; - - /* Set GST_BUFFER_FLAG_DELTA_UNIT if it's not an intra frame */ - if (!parse->intra_frame) { - GST_BUFFER_FLAG_SET (out_buf, GST_BUFFER_FLAG_DELTA_UNIT); - } else if (parse->interval > 0 && parse->config) { - GstClockTime timestamp = GST_BUFFER_TIMESTAMP (out_buf); - guint64 diff; - - /* init */ - if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (parse->last_report))) { - parse->last_report = timestamp; - } - - /* insert on intra frames */ - if (G_LIKELY (timestamp > parse->last_report)) - diff = timestamp - parse->last_report; - else - diff = 0; - - GST_LOG_OBJECT (parse, - "now %" GST_TIME_FORMAT ", last VOP-I %" GST_TIME_FORMAT, - GST_TIME_ARGS (timestamp), GST_TIME_ARGS (parse->last_report)); - - GST_DEBUG_OBJECT (parse, - "interval since last config %" GST_TIME_FORMAT, - GST_TIME_ARGS (diff)); - - if (G_UNLIKELY (GST_TIME_AS_SECONDS (diff) >= parse->interval)) { - /* we need to send config now first */ - GstBuffer *superbuf; - - GST_LOG_OBJECT (parse, "inserting config in stream"); - - /* insert header */ - superbuf = gst_buffer_merge (parse->config, out_buf); - gst_buffer_unref (out_buf); - - out_buf = gst_buffer_make_metadata_writable (superbuf); - GST_BUFFER_TIMESTAMP (out_buf) = timestamp; - - if (G_UNLIKELY (timestamp != -1)) { - parse->last_report = timestamp; - } - } - } - gst_buffer_set_caps (out_buf, GST_PAD_CAPS (parse->srcpad)); - gst_pad_push (parse->srcpad, out_buf); - } - } - - /* Restart now that we flushed data */ - parse->offset = 0; - parse->state = PARSE_NEED_START; - parse->intra_frame = FALSE; -} - -static GstFlowReturn -gst_mpeg4vparse_drain (GstMpeg4VParse * parse, GstBuffer * last_buffer) -{ - GstFlowReturn ret = GST_FLOW_OK; - const guint8 *data = NULL; - guint available = 0; - - available = gst_adapter_available (parse->adapter); - /* We do a quick check here to avoid the _peek() below. */ - if (G_UNLIKELY (available < 5)) { - GST_DEBUG_OBJECT (parse, "we need more data, %d < 5", available); - goto beach; - } - data = gst_adapter_peek (parse->adapter, available); - - /* Need at least 5 more bytes, 4 for the startcode, 1 to optionally determine - * the VOP frame type */ - while (available >= 5 && parse->offset < available - 5) { - if (data[parse->offset] == 0 && data[parse->offset + 1] == 0 && - data[parse->offset + 2] == 1) { - - switch (parse->state) { - case PARSE_NEED_START: - { - gboolean found = FALSE; - guint8 code; - - code = data[parse->offset + 3]; - - switch (code) { - case VOP_STARTCODE: - case VOS_STARTCODE: - case GOP_STARTCODE: - found = TRUE; - break; - default: - if (code <= 0x1f) - found = TRUE; - break; - } - if (found) { - /* valid starts of a frame */ - parse->state = PARSE_START_FOUND; - if (parse->offset > 0) { - GST_LOG_OBJECT (parse, "Flushing %u bytes", parse->offset); - gst_adapter_flush (parse->adapter, parse->offset); - parse->offset = 0; - available = gst_adapter_available (parse->adapter); - data = gst_adapter_peek (parse->adapter, available); - } - } else - parse->offset += 4; - break; - } - case PARSE_START_FOUND: - { - guint8 code; - - code = data[parse->offset + 3]; - - switch (code) { - case VOP_STARTCODE: - GST_LOG_OBJECT (parse, "found VOP start marker at %u", - parse->offset); - parse->intra_frame = ((data[parse->offset + 4] >> 6 & 0x3) == 0); - /* Ensure that the timestamp of the outgoing buffer is the same - * as the one the VOP header is found in */ - parse->timestamp = GST_BUFFER_TIMESTAMP (last_buffer); - parse->state = PARSE_VOP_FOUND; - break; - case VOS_STARTCODE: - GST_LOG_OBJECT (parse, "found VOS start marker at %u", - parse->offset); - parse->vos_offset = parse->offset; - parse->state = PARSE_VOS_FOUND; - break; - default: - if (code <= 0x1f) { - GST_LOG_OBJECT (parse, "found VO start marker at %u", - parse->offset); - parse->vos_offset = parse->offset; - parse->state = PARSE_VO_FOUND; - } - break; - } - /* Jump over it */ - parse->offset += 4; - break; - } - case PARSE_VO_FOUND: - switch (data[parse->offset + 3]) { - case GOP_STARTCODE: - case VOP_STARTCODE: - /* end of VOS found, interpret the config data and restart the - * search for the VOP */ - gst_mpeg4vparse_handle_vo (parse, data + parse->vos_offset, - parse->offset - parse->vos_offset, TRUE); - parse->state = PARSE_START_FOUND; - break; - default: - parse->offset += 4; - } - break; - case PARSE_VOS_FOUND: - switch (data[parse->offset + 3]) { - case GOP_STARTCODE: - case VOP_STARTCODE: - /* end of VOS found, interpret the config data and restart the - * search for the VOP */ - gst_mpeg4vparse_handle_vos (parse, data + parse->vos_offset, - parse->offset - parse->vos_offset); - parse->state = PARSE_START_FOUND; - break; - default: - parse->offset += 4; - } - break; - case PARSE_VOP_FOUND: - { /* We were in a VOP already, any start code marks the end of it */ - GST_LOG_OBJECT (parse, "found VOP end marker at %u", parse->offset); - - gst_mpeg4vparse_push (parse, parse->offset); - - available = gst_adapter_available (parse->adapter); - data = gst_adapter_peek (parse->adapter, available); - break; - } - default: - GST_WARNING_OBJECT (parse, "unexpected parse state (%d)", - parse->state); - ret = GST_FLOW_UNEXPECTED; - goto beach; - } - } else { /* Continue searching */ - parse->offset++; - } - } - -beach: - return ret; -} - -static GstFlowReturn -gst_mpeg4vparse_chain (GstPad * pad, GstBuffer * buffer) -{ - GstMpeg4VParse *parse = GST_MPEG4VIDEOPARSE (gst_pad_get_parent (pad)); - GstFlowReturn ret = GST_FLOW_OK; - - GST_DEBUG_OBJECT (parse, "received buffer of %u bytes with ts %" - GST_TIME_FORMAT " and offset %" G_GINT64_FORMAT, GST_BUFFER_SIZE (buffer), - GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)), - GST_BUFFER_OFFSET (buffer)); - - gst_adapter_push (parse->adapter, buffer); - - /* Drain the accumulated blocks frame per frame */ - ret = gst_mpeg4vparse_drain (parse, buffer); - - gst_object_unref (parse); - - return ret; -} - -static gboolean -gst_mpeg4vparse_sink_setcaps (GstPad * pad, GstCaps * caps) -{ - gboolean res = TRUE; - GstMpeg4VParse *parse = GST_MPEG4VIDEOPARSE (gst_pad_get_parent (pad)); - GstStructure *s; - const GValue *value; - - GST_DEBUG_OBJECT (parse, "setcaps called with %" GST_PTR_FORMAT, caps); - parse->sink_caps = gst_caps_ref (caps); - - s = gst_caps_get_structure (caps, 0); - - if ((value = gst_structure_get_value (s, "codec_data")) != NULL - && G_VALUE_HOLDS (value, GST_TYPE_BUFFER)) { - GstBuffer *buf = gst_value_get_buffer (value); - - /* Set the config from this codec_data immediately so that in the worst - case, we don't just discard it. - Note that in most cases, this will be freed and overwritten when we - manage to parse the codec_data. */ - if (!parse->config) { - parse->config = gst_buffer_copy (buf); - } - - if (GST_BUFFER_SIZE (buf) < 4) { - GST_WARNING_OBJECT (parse, "codec_data too short, ignoring"); - goto failed_parse; - } else { - const guint8 *data = GST_BUFFER_DATA (buf); - - res = FALSE; - if (data[0] == 0 && data[1] == 0 && data[2] == 1) { - if (data[3] == VOS_STARTCODE) { - /* Usually the codec data will be a visual object sequence, containing - a visual object, with a video object/video object layer. */ - res = gst_mpeg4vparse_handle_vos (parse, data, GST_BUFFER_SIZE (buf)); - } else if (data[3] <= VIDEO_OBJECT_STARTCODE_MAX) { - /* VIDEO_OBJECT_STARTCODE_MIN is zero, and data is unsigned, so we - don't need to check min (and in fact that causes a compile err */ - /* Sometimes, instead, it'll just have the video object/video object - layer data. We can parse that too, though it'll give us slightly - less information. */ - res = gst_mpeg4vparse_handle_vo (parse, data, GST_BUFFER_SIZE (buf), - FALSE); - } - if (!res) - goto failed_parse; - } else { - GST_WARNING_OBJECT (parse, - "codec_data does not begin with start code, invalid"); - goto failed_parse; - } - } - } else { - /* No codec data; treat the same a failed codec data */ - goto failed_parse; - } - -done: - gst_object_unref (parse); - return res; - -failed_parse: - /* No codec data, or obviously-invalid, so set minimal new caps. - VOS parsing later will (hopefully) fill in the other fields */ - res = gst_mpeg4vparse_set_new_caps (parse, 0, 0, 0, 0, 0, 0); - goto done; -} - -static gboolean -gst_mpeg4vparse_sink_event (GstPad * pad, GstEvent * event) -{ - gboolean res = TRUE; - GstMpeg4VParse *parse = GST_MPEG4VIDEOPARSE (gst_pad_get_parent (pad)); - - GST_DEBUG_OBJECT (parse, "handling event type %s", - GST_EVENT_TYPE_NAME (event)); - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_FLUSH_STOP: - parse->last_report = GST_CLOCK_TIME_NONE; - gst_adapter_clear (parse->adapter); - parse->state = PARSE_NEED_START; - parse->offset = 0; - break; - case GST_EVENT_EOS: - if (parse->pending_segment != NULL) { - /* Send pending newsegment before EOS */ - gst_pad_push_event (parse->srcpad, parse->pending_segment); - parse->pending_segment = NULL; - } - if (parse->state == PARSE_VOP_FOUND) { - /* If we've found the start of the VOP assume what's left in the - * adapter is the complete VOP. This might cause us to send an - * incomplete VOP out, but prevents the last video frame from - * potentially being dropped */ - gst_mpeg4vparse_push (parse, gst_adapter_available (parse->adapter)); - } - /* fallthrough */ - case GST_EVENT_FLUSH_START: - res = gst_pad_event_default (pad, event); - break; - case GST_EVENT_NEWSEGMENT: - gst_event_replace (&parse->pending_segment, event); - gst_event_unref (event); - res = TRUE; - break; - default: - if (G_UNLIKELY (!parse->have_src_caps || parse->pending_segment)) { - /* We don't yet have enough data to set caps on the srcpad, so collect - * non-critical events till we do */ - parse->pending_events = g_list_append (parse->pending_events, event); - res = TRUE; - } else - res = gst_pad_event_default (pad, event); - break; - } - - gst_object_unref (parse); - - return res; -} - -static gboolean -gst_mpeg4vparse_src_query (GstPad * pad, GstQuery * query) -{ - GstMpeg4VParse *parse = GST_MPEG4VIDEOPARSE (gst_pad_get_parent (pad)); - gboolean res; - - 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; - - if ((res = gst_pad_peer_query (parse->sinkpad, query))) { - gst_query_parse_latency (query, &us_live, &min_latency, &max_latency); - - GST_DEBUG_OBJECT (parse, "Peer latency: min %" - GST_TIME_FORMAT " max %" GST_TIME_FORMAT, - GST_TIME_ARGS (min_latency), GST_TIME_ARGS (max_latency)); - - /* our latency is 1 frame, find the frame duration */ - our_latency = parse->frame_duration; - - GST_DEBUG_OBJECT (parse, "Our latency: %" GST_TIME_FORMAT, - GST_TIME_ARGS (our_latency)); - - /* we add some latency */ - min_latency += our_latency; - if (max_latency != -1) - max_latency += our_latency; - - GST_DEBUG_OBJECT (parse, "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, us_live, min_latency, max_latency); - } - break; - } - default: - res = gst_pad_peer_query (parse->sinkpad, query); - break; - } - gst_object_unref (parse); - - return res; -} - -static void -gst_mpeg4vparse_cleanup (GstMpeg4VParse * parse) -{ - if (parse->sink_caps) { - gst_caps_unref (parse->sink_caps); - parse->sink_caps = NULL; - } - if (parse->adapter) { - gst_adapter_clear (parse->adapter); - } - if (parse->config != NULL) { - gst_buffer_unref (parse->config); - parse->config = NULL; - } - - if (parse->pending_segment) - gst_event_unref (parse->pending_segment); - parse->pending_segment = NULL; - - g_list_foreach (parse->pending_events, (GFunc) gst_event_unref, NULL); - g_list_free (parse->pending_events); - parse->pending_events = NULL; - - parse->have_src_caps = FALSE; - - parse->state = PARSE_NEED_START; - parse->have_config = FALSE; - parse->offset = 0; - parse->last_report = GST_CLOCK_TIME_NONE; -} - -static GstStateChangeReturn -gst_mpeg4vparse_change_state (GstElement * element, GstStateChange transition) -{ - GstMpeg4VParse *parse = GST_MPEG4VIDEOPARSE (element); - - GstStateChangeReturn ret; - - ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - - switch (transition) { - case GST_STATE_CHANGE_PAUSED_TO_READY: - gst_mpeg4vparse_cleanup (parse); - break; - default: - break; - } - return ret; -} - -static void -gst_mpeg4vparse_finalize (GObject * object) -{ - GstMpeg4VParse *parse = GST_MPEG4VIDEOPARSE (object); - - gst_mpeg4vparse_cleanup (parse); - - if (parse->adapter) { - g_object_unref (parse->adapter); - parse->adapter = NULL; - } - - GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object)); -} +GST_BOILERPLATE (GstMpeg4VParse, gst_mpeg4vparse, GstBaseParse, + GST_TYPE_BASE_PARSE); + +static gboolean gst_mpeg4vparse_start (GstBaseParse * parse); +static gboolean gst_mpeg4vparse_stop (GstBaseParse * parse); +static gboolean gst_mpeg4vparse_check_valid_frame (GstBaseParse * parse, + GstBaseParseFrame * frame, guint * framesize, gint * skipsize); +static GstFlowReturn gst_mpeg4vparse_parse_frame (GstBaseParse * parse, + GstBaseParseFrame * frame); +static GstFlowReturn gst_mpeg4vparse_pre_push_frame (GstBaseParse * parse, + GstBaseParseFrame * frame); +static gboolean gst_mpeg4vparse_set_caps (GstBaseParse * parse, GstCaps * caps); + +static void gst_mpeg4vparse_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec); +static void gst_mpeg4vparse_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec); static void gst_mpeg4vparse_base_init (gpointer klass) @@ -1021,15 +134,11 @@ gst_mpeg4vparse_get_property (GObject * object, guint property_id, static void gst_mpeg4vparse_class_init (GstMpeg4VParseClass * klass) { - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - gstelement_class = (GstElementClass *) klass; - gobject_class = G_OBJECT_CLASS (klass); + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GstBaseParseClass *parse_class = GST_BASE_PARSE_CLASS (klass); parent_class = g_type_class_peek_parent (klass); - gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_mpeg4vparse_finalize); - gobject_class->set_property = gst_mpeg4vparse_set_property; gobject_class->get_property = gst_mpeg4vparse_get_property; @@ -1047,34 +156,453 @@ gst_mpeg4vparse_class_init (GstMpeg4VParseClass * klass) 0, 3600, DEFAULT_CONFIG_INTERVAL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - gstelement_class->change_state = - GST_DEBUG_FUNCPTR (gst_mpeg4vparse_change_state); + /* Override BaseParse vfuncs */ + parse_class->start = GST_DEBUG_FUNCPTR (gst_mpeg4vparse_start); + parse_class->stop = GST_DEBUG_FUNCPTR (gst_mpeg4vparse_stop); + parse_class->check_valid_frame = + GST_DEBUG_FUNCPTR (gst_mpeg4vparse_check_valid_frame); + parse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_mpeg4vparse_parse_frame); + parse_class->pre_push_frame = + GST_DEBUG_FUNCPTR (gst_mpeg4vparse_pre_push_frame); + parse_class->set_sink_caps = GST_DEBUG_FUNCPTR (gst_mpeg4vparse_set_caps); } static void gst_mpeg4vparse_init (GstMpeg4VParse * parse, GstMpeg4VParseClass * g_class) { - parse->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink"); - gst_pad_set_chain_function (parse->sinkpad, - GST_DEBUG_FUNCPTR (gst_mpeg4vparse_chain)); - gst_pad_set_event_function (parse->sinkpad, - GST_DEBUG_FUNCPTR (gst_mpeg4vparse_sink_event)); - gst_pad_set_setcaps_function (parse->sinkpad, - GST_DEBUG_FUNCPTR (gst_mpeg4vparse_sink_setcaps)); - gst_element_add_pad (GST_ELEMENT (parse), parse->sinkpad); - - parse->srcpad = gst_pad_new_from_static_template (&src_template, "src"); - gst_pad_set_query_function (parse->srcpad, - GST_DEBUG_FUNCPTR (gst_mpeg4vparse_src_query)); - gst_pad_use_fixed_caps (parse->srcpad); - gst_element_add_pad (GST_ELEMENT (parse), parse->srcpad); - - parse->adapter = gst_adapter_new (); - parse->interval = DEFAULT_CONFIG_INTERVAL; parse->last_report = GST_CLOCK_TIME_NONE; +} - gst_mpeg4vparse_cleanup (parse); +static void +gst_mpeg4vparse_reset_frame (GstMpeg4VParse * mp4vparse) +{ + /* done parsing; reset state */ + mp4vparse->last_sc = -1; + mp4vparse->vop_offset = -1; + mp4vparse->vos_offset = -1; + mp4vparse->vo_offset = -1; +} + +static void +gst_mpeg4vparse_reset (GstMpeg4VParse * mp4vparse) +{ + gst_mpeg4vparse_reset_frame (mp4vparse); + mp4vparse->profile = 0; + mp4vparse->update_caps = TRUE; + + gst_buffer_replace (&mp4vparse->config, NULL); + memset (&mp4vparse->params, 0, sizeof (mp4vparse->params)); +} + +static gboolean +gst_mpeg4vparse_start (GstBaseParse * parse) +{ + GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEOPARSE (parse); + + GST_DEBUG_OBJECT (parse, "start"); + + gst_mpeg4vparse_reset (mp4vparse); + /* at least this much for a valid frame */ + gst_base_parse_set_min_frame_size (parse, 6); + + return TRUE; +} + +static gboolean +gst_mpeg4vparse_stop (GstBaseParse * parse) +{ + GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEOPARSE (parse); + + GST_DEBUG_OBJECT (parse, "stop"); + + gst_mpeg4vparse_reset (mp4vparse); + + return TRUE; +} + +static gboolean +gst_mpeg4vparse_process_config (GstMpeg4VParse * mp4vparse, const guint8 * data, + gsize size) +{ + /* only do stuff if something new */ + if (mp4vparse->config && size == GST_BUFFER_SIZE (mp4vparse->config) && + memcmp (GST_BUFFER_DATA (mp4vparse->config), data, size) == 0) + return TRUE; + + if (!gst_mpeg4_params_parse_config (&mp4vparse->params, data, size)) { + GST_DEBUG_OBJECT (mp4vparse, "failed to parse config data (size %" + G_GSSIZE_FORMAT ")", size); + return FALSE; + } + + GST_LOG_OBJECT (mp4vparse, "accepting parsed config size %" G_GSSIZE_FORMAT, + size); + + /* parsing ok, so accept it as new config */ + if (mp4vparse->config != NULL) + gst_buffer_unref (mp4vparse->config); + + mp4vparse->config = gst_buffer_new_and_alloc (size); + memcpy (GST_BUFFER_DATA (mp4vparse->config), data, size); + + /* trigger src caps update */ + mp4vparse->update_caps = TRUE; + + return TRUE; +} + +/* caller guarantees at least start code in @buf at @off */ +static gboolean +gst_mpeg4vparse_process_sc (GstMpeg4VParse * mp4vparse, GstBuffer * buf, + gint off) +{ + guint8 *data; + guint code; + + g_return_val_if_fail (buf && GST_BUFFER_SIZE (buf) >= off + 4, FALSE); + + data = GST_BUFFER_DATA (buf); + code = data[off + 3]; + + GST_LOG_OBJECT (mp4vparse, "process startcode %x", code); + + /* if we found a VOP, next start code ends it, + * except for final VOS end sequence code included in last VOP-frame */ + if (mp4vparse->vop_offset >= 0 && code != MPEG4_VOS_ENDCODE) { + if (G_LIKELY (GST_BUFFER_SIZE (buf) > mp4vparse->vop_offset + 4)) { + mp4vparse->intra_frame = + ((data[mp4vparse->vop_offset + 4] >> 6 & 0x3) == 0); + } else { + GST_WARNING_OBJECT (mp4vparse, "no data following VOP startcode"); + mp4vparse->intra_frame = FALSE; + } + GST_LOG_OBJECT (mp4vparse, "ending frame of size %d, is intra %d", off, + mp4vparse->intra_frame); + return TRUE; + } + + switch (code) { + case MPEG4_VOP_STARTCODE: + case MPEG4_GOP_STARTCODE: + { + gint offset; + + if (code == MPEG4_VOP_STARTCODE) { + GST_LOG_OBJECT (mp4vparse, "startcode is VOP"); + mp4vparse->vop_offset = off; + } else { + GST_LOG_OBJECT (mp4vparse, "startcode is GOP"); + } + /* parse config data ending here if proper startcodes found earlier; + * preferably start at VOS (visual object sequence), + * otherwise at VO (video object) */ + offset = mp4vparse->vos_offset >= 0 ? + mp4vparse->vos_offset : mp4vparse->vo_offset; + if (offset >= 0) { + gst_mpeg4vparse_process_config (mp4vparse, GST_BUFFER_DATA (buf), off); + /* avoid accepting again for a VOP sc following a GOP sc */ + mp4vparse->vos_offset = -1; + mp4vparse->vo_offset = -1; + } + break; + } + case MPEG4_VOS_STARTCODE: + GST_LOG_OBJECT (mp4vparse, "startcode is VOS"); + mp4vparse->vos_offset = off; + break; + default: + /* VO (video object) cases */ + if (code <= 0x1f) { + GST_LOG_OBJECT (mp4vparse, "startcode is VO"); + mp4vparse->vo_offset = off; + } + break; + } + + /* at least need to have a VOP in a frame */ + return FALSE; +} + +/* FIXME move into baseparse, or anything equivalent; + * see https://bugzilla.gnome.org/show_bug.cgi?id=650093 */ +#define GST_BASE_PARSE_FRAME_FLAG_PARSING 0x10000 + +static gboolean +gst_mpeg4vparse_check_valid_frame (GstBaseParse * parse, + GstBaseParseFrame * frame, guint * framesize, gint * skipsize) +{ + GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEOPARSE (parse); + GstBuffer *buf = frame->buffer; + GstByteReader reader = GST_BYTE_READER_INIT_FROM_BUFFER (buf); + gint off = 0; + gboolean ret; + guint code; + +retry: + /* at least start code and subsequent byte */ + if (G_UNLIKELY (GST_BUFFER_SIZE (buf) - off < 5)) + return FALSE; + + /* avoid stale cached parsing state */ + if (!(frame->flags & GST_BASE_PARSE_FRAME_FLAG_PARSING)) { + GST_LOG_OBJECT (mp4vparse, "parsing new frame"); + gst_mpeg4vparse_reset_frame (mp4vparse); + frame->flags |= GST_BASE_PARSE_FRAME_FLAG_PARSING; + } else { + GST_LOG_OBJECT (mp4vparse, "resuming frame parsing"); + } + + /* if already found a previous start code, e.g. start of frame, go for next */ + if (mp4vparse->last_sc >= 0) { + off = mp4vparse->last_sc; + goto next; + } + + off = gst_byte_reader_masked_scan_uint32 (&reader, 0xffffff00, 0x00000100, + off, GST_BUFFER_SIZE (buf) - off); + + GST_LOG_OBJECT (mp4vparse, "possible sync at buffer offset %d", off); + + /* didn't find anything that looks like a sync word, skip */ + if (G_UNLIKELY (off < 0)) { + *skipsize = GST_BUFFER_SIZE (buf) - 3; + return FALSE; + } + + /* possible frame header, but not at offset 0? skip bytes before sync */ + if (G_UNLIKELY (off > 0)) { + *skipsize = off; + return FALSE; + } + + /* ensure start code looks like a real starting start code */ + code = GST_BUFFER_DATA (buf)[3]; + switch (code) { + case MPEG4_VOP_STARTCODE: + case MPEG4_VOS_STARTCODE: + case MPEG4_GOP_STARTCODE: + break; + default: + if (code <= 0x1f) + break; + /* undesirable sc */ + GST_LOG_OBJECT (mp4vparse, "start code is no VOS, VO, VOP or GOP"); + off++; + goto retry; + } + + /* found sc */ + mp4vparse->last_sc = 0; + + /* examine start code, which should not end frame at present */ + gst_mpeg4vparse_process_sc (mp4vparse, buf, 0); + +next: + /* start is fine as of now */ + *skipsize = 0; + /* position a bit further than last sc */ + off++; + /* so now we have start code at start of data; locate next start code */ + off = gst_byte_reader_masked_scan_uint32 (&reader, 0xffffff00, 0x00000100, + off, GST_BUFFER_SIZE (buf) - off); + + GST_LOG_OBJECT (mp4vparse, "next start code at %d", off); + if (off < 0) { + /* if draining, take all */ + if (GST_BASE_PARSE_DRAINING (parse)) { + off = GST_BUFFER_SIZE (buf); + ret = TRUE; + } else { + /* resume scan where we left it */ + mp4vparse->last_sc = GST_BUFFER_SIZE (buf) - 4; + /* request best next available */ + *framesize = G_MAXUINT; + return FALSE; + } + } else { + /* decide whether this startcode ends a frame */ + ret = gst_mpeg4vparse_process_sc (mp4vparse, buf, off); + } + + if (ret) { + *framesize = off; + } else { + goto next; + } + + return ret; +} + +static void +gst_mpeg4vparse_update_src_caps (GstMpeg4VParse * mp4vparse) +{ + GstCaps *caps = NULL; + + /* only update if no src caps yet or explicitly triggered */ + if (G_LIKELY (GST_PAD_CAPS (GST_BASE_PARSE_SRC_PAD (mp4vparse)) && + !mp4vparse->update_caps)) + return; + + /* carry over input caps as much as possible; override with our own stuff */ + caps = GST_PAD_CAPS (GST_BASE_PARSE_SINK_PAD (mp4vparse)); + if (caps) { + caps = gst_caps_copy (caps); + } else { + caps = gst_caps_new_simple ("video/mpeg", + "mpegversion", G_TYPE_INT, 4, NULL); + } + + gst_caps_set_simple (caps, "systemstream", G_TYPE_BOOLEAN, FALSE, + "parsed", G_TYPE_BOOLEAN, TRUE, NULL); + + if (mp4vparse->profile != 0) { + gchar *profile = NULL; + + /* FIXME does it make sense to expose the profile in the caps ? */ + profile = g_strdup_printf ("%d", mp4vparse->profile); + gst_caps_set_simple (caps, "profile-level-id", + G_TYPE_STRING, profile, NULL); + g_free (profile); + } + + if (mp4vparse->config != NULL) { + gst_caps_set_simple (caps, "codec_data", + GST_TYPE_BUFFER, mp4vparse->config, NULL); + } + + if (mp4vparse->params.width > 0 && mp4vparse->params.height > 0) { + gst_caps_set_simple (caps, "width", G_TYPE_INT, mp4vparse->params.width, + "height", G_TYPE_INT, mp4vparse->params.height, NULL); + } + + /* perhaps we have a framerate */ + if (mp4vparse->params.fixed_time_increment != 0) { + gint fps_num = mp4vparse->params.time_increment_resolution; + gint fps_den = mp4vparse->params.fixed_time_increment; + GstClockTime latency = gst_util_uint64_scale (GST_SECOND, fps_den, fps_num); + + gst_caps_set_simple (caps, "framerate", + GST_TYPE_FRACTION, fps_num, fps_den, NULL); + gst_base_parse_set_frame_rate (GST_BASE_PARSE (mp4vparse), + fps_num, fps_den, 0, 0); + gst_base_parse_set_latency (GST_BASE_PARSE (mp4vparse), latency, latency); + } + + /* or pixel-aspect-ratio */ + if (mp4vparse->params.aspect_ratio_width > 0 && + mp4vparse->params.aspect_ratio_height > 0) { + gst_caps_set_simple (caps, "pixel-aspect-ratio", + GST_TYPE_FRACTION, mp4vparse->params.aspect_ratio_width, + mp4vparse->params.aspect_ratio_height, NULL); + } + + gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (mp4vparse), caps); + gst_caps_unref (caps); +} + +static GstFlowReturn +gst_mpeg4vparse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame) +{ + GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEOPARSE (parse); + GstBuffer *buffer = frame->buffer; + + gst_mpeg4vparse_update_src_caps (mp4vparse); + + if (mp4vparse->intra_frame) + GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DELTA_UNIT); + else + GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT); + + if (G_UNLIKELY (mp4vparse->drop && !mp4vparse->config)) { + GST_DEBUG_OBJECT (mp4vparse, "dropping frame as no config yet"); + return GST_BASE_PARSE_FLOW_DROPPED; + } else + return GST_FLOW_OK; +} + +static GstFlowReturn +gst_mpeg4vparse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame) +{ + GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEOPARSE (parse); + GstBuffer *buffer = frame->buffer; + + /* periodic SPS/PPS sending */ + if (mp4vparse->interval > 0) { + GstClockTime timestamp = GST_BUFFER_TIMESTAMP (buffer); + guint64 diff; + + /* init */ + if (!GST_CLOCK_TIME_IS_VALID (mp4vparse->last_report)) { + mp4vparse->last_report = timestamp; + } + + if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT)) { + if (timestamp > mp4vparse->last_report) + diff = timestamp - mp4vparse->last_report; + else + diff = 0; + + GST_LOG_OBJECT (mp4vparse, + "now %" GST_TIME_FORMAT ", last config %" GST_TIME_FORMAT, + GST_TIME_ARGS (timestamp), GST_TIME_ARGS (mp4vparse->last_report)); + + GST_LOG_OBJECT (mp4vparse, + "interval since last config %" GST_TIME_FORMAT, GST_TIME_ARGS (diff)); + + if (GST_TIME_AS_SECONDS (diff) >= mp4vparse->interval) { + /* we need to send config now first */ + GST_LOG_OBJECT (parse, "inserting config in stream"); + + /* avoid inserting duplicate config */ + if ((GST_BUFFER_SIZE (buffer) < GST_BUFFER_SIZE (mp4vparse->config)) || + memcmp (GST_BUFFER_DATA (buffer), + GST_BUFFER_DATA (mp4vparse->config), + GST_BUFFER_SIZE (mp4vparse->config))) { + GstBuffer *superbuf; + + /* insert header */ + superbuf = gst_buffer_merge (mp4vparse->config, buffer); + gst_buffer_copy_metadata (superbuf, buffer, GST_BUFFER_COPY_ALL); + gst_buffer_replace (&frame->buffer, superbuf); + gst_buffer_unref (superbuf); + } else { + GST_LOG_OBJECT (parse, "... but avoiding duplication"); + } + + if (G_UNLIKELY (timestamp != -1)) { + mp4vparse->last_report = timestamp; + } + } + } + } + + return GST_FLOW_OK; +} + +static gboolean +gst_mpeg4vparse_set_caps (GstBaseParse * parse, GstCaps * caps) +{ + GstMpeg4VParse *mp4vparse = GST_MPEG4VIDEOPARSE (parse); + GstStructure *s; + const GValue *value; + GstBuffer *buf; + + GST_DEBUG_OBJECT (parse, "setcaps called with %" GST_PTR_FORMAT, caps); + + s = gst_caps_get_structure (caps, 0); + + if ((value = gst_structure_get_value (s, "codec_data")) != NULL + && (buf = gst_value_get_buffer (value))) { + /* best possible parse attempt, + * src caps are based on sink caps so it will end up in there + * whether sucessful or not */ + gst_mpeg4vparse_process_config (mp4vparse, GST_BUFFER_DATA (buf), + GST_BUFFER_SIZE (buf)); + } + + /* let's not interfere and accept regardless of config parsing success */ + return TRUE; } static gboolean diff --git a/gst/mpeg4videoparse/mpeg4videoparse.h b/gst/mpeg4videoparse/mpeg4videoparse.h index 29f7fa1834..05d81e8a9f 100644 --- a/gst/mpeg4videoparse/mpeg4videoparse.h +++ b/gst/mpeg4videoparse/mpeg4videoparse.h @@ -21,7 +21,9 @@ #define __MPEG4VIDEOPARSE_H__ #include -#include +#include + +#include "mpeg4parse.h" G_BEGIN_DECLS @@ -40,47 +42,30 @@ G_BEGIN_DECLS typedef struct _GstMpeg4VParse GstMpeg4VParse; typedef struct _GstMpeg4VParseClass GstMpeg4VParseClass; -typedef enum { - PARSE_NEED_START, - PARSE_START_FOUND, - PARSE_VO_FOUND, - PARSE_VOS_FOUND, - PARSE_VOP_FOUND -} GstMpeg4VParseState; - struct _GstMpeg4VParse { - GstElement element; + GstBaseParse element; - GstPad * sinkpad; - GstPad * srcpad; - - GstCaps *sink_caps; - - guint interval; GstClockTime last_report; - GstAdapter * adapter; - guint offset; - guint vos_offset; + /* parse state */ + gint last_sc; + gint vop_offset; + gint vos_offset; + gint vo_offset; gboolean intra_frame; - - GstMpeg4VParseState state; - GstClockTime timestamp; + gboolean update_caps; GstBuffer *config; - gboolean have_config; guint8 profile; - GstClockTime frame_duration; + MPEG4Params params; + /* properties */ gboolean drop; - - gboolean have_src_caps; - GstEvent *pending_segment; - GList *pending_events; + guint interval; }; struct _GstMpeg4VParseClass { - GstElementClass parent_class; + GstBaseParseClass parent_class; }; GType gst_mpeg4vparse_get_type (void); diff --git a/gst/mpegdemux/Makefile.am b/gst/mpegdemux/Makefile.am index 3737017f70..3c9cf844b7 100644 --- a/gst/mpegdemux/Makefile.am +++ b/gst/mpegdemux/Makefile.am @@ -35,3 +35,16 @@ noinst_HEADERS = \ mpegtspacketizer.h \ mpegtsparse.h +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstmpegdemux -:SHARED libgstmpegdemux \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstmpegdemux_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstmpegdemux_la_CFLAGS) \ + -:LDFLAGS $(libgstmpegdemux_la_LDFLAGS) \ + $(libgstmpegdemux_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/mpegdemux/gstmpegdefs.h b/gst/mpegdemux/gstmpegdefs.h index 05320ecb16..a34af53a2d 100644 --- a/gst/mpegdemux/gstmpegdefs.h +++ b/gst/mpegdemux/gstmpegdefs.h @@ -159,7 +159,9 @@ #define ST_H222_1 0x09 /* later extensions */ -#define ST_AUDIO_AAC 0x0f +#define ST_AUDIO_AAC_ADTS 0x0f +/* LATM/LOAS AAC syntax */ +#define ST_AUDIO_AAC_LOAS 0x11 #define ST_VIDEO_MPEG4 0x10 #define ST_VIDEO_H264 0x1b diff --git a/gst/mpegdemux/gstmpegdemux.c b/gst/mpegdemux/gstmpegdemux.c index d5aa6f5804..205d381d5a 100644 --- a/gst/mpegdemux/gstmpegdemux.c +++ b/gst/mpegdemux/gstmpegdemux.c @@ -350,11 +350,19 @@ gst_flups_demux_create_stream (GstFluPSDemux * demux, gint id, gint stream_type) case ST_MHEG: case ST_DSMCC: break; - case ST_AUDIO_AAC: + case ST_AUDIO_AAC_ADTS: template = klass->audio_template; name = g_strdup_printf ("audio_%02x", id); caps = gst_caps_new_simple ("audio/mpeg", - "mpegversion", G_TYPE_INT, 4, NULL); + "mpegversion", G_TYPE_INT, 4, + "stream-format", G_TYPE_STRING, "adts", NULL); + break; + case ST_AUDIO_AAC_LOAS: // LATM/LOAS AAC syntax + template = klass->audio_template; + name = g_strdup_printf ("audio_%02x", id); + caps = gst_caps_new_simple ("audio/mpeg", + "mpegversion", G_TYPE_INT, 4, + "stream-format", G_TYPE_STRING, "loas", NULL); break; case ST_VIDEO_H264: template = klass->video_template; @@ -626,7 +634,7 @@ gst_flups_demux_handle_dvd_event (GstFluPSDemux * demux, GstEvent * event) const char *type = gst_structure_get_string (structure, "event"); gint i; gchar cur_stream_name[32]; - GstFluPSStream *temp; + GstFluPSStream *temp G_GNUC_UNUSED; if (strcmp (type, "dvd-lang-codes") == 0) { GstEvent **p_ev; @@ -639,7 +647,7 @@ gst_flups_demux_handle_dvd_event (GstFluPSDemux * demux, GstEvent * event) GST_DEBUG_OBJECT (demux, "Handling language codes event"); /* Create a video pad to ensure have it before emit no more pads */ - temp = gst_flups_demux_get_stream (demux, 0xe0, ST_VIDEO_MPEG2); + (void) gst_flups_demux_get_stream (demux, 0xe0, ST_VIDEO_MPEG2); /* Read out the languages for audio streams and request each one that * is present */ @@ -1066,7 +1074,7 @@ gst_flups_demux_handle_seek_pull (GstFluPSDemux * demux, GstEvent * event) GstSeekType start_type, stop_type; gint64 start, stop; gdouble rate; - gboolean update, flush, keyframe; + gboolean update, flush; GstSegment seeksegment; GstClockTime first_pts = MPEGTIME_TO_GSTTIME (demux->first_pts); @@ -1084,7 +1092,7 @@ gst_flups_demux_handle_seek_pull (GstFluPSDemux * demux, GstEvent * event) goto no_scr_rate; flush = flags & GST_SEEK_FLAG_FLUSH; - keyframe = flags & GST_SEEK_FLAG_KEY_UNIT; + /* keyframe = flags & GST_SEEK_FLAG_KEY_UNIT; *//* FIXME */ if (flush) { /* Flush start up and downstream to make sure data flow and loops are diff --git a/gst/mpegdemux/gstmpegtsdemux.c b/gst/mpegdemux/gstmpegtsdemux.c index cb0d89c912..986914d0c9 100644 --- a/gst/mpegdemux/gstmpegtsdemux.c +++ b/gst/mpegdemux/gstmpegtsdemux.c @@ -110,7 +110,8 @@ enum "video/mpeg, " \ "mpegversion = (int) { 1, 2, 4 }, " \ "systemstream = (boolean) FALSE; " \ - "video/x-h264;" \ + "video/x-h264,stream-format=(string)byte-stream," \ + "alignment=(string)nal;" \ "video/x-dirac;" \ "video/x-wmv," \ "wmvversion = (int) 3, " \ @@ -365,16 +366,9 @@ gst_mpegts_demux_reset (GstMpegTSDemux * demux) if (stream->PAT.entries) g_array_free (stream->PAT.entries, TRUE); - switch (stream->PID_type) { - case PID_TYPE_ELEMENTARY: - gst_pes_filter_uninit (&stream->filter); - break; - case PID_TYPE_PROGRAM_ASSOCIATION: - case PID_TYPE_CONDITIONAL_ACCESS: - case PID_TYPE_PROGRAM_MAP: - gst_section_filter_uninit (&stream->section_filter); - break; - } + gst_pes_filter_uninit (&stream->filter); + gst_section_filter_uninit (&stream->section_filter); + if (stream->pes_buffer) { gst_buffer_unref (stream->pes_buffer); stream->pes_buffer = NULL; @@ -688,11 +682,19 @@ gst_mpegts_demux_fill_stream (GstMpegTSStream * stream, guint8 id, case ST_MHEG: case ST_DSMCC: break; - case ST_AUDIO_AAC: + case ST_AUDIO_AAC_ADTS: template = klass->audio_template; name = g_strdup_printf ("audio_%04x", stream->PID); caps = gst_caps_new_simple ("audio/mpeg", - "mpegversion", G_TYPE_INT, 4, NULL); + "mpegversion", G_TYPE_INT, 4, + "stream-format", G_TYPE_STRING, "adts", NULL); + break; + case ST_AUDIO_AAC_LOAS: // LATM/LOAS AAC syntax + template = klass->audio_template; + name = g_strdup_printf ("audio_%04x", stream->PID); + caps = gst_caps_new_simple ("audio/mpeg", + "mpegversion", G_TYPE_INT, 4, + "stream-format", G_TYPE_STRING, "loas", NULL); break; case ST_VIDEO_MPEG4: template = klass->video_template; @@ -704,7 +706,9 @@ gst_mpegts_demux_fill_stream (GstMpegTSStream * stream, guint8 id, case ST_VIDEO_H264: template = klass->video_template; name = g_strdup_printf ("video_%04x", stream->PID); - caps = gst_caps_new_simple ("video/x-h264", NULL); + caps = gst_caps_new_simple ("video/x-h264", + "stream-format", G_TYPE_STRING, "byte-stream", + "alignment", G_TYPE_STRING, "nal", NULL); break; case ST_VIDEO_DIRAC: if (gst_mpegts_is_dirac_stream (stream)) { @@ -1051,8 +1055,8 @@ gst_mpegts_demux_data_cb (GstPESFilter * filter, gboolean first, * to drop. */ if (stream->PMT_pid <= MPEGTS_MAX_PID && demux->streams[stream->PMT_pid] && demux->streams[demux->streams[stream->PMT_pid]->PMT.PCR_PID] - && demux->streams[demux->streams[stream->PMT_pid]->PMT.PCR_PID]-> - discont_PCR) { + && demux->streams[demux->streams[stream->PMT_pid]->PMT. + PCR_PID]->discont_PCR) { GST_WARNING_OBJECT (demux, "middle of discont, dropping"); goto bad_timestamp; } @@ -1074,8 +1078,8 @@ gst_mpegts_demux_data_cb (GstPESFilter * filter, gboolean first, */ if (stream->PMT_pid <= MPEGTS_MAX_PID && demux->streams[stream->PMT_pid] && demux->streams[demux->streams[stream->PMT_pid]->PMT.PCR_PID] - && demux->streams[demux->streams[stream->PMT_pid]->PMT.PCR_PID]-> - last_PCR > 0) { + && demux->streams[demux->streams[stream->PMT_pid]->PMT. + PCR_PID]->last_PCR > 0) { GST_DEBUG_OBJECT (demux, "timestamps wrapped before noticed in PCR"); time = MPEGTIME_TO_GSTTIME (pts) + stream->base_time + MPEGTIME_TO_GSTTIME ((guint64) (1) << 33); @@ -1456,10 +1460,13 @@ gst_mpegts_stream_parse_pmt (GstMpegTSStream * stream, /* not really an ES, so use section filter not pes filter */ /* initialise section filter */ GstCaps *caps; + gchar name[13]; + + g_snprintf (name, sizeof (name), "private_%04x", entry.PID); gst_section_filter_init (&ES_stream->section_filter); ES_stream->PID_type = PID_TYPE_PRIVATE_SECTION; ES_stream->pad = gst_pad_new_from_static_template (&private_template, - g_strdup_printf ("private_%04x", entry.PID)); + name); gst_pad_set_active (ES_stream->pad, TRUE); caps = gst_caps_new_simple ("application/x-mpegts-private-section", NULL); @@ -2246,11 +2253,11 @@ gst_mpegts_demux_parse_stream (GstMpegTSDemux * demux, GstMpegTSStream * stream, const guint8 * in_data, guint in_size) { GstFlowReturn ret; - gboolean transport_error_indicator; + gboolean transport_error_indicator G_GNUC_UNUSED; + gboolean transport_priority G_GNUC_UNUSED; gboolean payload_unit_start_indicator; - gboolean transport_priority; guint16 PID; - guint8 transport_scrambling_control; + guint8 transport_scrambling_control G_GNUC_UNUSED; guint8 adaptation_field_control; guint8 continuity_counter; const guint8 *data = in_data; diff --git a/gst/mpegdemux/gstpesfilter.c b/gst/mpegdemux/gstpesfilter.c index 736d4960b6..18d503608c 100644 --- a/gst/mpegdemux/gstpesfilter.c +++ b/gst/mpegdemux/gstpesfilter.c @@ -112,7 +112,7 @@ gst_pes_filter_parse (GstPESFilter * filter) GstFlowReturn ret; guint32 start_code; - gboolean STD_buffer_bound_scale; + gboolean STD_buffer_bound_scale G_GNUC_UNUSED; guint16 STD_buffer_size_bound; const guint8 *data; gint avail, datalen; diff --git a/gst/mpegdemux/mpegtspacketizer.c b/gst/mpegdemux/mpegtspacketizer.c index a86ef0e810..94ffd9472d 100644 --- a/gst/mpegdemux/mpegtspacketizer.c +++ b/gst/mpegdemux/mpegtspacketizer.c @@ -356,7 +356,8 @@ mpegts_packetizer_parse_descriptors (MpegTSPacketizer * packetizer, /* include tag and length */ desc = g_string_new_len ((gchar *) data - 2, length + 2); data += length; - /* G_TYPE_GSTING is a GBoxed type and is used so properly marshalled from python */ + /* G_TYPE_GSTRING is a GBoxed type and is used so properly marshalled from + * python (FIXME: should either be G_TYPE_STRING or GST_TYPE_BUFFFER) */ g_value_init (&value, G_TYPE_GSTRING); g_value_take_boxed (&value, desc); g_value_array_append (descriptors, &value); @@ -1646,8 +1647,8 @@ mpegts_packetizer_parse_eit (MpegTSPacketizer * packetizer, DESC_LENGTH (event_descriptor)) { eventname_tmp = - get_encoding_and_convert (eventname, eventname_length), - eventdescription_tmp = + get_encoding_and_convert (eventname, eventname_length); + eventdescription_tmp = get_encoding_and_convert (eventdescription, eventdescription_length); @@ -2360,24 +2361,9 @@ get_encoding (const gchar * text, guint * start_text, gboolean * is_multibyte) firstbyte = (guint8) text[0]; - if (firstbyte == 0x01) { - encoding = g_strdup ("iso8859-5"); - *start_text = 1; - *is_multibyte = FALSE; - } else if (firstbyte == 0x02) { - encoding = g_strdup ("iso8859-6"); - *start_text = 1; - *is_multibyte = FALSE; - } else if (firstbyte == 0x03) { - encoding = g_strdup ("iso8859-7"); - *start_text = 1; - *is_multibyte = FALSE; - } else if (firstbyte == 0x04) { - encoding = g_strdup ("iso8859-8"); - *start_text = 1; - *is_multibyte = FALSE; - } else if (firstbyte == 0x05) { - encoding = g_strdup ("iso8859-9"); + /* ETSI EN 300 468, "Selection of character table" */ + if (firstbyte <= 0x0B) { + encoding = g_strdup_printf ("iso8859-%u", firstbyte + 4); *start_text = 1; *is_multibyte = FALSE; } else if (firstbyte >= 0x20) { diff --git a/gst/mpegdemux/mpegtsparse.c b/gst/mpegdemux/mpegtsparse.c index f472c2251b..0d489bb617 100644 --- a/gst/mpegdemux/mpegtsparse.c +++ b/gst/mpegdemux/mpegtsparse.c @@ -874,6 +874,8 @@ mpegts_parse_is_psi (MpegTSParse * parse, MpegTSPacketizerPacket * packet) { gboolean retval = FALSE; guint8 table_id; + guint8 *data; + guint8 pointer; int i; static const guint8 si_tables[] = { 0x00, 0x01, 0x02, 0x03, 0x40, 0x41, 0x42, 0x46, 0x4A, 0x4E, 0x4F, 0x50, @@ -891,7 +893,10 @@ mpegts_parse_is_psi (MpegTSParse * parse, MpegTSPacketizerPacket * packet) return FALSE; if (!retval) { if (packet->payload_unit_start_indicator) { - table_id = *(packet->data); + data = packet->data; + pointer = *data++; + data += pointer; + table_id = *data; i = 0; while (si_tables[i] != TABLE_ID_UNSET) { if (G_UNLIKELY (si_tables[i] == table_id)) { diff --git a/gst/mpegpsmux/Makefile.am b/gst/mpegpsmux/Makefile.am index 23bc549723..26ac56cc94 100644 --- a/gst/mpegpsmux/Makefile.am +++ b/gst/mpegpsmux/Makefile.am @@ -21,3 +21,17 @@ noinst_HEADERS = \ mpegpsmux_h264.h \ bits.h \ crc.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstmpegpsmux -:SHARED libgstmpegpsmux \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstmpegpsmux_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstmpegpsmux_la_CFLAGS) \ + -:LDFLAGS $(libgstmpegpsmux_la_LDFLAGS) \ + $(libgstmpegpsmux_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/mpegtsdemux/Makefile.am b/gst/mpegtsdemux/Makefile.am index d3d2c3ed53..7d3e663256 100644 --- a/gst/mpegtsdemux/Makefile.am +++ b/gst/mpegtsdemux/Makefile.am @@ -6,6 +6,7 @@ libgstmpegtsdemux_la_SOURCES = \ mpegtsbase.c \ mpegtspacketizer.c \ mpegtsparse.c \ + payload_parsers.c \ tsdemux.c libgstmpegtsdemux_la_CFLAGS = \ @@ -23,5 +24,19 @@ noinst_HEADERS = \ mpegtsbase.h \ mpegtspacketizer.h \ mpegtsparse.h \ + payload_parsers.h \ tsdemux.h +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstmpegtsdemux -:SHARED libgstmpegtsdemux \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstmpegtsdemux_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstmpegtsdemux_la_CFLAGS) \ + -:LDFLAGS $(libgstmpegtsdemux_la_LDFLAGS) \ + $(libgstmpegtsdemux_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/mpegtsdemux/gstmpegdefs.h b/gst/mpegtsdemux/gstmpegdefs.h index 268234f25c..60ab5800a1 100644 --- a/gst/mpegtsdemux/gstmpegdefs.h +++ b/gst/mpegtsdemux/gstmpegdefs.h @@ -141,6 +141,11 @@ #define ST_DSMCC 0x08 #define ST_H222_1 0x09 +#define ST_DSMCC_A 0x0a +#define ST_DSMCC_B 0x0b +#define ST_DSMCC_C 0x0c +#define ST_DSMCC_D 0x0d + /* later extensions */ #define ST_AUDIO_AAC 0x0f #define ST_VIDEO_MPEG4 0x10 diff --git a/gst/mpegtsdemux/mpegtsbase.c b/gst/mpegtsdemux/mpegtsbase.c index 8eb89bff2b..866f0d4ccd 100644 --- a/gst/mpegtsdemux/mpegtsbase.c +++ b/gst/mpegtsdemux/mpegtsbase.c @@ -31,6 +31,8 @@ #include #include +#include + #include #include "mpegtsbase.h" #include "gstmpegdesc.h" @@ -187,6 +189,8 @@ mpegts_base_class_init (MpegTSBaseClass * klass) static void mpegts_base_reset (MpegTSBase * base) { + MpegTSBaseClass *klass = GST_MPEGTS_BASE_GET_CLASS (base); + mpegts_packetizer_clear (base->packetizer); memset (base->is_pes, 0, 8192); memset (base->known_psi, 0, 8192); @@ -206,6 +210,8 @@ mpegts_base_reset (MpegTSBase * base) /* base->pat = NULL; */ /* pmt pids will be added and removed dynamically */ + if (klass->reset) + klass->reset (base); } static void @@ -307,11 +313,13 @@ mpegts_get_descriptor_from_stream (MpegTSBaseStream * stream, guint8 tag) if (descriptors) { for (i = 0; i < descriptors->n_values; i++) { GValue *value = g_value_array_get_nth (descriptors, i); - guint8 *desc = g_value_dup_boxed (value); - if (DESC_TAG (desc) == tag) { - retval = desc; + GString *desc = g_value_dup_boxed (value); + if (DESC_TAG (desc->str) == tag) { + retval = (guint8 *) desc->str; + g_string_free (desc, FALSE); break; - } + } else + g_string_free (desc, FALSE); } g_value_array_free (descriptors); } @@ -427,6 +435,7 @@ mpegts_base_free_program (MpegTSBaseProgram * program) for (i = 0; i < 0x2000; i++) if (program->streams[i]) mpegts_base_free_stream (program->streams[i]); + g_free (program->streams); if (program->tags) gst_tag_list_free (program->tags); @@ -444,7 +453,8 @@ mpegts_base_remove_program (MpegTSBase * base, gint program_number) program = (MpegTSBaseProgram *) g_hash_table_lookup (base->programs, GINT_TO_POINTER (program_number)); - klass->program_stopped (base, program); + if (program) + klass->program_stopped (base, program); } g_hash_table_remove (base->programs, GINT_TO_POINTER (program_number)); @@ -697,6 +707,8 @@ mpegts_base_apply_pmt (MpegTSBase * base, if (G_UNLIKELY (base->first_pat_offset == -1)) { GST_WARNING ("Got pmt without pat first. Returning"); + /* remove the stream since we won't get another PMT otherwise */ + mpegts_packetizer_remove_stream (base->packetizer, pmt_pid); return; } @@ -731,9 +743,9 @@ mpegts_base_apply_pmt (MpegTSBase * base, gst_structure_id_get (stream, QUARK_PID, G_TYPE_UINT, &pid, QUARK_STREAM_TYPE, G_TYPE_UINT, &stream_type, NULL); + base->is_pes[pid] = TRUE; mpegts_base_program_add_stream (base, program, (guint16) pid, (guint8) stream_type, stream); - base->is_pes[pid] = TRUE; } @@ -1007,8 +1019,8 @@ mpegts_base_sink_event (GstPad * pad, GstEvent * event) gst_event_unref (event); res = FALSE; break; - case GST_EVENT_FLUSH_STOP: - mpegts_packetizer_clear (base->packetizer); + case GST_EVENT_FLUSH_START: + mpegts_packetizer_flush (base->packetizer); /* Passthrough */ default: res = GST_MPEGTS_BASE_GET_CLASS (base)->push_event (base, event); @@ -1043,10 +1055,8 @@ mpegts_base_chain (GstPad * pad, GstBuffer * buf) MpegTSPacketizerPacketReturn pret; MpegTSPacketizer2 *packetizer; MpegTSPacketizerPacket packet; - MpegTSBaseClass *klass; base = GST_MPEGTS_BASE (gst_object_get_parent (GST_OBJECT (pad))); - klass = GST_MPEGTS_BASE_GET_CLASS (base); packetizer = base->packetizer; mpegts_packetizer_push (base->packetizer, buf); @@ -1077,10 +1087,11 @@ mpegts_base_chain (GstPad * pad, GstBuffer * buf) /* we need to push section packet downstream */ res = mpegts_base_push (base, &packet, §ion); - } else { + } else if (base->is_pes[packet.pid]) { /* push the packet downstream */ res = mpegts_base_push (base, &packet, NULL); - } + } else + gst_buffer_unref (packet.buffer); next: mpegts_packetizer_clear_packet (base->packetizer, &packet); @@ -1176,6 +1187,9 @@ mpegts_base_loop (MpegTSBase * base) goto error; } break; + case BASE_MODE_PUSHING: + GST_WARNING ("wrong BASE_MODE_PUSHING mode in pull loop"); + break; } return; @@ -1196,6 +1210,104 @@ error: } } + +gboolean +mpegts_base_handle_seek_event (MpegTSBase * base, GstPad * pad, + GstEvent * event) +{ + MpegTSBaseClass *klass = GST_MPEGTS_BASE_GET_CLASS (base); + GstFlowReturn ret = GST_FLOW_ERROR; + gdouble rate; + gboolean flush; + GstFormat format; + GstSeekFlags flags; + GstSeekType start_type, stop_type; + gint64 start, stop; + gchar *pad_name; + guint16 pid = 0; + + gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start, + &stop_type, &stop); + + if (format != GST_FORMAT_TIME) + return FALSE; + + GST_DEBUG ("seek event, rate: %f start: %" GST_TIME_FORMAT + " stop: %" GST_TIME_FORMAT, rate, GST_TIME_ARGS (start), + GST_TIME_ARGS (stop)); + + /* extract the pid from the pad name */ + pad_name = gst_pad_get_name (pad); + if (pad_name) { + gchar *pidstr = g_strrstr (pad_name, "_"); + if (pidstr) { + pidstr++; + pid = g_ascii_strtoull (pidstr, NULL, 16); + } + g_free (pad_name); + } + + flush = flags & GST_SEEK_FLAG_FLUSH; + + if (base->mode == BASE_MODE_PUSHING) { + GST_ERROR ("seeking in push mode not supported"); + goto done; + } + + /* stop streaming, either by flushing or by pausing the task */ + base->mode = BASE_MODE_SEEKING; + if (flush) { + GST_DEBUG_OBJECT (base, "sending flush start"); + gst_pad_push_event (base->sinkpad, gst_event_new_flush_start ()); + GST_MPEGTS_BASE_GET_CLASS (base)->push_event (base, + gst_event_new_flush_start ()); + } else + gst_pad_pause_task (base->sinkpad); + /* wait for streaming to finish */ + GST_PAD_STREAM_LOCK (base->sinkpad); + + if (flush) { + /* send a FLUSH_STOP for the sinkpad, since we need data for seeking */ + GST_DEBUG_OBJECT (base, "sending flush stop"); + gst_pad_push_event (base->sinkpad, gst_event_new_flush_stop ()); + } + + if (flags & (GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_SKIP)) { + GST_WARNING ("seek flags 0x%x are not supported", (int) flags); + goto done; + } + + + if (format == GST_FORMAT_TIME) { + /* If the subclass can seek, do that */ + if (klass->seek) { + ret = klass->seek (base, event, pid); + if (G_UNLIKELY (ret != GST_FLOW_OK)) { + GST_WARNING ("seeking failed %s", gst_flow_get_name (ret)); + goto done; + } + } else { + GST_WARNING ("subclass has no seek implementation"); + goto done; + } + } + + if (flush) { + /* if we sent a FLUSH_START, we now send a FLUSH_STOP */ + GST_DEBUG_OBJECT (base, "sending flush stop"); + //gst_pad_push_event (base->sinkpad, gst_event_new_flush_stop ()); + GST_MPEGTS_BASE_GET_CLASS (base)->push_event (base, + gst_event_new_flush_stop ()); + } + //else +done: + gst_pad_start_task (base->sinkpad, (GstTaskFunction) mpegts_base_loop, base); + + GST_PAD_STREAM_UNLOCK (base->sinkpad); + return ret == GST_FLOW_OK; +} + + static gboolean mpegts_base_sink_activate (GstPad * pad) { @@ -1222,6 +1334,8 @@ mpegts_base_sink_activate_pull (GstPad * pad, gboolean active) static gboolean mpegts_base_sink_activate_push (GstPad * pad, gboolean active) { + MpegTSBase *base = GST_MPEGTS_BASE (GST_OBJECT_PARENT (pad)); + base->mode = BASE_MODE_PUSHING; return TRUE; } @@ -1238,6 +1352,8 @@ mpegts_base_change_state (GstElement * element, GstStateChange transition) switch (transition) { case GST_STATE_CHANGE_PAUSED_TO_READY: mpegts_base_reset (base); + if (base->mode != BASE_MODE_PUSHING) + base->mode = BASE_MODE_SCANNING; break; default: break; diff --git a/gst/mpegtsdemux/mpegtsbase.h b/gst/mpegtsdemux/mpegtsbase.h index 168f2ff1c4..a8e66721a1 100644 --- a/gst/mpegtsdemux/mpegtsbase.h +++ b/gst/mpegtsdemux/mpegtsbase.h @@ -74,7 +74,8 @@ struct _MpegTSBaseProgram typedef enum { BASE_MODE_SCANNING, BASE_MODE_SEEKING, - BASE_MODE_STREAMING + BASE_MODE_STREAMING, + BASE_MODE_PUSHING } MpegTSBaseMode; struct _MpegTSBase { @@ -124,6 +125,7 @@ struct _MpegTSBaseClass { GstElementClass parent_class; /* Virtual methods */ + void (*reset) (MpegTSBase *base); GstFlowReturn (*push) (MpegTSBase *base, MpegTSPacketizerPacket *packet, MpegTSPacketizerSection * section); gboolean (*push_event) (MpegTSBase *base, GstEvent * event); /* program_started gets called when program's pmt arrives for first time */ @@ -139,6 +141,9 @@ struct _MpegTSBaseClass { /* find_timestamps is called to find PCR */ GstFlowReturn (*find_timestamps) (MpegTSBase * base, guint64 initoff, guint64 *offset); + /* seek is called to wait for seeking */ + GstFlowReturn (*seek) (MpegTSBase * base, GstEvent * event, guint16 pid); + /* signals */ void (*pat_info) (GstStructure *pat); void (*pmt_info) (GstStructure *pmt); @@ -155,6 +160,8 @@ MpegTSBaseProgram *mpegts_base_add_program (MpegTSBase * base, gint program_numb guint8 *mpegts_get_descriptor_from_stream (MpegTSBaseStream * stream, guint8 tag); guint8 *mpegts_get_descriptor_from_program (MpegTSBaseProgram * program, guint8 tag); +gboolean +mpegts_base_handle_seek_event(MpegTSBase * base, GstPad * pad, GstEvent * event); gboolean gst_mpegtsbase_plugin_init (GstPlugin * plugin); diff --git a/gst/mpegtsdemux/mpegtspacketizer.c b/gst/mpegtsdemux/mpegtspacketizer.c index f27918a0e6..87a57c6a56 100644 --- a/gst/mpegtsdemux/mpegtspacketizer.c +++ b/gst/mpegtsdemux/mpegtspacketizer.c @@ -199,6 +199,21 @@ mpegts_packetizer_finalize (GObject * object) G_OBJECT_CLASS (mpegts_packetizer_parent_class)->finalize (object); } +guint64 +mpegts_packetizer_compute_pcr (const guint8 * data) +{ + guint32 pcr1; + guint16 pcr2; + guint64 pcr, pcr_ext; + + pcr1 = GST_READ_UINT32_BE (data); + pcr2 = GST_READ_UINT16_BE (data + 4); + pcr = ((guint64) pcr1) << 1; + pcr |= (pcr2 & 0x8000) >> 15; + pcr_ext = (pcr2 & 0x01ff); + return pcr * 300 + pcr_ext % 300; +} + static gboolean mpegts_packetizer_parse_adaptation_field_control (MpegTSPacketizer2 * packetizer, MpegTSPacketizerPacket * packet) @@ -208,6 +223,13 @@ mpegts_packetizer_parse_adaptation_field_control (MpegTSPacketizer2 * length = *packet->data++; + /* an adaptation field with length 0 is valid and + * can be used to insert a single stuffing byte */ + if (!length) { + packet->afc_flags = 0; + return TRUE; + } + if (packet->adaptation_field_control == 0x02) { /* no payload, adaptation field of 183 bytes */ if (length != 183) { @@ -233,31 +255,13 @@ mpegts_packetizer_parse_adaptation_field_control (MpegTSPacketizer2 * /* PCR */ if (afcflags & MPEGTS_AFC_PCR_FLAG) { - guint32 pcr1; - guint16 pcr2; - guint64 pcr, pcr_ext; - - pcr1 = GST_READ_UINT32_BE (data); - pcr2 = GST_READ_UINT16_BE (data + 4); - pcr = ((guint64) pcr1) << 1; - pcr |= (pcr2 & 0x8000) >> 15; - pcr_ext = (pcr2 & 0x01ff); - packet->pcr = pcr * 300 + pcr_ext % 300;; + packet->pcr = mpegts_packetizer_compute_pcr (data); *data += 6; } /* OPCR */ if (afcflags & MPEGTS_AFC_OPCR_FLAG) { - guint32 pcr1; - guint16 pcr2; - guint64 pcr, pcr_ext; - - pcr1 = GST_READ_UINT32_BE (data); - pcr2 = GST_READ_UINT16_BE (data + 4); - pcr = ((guint64) pcr1) << 1; - pcr |= (pcr2 & 0x8000) >> 15; - pcr_ext = (pcr2 & 0x01ff); - packet->opcr = pcr * 300 + pcr_ext % 300;; + packet->opcr = mpegts_packetizer_compute_pcr (data); *data += 6; } @@ -1693,8 +1697,8 @@ mpegts_packetizer_parse_eit (MpegTSPacketizer2 * packetizer, DESC_LENGTH (event_descriptor)) { eventname_tmp = - get_encoding_and_convert (eventname, eventname_length), - eventdescription_tmp = + get_encoding_and_convert (eventname, eventname_length); + eventdescription_tmp = get_encoding_and_convert (eventdescription, eventdescription_length); @@ -2082,6 +2086,24 @@ mpegts_packetizer_clear (MpegTSPacketizer2 * packetizer) packetizer->empty = TRUE; } +void +mpegts_packetizer_flush (MpegTSPacketizer2 * packetizer) +{ + if (packetizer->streams) { + int i; + for (i = 0; i < 8192; i++) { + if (packetizer->streams[i]) { + gst_adapter_flush (packetizer->streams[i]->section_adapter, + packetizer->streams[i]->section_adapter->size); + } + } + } + gst_adapter_flush (packetizer->adapter, packetizer->adapter->size); + + packetizer->offset = 0; + packetizer->empty = TRUE; +} + void mpegts_packetizer_remove_stream (MpegTSPacketizer2 * packetizer, gint16 pid) { @@ -2246,6 +2268,14 @@ mpegts_packetizer_next_packet (MpegTSPacketizer2 * packetizer, gst_buffer_unref (packet->buffer); goto done; } + + if (packetizer->packet_size == MPEGTS_M2TS_PACKETSIZE) { + if (i >= 4) + i -= 4; + else + i += 188; + } + /* Pop out the remaining data... */ GST_BUFFER_DATA (packet->buffer) += i; GST_BUFFER_SIZE (packet->buffer) -= i; @@ -2466,24 +2496,9 @@ get_encoding (const gchar * text, guint * start_text, gboolean * is_multibyte) firstbyte = (guint8) text[0]; - if (firstbyte == 0x01) { - encoding = g_strdup ("iso8859-5"); - *start_text = 1; - *is_multibyte = FALSE; - } else if (firstbyte == 0x02) { - encoding = g_strdup ("iso8859-6"); - *start_text = 1; - *is_multibyte = FALSE; - } else if (firstbyte == 0x03) { - encoding = g_strdup ("iso8859-7"); - *start_text = 1; - *is_multibyte = FALSE; - } else if (firstbyte == 0x04) { - encoding = g_strdup ("iso8859-8"); - *start_text = 1; - *is_multibyte = FALSE; - } else if (firstbyte == 0x05) { - encoding = g_strdup ("iso8859-9"); + /* ETSI EN 300 468, "Selection of character table" */ + if (firstbyte <= 0x0B) { + encoding = g_strdup_printf ("iso8859-%u", firstbyte + 4); *start_text = 1; *is_multibyte = FALSE; } else if (firstbyte >= 0x20) { diff --git a/gst/mpegtsdemux/mpegtspacketizer.h b/gst/mpegtsdemux/mpegtspacketizer.h index e0be1e09ff..832862577d 100644 --- a/gst/mpegtsdemux/mpegtspacketizer.h +++ b/gst/mpegtsdemux/mpegtspacketizer.h @@ -138,6 +138,7 @@ GType mpegts_packetizer_get_type(void); MpegTSPacketizer2 *mpegts_packetizer_new (void); void mpegts_packetizer_clear (MpegTSPacketizer2 *packetizer); +void mpegts_packetizer_flush (MpegTSPacketizer2 *packetizer); void mpegts_packetizer_push (MpegTSPacketizer2 *packetizer, GstBuffer *buffer); gboolean mpegts_packetizer_has_packets (MpegTSPacketizer2 *packetizer); MpegTSPacketizerPacketReturn mpegts_packetizer_next_packet (MpegTSPacketizer2 *packetizer, @@ -161,6 +162,7 @@ GstStructure *mpegts_packetizer_parse_eit (MpegTSPacketizer2 *packetizer, MpegTSPacketizerSection *section); GstStructure *mpegts_packetizer_parse_tdt (MpegTSPacketizer2 *packetizer, MpegTSPacketizerSection *section); +guint64 mpegts_packetizer_compute_pcr(const guint8 * data); G_END_DECLS diff --git a/gst/mpegtsdemux/payload_parsers.c b/gst/mpegtsdemux/payload_parsers.c new file mode 100644 index 0000000000..ca2c75efd4 --- /dev/null +++ b/gst/mpegtsdemux/payload_parsers.c @@ -0,0 +1,313 @@ +/* + * payload_parsers.c + * Copyright (C) 2011 Janne Grunau + * + * Authors: + * Janne Grunau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "payload_parsers.h" +#include + +#define PICTURE_START_CODE 0x00000100 +#define GROUP_START_CODE 0x000001B8 + +#define SLICE_NAL_UNIT_TYPE 0x01 +#define SLICE_IDR_NAL_UNIT_TYPE 0x05 +#define SEI_NAL_UNIT_TYPE 0x06 + +#define SEI_TYPE_RECOVERY_POINT 0x06 + +typedef struct Mpeg2PictureHeader +{ + guint16 temporal_reference; + guint8 picture_coding_type; + guint16 vbv_delay; + + /* picture_coding_type == 2 || picture_coding_type */ + guint8 full_pel_forward_vector; + guint8 forward_f_code; + + /* picture_coding_type == 3 */ + guint8 full_pel_backward_vector; + guint8 backward_f_code; +} Mpeg2PictureHeader; + +/* shortened slice header */ +typedef struct H264SliceHeader +{ + guint32 first_mb_in_slice; + guint8 slice_type; +} H264SliceHeader; + + +static guint8 * +find_start_code (guint32 * start_code, guint8 * buffer, guint8 * buffer_end) +{ + if (G_UNLIKELY (buffer == NULL) || G_UNLIKELY (buffer_end == NULL) + || G_UNLIKELY (start_code == NULL)) + return NULL; + + while (buffer <= buffer_end) { + + *start_code <<= 8; + *start_code |= *buffer++; + + if ((*start_code & 0xffffff00) == 0x00000100) + return buffer; + } + + return NULL; +} + +static gboolean +parse_mpeg2_picture_header (Mpeg2PictureHeader * hdr, guint8 * buffer, + guint8 * buffer_end) +{ + GstBitReader br = GST_BIT_READER_INIT (buffer, buffer_end - buffer); + + if (gst_bit_reader_get_remaining (&br) < 40) + return FALSE; + + hdr->temporal_reference = gst_bit_reader_get_bits_uint16_unchecked (&br, 10); + hdr->picture_coding_type = gst_bit_reader_get_bits_uint8_unchecked (&br, 3); + hdr->vbv_delay = gst_bit_reader_get_bits_uint16_unchecked (&br, 16); + + if (hdr->picture_coding_type == 2 || hdr->picture_coding_type == 3) { + hdr->full_pel_forward_vector = + gst_bit_reader_get_bits_uint8_unchecked (&br, 1); + hdr->forward_f_code = gst_bit_reader_get_bits_uint8_unchecked (&br, 3); + } + if (hdr->picture_coding_type == 3) { + hdr->full_pel_backward_vector = + gst_bit_reader_get_bits_uint8_unchecked (&br, 1); + hdr->backward_f_code = gst_bit_reader_get_bits_uint8_unchecked (&br, 3); + } + return TRUE; +} + +gboolean +gst_tsdemux_has_mpeg2_keyframe (guint32 * state, + MpegTSPacketizerPacket * packet, gboolean * need_more) +{ + guint8 *data = packet->payload; + guint8 *data_end = packet->data_end; + + GST_LOG ("state: 0x%08x", *state); + + while (data <= data_end) { + + data = find_start_code (state, data, data_end); + + if (!data) + return FALSE; + + GST_LOG ("found start code: 0x%08x", *state); + + if (*state == GROUP_START_CODE) { + GST_DEBUG ("found group start code"); + *state = 0xffffffff; + *need_more = FALSE; + return TRUE; + } else if (*state == PICTURE_START_CODE) { + Mpeg2PictureHeader hdr = { 0 }; + gboolean success; + + success = parse_mpeg2_picture_header (&hdr, data, data_end); + GST_DEBUG ("found picture start code, %sparsed, picture coding type: %d", + success ? "" : "not ", hdr.picture_coding_type); + + *state = 0xffffffff; + *need_more = FALSE; + return success && hdr.picture_coding_type == 1; + } + } + + return FALSE; +} + +/* variable length Exp-Golomb parsing according to H.264 spec 9.1*/ +static gboolean +read_golomb (GstBitReader * br, guint32 * value) +{ + guint8 b, leading_zeros = -1; + *value = 1; + + for (b = 0; !b; leading_zeros++) { + if (!gst_bit_reader_get_bits_uint8 (br, &b, 1)) + return FALSE; + *value *= 2; + } + + *value = (*value >> 1) - 1; + if (leading_zeros > 0) { + guint32 tmp = 0; + if (!gst_bit_reader_get_bits_uint32 (br, &tmp, leading_zeros)) + return FALSE; + *value += tmp; + } + + return TRUE; +} + +/* just parse the requirred bits of the slice header */ +static gboolean +parse_h264_slice_header (H264SliceHeader * hdr, guint8 * buffer, + guint8 * buffer_end) +{ + guint32 value; + GstBitReader br = GST_BIT_READER_INIT (buffer, buffer_end - buffer); + + if (!read_golomb (&br, &value)) + return FALSE; + hdr->first_mb_in_slice = value; + + if (!read_golomb (&br, &value)) + return FALSE; + hdr->slice_type = value; + + return TRUE; +} + +enum H264SliceTypes +{ + h264_p_slice = 0, + h264_b_slice, + h264_i_slice, + h264_sp_slice, + h264_si_slice, + h264_p_slice_a, + h264_b_slice_a, + h264_i_slice_a, + h264_sp_slice_a, + h264_si_slice_a, +}; + +static gboolean +is_key_slice (guint8 slice_type) +{ + switch (slice_type) { + case h264_i_slice: + case h264_si_slice: + case h264_i_slice_a: + case h264_si_slice_a: + return TRUE; + } + return FALSE; +} + +gboolean +gst_tsdemux_has_h264_keyframe (guint32 * state, MpegTSPacketizerPacket * packet, + gboolean * need_more) +{ + guint8 *data = packet->payload; + guint8 *data_end = packet->data_end; + + GST_LOG ("state: 0x%08x", *state); + + while (data <= data_end) { + guint8 nal_unit_type; + guint8 *next_data = NULL; + + data = find_start_code (state, data, data_end); + + if (!data) + goto beach; + + GST_LOG ("found start code: 0x%08x", *state); + + /* determine length */ + nal_unit_type = *state & 0x1f; + next_data = find_start_code (state, data, data_end); + + if (nal_unit_type == SEI_NAL_UNIT_TYPE && !next_data) { + GST_WARNING ("NAL unit 0x%02x not completely in ts packet", + nal_unit_type); + goto beach; + } + next_data -= 4; + + switch (nal_unit_type) { + case SLICE_IDR_NAL_UNIT_TYPE: + GST_DEBUG ("found SLICE_IDR NAL unit type"); + *state = 0xffffffff; + *need_more = FALSE; + return TRUE; + case SLICE_NAL_UNIT_TYPE: + { + H264SliceHeader hdr = { 0 }; + gboolean success; + + success = parse_h264_slice_header (&hdr, data, data_end); + GST_DEBUG ("found SLICE NAL unit type with slice type %d", + hdr.slice_type); + + *state = 0xffffffff; + *need_more = FALSE; + return success && is_key_slice (hdr.slice_type); + } + case SEI_NAL_UNIT_TYPE: + { + guint32 recovery_frame_count; + GstBitReader br = GST_BIT_READER_INIT (data, next_data - data); + + break; + + /* SEI message is at least 24 bit long */ + while (gst_bit_reader_get_remaining (&br) >= 24) { + gint type = 0, size = 0; + guint8 tmp = 0; + + do { + if (!gst_bit_reader_get_bits_uint8 (&br, &tmp, 8)) + goto beach; + type += tmp; + } while (tmp == 255); + + do { + if (!gst_bit_reader_get_bits_uint8 (&br, &tmp, 8)) + goto beach; + size += tmp; + } while (tmp == 255); + + + GST_LOG ("found SEI msg type: %d, len: %d", type, size); + + switch (type) { + case SEI_TYPE_RECOVERY_POINT: + if (!read_golomb (&br, &recovery_frame_count)) + return FALSE; + gst_bit_reader_skip (&br, 1); /* exact_match */ + gst_bit_reader_skip (&br, 1); /* broken_link_flag */ + gst_bit_reader_skip (&br, 2); /* changing_slice_group_idc */ + GST_DEBUG ("found SEI with recovery point message, " + "recovery_frame_count: %d", recovery_frame_count); + return TRUE; + default: + /* skip all other sei messages */ + gst_bit_reader_skip (&br, size * 8); + } + } + } + data = next_data; + *state = 0xffffffff; + } + } +beach: + return FALSE; +} diff --git a/gst/mpegtsdemux/payload_parsers.h b/gst/mpegtsdemux/payload_parsers.h new file mode 100644 index 0000000000..7f7a480052 --- /dev/null +++ b/gst/mpegtsdemux/payload_parsers.h @@ -0,0 +1,36 @@ +/* + * payload_parsers.h + * Copyright (C) 2011 Janne Grunau + * + * Authors: + * Janne Grunau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "mpegtspacketizer.h" + +typedef gboolean (*payload_parse_keyframe) (guint32 *state, + MpegTSPacketizerPacket * packet, + gboolean *need_more); + +gboolean gst_tsdemux_has_mpeg2_keyframe (guint32 *state, + MpegTSPacketizerPacket * packet, + gboolean *need_more); + +gboolean gst_tsdemux_has_h264_keyframe (guint32 *state, + MpegTSPacketizerPacket * packet, + gboolean *need_more); diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c index 97dd3802bf..62fd9a0ce2 100644 --- a/gst/mpegtsdemux/tsdemux.c +++ b/gst/mpegtsdemux/tsdemux.c @@ -30,11 +30,14 @@ #include #include +#include + #include "mpegtsbase.h" #include "tsdemux.h" #include "gstmpegdesc.h" #include "gstmpegdefs.h" #include "mpegtspacketizer.h" +#include "payload_parsers.h" /* latency in mseconds */ #define TS_LATENCY 700 @@ -44,6 +47,17 @@ /* Size of the pendingbuffers array. */ #define TS_MAX_PENDING_BUFFERS 256 +#define PCR_WRAP_SIZE_128KBPS (((gint64)1490)*(1024*1024)) +/* small PCR for wrap detection */ +#define PCR_SMALL 17775000 +/* maximal PCR time */ +#define PCR_MAX_VALUE (((((guint64)1)<<33) * 300) + 298) + +/* seek to SEEK_TIMESTAMP_OFFSET before the desired offset and search then + * either accurately or for the next timestamp + */ +#define SEEK_TIMESTAMP_OFFSET (1000 * GST_MSECOND) + GST_DEBUG_CATEGORY_STATIC (ts_demux_debug); #define GST_CAT_DEFAULT ts_demux_debug @@ -104,7 +118,8 @@ struct _TSDemuxStream "video/mpeg, " \ "mpegversion = (int) { 1, 2, 4 }, " \ "systemstream = (boolean) FALSE; " \ - "video/x-h264;" \ + "video/x-h264,stream-format=(string)byte-stream," \ + "alignment=(string)nal;" \ "video/x-dirac;" \ "video/x-wmv," \ "wmvversion = (int) 3, " \ @@ -172,6 +187,7 @@ static void gst_ts_demux_program_started (MpegTSBase * base, MpegTSBaseProgram * program); static void gst_ts_demux_program_stopped (MpegTSBase * base, MpegTSBaseProgram * program); +static void gst_ts_demux_reset (MpegTSBase * base); static GstFlowReturn gst_ts_demux_push (MpegTSBase * base, MpegTSPacketizerPacket * packet, MpegTSPacketizerSection * section); @@ -180,16 +196,21 @@ gst_ts_demux_stream_added (MpegTSBase * base, MpegTSBaseStream * stream, MpegTSBaseProgram * program); static void gst_ts_demux_stream_removed (MpegTSBase * base, MpegTSBaseStream * stream); -static GstFlowReturn -find_timestamps (MpegTSBase * base, guint64 initoff, guint64 * offset); +static GstFlowReturn gst_ts_demux_do_seek (MpegTSBase * base, GstEvent * event, + guint16 pid); +static GstFlowReturn find_pcr_packet (MpegTSBase * base, guint64 offset, + gint64 length, TSPcrOffset * pcroffset); +static GstFlowReturn find_timestamps (MpegTSBase * base, guint64 initoff, + guint64 * offset); static void gst_ts_demux_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_ts_demux_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); static void gst_ts_demux_finalize (GObject * object); static GstFlowReturn -process_pcr (MpegTSBase * base, guint64 initoff, GstClockTime * pcr, +process_pcr (MpegTSBase * base, guint64 initoff, TSPcrOffset * pcroffset, guint numpcr, gboolean isinitial); +static void gst_ts_demux_flush_streams (GstTSDemux * tsdemux); static gboolean push_event (MpegTSBase * base, GstEvent * event); static void _extra_init (GType type); @@ -226,8 +247,8 @@ gst_ts_demux_base_init (gpointer klass) "MPEG transport stream demuxer", "Codec/Demuxer", "Demuxes MPEG2 transport streams", - "Zaheer Abbas Merali ;" - " Edward Hervey "); + "Zaheer Abbas Merali \n" + "Edward Hervey "); } static void @@ -253,6 +274,7 @@ gst_ts_demux_class_init (GstTSDemuxClass * klass) ts_class = GST_MPEGTS_BASE_CLASS (klass); + ts_class->reset = GST_DEBUG_FUNCPTR (gst_ts_demux_reset); ts_class->push = GST_DEBUG_FUNCPTR (gst_ts_demux_push); ts_class->push_event = GST_DEBUG_FUNCPTR (push_event); ts_class->program_started = GST_DEBUG_FUNCPTR (gst_ts_demux_program_started); @@ -260,6 +282,7 @@ gst_ts_demux_class_init (GstTSDemuxClass * klass) ts_class->stream_added = gst_ts_demux_stream_added; ts_class->stream_removed = gst_ts_demux_stream_removed; ts_class->find_timestamps = GST_DEBUG_FUNCPTR (find_timestamps); + ts_class->seek = GST_DEBUG_FUNCPTR (gst_ts_demux_do_seek); } static void @@ -269,6 +292,32 @@ gst_ts_demux_init (GstTSDemux * demux, GstTSDemuxClass * klass) demux->program_number = -1; demux->duration = GST_CLOCK_TIME_NONE; GST_MPEGTS_BASE (demux)->stream_size = sizeof (TSDemuxStream); + gst_segment_init (&demux->segment, GST_FORMAT_TIME); + demux->first_pcr = (TSPcrOffset) { + GST_CLOCK_TIME_NONE, 0, 0}; + demux->cur_pcr = (TSPcrOffset) { + 0}; + demux->last_pcr = (TSPcrOffset) { + 0}; +} + +static void +gst_ts_demux_reset (MpegTSBase * base) +{ + GstTSDemux *demux = (GstTSDemux *) base; + g_array_free (demux->index, TRUE); + demux->index = NULL; + demux->index_size = 0; + demux->need_newsegment = TRUE; + demux->program_number = -1; + demux->duration = GST_CLOCK_TIME_NONE; + gst_segment_init (&demux->segment, GST_FORMAT_TIME); + demux->first_pcr = (TSPcrOffset) { + GST_CLOCK_TIME_NONE, 0, 0}; + demux->cur_pcr = (TSPcrOffset) { + 0}; + demux->last_pcr = (TSPcrOffset) { + 0}; } static void @@ -323,6 +372,7 @@ gst_ts_demux_srcpad_query_types (GstPad * pad) { static const GstQueryType query_types[] = { GST_QUERY_DURATION, + GST_QUERY_SEEKING, 0 }; @@ -333,40 +383,578 @@ static gboolean gst_ts_demux_srcpad_query (GstPad * pad, GstQuery * query) { gboolean res = TRUE; + GstFormat format; GstTSDemux *demux; demux = GST_TS_DEMUX (gst_pad_get_parent (pad)); switch (GST_QUERY_TYPE (query)) { case GST_QUERY_DURATION: - { - GstFormat format; - + GST_DEBUG ("query duration"); gst_query_parse_duration (query, &format, NULL); - /* can only get position in time */ - if (format != GST_FORMAT_TIME) - goto wrong_format; - - gst_query_set_duration (query, GST_FORMAT_TIME, demux->duration); + if (format == GST_FORMAT_TIME) { + gst_query_set_duration (query, GST_FORMAT_TIME, + demux->segment.duration); + } else { + GST_DEBUG_OBJECT (demux, "only query duration on TIME is supported"); + res = FALSE; + } + break; + case GST_QUERY_SEEKING: + GST_DEBUG ("query seeking"); + gst_query_parse_seeking (query, &format, NULL, NULL, NULL); + if (format == GST_FORMAT_TIME) { + gst_query_set_seeking (query, GST_FORMAT_TIME, + demux->parent.mode != BASE_MODE_PUSHING, 0, + demux->segment.duration); + } else { + GST_DEBUG_OBJECT (demux, "only TIME is supported for query seeking"); + res = FALSE; + } break; - } default: res = gst_pad_query_default (pad, query); - break; } -done: gst_object_unref (demux); return res; -wrong_format: - { - GST_DEBUG_OBJECT (demux, "only query duration on TIME is supported"); - res = FALSE; - goto done; - } } +static inline GstClockTime +calculate_gsttime (TSPcrOffset * start, guint64 pcr) +{ + + GstClockTime time = start->gsttime; + + if (start->pcr > pcr) + time += PCRTIME_TO_GSTTIME (PCR_MAX_VALUE - start->pcr) + + PCRTIME_TO_GSTTIME (pcr); + else + time += PCRTIME_TO_GSTTIME (pcr - start->pcr); + + return time; +} + +static GstFlowReturn +gst_ts_demux_parse_pes_header_pts (GstTSDemux * demux, + MpegTSPacketizerPacket * packet, guint64 * time) +{ + GstFlowReturn res = GST_FLOW_ERROR; + guint8 *data; + guint32 length; + guint32 psc_stid; + guint8 stid; + guint16 pesplength; + guint8 PES_header_data_length = 0; + + data = packet->payload; + length = packet->data_end - data; + + GST_MEMDUMP ("Header buffer", data, MIN (length, 32)); + + /* packet_start_code_prefix 24 + * stream_id 8*/ + psc_stid = GST_READ_UINT32_BE (data); + data += 4; + length -= 4; + if (G_UNLIKELY ((psc_stid & 0xffffff00) != 0x00000100)) { + GST_DEBUG ("WRONG PACKET START CODE! pid: 0x%x", packet->pid); + goto discont; + } + stid = psc_stid & 0x000000ff; + GST_LOG ("stream_id:0x%02x", stid); + + /* PES_packet_length 16 */ + /* FIXME : store the expected pes length somewhere ? */ + pesplength = GST_READ_UINT16_BE (data); + data += 2; + length -= 2; + GST_LOG ("PES_packet_length:%d", pesplength); + + /* FIXME : Only parse header on streams which require it (see table 2-21) */ + if (stid != 0xbf) { + guint64 pts; + guint8 p1, p2; + p1 = *data++; + p2 = *data++; + PES_header_data_length = *data++ + 3; + length -= 3; + + GST_LOG ("0x%02x 0x%02x 0x%02x", p1, p2, PES_header_data_length); + GST_LOG ("PES header data length:%d", PES_header_data_length); + + /* '10' 2 + * PES_scrambling_control 2 + * PES_priority 1 + * data_alignment_indicator 1 + * copyright 1 + * original_or_copy 1 */ + if (G_UNLIKELY ((p1 & 0xc0) != 0x80)) { + GST_WARNING ("p1 >> 6 != 0x2"); + goto discont; + } + + /* PTS_DTS_flags 2 + * ESCR_flag 1 + * ES_rate_flag 1 + * DSM_trick_mode_flag 1 + * additional_copy_info_flag 1 + * PES_CRC_flag 1 + * PES_extension_flag 1*/ + + /* PES_header_data_length 8 */ + if (G_UNLIKELY (length < PES_header_data_length)) { + GST_WARNING ("length < PES_header_data_length"); + goto discont; + } + + /* PTS 32 */ + if ((p2 & 0x80)) { /* PTS */ + READ_TS (data, pts, discont); + length -= 4; + *time = pts; + res = GST_FLOW_OK; + } + } +discont: + return res; +} + +/* performs a accurate/key_unit seek */ +static GstFlowReturn +gst_ts_demux_perform_auxiliary_seek (MpegTSBase * base, GstClockTime seektime, + TSPcrOffset * pcroffset, gint64 length, gint16 pid, GstSeekFlags flags, + payload_parse_keyframe auxiliary_seek_fn) +{ + GstTSDemux *demux = (GstTSDemux *) base; + GstFlowReturn res = GST_FLOW_ERROR; + gboolean done = FALSE; + gboolean found_keyframe = FALSE, found_accurate = FALSE, need_more = TRUE; + GstBuffer *buf; + MpegTSPacketizerPacket packet; + MpegTSPacketizerPacketReturn pret; + gint64 offset = pcroffset->offset; + gint64 scan_offset = MIN (length, 50 * MPEGTS_MAX_PACKETSIZE); + guint32 state = 0xffffffff; + TSPcrOffset key_pos = { 0 }; + + GST_DEBUG ("auxiliary seek for %" GST_TIME_FORMAT " from offset: %" + G_GINT64_FORMAT " in %" G_GINT64_FORMAT " bytes for PID: %d " + "%s %s", GST_TIME_ARGS (seektime), pcroffset->offset, length, pid, + (flags & GST_SEEK_FLAG_ACCURATE) ? "accurate" : "", + (flags & GST_SEEK_FLAG_KEY_UNIT) ? "key_unit" : ""); + + mpegts_packetizer_flush (base->packetizer); + + if (base->packetizer->packet_size == MPEGTS_M2TS_PACKETSIZE) + offset -= 4; + + while (!done && scan_offset <= length) { + res = + gst_pad_pull_range (base->sinkpad, offset + scan_offset, + 50 * MPEGTS_MAX_PACKETSIZE, &buf); + if (res != GST_FLOW_OK) + goto beach; + mpegts_packetizer_push (base->packetizer, buf); + + while ((!done) + && ((pret = + mpegts_packetizer_next_packet (base->packetizer, + &packet)) != PACKET_NEED_MORE)) { + if (G_UNLIKELY (pret == PACKET_BAD)) + /* bad header, skip the packet */ + goto next; + + if (packet.payload_unit_start_indicator) + GST_DEBUG ("found packet for PID: %d with pcr: %" GST_TIME_FORMAT + " at offset: %" G_GINT64_FORMAT, packet.pid, + GST_TIME_ARGS (packet.pcr), packet.offset); + + if (packet.payload != NULL && packet.pid == pid) { + + if (packet.payload_unit_start_indicator) { + guint64 pts = 0; + GstFlowReturn ok = + gst_ts_demux_parse_pes_header_pts (demux, &packet, &pts); + if (ok == GST_FLOW_OK) { + GstClockTime time = calculate_gsttime (pcroffset, pts * 300); + + GST_DEBUG ("packet has PTS: %" GST_TIME_FORMAT, + GST_TIME_ARGS (time)); + + if (time <= seektime) { + pcroffset->gsttime = time; + pcroffset->pcr = packet.pcr; + pcroffset->offset = packet.offset; + } else + found_accurate = TRUE; + } else + goto next; + /* reset state for new packet */ + state = 0xffffffff; + need_more = TRUE; + } + + if (auxiliary_seek_fn) { + if (need_more) { + if (auxiliary_seek_fn (&state, &packet, &need_more)) { + found_keyframe = TRUE; + key_pos = *pcroffset; + GST_DEBUG ("found keyframe: time: %" GST_TIME_FORMAT " pcr: %" + GST_TIME_FORMAT " offset %" G_GINT64_FORMAT, + GST_TIME_ARGS (pcroffset->gsttime), + GST_TIME_ARGS (pcroffset->pcr), pcroffset->offset); + } + } + } else { + /* if we don't have a payload parsing function + * every frame is a keyframe */ + found_keyframe = TRUE; + } + } + if (flags & GST_SEEK_FLAG_ACCURATE) + done = found_accurate && found_keyframe; + else + done = found_keyframe; + if (done) + *pcroffset = key_pos; + next: + mpegts_packetizer_clear_packet (base->packetizer, &packet); + } + scan_offset += 50 * MPEGTS_MAX_PACKETSIZE; + } + +beach: + if (done) + res = GST_FLOW_OK; + else if (GST_FLOW_OK == res) + res = GST_FLOW_CUSTOM_ERROR_1; + + mpegts_packetizer_flush (base->packetizer); + return res; +} + +static gint +TSPcrOffset_find (gconstpointer a, gconstpointer b, gpointer user_data) +{ + +/* GST_INFO ("a: %" GST_TIME_FORMAT " offset: %" G_GINT64_FORMAT, */ +/* GST_TIME_ARGS (((TSPcrOffset *) a)->gsttime), ((TSPcrOffset *) a)->offset); */ +/* GST_INFO ("b: %" GST_TIME_FORMAT " offset: %" G_GINT64_FORMAT, */ +/* GST_TIME_ARGS (((TSPcrOffset *) b)->gsttime), ((TSPcrOffset *) b)->offset); */ + + if (((TSPcrOffset *) a)->gsttime < ((TSPcrOffset *) b)->gsttime) + return -1; + else if (((TSPcrOffset *) a)->gsttime > ((TSPcrOffset *) b)->gsttime) + return 1; + else + return 0; +} + +static GstFlowReturn +gst_ts_demux_perform_seek (MpegTSBase * base, GstSegment * segment, guint16 pid) +{ + GstTSDemux *demux = (GstTSDemux *) base; + GstFlowReturn res = GST_FLOW_ERROR; + int max_loop_cnt, loop_cnt = 0; + gint64 seekpos = 0; + gint64 time_diff; + GstClockTime seektime; + TSPcrOffset seekpcroffset, pcr_start, pcr_stop, *tmp; + + max_loop_cnt = (segment->flags & GST_SEEK_FLAG_ACCURATE) ? 25 : 10; + + seektime = + MAX (0, + segment->last_stop - SEEK_TIMESTAMP_OFFSET) + demux->first_pcr.gsttime; + seekpcroffset.gsttime = seektime; + + GST_DEBUG ("seeking to %" GST_TIME_FORMAT, GST_TIME_ARGS (seektime)); + + gst_ts_demux_flush_streams (demux); + + if (G_UNLIKELY (!demux->index)) { + GST_ERROR ("no index"); + goto done; + } + + /* get the first index entry before the seek position */ + tmp = gst_util_array_binary_search (demux->index->data, demux->index_size, + sizeof (*tmp), TSPcrOffset_find, GST_SEARCH_MODE_BEFORE, &seekpcroffset, + NULL); + + if (G_UNLIKELY (!tmp)) { + GST_ERROR ("value not found"); + goto done; + } + + pcr_start = *tmp; + pcr_stop = *(++tmp); + + if (G_UNLIKELY (!pcr_stop.offset)) { + GST_ERROR ("invalid entry"); + goto done; + } + + /* check if the last recorded pcr can be used */ + if (pcr_start.offset < demux->cur_pcr.offset + && demux->cur_pcr.offset < pcr_stop.offset) { + demux->cur_pcr.gsttime = calculate_gsttime (&pcr_start, demux->cur_pcr.pcr); + if (demux->cur_pcr.gsttime < seekpcroffset.gsttime) + pcr_start = demux->cur_pcr; + else + pcr_stop = demux->cur_pcr; + } + + GST_DEBUG ("start %" GST_TIME_FORMAT " offset: %" G_GINT64_FORMAT, + GST_TIME_ARGS (pcr_start.gsttime), pcr_start.offset); + GST_DEBUG ("stop %" GST_TIME_FORMAT " offset: %" G_GINT64_FORMAT, + GST_TIME_ARGS (pcr_stop.gsttime), pcr_stop.offset); + + time_diff = seektime - pcr_start.gsttime; + seekpcroffset = pcr_start; + + GST_DEBUG ("cur %" GST_TIME_FORMAT " offset: %" G_GINT64_FORMAT + " time diff: %" G_GINT64_FORMAT, + GST_TIME_ARGS (demux->cur_pcr.gsttime), demux->cur_pcr.offset, time_diff); + + /* seek loop */ + while (loop_cnt++ < max_loop_cnt && (time_diff > SEEK_TIMESTAMP_OFFSET >> 1) + && (pcr_stop.gsttime - pcr_start.gsttime > SEEK_TIMESTAMP_OFFSET)) { + gint64 duration = pcr_stop.gsttime - pcr_start.gsttime; + gint64 size = pcr_stop.offset - pcr_start.offset; + + if (loop_cnt & 1) + seekpos = pcr_start.offset + (size >> 1); + else + seekpos = + pcr_start.offset + size * ((double) (seektime - + pcr_start.gsttime) / duration); + + /* look a litle bit behind */ + seekpos = + MAX (pcr_start.offset + 188, seekpos - 55 * MPEGTS_MAX_PACKETSIZE); + + GST_DEBUG ("looking for time: %" GST_TIME_FORMAT " .. %" GST_TIME_FORMAT + " .. %" GST_TIME_FORMAT, + GST_TIME_ARGS (pcr_start.gsttime), + GST_TIME_ARGS (seektime), GST_TIME_ARGS (pcr_stop.gsttime)); + GST_DEBUG ("looking in bytes: %" G_GINT64_FORMAT " .. %" G_GINT64_FORMAT + " .. %" G_GINT64_FORMAT, pcr_start.offset, seekpos, pcr_stop.offset); + + res = + find_pcr_packet (&demux->parent, seekpos, 4000 * MPEGTS_MAX_PACKETSIZE, + &seekpcroffset); + if (G_UNLIKELY (res == GST_FLOW_UNEXPECTED)) { + seekpos = + MAX ((gint64) pcr_start.offset, + seekpos - 2000 * MPEGTS_MAX_PACKETSIZE) + 188; + res = + find_pcr_packet (&demux->parent, seekpos, + 8000 * MPEGTS_MAX_PACKETSIZE, &seekpcroffset); + } + if (G_UNLIKELY (res != GST_FLOW_OK)) { + GST_WARNING ("seeking failed %s", gst_flow_get_name (res)); + goto done; + } + + seekpcroffset.gsttime = calculate_gsttime (&pcr_start, seekpcroffset.pcr); + + /* validate */ + if (G_UNLIKELY ((seekpcroffset.gsttime < pcr_start.gsttime) || + (seekpcroffset.gsttime > pcr_stop.gsttime))) { + GST_ERROR ("Unexpected timestamp found, seeking failed! %" + GST_TIME_FORMAT, GST_TIME_ARGS (seekpcroffset.gsttime)); + res = GST_FLOW_ERROR; + goto done; + } + + if (seekpcroffset.gsttime > seektime) { + pcr_stop = seekpcroffset; + } else { + pcr_start = seekpcroffset; + } + time_diff = seektime - pcr_start.gsttime; + GST_DEBUG ("seeking: %" GST_TIME_FORMAT " found: %" GST_TIME_FORMAT + " diff = %" G_GINT64_FORMAT, GST_TIME_ARGS (seektime), + GST_TIME_ARGS (seekpcroffset.gsttime), time_diff); + } + + GST_DEBUG ("seeking finished after %d loops", loop_cnt); + + /* use correct seek position for the auxiliary search */ + seektime += SEEK_TIMESTAMP_OFFSET; + + { + payload_parse_keyframe keyframe_seek = NULL; + MpegTSBaseProgram *program = demux->program; + guint64 avg_bitrate, length; + + if (program->streams[pid]) { + switch (program->streams[pid]->stream_type) { + case ST_VIDEO_MPEG1: + case ST_VIDEO_MPEG2: + keyframe_seek = gst_tsdemux_has_mpeg2_keyframe; + break; + case ST_VIDEO_H264: + keyframe_seek = gst_tsdemux_has_h264_keyframe; + break; + case ST_VIDEO_MPEG4: + case ST_VIDEO_DIRAC: + GST_WARNING ("no payload parser for stream 0x%04x type: 0x%02x", pid, + program->streams[pid]->stream_type); + break; + } + } else + GST_WARNING ("no stream info for PID: 0x%04x", pid); + + avg_bitrate = + (pcr_stop.offset - + pcr_start.offset) * 1000 * GST_MSECOND / (pcr_stop.gsttime - + pcr_start.gsttime); + + seekpcroffset = pcr_start; + /* search in 2500ms for a keyframe */ + length = + MIN (demux->last_pcr.offset - pcr_start.offset, + (avg_bitrate * 25) / 10); + res = + gst_ts_demux_perform_auxiliary_seek (base, seektime, &seekpcroffset, + length, pid, segment->flags, keyframe_seek); + + if (res == GST_FLOW_CUSTOM_ERROR_1) { + GST_ERROR ("no keyframe found in %" G_GUINT64_FORMAT + " bytes starting from %" G_GUINT64_FORMAT, length, + seekpcroffset.offset); + res = GST_FLOW_ERROR; + } + if (res != GST_FLOW_OK) + goto done; + } + + + /* update seektime to the actual timestamp of the found keyframe */ + if (segment->flags & GST_SEEK_FLAG_KEY_UNIT) + seektime = seekpcroffset.gsttime; + + seektime -= demux->first_pcr.gsttime; + + segment->last_stop = seektime; + segment->time = seektime; + + /* we stop at the end */ + if (segment->stop == -1) + segment->stop = demux->first_pcr.gsttime + segment->duration; + + demux->need_newsegment = TRUE; + demux->parent.seek_offset = seekpcroffset.offset; + GST_DEBUG ("seeked to postion:%" GST_TIME_FORMAT, GST_TIME_ARGS (seektime)); + res = GST_FLOW_OK; + +done: + return res; +} + + +static GstFlowReturn +gst_ts_demux_do_seek (MpegTSBase * base, GstEvent * event, guint16 pid) +{ + GstTSDemux *demux = (GstTSDemux *) base; + GstFlowReturn res = GST_FLOW_ERROR; + gdouble rate; + gboolean accurate, flush; + GstFormat format; + GstSeekFlags flags; + GstSeekType start_type, stop_type; + gint64 start, stop; + GstSegment seeksegment; + gboolean update; + + gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start, + &stop_type, &stop); + + if (format != GST_FORMAT_TIME) { + goto done; + } + + GST_DEBUG ("seek event, rate: %f start: %" GST_TIME_FORMAT + " stop: %" GST_TIME_FORMAT, rate, GST_TIME_ARGS (start), + GST_TIME_ARGS (stop)); + + accurate = flags & GST_SEEK_FLAG_ACCURATE; + flush = flags & GST_SEEK_FLAG_FLUSH; + + if (flags & (GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_SKIP)) { + GST_WARNING ("seek flags 0x%x are not supported", (int) flags); + goto done; + } + + /* copy segment, we need this because we still need the old + * segment when we close the current segment. */ + memcpy (&seeksegment, &demux->segment, sizeof (GstSegment)); + /* configure the segment with the seek variables */ + GST_DEBUG_OBJECT (demux, "configuring seek"); + GST_DEBUG ("seeksegment: start: %" GST_TIME_FORMAT " stop: %" + GST_TIME_FORMAT " time: %" GST_TIME_FORMAT " accum: %" GST_TIME_FORMAT + " last_stop: %" GST_TIME_FORMAT " duration: %" GST_TIME_FORMAT, + GST_TIME_ARGS (seeksegment.start), GST_TIME_ARGS (seeksegment.stop), + GST_TIME_ARGS (seeksegment.time), GST_TIME_ARGS (seeksegment.accum), + GST_TIME_ARGS (seeksegment.last_stop), + GST_TIME_ARGS (seeksegment.duration)); + gst_segment_set_seek (&seeksegment, rate, format, flags, start_type, start, + stop_type, stop, &update); + GST_DEBUG ("seeksegment: start: %" GST_TIME_FORMAT " stop: %" + GST_TIME_FORMAT " time: %" GST_TIME_FORMAT " accum: %" GST_TIME_FORMAT + " last_stop: %" GST_TIME_FORMAT " duration: %" GST_TIME_FORMAT, + GST_TIME_ARGS (seeksegment.start), GST_TIME_ARGS (seeksegment.stop), + GST_TIME_ARGS (seeksegment.time), GST_TIME_ARGS (seeksegment.accum), + GST_TIME_ARGS (seeksegment.last_stop), + GST_TIME_ARGS (seeksegment.duration)); + + res = gst_ts_demux_perform_seek (base, &seeksegment, pid); + if (G_UNLIKELY (res != GST_FLOW_OK)) { + GST_WARNING ("seeking failed %s", gst_flow_get_name (res)); + goto done; + } + + /* commit the new segment */ + memcpy (&demux->segment, &seeksegment, sizeof (GstSegment)); + + if (demux->segment.flags & GST_SEEK_FLAG_SEGMENT) { + gst_element_post_message (GST_ELEMENT_CAST (demux), + gst_message_new_segment_start (GST_OBJECT_CAST (demux), + demux->segment.format, demux->segment.last_stop)); + } + +done: + return res; +} + +static gboolean +gst_ts_demux_srcpad_event (GstPad * pad, GstEvent * event) +{ + gboolean res = TRUE; + GstTSDemux *demux = GST_TS_DEMUX (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (pad, "Got event %s", + gst_event_type_get_name (GST_EVENT_TYPE (event))); + + switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_SEEK: + res = mpegts_base_handle_seek_event ((MpegTSBase *) demux, pad, event); + if (!res) { + GST_WARNING ("seeking failed"); + } + gst_event_unref (event); + break; + default: + res = gst_pad_event_default (pad, event); + } + + gst_object_unref (demux); + return res; +} static gboolean push_event (MpegTSBase * base, GstEvent * event) @@ -424,7 +1012,7 @@ done: } static GstPad * -create_pad_for_stream (GstTSDemux * demux, MpegTSBaseStream * bstream, +create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream, MpegTSBaseProgram * program) { TSDemuxStream *stream = (TSDemuxStream *) bstream; @@ -508,7 +1096,9 @@ create_pad_for_stream (GstTSDemux * demux, MpegTSBaseStream * bstream, if (program->program_number == 10510 && bstream->pid == 3401) { template = gst_static_pad_template_get (&video_template); name = g_strdup_printf ("video_%04x", bstream->pid); - caps = gst_caps_new_simple ("video/x-h264", NULL); + caps = gst_caps_new_simple ("video/x-h264", + "stream-format", G_TYPE_STRING, "byte-stream", + "alignment", G_TYPE_STRING, "nal", NULL); } break; case ST_HDV_AUX_V: @@ -526,6 +1116,11 @@ create_pad_for_stream (GstTSDemux * demux, MpegTSBaseStream * bstream, case ST_PRIVATE_SECTIONS: case ST_MHEG: case ST_DSMCC: + case ST_DSMCC_A: + case ST_DSMCC_B: + case ST_DSMCC_C: + case ST_DSMCC_D: + base->is_pes[bstream->pid] = FALSE; break; case ST_AUDIO_AAC: template = gst_static_pad_template_get (&audio_template); @@ -543,7 +1138,9 @@ create_pad_for_stream (GstTSDemux * demux, MpegTSBaseStream * bstream, case ST_VIDEO_H264: template = gst_static_pad_template_get (&video_template); name = g_strdup_printf ("video_%04x", bstream->pid); - caps = gst_caps_new_simple ("video/x-h264", NULL); + caps = gst_caps_new_simple ("video/x-h264", + "stream-format", G_TYPE_STRING, "byte-stream", + "alignment", G_TYPE_STRING, "nal", NULL); break; case ST_VIDEO_DIRAC: desc = @@ -665,6 +1262,7 @@ create_pad_for_stream (GstTSDemux * demux, MpegTSBaseStream * bstream, gst_pad_set_caps (pad, caps); gst_pad_set_query_type_function (pad, gst_ts_demux_srcpad_query_types); gst_pad_set_query_function (pad, gst_ts_demux_srcpad_query); + gst_pad_set_event_function (pad, gst_ts_demux_srcpad_event); gst_caps_unref (caps); } @@ -677,13 +1275,12 @@ static void gst_ts_demux_stream_added (MpegTSBase * base, MpegTSBaseStream * bstream, MpegTSBaseProgram * program) { - GstTSDemux *tsdemux = (GstTSDemux *) base; TSDemuxStream *stream = (TSDemuxStream *) bstream; if (!stream->pad) { /* Create the pad */ if (bstream->stream_type != 0xff) - stream->pad = create_pad_for_stream (tsdemux, bstream, program); + stream->pad = create_pad_for_stream (base, bstream, program); stream->pts = GST_CLOCK_TIME_NONE; } stream->flow_return = GST_FLOW_OK; @@ -716,6 +1313,33 @@ activate_pad_for_stream (GstTSDemux * tsdemux, TSDemuxStream * stream) GST_WARNING_OBJECT (tsdemux, "stream %p has no pad", stream); } +static void +gst_ts_demux_stream_flush (TSDemuxStream * stream) +{ + gint i; + + stream->pts = GST_CLOCK_TIME_NONE; + + for (i = 0; i < stream->nbpending; i++) + gst_buffer_unref (stream->pendingbuffers[i]); + memset (stream->pendingbuffers, 0, TS_MAX_PENDING_BUFFERS); + stream->nbpending = 0; + + stream->current = NULL; +} + +static void +gst_ts_demux_flush_streams (GstTSDemux * demux) +{ + gint i; + + for (i = 0; i < 0x2000; i++) { + if (demux->program->streams[i]) { + gst_ts_demux_stream_flush ((TSDemuxStream *) demux->program->streams[i]); + } + } +} + static void gst_ts_demux_program_started (MpegTSBase * base, MpegTSBaseProgram * program) { @@ -754,7 +1378,7 @@ gst_ts_demux_program_stopped (MpegTSBase * base, MpegTSBaseProgram * program) GST_LOG ("program %d stopped", program->program_number); - if (program != demux->program) + if (demux->program == NULL || program != demux->program) return; for (i = 0; i < 0x2000; i++) { @@ -823,6 +1447,173 @@ process_section (MpegTSBase * base) return done; } +static gboolean +process_pes (MpegTSBase * base, TSPcrOffset * pcroffset) +{ + gboolean based, done = FALSE; + MpegTSPacketizerPacket packet; + MpegTSPacketizerPacketReturn pret; + GstTSDemux *demux = GST_TS_DEMUX (base); + guint16 pcr_pid = 0; + + while ((!done) + && ((pret = + mpegts_packetizer_next_packet (base->packetizer, + &packet)) != PACKET_NEED_MORE)) { + if (G_UNLIKELY (pret == PACKET_BAD)) + /* bad header, skip the packet */ + goto next; + + if (demux->program != NULL) { + pcr_pid = demux->program->pcr_pid; + } + + /* base PSI data */ + if (packet.payload != NULL && mpegts_base_is_psi (base, &packet)) { + MpegTSPacketizerSection section; + + based = + mpegts_packetizer_push_section (base->packetizer, &packet, §ion); + if (G_UNLIKELY (!based)) + /* bad section data */ + goto next; + + if (G_LIKELY (section.complete)) { + /* section complete */ + GST_DEBUG ("Section Complete"); + based = mpegts_base_handle_psi (base, §ion); + gst_buffer_unref (section.buffer); + if (G_UNLIKELY (!based)) + /* bad PSI table */ + goto next; + + } + } + if (packet.pid == pcr_pid && (packet.adaptation_field_control & 0x02) + && (packet.afc_flags & MPEGTS_AFC_PCR_FLAG)) { + GST_DEBUG ("PCR[0x%x]: %" G_GINT64_FORMAT, packet.pid, packet.pcr); + pcroffset->pcr = packet.pcr; + pcroffset->offset = packet.offset; + done = TRUE; + } + next: + mpegts_packetizer_clear_packet (base->packetizer, &packet); + } + return done; +} + +static GstFlowReturn +find_pcr_packet (MpegTSBase * base, guint64 offset, gint64 length, + TSPcrOffset * pcroffset) +{ + GstFlowReturn ret = GST_FLOW_OK; + GstTSDemux *demux = GST_TS_DEMUX (base); + MpegTSBaseProgram *program; + GstBuffer *buf; + gboolean done = FALSE; + guint64 scan_offset = 0; + + GST_DEBUG ("Scanning for PCR between:%" G_GINT64_FORMAT + " and the end:%" G_GINT64_FORMAT, offset, offset + length); + + /* Get the program */ + program = demux->program; + if (G_UNLIKELY (program == NULL)) + return GST_FLOW_ERROR; + + mpegts_packetizer_flush (base->packetizer); + if (offset >= 4 && base->packetizer->packet_size == MPEGTS_M2TS_PACKETSIZE) + offset -= 4; + + while (!done && scan_offset < length) { + ret = + gst_pad_pull_range (base->sinkpad, offset + scan_offset, + 50 * MPEGTS_MAX_PACKETSIZE, &buf); + if (ret != GST_FLOW_OK) + goto beach; + mpegts_packetizer_push (base->packetizer, buf); + done = process_pes (base, pcroffset); + scan_offset += 50 * MPEGTS_MAX_PACKETSIZE; + } + + if (!done || scan_offset >= length) { + GST_WARNING ("No PCR found!"); + ret = GST_FLOW_ERROR; + goto beach; + } + +beach: + mpegts_packetizer_flush (base->packetizer); + return ret; +} + +static gboolean +verify_timestamps (MpegTSBase * base, TSPcrOffset * first, TSPcrOffset * last) +{ + GstTSDemux *demux = GST_TS_DEMUX (base); + guint64 length = 4000 * MPEGTS_MAX_PACKETSIZE; + guint64 offset = PCR_WRAP_SIZE_128KBPS; + + demux->index = + g_array_sized_new (TRUE, TRUE, sizeof (*first), + 2 + 1 + ((last->offset - first->offset) / PCR_WRAP_SIZE_128KBPS)); + + first->gsttime = PCRTIME_TO_GSTTIME (first->pcr); + demux->index = g_array_append_val (demux->index, *first); + demux->index_size++; + demux->first_pcr = *first; + demux->index_pcr = *first; + GST_DEBUG ("first time: %" GST_TIME_FORMAT " pcr: %" GST_TIME_FORMAT + " offset: %" G_GINT64_FORMAT + " last pcr: %" GST_TIME_FORMAT " offset: %" G_GINT64_FORMAT, + GST_TIME_ARGS (first->gsttime), + GST_TIME_ARGS (PCRTIME_TO_GSTTIME (first->pcr)), first->offset, + GST_TIME_ARGS (PCRTIME_TO_GSTTIME (last->pcr)), last->offset); + + while (offset + length < last->offset) { + TSPcrOffset half; + GstFlowReturn ret; + gint tries = 0; + + retry: + ret = find_pcr_packet (base, offset, length, &half); + if (G_UNLIKELY (ret != GST_FLOW_OK)) { + GST_WARNING ("no pcr found, retrying"); + if (tries++ < 3) { + offset += length; + length *= 2; + goto retry; + } + return FALSE; + } + + half.gsttime = calculate_gsttime (first, half.pcr); + + GST_DEBUG ("add half time: %" GST_TIME_FORMAT " pcr: %" GST_TIME_FORMAT + " offset: %" G_GINT64_FORMAT, + GST_TIME_ARGS (half.gsttime), + GST_TIME_ARGS (PCRTIME_TO_GSTTIME (half.pcr)), half.offset); + demux->index = g_array_append_val (demux->index, half); + demux->index_size++; + + length = 4000 * MPEGTS_MAX_PACKETSIZE; + offset += PCR_WRAP_SIZE_128KBPS; + *first = half; + } + + last->gsttime = calculate_gsttime (first, last->pcr); + + GST_DEBUG ("add last time: %" GST_TIME_FORMAT " pcr: %" GST_TIME_FORMAT + " offset: %" G_GINT64_FORMAT, + GST_TIME_ARGS (last->gsttime), + GST_TIME_ARGS (PCRTIME_TO_GSTTIME (last->pcr)), last->offset); + + demux->index = g_array_append_val (demux->index, *last); + demux->index_size++; + + demux->last_pcr = *last; + return TRUE; +} static GstFlowReturn find_timestamps (MpegTSBase * base, guint64 initoff, guint64 * offset) @@ -835,7 +1626,7 @@ find_timestamps (MpegTSBase * base, guint64 initoff, guint64 * offset) gint64 total_bytes; guint64 scan_offset; guint i = 0; - GstClockTime initial, final; + TSPcrOffset initial, final; GstTSDemux *demux = GST_TS_DEMUX (base); GST_DEBUG ("Scanning for timestamps"); @@ -863,16 +1654,19 @@ find_timestamps (MpegTSBase * base, guint64 initoff, guint64 * offset) /* Search for the first PCRs */ ret = process_pcr (base, base->first_pat_offset, &initial, 10, TRUE); - mpegts_packetizer_clear (base->packetizer); - /* Remove current program so we ensure looking for a PAT when scanning the - * for the final PCR */ - mpegts_base_remove_program (base, demux->current_program_number); - if (ret != GST_FLOW_OK) { + if (ret != GST_FLOW_OK && ret != GST_FLOW_UNEXPECTED) { GST_WARNING ("Problem getting initial PCRs"); goto beach; } + mpegts_packetizer_clear (base->packetizer); + /* Remove current program so we ensure looking for a PAT when scanning the + * for the final PCR */ + gst_structure_free (base->pat); + base->pat = NULL; + mpegts_base_remove_program (base, demux->current_program_number); + /* Find end position */ if (G_UNLIKELY (!gst_pad_query_peer_duration (base->sinkpad, &format, &total_bytes) || format != GST_FORMAT_BYTES)) { @@ -883,7 +1677,9 @@ find_timestamps (MpegTSBase * base, guint64 initoff, guint64 * offset) } GST_DEBUG ("Upstream is %" G_GINT64_FORMAT " bytes", total_bytes); - scan_offset = total_bytes - 4000 * MPEGTS_MAX_PACKETSIZE; + + /* Let's start scanning 4000 packets from the end */ + scan_offset = MAX (188, total_bytes - 4000 * MPEGTS_MAX_PACKETSIZE); GST_DEBUG ("Scanning for last sync point between:%" G_GINT64_FORMAT " and the end:%" G_GINT64_FORMAT, scan_offset, total_bytes); @@ -903,7 +1699,7 @@ find_timestamps (MpegTSBase * base, guint64 initoff, guint64 * offset) GST_DEBUG ("Searching PCR"); ret = - process_pcr (base, total_bytes - 4000 * MPEGTS_MAX_PACKETSIZE, &final, 10, + process_pcr (base, scan_offset - 50 * MPEGTS_MAX_PACKETSIZE, &final, 10, FALSE); if (ret != GST_FLOW_OK) { @@ -911,8 +1707,11 @@ find_timestamps (MpegTSBase * base, guint64 initoff, guint64 * offset) goto beach; } - demux->duration = final - initial; + verify_timestamps (base, &initial, &final); + gst_segment_set_duration (&demux->segment, GST_FORMAT_TIME, + demux->last_pcr.gsttime - demux->first_pcr.gsttime); + demux->duration = demux->last_pcr.gsttime - demux->first_pcr.gsttime; GST_DEBUG ("Done, duration:%" GST_TIME_FORMAT, GST_TIME_ARGS (demux->duration)); @@ -920,13 +1719,17 @@ beach: mpegts_packetizer_clear (base->packetizer); /* Remove current program */ + if (base->pat) { + gst_structure_free (base->pat); + base->pat = NULL; + } mpegts_base_remove_program (base, demux->current_program_number); return ret; } static GstFlowReturn -process_pcr (MpegTSBase * base, guint64 initoff, GstClockTime * pcr, +process_pcr (MpegTSBase * base, guint64 initoff, TSPcrOffset * pcroffset, guint numpcr, gboolean isinitial) { GstTSDemux *demux = GST_TS_DEMUX (base); @@ -977,29 +1780,38 @@ process_pcr (MpegTSBase * base, guint64 initoff, GstClockTime * pcr, offset = 0; size = GST_BUFFER_SIZE (buf); - /* FIXME : We should jump to next packet instead of scanning everything */ - while ((size >= br.size) && (nbpcr < numpcr) - && (offset = - gst_byte_reader_masked_scan_uint32 (&br, pcrmask, pcrpattern, - offset, size)) != -1) { + resync: + offset = gst_byte_reader_masked_scan_uint32 (&br, 0xff000000, 0x47000000, + 0, base->packetsize); + + if (offset == -1) + continue; + + while ((nbpcr < numpcr) && (size >= base->packetsize)) { + + guint32 header = GST_READ_UINT32_BE (br.data + offset); + + if ((header >> 24) != 0x47) + goto resync; + + if ((header & pcrmask) != pcrpattern) { + /* Move offset forward by 1 packet */ + size -= base->packetsize; + offset += base->packetsize; + continue; + } + /* Potential PCR */ /* GST_DEBUG ("offset %" G_GUINT64_FORMAT, GST_BUFFER_OFFSET (buf) + offset); GST_MEMDUMP ("something", GST_BUFFER_DATA (buf) + offset, 16);*/ - if ((*(br.data + offset + 5)) & 0x10) { - guint16 pcr2; - guint64 pcr, pcr_ext; + if ((*(br.data + offset + 5)) & MPEGTS_AFC_PCR_FLAG) { + guint64 lpcr = mpegts_packetizer_compute_pcr (br.data + offset + 6); - pcr = ((guint64) GST_READ_UINT32_BE (br.data + offset + 6)) << 1; - pcr2 = GST_READ_UINT16_BE (br.data + offset + 10); - pcr |= (pcr2 & 0x8000) >> 15; - pcr_ext = (pcr2 & 0x01ff); - pcr = pcr * 300 + pcr_ext % 300; - - GST_DEBUG ("Found PCR %" G_GUINT64_FORMAT " %" GST_TIME_FORMAT - " at offset %" G_GUINT64_FORMAT, pcr, - GST_TIME_ARGS (PCRTIME_TO_GSTTIME (pcr)), + GST_INFO ("Found PCR %" G_GUINT64_FORMAT " %" GST_TIME_FORMAT + " at offset %" G_GUINT64_FORMAT, lpcr, + GST_TIME_ARGS (PCRTIME_TO_GSTTIME (lpcr)), GST_BUFFER_OFFSET (buf) + offset); - pcrs[nbpcr] = pcr; + pcrs[nbpcr] = lpcr; pcroffs[nbpcr] = GST_BUFFER_OFFSET (buf) + offset; /* Safeguard against bogus PCR (by detecting if it's the same as the * previous one or wheter the difference with the previous one is @@ -1007,6 +1819,9 @@ process_pcr (MpegTSBase * base, guint64 initoff, GstClockTime * pcr, if (nbpcr > 1) { if (pcrs[nbpcr] == pcrs[nbpcr - 1]) { GST_WARNING ("Found same PCR at different offset"); + } else if (pcrs[nbpcr] < pcrs[nbpcr - 1]) { + GST_WARNING ("Found PCR wraparound"); + nbpcr += 1; } else if ((pcrs[nbpcr] - pcrs[nbpcr - 1]) > (guint64) 10 * 60 * 27000000) { GST_WARNING ("PCR differs with previous PCR by more than 10 mins"); @@ -1015,20 +1830,22 @@ process_pcr (MpegTSBase * base, guint64 initoff, GstClockTime * pcr, } else nbpcr += 1; } - /* Move offset forward by 1 */ - size -= offset + 1; - offset += 1; - + /* Move offset forward by 1 packet */ + size -= base->packetsize; + offset += base->packetsize; } } beach: GST_DEBUG ("Found %d PCR", nbpcr); if (nbpcr) { - if (isinitial) - *pcr = PCRTIME_TO_GSTTIME (pcrs[0]); - else - *pcr = PCRTIME_TO_GSTTIME (pcrs[nbpcr - 1]); + if (isinitial) { + pcroffset->pcr = pcrs[0]; + pcroffset->offset = pcroffs[0]; + } else { + pcroffset->pcr = pcrs[nbpcr - 1]; + pcroffset->offset = pcroffs[nbpcr - 1]; + } GST_DEBUG ("pcrdiff:%" GST_TIME_FORMAT " offsetdiff %" G_GUINT64_FORMAT, GST_TIME_ARGS (PCRTIME_TO_GSTTIME (pcrs[nbpcr - 1] - pcrs[0])), pcroffs[nbpcr - 1] - pcroffs[0]); @@ -1057,6 +1874,18 @@ gst_ts_demux_record_pcr (GstTSDemux * demux, TSDemuxStream * stream, G_GUINT64_FORMAT, bs->pid, GST_TIME_ARGS (PCRTIME_TO_GSTTIME (pcr)), offset); + if (G_LIKELY (bs->pid == demux->program->pcr_pid)) { + demux->cur_pcr.gsttime = GST_CLOCK_TIME_NONE; + demux->cur_pcr.offset = offset; + demux->cur_pcr.pcr = pcr; + /* set first_pcr in push mode */ + if (G_UNLIKELY (!demux->first_pcr.gsttime == GST_CLOCK_TIME_NONE)) { + demux->first_pcr.gsttime = PCRTIME_TO_GSTTIME (pcr); + demux->first_pcr.offset = offset; + demux->first_pcr.pcr = pcr; + } + } + if (G_UNLIKELY (demux->emit_statistics)) { GstStructure *st; st = gst_structure_id_empty_new (QUARK_TSDEMUX); @@ -1135,6 +1964,36 @@ gst_ts_demux_record_dts (GstTSDemux * demux, TSDemuxStream * stream, } } +static inline GstClockTime +calc_gsttime_from_pts (TSPcrOffset * start, guint64 pts) +{ + GstClockTime time = start->gsttime - PCRTIME_TO_GSTTIME (start->pcr); + + if (start->pcr > pts * 300) + time += PCRTIME_TO_GSTTIME (PCR_MAX_VALUE) + MPEGTIME_TO_GSTTIME (pts); + else + time += MPEGTIME_TO_GSTTIME (pts); + + return time; +} + +static gint +TSPcrOffset_find_offset (gconstpointer a, gconstpointer b, gpointer user_data) +{ + +/* GST_INFO ("a: %" GST_TIME_FORMAT " offset: %" G_GINT64_FORMAT, */ +/* GST_TIME_ARGS (((TSPcrOffset *) a)->gsttime), ((TSPcrOffset *) a)->offset); */ +/* GST_INFO ("b: %" GST_TIME_FORMAT " offset: %" G_GINT64_FORMAT, */ +/* GST_TIME_ARGS (((TSPcrOffset *) b)->gsttime), ((TSPcrOffset *) b)->offset); */ + + if (((TSPcrOffset *) a)->offset < ((TSPcrOffset *) b)->offset) + return -1; + else if (((TSPcrOffset *) a)->offset > ((TSPcrOffset *) b)->offset) + return 1; + else + return 0; +} + static GstFlowReturn gst_ts_demux_parse_pes_header (GstTSDemux * demux, TSDemuxStream * stream) { @@ -1157,7 +2016,8 @@ gst_ts_demux_parse_pes_header (GstTSDemux * demux, TSDemuxStream * stream) data += 4; length -= 4; if (G_UNLIKELY ((psc_stid & 0xffffff00) != 0x00000100)) { - GST_WARNING ("WRONG PACKET START CODE !"); + GST_WARNING ("WRONG PACKET START CODE! pid: 0x%x stream_type: 0x%x", + stream->stream.pid, stream->stream.stream_type); goto discont; } stid = psc_stid & 0x000000ff; @@ -1209,12 +2069,32 @@ gst_ts_demux_parse_pes_header (GstTSDemux * demux, TSDemuxStream * stream) /* PTS 32 */ if ((p2 & 0x80)) { /* PTS */ + GstClockTime time; + guint64 offset = GST_BUFFER_OFFSET (stream->pendingbuffers[0]); + READ_TS (data, pts, discont); - gst_ts_demux_record_pts (demux, stream, pts, - GST_BUFFER_OFFSET (stream->pendingbuffers[0])); + gst_ts_demux_record_pts (demux, stream, pts, offset); length -= 4; - GST_BUFFER_TIMESTAMP (stream->pendingbuffers[0]) = - MPEGTIME_TO_GSTTIME (pts); + + if (demux->index_pcr.offset + PCR_WRAP_SIZE_128KBPS + 1000 * 128 < offset + || (demux->index_pcr.offset > offset)) { + /* find next entry */ + TSPcrOffset *next; + demux->index_pcr.offset = offset; + next = gst_util_array_binary_search (demux->index->data, + demux->index_size, sizeof (*next), TSPcrOffset_find_offset, + GST_SEARCH_MODE_BEFORE, &demux->index_pcr, NULL); + if (next) { + GST_INFO ("new index_pcr %" GST_TIME_FORMAT " offset: %" + G_GINT64_FORMAT, GST_TIME_ARGS (next->gsttime), next->offset); + + demux->index_pcr = *next; + } + } + + time = calc_gsttime_from_pts (&demux->index_pcr, pts); + + GST_BUFFER_TIMESTAMP (stream->pendingbuffers[0]) = time; if (!GST_CLOCK_TIME_IS_VALID (stream->pts)) { stream->pts = GST_BUFFER_TIMESTAMP (stream->pendingbuffers[0]); @@ -1339,7 +2219,6 @@ gst_ts_demux_push_pending_data (GstTSDemux * demux, TSDemuxStream * stream) guint i; GstClockTime tinypts = GST_CLOCK_TIME_NONE; - GstClockTime stop = GST_CLOCK_TIME_NONE; GstEvent *newsegmentevent; GST_DEBUG ("stream:%p, pid:0x%04x stream_type:%d state:%d pad:%s:%s", @@ -1376,30 +2255,45 @@ gst_ts_demux_push_pending_data (GstTSDemux * demux, TSDemuxStream * stream) tinypts)) tinypts = ((TSDemuxStream *) demux->program->streams[i])->pts; } - - } - if (GST_CLOCK_TIME_IS_VALID (demux->duration)) - stop = tinypts + demux->duration; - - GST_DEBUG ("Sending newsegment event"); + GST_DEBUG ("old segment: tinypts: %" GST_TIME_FORMAT " stop: %" + GST_TIME_FORMAT " time: %" GST_TIME_FORMAT, + GST_TIME_ARGS (tinypts), + GST_TIME_ARGS (demux->first_pcr.gsttime + demux->duration), + GST_TIME_ARGS (tinypts - demux->first_pcr.gsttime)); +/* newsegmentevent = */ +/* gst_event_new_new_segment (0, 1.0, GST_FORMAT_TIME, tinypts, */ +/* demux->first_pcr.gsttime + demux->duration, */ +/* tinypts - demux->first_pcr.gsttime); */ + GST_DEBUG ("new segment: start: %" GST_TIME_FORMAT " stop: %" + GST_TIME_FORMAT " time: %" GST_TIME_FORMAT, + GST_TIME_ARGS (demux->first_pcr.gsttime + demux->segment.start), + GST_TIME_ARGS (demux->first_pcr.gsttime + demux->segment.duration), + GST_TIME_ARGS (demux->segment.time)); newsegmentevent = - gst_event_new_new_segment (0, 1.0, GST_FORMAT_TIME, tinypts, stop, - 0); + gst_event_new_new_segment (0, 1.0, GST_FORMAT_TIME, + demux->first_pcr.gsttime + demux->segment.start, + demux->first_pcr.gsttime + demux->segment.duration, + demux->segment.time); push_event ((MpegTSBase *) demux, newsegmentevent); demux->need_newsegment = FALSE; } - GST_DEBUG_OBJECT (stream->pad, "Pushing buffer list "); + GST_DEBUG_OBJECT (stream->pad, + "Pushing buffer list with timestamp: %" GST_TIME_FORMAT, + GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (gst_buffer_list_get + (stream->current, 0, 0)))); res = gst_pad_push_list (stream->pad, stream->current); GST_DEBUG_OBJECT (stream->pad, "Returned %s", gst_flow_get_name (res)); /* FIXME : combine flow returns */ res = tsdemux_combine_flows (demux, stream, res); GST_DEBUG_OBJECT (stream->pad, "combined %s", gst_flow_get_name (res)); + } else { + gst_buffer_list_unref (stream->current); } } @@ -1437,6 +2331,8 @@ gst_ts_demux_handle_packet (GstTSDemux * demux, TSDemuxStream * stream, if (section) { GST_DEBUG ("section complete:%d, buffer size %d", section->complete, GST_BUFFER_SIZE (section->buffer)); + gst_buffer_unref (packet->buffer); + return res; } if (G_UNLIKELY (packet->payload_unit_start_indicator)) @@ -1454,6 +2350,8 @@ gst_ts_demux_handle_packet (GstTSDemux * demux, TSDemuxStream * stream, if (packet->payload) gst_ts_demux_queue_data (demux, stream, packet); + else + gst_buffer_unref (packet->buffer); return res; } diff --git a/gst/mpegtsdemux/tsdemux.h b/gst/mpegtsdemux/tsdemux.h index bfee2df42e..636bc3a67d 100644 --- a/gst/mpegtsdemux/tsdemux.h +++ b/gst/mpegtsdemux/tsdemux.h @@ -48,6 +48,14 @@ G_BEGIN_DECLS #define GST_TS_DEMUX_CAST(obj) ((GstTSDemux*) obj) typedef struct _GstTSDemux GstTSDemux; typedef struct _GstTSDemuxClass GstTSDemuxClass; +typedef struct _TSPcrOffset TSPcrOffset; + +struct _TSPcrOffset +{ + guint64 gsttime; + guint64 pcr; + guint64 offset; +}; struct _GstTSDemux { @@ -62,7 +70,16 @@ struct _GstTSDemux MpegTSBaseProgram *program; /* Current program */ guint current_program_number; gboolean need_newsegment; + GstSegment segment; GstClockTime duration; /* Total duration */ + + /* pcr wrap and seeking */ + GArray *index; + gint index_size; + TSPcrOffset first_pcr; + TSPcrOffset last_pcr; + TSPcrOffset cur_pcr; + TSPcrOffset index_pcr; }; struct _GstTSDemuxClass diff --git a/gst/mpegtsmux/mpegtsmux.c b/gst/mpegtsmux/mpegtsmux.c index 0ed2403dd1..6ba24ec987 100644 --- a/gst/mpegtsmux/mpegtsmux.c +++ b/gst/mpegtsmux/mpegtsmux.c @@ -4,6 +4,8 @@ * Kapil Agrawal * Julien Moutte * + * Copyright (C) 2011 Jan Schmidt + * * This library is licensed under 4 different licenses and you * can choose to use it under the terms of any one of them. The * four licenses are the MPL 1.1, the LGPL, the GPL and the MIT @@ -111,7 +113,7 @@ static GstStaticPadTemplate mpegtsmux_sink_factory = "mpegversion = (int) { 1, 2, 4 }, " "systemstream = (boolean) false; " "video/x-dirac;" - "video/x-h264;" + "video/x-h264,stream-format=(string)byte-stream;" "audio/mpeg, " "mpegversion = (int) { 1, 2, 4 };" "audio/x-lpcm, " @@ -140,7 +142,7 @@ static gboolean new_packet_cb (guint8 * data, guint len, void *user_data, gint64 new_pcr); static void release_buffer_cb (guint8 * data, void *user_data); -static gboolean mpegtsdemux_prepare_srcpad (MpegTsMux * mux); +static void mpegtsdemux_prepare_srcpad (MpegTsMux * mux); static GstFlowReturn mpegtsmux_collected (GstCollectPads * pads, MpegTsMux * mux); static GstPad *mpegtsmux_request_new_pad (GstElement * element, @@ -190,8 +192,8 @@ mpegtsmux_class_init (MpegTsMuxClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_M2TS_MODE, g_param_spec_boolean ("m2ts-mode", "M2TS(192 bytes) Mode", - "Defines what packet size to use, normal TS format ie .ts(188 bytes) " - "or Blue-Ray disc ie .m2ts(192 bytes).", FALSE, + "Set to TRUE to output Blu-Ray disc format with 192 byte packets. " + "FALSE for standard TS format with 188 byte packets.", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PAT_INTERVAL, @@ -656,23 +658,18 @@ mpegtsmux_collected (GstCollectPads * pads, MpegTsMux * mux) GST_DEBUG_OBJECT (mux, "Pads collected"); - if (mux->first) { + if (G_UNLIKELY (mux->first)) { ret = mpegtsmux_create_streams (mux); if (G_UNLIKELY (ret != GST_FLOW_OK)) return ret; - best = mpegtsmux_choose_best_stream (mux); - - if (!mpegtsdemux_prepare_srcpad (mux)) { - GST_DEBUG_OBJECT (mux, "Failed to send new segment"); - goto new_seg_fail; - } + mpegtsdemux_prepare_srcpad (mux); mux->first = FALSE; - } else { - best = mpegtsmux_choose_best_stream (mux); } + best = mpegtsmux_choose_best_stream (mux); + if (best != NULL) { TsMuxProgram *prog = best->prog; GstBuffer *buf = best->queued_buf; @@ -680,8 +677,10 @@ mpegtsmux_collected (GstCollectPads * pads, MpegTsMux * mux) gboolean delta = TRUE; if (prog == NULL) { - GST_ELEMENT_ERROR (mux, STREAM, MUX, ("Stream is not associated with " - "any program"), (NULL)); + GST_ELEMENT_ERROR (mux, STREAM, MUX, + ("Stream on pad %" GST_PTR_FORMAT + " is not associated with any program", COLLECT_DATA_PAD (best)), + (NULL)); return GST_FLOW_ERROR; } @@ -718,7 +717,11 @@ mpegtsmux_collected (GstCollectPads * pads, MpegTsMux * mux) mux->is_delta = delta; while (tsmux_stream_bytes_in_buffer (best->stream) > 0) { if (!tsmux_write_stream_packet (mux->tsmux, best->stream)) { + /* Failed writing data for some reason. Set appropriate error */ GST_DEBUG_OBJECT (mux, "Failed to write data packet"); + GST_ELEMENT_ERROR (mux, STREAM, MUX, + ("Failed writing output data to stream %04x", best->stream->id), + (NULL)); goto write_fail; } } @@ -732,10 +735,7 @@ mpegtsmux_collected (GstCollectPads * pads, MpegTsMux * mux) } return ret; -new_seg_fail: - return GST_FLOW_ERROR; write_fail: - /* FIXME: Failed writing data for some reason. Should set appropriate error */ return mux->last_flow_ret; } @@ -811,141 +811,193 @@ mpegtsmux_release_pad (GstElement * element, GstPad * pad) gst_element_remove_pad (element, pad); } +static void +new_packet_common_init (MpegTsMux * mux, GstBuffer * buf, guint8 * data, + guint len) +{ + /* Packets should be at least 188 bytes, but check anyway */ + g_return_if_fail (len >= 2); + + if (!mux->streamheader_sent) { + guint pid = ((data[1] & 0x1f) << 8) | data[2]; + /* if it's a PAT or a PMT */ + if (pid == 0x00 || (pid >= TSMUX_START_PMT_PID && pid < TSMUX_START_ES_PID)) { + mux->streamheader = + g_list_append (mux->streamheader, gst_buffer_copy (buf)); + } else if (mux->streamheader) { + mpegtsdemux_set_header_on_caps (mux); + mux->streamheader_sent = TRUE; + } + } + + /* Set the caps on the buffer only after possibly setting the stream headers + * into the pad caps above */ + gst_buffer_set_caps (buf, GST_PAD_CAPS (mux->srcpad)); + + if (mux->is_delta) { + GST_LOG_OBJECT (mux, "marking as delta unit"); + GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); + } else { + GST_DEBUG_OBJECT (mux, "marking as non-delta unit"); + mux->is_delta = TRUE; + } +} + +static gboolean +new_packet_m2ts (MpegTsMux * mux, guint8 * data, guint len, gint64 new_pcr) +{ + GstBuffer *buf, *out_buf; + GstFlowReturn ret; + int chunk_bytes; + + GST_LOG_OBJECT (mux, "Have buffer with new_pcr=%" G_GINT64_FORMAT " size %d", + new_pcr, len); + + buf = gst_buffer_new_and_alloc (M2TS_PACKET_LENGTH); + if (G_UNLIKELY (buf == NULL)) { + GST_ELEMENT_ERROR (mux, STREAM, MUX, + ("Failed allocating output buffer"), (NULL)); + mux->last_flow_ret = GST_FLOW_ERROR; + return FALSE; + } + + new_packet_common_init (mux, buf, data, len); + + /* copies the TS data of 188 bytes to the m2ts buffer at an offset + of 4 bytes to leave space for writing the timestamp later */ + memcpy (GST_BUFFER_DATA (buf) + 4, data, len); + + if (new_pcr < 0) { + /* If theres no pcr in current ts packet then just add the packet + to the adapter for later output when we see a PCR */ + GST_LOG_OBJECT (mux, "Accumulating non-PCR packet"); + gst_adapter_push (mux->adapter, buf); + return TRUE; + } + + chunk_bytes = gst_adapter_available (mux->adapter); + + /* We have a new PCR, output anything in the adapter */ + if (mux->first_pcr) { + /* We can't generate sensible timestamps for anything that might + * be in the adapter preceding the first PCR and will hit a divide + * by zero, so empty the adapter. This is probably a null op. */ + gst_adapter_clear (mux->adapter); + /* Warn if we threw anything away */ + if (chunk_bytes) { + GST_ELEMENT_WARNING (mux, STREAM, MUX, + ("Discarding %d bytes from stream preceding first PCR", + chunk_bytes / M2TS_PACKET_LENGTH * NORMAL_TS_PACKET_LENGTH), + (NULL)); + chunk_bytes = 0; + } + mux->first_pcr = FALSE; + } + + if (chunk_bytes) { + /* Start the PCR offset counting at 192 bytes: At the end of the packet + * that had the last PCR */ + guint64 pcr_bytes = M2TS_PACKET_LENGTH, ts_rate; + + /* Include the pending packet size to get the ts_rate right */ + chunk_bytes += M2TS_PACKET_LENGTH; + + /* calculate rate based on latest and previous pcr values */ + ts_rate = gst_util_uint64_scale (chunk_bytes, CLOCK_FREQ_SCR, + (new_pcr - mux->previous_pcr)); + GST_LOG_OBJECT (mux, "Processing pending packets with ts_rate %" + G_GUINT64_FORMAT, ts_rate); + + while (1) { + guint64 cur_pcr; + + /* Loop, pulling packets of the adapter, updating their 4 byte + * timestamp header and pushing */ + + /* The header is the bottom 30 bits of the PCR, apparently not + * encoded into base + ext as in the packets themselves, so + * we can just interpolate, mask and insert */ + cur_pcr = (mux->previous_pcr + + gst_util_uint64_scale (pcr_bytes, CLOCK_FREQ_SCR, ts_rate)); + + out_buf = gst_adapter_take_buffer (mux->adapter, M2TS_PACKET_LENGTH); + if (G_UNLIKELY (!out_buf)) + break; + gst_buffer_set_caps (out_buf, GST_PAD_CAPS (mux->srcpad)); + GST_BUFFER_TIMESTAMP (out_buf) = MPEG_SYS_TIME_TO_GSTTIME (cur_pcr); + + /* Write the 4 byte timestamp value, bottom 30 bits only = PCR */ + GST_WRITE_UINT32_BE (GST_BUFFER_DATA (out_buf), cur_pcr & 0x3FFFFFFF); + + GST_LOG_OBJECT (mux, "Outputting a packet of length %d PCR %" + G_GUINT64_FORMAT, M2TS_PACKET_LENGTH, cur_pcr); + ret = gst_pad_push (mux->srcpad, out_buf); + if (G_UNLIKELY (ret != GST_FLOW_OK)) { + mux->last_flow_ret = ret; + return FALSE; + } + pcr_bytes += M2TS_PACKET_LENGTH; + } + } + + /* Finally, output the passed in packet */ + /* Only write the bottom 30 bits of the PCR */ + GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf), new_pcr & 0x3FFFFFFF); + GST_BUFFER_TIMESTAMP (buf) = MPEG_SYS_TIME_TO_GSTTIME (new_pcr); + + GST_LOG_OBJECT (mux, "Outputting a packet of length %d PCR %" + G_GUINT64_FORMAT, M2TS_PACKET_LENGTH, new_pcr); + ret = gst_pad_push (mux->srcpad, buf); + if (G_UNLIKELY (ret != GST_FLOW_OK)) { + mux->last_flow_ret = ret; + return FALSE; + } + + mux->previous_pcr = new_pcr; + + return TRUE; +} + +static gboolean +new_packet_normal_ts (MpegTsMux * mux, guint8 * data, guint len, gint64 new_pcr) +{ + GstBuffer *buf; + GstFlowReturn ret; + + /* Output a normal TS packet */ + GST_LOG_OBJECT (mux, "Outputting a packet of length %d", len); + buf = gst_buffer_new_and_alloc (len); + if (G_UNLIKELY (buf == NULL)) { + mux->last_flow_ret = GST_FLOW_ERROR; + return FALSE; + } + + new_packet_common_init (mux, buf, data, len); + + memcpy (GST_BUFFER_DATA (buf), data, len); + GST_BUFFER_TIMESTAMP (buf) = mux->last_ts; + + ret = gst_pad_push (mux->srcpad, buf); + if (G_UNLIKELY (ret != GST_FLOW_OK)) { + mux->last_flow_ret = ret; + return FALSE; + } + + return TRUE; +} + static gboolean new_packet_cb (guint8 * data, guint len, void *user_data, gint64 new_pcr) { /* Called when the TsMux has prepared a packet for output. Return FALSE * on error */ MpegTsMux *mux = (MpegTsMux *) user_data; - GstBuffer *buf, *out_buf; - GstFlowReturn ret; - gfloat current_ts; - gint64 m2ts_pcr, pcr_bytes, chunk_bytes; - gint8 *temp_ptr; - gint64 ts_rate; if (mux->m2ts_mode == TRUE) { - /* Enters when the m2ts-mode is set true */ - buf = gst_buffer_new_and_alloc (M2TS_PACKET_LENGTH); - if (mux->is_delta) { - GST_LOG_OBJECT (mux, "marking as delta unit"); - GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); - } else { - GST_DEBUG_OBJECT (mux, "marking as non-delta unit"); - mux->is_delta = TRUE; - } - if (G_UNLIKELY (buf == NULL)) { - mux->last_flow_ret = GST_FLOW_ERROR; - return FALSE; - } - gst_buffer_set_caps (buf, GST_PAD_CAPS (mux->srcpad)); - - /* copies the ts data of 188 bytes to the m2ts buffer at an offset - of 4 bytes of timestamp */ - memcpy (GST_BUFFER_DATA (buf) + 4, data, len); - - if (new_pcr >= 0) { - /*when there is a pcr value in ts data */ - pcr_bytes = 0; - if (mux->first_pcr) { - /*Incase of first pcr */ - /*writing the 4 byte timestamp value */ - GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf), new_pcr); - - GST_LOG_OBJECT (mux, "Outputting a packet of length %d", - M2TS_PACKET_LENGTH); - ret = gst_pad_push (mux->srcpad, buf); - if (G_UNLIKELY (ret != GST_FLOW_OK)) { - mux->last_flow_ret = ret; - return FALSE; - } - mux->first_pcr = FALSE; - mux->previous_pcr = new_pcr; - pcr_bytes = M2TS_PACKET_LENGTH; - } - chunk_bytes = gst_adapter_available (mux->adapter); - - if (G_UNLIKELY (chunk_bytes)) { - /* calculate rate based on latest and previous pcr values */ - ts_rate = ((chunk_bytes * STANDARD_TIME_CLOCK) / (new_pcr - - mux->previous_pcr)); - while (1) { - /*loop till all the accumulated ts packets are transformed to - m2ts packets and pushed */ - current_ts = ((gfloat) mux->previous_pcr / STANDARD_TIME_CLOCK) + - ((gfloat) pcr_bytes / ts_rate); - m2ts_pcr = (((gint64) (STANDARD_TIME_CLOCK * current_ts / 300) & - TWO_POW_33_MINUS1) * 300) + ((gint64) (STANDARD_TIME_CLOCK * - current_ts) % 300); - temp_ptr = (gint8 *) & m2ts_pcr; - - out_buf = gst_adapter_take_buffer (mux->adapter, M2TS_PACKET_LENGTH); - if (G_UNLIKELY (!out_buf)) - break; - gst_buffer_set_caps (out_buf, GST_PAD_CAPS (mux->srcpad)); - - /*writing the 4 byte timestamp value */ - GST_WRITE_UINT32_BE (GST_BUFFER_DATA (out_buf), m2ts_pcr); - - GST_LOG_OBJECT (mux, "Outputting a packet of length %d", - M2TS_PACKET_LENGTH); - ret = gst_pad_push (mux->srcpad, out_buf); - if (G_UNLIKELY (ret != GST_FLOW_OK)) { - mux->last_flow_ret = ret; - return FALSE; - } - pcr_bytes += M2TS_PACKET_LENGTH; - } - mux->previous_pcr = m2ts_pcr; - } - } else - /* If theres no pcr in current ts packet then push the packet - to an adapter, which is used to create m2ts packets */ - gst_adapter_push (mux->adapter, buf); - } else { - /* In case of Normal Ts packets */ - GST_LOG_OBJECT (mux, "Outputting a packet of length %d", len); - buf = gst_buffer_new_and_alloc (len); - if (G_UNLIKELY (buf == NULL)) { - mux->last_flow_ret = GST_FLOW_ERROR; - return FALSE; - } - gst_buffer_set_caps (buf, GST_PAD_CAPS (mux->srcpad)); - - memcpy (GST_BUFFER_DATA (buf), data, len); - GST_BUFFER_TIMESTAMP (buf) = mux->last_ts; - - if (!mux->streamheader_sent) { - guint pid = ((data[1] & 0x1f) << 8) | data[2]; - /* if it's a PAT or a PMT */ - if (pid == 0x00 || - (pid >= TSMUX_START_PMT_PID && pid < TSMUX_START_ES_PID)) { - mux->streamheader = - g_list_append (mux->streamheader, gst_buffer_copy (buf)); - } else if (mux->streamheader) { - mpegtsdemux_set_header_on_caps (mux); - mux->streamheader_sent = TRUE; - /* don't unset the streamheaders by pushing old caps */ - gst_buffer_set_caps (buf, GST_PAD_CAPS (mux->srcpad)); - } - } - - if (mux->is_delta) { - GST_LOG_OBJECT (mux, "marking as delta unit"); - GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); - } else { - GST_DEBUG_OBJECT (mux, "marking as non-delta unit"); - mux->is_delta = TRUE; - } - - ret = gst_pad_push (mux->srcpad, buf); - if (G_UNLIKELY (ret != GST_FLOW_OK)) { - mux->last_flow_ret = ret; - return FALSE; - } + return new_packet_m2ts (mux, data, len, new_pcr); } - return TRUE; + return new_packet_normal_ts (mux, data, len, new_pcr); } static void @@ -955,10 +1007,10 @@ mpegtsdemux_set_header_on_caps (MpegTsMux * mux) GstStructure *structure; GValue array = { 0 }; GValue value = { 0 }; - GstCaps *caps = GST_PAD_CAPS (mux->srcpad); + GstCaps *caps; GList *sh; - caps = gst_caps_make_writable (caps); + caps = gst_caps_copy (GST_PAD_CAPS (mux->srcpad)); structure = gst_caps_get_structure (caps, 0); g_value_init (&array, GST_TYPE_ARRAY); @@ -983,7 +1035,7 @@ mpegtsdemux_set_header_on_caps (MpegTsMux * mux) gst_caps_unref (caps); } -static gboolean +static void mpegtsdemux_prepare_srcpad (MpegTsMux * mux) { GstEvent *new_seg = @@ -994,17 +1046,13 @@ mpegtsdemux_prepare_srcpad (MpegTsMux * mux) (mux->m2ts_mode ? M2TS_PACKET_LENGTH : NORMAL_TS_PACKET_LENGTH), NULL); -// gst_static_pad_template_get_caps (&mpegtsmux_src_factory); - /* Set caps on src pad from our template and push new segment */ gst_pad_set_caps (mux->srcpad, caps); + gst_caps_unref (caps); if (!gst_pad_push_event (mux->srcpad, new_seg)) { - GST_WARNING_OBJECT (mux, "New segment event was not handled"); - return FALSE; + GST_WARNING_OBJECT (mux, "New segment event was not handled downstream"); } - - return TRUE; } static GstStateChangeReturn diff --git a/gst/mpegtsmux/mpegtsmux.h b/gst/mpegtsmux/mpegtsmux.h index a94b991843..b45dd34aad 100644 --- a/gst/mpegtsmux/mpegtsmux.h +++ b/gst/mpegtsmux/mpegtsmux.h @@ -163,18 +163,22 @@ struct MpegTsPadData { GType mpegtsmux_get_type (void); #define CLOCK_BASE 9LL -#define CLOCK_FREQ (CLOCK_BASE * 10000) +#define CLOCK_FREQ (CLOCK_BASE * 10000) /* 90 kHz PTS clock */ +#define CLOCK_FREQ_SCR (CLOCK_FREQ * 300) /* 27 MHz SCR clock */ #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)) +/* 27 MHz SCR conversions: */ +#define MPEG_SYS_TIME_TO_GSTTIME(time) (gst_util_uint64_scale ((time), \ + GST_USECOND, CLOCK_FREQ_SCR / 1000000)) +#define GSTTIME_TO_MPEG_SYS_TIME(time) (gst_util_uint64_scale ((time), \ + CLOCK_FREQ_SCR / 1000000, GST_USECOND)) + #define NORMAL_TS_PACKET_LENGTH 188 #define M2TS_PACKET_LENGTH 192 -#define STANDARD_TIME_CLOCK 27000000 -/*33 bits as 1 ie 0x1ffffffff*/ -#define TWO_POW_33_MINUS1 ((0xffffffff * 2) - 1) #define MAX_PROG_NUMBER 32 #define DEFAULT_PROG_ID 0 diff --git a/gst/mpegtsmux/mpegtsmux_aac.c b/gst/mpegtsmux/mpegtsmux_aac.c index 5afefc834a..c4336641d1 100644 --- a/gst/mpegtsmux/mpegtsmux_aac.c +++ b/gst/mpegtsmux/mpegtsmux_aac.c @@ -87,7 +87,6 @@ #include "mpegtsmux_aac.h" #include -GST_DEBUG_CATEGORY_EXTERN (mpegtsmux_debug); #define GST_CAT_DEFAULT mpegtsmux_debug GstBuffer * diff --git a/gst/mpegtsmux/mpegtsmux_h264.c b/gst/mpegtsmux/mpegtsmux_h264.c index 7188ce7c09..bdf7f2f0bd 100644 --- a/gst/mpegtsmux/mpegtsmux_h264.c +++ b/gst/mpegtsmux/mpegtsmux_h264.c @@ -87,7 +87,6 @@ #include "mpegtsmux_h264.h" #include -GST_DEBUG_CATEGORY_EXTERN (mpegtsmux_debug); #define GST_CAT_DEFAULT mpegtsmux_debug #define SPS_PPS_PERIOD GST_SECOND diff --git a/gst/mpegtsmux/tsmux/tsmux.c b/gst/mpegtsmux/tsmux/tsmux.c index 1a50e72246..72095d0cec 100644 --- a/gst/mpegtsmux/tsmux/tsmux.c +++ b/gst/mpegtsmux/tsmux/tsmux.c @@ -87,6 +87,8 @@ #include "tsmuxstream.h" #include "crc.h" +#define GST_CAT_DEFAULT mpegtsmux_debug + /* Maximum total data length for a PAT section is 1024 bytes, minus an * 8 byte header, then the length of each program entry is 32 bits, * then finally a 32 bit CRC. Thus the maximum number of programs in this mux @@ -723,7 +725,7 @@ tsmux_write_stream_packet (TsMux * mux, TsMuxStream * stream) /* Need to decide whether to write a new PCR in this packet */ if (stream->last_pcr == -1 || (cur_pcr - stream->last_pcr > - (TSMUX_CLOCK_FREQ / TSMUX_DEFAULT_PCR_FREQ))) { + (TSMUX_SYS_CLOCK_FREQ / TSMUX_DEFAULT_PCR_FREQ))) { stream->pi.flags |= TSMUX_PACKET_FLAG_ADAPTATION | TSMUX_PACKET_FLAG_WRITE_PCR; diff --git a/gst/mpegtsmux/tsmux/tsmuxcommon.h b/gst/mpegtsmux/tsmux/tsmuxcommon.h index 4bc7304cda..9657b30c8e 100644 --- a/gst/mpegtsmux/tsmux/tsmuxcommon.h +++ b/gst/mpegtsmux/tsmux/tsmuxcommon.h @@ -81,8 +81,7 @@ #define __TSMUX_COMMON_H__ #include - -#undef TS_DEBUG_ON +#include G_BEGIN_DECLS @@ -169,11 +168,8 @@ tsmux_put_ts (guint8 **pos, guint8 id, gint64 ts) tsmux_put16 (pos, ((ts << 1) & 0xfffe) | 0x01); } -#ifdef TS_DEBUG_ON -#define TS_DEBUG(...) g_print(__VA_ARGS__); g_print ("\n") -#else -#define TS_DEBUG(...) -#endif +GST_DEBUG_CATEGORY_EXTERN (mpegtsmux_debug); +#define TS_DEBUG GST_DEBUG G_END_DECLS diff --git a/gst/mpegtsmux/tsmux/tsmuxstream.c b/gst/mpegtsmux/tsmux/tsmuxstream.c index f147bfcdba..28112e134a 100644 --- a/gst/mpegtsmux/tsmux/tsmuxstream.c +++ b/gst/mpegtsmux/tsmux/tsmuxstream.c @@ -86,6 +86,8 @@ #include "tsmuxcommon.h" #include "tsmuxstream.h" +#define GST_CAT_DEFAULT mpegtsmux_debug + static guint8 tsmux_stream_pes_header_length (TsMuxStream * stream); static void tsmux_stream_write_pes_header (TsMuxStream * stream, guint8 * data); static void tsmux_stream_find_pts_dts_within (TsMuxStream * stream, guint bound, diff --git a/gst/mpegvideoparse/Makefile.am b/gst/mpegvideoparse/Makefile.am index 833661e8c3..4a52e27b5b 100644 --- a/gst/mpegvideoparse/Makefile.am +++ b/gst/mpegvideoparse/Makefile.am @@ -8,3 +8,17 @@ libgstmpegvideoparse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstmpegvideoparse_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = mpegvideoparse.h mpegpacketiser.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstmpegvideoparse -:SHARED libgstmpegvideoparse \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstmpegvideoparse_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstmpegvideoparse_la_CFLAGS) \ + -:LDFLAGS $(libgstmpegvideoparse_la_LDFLAGS) \ + $(libgstmpegvideoparse_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/mpegvideoparse/mpegvideoparse.c b/gst/mpegvideoparse/mpegvideoparse.c index 70fdc89af3..2f4e96cecf 100644 --- a/gst/mpegvideoparse/mpegvideoparse.c +++ b/gst/mpegvideoparse/mpegvideoparse.c @@ -434,6 +434,7 @@ mpegvideoparse_handle_picture (MpegVideoParse * mpegvideoparse, GstBuffer * buf) picture_type_name (hdr.pic_type)); /* FIXME: Can use the picture type and number of fields to track a * timestamp */ + break; } cur = mpeg_util_find_start_code (&sync_word, cur, end); } @@ -1022,10 +1023,10 @@ gst_mpegvideoparse_change_state (GstElement * element, static gboolean plugin_init (GstPlugin * plugin) { - GST_DEBUG_CATEGORY_INIT (mpv_parse_debug, "mpegvideoparse", 0, + GST_DEBUG_CATEGORY_INIT (mpv_parse_debug, "legacympegvideoparse", 0, "MPEG Video Parser"); - return gst_element_register (plugin, "mpegvideoparse", + return gst_element_register (plugin, "legacympegvideoparse", GST_RANK_PRIMARY, GST_TYPE_MPEGVIDEOPARSE); } diff --git a/gst/mve/Makefile.am b/gst/mve/Makefile.am index 9fd67dbc1b..272b918578 100644 --- a/gst/mve/Makefile.am +++ b/gst/mve/Makefile.am @@ -19,3 +19,17 @@ libgstmve_la_SOURCES = \ noinst_HEADERS = gstmvedemux.h gstmvemux.h mve.h EXTRA_DIST = TODO + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstmve -:SHARED libgstmve \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstmve_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstmve_la_CFLAGS) \ + -:LDFLAGS $(libgstmve_la_LDFLAGS) \ + $(libgstmve_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/mxf/Makefile.am b/gst/mxf/Makefile.am index 5567867960..ac6478e5c6 100644 --- a/gst/mxf/Makefile.am +++ b/gst/mxf/Makefile.am @@ -43,3 +43,16 @@ noinst_HEADERS = \ mxfvc3.h \ mxfdms1.h +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstmxf -:SHARED libgstmxf \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstmxf_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstmxf_la_CFLAGS) \ + -:LDFLAGS $(libgstmxf_la_LDFLAGS) \ + $(libgstmxf_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/mxf/mxfmux.c b/gst/mxf/mxfmux.c index a2922ae84e..6b0e79556f 100644 --- a/gst/mxf/mxfmux.c +++ b/gst/mxf/mxfmux.c @@ -409,8 +409,11 @@ gst_mxf_mux_request_new_pad (GstElement * element, GST_ERROR_OBJECT (mux, "Not our template"); return NULL; } - +#if GLIB_CHECK_VERSION(2,29,5) + pad_number = g_atomic_int_add ((gint *) & mux->n_pads, 1); +#else pad_number = g_atomic_int_exchange_and_add ((gint *) & mux->n_pads, 1); +#endif name = gst_mxf_mux_create_pad_name (templ, pad_number); GST_DEBUG_OBJECT (mux, "Creating pad '%s'", name); diff --git a/gst/nsf/Makefile.am b/gst/nsf/Makefile.am index 1311ff18b9..97038ab67e 100644 --- a/gst/nsf/Makefile.am +++ b/gst/nsf/Makefile.am @@ -34,3 +34,17 @@ libgstnsf_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstnsf.h $(NOSEFART_INCLUDES) EXTRA_DIST = + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstnsf -:SHARED libgstnsf \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstnsf_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstnsf_la_CFLAGS) \ + -:LDFLAGS $(libgstnsf_la_LDFLAGS) \ + $(libgstnsf_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/nsf/gstnsf.c b/gst/nsf/gstnsf.c index bb281173cd..63ab00141f 100644 --- a/gst/nsf/gstnsf.c +++ b/gst/nsf/gstnsf.c @@ -151,10 +151,8 @@ static void gst_nsfdec_class_init (GstNsfDec * klass) { GObjectClass *gobject_class; - GstElementClass *gstelement_class; gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; parent_class = GST_ELEMENT_CLASS (g_type_class_peek_parent (klass)); diff --git a/gst/nuvdemux/Makefile.am b/gst/nuvdemux/Makefile.am index e51156858a..35df358a23 100644 --- a/gst/nuvdemux/Makefile.am +++ b/gst/nuvdemux/Makefile.am @@ -8,3 +8,17 @@ libgstnuvdemux_la_SOURCES = gstnuvdemux.c libgstnuvdemux_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstnuvdemux.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstnuvdemux -:SHARED libgstnuvdemux \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstnuvdemux_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstnuvdemux_la_CFLAGS) \ + -:LDFLAGS $(libgstnuvdemux_la_LDFLAGS) \ + $(libgstnuvdemux_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/patchdetect/Makefile.am b/gst/patchdetect/Makefile.am new file mode 100644 index 0000000000..7c0e564d31 --- /dev/null +++ b/gst/patchdetect/Makefile.am @@ -0,0 +1,33 @@ +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_MAJORMINOR) \ + $(GST_BASE_LIBS) \ + $(GST_LIBS) \ + $(LIBM) +libgstpatchdetect_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstpatchdetect_la_LIBTOOLFLAGS = --tag=disable-static + +noinst_HEADERS = gstpatchdetect.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstpatchdetect -:SHARED libgstpatchdetect \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstpatchdetect_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstpatchdetect_la_CFLAGS) \ + -:LDFLAGS $(libgstpatchdetect_la_LDFLAGS) \ + $(libgstpatchdetect_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/patchdetect/gstpatchdetect.c b/gst/patchdetect/gstpatchdetect.c new file mode 100644 index 0000000000..af4d88319a --- /dev/null +++ b/gst/patchdetect/gstpatchdetect.c @@ -0,0 +1,1241 @@ +/* GStreamer + * Copyright (C) 2011 David Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received 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. + * + * + * Example launch line + * |[ + * gst-launch -v dv1394src ! dvdemux ! dvdec ! patchdetect ! xvimagesink + * ]| + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#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_pad_template (element_class, + gst_static_pad_template_get (&gst_patchdetect_sink_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_patchdetect_src_template)); + + gst_element_class_set_details_simple (element_class, "Color Patch Detector", + "Video/Analysis", "Detects color patches from a color calibration chart", + "David Schleef "); +} + +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) +{ + + patchdetect->sinkpad = + gst_pad_new_from_static_template (&gst_patchdetect_sink_template, "sink"); + + patchdetect->srcpad = + gst_pad_new_from_static_template (&gst_patchdetect_src_template, "src"); +} + +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 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 new file mode 100644 index 0000000000..1f29218aa8 --- /dev/null +++ b/gst/patchdetect/gstpatchdetect.h @@ -0,0 +1,61 @@ +/* GStreamer + * Copyright (C) 2011 David Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _GST_PATCHDETECT_H_ +#define _GST_PATCHDETECT_H_ + +#include + +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; + + GstPad *sinkpad; + GstPad *srcpad; + + 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/pcapparse/Makefile.am b/gst/pcapparse/Makefile.am index 838d7ad049..08a9d25ada 100644 --- a/gst/pcapparse/Makefile.am +++ b/gst/pcapparse/Makefile.am @@ -18,3 +18,16 @@ libgstpcapparse_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(WINSOCK2_LIBS) libgstpcapparse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstpcapparse_la_LIBTOOLFLAGS = --tag=disable-static +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstpcapparse -:SHARED libgstpcapparse \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstpcapparse_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstpcapparse_la_CFLAGS) \ + -:LDFLAGS $(libgstpcapparse_la_LDFLAGS) \ + $(libgstpcapparse_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ \ No newline at end of file diff --git a/gst/pnm/Makefile.am b/gst/pnm/Makefile.am index 0d3f49d2a5..e702131c07 100644 --- a/gst/pnm/Makefile.am +++ b/gst/pnm/Makefile.am @@ -4,5 +4,20 @@ libgstpnm_la_SOURCES = gstpnmutils.c gstpnm.c gstpnmdec.c gstpnmenc.c libgstpnm_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) libgstpnm_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_LIBS) -lgstvideo-@GST_MAJORMINOR@ libgstpnm_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstpnm_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstpnmdec.h gstpnmutils.h gstpnmenc.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstpnm -:SHARED libgstpnm \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstpnm_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstpnm_la_CFLAGS) \ + -:LDFLAGS $(libgstpnm_la_LDFLAGS) \ + $(libgstpnm_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/qtmux/Makefile.am b/gst/qtmux/Makefile.am deleted file mode 100644 index 7fbbcc01e9..0000000000 --- a/gst/qtmux/Makefile.am +++ /dev/null @@ -1,32 +0,0 @@ -# plugindir is set in configure - -plugin_LTLIBRARIES = libgstqtmux.la - -# sources used to compile this plug-in -libgstqtmux_la_SOURCES = gstqtmux.c \ - gstqtmoovrecover.c \ - gstqtmuxplugin.c \ - atoms.c \ - atomsrecovery.c \ - descriptors.c \ - properties.c \ - gstqtmuxmap.c - -# flags used to compile this plugin -# add other _CFLAGS and _LIBS as needed -libgstqtmux_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) -libgstqtmux_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgsttag-$(GST_MAJORMINOR) -libgstqtmux_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -libgstqtmux_la_LIBTOOLFLAGS = --tag=disable-static - -# headers we need but don't want installed -noinst_HEADERS = gstqtmux.h \ - gstqtmoovrecover.h \ - atoms.h \ - atomsrecovery.h \ - descriptors.h \ - properties.h \ - fourcc.h \ - ftypcc.h \ - gstqtmuxmap.h - diff --git a/gst/qtmux/atoms.c b/gst/qtmux/atoms.c deleted file mode 100644 index bdba5bc5ad..0000000000 --- a/gst/qtmux/atoms.c +++ /dev/null @@ -1,4429 +0,0 @@ -/* Quicktime muxer plugin for GStreamer - * Copyright (C) 2008-2010 Thiago Santos - * Copyright (C) 2008 Mark Nauwelaerts - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* - * Unless otherwise indicated, Source Code is licensed under MIT license. - * See further explanation attached in License Statement (distributed in the file - * LICENSE). - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#include "atoms.h" -#include -#include - -#include -#include -#include - -/** - * Creates a new AtomsContext for the given flavor. - */ -AtomsContext * -atoms_context_new (AtomsTreeFlavor flavor) -{ - AtomsContext *context = g_new0 (AtomsContext, 1); - context->flavor = flavor; - return context; -} - -/** - * Frees an AtomsContext and all memory associated with it - */ -void -atoms_context_free (AtomsContext * context) -{ - g_free (context); -} - -/* -- creation, initialization, clear and free functions -- */ - -#define SECS_PER_DAY (24 * 60 * 60) -#define LEAP_YEARS_FROM_1904_TO_1970 17 - -static guint64 -get_current_qt_time (void) -{ - GTimeVal timeval; - - g_get_current_time (&timeval); - /* FIXME this should use UTC coordinated time */ - return timeval.tv_sec + (((1970 - 1904) * (guint64) 365) + - LEAP_YEARS_FROM_1904_TO_1970) * SECS_PER_DAY; -} - -static void -common_time_info_init (TimeInfo * ti) -{ - ti->creation_time = ti->modification_time = get_current_qt_time (); - ti->timescale = 0; - ti->duration = 0; -} - -static void -atom_header_set (Atom * header, guint32 fourcc, gint32 size, gint64 ext_size) -{ - header->type = fourcc; - header->size = size; - header->extended_size = ext_size; -} - -static void -atom_clear (Atom * atom) -{ -} - -static void -atom_full_init (AtomFull * full, guint32 fourcc, gint32 size, gint64 ext_size, - guint8 version, guint8 flags[3]) -{ - atom_header_set (&(full->header), fourcc, size, ext_size); - full->version = version; - full->flags[0] = flags[0]; - full->flags[1] = flags[1]; - full->flags[2] = flags[2]; -} - -static void -atom_full_clear (AtomFull * full) -{ - atom_clear (&full->header); -} - -static void -atom_full_free (AtomFull * full) -{ - atom_full_clear (full); - g_free (full); -} - -static guint32 -atom_full_get_flags_as_uint (AtomFull * full) -{ - return full->flags[0] << 16 | full->flags[1] << 8 | full->flags[2]; -} - -static void -atom_full_set_flags_as_uint (AtomFull * full, guint32 flags_as_uint) -{ - full->flags[2] = flags_as_uint & 0xFF; - full->flags[1] = (flags_as_uint & 0xFF00) >> 8; - full->flags[0] = (flags_as_uint & 0xFF0000) >> 16; -} - -static AtomInfo * -build_atom_info_wrapper (Atom * atom, gpointer copy_func, gpointer free_func) -{ - AtomInfo *info = NULL; - - if (atom) { - info = g_new0 (AtomInfo, 1); - - info->atom = atom; - info->copy_data_func = copy_func; - info->free_func = free_func; - } - - return info; -} - -static GList * -atom_info_list_prepend_atom (GList * ai, Atom * atom, - AtomCopyDataFunc copy_func, AtomFreeFunc free_func) -{ - if (atom) - return g_list_prepend (ai, - build_atom_info_wrapper (atom, copy_func, free_func)); - else - return ai; -} - -static void -atom_info_list_free (GList * ai) -{ - while (ai) { - AtomInfo *info = (AtomInfo *) ai->data; - - info->free_func (info->atom); - g_free (info); - ai = g_list_delete_link (ai, ai); - } -} - -static AtomData * -atom_data_new (guint32 fourcc) -{ - AtomData *data = g_new0 (AtomData, 1); - - atom_header_set (&data->header, fourcc, 0, 0); - return data; -} - -static void -atom_data_alloc_mem (AtomData * data, guint32 size) -{ - if (data->data) { - g_free (data->data); - } - data->data = g_new0 (guint8, size); - data->datalen = size; -} - -static AtomData * -atom_data_new_from_gst_buffer (guint32 fourcc, const GstBuffer * buf) -{ - AtomData *data = atom_data_new (fourcc); - - atom_data_alloc_mem (data, GST_BUFFER_SIZE (buf)); - g_memmove (data->data, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); - return data; -} - -static void -atom_data_free (AtomData * data) -{ - atom_clear (&data->header); - g_free (data->data); - g_free (data); -} - -static AtomUUID * -atom_uuid_new (void) -{ - AtomUUID *uuid = g_new0 (AtomUUID, 1); - - atom_header_set (&uuid->header, FOURCC_uuid, 0, 0); - return uuid; -} - -static void -atom_uuid_free (AtomUUID * data) -{ - atom_clear (&data->header); - g_free (data->data); - g_free (data); -} - -static void -atom_ftyp_init (AtomFTYP * ftyp, guint32 major, guint32 version, GList * brands) -{ - gint index; - GList *it = NULL; - - atom_header_set (&ftyp->header, FOURCC_ftyp, 16, 0); - ftyp->major_brand = major; - ftyp->version = version; - - /* always include major brand as compatible brand */ - ftyp->compatible_brands_size = g_list_length (brands) + 1; - ftyp->compatible_brands = g_new (guint32, ftyp->compatible_brands_size); - - ftyp->compatible_brands[0] = major; - index = 1; - for (it = brands; it != NULL; it = g_list_next (it)) { - ftyp->compatible_brands[index++] = GPOINTER_TO_UINT (it->data); - } -} - -AtomFTYP * -atom_ftyp_new (AtomsContext * context, guint32 major, guint32 version, - GList * brands) -{ - AtomFTYP *ftyp = g_new0 (AtomFTYP, 1); - - atom_ftyp_init (ftyp, major, version, brands); - return ftyp; -} - -void -atom_ftyp_free (AtomFTYP * ftyp) -{ - atom_clear (&ftyp->header); - g_free (ftyp->compatible_brands); - ftyp->compatible_brands = NULL; - g_free (ftyp); -} - -static void -atom_esds_init (AtomESDS * esds) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&esds->header, FOURCC_esds, 0, 0, 0, flags); - desc_es_init (&esds->es); -} - -static AtomESDS * -atom_esds_new (void) -{ - AtomESDS *esds = g_new0 (AtomESDS, 1); - - atom_esds_init (esds); - return esds; -} - -static void -atom_esds_free (AtomESDS * esds) -{ - atom_full_clear (&esds->header); - desc_es_descriptor_clear (&esds->es); - g_free (esds); -} - -static AtomFRMA * -atom_frma_new (void) -{ - AtomFRMA *frma = g_new0 (AtomFRMA, 1); - - atom_header_set (&frma->header, FOURCC_frma, 0, 0); - return frma; -} - -static void -atom_frma_free (AtomFRMA * frma) -{ - atom_clear (&frma->header); - g_free (frma); -} - -static AtomWAVE * -atom_wave_new (void) -{ - AtomWAVE *wave = g_new0 (AtomWAVE, 1); - - atom_header_set (&wave->header, FOURCC_wave, 0, 0); - return wave; -} - -static void -atom_wave_free (AtomWAVE * wave) -{ - atom_clear (&wave->header); - atom_info_list_free (wave->extension_atoms); - g_free (wave); -} - -static void -atom_elst_init (AtomELST * elst) -{ - guint8 flags[3] = { 0, 0, 0 }; - atom_full_init (&elst->header, FOURCC_elst, 0, 0, 0, flags); - elst->entries = 0; -} - -static void -atom_elst_clear (AtomELST * elst) -{ - GSList *walker; - - atom_full_clear (&elst->header); - walker = elst->entries; - while (walker) { - g_free ((EditListEntry *) walker->data); - walker = g_slist_next (walker); - } - g_slist_free (elst->entries); -} - -static void -atom_edts_init (AtomEDTS * edts) -{ - atom_header_set (&edts->header, FOURCC_edts, 0, 0); - atom_elst_init (&edts->elst); -} - -static void -atom_edts_clear (AtomEDTS * edts) -{ - atom_clear (&edts->header); - atom_elst_clear (&edts->elst); -} - -static AtomEDTS * -atom_edts_new (void) -{ - AtomEDTS *edts = g_new0 (AtomEDTS, 1); - atom_edts_init (edts); - return edts; -} - -static void -atom_edts_free (AtomEDTS * edts) -{ - atom_edts_clear (edts); - g_free (edts); -} - -static void -atom_sample_entry_init (SampleTableEntry * se, guint32 type) -{ - atom_header_set (&se->header, type, 0, 0); - - memset (se->reserved, 0, sizeof (guint8) * 6); - se->data_reference_index = 0; -} - -static void -atom_sample_entry_free (SampleTableEntry * se) -{ - atom_clear (&se->header); -} - -static void -sample_entry_mp4a_init (SampleTableEntryMP4A * mp4a) -{ - atom_sample_entry_init (&mp4a->se, FOURCC_mp4a); - - mp4a->version = 0; - mp4a->revision_level = 0; - mp4a->vendor = 0; - mp4a->channels = 2; - mp4a->sample_size = 16; - mp4a->compression_id = 0; - mp4a->packet_size = 0; - mp4a->sample_rate = 0; - /* following only used if version is 1 */ - mp4a->samples_per_packet = 0; - mp4a->bytes_per_packet = 0; - mp4a->bytes_per_frame = 0; - mp4a->bytes_per_sample = 0; - - mp4a->extension_atoms = NULL; -} - -static SampleTableEntryMP4A * -sample_entry_mp4a_new (void) -{ - SampleTableEntryMP4A *mp4a = g_new0 (SampleTableEntryMP4A, 1); - - sample_entry_mp4a_init (mp4a); - return mp4a; -} - -static void -sample_entry_mp4a_free (SampleTableEntryMP4A * mp4a) -{ - atom_sample_entry_free (&mp4a->se); - atom_info_list_free (mp4a->extension_atoms); - g_free (mp4a); -} - -static void -sample_entry_mp4v_init (SampleTableEntryMP4V * mp4v, AtomsContext * context) -{ - atom_sample_entry_init (&mp4v->se, FOURCC_mp4v); - - mp4v->version = 0; - mp4v->revision_level = 0; - mp4v->vendor = 0; - - mp4v->temporal_quality = 0; - mp4v->spatial_quality = 0; - - /* qt and ISO base media do not contradict, and examples agree */ - mp4v->horizontal_resolution = 0x00480000; - mp4v->vertical_resolution = 0x00480000; - - mp4v->datasize = 0; - mp4v->frame_count = 1; - - memset (mp4v->compressor, 0, sizeof (guint8) * 32); - - mp4v->depth = 0; - mp4v->color_table_id = 0; - - mp4v->extension_atoms = NULL; -} - -static void -sample_entry_mp4v_free (SampleTableEntryMP4V * mp4v) -{ - atom_sample_entry_free (&mp4v->se); - atom_info_list_free (mp4v->extension_atoms); - g_free (mp4v); -} - -static SampleTableEntryMP4V * -sample_entry_mp4v_new (AtomsContext * context) -{ - SampleTableEntryMP4V *mp4v = g_new0 (SampleTableEntryMP4V, 1); - - sample_entry_mp4v_init (mp4v, context); - return mp4v; -} - -static void -atom_stsd_init (AtomSTSD * stsd) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&stsd->header, FOURCC_stsd, 0, 0, 0, flags); - stsd->entries = NULL; - stsd->n_entries = 0; -} - -static void -atom_stsd_remove_entries (AtomSTSD * stsd) -{ - GList *walker; - - walker = stsd->entries; - while (walker) { - GList *aux = walker; - SampleTableEntry *se = (SampleTableEntry *) aux->data; - - walker = g_list_next (walker); - stsd->entries = g_list_remove_link (stsd->entries, aux); - - switch (se->kind) { - case AUDIO: - sample_entry_mp4a_free ((SampleTableEntryMP4A *) se); - break; - case VIDEO: - sample_entry_mp4v_free ((SampleTableEntryMP4V *) se); - break; - default: - /* best possible cleanup */ - atom_sample_entry_free (se); - } - g_list_free (aux); - } - stsd->n_entries = 0; -} - -static void -atom_stsd_clear (AtomSTSD * stsd) -{ - atom_stsd_remove_entries (stsd); - atom_full_clear (&stsd->header); -} - -static void -atom_ctts_init (AtomCTTS * ctts) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&ctts->header, FOURCC_ctts, 0, 0, 0, flags); - atom_array_init (&ctts->entries, 128); - ctts->do_pts = FALSE; -} - -static AtomCTTS * -atom_ctts_new (void) -{ - AtomCTTS *ctts = g_new0 (AtomCTTS, 1); - - atom_ctts_init (ctts); - return ctts; -} - -static void -atom_ctts_free (AtomCTTS * ctts) -{ - atom_full_clear (&ctts->header); - atom_array_clear (&ctts->entries); - g_free (ctts); -} - -static void -atom_stts_init (AtomSTTS * stts) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&stts->header, FOURCC_stts, 0, 0, 0, flags); - atom_array_init (&stts->entries, 512); -} - -static void -atom_stts_clear (AtomSTTS * stts) -{ - atom_full_clear (&stts->header); - atom_array_clear (&stts->entries); -} - -static void -atom_stsz_init (AtomSTSZ * stsz) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&stsz->header, FOURCC_stsz, 0, 0, 0, flags); - atom_array_init (&stsz->entries, 1024); - stsz->sample_size = 0; - stsz->table_size = 0; -} - -static void -atom_stsz_clear (AtomSTSZ * stsz) -{ - atom_full_clear (&stsz->header); - atom_array_clear (&stsz->entries); - stsz->table_size = 0; -} - -static void -atom_stsc_init (AtomSTSC * stsc) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&stsc->header, FOURCC_stsc, 0, 0, 0, flags); - atom_array_init (&stsc->entries, 128); -} - -static void -atom_stsc_clear (AtomSTSC * stsc) -{ - atom_full_clear (&stsc->header); - atom_array_clear (&stsc->entries); -} - -static void -atom_co64_init (AtomSTCO64 * co64) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&co64->header, FOURCC_stco, 0, 0, 0, flags); - atom_array_init (&co64->entries, 256); -} - -static void -atom_stco64_clear (AtomSTCO64 * stco64) -{ - atom_full_clear (&stco64->header); - atom_array_clear (&stco64->entries); -} - -static void -atom_stss_init (AtomSTSS * stss) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&stss->header, FOURCC_stss, 0, 0, 0, flags); - atom_array_init (&stss->entries, 128); -} - -static void -atom_stss_clear (AtomSTSS * stss) -{ - atom_full_clear (&stss->header); - atom_array_clear (&stss->entries); -} - -void -atom_stbl_init (AtomSTBL * stbl) -{ - atom_header_set (&stbl->header, FOURCC_stbl, 0, 0); - - atom_stts_init (&stbl->stts); - atom_stss_init (&stbl->stss); - atom_stsd_init (&stbl->stsd); - atom_stsz_init (&stbl->stsz); - atom_stsc_init (&stbl->stsc); - stbl->ctts = NULL; - - atom_co64_init (&stbl->stco64); -} - -void -atom_stbl_clear (AtomSTBL * stbl) -{ - atom_clear (&stbl->header); - atom_stsd_clear (&stbl->stsd); - atom_stts_clear (&stbl->stts); - atom_stss_clear (&stbl->stss); - atom_stsc_clear (&stbl->stsc); - atom_stsz_clear (&stbl->stsz); - if (stbl->ctts) { - atom_ctts_free (stbl->ctts); - } - atom_stco64_clear (&stbl->stco64); -} - -static void -atom_vmhd_init (AtomVMHD * vmhd, AtomsContext * context) -{ - guint8 flags[3] = { 0, 0, 1 }; - - atom_full_init (&vmhd->header, FOURCC_vmhd, 0, 0, 0, flags); - vmhd->graphics_mode = 0x0; - memset (vmhd->opcolor, 0, sizeof (guint16) * 3); - - if (context->flavor == ATOMS_TREE_FLAVOR_MOV) { - vmhd->graphics_mode = 0x40; - vmhd->opcolor[0] = 32768; - vmhd->opcolor[1] = 32768; - vmhd->opcolor[2] = 32768; - } -} - -static AtomVMHD * -atom_vmhd_new (AtomsContext * context) -{ - AtomVMHD *vmhd = g_new0 (AtomVMHD, 1); - - atom_vmhd_init (vmhd, context); - return vmhd; -} - -static void -atom_vmhd_free (AtomVMHD * vmhd) -{ - atom_full_clear (&vmhd->header); - g_free (vmhd); -} - -static void -atom_smhd_init (AtomSMHD * smhd) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&smhd->header, FOURCC_smhd, 0, 0, 0, flags); - smhd->balance = 0; - smhd->reserved = 0; -} - -static AtomSMHD * -atom_smhd_new (void) -{ - AtomSMHD *smhd = g_new0 (AtomSMHD, 1); - - atom_smhd_init (smhd); - return smhd; -} - -static void -atom_smhd_free (AtomSMHD * smhd) -{ - atom_full_clear (&smhd->header); - g_free (smhd); -} - -static void -atom_hmhd_free (AtomHMHD * hmhd) -{ - atom_full_clear (&hmhd->header); - g_free (hmhd); -} - -static void -atom_hdlr_init (AtomHDLR * hdlr) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&hdlr->header, FOURCC_hdlr, 0, 0, 0, flags); - - hdlr->component_type = 0; - hdlr->handler_type = 0; - hdlr->manufacturer = 0; - hdlr->flags = 0; - hdlr->flags_mask = 0; - hdlr->name = g_strdup (""); -} - -static AtomHDLR * -atom_hdlr_new (void) -{ - AtomHDLR *hdlr = g_new0 (AtomHDLR, 1); - - atom_hdlr_init (hdlr); - return hdlr; -} - -static void -atom_hdlr_clear (AtomHDLR * hdlr) -{ - atom_full_clear (&hdlr->header); - if (hdlr->name) { - g_free (hdlr->name); - hdlr->name = NULL; - } -} - -static void -atom_hdlr_free (AtomHDLR * hdlr) -{ - atom_hdlr_clear (hdlr); - g_free (hdlr); -} - -static void -atom_url_init (AtomURL * url) -{ - guint8 flags[3] = { 0, 0, 1 }; - - atom_full_init (&url->header, FOURCC_url_, 0, 0, 0, flags); - url->location = NULL; -} - -static void -atom_url_free (AtomURL * url) -{ - atom_full_clear (&url->header); - if (url->location) { - g_free (url->location); - url->location = NULL; - } - g_free (url); -} - -static AtomURL * -atom_url_new (void) -{ - AtomURL *url = g_new0 (AtomURL, 1); - - atom_url_init (url); - return url; -} - -static AtomFull * -atom_alis_new (void) -{ - guint8 flags[3] = { 0, 0, 1 }; - AtomFull *alis = g_new0 (AtomFull, 1); - - atom_full_init (alis, FOURCC_alis, 0, 0, 0, flags); - return alis; -} - -static void -atom_dref_init (AtomDREF * dref, AtomsContext * context) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&dref->header, FOURCC_dref, 0, 0, 0, flags); - - /* in either case, alis or url init arranges to set self-contained flag */ - if (context->flavor == ATOMS_TREE_FLAVOR_MOV) { - /* alis dref for qt */ - AtomFull *alis = atom_alis_new (); - dref->entries = g_list_append (dref->entries, alis); - } else { - /* url for iso spec, as 'alis' not specified there */ - AtomURL *url = atom_url_new (); - dref->entries = g_list_append (dref->entries, url); - } -} - -static void -atom_dref_clear (AtomDREF * dref) -{ - GList *walker; - - atom_full_clear (&dref->header); - walker = dref->entries; - while (walker) { - GList *aux = walker; - Atom *atom = (Atom *) aux->data; - - walker = g_list_next (walker); - dref->entries = g_list_remove_link (dref->entries, aux); - switch (atom->type) { - case FOURCC_alis: - atom_full_free ((AtomFull *) atom); - break; - case FOURCC_url_: - atom_url_free ((AtomURL *) atom); - break; - default: - /* we do nothing, better leak than crash */ - break; - } - g_list_free (aux); - } -} - -static void -atom_dinf_init (AtomDINF * dinf, AtomsContext * context) -{ - atom_header_set (&dinf->header, FOURCC_dinf, 0, 0); - atom_dref_init (&dinf->dref, context); -} - -static void -atom_dinf_clear (AtomDINF * dinf) -{ - atom_clear (&dinf->header); - atom_dref_clear (&dinf->dref); -} - -static void -atom_minf_init (AtomMINF * minf, AtomsContext * context) -{ - atom_header_set (&minf->header, FOURCC_minf, 0, 0); - - minf->vmhd = NULL; - minf->smhd = NULL; - minf->hmhd = NULL; - - if (context->flavor == ATOMS_TREE_FLAVOR_MOV) { - minf->hdlr = atom_hdlr_new (); - minf->hdlr->component_type = FOURCC_dhlr; - minf->hdlr->handler_type = FOURCC_alis; - } else { - minf->hdlr = NULL; - } - atom_dinf_init (&minf->dinf, context); - atom_stbl_init (&minf->stbl); -} - -static void -atom_minf_clear_handlers (AtomMINF * minf) -{ - if (minf->vmhd) { - atom_vmhd_free (minf->vmhd); - minf->vmhd = NULL; - } - if (minf->smhd) { - atom_smhd_free (minf->smhd); - minf->smhd = NULL; - } - if (minf->hmhd) { - atom_hmhd_free (minf->hmhd); - minf->hmhd = NULL; - } -} - -static void -atom_minf_clear (AtomMINF * minf) -{ - atom_clear (&minf->header); - atom_minf_clear_handlers (minf); - if (minf->hdlr) { - atom_hdlr_free (minf->hdlr); - } - atom_dinf_clear (&minf->dinf); - atom_stbl_clear (&minf->stbl); -} - -static void -atom_mdhd_init (AtomMDHD * mdhd) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&mdhd->header, FOURCC_mdhd, 0, 0, 0, flags); - common_time_info_init (&mdhd->time_info); - mdhd->language_code = 0; - mdhd->quality = 0; -} - -static void -atom_mdhd_clear (AtomMDHD * mdhd) -{ - atom_full_clear (&mdhd->header); -} - -static void -atom_mdia_init (AtomMDIA * mdia, AtomsContext * context) -{ - atom_header_set (&mdia->header, FOURCC_mdia, 0, 0); - - atom_mdhd_init (&mdia->mdhd); - atom_hdlr_init (&mdia->hdlr); - atom_minf_init (&mdia->minf, context); -} - -static void -atom_mdia_clear (AtomMDIA * mdia) -{ - atom_clear (&mdia->header); - atom_mdhd_clear (&mdia->mdhd); - atom_hdlr_clear (&mdia->hdlr); - atom_minf_clear (&mdia->minf); -} - -static void -atom_tkhd_init (AtomTKHD * tkhd, AtomsContext * context) -{ - /* - * flags info - * 1 -> track enabled - * 2 -> track in movie - * 4 -> track in preview - */ - guint8 flags[3] = { 0, 0, 7 }; - - atom_full_init (&tkhd->header, FOURCC_tkhd, 0, 0, 0, flags); - - tkhd->creation_time = tkhd->modification_time = get_current_qt_time (); - tkhd->duration = 0; - tkhd->track_ID = 0; - tkhd->reserved = 0; - - tkhd->reserved2[0] = tkhd->reserved2[1] = 0; - tkhd->layer = 0; - tkhd->alternate_group = 0; - tkhd->volume = 0; - tkhd->reserved3 = 0; - memset (tkhd->matrix, 0, sizeof (guint32) * 9); - tkhd->matrix[0] = 1 << 16; - tkhd->matrix[4] = 1 << 16; - tkhd->matrix[8] = 16384 << 16; - tkhd->width = 0; - tkhd->height = 0; -} - -static void -atom_tkhd_clear (AtomTKHD * tkhd) -{ - atom_full_clear (&tkhd->header); -} - -static void -atom_trak_init (AtomTRAK * trak, AtomsContext * context) -{ - atom_header_set (&trak->header, FOURCC_trak, 0, 0); - - atom_tkhd_init (&trak->tkhd, context); - trak->edts = NULL; - atom_mdia_init (&trak->mdia, context); -} - -AtomTRAK * -atom_trak_new (AtomsContext * context) -{ - AtomTRAK *trak = g_new0 (AtomTRAK, 1); - - atom_trak_init (trak, context); - return trak; -} - -static void -atom_trak_clear (AtomTRAK * trak) -{ - atom_clear (&trak->header); - atom_tkhd_clear (&trak->tkhd); - if (trak->edts) - atom_edts_free (trak->edts); - atom_mdia_clear (&trak->mdia); -} - -static void -atom_trak_free (AtomTRAK * trak) -{ - atom_trak_clear (trak); - g_free (trak); -} - -static void -atom_ilst_init (AtomILST * ilst) -{ - atom_header_set (&ilst->header, FOURCC_ilst, 0, 0); - ilst->entries = NULL; -} - -static AtomILST * -atom_ilst_new (void) -{ - AtomILST *ilst = g_new0 (AtomILST, 1); - - atom_ilst_init (ilst); - return ilst; -} - -static void -atom_ilst_free (AtomILST * ilst) -{ - if (ilst->entries) - atom_info_list_free (ilst->entries); - atom_clear (&ilst->header); - g_free (ilst); -} - -static void -atom_meta_init (AtomMETA * meta) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&meta->header, FOURCC_meta, 0, 0, 0, flags); - atom_hdlr_init (&meta->hdlr); - /* FIXME (ISOM says this is always 0) */ - meta->hdlr.component_type = FOURCC_mhlr; - meta->hdlr.handler_type = FOURCC_mdir; - meta->ilst = NULL; -} - -static AtomMETA * -atom_meta_new (void) -{ - AtomMETA *meta = g_new0 (AtomMETA, 1); - - atom_meta_init (meta); - return meta; -} - -static void -atom_meta_free (AtomMETA * meta) -{ - atom_full_clear (&meta->header); - atom_hdlr_clear (&meta->hdlr); - if (meta->ilst) - atom_ilst_free (meta->ilst); - meta->ilst = NULL; - g_free (meta); -} - -static void -atom_udta_init (AtomUDTA * udta) -{ - atom_header_set (&udta->header, FOURCC_udta, 0, 0); - udta->meta = NULL; -} - -static AtomUDTA * -atom_udta_new (void) -{ - AtomUDTA *udta = g_new0 (AtomUDTA, 1); - - atom_udta_init (udta); - return udta; -} - -static void -atom_udta_free (AtomUDTA * udta) -{ - atom_clear (&udta->header); - if (udta->meta) - atom_meta_free (udta->meta); - udta->meta = NULL; - if (udta->entries) - atom_info_list_free (udta->entries); - g_free (udta); -} - -static void -atom_tag_data_init (AtomTagData * data) -{ - guint8 flags[] = { 0, 0, 0 }; - - atom_full_init (&data->header, FOURCC_data, 0, 0, 0, flags); -} - -static void -atom_tag_data_clear (AtomTagData * data) -{ - atom_full_clear (&data->header); - g_free (data->data); - data->datalen = 0; -} - -/* - * Fourcc is the tag fourcc - * flags will be truncated to 24bits - */ -static AtomTag * -atom_tag_new (guint32 fourcc, guint32 flags_as_uint) -{ - AtomTag *tag = g_new0 (AtomTag, 1); - - tag->header.type = fourcc; - atom_tag_data_init (&tag->data); - atom_full_set_flags_as_uint (&tag->data.header, flags_as_uint); - return tag; -} - -static void -atom_tag_free (AtomTag * tag) -{ - atom_clear (&tag->header); - atom_tag_data_clear (&tag->data); - g_free (tag); -} - -static void -atom_mvhd_init (AtomMVHD * mvhd) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&(mvhd->header), FOURCC_mvhd, sizeof (AtomMVHD), 0, 0, flags); - - common_time_info_init (&mvhd->time_info); - - mvhd->prefered_rate = 1 << 16; - mvhd->volume = 1 << 8; - mvhd->reserved3 = 0; - memset (mvhd->reserved4, 0, sizeof (guint32[2])); - - memset (mvhd->matrix, 0, sizeof (guint32[9])); - mvhd->matrix[0] = 1 << 16; - mvhd->matrix[4] = 1 << 16; - mvhd->matrix[8] = 16384 << 16; - - mvhd->preview_time = 0; - mvhd->preview_duration = 0; - mvhd->poster_time = 0; - mvhd->selection_time = 0; - mvhd->selection_duration = 0; - mvhd->current_time = 0; - - mvhd->next_track_id = 1; -} - -static void -atom_mvhd_clear (AtomMVHD * mvhd) -{ - atom_full_clear (&mvhd->header); -} - -static void -atom_mehd_init (AtomMEHD * mehd) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&mehd->header, FOURCC_mehd, 0, 0, 1, flags); - mehd->fragment_duration = 0; -} - -static void -atom_mvex_init (AtomMVEX * mvex) -{ - atom_header_set (&mvex->header, FOURCC_mvex, 0, 0); - atom_mehd_init (&mvex->mehd); - mvex->trexs = NULL; -} - -static void -atom_moov_init (AtomMOOV * moov, AtomsContext * context) -{ - atom_header_set (&(moov->header), FOURCC_moov, 0, 0); - atom_mvhd_init (&(moov->mvhd)); - atom_mvex_init (&(moov->mvex)); - moov->udta = NULL; - moov->traks = NULL; - moov->context = *context; -} - -AtomMOOV * -atom_moov_new (AtomsContext * context) -{ - AtomMOOV *moov = g_new0 (AtomMOOV, 1); - - atom_moov_init (moov, context); - return moov; -} - -static void -atom_trex_free (AtomTREX * trex) -{ - atom_full_clear (&trex->header); - g_free (trex); -} - -static void -atom_mvex_clear (AtomMVEX * mvex) -{ - GList *walker; - - atom_clear (&mvex->header); - walker = mvex->trexs; - while (walker) { - atom_trex_free ((AtomTREX *) walker->data); - walker = g_list_next (walker); - } - g_list_free (mvex->trexs); - mvex->trexs = NULL; -} - -void -atom_moov_free (AtomMOOV * moov) -{ - GList *walker; - - atom_clear (&moov->header); - atom_mvhd_clear (&moov->mvhd); - - walker = moov->traks; - while (walker) { - atom_trak_free ((AtomTRAK *) walker->data); - walker = g_list_next (walker); - } - g_list_free (moov->traks); - moov->traks = NULL; - - if (moov->udta) { - atom_udta_free (moov->udta); - moov->udta = NULL; - } - - atom_mvex_clear (&moov->mvex); - - g_free (moov); -} - -/* -- end of init / free -- */ - -/* -- copy data functions -- */ - -static guint8 -atom_full_get_version (AtomFull * full) -{ - return full->version; -} - -static guint64 -common_time_info_copy_data (TimeInfo * ti, gboolean trunc_to_32, - guint8 ** buffer, guint64 * size, guint64 * offset) -{ - guint64 original_offset = *offset; - - if (trunc_to_32) { - prop_copy_uint32 ((guint32) ti->creation_time, buffer, size, offset); - prop_copy_uint32 ((guint32) ti->modification_time, buffer, size, offset); - prop_copy_uint32 (ti->timescale, buffer, size, offset); - prop_copy_uint32 ((guint32) ti->duration, buffer, size, offset); - } else { - prop_copy_uint64 (ti->creation_time, buffer, size, offset); - prop_copy_uint64 (ti->modification_time, buffer, size, offset); - prop_copy_uint32 (ti->timescale, buffer, size, offset); - prop_copy_uint64 (ti->duration, buffer, size, offset); - } - return *offset - original_offset; -} - -static void -atom_write_size (guint8 ** buffer, guint64 * size, guint64 * offset, - guint64 atom_pos) -{ - /* this only works for non-extended atom size, which is OK - * (though it could be made to do mem_move, etc and write extended size) */ - prop_copy_uint32 (*offset - atom_pos, buffer, size, &atom_pos); -} - -guint64 -atom_copy_data (Atom * atom, guint8 ** buffer, guint64 * size, guint64 * offset) -{ - guint64 original_offset = *offset; - - /* copies type and size */ - prop_copy_uint32 (atom->size, buffer, size, offset); - prop_copy_fourcc (atom->type, buffer, size, offset); - - /* extended size needed */ - if (atom->size == 1) { - /* really should not happen other than with mdat atom; - * would be a problem for size (re)write code, not to mention memory */ - g_return_val_if_fail (atom->type == FOURCC_mdat, 0); - prop_copy_uint64 (atom->extended_size, buffer, size, offset); - } - - return *offset - original_offset; -} - -static guint64 -atom_full_copy_data (AtomFull * atom, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_copy_data (&atom->header, buffer, size, offset)) { - return 0; - } - - prop_copy_uint8 (atom->version, buffer, size, offset); - prop_copy_uint8_array (atom->flags, 3, buffer, size, offset); - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_info_list_copy_data (GList * ai, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - while (ai) { - AtomInfo *info = (AtomInfo *) ai->data; - - if (!info->copy_data_func (info->atom, buffer, size, offset)) { - return 0; - } - ai = g_list_next (ai); - } - - return *offset - original_offset; -} - -static guint64 -atom_data_copy_data (AtomData * data, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_copy_data (&data->header, buffer, size, offset)) { - return 0; - } - if (data->datalen) - prop_copy_uint8_array (data->data, data->datalen, buffer, size, offset); - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_uuid_copy_data (AtomUUID * uuid, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_copy_data (&uuid->header, buffer, size, offset)) { - return 0; - } - prop_copy_uint8_array (uuid->uuid, 16, buffer, size, offset); - if (uuid->datalen) - prop_copy_uint8_array (uuid->data, uuid->datalen, buffer, size, offset); - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -guint64 -atom_ftyp_copy_data (AtomFTYP * ftyp, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_copy_data (&ftyp->header, buffer, size, offset)) { - return 0; - } - prop_copy_fourcc (ftyp->major_brand, buffer, size, offset); - prop_copy_uint32 (ftyp->version, buffer, size, offset); - - prop_copy_fourcc_array (ftyp->compatible_brands, ftyp->compatible_brands_size, - buffer, size, offset); - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -guint64 -atom_mvhd_copy_data (AtomMVHD * atom, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint8 version; - guint64 original_offset = *offset; - - if (!atom_full_copy_data (&(atom->header), buffer, size, offset)) { - return 0; - } - - version = atom_full_get_version (&(atom->header)); - if (version == 0) { - common_time_info_copy_data (&atom->time_info, TRUE, buffer, size, offset); - } else if (version == 1) { - common_time_info_copy_data (&atom->time_info, FALSE, buffer, size, offset); - } else { - *offset = original_offset; - return 0; - } - - prop_copy_uint32 (atom->prefered_rate, buffer, size, offset); - prop_copy_uint16 (atom->volume, buffer, size, offset); - prop_copy_uint16 (atom->reserved3, buffer, size, offset); - prop_copy_uint32_array (atom->reserved4, 2, buffer, size, offset); - prop_copy_uint32_array (atom->matrix, 9, buffer, size, offset); - prop_copy_uint32 (atom->preview_time, buffer, size, offset); - prop_copy_uint32 (atom->preview_duration, buffer, size, offset); - prop_copy_uint32 (atom->poster_time, buffer, size, offset); - prop_copy_uint32 (atom->selection_time, buffer, size, offset); - prop_copy_uint32 (atom->selection_duration, buffer, size, offset); - prop_copy_uint32 (atom->current_time, buffer, size, offset); - - prop_copy_uint32 (atom->next_track_id, buffer, size, offset); - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_tkhd_copy_data (AtomTKHD * tkhd, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_full_copy_data (&tkhd->header, buffer, size, offset)) { - return 0; - } - - if (atom_full_get_version (&tkhd->header) == 0) { - prop_copy_uint32 ((guint32) tkhd->creation_time, buffer, size, offset); - prop_copy_uint32 ((guint32) tkhd->modification_time, buffer, size, offset); - prop_copy_uint32 (tkhd->track_ID, buffer, size, offset); - prop_copy_uint32 (tkhd->reserved, buffer, size, offset); - prop_copy_uint32 ((guint32) tkhd->duration, buffer, size, offset); - } else { - prop_copy_uint64 (tkhd->creation_time, buffer, size, offset); - prop_copy_uint64 (tkhd->modification_time, buffer, size, offset); - prop_copy_uint32 (tkhd->track_ID, buffer, size, offset); - prop_copy_uint32 (tkhd->reserved, buffer, size, offset); - prop_copy_uint64 (tkhd->duration, buffer, size, offset); - } - - prop_copy_uint32_array (tkhd->reserved2, 2, buffer, size, offset); - prop_copy_uint16 (tkhd->layer, buffer, size, offset); - prop_copy_uint16 (tkhd->alternate_group, buffer, size, offset); - prop_copy_uint16 (tkhd->volume, buffer, size, offset); - prop_copy_uint16 (tkhd->reserved3, buffer, size, offset); - prop_copy_uint32_array (tkhd->matrix, 9, buffer, size, offset); - - prop_copy_uint32 (tkhd->width, buffer, size, offset); - prop_copy_uint32 (tkhd->height, buffer, size, offset); - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_hdlr_copy_data (AtomHDLR * hdlr, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_full_copy_data (&hdlr->header, buffer, size, offset)) { - return 0; - } - - prop_copy_fourcc (hdlr->component_type, buffer, size, offset); - prop_copy_fourcc (hdlr->handler_type, buffer, size, offset); - prop_copy_fourcc (hdlr->manufacturer, buffer, size, offset); - prop_copy_uint32 (hdlr->flags, buffer, size, offset); - prop_copy_uint32 (hdlr->flags_mask, buffer, size, offset); - - prop_copy_size_string ((guint8 *) hdlr->name, strlen (hdlr->name), buffer, - size, offset); - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_vmhd_copy_data (AtomVMHD * vmhd, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_full_copy_data (&vmhd->header, buffer, size, offset)) { - return 0; - } - prop_copy_uint16 (vmhd->graphics_mode, buffer, size, offset); - prop_copy_uint16_array (vmhd->opcolor, 3, buffer, size, offset); - - atom_write_size (buffer, size, offset, original_offset); - return original_offset - *offset; -} - -static guint64 -atom_smhd_copy_data (AtomSMHD * smhd, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_full_copy_data (&smhd->header, buffer, size, offset)) { - return 0; - } - prop_copy_uint16 (smhd->balance, buffer, size, offset); - prop_copy_uint16 (smhd->reserved, buffer, size, offset); - - atom_write_size (buffer, size, offset, original_offset); - return original_offset - *offset; -} - -static guint64 -atom_hmhd_copy_data (AtomHMHD * hmhd, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_full_copy_data (&hmhd->header, buffer, size, offset)) { - return 0; - } - prop_copy_uint16 (hmhd->max_pdu_size, buffer, size, offset); - prop_copy_uint16 (hmhd->avg_pdu_size, buffer, size, offset); - prop_copy_uint32 (hmhd->max_bitrate, buffer, size, offset); - prop_copy_uint32 (hmhd->avg_bitrate, buffer, size, offset); - prop_copy_uint32 (hmhd->sliding_avg_bitrate, buffer, size, offset); - - atom_write_size (buffer, size, offset, original_offset); - return original_offset - *offset; -} - -static gboolean -atom_url_same_file_flag (AtomURL * url) -{ - return (url->header.flags[2] & 0x1) == 1; -} - -static guint64 -atom_url_copy_data (AtomURL * url, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_full_copy_data (&url->header, buffer, size, offset)) { - return 0; - } - - if (!atom_url_same_file_flag (url)) { - prop_copy_null_terminated_string (url->location, buffer, size, offset); - } - - atom_write_size (buffer, size, offset, original_offset); - return original_offset - *offset; -} - -guint64 -atom_stts_copy_data (AtomSTTS * stts, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - guint i; - - if (!atom_full_copy_data (&stts->header, buffer, size, offset)) { - return 0; - } - - prop_copy_uint32 (atom_array_get_len (&stts->entries), buffer, size, offset); - /* minimize realloc */ - prop_copy_ensure_buffer (buffer, size, offset, - 8 * atom_array_get_len (&stts->entries)); - for (i = 0; i < atom_array_get_len (&stts->entries); i++) { - STTSEntry *entry = &atom_array_index (&stts->entries, i); - - prop_copy_uint32 (entry->sample_count, buffer, size, offset); - prop_copy_int32 (entry->sample_delta, buffer, size, offset); - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_sample_entry_copy_data (SampleTableEntry * se, guint8 ** buffer, - guint64 * size, guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_copy_data (&se->header, buffer, size, offset)) { - return 0; - } - - prop_copy_uint8_array (se->reserved, 6, buffer, size, offset); - prop_copy_uint16 (se->data_reference_index, buffer, size, offset); - - return *offset - original_offset; -} - -static guint64 -atom_esds_copy_data (AtomESDS * esds, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_full_copy_data (&esds->header, buffer, size, offset)) { - return 0; - } - if (!desc_es_descriptor_copy_data (&esds->es, buffer, size, offset)) { - return 0; - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_frma_copy_data (AtomFRMA * frma, guint8 ** buffer, - guint64 * size, guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_copy_data (&(frma->header), buffer, size, offset)) - return 0; - - prop_copy_fourcc (frma->media_type, buffer, size, offset); - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_mp4s_copy_data (SampleTableEntryMP4S * mp4s, guint8 ** buffer, - guint64 * size, guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_sample_entry_copy_data (&mp4s->se, buffer, size, offset)) { - return 0; - } - if (!atom_esds_copy_data (&mp4s->es, buffer, size, offset)) { - return 0; - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_hint_sample_entry_copy_data (AtomHintSampleEntry * hse, guint8 ** buffer, - guint64 * size, guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_sample_entry_copy_data (&hse->se, buffer, size, offset)) { - return 0; - } - - prop_copy_uint32 (hse->size, buffer, size, offset); - prop_copy_uint8_array (hse->data, hse->size, buffer, size, offset); - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -sample_entry_mp4a_copy_data (SampleTableEntryMP4A * mp4a, guint8 ** buffer, - guint64 * size, guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_sample_entry_copy_data (&mp4a->se, buffer, size, offset)) { - return 0; - } - - prop_copy_uint16 (mp4a->version, buffer, size, offset); - prop_copy_uint16 (mp4a->revision_level, buffer, size, offset); - prop_copy_uint32 (mp4a->vendor, buffer, size, offset); - prop_copy_uint16 (mp4a->channels, buffer, size, offset); - prop_copy_uint16 (mp4a->sample_size, buffer, size, offset); - prop_copy_uint16 (mp4a->compression_id, buffer, size, offset); - prop_copy_uint16 (mp4a->packet_size, buffer, size, offset); - prop_copy_uint32 (mp4a->sample_rate, buffer, size, offset); - - /* this should always be 0 for mp4 flavor */ - if (mp4a->version == 1) { - prop_copy_uint32 (mp4a->samples_per_packet, buffer, size, offset); - prop_copy_uint32 (mp4a->bytes_per_packet, buffer, size, offset); - prop_copy_uint32 (mp4a->bytes_per_frame, buffer, size, offset); - prop_copy_uint32 (mp4a->bytes_per_sample, buffer, size, offset); - } - - if (mp4a->extension_atoms) { - if (!atom_info_list_copy_data (mp4a->extension_atoms, buffer, size, offset)) - return 0; - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -sample_entry_mp4v_copy_data (SampleTableEntryMP4V * mp4v, guint8 ** buffer, - guint64 * size, guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_sample_entry_copy_data (&mp4v->se, buffer, size, offset)) { - return 0; - } - - prop_copy_uint16 (mp4v->version, buffer, size, offset); - prop_copy_uint16 (mp4v->revision_level, buffer, size, offset); - prop_copy_fourcc (mp4v->vendor, buffer, size, offset); - prop_copy_uint32 (mp4v->temporal_quality, buffer, size, offset); - prop_copy_uint32 (mp4v->spatial_quality, buffer, size, offset); - - prop_copy_uint16 (mp4v->width, buffer, size, offset); - prop_copy_uint16 (mp4v->height, buffer, size, offset); - - prop_copy_uint32 (mp4v->horizontal_resolution, buffer, size, offset); - prop_copy_uint32 (mp4v->vertical_resolution, buffer, size, offset); - prop_copy_uint32 (mp4v->datasize, buffer, size, offset); - - prop_copy_uint16 (mp4v->frame_count, buffer, size, offset); - - prop_copy_fixed_size_string ((guint8 *) mp4v->compressor, 32, buffer, size, - offset); - - prop_copy_uint16 (mp4v->depth, buffer, size, offset); - prop_copy_uint16 (mp4v->color_table_id, buffer, size, offset); - - /* extra atoms */ - if (mp4v->extension_atoms && - !atom_info_list_copy_data (mp4v->extension_atoms, buffer, size, offset)) - return 0; - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -guint64 -atom_stsz_copy_data (AtomSTSZ * stsz, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - guint i; - - if (!atom_full_copy_data (&stsz->header, buffer, size, offset)) { - return 0; - } - - prop_copy_uint32 (stsz->sample_size, buffer, size, offset); - prop_copy_uint32 (stsz->table_size, buffer, size, offset); - if (stsz->sample_size == 0) { - /* minimize realloc */ - prop_copy_ensure_buffer (buffer, size, offset, 4 * stsz->table_size); - /* entry count must match sample count */ - g_assert (atom_array_get_len (&stsz->entries) == stsz->table_size); - for (i = 0; i < atom_array_get_len (&stsz->entries); i++) { - prop_copy_uint32 (atom_array_index (&stsz->entries, i), buffer, size, - offset); - } - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -guint64 -atom_stsc_copy_data (AtomSTSC * stsc, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - guint i; - - if (!atom_full_copy_data (&stsc->header, buffer, size, offset)) { - return 0; - } - - prop_copy_uint32 (atom_array_get_len (&stsc->entries), buffer, size, offset); - /* minimize realloc */ - prop_copy_ensure_buffer (buffer, size, offset, - 12 * atom_array_get_len (&stsc->entries)); - - for (i = 0; i < atom_array_get_len (&stsc->entries); i++) { - STSCEntry *entry = &atom_array_index (&stsc->entries, i); - - prop_copy_uint32 (entry->first_chunk, buffer, size, offset); - prop_copy_uint32 (entry->samples_per_chunk, buffer, size, offset); - prop_copy_uint32 (entry->sample_description_index, buffer, size, offset); - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -guint64 -atom_ctts_copy_data (AtomCTTS * ctts, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - guint i; - - if (!atom_full_copy_data (&ctts->header, buffer, size, offset)) { - return 0; - } - - prop_copy_uint32 (atom_array_get_len (&ctts->entries), buffer, size, offset); - /* minimize realloc */ - prop_copy_ensure_buffer (buffer, size, offset, - 8 * atom_array_get_len (&ctts->entries)); - for (i = 0; i < atom_array_get_len (&ctts->entries); i++) { - CTTSEntry *entry = &atom_array_index (&ctts->entries, i); - - prop_copy_uint32 (entry->samplecount, buffer, size, offset); - prop_copy_uint32 (entry->sampleoffset, buffer, size, offset); - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -guint64 -atom_stco64_copy_data (AtomSTCO64 * stco64, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - guint i; - gboolean trunc_to_32 = stco64->header.header.type == FOURCC_stco; - - if (!atom_full_copy_data (&stco64->header, buffer, size, offset)) { - return 0; - } - - prop_copy_uint32 (atom_array_get_len (&stco64->entries), buffer, size, - offset); - - /* minimize realloc */ - prop_copy_ensure_buffer (buffer, size, offset, - 8 * atom_array_get_len (&stco64->entries)); - for (i = 0; i < atom_array_get_len (&stco64->entries); i++) { - guint64 *value = &atom_array_index (&stco64->entries, i); - - if (trunc_to_32) { - prop_copy_uint32 ((guint32) * value, buffer, size, offset); - } else { - prop_copy_uint64 (*value, buffer, size, offset); - } - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -guint64 -atom_stss_copy_data (AtomSTSS * stss, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - guint i; - - if (atom_array_get_len (&stss->entries) == 0) { - /* FIXME not needing this atom might be confused with error while copying */ - return 0; - } - - if (!atom_full_copy_data (&stss->header, buffer, size, offset)) { - return 0; - } - - prop_copy_uint32 (atom_array_get_len (&stss->entries), buffer, size, offset); - /* minimize realloc */ - prop_copy_ensure_buffer (buffer, size, offset, - 4 * atom_array_get_len (&stss->entries)); - for (i = 0; i < atom_array_get_len (&stss->entries); i++) { - prop_copy_uint32 (atom_array_index (&stss->entries, i), buffer, size, - offset); - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_stsd_copy_data (AtomSTSD * stsd, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - GList *walker; - - if (!atom_full_copy_data (&stsd->header, buffer, size, offset)) { - return 0; - } - - prop_copy_uint32 (stsd->n_entries, buffer, size, offset); - - for (walker = g_list_last (stsd->entries); walker != NULL; - walker = g_list_previous (walker)) { - SampleTableEntry *se = (SampleTableEntry *) walker->data; - - switch (((Atom *) walker->data)->type) { - case FOURCC_mp4a: - if (!sample_entry_mp4a_copy_data ((SampleTableEntryMP4A *) walker->data, - buffer, size, offset)) { - return 0; - } - break; - case FOURCC_mp4s: - if (!atom_mp4s_copy_data ((SampleTableEntryMP4S *) walker->data, - buffer, size, offset)) { - return 0; - } - break; - case FOURCC_mp4v: - if (!sample_entry_mp4v_copy_data ((SampleTableEntryMP4V *) walker->data, - buffer, size, offset)) { - return 0; - } - break; - default: - if (se->kind == VIDEO) { - if (!sample_entry_mp4v_copy_data ((SampleTableEntryMP4V *) - walker->data, buffer, size, offset)) { - return 0; - } - } else if (se->kind == AUDIO) { - if (!sample_entry_mp4a_copy_data ((SampleTableEntryMP4A *) - walker->data, buffer, size, offset)) { - return 0; - } - } else { - if (!atom_hint_sample_entry_copy_data ( - (AtomHintSampleEntry *) walker->data, buffer, size, offset)) { - return 0; - } - } - break; - } - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_stbl_copy_data (AtomSTBL * stbl, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_copy_data (&stbl->header, buffer, size, offset)) { - return 0; - } - - if (!atom_stsd_copy_data (&stbl->stsd, buffer, size, offset)) { - return 0; - } - if (!atom_stts_copy_data (&stbl->stts, buffer, size, offset)) { - return 0; - } - /* this atom is optional, so let's check if we need it - * (to avoid false error) */ - if (atom_array_get_len (&stbl->stss.entries)) { - if (!atom_stss_copy_data (&stbl->stss, buffer, size, offset)) { - return 0; - } - } - - if (!atom_stsc_copy_data (&stbl->stsc, buffer, size, offset)) { - return 0; - } - if (!atom_stsz_copy_data (&stbl->stsz, buffer, size, offset)) { - return 0; - } - if (stbl->ctts && stbl->ctts->do_pts) { - if (!atom_ctts_copy_data (stbl->ctts, buffer, size, offset)) { - return 0; - } - } - if (!atom_stco64_copy_data (&stbl->stco64, buffer, size, offset)) { - return 0; - } - - atom_write_size (buffer, size, offset, original_offset); - return original_offset - *offset; -} - - -static guint64 -atom_dref_copy_data (AtomDREF * dref, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - GList *walker; - - if (!atom_full_copy_data (&dref->header, buffer, size, offset)) { - return 0; - } - - prop_copy_uint32 (g_list_length (dref->entries), buffer, size, offset); - - walker = dref->entries; - while (walker != NULL) { - Atom *atom = (Atom *) walker->data; - - if (atom->type == FOURCC_url_) { - atom_url_copy_data ((AtomURL *) atom, buffer, size, offset); - } else if (atom->type == FOURCC_alis) { - atom_full_copy_data ((AtomFull *) atom, buffer, size, offset); - } else { - g_error ("Unsupported atom used inside dref atom"); - } - walker = g_list_next (walker); - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_dinf_copy_data (AtomDINF * dinf, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_copy_data (&dinf->header, buffer, size, offset)) { - return 0; - } - - if (!atom_dref_copy_data (&dinf->dref, buffer, size, offset)) { - return 0; - } - - atom_write_size (buffer, size, offset, original_offset); - return original_offset - *offset; -} - -static guint64 -atom_minf_copy_data (AtomMINF * minf, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_copy_data (&minf->header, buffer, size, offset)) { - return 0; - } - - if (minf->vmhd) { - if (!atom_vmhd_copy_data (minf->vmhd, buffer, size, offset)) { - return 0; - } - } else if (minf->smhd) { - if (!atom_smhd_copy_data (minf->smhd, buffer, size, offset)) { - return 0; - } - } else if (minf->hmhd) { - if (!atom_hmhd_copy_data (minf->hmhd, buffer, size, offset)) { - return 0; - } - } - - if (minf->hdlr) { - if (!atom_hdlr_copy_data (minf->hdlr, buffer, size, offset)) { - return 0; - } - } - - if (!atom_dinf_copy_data (&minf->dinf, buffer, size, offset)) { - return 0; - } - if (!atom_stbl_copy_data (&minf->stbl, buffer, size, offset)) { - return 0; - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_mdhd_copy_data (AtomMDHD * mdhd, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_full_copy_data (&mdhd->header, buffer, size, offset)) { - return 0; - } - - if (!common_time_info_copy_data (&mdhd->time_info, - atom_full_get_version (&mdhd->header) == 0, buffer, size, offset)) { - return 0; - } - - prop_copy_uint16 (mdhd->language_code, buffer, size, offset); - prop_copy_uint16 (mdhd->quality, buffer, size, offset); - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_mdia_copy_data (AtomMDIA * mdia, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_copy_data (&mdia->header, buffer, size, offset)) { - return 0; - } - if (!atom_mdhd_copy_data (&mdia->mdhd, buffer, size, offset)) { - return 0; - } - if (!atom_hdlr_copy_data (&mdia->hdlr, buffer, size, offset)) { - return 0; - } - - if (!atom_minf_copy_data (&mdia->minf, buffer, size, offset)) { - return 0; - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_elst_copy_data (AtomELST * elst, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - GSList *walker; - - if (!atom_full_copy_data (&elst->header, buffer, size, offset)) { - return 0; - } - - prop_copy_uint32 (g_slist_length (elst->entries), buffer, size, offset); - - for (walker = elst->entries; walker != NULL; walker = g_slist_next (walker)) { - EditListEntry *entry = (EditListEntry *) walker->data; - prop_copy_uint32 (entry->duration, buffer, size, offset); - prop_copy_uint32 (entry->media_time, buffer, size, offset); - prop_copy_uint32 (entry->media_rate, buffer, size, offset); - } - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_edts_copy_data (AtomEDTS * edts, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_copy_data (&(edts->header), buffer, size, offset)) - return 0; - - if (!atom_elst_copy_data (&(edts->elst), buffer, size, offset)) - return 0; - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -guint64 -atom_trak_copy_data (AtomTRAK * trak, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_copy_data (&trak->header, buffer, size, offset)) { - return 0; - } - if (!atom_tkhd_copy_data (&trak->tkhd, buffer, size, offset)) { - return 0; - } - if (trak->edts) { - if (!atom_edts_copy_data (trak->edts, buffer, size, offset)) { - return 0; - } - } - - if (!atom_mdia_copy_data (&trak->mdia, buffer, size, offset)) { - return 0; - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_tag_data_copy_data (AtomTagData * data, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_full_copy_data (&data->header, buffer, size, offset)) { - return 0; - } - - prop_copy_uint32 (data->reserved, buffer, size, offset); - prop_copy_uint8_array (data->data, data->datalen, buffer, size, offset); - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_tag_copy_data (AtomTag * tag, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_copy_data (&tag->header, buffer, size, offset)) { - return 0; - } - - if (!atom_tag_data_copy_data (&tag->data, buffer, size, offset)) { - return 0; - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_ilst_copy_data (AtomILST * ilst, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_copy_data (&ilst->header, buffer, size, offset)) { - return 0; - } - /* extra atoms */ - if (ilst->entries && - !atom_info_list_copy_data (ilst->entries, buffer, size, offset)) - return 0; - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_meta_copy_data (AtomMETA * meta, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_full_copy_data (&meta->header, buffer, size, offset)) { - return 0; - } - if (!atom_hdlr_copy_data (&meta->hdlr, buffer, size, offset)) { - return 0; - } - if (meta->ilst) { - if (!atom_ilst_copy_data (meta->ilst, buffer, size, offset)) { - return 0; - } - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_udta_copy_data (AtomUDTA * udta, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_copy_data (&udta->header, buffer, size, offset)) { - return 0; - } - if (udta->meta) { - if (!atom_meta_copy_data (udta->meta, buffer, size, offset)) { - return 0; - } - } - if (udta->entries) { - /* extra atoms */ - if (!atom_info_list_copy_data (udta->entries, buffer, size, offset)) - return 0; - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_mehd_copy_data (AtomMEHD * mehd, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_full_copy_data (&mehd->header, buffer, size, offset)) { - return 0; - } - - prop_copy_uint64 (mehd->fragment_duration, buffer, size, offset); - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_trex_copy_data (AtomTREX * trex, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_full_copy_data (&trex->header, buffer, size, offset)) { - return 0; - } - - prop_copy_uint32 (trex->track_ID, buffer, size, offset); - prop_copy_uint32 (trex->default_sample_description_index, buffer, size, - offset); - prop_copy_uint32 (trex->default_sample_duration, buffer, size, offset); - prop_copy_uint32 (trex->default_sample_size, buffer, size, offset); - prop_copy_uint32 (trex->default_sample_flags, buffer, size, offset); - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_mvex_copy_data (AtomMVEX * mvex, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - GList *walker; - - if (!atom_copy_data (&mvex->header, buffer, size, offset)) { - return 0; - } - - if (!atom_mehd_copy_data (&mvex->mehd, buffer, size, offset)) { - return 0; - } - - walker = g_list_first (mvex->trexs); - while (walker != NULL) { - if (!atom_trex_copy_data ((AtomTREX *) walker->data, buffer, size, offset)) { - return 0; - } - walker = g_list_next (walker); - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -guint64 -atom_moov_copy_data (AtomMOOV * atom, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - GList *walker; - - if (!atom_copy_data (&(atom->header), buffer, size, offset)) - return 0; - - if (!atom_mvhd_copy_data (&(atom->mvhd), buffer, size, offset)) - return 0; - - walker = g_list_first (atom->traks); - while (walker != NULL) { - if (!atom_trak_copy_data ((AtomTRAK *) walker->data, buffer, size, offset)) { - return 0; - } - walker = g_list_next (walker); - } - - if (atom->udta) { - if (!atom_udta_copy_data (atom->udta, buffer, size, offset)) { - return 0; - } - } - - if (atom->fragmented) { - if (!atom_mvex_copy_data (&atom->mvex, buffer, size, offset)) { - return 0; - } - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_wave_copy_data (AtomWAVE * wave, guint8 ** buffer, - guint64 * size, guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_copy_data (&(wave->header), buffer, size, offset)) - return 0; - - if (wave->extension_atoms) { - if (!atom_info_list_copy_data (wave->extension_atoms, buffer, size, offset)) - return 0; - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -/* -- end of copy data functions -- */ - -/* -- general functions, API and support functions */ - -/* add samples to tables */ - -static void -atom_stsc_add_new_entry (AtomSTSC * stsc, guint32 first_chunk, guint32 nsamples) -{ - STSCEntry nentry; - gint len; - - if ((len = atom_array_get_len (&stsc->entries)) && - ((atom_array_index (&stsc->entries, len - 1)).samples_per_chunk == - nsamples)) - return; - - nentry.first_chunk = first_chunk; - nentry.samples_per_chunk = nsamples; - nentry.sample_description_index = 1; - atom_array_append (&stsc->entries, nentry, 128); -} - -static void -atom_stts_add_entry (AtomSTTS * stts, guint32 sample_count, gint32 sample_delta) -{ - STTSEntry *entry = NULL; - - if (G_LIKELY (atom_array_get_len (&stts->entries) != 0)) - entry = &atom_array_index (&stts->entries, - atom_array_get_len (&stts->entries) - 1); - - if (entry && entry->sample_delta == sample_delta) { - entry->sample_count += sample_count; - } else { - STTSEntry nentry; - - nentry.sample_count = sample_count; - nentry.sample_delta = sample_delta; - atom_array_append (&stts->entries, nentry, 256); - } -} - -static void -atom_stsz_add_entry (AtomSTSZ * stsz, guint32 nsamples, guint32 size) -{ - guint32 i; - - stsz->table_size += nsamples; - if (stsz->sample_size != 0) { - /* it is constant size, we don't need entries */ - return; - } - for (i = 0; i < nsamples; i++) { - atom_array_append (&stsz->entries, size, 1024); - } -} - -static guint32 -atom_stco64_get_entry_count (AtomSTCO64 * stco64) -{ - return atom_array_get_len (&stco64->entries); -} - -static void -atom_stco64_add_entry (AtomSTCO64 * stco64, guint64 entry) -{ - atom_array_append (&stco64->entries, entry, 256); - if (entry > G_MAXUINT32) - stco64->header.header.type = FOURCC_co64; -} - -static void -atom_stss_add_entry (AtomSTSS * stss, guint32 sample) -{ - atom_array_append (&stss->entries, sample, 512); -} - -static void -atom_stbl_add_stss_entry (AtomSTBL * stbl) -{ - guint32 sample_index = stbl->stsz.table_size; - - atom_stss_add_entry (&stbl->stss, sample_index); -} - -static void -atom_ctts_add_entry (AtomCTTS * ctts, guint32 nsamples, guint32 offset) -{ - CTTSEntry *entry = NULL; - - if (G_LIKELY (atom_array_get_len (&ctts->entries) != 0)) - entry = &atom_array_index (&ctts->entries, - atom_array_get_len (&ctts->entries) - 1); - - if (entry == NULL || entry->sampleoffset != offset) { - CTTSEntry nentry; - - nentry.samplecount = nsamples; - nentry.sampleoffset = offset; - atom_array_append (&ctts->entries, nentry, 256); - if (offset != 0) - ctts->do_pts = TRUE; - } else { - entry->samplecount += nsamples; - } -} - -static void -atom_stbl_add_ctts_entry (AtomSTBL * stbl, guint32 nsamples, guint32 offset) -{ - if (stbl->ctts == NULL) { - stbl->ctts = atom_ctts_new (); - } - atom_ctts_add_entry (stbl->ctts, nsamples, offset); -} - -void -atom_stbl_add_samples (AtomSTBL * stbl, guint32 nsamples, guint32 delta, - guint32 size, guint64 chunk_offset, gboolean sync, gint64 pts_offset) -{ - atom_stts_add_entry (&stbl->stts, nsamples, delta); - atom_stsz_add_entry (&stbl->stsz, nsamples, size); - atom_stco64_add_entry (&stbl->stco64, chunk_offset); - atom_stsc_add_new_entry (&stbl->stsc, - atom_stco64_get_entry_count (&stbl->stco64), nsamples); - if (sync) - atom_stbl_add_stss_entry (stbl); - /* always store to arrange for consistent content */ - atom_stbl_add_ctts_entry (stbl, nsamples, pts_offset); -} - -void -atom_trak_add_samples (AtomTRAK * trak, guint32 nsamples, guint32 delta, - guint32 size, guint64 chunk_offset, gboolean sync, gint64 pts_offset) -{ - AtomSTBL *stbl = &trak->mdia.minf.stbl; - atom_stbl_add_samples (stbl, nsamples, delta, size, chunk_offset, sync, - pts_offset); -} - -/* trak and moov molding */ - -guint32 -atom_trak_get_timescale (AtomTRAK * trak) -{ - return trak->mdia.mdhd.time_info.timescale; -} - -guint32 -atom_trak_get_id (AtomTRAK * trak) -{ - return trak->tkhd.track_ID; -} - -static void -atom_trak_set_id (AtomTRAK * trak, guint32 id) -{ - trak->tkhd.track_ID = id; -} - -static void -atom_moov_add_trex (AtomMOOV * moov, AtomTREX * trex) -{ - moov->mvex.trexs = g_list_append (moov->mvex.trexs, trex); -} - -static AtomTREX * -atom_trex_new (AtomTRAK * trak) -{ - guint8 flags[3] = { 0, 0, 0 }; - AtomTREX *trex = g_new0 (AtomTREX, 1); - - atom_full_init (&trex->header, FOURCC_trex, 0, 0, 0, flags); - - trex->track_ID = trak->tkhd.track_ID; - trex->default_sample_description_index = 1; - trex->default_sample_duration = 0; - trex->default_sample_size = 0; - trex->default_sample_flags = 0; - - return trex; -} - -void -atom_moov_add_trak (AtomMOOV * moov, AtomTRAK * trak) -{ - atom_trak_set_id (trak, moov->mvhd.next_track_id++); - moov->traks = g_list_append (moov->traks, trak); - /* additional trak means also new trex */ - atom_moov_add_trex (moov, atom_trex_new (trak)); -} - -static guint64 -atom_trak_get_duration (AtomTRAK * trak) -{ - return trak->tkhd.duration; -} - -static guint64 -atom_stts_get_total_duration (AtomSTTS * stts) -{ - guint i; - guint64 sum = 0; - - for (i = 0; i < atom_array_get_len (&stts->entries); i++) { - STTSEntry *entry = &atom_array_index (&stts->entries, i); - - sum += (guint64) (entry->sample_count) * entry->sample_delta; - } - return sum; -} - -static void -atom_trak_update_duration (AtomTRAK * trak, guint64 moov_timescale) -{ - trak->mdia.mdhd.time_info.duration = - atom_stts_get_total_duration (&trak->mdia.minf.stbl.stts); - if (trak->mdia.mdhd.time_info.timescale != 0) { - trak->tkhd.duration = - gst_util_uint64_scale (trak->mdia.mdhd.time_info.duration, - moov_timescale, trak->mdia.mdhd.time_info.timescale); - } else { - trak->tkhd.duration = 0; - } -} - -static guint32 -atom_moov_get_timescale (AtomMOOV * moov) -{ - return moov->mvhd.time_info.timescale; -} - -void -atom_moov_update_timescale (AtomMOOV * moov, guint32 timescale) -{ - moov->mvhd.time_info.timescale = timescale; -} - -void -atom_moov_update_duration (AtomMOOV * moov) -{ - GList *traks = moov->traks; - guint64 dur, duration = 0; - - while (traks) { - AtomTRAK *trak = (AtomTRAK *) traks->data; - - atom_trak_update_duration (trak, atom_moov_get_timescale (moov)); - dur = atom_trak_get_duration (trak); - if (dur > duration) - duration = dur; - traks = g_list_next (traks); - } - moov->mvhd.time_info.duration = duration; - moov->mvex.mehd.fragment_duration = duration; -} - -void -atom_moov_set_fragmented (AtomMOOV * moov, gboolean fragmented) -{ - moov->fragmented = fragmented; -} - -void -atom_stco64_chunks_add_offset (AtomSTCO64 * stco64, guint32 offset) -{ - guint i; - - for (i = 0; i < atom_array_get_len (&stco64->entries); i++) { - guint64 *value = &atom_array_index (&stco64->entries, i); - - *value += offset; - } -} - -void -atom_moov_chunks_add_offset (AtomMOOV * moov, guint32 offset) -{ - GList *traks = moov->traks; - - while (traks) { - AtomTRAK *trak = (AtomTRAK *) traks->data; - - atom_stco64_chunks_add_offset (&trak->mdia.minf.stbl.stco64, offset); - traks = g_list_next (traks); - } -} - -/* - * Meta tags functions - */ -static void -atom_moov_init_metatags (AtomMOOV * moov, AtomsContext * context) -{ - if (!moov->udta) { - moov->udta = atom_udta_new (); - } - if (context->flavor != ATOMS_TREE_FLAVOR_3GP) { - if (!moov->udta->meta) { - moov->udta->meta = atom_meta_new (); - } - if (!moov->udta->meta->ilst) { - moov->udta->meta->ilst = atom_ilst_new (); - } - } -} - -static void -atom_tag_data_alloc_data (AtomTagData * data, guint size) -{ - if (data->data != NULL) { - g_free (data->data); - } - data->data = g_new0 (guint8, size); - data->datalen = size; -} - -static void -atom_moov_append_tag (AtomMOOV * moov, AtomInfo * tag) -{ - GList **entries; - - atom_moov_init_metatags (moov, &moov->context); - if (moov->udta->meta) - entries = &moov->udta->meta->ilst->entries; - else - entries = &moov->udta->entries; - *entries = g_list_append (*entries, tag); -} - -void -atom_moov_add_tag (AtomMOOV * moov, guint32 fourcc, guint32 flags, - const guint8 * data, guint size) -{ - AtomTag *tag; - AtomTagData *tdata; - - tag = atom_tag_new (fourcc, flags); - tdata = &tag->data; - atom_tag_data_alloc_data (tdata, size); - g_memmove (tdata->data, data, size); - - atom_moov_append_tag (moov, - build_atom_info_wrapper ((Atom *) tag, atom_tag_copy_data, - atom_tag_free)); -} - -void -atom_moov_add_str_tag (AtomMOOV * moov, guint32 fourcc, const gchar * value) -{ - gint len = strlen (value); - - if (len > 0) - atom_moov_add_tag (moov, fourcc, METADATA_TEXT_FLAG, (guint8 *) value, len); -} - -void -atom_moov_add_uint_tag (AtomMOOV * moov, guint32 fourcc, guint32 flags, - guint32 value) -{ - guint8 data[8] = { 0, }; - - if (flags) { - GST_WRITE_UINT16_BE (data, value); - atom_moov_add_tag (moov, fourcc, flags, data, 2); - } else { - GST_WRITE_UINT32_BE (data + 2, value); - atom_moov_add_tag (moov, fourcc, flags, data, 8); - } -} - -void -atom_moov_add_blob_tag (AtomMOOV * moov, guint8 * data, guint size) -{ - AtomData *data_atom; - GstBuffer *buf; - guint len; - guint32 fourcc; - - if (size < 8) - return; - - /* blob is unparsed atom; - * extract size and fourcc, and wrap remainder in data atom */ - len = GST_READ_UINT32_BE (data); - fourcc = GST_READ_UINT32_LE (data + 4); - if (len > size) - return; - - buf = gst_buffer_new (); - GST_BUFFER_SIZE (buf) = len - 8; - GST_BUFFER_DATA (buf) = data + 8; - - data_atom = atom_data_new_from_gst_buffer (fourcc, buf); - gst_buffer_unref (buf); - - atom_moov_append_tag (moov, - build_atom_info_wrapper ((Atom *) data_atom, atom_data_copy_data, - atom_data_free)); -} - -void -atom_moov_add_3gp_tag (AtomMOOV * moov, guint32 fourcc, guint8 * data, - guint size) -{ - AtomData *data_atom; - GstBuffer *buf; - guint8 *bdata; - - /* need full atom */ - buf = gst_buffer_new_and_alloc (size + 4); - bdata = GST_BUFFER_DATA (buf); - /* full atom: version and flags */ - GST_WRITE_UINT32_BE (bdata, 0); - memcpy (bdata + 4, data, size); - - data_atom = atom_data_new_from_gst_buffer (fourcc, buf); - gst_buffer_unref (buf); - - atom_moov_append_tag (moov, - build_atom_info_wrapper ((Atom *) data_atom, atom_data_copy_data, - atom_data_free)); -} - -guint16 -language_code (const char *lang) -{ - g_return_val_if_fail (lang != NULL, 0); - g_return_val_if_fail (strlen (lang) == 3, 0); - - return (((lang[0] - 0x60) & 0x1F) << 10) + (((lang[1] - 0x60) & 0x1F) << 5) + - ((lang[2] - 0x60) & 0x1F); -} - -void -atom_moov_add_3gp_str_int_tag (AtomMOOV * moov, guint32 fourcc, - const gchar * value, gint16 ivalue) -{ - gint len = 0, size = 0; - guint8 *data; - - if (value) { - len = strlen (value); - size = len + 3; - } - - if (ivalue >= 0) - size += 2; - - data = g_malloc (size + 3); - /* language tag and null-terminated UTF-8 string */ - if (value) { - GST_WRITE_UINT16_BE (data, language_code (GST_QT_MUX_DEFAULT_TAG_LANGUAGE)); - /* include 0 terminator */ - memcpy (data + 2, value, len + 1); - } - /* 16-bit unsigned int if standalone, otherwise 8-bit */ - if (ivalue >= 0) { - if (size == 2) - GST_WRITE_UINT16_BE (data + size - 2, ivalue); - else { - GST_WRITE_UINT8 (data + size - 2, ivalue & 0xFF); - size--; - } - } - - atom_moov_add_3gp_tag (moov, fourcc, data, size); - g_free (data); -} - -void -atom_moov_add_3gp_str_tag (AtomMOOV * moov, guint32 fourcc, const gchar * value) -{ - atom_moov_add_3gp_str_int_tag (moov, fourcc, value, -1); -} - -void -atom_moov_add_3gp_uint_tag (AtomMOOV * moov, guint32 fourcc, guint16 value) -{ - atom_moov_add_3gp_str_int_tag (moov, fourcc, NULL, value); -} - -void -atom_moov_add_xmp_tags (AtomMOOV * moov, const GstTagList * tags) -{ - GstBuffer *xmpbuffer; - AtomData *data_atom = NULL; - - if (moov->context.flavor == ATOMS_TREE_FLAVOR_MOV) { - xmpbuffer = gst_tag_list_to_xmp_buffer (tags, TRUE); - if (xmpbuffer) { - data_atom = atom_data_new_from_gst_buffer (FOURCC_XMP_, xmpbuffer); - atom_moov_init_metatags (moov, &moov->context); - moov->udta->entries = g_list_append (moov->udta->entries, - build_atom_info_wrapper ((Atom *) data_atom, atom_data_copy_data, - atom_data_free)); - gst_buffer_unref (xmpbuffer); - } - } else { - GST_DEBUG ("Not adding xmp to moov atom, it is only used in 'mov' format"); - } - -} - -/* - * Functions for specifying media types - */ - -static void -atom_minf_set_audio (AtomMINF * minf) -{ - atom_minf_clear_handlers (minf); - minf->smhd = atom_smhd_new (); -} - -static void -atom_minf_set_video (AtomMINF * minf, AtomsContext * context) -{ - atom_minf_clear_handlers (minf); - minf->vmhd = atom_vmhd_new (context); -} - -static void -atom_hdlr_set_type (AtomHDLR * hdlr, AtomsContext * context, guint32 comp_type, - guint32 hdlr_type) -{ - if (context->flavor == ATOMS_TREE_FLAVOR_MOV) { - hdlr->component_type = comp_type; - } - hdlr->handler_type = hdlr_type; -} - -static void -atom_hdlr_set_name (AtomHDLR * hdlr, const char *name) -{ - if (hdlr->name) - g_free (hdlr->name); - hdlr->name = g_strdup (name); -} - -static void -atom_mdia_set_hdlr_type_audio (AtomMDIA * mdia, AtomsContext * context) -{ - atom_hdlr_set_type (&mdia->hdlr, context, FOURCC_mhlr, FOURCC_soun); - /* Some players (low-end hardware) check for this name, which is what - * QuickTime itself sets */ - atom_hdlr_set_name (&mdia->hdlr, "SoundHandler"); -} - -static void -atom_mdia_set_hdlr_type_video (AtomMDIA * mdia, AtomsContext * context) -{ - atom_hdlr_set_type (&mdia->hdlr, context, FOURCC_mhlr, FOURCC_vide); - /* Some players (low-end hardware) check for this name, which is what - * QuickTime itself sets */ - atom_hdlr_set_name (&mdia->hdlr, "VideoHandler"); -} - -static void -atom_mdia_set_audio (AtomMDIA * mdia, AtomsContext * context) -{ - atom_mdia_set_hdlr_type_audio (mdia, context); - atom_minf_set_audio (&mdia->minf); -} - -static void -atom_mdia_set_video (AtomMDIA * mdia, AtomsContext * context) -{ - atom_mdia_set_hdlr_type_video (mdia, context); - atom_minf_set_video (&mdia->minf, context); -} - -static void -atom_tkhd_set_audio (AtomTKHD * tkhd) -{ - tkhd->volume = 0x0100; - tkhd->width = tkhd->height = 0; -} - -static void -atom_tkhd_set_video (AtomTKHD * tkhd, AtomsContext * context, guint32 width, - guint32 height) -{ - tkhd->volume = 0; - - /* qt and ISO base media do not contradict, and examples agree */ - tkhd->width = width; - tkhd->height = height; -} - -static void -atom_edts_add_entry (AtomEDTS * edts, EditListEntry * entry) -{ - edts->elst.entries = g_slist_append (edts->elst.entries, entry); -} - -/* - * Adds a new entry to this trak edits list - * duration is in the moov's timescale - * media_time is the offset in the media time to start from (media's timescale) - * rate is a 32 bits fixed-point - */ -void -atom_trak_add_elst_entry (AtomTRAK * trak, guint32 duration, guint32 media_time, - guint32 rate) -{ - EditListEntry *entry = g_new (EditListEntry, 1); - - entry->duration = duration; - entry->media_time = media_time; - entry->media_rate = rate; - - if (trak->edts == NULL) { - trak->edts = atom_edts_new (); - } - atom_edts_add_entry (trak->edts, entry); -} - -/* re-negotiation is prevented at top-level, so only 1 entry expected. - * Quite some more care here and elsewhere may be needed to - * support several entries */ -static SampleTableEntryMP4A * -atom_trak_add_audio_entry (AtomTRAK * trak, AtomsContext * context, - guint32 type) -{ - AtomSTSD *stsd = &trak->mdia.minf.stbl.stsd; - SampleTableEntryMP4A *mp4a = sample_entry_mp4a_new (); - - mp4a->se.header.type = type; - mp4a->se.kind = AUDIO; - mp4a->compression_id = -1; - mp4a->se.data_reference_index = 1; - - stsd->entries = g_list_prepend (stsd->entries, mp4a); - stsd->n_entries++; - return mp4a; -} - -static SampleTableEntryMP4V * -atom_trak_add_video_entry (AtomTRAK * trak, AtomsContext * context, - guint32 type) -{ - SampleTableEntryMP4V *mp4v = sample_entry_mp4v_new (context); - AtomSTSD *stsd = &trak->mdia.minf.stbl.stsd; - - mp4v->se.header.type = type; - mp4v->se.kind = VIDEO; - mp4v->se.data_reference_index = 1; - mp4v->horizontal_resolution = 72 << 16; - mp4v->vertical_resolution = 72 << 16; - if (context->flavor == ATOMS_TREE_FLAVOR_MOV) { - mp4v->spatial_quality = 512; - mp4v->temporal_quality = 512; - } - - stsd->entries = g_list_prepend (stsd->entries, mp4v); - stsd->n_entries++; - return mp4v; -} - -static void -atom_trak_set_constant_size_samples (AtomTRAK * trak, guint32 sample_size) -{ - trak->mdia.minf.stbl.stsz.sample_size = sample_size; -} - -static void -atom_trak_set_audio (AtomTRAK * trak, AtomsContext * context) -{ - atom_tkhd_set_audio (&trak->tkhd); - atom_mdia_set_audio (&trak->mdia, context); -} - -static void -atom_trak_set_video (AtomTRAK * trak, AtomsContext * context, guint32 width, - guint32 height) -{ - atom_tkhd_set_video (&trak->tkhd, context, width, height); - atom_mdia_set_video (&trak->mdia, context); -} - -static void -atom_trak_set_audio_commons (AtomTRAK * trak, AtomsContext * context, - guint32 rate) -{ - atom_trak_set_audio (trak, context); - trak->mdia.mdhd.time_info.timescale = rate; -} - -static void -atom_trak_set_video_commons (AtomTRAK * trak, AtomsContext * context, - guint32 rate, guint32 width, guint32 height) -{ - atom_trak_set_video (trak, context, width, height); - trak->mdia.mdhd.time_info.timescale = rate; - trak->tkhd.width = width << 16; - trak->tkhd.height = height << 16; -} - -void -atom_trak_set_audio_type (AtomTRAK * trak, AtomsContext * context, - AudioSampleEntry * entry, guint32 scale, AtomInfo * ext, gint sample_size) -{ - SampleTableEntryMP4A *ste; - - atom_trak_set_audio_commons (trak, context, scale); - atom_stsd_remove_entries (&trak->mdia.minf.stbl.stsd); - ste = atom_trak_add_audio_entry (trak, context, entry->fourcc); - - trak->is_video = FALSE; - trak->is_h264 = FALSE; - - ste->version = entry->version; - ste->compression_id = entry->compression_id; - ste->sample_size = entry->sample_size; - ste->sample_rate = entry->sample_rate << 16; - ste->channels = entry->channels; - - ste->samples_per_packet = entry->samples_per_packet; - ste->bytes_per_sample = entry->bytes_per_sample; - ste->bytes_per_packet = entry->bytes_per_packet; - ste->bytes_per_frame = entry->bytes_per_frame; - - if (ext) - ste->extension_atoms = g_list_prepend (ste->extension_atoms, ext); - - /* 0 size means variable size */ - atom_trak_set_constant_size_samples (trak, sample_size); -} - -static AtomInfo * -build_pasp_extension (AtomTRAK * trak, gint par_width, gint par_height) -{ - AtomData *atom_data; - GstBuffer *buf; - guint8 *data; - - buf = gst_buffer_new_and_alloc (8); - data = GST_BUFFER_DATA (buf); - - /* ihdr = image header box */ - GST_WRITE_UINT32_BE (data, par_width); - GST_WRITE_UINT32_BE (data + 4, par_height); - - atom_data = atom_data_new_from_gst_buffer (FOURCC_pasp, buf); - gst_buffer_unref (buf); - - return build_atom_info_wrapper ((Atom *) atom_data, atom_data_copy_data, - atom_data_free); -} - -void -atom_trak_set_video_type (AtomTRAK * trak, AtomsContext * context, - VisualSampleEntry * entry, guint32 scale, GList * ext_atoms_list) -{ - SampleTableEntryMP4V *ste; - gint dwidth, dheight; - gint par_n = 0, par_d = 0; - - if ((entry->par_n != 1 || entry->par_d != 1) && - (entry->par_n != entry->par_d)) { - par_n = entry->par_n; - par_d = entry->par_d; - } - - dwidth = entry->width; - dheight = entry->height; - /* ISO file spec says track header w/h indicates track's visual presentation - * (so this together with pixels w/h implicitly defines PAR) */ - if (par_n && (context->flavor != ATOMS_TREE_FLAVOR_MOV)) { - if (par_n > par_d) { - dwidth = entry->width * par_n / par_d; - dheight = entry->height; - } else { - dwidth = entry->width * par_n / par_d; - dheight = entry->height; - } - } - - atom_trak_set_video_commons (trak, context, scale, dwidth, dheight); - atom_stsd_remove_entries (&trak->mdia.minf.stbl.stsd); - ste = atom_trak_add_video_entry (trak, context, entry->fourcc); - - trak->is_video = TRUE; - trak->is_h264 = (entry->fourcc == FOURCC_avc1); - - ste->version = entry->version; - ste->width = entry->width; - ste->height = entry->height; - ste->depth = entry->depth; - ste->color_table_id = entry->color_table_id; - ste->frame_count = entry->frame_count; - - if (ext_atoms_list) - ste->extension_atoms = g_list_concat (ste->extension_atoms, ext_atoms_list); - - /* QT spec has a pasp extension atom in stsd that can hold PAR */ - if (par_n && (context->flavor == ATOMS_TREE_FLAVOR_MOV)) { - ste->extension_atoms = g_list_append (ste->extension_atoms, - build_pasp_extension (trak, par_n, par_d)); - } -} - -static void -atom_mfhd_init (AtomMFHD * mfhd, guint32 sequence_number) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&(mfhd->header), FOURCC_mfhd, 0, 0, 0, flags); - mfhd->sequence_number = sequence_number; -} - -static void -atom_moof_init (AtomMOOF * moof, AtomsContext * context, - guint32 sequence_number) -{ - atom_header_set (&moof->header, FOURCC_moof, 0, 0); - atom_mfhd_init (&moof->mfhd, sequence_number); - moof->trafs = NULL; -} - -AtomMOOF * -atom_moof_new (AtomsContext * context, guint32 sequence_number) -{ - AtomMOOF *moof = g_new0 (AtomMOOF, 1); - - atom_moof_init (moof, context, sequence_number); - return moof; -} - -static void -atom_trun_free (AtomTRUN * trun) -{ - atom_full_clear (&trun->header); - atom_array_clear (&trun->entries); - g_free (trun); -} - -static void -atom_sdtp_free (AtomSDTP * sdtp) -{ - atom_full_clear (&sdtp->header); - atom_array_clear (&sdtp->entries); - g_free (sdtp); -} - -void -atom_traf_free (AtomTRAF * traf) -{ - GList *walker; - - walker = traf->truns; - while (walker) { - atom_trun_free ((AtomTRUN *) walker->data); - walker = g_list_next (walker); - } - g_list_free (traf->truns); - traf->truns = NULL; - - walker = traf->sdtps; - while (walker) { - atom_sdtp_free ((AtomSDTP *) walker->data); - walker = g_list_next (walker); - } - g_list_free (traf->sdtps); - traf->sdtps = NULL; - - g_free (traf); -} - -void -atom_moof_free (AtomMOOF * moof) -{ - GList *walker; - - walker = moof->trafs; - while (walker) { - atom_traf_free ((AtomTRAF *) walker->data); - walker = g_list_next (walker); - } - g_list_free (moof->trafs); - moof->trafs = NULL; - - g_free (moof); -} - -static guint64 -atom_mfhd_copy_data (AtomMFHD * mfhd, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_full_copy_data (&mfhd->header, buffer, size, offset)) { - return 0; - } - - prop_copy_uint32 (mfhd->sequence_number, buffer, size, offset); - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_tfhd_copy_data (AtomTFHD * tfhd, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - guint32 flags; - - if (!atom_full_copy_data (&tfhd->header, buffer, size, offset)) { - return 0; - } - - prop_copy_uint32 (tfhd->track_ID, buffer, size, offset); - - flags = atom_full_get_flags_as_uint (&tfhd->header); - - if (flags & TF_BASE_DATA_OFFSET) - prop_copy_uint64 (tfhd->base_data_offset, buffer, size, offset); - if (flags & TF_SAMPLE_DESCRIPTION_INDEX) - prop_copy_uint32 (tfhd->sample_description_index, buffer, size, offset); - if (flags & TF_DEFAULT_SAMPLE_DURATION) - prop_copy_uint32 (tfhd->default_sample_duration, buffer, size, offset); - if (flags & TF_DEFAULT_SAMPLE_SIZE) - prop_copy_uint32 (tfhd->default_sample_size, buffer, size, offset); - if (flags & TF_DEFAULT_SAMPLE_FLAGS) - prop_copy_uint32 (tfhd->default_sample_flags, buffer, size, offset); - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_trun_copy_data (AtomTRUN * trun, guint8 ** buffer, guint64 * size, - guint64 * offset, guint32 * data_offset) -{ - guint64 original_offset = *offset; - guint32 flags, i; - - flags = atom_full_get_flags_as_uint (&trun->header); - - /* if first trun in moof, forcibly add data_offset and record - * where it must be written later on */ - if (data_offset && !*data_offset) { - flags |= TR_DATA_OFFSET; - } else { - flags &= ~TR_DATA_OFFSET; - } - - atom_full_set_flags_as_uint (&trun->header, flags); - - if (!atom_full_copy_data (&trun->header, buffer, size, offset)) { - return 0; - } - - prop_copy_uint32 (trun->sample_count, buffer, size, offset); - - if (flags & TR_DATA_OFFSET) { - *data_offset = *offset; - prop_copy_int32 (trun->data_offset, buffer, size, offset); - } - if (flags & TR_FIRST_SAMPLE_FLAGS) - prop_copy_uint32 (trun->first_sample_flags, buffer, size, offset); - - for (i = 0; i < atom_array_get_len (&trun->entries); i++) { - TRUNSampleEntry *entry = &atom_array_index (&trun->entries, i); - - if (flags & TR_SAMPLE_DURATION) - prop_copy_uint32 (entry->sample_duration, buffer, size, offset); - if (flags & TR_SAMPLE_SIZE) - prop_copy_uint32 (entry->sample_size, buffer, size, offset); - if (flags & TR_SAMPLE_FLAGS) - prop_copy_uint32 (entry->sample_flags, buffer, size, offset); - if (flags & TR_COMPOSITION_TIME_OFFSETS) - prop_copy_uint32 (entry->sample_composition_time_offset, - buffer, size, offset); - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_sdtp_copy_data (AtomSDTP * sdtp, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!atom_full_copy_data (&sdtp->header, buffer, size, offset)) { - return 0; - } - - /* all entries at once */ - prop_copy_fixed_size_string (&atom_array_index (&sdtp->entries, 0), - atom_array_get_len (&sdtp->entries), buffer, size, offset); - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_traf_copy_data (AtomTRAF * traf, guint8 ** buffer, guint64 * size, - guint64 * offset, guint32 * data_offset) -{ - guint64 original_offset = *offset; - GList *walker; - - if (!atom_copy_data (&traf->header, buffer, size, offset)) { - return 0; - } - if (!atom_tfhd_copy_data (&traf->tfhd, buffer, size, offset)) { - return 0; - } - - walker = g_list_first (traf->truns); - while (walker != NULL) { - if (!atom_trun_copy_data ((AtomTRUN *) walker->data, buffer, size, offset, - data_offset)) { - return 0; - } - walker = g_list_next (walker); - } - - walker = g_list_first (traf->sdtps); - while (walker != NULL) { - if (!atom_sdtp_copy_data ((AtomSDTP *) walker->data, buffer, size, offset)) { - return 0; - } - walker = g_list_next (walker); - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -/* creates moof atom; metadata is written expecting actual buffer data - * is in mdata directly after moof, and is consecutively written per trak */ -guint64 -atom_moof_copy_data (AtomMOOF * moof, guint8 ** buffer, - guint64 * size, guint64 * offset) -{ - guint64 original_offset = *offset; - GList *walker; - guint32 data_offset = 0; - - if (!atom_copy_data (&moof->header, buffer, size, offset)) - return 0; - - if (!atom_mfhd_copy_data (&moof->mfhd, buffer, size, offset)) - return 0; - - walker = g_list_first (moof->trafs); - while (walker != NULL) { - if (!atom_traf_copy_data ((AtomTRAF *) walker->data, buffer, size, offset, - &data_offset)) { - return 0; - } - walker = g_list_next (walker); - } - - atom_write_size (buffer, size, offset, original_offset); - - if (*buffer && data_offset) { - /* first trun needs a data-offset relative to moof start - * = moof size + mdat prefix */ - GST_WRITE_UINT32_BE (*buffer + data_offset, *offset - original_offset + 8); - } - - return *offset - original_offset; -} - -static void -atom_tfhd_init (AtomTFHD * tfhd, guint32 track_ID) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&tfhd->header, FOURCC_tfhd, 0, 0, 0, flags); - tfhd->track_ID = track_ID; - tfhd->base_data_offset = 0; - tfhd->sample_description_index = 1; - tfhd->default_sample_duration = 0; - tfhd->default_sample_size = 0; - tfhd->default_sample_flags = 0; -} - -static void -atom_trun_init (AtomTRUN * trun) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&trun->header, FOURCC_trun, 0, 0, 0, flags); - trun->sample_count = 0; - trun->data_offset = 0; - trun->first_sample_flags = 0; - atom_array_init (&trun->entries, 512); -} - -static AtomTRUN * -atom_trun_new (void) -{ - AtomTRUN *trun = g_new0 (AtomTRUN, 1); - - atom_trun_init (trun); - return trun; -} - -static void -atom_sdtp_init (AtomSDTP * sdtp) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&sdtp->header, FOURCC_sdtp, 0, 0, 0, flags); - atom_array_init (&sdtp->entries, 512); -} - -static AtomSDTP * -atom_sdtp_new (AtomsContext * context) -{ - AtomSDTP *sdtp = g_new0 (AtomSDTP, 1); - - atom_sdtp_init (sdtp); - return sdtp; -} - -static void -atom_traf_add_sdtp (AtomTRAF * traf, AtomSDTP * sdtp) -{ - traf->sdtps = g_list_append (traf->sdtps, sdtp); -} - -static void -atom_sdtp_add_samples (AtomSDTP * sdtp, guint8 val) -{ - /* it does not make much/any sense according to specs, - * but that's how MS isml samples seem to do it */ - atom_array_append (&sdtp->entries, val, 256); -} - -static void -atom_trun_add_samples (AtomTRUN * trun, guint32 delta, guint32 size, - guint32 flags, gint64 pts_offset) -{ - TRUNSampleEntry nentry; - - if (pts_offset != 0) - trun->header.flags[1] |= TR_COMPOSITION_TIME_OFFSETS; - - nentry.sample_duration = delta; - nentry.sample_size = size; - nentry.sample_flags = flags; - nentry.sample_composition_time_offset = pts_offset; - atom_array_append (&trun->entries, nentry, 256); - trun->sample_count++; -} - -static void -atom_traf_init (AtomTRAF * traf, AtomsContext * context, guint32 track_ID) -{ - atom_header_set (&traf->header, FOURCC_traf, 0, 0); - atom_tfhd_init (&traf->tfhd, track_ID); - traf->truns = NULL; - - if (context->flavor == ATOMS_TREE_FLAVOR_ISML) - atom_traf_add_sdtp (traf, atom_sdtp_new (context)); -} - -AtomTRAF * -atom_traf_new (AtomsContext * context, guint32 track_ID) -{ - AtomTRAF *traf = g_new0 (AtomTRAF, 1); - - atom_traf_init (traf, context, track_ID); - return traf; -} - -static void -atom_traf_add_trun (AtomTRAF * traf, AtomTRUN * trun) -{ - traf->truns = g_list_append (traf->truns, trun); -} - -void -atom_traf_add_samples (AtomTRAF * traf, guint32 delta, guint32 size, - gboolean sync, gint64 pts_offset, gboolean sdtp_sync) -{ - AtomTRUN *trun; - guint32 flags; - - /* 0x10000 is sample-is-difference-sample flag - * low byte stuff is what ismv uses */ - flags = (sync ? 0x0 : 0x10000) | (sdtp_sync ? 0x40 : 0xc0); - - if (G_UNLIKELY (!traf->truns)) { - trun = atom_trun_new (); - atom_traf_add_trun (traf, trun); - /* optimistic; indicate all defaults present in tfhd */ - traf->tfhd.header.flags[2] = TF_DEFAULT_SAMPLE_DURATION | - TF_DEFAULT_SAMPLE_SIZE | TF_DEFAULT_SAMPLE_FLAGS; - traf->tfhd.default_sample_duration = delta; - traf->tfhd.default_sample_size = size; - traf->tfhd.default_sample_flags = flags; - trun->first_sample_flags = flags; - } - - trun = traf->truns->data; - - /* check if still matching defaults, - * if not, abandon default and need entry for each sample */ - if (traf->tfhd.default_sample_duration != delta) { - traf->tfhd.header.flags[2] &= ~TF_DEFAULT_SAMPLE_DURATION; - trun->header.flags[1] |= (TR_SAMPLE_DURATION >> 8); - } - if (traf->tfhd.default_sample_size != size) { - traf->tfhd.header.flags[2] &= ~TF_DEFAULT_SAMPLE_SIZE; - trun->header.flags[1] |= (TR_SAMPLE_SIZE >> 8); - } - if (traf->tfhd.default_sample_flags != flags) { - if (trun->sample_count == 1) { - /* at least will need first sample flag */ - traf->tfhd.default_sample_flags = flags; - trun->header.flags[2] |= TR_FIRST_SAMPLE_FLAGS; - } else { - /* now we need sample flags for each sample */ - traf->tfhd.header.flags[2] &= ~TF_DEFAULT_SAMPLE_FLAGS; - trun->header.flags[1] |= (TR_SAMPLE_FLAGS >> 8); - trun->header.flags[2] &= ~TR_FIRST_SAMPLE_FLAGS; - } - } - - atom_trun_add_samples (traf->truns->data, delta, size, flags, pts_offset); - - if (traf->sdtps) - atom_sdtp_add_samples (traf->sdtps->data, 0x10 | ((flags & 0xff) >> 4)); -} - -guint32 -atom_traf_get_sample_num (AtomTRAF * traf) -{ - AtomTRUN *trun; - - if (G_UNLIKELY (!traf->truns)) - return 0; - - trun = traf->truns->data; - return atom_array_get_len (&trun->entries); -} - -void -atom_moof_add_traf (AtomMOOF * moof, AtomTRAF * traf) -{ - moof->trafs = g_list_append (moof->trafs, traf); -} - -static void -atom_tfra_free (AtomTFRA * tfra) -{ - atom_full_clear (&tfra->header); - atom_array_clear (&tfra->entries); - g_free (tfra); -} - -AtomMFRA * -atom_mfra_new (AtomsContext * context) -{ - AtomMFRA *mfra = g_new0 (AtomMFRA, 1); - - atom_header_set (&mfra->header, FOURCC_mfra, 0, 0); - return mfra; -} - -void -atom_mfra_add_tfra (AtomMFRA * mfra, AtomTFRA * tfra) -{ - mfra->tfras = g_list_append (mfra->tfras, tfra); -} - -void -atom_mfra_free (AtomMFRA * mfra) -{ - GList *walker; - - walker = mfra->tfras; - while (walker) { - atom_tfra_free ((AtomTFRA *) walker->data); - walker = g_list_next (walker); - } - g_list_free (mfra->tfras); - mfra->tfras = NULL; - - atom_clear (&mfra->header); - g_free (mfra); -} - -static void -atom_tfra_init (AtomTFRA * tfra, guint32 track_ID) -{ - guint8 flags[3] = { 0, 0, 0 }; - - atom_full_init (&tfra->header, FOURCC_tfra, 0, 0, 0, flags); - tfra->track_ID = track_ID; - atom_array_init (&tfra->entries, 512); -} - -AtomTFRA * -atom_tfra_new (AtomsContext * context, guint32 track_ID) -{ - AtomTFRA *tfra = g_new0 (AtomTFRA, 1); - - atom_tfra_init (tfra, track_ID); - return tfra; - -} - -static inline gint -need_bytes (guint32 num) -{ - gint n = 0; - - while (num >>= 8) - n++; - - return n; -} - -void -atom_tfra_add_entry (AtomTFRA * tfra, guint64 dts, guint32 sample_num) -{ - TFRAEntry entry; - - entry.time = dts; - /* fill in later */ - entry.moof_offset = 0; - /* always write a single trun in a single traf */ - entry.traf_number = 1; - entry.trun_number = 1; - entry.sample_number = sample_num; - - /* auto-use 64 bits if needed */ - if (dts > G_MAXUINT32) - tfra->header.version = 1; - - /* 1 byte will always do for traf and trun number, - * check how much sample_num needs */ - tfra->lengths = (tfra->lengths & 0xfc) || - MAX (tfra->lengths, need_bytes (sample_num)); - - atom_array_append (&tfra->entries, entry, 256); -} - -void -atom_tfra_update_offset (AtomTFRA * tfra, guint64 offset) -{ - gint i; - - /* auto-use 64 bits if needed */ - if (offset > G_MAXUINT32) - tfra->header.version = 1; - - for (i = atom_array_get_len (&tfra->entries) - 1; i >= 0; i--) { - TFRAEntry *entry = &atom_array_index (&tfra->entries, i); - - if (entry->moof_offset) - break; - entry->moof_offset = offset; - } -} - -static guint64 -atom_tfra_copy_data (AtomTFRA * tfra, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - guint32 i; - TFRAEntry *entry; - guint32 data; - guint bytes; - guint version; - - if (!atom_full_copy_data (&tfra->header, buffer, size, offset)) { - return 0; - } - - prop_copy_uint32 (tfra->track_ID, buffer, size, offset); - prop_copy_uint32 (tfra->lengths, buffer, size, offset); - prop_copy_uint32 (atom_array_get_len (&tfra->entries), buffer, size, offset); - - version = tfra->header.version; - for (i = 0; i < atom_array_get_len (&tfra->entries); ++i) { - entry = &atom_array_index (&tfra->entries, i); - if (version) { - prop_copy_uint64 (entry->time, buffer, size, offset); - prop_copy_uint64 (entry->moof_offset, buffer, size, offset); - } else { - prop_copy_uint32 (entry->time, buffer, size, offset); - prop_copy_uint32 (entry->moof_offset, buffer, size, offset); - } - - bytes = (tfra->lengths & (0x3 << 4)) + 1; - data = GUINT32_TO_BE (entry->traf_number); - prop_copy_fixed_size_string (((guint8 *) & data) + 4 - bytes, bytes, - buffer, size, offset); - - bytes = (tfra->lengths & (0x3 << 2)) + 1; - data = GUINT32_TO_BE (entry->trun_number); - prop_copy_fixed_size_string (((guint8 *) & data) + 4 - bytes, bytes, - buffer, size, offset); - - bytes = (tfra->lengths & (0x3)) + 1; - data = GUINT32_TO_BE (entry->sample_number); - prop_copy_fixed_size_string (((guint8 *) & data) + 4 - bytes, bytes, - buffer, size, offset); - - } - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -static guint64 -atom_mfro_copy_data (guint32 s, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - guint8 flags[3] = { 0, 0, 0 }; - AtomFull mfro; - - atom_full_init (&mfro, FOURCC_mfro, 0, 0, 0, flags); - - if (!atom_full_copy_data (&mfro, buffer, size, offset)) { - return 0; - } - - prop_copy_uint32 (s, buffer, size, offset); - - atom_write_size (buffer, size, offset, original_offset); - - return *offset - original_offset; -} - - -guint64 -atom_mfra_copy_data (AtomMFRA * mfra, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - guint64 original_offset = *offset; - GList *walker; - - if (!atom_copy_data (&mfra->header, buffer, size, offset)) - return 0; - - walker = g_list_first (mfra->tfras); - while (walker != NULL) { - if (!atom_tfra_copy_data ((AtomTFRA *) walker->data, buffer, size, offset)) { - return 0; - } - walker = g_list_next (walker); - } - - /* 16 is the size of the mfro atom */ - if (!atom_mfro_copy_data (*offset - original_offset + 16, buffer, - size, offset)) - return 0; - - atom_write_size (buffer, size, offset, original_offset); - return *offset - original_offset; -} - -/* some sample description construction helpers */ - -AtomInfo * -build_esds_extension (AtomTRAK * trak, guint8 object_type, guint8 stream_type, - const GstBuffer * codec_data, guint32 avg_bitrate, guint32 max_bitrate) -{ - guint32 track_id; - AtomESDS *esds; - - track_id = trak->tkhd.track_ID; - - esds = atom_esds_new (); - esds->es.id = track_id & 0xFFFF; - esds->es.dec_conf_desc.object_type = object_type; - esds->es.dec_conf_desc.stream_type = stream_type << 2 | 0x01; - - if (avg_bitrate > 0) - esds->es.dec_conf_desc.avg_bitrate = avg_bitrate; - if (max_bitrate > 0) - esds->es.dec_conf_desc.max_bitrate = max_bitrate; - - /* optional DecoderSpecificInfo */ - if (codec_data) { - DecoderSpecificInfoDescriptor *desc; - - esds->es.dec_conf_desc.dec_specific_info = desc = - desc_dec_specific_info_new (); - desc_dec_specific_info_alloc_data (desc, GST_BUFFER_SIZE (codec_data)); - - memcpy (desc->data, GST_BUFFER_DATA (codec_data), - GST_BUFFER_SIZE (codec_data)); - } - - return build_atom_info_wrapper ((Atom *) esds, atom_esds_copy_data, - atom_esds_free); -} - -AtomInfo * -build_btrt_extension (guint32 buffer_size_db, guint32 avg_bitrate, - guint32 max_bitrate) -{ - AtomData *atom_data; - GstBuffer *buf; - - if (buffer_size_db == 0 && avg_bitrate == 0 && max_bitrate == 0) - return 0; - - buf = gst_buffer_new_and_alloc (12); - - GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf), buffer_size_db); - GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf) + 4, max_bitrate); - GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf) + 8, avg_bitrate); - - atom_data = - atom_data_new_from_gst_buffer (GST_MAKE_FOURCC ('b', 't', 'r', 't'), buf); - gst_buffer_unref (buf); - - return build_atom_info_wrapper ((Atom *) atom_data, atom_data_copy_data, - atom_data_free); -} - -static AtomInfo * -build_mov_wave_extension (AtomTRAK * trak, guint32 fourcc, AtomInfo * atom1, - AtomInfo * atom2, gboolean terminator) -{ - AtomWAVE *wave; - AtomFRMA *frma; - Atom *ext_atom; - - /* Build WAVE atom for sample table entry */ - wave = atom_wave_new (); - - /* Prepend Terminator atom to the WAVE list first, so it ends up last */ - if (terminator) { - ext_atom = (Atom *) atom_data_new (FOURCC_null); - wave->extension_atoms = - atom_info_list_prepend_atom (wave->extension_atoms, (Atom *) ext_atom, - (AtomCopyDataFunc) atom_data_copy_data, (AtomFreeFunc) atom_data_free); - } - - /* Add supplied atoms to WAVE */ - if (atom2) - wave->extension_atoms = g_list_prepend (wave->extension_atoms, atom2); - if (atom1) - wave->extension_atoms = g_list_prepend (wave->extension_atoms, atom1); - - /* Add FRMA to the WAVE */ - frma = atom_frma_new (); - frma->media_type = fourcc; - - wave->extension_atoms = - atom_info_list_prepend_atom (wave->extension_atoms, (Atom *) frma, - (AtomCopyDataFunc) atom_frma_copy_data, (AtomFreeFunc) atom_frma_free); - - return build_atom_info_wrapper ((Atom *) wave, atom_wave_copy_data, - atom_wave_free); -} - -AtomInfo * -build_mov_aac_extension (AtomTRAK * trak, const GstBuffer * codec_data, - guint32 avg_bitrate, guint32 max_bitrate) -{ - AtomInfo *esds, *mp4a; - GstBuffer *buf; - - /* Add ESDS atom to WAVE */ - esds = build_esds_extension (trak, ESDS_OBJECT_TYPE_MPEG4_P3, - ESDS_STREAM_TYPE_AUDIO, codec_data, avg_bitrate, max_bitrate); - - /* Add MP4A atom to the WAVE: - * not really in spec, but makes offset based players happy */ - buf = gst_buffer_new_and_alloc (4); - *((guint32 *) GST_BUFFER_DATA (buf)) = 0; - mp4a = build_codec_data_extension (FOURCC_mp4a, buf); - gst_buffer_unref (buf); - - return build_mov_wave_extension (trak, FOURCC_mp4a, mp4a, esds, TRUE); -} - -AtomInfo * -build_mov_alac_extension (AtomTRAK * trak, const GstBuffer * codec_data) -{ - AtomInfo *alac; - - alac = build_codec_data_extension (FOURCC_alac, codec_data); - - return build_mov_wave_extension (trak, FOURCC_alac, NULL, alac, TRUE); -} - -AtomInfo * -build_fiel_extension (gint fields) -{ - AtomData *atom_data; - GstBuffer *buf; - - if (fields == 1) { - return NULL; - } - - buf = gst_buffer_new_and_alloc (1); - GST_BUFFER_DATA (buf)[0] = (guint8) fields; - - atom_data = - atom_data_new_from_gst_buffer (GST_MAKE_FOURCC ('f', 'i', 'e', 'l'), buf); - gst_buffer_unref (buf); - - return build_atom_info_wrapper ((Atom *) atom_data, atom_data_copy_data, - atom_data_free); -} - -AtomInfo * -build_jp2x_extension (const GstBuffer * prefix) -{ - AtomData *atom_data; - - if (!prefix) { - return NULL; - } - - atom_data = - atom_data_new_from_gst_buffer (GST_MAKE_FOURCC ('j', 'p', '2', 'x'), - prefix); - - return build_atom_info_wrapper ((Atom *) atom_data, atom_data_copy_data, - atom_data_free); -} - -AtomInfo * -build_jp2h_extension (AtomTRAK * trak, gint width, gint height, guint32 fourcc, - gint ncomp, const GValue * cmap_array, const GValue * cdef_array) -{ - AtomData *atom_data; - GstBuffer *buf; - guint8 cenum; - gint i; - gint idhr_size = 22; - gint colr_size = 15; - gint cmap_size = 0, cdef_size = 0; - gint cmap_array_size = 0; - gint cdef_array_size = 0; - GstByteWriter writer; - - g_return_val_if_fail (cmap_array == NULL || - GST_VALUE_HOLDS_ARRAY (cmap_array), NULL); - g_return_val_if_fail (cdef_array == NULL || - GST_VALUE_HOLDS_ARRAY (cdef_array), NULL); - - if (fourcc == GST_MAKE_FOURCC ('s', 'R', 'G', 'B')) { - cenum = 0x10; - if (ncomp == 0) - ncomp = 3; - } else if (fourcc == GST_MAKE_FOURCC ('G', 'R', 'A', 'Y')) { - cenum = 0x11; - if (ncomp == 0) - ncomp = 1; - } else if (fourcc == GST_MAKE_FOURCC ('s', 'Y', 'U', 'V')) { - cenum = 0x12; - if (ncomp == 0) - ncomp = 3; - } else - return NULL; - - if (cmap_array) { - cmap_array_size = gst_value_array_get_size (cmap_array); - cmap_size = 8 + cmap_array_size * 4; - } - if (cdef_array) { - cdef_array_size = gst_value_array_get_size (cdef_array); - cdef_size = 8 + 2 + cdef_array_size * 6; - } - - buf = gst_buffer_new_and_alloc (idhr_size + colr_size + cmap_size + - cdef_size); - gst_byte_writer_init_with_buffer (&writer, buf, FALSE); - - /* ihdr = image header box */ - gst_byte_writer_put_uint32_be (&writer, 22); - gst_byte_writer_put_uint32_le (&writer, GST_MAKE_FOURCC ('i', 'h', 'd', 'r')); - gst_byte_writer_put_uint32_be (&writer, height); - gst_byte_writer_put_uint32_be (&writer, width); - gst_byte_writer_put_uint16_be (&writer, ncomp); - /* 8 bits per component, unsigned */ - gst_byte_writer_put_uint8 (&writer, 0x7); - /* compression type; reserved */ - gst_byte_writer_put_uint8 (&writer, 0x7); - /* colour space (un)known */ - gst_byte_writer_put_uint8 (&writer, 0x0); - /* intellectual property right (box present) */ - gst_byte_writer_put_uint8 (&writer, 0x0); - - /* colour specification box */ - gst_byte_writer_put_uint32_be (&writer, 15); - gst_byte_writer_put_uint32_le (&writer, GST_MAKE_FOURCC ('c', 'o', 'l', 'r')); - - /* specification method: enumerated */ - gst_byte_writer_put_uint8 (&writer, 0x1); - /* precedence; reserved */ - gst_byte_writer_put_uint8 (&writer, 0x0); - /* approximation; reserved */ - gst_byte_writer_put_uint8 (&writer, 0x0); - /* enumerated colourspace */ - gst_byte_writer_put_uint32_be (&writer, cenum); - - if (cmap_array) { - gst_byte_writer_put_uint32_be (&writer, cmap_size); - gst_byte_writer_put_uint32_le (&writer, - GST_MAKE_FOURCC ('c', 'm', 'a', 'p')); - for (i = 0; i < cmap_array_size; i++) { - const GValue *item; - gint value; - guint16 cmp; - guint8 mtyp; - guint8 pcol; - item = gst_value_array_get_value (cmap_array, i); - value = g_value_get_int (item); - - /* value is '(mtyp << 24) | (pcol << 16) | cmp' */ - cmp = value & 0xFFFF; - mtyp = value >> 24; - pcol = (value >> 16) & 0xFF; - - if (mtyp == 1) - GST_WARNING ("MTYP of cmap atom signals Pallete Mapping, but we don't " - "handle Pallete mapping atoms yet"); - - gst_byte_writer_put_uint16_be (&writer, cmp); - gst_byte_writer_put_uint8 (&writer, mtyp); - gst_byte_writer_put_uint8 (&writer, pcol); - } - } - - if (cdef_array) { - gst_byte_writer_put_uint32_be (&writer, cdef_size); - gst_byte_writer_put_uint32_le (&writer, - GST_MAKE_FOURCC ('c', 'd', 'e', 'f')); - gst_byte_writer_put_uint16_be (&writer, cdef_array_size); - for (i = 0; i < cdef_array_size; i++) { - const GValue *item; - gint value; - item = gst_value_array_get_value (cdef_array, i); - value = g_value_get_int (item); - - gst_byte_writer_put_uint16_be (&writer, i); - if (value > 0) { - gst_byte_writer_put_uint16_be (&writer, 0); - gst_byte_writer_put_uint16_be (&writer, value); - } else if (value < 0) { - gst_byte_writer_put_uint16_be (&writer, -value); - gst_byte_writer_put_uint16_be (&writer, 0); /* TODO what here? */ - } else { - gst_byte_writer_put_uint16_be (&writer, 1); - gst_byte_writer_put_uint16_be (&writer, 0); - } - } - } - - g_assert (gst_byte_writer_get_remaining (&writer) == 0); - - atom_data = atom_data_new_from_gst_buffer (FOURCC_jp2h, buf); - gst_buffer_unref (buf); - - return build_atom_info_wrapper ((Atom *) atom_data, atom_data_copy_data, - atom_data_free); -} - -AtomInfo * -build_codec_data_extension (guint32 fourcc, const GstBuffer * codec_data) -{ - AtomData *data; - AtomInfo *result = NULL; - - if (codec_data) { - data = atom_data_new_from_gst_buffer (fourcc, codec_data); - result = build_atom_info_wrapper ((Atom *) data, atom_data_copy_data, - atom_data_free); - } - - return result; -} - -AtomInfo * -build_amr_extension (void) -{ - guint8 ext[9]; - GstBuffer *buf; - AtomInfo *res; - - buf = gst_buffer_new (); - GST_BUFFER_DATA (buf) = ext; - GST_BUFFER_SIZE (buf) = sizeof (ext); - - /* vendor */ - GST_WRITE_UINT32_LE (ext, 0); - /* decoder version */ - GST_WRITE_UINT8 (ext + 4, 0); - /* mode set (all modes) */ - GST_WRITE_UINT16_BE (ext + 5, 0x81FF); - /* mode change period (no restriction) */ - GST_WRITE_UINT8 (ext + 7, 0); - /* frames per sample */ - GST_WRITE_UINT8 (ext + 8, 1); - - res = build_codec_data_extension (GST_MAKE_FOURCC ('d', 'a', 'm', 'r'), buf); - gst_buffer_unref (buf); - return res; -} - -AtomInfo * -build_h263_extension (void) -{ - guint8 ext[7]; - GstBuffer *buf; - AtomInfo *res; - - buf = gst_buffer_new (); - GST_BUFFER_DATA (buf) = ext; - GST_BUFFER_SIZE (buf) = sizeof (ext); - - /* vendor */ - GST_WRITE_UINT32_LE (ext, 0); - /* decoder version */ - GST_WRITE_UINT8 (ext + 4, 0); - /* level / profile */ - /* FIXME ? maybe ? obtain somewhere; baseline for now */ - GST_WRITE_UINT8 (ext + 5, 10); - GST_WRITE_UINT8 (ext + 6, 0); - - res = build_codec_data_extension (GST_MAKE_FOURCC ('d', '2', '6', '3'), buf); - gst_buffer_unref (buf); - return res; -} - -AtomInfo * -build_gama_atom (gdouble gamma) -{ - AtomInfo *res; - guint32 gamma_fp; - GstBuffer *buf; - - /* convert to uint32 from fixed point */ - gamma_fp = (guint32) 65536 *gamma; - - buf = gst_buffer_new_and_alloc (4); - GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf), gamma_fp); - res = build_codec_data_extension (FOURCC_gama, buf); - gst_buffer_unref (buf); - return res; -} - -AtomInfo * -build_SMI_atom (const GstBuffer * seqh) -{ - AtomInfo *res; - GstBuffer *buf; - - /* the seqh plus its size and fourcc */ - buf = gst_buffer_new_and_alloc (GST_BUFFER_SIZE (seqh) + 8); - - GST_WRITE_UINT32_LE (GST_BUFFER_DATA (buf), FOURCC_SEQH); - GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf) + 4, GST_BUFFER_SIZE (seqh)); - memcpy (GST_BUFFER_DATA (buf) + 8, GST_BUFFER_DATA (seqh), - GST_BUFFER_SIZE (seqh)); - res = build_codec_data_extension (FOURCC_SMI_, buf); - gst_buffer_unref (buf); - return res; -} - -static AtomInfo * -build_ima_adpcm_atom (gint channels, gint rate, gint blocksize) -{ - AtomData *atom_data; - GstBuffer *buf; - guint8 *data; - const gint ima_adpcm_atom_size = 20; - guint32 fourcc; - gint samplesperblock; - gint bytespersec; - - /* The FOURCC for WAV codecs in QT is 'ms' followed by the 16 bit wave codec - identifier. Note that the identifier here is big-endian, but when used - within the WAVE header (below), it's little endian. */ - fourcc = MS_WAVE_FOURCC (0x11); - - buf = gst_buffer_new_and_alloc (ima_adpcm_atom_size); - data = GST_BUFFER_DATA (buf); - - /* This atom's content is a WAVE header, including 2 bytes of extra data. - Note that all of this is little-endian, unlike most stuff in qt. */ - /* 4 bytes header per channel (including 1 sample). Then 2 samples per byte - for the rest. Simplifies to this. */ - samplesperblock = 2 * blocksize / channels - 7; - bytespersec = rate * blocksize / samplesperblock; - GST_WRITE_UINT16_LE (data, 0x11); - GST_WRITE_UINT16_LE (data + 2, channels); - GST_WRITE_UINT32_LE (data + 4, rate); - GST_WRITE_UINT32_LE (data + 8, bytespersec); - GST_WRITE_UINT16_LE (data + 12, blocksize); - GST_WRITE_UINT16_LE (data + 14, 4); - GST_WRITE_UINT16_LE (data + 16, 2); /* Two extra bytes */ - GST_WRITE_UINT16_LE (data + 18, samplesperblock); - - atom_data = atom_data_new_from_gst_buffer (fourcc, buf); - gst_buffer_unref (buf); - - return build_atom_info_wrapper ((Atom *) atom_data, atom_data_copy_data, - atom_data_free); -} - -AtomInfo * -build_ima_adpcm_extension (gint channels, gint rate, gint blocksize) -{ - AtomWAVE *wave; - AtomFRMA *frma; - Atom *ext_atom; - - /* Add WAVE atom */ - wave = atom_wave_new (); - - /* Prepend Terminator atom to the WAVE list first, so it ends up last */ - ext_atom = (Atom *) atom_data_new (FOURCC_null); - wave->extension_atoms = - atom_info_list_prepend_atom (wave->extension_atoms, (Atom *) ext_atom, - (AtomCopyDataFunc) atom_data_copy_data, (AtomFreeFunc) atom_data_free); - - /* Add wave ima adpcm atom to WAVE */ - wave->extension_atoms = g_list_prepend (wave->extension_atoms, - build_ima_adpcm_atom (channels, rate, blocksize)); - - /* Add FRMA to the WAVE */ - frma = atom_frma_new (); - frma->media_type = MS_WAVE_FOURCC (0x11); - - wave->extension_atoms = - atom_info_list_prepend_atom (wave->extension_atoms, (Atom *) frma, - (AtomCopyDataFunc) atom_frma_copy_data, (AtomFreeFunc) atom_frma_free); - - return build_atom_info_wrapper ((Atom *) wave, atom_wave_copy_data, - atom_wave_free); -} - -AtomInfo * -build_uuid_xmp_atom (const GstTagList * taglist) -{ - GstBuffer *xmp_data; - AtomUUID *uuid; - static guint8 xmp_uuid[] = { 0xBE, 0x7A, 0xCF, 0xCB, - 0x97, 0xA9, 0x42, 0xE8, - 0x9C, 0x71, 0x99, 0x94, - 0x91, 0xE3, 0xAF, 0xAC - }; - - xmp_data = gst_tag_list_to_xmp_buffer (taglist, TRUE); - if (xmp_data == NULL) - return NULL; - - uuid = atom_uuid_new (); - memcpy (uuid->uuid, xmp_uuid, 16); - - uuid->data = g_malloc (GST_BUFFER_SIZE (xmp_data)); - uuid->datalen = GST_BUFFER_SIZE (xmp_data); - memcpy (uuid->data, GST_BUFFER_DATA (xmp_data), GST_BUFFER_SIZE (xmp_data)); - - gst_buffer_unref (xmp_data); - return build_atom_info_wrapper ((Atom *) uuid, atom_uuid_copy_data, - atom_uuid_free); -} diff --git a/gst/qtmux/atoms.h b/gst/qtmux/atoms.h deleted file mode 100644 index d1241184d7..0000000000 --- a/gst/qtmux/atoms.h +++ /dev/null @@ -1,956 +0,0 @@ -/* Quicktime muxer plugin for GStreamer - * Copyright (C) 2008-2010 Thiago Santos - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* - * Unless otherwise indicated, Source Code is licensed under MIT license. - * See further explanation attached in License Statement (distributed in the file - * LICENSE). - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef __ATOMS_H__ -#define __ATOMS_H__ - -#include -#include - -#include "descriptors.h" -#include "properties.h" -#include "fourcc.h" -#include "ftypcc.h" - -/* helper storage struct */ -#define ATOM_ARRAY(struct_type) \ -struct { \ - guint size; \ - guint len; \ - struct_type *data; \ -} - -/* storage helpers */ - -#define atom_array_init(array, reserve) \ -G_STMT_START { \ - (array)->len = 0; \ - (array)->size = reserve; \ - (array)->data = g_malloc (sizeof (*(array)->data) * reserve); \ -} G_STMT_END - -#define atom_array_append(array, elmt, inc) \ -G_STMT_START { \ - g_assert ((array)->data); \ - g_assert (inc > 0); \ - if (G_UNLIKELY ((array)->len == (array)->size)) { \ - (array)->size += inc; \ - (array)->data = \ - g_realloc ((array)->data, sizeof (*((array)->data)) * (array)->size); \ - } \ - (array)->data[(array)->len] = elmt; \ - (array)->len++; \ -} G_STMT_END - -#define atom_array_get_len(array) ((array)->len) -#define atom_array_index(array, index) ((array)->data[index]) - -#define atom_array_clear(array) \ -G_STMT_START { \ - (array)->size = (array)->len = 0; \ - g_free ((array)->data); \ - (array)->data = NULL; \ -} G_STMT_END - -/* light-weight context that may influence header atom tree construction */ -typedef enum _AtomsTreeFlavor -{ - ATOMS_TREE_FLAVOR_MOV, - ATOMS_TREE_FLAVOR_ISOM, - ATOMS_TREE_FLAVOR_3GP, - ATOMS_TREE_FLAVOR_ISML -} AtomsTreeFlavor; - -typedef struct _AtomsContext -{ - AtomsTreeFlavor flavor; -} AtomsContext; - -AtomsContext* atoms_context_new (AtomsTreeFlavor flavor); -void atoms_context_free (AtomsContext *context); - -#define METADATA_DATA_FLAG 0x0 -#define METADATA_TEXT_FLAG 0x1 - -/* atom defs and functions */ - -/** - * Used for storing time related values for some atoms. - */ -typedef struct _TimeInfo -{ - guint64 creation_time; - guint64 modification_time; - guint32 timescale; - guint64 duration; -} TimeInfo; - -typedef struct _Atom -{ - guint32 size; - guint32 type; - guint64 extended_size; -} Atom; - -typedef struct _AtomFull -{ - Atom header; - - guint8 version; - guint8 flags[3]; -} AtomFull; - -/* - * Generic extension atom - */ -typedef struct _AtomData -{ - Atom header; - - /* not written */ - guint32 datalen; - - guint8 *data; -} AtomData; - -typedef struct _AtomUUID -{ - Atom header; - - guint8 uuid[16]; - - /* not written */ - guint32 datalen; - - guint8 *data; -} AtomUUID; - -typedef struct _AtomFTYP -{ - Atom header; - guint32 major_brand; - guint32 version; - guint32 *compatible_brands; - - /* not written */ - guint32 compatible_brands_size; -} AtomFTYP; - -typedef struct _AtomMVHD -{ - AtomFull header; - - /* version 0: 32 bits */ - TimeInfo time_info; - - guint32 prefered_rate; /* ISO: 0x00010000 */ - guint16 volume; /* ISO: 0x0100 */ - guint16 reserved3; /* ISO: 0x0 */ - guint32 reserved4[2]; /* ISO: 0, 0 */ - /* ISO: identity matrix = - * { 0x00010000, 0, 0, 0, 0x00010000, 0, 0, 0, 0x40000000 } */ - guint32 matrix[9]; - - /* ISO: all 0 */ - guint32 preview_time; - guint32 preview_duration; - guint32 poster_time; - guint32 selection_time; - guint32 selection_duration; - guint32 current_time; - - guint32 next_track_id; -} AtomMVHD; - -typedef struct _AtomTKHD -{ - AtomFull header; - - /* version 0: 32 bits */ - /* like the TimeInfo struct, but it has this track_ID inside */ - guint64 creation_time; - guint64 modification_time; - guint32 track_ID; - guint32 reserved; - guint64 duration; - - guint32 reserved2[2]; - guint16 layer; - guint16 alternate_group; - guint16 volume; - guint16 reserved3; - - /* ISO: identity matrix = - * { 0x00010000, 0, 0, 0, 0x00010000, 0, 0, 0, 0x40000000 } */ - guint32 matrix[9]; - guint32 width; - guint32 height; -} AtomTKHD; - -typedef struct _AtomMDHD -{ - AtomFull header; - - /* version 0: 32 bits */ - TimeInfo time_info; - - /* ISO: packed ISO-639-2/T language code (first bit must be 0) */ - guint16 language_code; - /* ISO: 0 */ - guint16 quality; -} AtomMDHD; - -typedef struct _AtomHDLR -{ - AtomFull header; - - /* ISO: 0 */ - guint32 component_type; - guint32 handler_type; - guint32 manufacturer; - guint32 flags; - guint32 flags_mask; - gchar *name; -} AtomHDLR; - -typedef struct _AtomVMHD -{ - AtomFull header; /* ISO: flags = 1 */ - - guint16 graphics_mode; - /* RGB */ - guint16 opcolor[3]; -} AtomVMHD; - -typedef struct _AtomSMHD -{ - AtomFull header; - - guint16 balance; - guint16 reserved; -} AtomSMHD; - -typedef struct _AtomHMHD -{ - AtomFull header; - - guint16 max_pdu_size; - guint16 avg_pdu_size; - guint32 max_bitrate; - guint32 avg_bitrate; - guint32 sliding_avg_bitrate; -} AtomHMHD; - -typedef struct _AtomURL -{ - AtomFull header; - - gchar *location; -} AtomURL; - -typedef struct _AtomDREF -{ - AtomFull header; - - GList *entries; -} AtomDREF; - -typedef struct _AtomDINF -{ - Atom header; - - AtomDREF dref; -} AtomDINF; - -typedef struct _STTSEntry -{ - guint32 sample_count; - gint32 sample_delta; -} STTSEntry; - -typedef struct _AtomSTTS -{ - AtomFull header; - - ATOM_ARRAY (STTSEntry) entries; -} AtomSTTS; - -typedef struct _AtomSTSS -{ - AtomFull header; - - ATOM_ARRAY (guint32) entries; -} AtomSTSS; - -typedef struct _AtomESDS -{ - AtomFull header; - - ESDescriptor es; -} AtomESDS; - -typedef struct _AtomFRMA -{ - Atom header; - - guint32 media_type; -} AtomFRMA; - -typedef enum _SampleEntryKind -{ - UNKNOWN, - AUDIO, - VIDEO -} SampleEntryKind; - -typedef struct _SampleTableEntry -{ - Atom header; - - guint8 reserved[6]; - guint16 data_reference_index; - - /* sort of entry */ - SampleEntryKind kind; -} SampleTableEntry; - -typedef struct _AtomHintSampleEntry -{ - SampleTableEntry se; - guint32 size; - guint8 *data; -} AtomHintSampleEntry; - -typedef struct _SampleTableEntryMP4V -{ - SampleTableEntry se; - - guint16 version; - guint16 revision_level; - - guint32 vendor; /* fourcc code */ - guint32 temporal_quality; - guint32 spatial_quality; - - guint16 width; - guint16 height; - - guint32 horizontal_resolution; - guint32 vertical_resolution; - guint32 datasize; - - guint16 frame_count; /* usually 1 */ - - guint8 compressor[32]; /* pascal string, i.e. first byte = length */ - - guint16 depth; - guint16 color_table_id; - - /* (optional) list of AtomInfo */ - GList *extension_atoms; -} SampleTableEntryMP4V; - -typedef struct _SampleTableEntryMP4A -{ - SampleTableEntry se; - - guint16 version; - guint16 revision_level; - guint32 vendor; - - guint16 channels; - guint16 sample_size; - guint16 compression_id; - guint16 packet_size; - - guint32 sample_rate; /* fixed point 16.16 */ - - guint32 samples_per_packet; - guint32 bytes_per_packet; - guint32 bytes_per_frame; - guint32 bytes_per_sample; - - /* (optional) list of AtomInfo */ - GList *extension_atoms; -} SampleTableEntryMP4A; - -typedef struct _SampleTableEntryMP4S -{ - SampleTableEntry se; - - AtomESDS es; -} SampleTableEntryMP4S; - -typedef struct _AtomSTSD -{ - AtomFull header; - - guint n_entries; - /* list of subclasses of SampleTableEntry */ - GList *entries; -} AtomSTSD; - -typedef struct _AtomSTSZ -{ - AtomFull header; - - guint32 sample_size; - - /* need the size here because when sample_size is constant, - * the list is empty */ - guint32 table_size; - ATOM_ARRAY (guint32) entries; -} AtomSTSZ; - -typedef struct _STSCEntry -{ - guint32 first_chunk; - guint32 samples_per_chunk; - guint32 sample_description_index; -} STSCEntry; - -typedef struct _AtomSTSC -{ - AtomFull header; - - ATOM_ARRAY (STSCEntry) entries; -} AtomSTSC; - - -/* - * used for both STCO and CO64 - * if used as STCO, entries should be truncated to use only 32bits - */ -typedef struct _AtomSTCO64 -{ - AtomFull header; - - ATOM_ARRAY (guint64) entries; -} AtomSTCO64; - -typedef struct _CTTSEntry -{ - guint32 samplecount; - guint32 sampleoffset; -} CTTSEntry; - -typedef struct _AtomCTTS -{ - AtomFull header; - - /* also entry count here */ - ATOM_ARRAY (CTTSEntry) entries; - gboolean do_pts; -} AtomCTTS; - -typedef struct _AtomSTBL -{ - Atom header; - - AtomSTSD stsd; - AtomSTTS stts; - AtomSTSS stss; - AtomSTSC stsc; - AtomSTSZ stsz; - /* NULL if not present */ - AtomCTTS *ctts; - - AtomSTCO64 stco64; -} AtomSTBL; - -typedef struct _AtomMINF -{ - Atom header; - - /* only (exactly) one of those must be present */ - AtomVMHD *vmhd; - AtomSMHD *smhd; - AtomHMHD *hmhd; - - AtomHDLR *hdlr; - AtomDINF dinf; - AtomSTBL stbl; -} AtomMINF; - -typedef struct _EditListEntry -{ - /* duration in movie's timescale */ - guint32 duration; - /* start time in media's timescale, -1 for empty */ - guint32 media_time; - guint32 media_rate; /* fixed point 32 bit */ -} EditListEntry; - -typedef struct _AtomELST -{ - AtomFull header; - - /* number of entries is implicit */ - GSList *entries; -} AtomELST; - -typedef struct _AtomEDTS -{ - Atom header; - AtomELST elst; -} AtomEDTS; - -typedef struct _AtomMDIA -{ - Atom header; - - AtomMDHD mdhd; - AtomHDLR hdlr; - AtomMINF minf; -} AtomMDIA; - -typedef struct _AtomILST -{ - Atom header; - - /* list of AtomInfo */ - GList* entries; -} AtomILST; - -typedef struct _AtomTagData -{ - AtomFull header; - guint32 reserved; - - guint32 datalen; - guint8* data; -} AtomTagData; - -typedef struct _AtomTag -{ - Atom header; - - AtomTagData data; -} AtomTag; - -typedef struct _AtomMETA -{ - AtomFull header; - AtomHDLR hdlr; - AtomILST *ilst; -} AtomMETA; - -typedef struct _AtomUDTA -{ - Atom header; - - /* list of AtomInfo */ - GList* entries; - /* or list is further down */ - AtomMETA *meta; -} AtomUDTA; - -enum TrFlags -{ - TR_DATA_OFFSET = 0x01, /* data-offset-present */ - TR_FIRST_SAMPLE_FLAGS = 0x04, /* first-sample-flags-present */ - TR_SAMPLE_DURATION = 0x0100, /* sample-duration-present */ - TR_SAMPLE_SIZE = 0x0200, /* sample-size-present */ - TR_SAMPLE_FLAGS = 0x0400, /* sample-flags-present */ - TR_COMPOSITION_TIME_OFFSETS = 0x0800 /* sample-composition-time-offsets-presents */ -}; - -enum TfFlags -{ - TF_BASE_DATA_OFFSET = 0x01, /* base-data-offset-present */ - TF_SAMPLE_DESCRIPTION_INDEX = 0x02, /* sample-description-index-present */ - TF_DEFAULT_SAMPLE_DURATION = 0x08, /* default-sample-duration-present */ - TF_DEFAULT_SAMPLE_SIZE = 0x010, /* default-sample-size-present */ - TF_DEFAULT_SAMPLE_FLAGS = 0x020, /* default-sample-flags-present */ - TF_DURATION_IS_EMPTY = 0x010000 /* sample-composition-time-offsets-presents */ -}; - -typedef struct _AtomTRAK -{ - Atom header; - - AtomTKHD tkhd; - AtomEDTS *edts; - AtomMDIA mdia; - - /* some helper info for structural conformity checks */ - gboolean is_video; - gboolean is_h264; -} AtomTRAK; - -typedef struct _AtomTREX -{ - AtomFull header; - - guint32 track_ID; - guint32 default_sample_description_index; - guint32 default_sample_duration; - guint32 default_sample_size; - guint32 default_sample_flags; -} AtomTREX; - -typedef struct _AtomMEHD -{ - AtomFull header; - - guint64 fragment_duration; -} AtomMEHD; - - -typedef struct _AtomMVEX -{ - Atom header; - - AtomMEHD mehd; - - /* list of AtomTREX */ - GList *trexs; -} AtomMVEX; - -typedef struct _AtomMFHD -{ - AtomFull header; - - guint32 sequence_number; -} AtomMFHD; - -typedef struct _AtomTFHD -{ - AtomFull header; - - guint32 track_ID; - guint64 base_data_offset; - guint32 sample_description_index; - guint32 default_sample_duration; - guint32 default_sample_size; - guint32 default_sample_flags; -} AtomTFHD; - -typedef struct _TRUNSampleEntry -{ - guint32 sample_duration; - guint32 sample_size; - guint32 sample_flags; - guint32 sample_composition_time_offset; -} TRUNSampleEntry; - -typedef struct _AtomTRUN -{ - AtomFull header; - - guint32 sample_count; - gint32 data_offset; - guint32 first_sample_flags; - - /* array of fields */ - ATOM_ARRAY (TRUNSampleEntry) entries; -} AtomTRUN; - -typedef struct _AtomSDTP -{ - AtomFull header; - - /* not serialized */ - guint32 sample_count; - - /* array of fields */ - ATOM_ARRAY (guint8) entries; -} AtomSDTP; - -typedef struct _AtomTRAF -{ - Atom header; - - AtomTFHD tfhd; - - /* list of AtomTRUN */ - GList *truns; - /* list of AtomSDTP */ - GList *sdtps; -} AtomTRAF; - -typedef struct _AtomMOOF -{ - Atom header; - - AtomMFHD mfhd; - - /* list of AtomTRAF */ - GList *trafs; -} AtomMOOF; - - -typedef struct _AtomMOOV -{ - /* style */ - AtomsContext context; - - Atom header; - - AtomMVHD mvhd; - AtomMVEX mvex; - - /* list of AtomTRAK */ - GList *traks; - AtomUDTA *udta; - - gboolean fragmented; -} AtomMOOV; - -typedef struct _AtomWAVE -{ - Atom header; - - /* list of AtomInfo */ - GList *extension_atoms; -} AtomWAVE; - -typedef struct _TFRAEntry -{ - guint64 time; - guint64 moof_offset; - guint32 traf_number; - guint32 trun_number; - guint32 sample_number; -} TFRAEntry; - -typedef struct _AtomTFRA -{ - AtomFull header; - - guint32 track_ID; - guint32 lengths; - /* array of entries */ - ATOM_ARRAY (TFRAEntry) entries; -} AtomTFRA; - -typedef struct _AtomMFRA -{ - Atom header; - - /* list of tfra */ - GList *tfras; -} AtomMFRA; - -/* - * Function to serialize an atom - */ -typedef guint64 (*AtomCopyDataFunc) (Atom *atom, guint8 **buffer, guint64 *size, guint64 *offset); - -/* - * Releases memory allocated by an atom - */ -typedef guint64 (*AtomFreeFunc) (Atom *atom); - -/* - * Some atoms might have many optional different kinds of child atoms, so this - * is useful for enabling generic handling of any atom. - * All we need are the two functions (copying it to an array - * for serialization and the memory releasing function). - */ -typedef struct _AtomInfo -{ - Atom *atom; - AtomCopyDataFunc copy_data_func; - AtomFreeFunc free_func; -} AtomInfo; - - -guint64 atom_copy_data (Atom *atom, guint8 **buffer, - guint64 *size, guint64* offset); - -AtomFTYP* atom_ftyp_new (AtomsContext *context, guint32 major, - guint32 version, GList *brands); -guint64 atom_ftyp_copy_data (AtomFTYP *ftyp, guint8 **buffer, - guint64 *size, guint64 *offset); -void atom_ftyp_free (AtomFTYP *ftyp); - -AtomTRAK* atom_trak_new (AtomsContext *context); -void atom_trak_add_samples (AtomTRAK * trak, guint32 nsamples, guint32 delta, - guint32 size, guint64 chunk_offset, gboolean sync, - gint64 pts_offset); -void atom_trak_add_elst_entry (AtomTRAK * trak, guint32 duration, - guint32 media_time, guint32 rate); -guint32 atom_trak_get_timescale (AtomTRAK *trak); -guint32 atom_trak_get_id (AtomTRAK * trak); -void atom_stbl_add_samples (AtomSTBL * stbl, guint32 nsamples, - guint32 delta, guint32 size, - guint64 chunk_offset, gboolean sync, - gint64 pts_offset); - -AtomMOOV* atom_moov_new (AtomsContext *context); -void atom_moov_free (AtomMOOV *moov); -guint64 atom_moov_copy_data (AtomMOOV *atom, guint8 **buffer, guint64 *size, guint64* offset); -void atom_moov_update_timescale (AtomMOOV *moov, guint32 timescale); -void atom_moov_update_duration (AtomMOOV *moov); -void atom_moov_set_fragmented (AtomMOOV *moov, gboolean fragmented); -void atom_moov_chunks_add_offset (AtomMOOV *moov, guint32 offset); -void atom_moov_add_trak (AtomMOOV *moov, AtomTRAK *trak); - -guint64 atom_mvhd_copy_data (AtomMVHD * atom, guint8 ** buffer, - guint64 * size, guint64 * offset); -void atom_stco64_chunks_add_offset (AtomSTCO64 * stco64, guint32 offset); -guint64 atom_trak_copy_data (AtomTRAK * atom, guint8 ** buffer, - guint64 * size, guint64 * offset); -void atom_stbl_clear (AtomSTBL * stbl); -void atom_stbl_init (AtomSTBL * stbl); -guint64 atom_stss_copy_data (AtomSTSS *atom, guint8 **buffer, - guint64 *size, guint64* offset); -guint64 atom_stts_copy_data (AtomSTTS *atom, guint8 **buffer, - guint64 *size, guint64* offset); -guint64 atom_stsc_copy_data (AtomSTSC *atom, guint8 **buffer, - guint64 *size, guint64* offset); -guint64 atom_stsz_copy_data (AtomSTSZ *atom, guint8 **buffer, - guint64 *size, guint64* offset); -guint64 atom_ctts_copy_data (AtomCTTS *atom, guint8 **buffer, - guint64 *size, guint64* offset); -guint64 atom_stco64_copy_data (AtomSTCO64 *atom, guint8 **buffer, - guint64 *size, guint64* offset); -AtomMOOF* atom_moof_new (AtomsContext *context, guint32 sequence_number); -void atom_moof_free (AtomMOOF *moof); -guint64 atom_moof_copy_data (AtomMOOF *moof, guint8 **buffer, guint64 *size, guint64* offset); -AtomTRAF * atom_traf_new (AtomsContext * context, guint32 track_ID); -void atom_traf_free (AtomTRAF * traf); -void atom_traf_add_samples (AtomTRAF * traf, guint32 delta, - guint32 size, gboolean sync, gint64 pts_offset, - gboolean sdtp_sync); -guint32 atom_traf_get_sample_num (AtomTRAF * traf); -void atom_moof_add_traf (AtomMOOF *moof, AtomTRAF *traf); - -AtomMFRA* atom_mfra_new (AtomsContext *context); -void atom_mfra_free (AtomMFRA *mfra); -AtomTFRA* atom_tfra_new (AtomsContext *context, guint32 track_ID); -void atom_tfra_add_entry (AtomTFRA *tfra, guint64 dts, guint32 sample_num); -void atom_tfra_update_offset (AtomTFRA * tfra, guint64 offset); -void atom_mfra_add_tfra (AtomMFRA *mfra, AtomTFRA *tfra); -guint64 atom_mfra_copy_data (AtomMFRA *mfra, guint8 **buffer, guint64 *size, guint64* offset); - - -/* media sample description related helpers */ - -typedef struct -{ - guint16 version; - guint32 fourcc; - guint width; - guint height; - guint depth; - guint frame_count; - gint color_table_id; - guint par_n; - guint par_d; - - GstBuffer *codec_data; -} VisualSampleEntry; - -typedef struct -{ - guint32 fourcc; - guint version; - gint compression_id; - guint sample_rate; - guint channels; - guint sample_size; - guint bytes_per_packet; - guint samples_per_packet; - guint bytes_per_sample; - guint bytes_per_frame; - - GstBuffer *codec_data; -} AudioSampleEntry; - -void atom_trak_set_audio_type (AtomTRAK * trak, AtomsContext * context, - AudioSampleEntry * entry, guint32 scale, - AtomInfo * ext, gint sample_size); - -void atom_trak_set_video_type (AtomTRAK * trak, AtomsContext * context, - VisualSampleEntry * entry, guint32 rate, - GList * ext_atoms_list); - -AtomInfo * build_codec_data_extension (guint32 fourcc, const GstBuffer * codec_data); -AtomInfo * build_mov_aac_extension (AtomTRAK * trak, const GstBuffer * codec_data, - guint32 avg_bitrate, guint32 max_bitrate); -AtomInfo * build_mov_alac_extension (AtomTRAK * trak, const GstBuffer * codec_data); -AtomInfo * build_esds_extension (AtomTRAK * trak, guint8 object_type, - guint8 stream_type, const GstBuffer * codec_data, - guint32 avg_bitrate, guint32 max_bitrate); -AtomInfo * build_btrt_extension (guint32 buffer_size_db, guint32 avg_bitrate, - guint32 max_bitrate); -AtomInfo * build_jp2h_extension (AtomTRAK * trak, gint width, gint height, - guint32 fourcc, gint ncomp, - const GValue * cmap_array, - const GValue * cdef_array); - -AtomInfo * build_jp2x_extension (const GstBuffer * prefix); -AtomInfo * build_fiel_extension (gint fields); -AtomInfo * build_amr_extension (void); -AtomInfo * build_h263_extension (void); -AtomInfo * build_gama_atom (gdouble gamma); -AtomInfo * build_SMI_atom (const GstBuffer *seqh); -AtomInfo * build_ima_adpcm_extension (gint channels, gint rate, - gint blocksize); -AtomInfo * build_uuid_xmp_atom (const GstTagList * taglist); - - -/* - * Meta tags functions - */ -void atom_moov_add_str_tag (AtomMOOV *moov, guint32 fourcc, const gchar *value); -void atom_moov_add_uint_tag (AtomMOOV *moov, guint32 fourcc, guint32 flags, - guint32 value); -void atom_moov_add_tag (AtomMOOV *moov, guint32 fourcc, guint32 flags, - const guint8 * data, guint size); -void atom_moov_add_blob_tag (AtomMOOV *moov, guint8 *data, guint size); - -void atom_moov_add_3gp_str_tag (AtomMOOV * moov, guint32 fourcc, const gchar * value); -void atom_moov_add_3gp_uint_tag (AtomMOOV * moov, guint32 fourcc, guint16 value); -void atom_moov_add_3gp_str_int_tag (AtomMOOV * moov, guint32 fourcc, const gchar * value, - gint16 ivalue); -void atom_moov_add_3gp_tag (AtomMOOV * moov, guint32 fourcc, guint8 * data, - guint size); - -void atom_moov_add_xmp_tags (AtomMOOV * moov, const GstTagList * tags); - -#define GST_QT_MUX_DEFAULT_TAG_LANGUAGE "eng" -guint16 language_code (const char * lang); - -#endif /* __ATOMS_H__ */ diff --git a/gst/qtmux/atomsrecovery.c b/gst/qtmux/atomsrecovery.c deleted file mode 100644 index 1f5a287d1d..0000000000 --- a/gst/qtmux/atomsrecovery.c +++ /dev/null @@ -1,1095 +0,0 @@ -/* Quicktime muxer plugin for GStreamer - * Copyright (C) 2010 Thiago Santos - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* - * Unless otherwise indicated, Source Code is licensed under MIT license. - * See further explanation attached in License Statement (distributed in the file - * LICENSE). - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/** - * This module contains functions for serializing partial information from - * a mux in progress (by qtmux elements). This enables reconstruction of the - * moov box if a crash happens and thus recovering the movie file. - * - * Usage: - * 1) pipeline: ...yourelements ! qtmux moov-recovery-file=path.mrf ! \ - * filesink location=moovie.mov - * - * 2) CRASH! - * - * 3) gst-launch qtmoovrecover recovery-input=path.mrf broken-input=moovie.mov \ - fixed-output=recovered.mov - * - * 4) (Hopefully) enjoy recovered.mov. - * - * --- Recovery file layout --- - * 1) Version (a guint16) - * 2) Prefix atom (if present) - * 3) ftyp atom - * 4) MVHD atom (without timescale/duration set) - * 5) moovie timescale - * 6) number of traks - * 7) list of trak atoms (stbl data is ignored, except for the stsd atom) - * 8) Buffers metadata (metadata that is relevant to the container) - * Buffers metadata are stored in the order they are added to the mdat, - * each entre has a fixed size and is stored in BE. booleans are stored - * as a single byte where 0 means false, otherwise is true. - * Metadata: - * - guint32 track_id; - * - guint32 nsamples; - * - guint32 delta; - * - guint32 size; - * - guint64 chunk_offset; - * - gboolean sync; - * - gboolean do_pts; - * - guint64 pts_offset; (always present, ignored if do_pts is false) - * - * The mdat file might contain ftyp and then mdat, in case this is the faststart - * temporary file there is no ftyp and no mdat header, only the buffers data. - * - * Notes about recovery file layout: We still don't store tags nor EDTS data. - * - * IMPORTANT: this is still at a experimental state. - */ - -#include "atomsrecovery.h" - -#define ATOMS_RECOV_OUTPUT_WRITE_ERROR(err) \ - g_set_error (err, ATOMS_RECOV_QUARK, ATOMS_RECOV_ERR_FILE, \ - "Failed to write to output file: %s", g_strerror (errno)) - -static gboolean -atoms_recov_write_version (FILE * f) -{ - guint8 data[2]; - GST_WRITE_UINT16_BE (data, ATOMS_RECOV_FILE_VERSION); - return fwrite (data, 2, 1, f) == 1; -} - -static gboolean -atoms_recov_write_ftyp_info (FILE * f, AtomFTYP * ftyp, GstBuffer * prefix) -{ - guint8 *data = NULL; - guint64 offset = 0; - guint64 size = 0; - - if (prefix) { - if (fwrite (GST_BUFFER_DATA (prefix), 1, GST_BUFFER_SIZE (prefix), f) != - GST_BUFFER_SIZE (prefix)) { - return FALSE; - } - } - if (!atom_ftyp_copy_data (ftyp, &data, &size, &offset)) { - return FALSE; - } - if (fwrite (data, 1, offset, f) != offset) { - return FALSE; - } - return TRUE; -} - -/** - * Writes important info on the 'moov' atom (non-trak related) - * to be able to recover the moov structure after a crash. - * - * Currently, it writes the MVHD atom. - */ -static gboolean -atoms_recov_write_moov_info (FILE * f, AtomMOOV * moov) -{ - guint8 *data; - guint64 size; - guint64 offset = 0; - guint64 atom_size = 0; - gint writen = 0; - - /* likely enough */ - size = 256; - data = g_malloc (size); - atom_size = atom_mvhd_copy_data (&moov->mvhd, &data, &size, &offset); - if (atom_size > 0) - writen = fwrite (data, 1, atom_size, f); - g_free (data); - return atom_size > 0 && writen == atom_size; -} - -/** - * Writes the number of traks to the file. - * This simply writes a guint32 in BE. - */ -static gboolean -atoms_recov_write_traks_number (FILE * f, guint32 traks) -{ - guint8 data[4]; - GST_WRITE_UINT32_BE (data, traks); - return fwrite (data, 4, 1, f) == 1; -} - -/** - * Writes the moov's timescale to the file - * This simply writes a guint32 in BE. - */ -static gboolean -atoms_recov_write_moov_timescale (FILE * f, guint32 timescale) -{ - guint8 data[4]; - GST_WRITE_UINT32_BE (data, timescale); - return fwrite (data, 4, 1, f) == 1; -} - -/** - * Writes the trak atom to the file. - */ -gboolean -atoms_recov_write_trak_info (FILE * f, AtomTRAK * trak) -{ - guint8 *data; - guint64 size; - guint64 offset = 0; - guint64 atom_size = 0; - gint writen = 0; - - /* buffer is realloced to a larger size if needed */ - size = 4 * 1024; - data = g_malloc (size); - atom_size = atom_trak_copy_data (trak, &data, &size, &offset); - if (atom_size > 0) - writen = fwrite (data, atom_size, 1, f); - g_free (data); - return atom_size > 0 && writen == atom_size; -} - -gboolean -atoms_recov_write_trak_samples (FILE * f, AtomTRAK * trak, guint32 nsamples, - guint32 delta, guint32 size, guint64 chunk_offset, gboolean sync, - gboolean do_pts, gint64 pts_offset) -{ - guint8 data[TRAK_BUFFER_ENTRY_INFO_SIZE]; - /* - * We have to write a TrakBufferEntryInfo - */ - GST_WRITE_UINT32_BE (data + 0, trak->tkhd.track_ID); - GST_WRITE_UINT32_BE (data + 4, nsamples); - GST_WRITE_UINT32_BE (data + 8, delta); - GST_WRITE_UINT32_BE (data + 12, size); - GST_WRITE_UINT64_BE (data + 16, chunk_offset); - if (sync) - GST_WRITE_UINT8 (data + 24, 1); - else - GST_WRITE_UINT8 (data + 24, 0); - if (do_pts) { - GST_WRITE_UINT8 (data + 25, 1); - GST_WRITE_UINT64_BE (data + 26, pts_offset); - } else { - GST_WRITE_UINT8 (data + 25, 0); - GST_WRITE_UINT64_BE (data + 26, 0); - } - - return fwrite (data, 1, TRAK_BUFFER_ENTRY_INFO_SIZE, f) == - TRAK_BUFFER_ENTRY_INFO_SIZE; -} - -gboolean -atoms_recov_write_headers (FILE * f, AtomFTYP * ftyp, GstBuffer * prefix, - AtomMOOV * moov, guint32 timescale, guint32 traks_number) -{ - if (!atoms_recov_write_version (f)) { - return FALSE; - } - - if (!atoms_recov_write_ftyp_info (f, ftyp, prefix)) { - return FALSE; - } - - if (!atoms_recov_write_moov_info (f, moov)) { - return FALSE; - } - - if (!atoms_recov_write_moov_timescale (f, timescale)) { - return FALSE; - } - - if (!atoms_recov_write_traks_number (f, traks_number)) { - return FALSE; - } - - return TRUE; -} - -static gboolean -read_atom_header (FILE * f, guint32 * fourcc, guint32 * size) -{ - guint8 aux[8]; - - if (fread (aux, 1, 8, f) != 8) - return FALSE; - *size = GST_READ_UINT32_BE (aux); - *fourcc = GST_READ_UINT32_LE (aux + 4); - return TRUE; -} - -static gboolean -moov_recov_file_parse_prefix (MoovRecovFile * moovrf) -{ - guint32 fourcc; - guint32 size; - guint32 total_size = 0; - if (fseek (moovrf->file, 2, SEEK_SET) != 0) - return FALSE; - if (!read_atom_header (moovrf->file, &fourcc, &size)) { - return FALSE; - } - - if (fourcc != FOURCC_ftyp) { - /* we might have a prefix here */ - if (fseek (moovrf->file, size - 8, SEEK_CUR) != 0) - return FALSE; - - total_size += size; - - /* now read the ftyp */ - if (!read_atom_header (moovrf->file, &fourcc, &size)) - return FALSE; - } - - /* this has to be the ftyp */ - if (fourcc != FOURCC_ftyp) - return FALSE; - total_size += size; - moovrf->prefix_size = total_size; - return fseek (moovrf->file, size - 8, SEEK_CUR) == 0; -} - -static gboolean -moov_recov_file_parse_mvhd (MoovRecovFile * moovrf) -{ - guint32 fourcc; - guint32 size; - if (!read_atom_header (moovrf->file, &fourcc, &size)) { - return FALSE; - } - /* check for sanity */ - if (fourcc != FOURCC_mvhd) - return FALSE; - - moovrf->mvhd_size = size; - moovrf->mvhd_pos = ftell (moovrf->file) - 8; - - /* skip the remaining of the mvhd in the file */ - return fseek (moovrf->file, size - 8, SEEK_CUR) == 0; -} - -static gboolean -mdat_recov_file_parse_mdat_start (MdatRecovFile * mdatrf) -{ - guint32 fourcc, size; - - if (!read_atom_header (mdatrf->file, &fourcc, &size)) { - return FALSE; - } - if (size == 1) { - mdatrf->mdat_header_size = 16; - mdatrf->mdat_size = 16; - } else { - mdatrf->mdat_header_size = 8; - mdatrf->mdat_size = 8; - } - mdatrf->mdat_start = ftell (mdatrf->file) - 8; - - return fourcc == FOURCC_mdat; -} - -MdatRecovFile * -mdat_recov_file_create (FILE * file, gboolean datafile, GError ** err) -{ - MdatRecovFile *mrf = g_new0 (MdatRecovFile, 1); - guint32 fourcc, size; - - g_return_val_if_fail (file != NULL, NULL); - - mrf->file = file; - mrf->rawfile = datafile; - - /* get the file/data length */ - if (fseek (file, 0, SEEK_END) != 0) - goto file_length_error; - /* still needs to deduce the mdat header and ftyp size */ - mrf->data_size = ftell (file); - if (mrf->data_size == -1L) - goto file_length_error; - - if (fseek (file, 0, SEEK_SET) != 0) - goto file_seek_error; - - if (datafile) { - /* this file contains no atoms, only raw data to be placed on the mdat - * this happens when faststart mode is used */ - mrf->mdat_start = 0; - mrf->mdat_header_size = 16; - mrf->mdat_size = 16; - return mrf; - } - - if (!read_atom_header (file, &fourcc, &size)) { - goto parse_error; - } - if (fourcc != FOURCC_ftyp) { - /* this could be a prefix atom, let's skip it and try again */ - if (fseek (file, size - 8, SEEK_CUR) != 0) { - goto file_seek_error; - } - if (!read_atom_header (file, &fourcc, &size)) { - goto parse_error; - } - } - - if (fourcc != FOURCC_ftyp) { - goto parse_error; - } - if (fseek (file, size - 8, SEEK_CUR) != 0) - goto file_seek_error; - - /* we don't parse this if we have a tmpdatafile */ - if (!mdat_recov_file_parse_mdat_start (mrf)) { - g_set_error (err, ATOMS_RECOV_QUARK, ATOMS_RECOV_ERR_PARSING, - "Error while parsing mdat atom"); - goto fail; - } - - return mrf; - -parse_error: - g_set_error (err, ATOMS_RECOV_QUARK, ATOMS_RECOV_ERR_FILE, - "Failed to parse atom"); - goto fail; - -file_seek_error: - g_set_error (err, ATOMS_RECOV_QUARK, ATOMS_RECOV_ERR_FILE, - "Failed to seek to start of the file"); - goto fail; - -file_length_error: - g_set_error (err, ATOMS_RECOV_QUARK, ATOMS_RECOV_ERR_FILE, - "Failed to determine file size"); - goto fail; - -fail: - mdat_recov_file_free (mrf); - return NULL; -} - -void -mdat_recov_file_free (MdatRecovFile * mrf) -{ - fclose (mrf->file); - g_free (mrf); -} - -static gboolean -moov_recov_parse_num_traks (MoovRecovFile * moovrf) -{ - guint8 traks[4]; - if (fread (traks, 1, 4, moovrf->file) != 4) - return FALSE; - moovrf->num_traks = GST_READ_UINT32_BE (traks); - return TRUE; -} - -static gboolean -moov_recov_parse_moov_timescale (MoovRecovFile * moovrf) -{ - guint8 ts[4]; - if (fread (ts, 1, 4, moovrf->file) != 4) - return FALSE; - moovrf->timescale = GST_READ_UINT32_BE (ts); - return TRUE; -} - -static gboolean -skip_atom (MoovRecovFile * moovrf, guint32 expected_fourcc) -{ - guint32 size; - guint32 fourcc; - - if (!read_atom_header (moovrf->file, &fourcc, &size)) - return FALSE; - if (fourcc != expected_fourcc) - return FALSE; - - return (fseek (moovrf->file, size - 8, SEEK_CUR) == 0); -} - -static gboolean -moov_recov_parse_tkhd (MoovRecovFile * moovrf, TrakRecovData * trakrd) -{ - guint32 size; - guint32 fourcc; - guint8 data[4]; - - /* make sure we are on a tkhd atom */ - if (!read_atom_header (moovrf->file, &fourcc, &size)) - return FALSE; - if (fourcc != FOURCC_tkhd) - return FALSE; - - trakrd->tkhd_file_offset = ftell (moovrf->file) - 8; - - /* move 8 bytes forward to the trak_id pos */ - if (fseek (moovrf->file, 12, SEEK_CUR) != 0) - return FALSE; - if (fread (data, 1, 4, moovrf->file) != 4) - return FALSE; - - /* advance the rest of tkhd */ - fseek (moovrf->file, 68, SEEK_CUR); - - trakrd->trak_id = GST_READ_UINT32_BE (data); - return TRUE; -} - -static gboolean -moov_recov_parse_stbl (MoovRecovFile * moovrf, TrakRecovData * trakrd) -{ - guint32 size; - guint32 fourcc; - guint32 auxsize; - - if (!read_atom_header (moovrf->file, &fourcc, &size)) - return FALSE; - if (fourcc != FOURCC_stbl) - return FALSE; - - trakrd->stbl_file_offset = ftell (moovrf->file) - 8; - trakrd->stbl_size = size; - - /* skip the stsd */ - if (!read_atom_header (moovrf->file, &fourcc, &auxsize)) - return FALSE; - if (fourcc != FOURCC_stsd) - return FALSE; - if (fseek (moovrf->file, auxsize - 8, SEEK_CUR) != 0) - return FALSE; - - trakrd->stsd_size = auxsize; - trakrd->post_stsd_offset = ftell (moovrf->file); - - /* as this is the last atom we parse, we don't skip forward */ - - return TRUE; -} - -static gboolean -moov_recov_parse_minf (MoovRecovFile * moovrf, TrakRecovData * trakrd) -{ - guint32 size; - guint32 fourcc; - guint32 auxsize; - - if (!read_atom_header (moovrf->file, &fourcc, &size)) - return FALSE; - if (fourcc != FOURCC_minf) - return FALSE; - - trakrd->minf_file_offset = ftell (moovrf->file) - 8; - trakrd->minf_size = size; - - /* skip either of vmhd, smhd, hmhd that might follow */ - if (!read_atom_header (moovrf->file, &fourcc, &auxsize)) - return FALSE; - if (fourcc != FOURCC_vmhd && fourcc != FOURCC_smhd && fourcc != FOURCC_hmhd && - fourcc != FOURCC_gmhd) - return FALSE; - if (fseek (moovrf->file, auxsize - 8, SEEK_CUR)) - return FALSE; - - /* skip a possible hdlr and the following dinf */ - if (!read_atom_header (moovrf->file, &fourcc, &auxsize)) - return FALSE; - if (fourcc == FOURCC_hdlr) { - if (fseek (moovrf->file, auxsize - 8, SEEK_CUR)) - return FALSE; - if (!read_atom_header (moovrf->file, &fourcc, &auxsize)) - return FALSE; - } - if (fourcc != FOURCC_dinf) - return FALSE; - if (fseek (moovrf->file, auxsize - 8, SEEK_CUR)) - return FALSE; - - /* now we are ready to read the stbl */ - if (!moov_recov_parse_stbl (moovrf, trakrd)) - return FALSE; - - return TRUE; -} - -static gboolean -moov_recov_parse_mdhd (MoovRecovFile * moovrf, TrakRecovData * trakrd) -{ - guint32 size; - guint32 fourcc; - guint8 data[4]; - - /* make sure we are on a tkhd atom */ - if (!read_atom_header (moovrf->file, &fourcc, &size)) - return FALSE; - if (fourcc != FOURCC_mdhd) - return FALSE; - - trakrd->mdhd_file_offset = ftell (moovrf->file) - 8; - - /* get the timescale */ - if (fseek (moovrf->file, 12, SEEK_CUR) != 0) - return FALSE; - if (fread (data, 1, 4, moovrf->file) != 4) - return FALSE; - trakrd->timescale = GST_READ_UINT32_BE (data); - if (fseek (moovrf->file, 8, SEEK_CUR) != 0) - return FALSE; - return TRUE; -} - -static gboolean -moov_recov_parse_mdia (MoovRecovFile * moovrf, TrakRecovData * trakrd) -{ - guint32 size; - guint32 fourcc; - - /* make sure we are on a tkhd atom */ - if (!read_atom_header (moovrf->file, &fourcc, &size)) - return FALSE; - if (fourcc != FOURCC_mdia) - return FALSE; - - trakrd->mdia_file_offset = ftell (moovrf->file) - 8; - trakrd->mdia_size = size; - - if (!moov_recov_parse_mdhd (moovrf, trakrd)) - return FALSE; - - if (!skip_atom (moovrf, FOURCC_hdlr)) - return FALSE; - if (!moov_recov_parse_minf (moovrf, trakrd)) - return FALSE; - return TRUE; -} - -static gboolean -moov_recov_parse_trak (MoovRecovFile * moovrf, TrakRecovData * trakrd) -{ - guint64 offset; - guint32 size; - guint32 fourcc; - - offset = ftell (moovrf->file); - if (offset == -1) { - return FALSE; - } - - /* make sure we are on a trak atom */ - if (!read_atom_header (moovrf->file, &fourcc, &size)) { - return FALSE; - } - if (fourcc != FOURCC_trak) { - return FALSE; - } - trakrd->trak_size = size; - - /* now we should have a trak header 'tkhd' */ - if (!moov_recov_parse_tkhd (moovrf, trakrd)) - return FALSE; - - /* FIXME add edts handling here and in qtmux, as this is only detected - * after buffers start flowing */ - - if (!moov_recov_parse_mdia (moovrf, trakrd)) - return FALSE; - - trakrd->file_offset = offset; - /* position after the trak */ - return fseek (moovrf->file, (long int) offset + size, SEEK_SET) == 0; -} - -MoovRecovFile * -moov_recov_file_create (FILE * file, GError ** err) -{ - gint i; - MoovRecovFile *moovrf = g_new0 (MoovRecovFile, 1); - - g_return_val_if_fail (file != NULL, NULL); - - moovrf->file = file; - - /* look for ftyp and prefix at the start */ - if (!moov_recov_file_parse_prefix (moovrf)) { - g_set_error (err, ATOMS_RECOV_QUARK, ATOMS_RECOV_ERR_PARSING, - "Error while parsing prefix atoms"); - goto fail; - } - - /* parse the mvhd */ - if (!moov_recov_file_parse_mvhd (moovrf)) { - g_set_error (err, ATOMS_RECOV_QUARK, ATOMS_RECOV_ERR_PARSING, - "Error while parsing mvhd atom"); - goto fail; - } - - if (!moov_recov_parse_moov_timescale (moovrf)) { - g_set_error (err, ATOMS_RECOV_QUARK, ATOMS_RECOV_ERR_PARSING, - "Error while parsing timescale"); - goto fail; - } - if (!moov_recov_parse_num_traks (moovrf)) { - g_set_error (err, ATOMS_RECOV_QUARK, ATOMS_RECOV_ERR_PARSING, - "Error while parsing parsing number of traks"); - goto fail; - } - - /* init the traks */ - moovrf->traks_rd = g_new0 (TrakRecovData, moovrf->num_traks); - for (i = 0; i < moovrf->num_traks; i++) { - atom_stbl_init (&(moovrf->traks_rd[i].stbl)); - } - for (i = 0; i < moovrf->num_traks; i++) { - if (!moov_recov_parse_trak (moovrf, &(moovrf->traks_rd[i]))) { - g_set_error (err, ATOMS_RECOV_QUARK, ATOMS_RECOV_ERR_PARSING, - "Error while parsing trak atom"); - goto fail; - } - } - - return moovrf; - -fail: - moov_recov_file_free (moovrf); - return NULL; -} - -void -moov_recov_file_free (MoovRecovFile * moovrf) -{ - gint i; - fclose (moovrf->file); - if (moovrf->traks_rd) { - for (i = 0; i < moovrf->num_traks; i++) { - atom_stbl_clear (&(moovrf->traks_rd[i].stbl)); - } - g_free (moovrf->traks_rd); - } - g_free (moovrf); -} - -static gboolean -moov_recov_parse_buffer_entry (MoovRecovFile * moovrf, TrakBufferEntryInfo * b) -{ - guint8 data[TRAK_BUFFER_ENTRY_INFO_SIZE]; - gint read; - - read = fread (data, 1, TRAK_BUFFER_ENTRY_INFO_SIZE, moovrf->file); - if (read != TRAK_BUFFER_ENTRY_INFO_SIZE) - return FALSE; - - b->track_id = GST_READ_UINT32_BE (data); - b->nsamples = GST_READ_UINT32_BE (data + 4); - b->delta = GST_READ_UINT32_BE (data + 8); - b->size = GST_READ_UINT32_BE (data + 12); - b->chunk_offset = GST_READ_UINT64_BE (data + 16); - b->sync = data[24] != 0; - b->do_pts = data[25] != 0; - b->pts_offset = GST_READ_UINT64_BE (data + 26); - return TRUE; -} - -static gboolean -mdat_recov_add_sample (MdatRecovFile * mdatrf, guint32 size) -{ - /* test if this data exists */ - if (mdatrf->mdat_size - mdatrf->mdat_header_size + size > mdatrf->data_size) - return FALSE; - - mdatrf->mdat_size += size; - return TRUE; -} - -static TrakRecovData * -moov_recov_get_trak (MoovRecovFile * moovrf, guint32 id) -{ - gint i; - for (i = 0; i < moovrf->num_traks; i++) { - if (moovrf->traks_rd[i].trak_id == id) - return &(moovrf->traks_rd[i]); - } - return NULL; -} - -static void -trak_recov_data_add_sample (TrakRecovData * trak, TrakBufferEntryInfo * b) -{ - trak->duration += b->nsamples * b->delta; - atom_stbl_add_samples (&trak->stbl, b->nsamples, b->delta, b->size, - b->chunk_offset, b->sync, b->pts_offset); -} - -/** - * Parses the buffer entries in the MoovRecovFile and matches the inputs - * with the data in the MdatRecovFile. Whenever a buffer entry of that - * represents 'x' bytes of data, the same amount of data is 'validated' in - * the MdatRecovFile and will be inluded in the generated moovie file. - */ -gboolean -moov_recov_parse_buffers (MoovRecovFile * moovrf, MdatRecovFile * mdatrf, - GError ** err) -{ - TrakBufferEntryInfo entry; - TrakRecovData *trak; - - /* we assume both moovrf and mdatrf are at the starting points of their - * data reading */ - while (moov_recov_parse_buffer_entry (moovrf, &entry)) { - /* be sure we still have this data in mdat */ - trak = moov_recov_get_trak (moovrf, entry.track_id); - if (trak == NULL) { - g_set_error (err, ATOMS_RECOV_QUARK, ATOMS_RECOV_ERR_PARSING, - "Invalid trak id found in buffer entry"); - return FALSE; - } - if (!mdat_recov_add_sample (mdatrf, entry.size)) - break; - trak_recov_data_add_sample (trak, &entry); - } - return TRUE; -} - -static guint32 -trak_recov_data_get_trak_atom_size (TrakRecovData * trak) -{ - AtomSTBL *stbl = &trak->stbl; - guint64 offset; - - /* write out our stbl child atoms */ - offset = 0; - - if (!atom_stts_copy_data (&stbl->stts, NULL, NULL, &offset)) { - goto fail; - } - if (atom_array_get_len (&stbl->stss.entries) > 0) { - if (!atom_stss_copy_data (&stbl->stss, NULL, NULL, &offset)) { - goto fail; - } - } - if (!atom_stsc_copy_data (&stbl->stsc, NULL, NULL, &offset)) { - goto fail; - } - if (!atom_stsz_copy_data (&stbl->stsz, NULL, NULL, &offset)) { - goto fail; - } - if (stbl->ctts) { - if (!atom_ctts_copy_data (stbl->ctts, NULL, NULL, &offset)) { - goto fail; - } - } - if (!atom_stco64_copy_data (&stbl->stco64, NULL, NULL, &offset)) { - goto fail; - } - - return trak->trak_size + ((trak->stsd_size + offset + 8) - trak->stbl_size); - -fail: - return 0; -} - -static guint8 * -moov_recov_get_stbl_children_data (MoovRecovFile * moovrf, TrakRecovData * trak, - guint64 * p_size) -{ - AtomSTBL *stbl = &trak->stbl; - guint8 *buffer; - guint64 size; - guint64 offset; - - /* write out our stbl child atoms - * - * Use 1MB as a starting size, *_copy_data functions - * will grow the buffer if needed. - */ - size = 1024 * 1024; - buffer = g_malloc0 (size); - offset = 0; - - if (!atom_stts_copy_data (&stbl->stts, &buffer, &size, &offset)) { - goto fail; - } - if (atom_array_get_len (&stbl->stss.entries) > 0) { - if (!atom_stss_copy_data (&stbl->stss, &buffer, &size, &offset)) { - goto fail; - } - } - if (!atom_stsc_copy_data (&stbl->stsc, &buffer, &size, &offset)) { - goto fail; - } - if (!atom_stsz_copy_data (&stbl->stsz, &buffer, &size, &offset)) { - goto fail; - } - if (stbl->ctts) { - if (!atom_ctts_copy_data (stbl->ctts, &buffer, &size, &offset)) { - goto fail; - } - } - if (!atom_stco64_copy_data (&stbl->stco64, &buffer, &size, &offset)) { - goto fail; - } - *p_size = offset; - return buffer; - -fail: - g_free (buffer); - return NULL; -} - -gboolean -moov_recov_write_file (MoovRecovFile * moovrf, MdatRecovFile * mdatrf, - FILE * outf, GError ** err) -{ - guint8 auxdata[16]; - guint8 *data = NULL; - guint8 *prefix_data = NULL; - guint8 *mvhd_data = NULL; - guint8 *trak_data = NULL; - guint32 moov_size = 0; - gint i; - guint64 stbl_children_size = 0; - guint8 *stbl_children = NULL; - guint32 longest_duration = 0; - guint16 version; - - /* check the version */ - if (fseek (moovrf->file, 0, SEEK_SET) != 0) { - g_set_error (err, ATOMS_RECOV_QUARK, ATOMS_RECOV_ERR_FILE, - "Failed to seek to the start of the moov recovery file"); - goto fail; - } - if (fread (auxdata, 1, 2, moovrf->file) != 2) { - g_set_error (err, ATOMS_RECOV_QUARK, ATOMS_RECOV_ERR_FILE, - "Failed to read version from file"); - } - - version = GST_READ_UINT16_BE (auxdata); - if (version != ATOMS_RECOV_FILE_VERSION) { - g_set_error (err, ATOMS_RECOV_QUARK, ATOMS_RECOV_ERR_VERSION, - "Input file version (%u) is not supported in this version (%u)", - version, ATOMS_RECOV_FILE_VERSION); - return FALSE; - } - - /* write the ftyp */ - prefix_data = g_malloc (moovrf->prefix_size); - if (fread (prefix_data, 1, moovrf->prefix_size, - moovrf->file) != moovrf->prefix_size) { - g_set_error (err, ATOMS_RECOV_QUARK, ATOMS_RECOV_ERR_FILE, - "Failed to read the ftyp atom from file"); - goto fail; - } - if (fwrite (prefix_data, 1, moovrf->prefix_size, outf) != moovrf->prefix_size) { - ATOMS_RECOV_OUTPUT_WRITE_ERROR (err); - goto fail; - } - g_free (prefix_data); - prefix_data = NULL; - - /* need to calculate the moov size beforehand to add the offset to - * chunk offset entries */ - moov_size += moovrf->mvhd_size + 8; /* mvhd + moov size + fourcc */ - for (i = 0; i < moovrf->num_traks; i++) { - TrakRecovData *trak = &(moovrf->traks_rd[i]); - guint32 duration; /* in moov's timescale */ - guint32 trak_size; - - /* convert trak duration to moov's duration */ - duration = gst_util_uint64_scale_round (trak->duration, moovrf->timescale, - trak->timescale); - - if (duration > longest_duration) - longest_duration = duration; - trak_size = trak_recov_data_get_trak_atom_size (trak); - if (trak_size == 0) { - g_set_error (err, ATOMS_RECOV_QUARK, ATOMS_RECOV_ERR_GENERIC, - "Failed to estimate trak atom size"); - goto fail; - } - moov_size += trak_size; - } - - /* add chunks offsets */ - for (i = 0; i < moovrf->num_traks; i++) { - TrakRecovData *trak = &(moovrf->traks_rd[i]); - /* 16 for the mdat header */ - gint64 offset = moov_size + ftell (outf) + 16; - atom_stco64_chunks_add_offset (&trak->stbl.stco64, offset); - } - - /* write the moov */ - GST_WRITE_UINT32_BE (auxdata, moov_size); - GST_WRITE_UINT32_LE (auxdata + 4, FOURCC_moov); - if (fwrite (auxdata, 1, 8, outf) != 8) { - ATOMS_RECOV_OUTPUT_WRITE_ERROR (err); - goto fail; - } - - /* write the mvhd */ - mvhd_data = g_malloc (moovrf->mvhd_size); - if (fseek (moovrf->file, moovrf->mvhd_pos, SEEK_SET) != 0) - goto fail; - if (fread (mvhd_data, 1, moovrf->mvhd_size, - moovrf->file) != moovrf->mvhd_size) - goto fail; - GST_WRITE_UINT32_BE (mvhd_data + 20, moovrf->timescale); - GST_WRITE_UINT32_BE (mvhd_data + 24, longest_duration); - if (fwrite (mvhd_data, 1, moovrf->mvhd_size, outf) != moovrf->mvhd_size) { - ATOMS_RECOV_OUTPUT_WRITE_ERROR (err); - goto fail; - } - g_free (mvhd_data); - mvhd_data = NULL; - - /* write the traks, this is the tough part because we need to update: - * - stbl atom - * - sizes of atoms from stbl to trak - * - trak duration - */ - for (i = 0; i < moovrf->num_traks; i++) { - TrakRecovData *trak = &(moovrf->traks_rd[i]); - guint trak_data_size; - guint32 stbl_new_size; - guint32 minf_new_size; - guint32 mdia_new_size; - guint32 trak_new_size; - guint32 size_diff; - guint32 duration; /* in moov's timescale */ - - /* convert trak duration to moov's duration */ - duration = gst_util_uint64_scale_round (trak->duration, moovrf->timescale, - trak->timescale); - - stbl_children = moov_recov_get_stbl_children_data (moovrf, trak, - &stbl_children_size); - if (stbl_children == NULL) - goto fail; - - /* calc the new size of the atoms from stbl to trak in the atoms tree */ - stbl_new_size = trak->stsd_size + stbl_children_size + 8; - size_diff = stbl_new_size - trak->stbl_size; - minf_new_size = trak->minf_size + size_diff; - mdia_new_size = trak->mdia_size + size_diff; - trak_new_size = trak->trak_size + size_diff; - - if (fseek (moovrf->file, trak->file_offset, SEEK_SET) != 0) - goto fail; - trak_data_size = trak->post_stsd_offset - trak->file_offset; - trak_data = g_malloc (trak_data_size); - if (fread (trak_data, 1, trak_data_size, moovrf->file) != trak_data_size) { - goto fail; - } - /* update the size values in those read atoms before writing */ - GST_WRITE_UINT32_BE (trak_data, trak_new_size); - GST_WRITE_UINT32_BE (trak_data + (trak->mdia_file_offset - - trak->file_offset), mdia_new_size); - GST_WRITE_UINT32_BE (trak_data + (trak->minf_file_offset - - trak->file_offset), minf_new_size); - GST_WRITE_UINT32_BE (trak_data + (trak->stbl_file_offset - - trak->file_offset), stbl_new_size); - - /* update duration values in tkhd and mdhd */ - GST_WRITE_UINT32_BE (trak_data + (trak->tkhd_file_offset - - trak->file_offset) + 28, duration); - GST_WRITE_UINT32_BE (trak_data + (trak->mdhd_file_offset - - trak->file_offset) + 24, trak->duration); - - if (fwrite (trak_data, 1, trak_data_size, outf) != trak_data_size) { - ATOMS_RECOV_OUTPUT_WRITE_ERROR (err); - goto fail; - } - if (fwrite (stbl_children, 1, stbl_children_size, outf) != - stbl_children_size) { - ATOMS_RECOV_OUTPUT_WRITE_ERROR (err); - goto fail; - } - g_free (trak_data); - trak_data = NULL; - g_free (stbl_children); - stbl_children = NULL; - } - - /* write the mdat */ - /* write the header first */ - GST_WRITE_UINT32_BE (auxdata, 1); - GST_WRITE_UINT32_LE (auxdata + 4, FOURCC_mdat); - GST_WRITE_UINT64_BE (auxdata + 8, mdatrf->mdat_size); - if (fwrite (auxdata, 1, 16, outf) != 16) { - ATOMS_RECOV_OUTPUT_WRITE_ERROR (err); - goto fail; - } - - /* now read the mdat data and output to the file */ - if (fseek (mdatrf->file, mdatrf->mdat_start + - (mdatrf->rawfile ? 0 : mdatrf->mdat_header_size), SEEK_SET) != 0) - goto fail; - - data = g_malloc (4096); - while (!feof (mdatrf->file)) { - gint read, write; - - read = fread (data, 1, 4096, mdatrf->file); - write = fwrite (data, 1, read, outf); - - if (write != read) { - g_set_error (err, ATOMS_RECOV_QUARK, ATOMS_RECOV_ERR_FILE, - "Failed to copy data to output file: %s", g_strerror (errno)); - goto fail; - } - } - g_free (data); - - return TRUE; - -fail: - g_free (stbl_children); - g_free (mvhd_data); - g_free (prefix_data); - g_free (trak_data); - g_free (data); - return FALSE; -} diff --git a/gst/qtmux/atomsrecovery.h b/gst/qtmux/atomsrecovery.h deleted file mode 100644 index 4dffc48d33..0000000000 --- a/gst/qtmux/atomsrecovery.h +++ /dev/null @@ -1,159 +0,0 @@ -/* Quicktime muxer plugin for GStreamer - * Copyright (C) 2010 Thiago Santos - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* - * Unless otherwise indicated, Source Code is licensed under MIT license. - * See further explanation attached in License Statement (distributed in the file - * LICENSE). - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef __ATOMS_RECOVERY_H__ -#define __ATOMS_RECOVERY_H__ - -#include -#include -#include -#include - -#include "atoms.h" - -/* Version to be incremented each time we decide - * to change the file layout */ -#define ATOMS_RECOV_FILE_VERSION 1 - -#define ATOMS_RECOV_QUARK (g_quark_from_string ("qtmux-atoms-recovery")) - -/* gerror error codes */ -#define ATOMS_RECOV_ERR_GENERIC 1 -#define ATOMS_RECOV_ERR_FILE 2 -#define ATOMS_RECOV_ERR_PARSING 3 -#define ATOMS_RECOV_ERR_VERSION 4 - -/* this struct represents each buffer in a moov file, containing the info - * that is placed in the stsd children atoms - * Fields should be writen in BE order, and booleans should be writen as - * 1byte with 0 for false, anything otherwise */ -#define TRAK_BUFFER_ENTRY_INFO_SIZE 34 -typedef struct -{ - guint32 track_id; - guint32 nsamples; - guint32 delta; - guint32 size; - guint64 chunk_offset; - guint64 pts_offset; - gboolean sync; - gboolean do_pts; -} TrakBufferEntryInfo; - -typedef struct -{ - guint32 trak_id; - guint32 duration; /* duration in trak timescale */ - guint32 timescale; /* trak's timescale */ - - guint64 file_offset; - - /* need for later updating duration */ - guint64 tkhd_file_offset; - guint64 mdhd_file_offset; - - /* need these offsets to update size */ - guint32 trak_size; - guint64 mdia_file_offset; - guint32 mdia_size; - guint64 minf_file_offset; - guint32 minf_size; - guint64 stbl_file_offset; - guint32 stbl_size; - - guint64 post_stsd_offset; - guint32 stsd_size; - - /* for storing the samples info */ - AtomSTBL stbl; -} TrakRecovData; - -typedef struct -{ - FILE * file; - gboolean rawfile; - - /* results from parsing the input file */ - guint64 data_size; - guint32 mdat_header_size; - guint mdat_start; - - guint64 mdat_size; -} MdatRecovFile; - -typedef struct -{ - FILE * file; - guint32 timescale; - - guint32 mvhd_pos; - guint32 mvhd_size; - guint32 prefix_size; /* prefix + ftyp total size */ - - gint num_traks; - TrakRecovData *traks_rd; -} MoovRecovFile; - -gboolean atoms_recov_write_trak_info (FILE * f, AtomTRAK * trak); -gboolean atoms_recov_write_headers (FILE * f, AtomFTYP * ftyp, - GstBuffer * prefix, AtomMOOV * moov, - guint32 timescale, - guint32 traks_number); -gboolean atoms_recov_write_trak_samples (FILE * f, AtomTRAK * trak, - guint32 nsamples, guint32 delta, - guint32 size, guint64 chunk_offset, - gboolean sync, gboolean do_pts, - gint64 pts_offset); - -MdatRecovFile * mdat_recov_file_create (FILE * file, gboolean datafile, - GError ** err); -void mdat_recov_file_free (MdatRecovFile * mrf); -MoovRecovFile * moov_recov_file_create (FILE * file, GError ** err); -void moov_recov_file_free (MoovRecovFile * moovrf); -gboolean moov_recov_parse_buffers (MoovRecovFile * moovrf, - MdatRecovFile * mdatrf, - GError ** err); -gboolean moov_recov_write_file (MoovRecovFile * moovrf, - MdatRecovFile * mdatrf, FILE * outf, - GError ** err); - -#endif /* __ATOMS_RECOVERY_H__ */ diff --git a/gst/qtmux/descriptors.c b/gst/qtmux/descriptors.c deleted file mode 100644 index d1e99c21e7..0000000000 --- a/gst/qtmux/descriptors.c +++ /dev/null @@ -1,458 +0,0 @@ -/* Quicktime muxer plugin for GStreamer - * Copyright (C) 2008 Thiago Sousa Santos - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* - * Unless otherwise indicated, Source Code is licensed under MIT license. - * See further explanation attached in License Statement (distributed in the file - * LICENSE). - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#include "descriptors.h" - -/* - * Some mp4 structures (descriptors) use a coding scheme for - * representing its size. - * It is grouped in bytes. The 1st bit set to 1 means we need another byte, - * 0 otherwise. The remaining 7 bits are the useful values. - * - * The next set of functions handle those values - */ - -/* - * Gets an unsigned integer and packs it into a 'expandable size' format - * (as used by mp4 descriptors) - * @size: the integer to be parsed - * @ptr: the array to place the result - * @array_size: the size of ptr array - */ -static void -expandable_size_parse (guint64 size, guint8 * ptr, guint32 array_size) -{ - int index = 0; - - memset (ptr, 0, sizeof (array_size)); - while (size > 0 && index < array_size) { - ptr[index++] = (size > 0x7F ? 0x80 : 0x0) | (size & 0x7F); - size = size >> 7; - } -} - -/* - * Gets how many positions in an array holding an 'expandable size' - * are really used - * - * @ptr: the array with the 'expandable size' - * @array_size: the size of ptr array - * - * Returns: the number of really used positions - */ -static guint64 -expandable_size_get_length (guint8 * ptr, guint32 array_size) -{ - gboolean next = TRUE; - guint32 index = 0; - - while (next && index < array_size) { - next = ((ptr[index] & 0x80) == 1); - index++; - } - return index; -} - -/* - * Initializers below - */ - -static void -desc_base_descriptor_init (BaseDescriptor * bd, guint8 tag, guint32 size) -{ - bd->tag = tag; - expandable_size_parse (size, bd->size, 4); -} - -static void -desc_dec_specific_info_init (DecoderSpecificInfoDescriptor * dsid) -{ - desc_base_descriptor_init (&dsid->base, DECODER_SPECIFIC_INFO_TAG, 0); - dsid->length = 0; - dsid->data = NULL; -} - -DecoderSpecificInfoDescriptor * -desc_dec_specific_info_new (void) -{ - DecoderSpecificInfoDescriptor *desc = - g_new0 (DecoderSpecificInfoDescriptor, 1); - desc_dec_specific_info_init (desc); - return desc; -} - -static void -desc_dec_conf_desc_init (DecoderConfigDescriptor * dcd) -{ - desc_base_descriptor_init (&dcd->base, DECODER_CONFIG_DESC_TAG, 0); - dcd->dec_specific_info = NULL; -} - -static void -desc_sl_conf_desc_init (SLConfigDescriptor * sl) -{ - desc_base_descriptor_init (&sl->base, SL_CONFIG_DESC_TAG, 0); - sl->predefined = 0x2; -} - -void -desc_es_init (ESDescriptor * es) -{ - desc_base_descriptor_init (&es->base, ES_DESCRIPTOR_TAG, 0); - - es->id = 0; - es->flags = 0; - es->depends_on_es_id = 0; - es->ocr_es_id = 0; - es->url_length = 0; - es->url_string = NULL; - - desc_dec_conf_desc_init (&es->dec_conf_desc); - desc_sl_conf_desc_init (&es->sl_conf_desc); -} - -ESDescriptor * -desc_es_descriptor_new (void) -{ - ESDescriptor *es = g_new0 (ESDescriptor, 1); - - desc_es_init (es); - return es; -} - -/* - * Deinitializers/Destructors below - */ - -static void -desc_base_descriptor_clear (BaseDescriptor * base) -{ -} - -void -desc_dec_specific_info_free (DecoderSpecificInfoDescriptor * dsid) -{ - desc_base_descriptor_clear (&dsid->base); - if (dsid->data) { - g_free (dsid->data); - dsid->data = NULL; - } - g_free (dsid); -} - -static void -desc_dec_conf_desc_clear (DecoderConfigDescriptor * dec) -{ - desc_base_descriptor_clear (&dec->base); - if (dec->dec_specific_info) { - desc_dec_specific_info_free (dec->dec_specific_info); - } -} - -static void -desc_sl_config_descriptor_clear (SLConfigDescriptor * sl) -{ - desc_base_descriptor_clear (&sl->base); -} - -void -desc_es_descriptor_clear (ESDescriptor * es) -{ - desc_base_descriptor_clear (&es->base); - if (es->url_string) { - g_free (es->url_string); - es->url_string = NULL; - } - desc_dec_conf_desc_clear (&es->dec_conf_desc); - desc_sl_config_descriptor_clear (&es->sl_conf_desc); -} - -/* - * Size handling functions below - */ - -void -desc_dec_specific_info_alloc_data (DecoderSpecificInfoDescriptor * dsid, - guint32 size) -{ - if (dsid->data) { - g_free (dsid->data); - } - dsid->data = g_new0 (guint8, size); - dsid->length = size; -} - -static void -desc_base_descriptor_set_size (BaseDescriptor * bd, guint32 size) -{ - expandable_size_parse (size, bd->size, 4); -} - -static guint64 -desc_base_descriptor_get_size (BaseDescriptor * bd) -{ - guint64 size = 0; - - size += sizeof (guint8); - size += expandable_size_get_length (bd->size, 4) * sizeof (guint8); - return size; -} - -static guint64 -desc_sl_config_descriptor_get_size (SLConfigDescriptor * sl_desc) -{ - guint64 size = 0; - guint64 extra_size = 0; - - size += desc_base_descriptor_get_size (&sl_desc->base); - /* predefined */ - extra_size += sizeof (guint8); - - desc_base_descriptor_set_size (&sl_desc->base, extra_size); - - return size + extra_size; -} - -static guint64 -desc_dec_specific_info_get_size (DecoderSpecificInfoDescriptor * dsid) -{ - guint64 size = 0; - guint64 extra_size = 0; - - size += desc_base_descriptor_get_size (&dsid->base); - extra_size += sizeof (guint8) * dsid->length; - desc_base_descriptor_set_size (&dsid->base, extra_size); - return size + extra_size; -} - -static guint64 -desc_dec_config_descriptor_get_size (DecoderConfigDescriptor * dec_desc) -{ - guint64 size = 0; - guint64 extra_size = 0; - - size += desc_base_descriptor_get_size (&dec_desc->base); - /* object type */ - extra_size += sizeof (guint8); - /* stream type */ - extra_size += sizeof (guint8); - /* buffer size */ - extra_size += sizeof (guint8) * 3; - /* max bitrate */ - extra_size += sizeof (guint32); - /* avg bitrate */ - extra_size += sizeof (guint32); - if (dec_desc->dec_specific_info) { - extra_size += desc_dec_specific_info_get_size (dec_desc->dec_specific_info); - } - - desc_base_descriptor_set_size (&dec_desc->base, extra_size); - return size + extra_size; -} - -static guint64 -desc_es_descriptor_get_size (ESDescriptor * es) -{ - guint64 size = 0; - guint64 extra_size = 0; - - size += desc_base_descriptor_get_size (&es->base); - /* id */ - extra_size += sizeof (guint16); - /* flags */ - extra_size += sizeof (guint8); - /* depends_on_es_id */ - if (es->flags & 0x80) { - extra_size += sizeof (guint16); - } - if (es->flags & 0x40) { - /* url_length */ - extra_size += sizeof (guint8); - /* url */ - extra_size += sizeof (gchar) * es->url_length; - } - if (es->flags & 0x20) { - /* ocr_es_id */ - extra_size += sizeof (guint16); - } - - extra_size += desc_dec_config_descriptor_get_size (&es->dec_conf_desc); - extra_size += desc_sl_config_descriptor_get_size (&es->sl_conf_desc); - - desc_base_descriptor_set_size (&es->base, extra_size); - - return size + extra_size; -} - -static gboolean -desc_es_descriptor_check_stream_dependency (ESDescriptor * es) -{ - return es->flags & 0x80; -} - -static gboolean -desc_es_descriptor_check_url_flag (ESDescriptor * es) -{ - return es->flags & 0x40; -} - -static gboolean -desc_es_descriptor_check_ocr (ESDescriptor * es) -{ - return es->flags & 0x20; -} - -/* Copy/Serializations Functions below */ - -static guint64 -desc_base_descriptor_copy_data (BaseDescriptor * desc, guint8 ** buffer, - guint64 * size, guint64 * offset) -{ - guint64 original_offset = *offset; - - prop_copy_uint8 (desc->tag, buffer, size, offset); - prop_copy_uint8_array (desc->size, expandable_size_get_length (desc->size, 4), - buffer, size, offset); - return original_offset - *offset; -} - -static guint64 -desc_sl_config_descriptor_copy_data (SLConfigDescriptor * desc, - guint8 ** buffer, guint64 * size, guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!desc_base_descriptor_copy_data (&desc->base, buffer, size, offset)) { - return 0; - } - /* predefined attribute */ - prop_copy_uint8 (desc->predefined, buffer, size, offset); - - return *offset - original_offset; -} - -static guint64 -desc_dec_specific_info_copy_data (DecoderSpecificInfoDescriptor * desc, - guint8 ** buffer, guint64 * size, guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!desc_base_descriptor_copy_data (&desc->base, buffer, size, offset)) { - return 0; - } - prop_copy_uint8_array (desc->data, desc->length, buffer, size, offset); - - return *offset - original_offset; -} - -static guint64 -desc_dec_config_descriptor_copy_data (DecoderConfigDescriptor * desc, - guint8 ** buffer, guint64 * size, guint64 * offset) -{ - guint64 original_offset = *offset; - - if (!desc_base_descriptor_copy_data (&desc->base, buffer, size, offset)) { - return 0; - } - - prop_copy_uint8 (desc->object_type, buffer, size, offset); - - prop_copy_uint8 (desc->stream_type, buffer, size, offset); - prop_copy_uint8_array (desc->buffer_size_DB, 3, buffer, size, offset); - - prop_copy_uint32 (desc->max_bitrate, buffer, size, offset); - prop_copy_uint32 (desc->avg_bitrate, buffer, size, offset); - - if (desc->dec_specific_info) { - if (!desc_dec_specific_info_copy_data (desc->dec_specific_info, buffer, - size, offset)) { - return 0; - } - } - - return *offset - original_offset; -} - -guint64 -desc_es_descriptor_copy_data (ESDescriptor * desc, guint8 ** buffer, - guint64 * size, guint64 * offset) -{ - guint64 desc_size; - guint64 original_offset = *offset; - - /* must call this twice to have size fields of all contained descriptors set - * correctly, and to have the size of the size fields taken into account */ - desc_size = desc_es_descriptor_get_size (desc); - desc_size = desc_es_descriptor_get_size (desc); - - if (!desc_base_descriptor_copy_data (&desc->base, buffer, size, offset)) { - return 0; - } - /* id and flags */ - prop_copy_uint16 (desc->id, buffer, size, offset); - prop_copy_uint8 (desc->flags, buffer, size, offset); - - if (desc_es_descriptor_check_stream_dependency (desc)) { - prop_copy_uint16 (desc->depends_on_es_id, buffer, size, offset); - } - - if (desc_es_descriptor_check_url_flag (desc)) { - prop_copy_size_string (desc->url_string, desc->url_length, buffer, size, - offset); - } - - if (desc_es_descriptor_check_ocr (desc)) { - prop_copy_uint16 (desc->ocr_es_id, buffer, size, offset); - } - - if (!desc_dec_config_descriptor_copy_data (&desc->dec_conf_desc, buffer, size, - offset)) { - return 0; - } - - if (!desc_sl_config_descriptor_copy_data (&desc->sl_conf_desc, buffer, size, - offset)) { - return 0; - } - - return *offset - original_offset; -} diff --git a/gst/qtmux/descriptors.h b/gst/qtmux/descriptors.h deleted file mode 100644 index cc633a305b..0000000000 --- a/gst/qtmux/descriptors.h +++ /dev/null @@ -1,151 +0,0 @@ -/* Quicktime muxer plugin for GStreamer - * Copyright (C) 2008 Thiago Sousa Santos - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* - * Unless otherwise indicated, Source Code is licensed under MIT license. - * See further explanation attached in License Statement (distributed in the file - * LICENSE). - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef __DESCRIPTORS_H__ -#define __DESCRIPTORS_H__ - -#include -#include -#include "properties.h" - -/* - * Tags for descriptor (each kind is represented by a number, instead of fourcc as in atoms) - */ -#define OBJECT_DESC_TAG 0x01 -#define INIT_OBJECT_DESC_TAG 0x02 -#define ES_DESCRIPTOR_TAG 0x03 -#define DECODER_CONFIG_DESC_TAG 0x04 -#define DECODER_SPECIFIC_INFO_TAG 0x05 -#define SL_CONFIG_DESC_TAG 0x06 -#define ES_ID_INC_TAG 0x0E -#define MP4_INIT_OBJECT_DESC_TAG 0x10 - -#define ESDS_OBJECT_TYPE_MPEG1_P3 0x6B -#define ESDS_OBJECT_TYPE_MPEG2_P7_MAIN 0x66 -#define ESDS_OBJECT_TYPE_MPEG4_P7_LC 0x67 -#define ESDS_OBJECT_TYPE_MPEG4_P7_SSR 0x68 -#define ESDS_OBJECT_TYPE_MPEG4_P2 0x20 -#define ESDS_OBJECT_TYPE_MPEG4_P3 0x40 - -#define ESDS_STREAM_TYPE_VISUAL 0x04 -#define ESDS_STREAM_TYPE_AUDIO 0x05 - - -typedef struct _BaseDescriptor -{ - guint8 tag; - /* the first bit of each byte indicates if the next byte should be used */ - guint8 size[4]; -} BaseDescriptor; - -typedef struct _SLConfigDescriptor -{ - BaseDescriptor base; - - guint8 predefined; /* everything is supposed predefined */ -} SLConfigDescriptor; - -typedef struct _DecoderSpecificInfoDescriptor -{ - BaseDescriptor base; - guint32 length; - guint8 *data; -} DecoderSpecificInfoDescriptor; - -typedef struct _DecoderConfigDescriptor { - BaseDescriptor base; - - guint8 object_type; - - /* following are condensed into streamType: - * bit(6) streamType; - * bit(1) upStream; - * const bit(1) reserved=1; - */ - guint8 stream_type; - - guint8 buffer_size_DB[3]; - guint32 max_bitrate; - guint32 avg_bitrate; - - DecoderSpecificInfoDescriptor *dec_specific_info; -} DecoderConfigDescriptor; - -typedef struct _ESDescriptor -{ - BaseDescriptor base; - - guint16 id; - - /* flags contains the following: - * bit(1) streamDependenceFlag; - * bit(1) URL_Flag; - * bit(1) OCRstreamFlag; - * bit(5) streamPriority; - */ - guint8 flags; - - guint16 depends_on_es_id; - guint8 url_length; /* only if URL_flag is set */ - guint8 *url_string; /* size is url_length */ - - guint16 ocr_es_id; /* only if OCRstreamFlag is set */ - - DecoderConfigDescriptor dec_conf_desc; - SLConfigDescriptor sl_conf_desc; - - /* optional remainder of ESDescriptor is not used */ -} ESDescriptor; - -/* --- FUNCTIONS --- */ -void desc_es_init (ESDescriptor *es); -ESDescriptor *desc_es_descriptor_new (void); -guint64 desc_es_descriptor_copy_data (ESDescriptor *es, guint8 **buffer, - guint64 *size, guint64 *offset); -void desc_es_descriptor_clear (ESDescriptor *es); - -DecoderSpecificInfoDescriptor *desc_dec_specific_info_new(void); -void desc_dec_specific_info_free (DecoderSpecificInfoDescriptor *dsid); -void desc_dec_specific_info_alloc_data (DecoderSpecificInfoDescriptor *dsid, - guint32 size); - -#endif /* __DESCRIPTORS_H__ */ diff --git a/gst/qtmux/fourcc.h b/gst/qtmux/fourcc.h deleted file mode 100644 index 188e20275e..0000000000 --- a/gst/qtmux/fourcc.h +++ /dev/null @@ -1,243 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - /* - * Unless otherwise indicated, Source Code is licensed under MIT license. - * See further explanation attached in License Statement (distributed in the file - * LICENSE). - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - - -#ifndef __FOURCC_H__ -#define __FOURCC_H__ - -#include - -G_BEGIN_DECLS - -#define FOURCC_null 0x0 - -#define FOURCC_moov GST_MAKE_FOURCC('m','o','o','v') -#define FOURCC_mvhd GST_MAKE_FOURCC('m','v','h','d') -#define FOURCC_clip GST_MAKE_FOURCC('c','l','i','p') -#define FOURCC_trak GST_MAKE_FOURCC('t','r','a','k') -#define FOURCC_udta GST_MAKE_FOURCC('u','d','t','a') -#define FOURCC_ctab GST_MAKE_FOURCC('c','t','a','b') -#define FOURCC_tkhd GST_MAKE_FOURCC('t','k','h','d') -#define FOURCC_crgn GST_MAKE_FOURCC('c','r','g','n') -#define FOURCC_matt GST_MAKE_FOURCC('m','a','t','t') -#define FOURCC_kmat GST_MAKE_FOURCC('k','m','a','t') -#define FOURCC_edts GST_MAKE_FOURCC('e','d','t','s') -#define FOURCC_elst GST_MAKE_FOURCC('e','l','s','t') -#define FOURCC_load GST_MAKE_FOURCC('l','o','a','d') -#define FOURCC_tref GST_MAKE_FOURCC('t','r','e','f') -#define FOURCC_imap GST_MAKE_FOURCC('i','m','a','p') -#define FOURCC___in GST_MAKE_FOURCC(' ',' ','i','n') -#define FOURCC___ty GST_MAKE_FOURCC(' ',' ','t','y') -#define FOURCC_mdia GST_MAKE_FOURCC('m','d','i','a') -#define FOURCC_mdhd GST_MAKE_FOURCC('m','d','h','d') -#define FOURCC_hdlr GST_MAKE_FOURCC('h','d','l','r') -#define FOURCC_dhlr GST_MAKE_FOURCC('d','h','l','r') -#define FOURCC_mhlr GST_MAKE_FOURCC('m','h','l','r') -#define FOURCC_minf GST_MAKE_FOURCC('m','i','n','f') -#define FOURCC_mdir GST_MAKE_FOURCC('m','d','i','r') -#define FOURCC_vmhd GST_MAKE_FOURCC('v','m','h','d') -#define FOURCC_smhd GST_MAKE_FOURCC('s','m','h','d') -#define FOURCC_gmhd GST_MAKE_FOURCC('g','m','h','d') -#define FOURCC_hmhd GST_MAKE_FOURCC('h','m','h','d') -#define FOURCC_gmin GST_MAKE_FOURCC('g','m','i','n') -#define FOURCC_dinf GST_MAKE_FOURCC('d','i','n','f') -#define FOURCC_dref GST_MAKE_FOURCC('d','r','e','f') -#define FOURCC_stbl GST_MAKE_FOURCC('s','t','b','l') -#define FOURCC_stsd GST_MAKE_FOURCC('s','t','s','d') -#define FOURCC_stts GST_MAKE_FOURCC('s','t','t','s') -#define FOURCC_stss GST_MAKE_FOURCC('s','t','s','s') -#define FOURCC_stsc GST_MAKE_FOURCC('s','t','s','c') -#define FOURCC_stsz GST_MAKE_FOURCC('s','t','s','z') -#define FOURCC_stco GST_MAKE_FOURCC('s','t','c','o') -#define FOURCC_vide GST_MAKE_FOURCC('v','i','d','e') -#define FOURCC_soun GST_MAKE_FOURCC('s','o','u','n') -#define FOURCC_strm GST_MAKE_FOURCC('s','t','r','m') -#define FOURCC_rtsp GST_MAKE_FOURCC('r','t','s','p') -#define FOURCC_co64 GST_MAKE_FOURCC('c','o','6','4') -#define FOURCC_cmov GST_MAKE_FOURCC('c','m','o','v') -#define FOURCC_dcom GST_MAKE_FOURCC('d','c','o','m') -#define FOURCC_cmvd GST_MAKE_FOURCC('c','m','v','d') -#define FOURCC_hint GST_MAKE_FOURCC('h','i','n','t') -#define FOURCC_mp4a GST_MAKE_FOURCC('m','p','4','a') -#define FOURCC__mp3 GST_MAKE_FOURCC('.','m','p','3') -#define FOURCC_mp4s GST_MAKE_FOURCC('m','p','4','s') -#define FOURCC_mp4v GST_MAKE_FOURCC('m','p','4','v') -#define FOURCC_2vuy GST_MAKE_FOURCC('2','v','u','y') -#define FOURCC_wave GST_MAKE_FOURCC('w','a','v','e') -#define FOURCC_appl GST_MAKE_FOURCC('a','p','p','l') -#define FOURCC_esds GST_MAKE_FOURCC('e','s','d','s') -#define FOURCC_pasp GST_MAKE_FOURCC('p','a','s','p') -#define FOURCC_hnti GST_MAKE_FOURCC('h','n','t','i') -#define FOURCC_rtp_ GST_MAKE_FOURCC('r','t','p',' ') -#define FOURCC_sdp_ GST_MAKE_FOURCC('s','d','p',' ') -#define FOURCC_meta GST_MAKE_FOURCC('m','e','t','a') -#define FOURCC_ilst GST_MAKE_FOURCC('i','l','s','t') -#define FOURCC__nam GST_MAKE_FOURCC(0xa9,'n','a','m') -#define FOURCC__ART GST_MAKE_FOURCC(0xa9,'A','R','T') -#define FOURCC_aART GST_MAKE_FOURCC('a','A','R','T') -#define FOURCC__wrt GST_MAKE_FOURCC(0xa9,'w','r','t') -#define FOURCC__grp GST_MAKE_FOURCC(0xa9,'g','r','p') -#define FOURCC__alb GST_MAKE_FOURCC(0xa9,'a','l','b') -#define FOURCC__day GST_MAKE_FOURCC(0xa9,'d','a','y') -#define FOURCC__des GST_MAKE_FOURCC(0xa9,'d','e','s') -#define FOURCC__lyr GST_MAKE_FOURCC(0xa9,'l','y','r') -#define FOURCC_gnre GST_MAKE_FOURCC('g','n','r','e') -#define FOURCC_disc GST_MAKE_FOURCC('d','i','s','c') -#define FOURCC_disk GST_MAKE_FOURCC('d','i','s','k') -#define FOURCC_trkn GST_MAKE_FOURCC('t','r','k','n') -#define FOURCC_cprt GST_MAKE_FOURCC('c','p','r','t') -#define FOURCC_covr GST_MAKE_FOURCC('c','o','v','r') -#define FOURCC_cpil GST_MAKE_FOURCC('c','p','i','l') -#define FOURCC_tmpo GST_MAKE_FOURCC('t','m','p','o') -#define FOURCC__too GST_MAKE_FOURCC(0xa9,'t','o','o') -#define FOURCC_keyw GST_MAKE_FOURCC('k','e','y','w') -#define FOURCC_____ GST_MAKE_FOURCC('-','-','-','-') -#define FOURCC_free GST_MAKE_FOURCC('f','r','e','e') -#define FOURCC_data GST_MAKE_FOURCC('d','a','t','a') -#define FOURCC_SVQ3 GST_MAKE_FOURCC('S','V','Q','3') -#define FOURCC_rmra GST_MAKE_FOURCC('r','m','r','a') -#define FOURCC_rmda GST_MAKE_FOURCC('r','m','d','a') -#define FOURCC_rdrf GST_MAKE_FOURCC('r','d','r','f') -#define FOURCC__gen GST_MAKE_FOURCC(0xa9, 'g', 'e', 'n') -#define FOURCC_rmdr GST_MAKE_FOURCC('r','m','d','r') -#define FOURCC_rmvc GST_MAKE_FOURCC('r','m','v','c') -#define FOURCC_qtim GST_MAKE_FOURCC('q','t','i','m') -#define FOURCC_drms GST_MAKE_FOURCC('d','r','m','s') -#define FOURCC_avc1 GST_MAKE_FOURCC('a','v','c','1') -#define FOURCC_h263 GST_MAKE_FOURCC('h','2','6','3') -#define FOURCC_s263 GST_MAKE_FOURCC('s','2','6','3') -#define FOURCC_avcC GST_MAKE_FOURCC('a','v','c','C') -#define FOURCC_VP31 GST_MAKE_FOURCC('V','P','3','1') -#define FOURCC_VP80 GST_MAKE_FOURCC('V','P','8','0') -#define FOURCC_rle_ GST_MAKE_FOURCC('r','l','e',' ') -#define FOURCC_MAC6 GST_MAKE_FOURCC('M','A','C','6') -#define FOURCC_MAC3 GST_MAKE_FOURCC('M','A','C','3') -#define FOURCC_ima4 GST_MAKE_FOURCC('i','m','a','4') -#define FOURCC_ulaw GST_MAKE_FOURCC('u','l','a','w') -#define FOURCC_alaw GST_MAKE_FOURCC('a','l','a','w') -#define FOURCC_twos GST_MAKE_FOURCC('t','w','o','s') -#define FOURCC_sowt GST_MAKE_FOURCC('s','o','w','t') -#define FOURCC_raw_ GST_MAKE_FOURCC('r','a','w',' ') -#define FOURCC_QDM2 GST_MAKE_FOURCC('Q','D','M','2') -#define FOURCC_alac GST_MAKE_FOURCC('a','l','a','c') -#define FOURCC_samr GST_MAKE_FOURCC('s','a','m','r') -#define FOURCC_sawb GST_MAKE_FOURCC('s','a','w','b') -#define FOURCC_mdat GST_MAKE_FOURCC('m','d','a','t') -#define FOURCC_wide GST_MAKE_FOURCC('w','i','d','e') -#define FOURCC_PICT GST_MAKE_FOURCC('P','I','C','T') -#define FOURCC_pnot GST_MAKE_FOURCC('p','n','o','t') -#define FOURCC_zlib GST_MAKE_FOURCC('z','l','i','b') -#define FOURCC_alis GST_MAKE_FOURCC('a','l','i','s') -#define FOURCC_url_ GST_MAKE_FOURCC('u','r','l',' ') -#define FOURCC_frma GST_MAKE_FOURCC('f','r','m','a') -#define FOURCC_ctts GST_MAKE_FOURCC('c','t','t','s') -#define FOURCC_drac GST_MAKE_FOURCC('d','r','a','c') -#define FOURCC_jpeg GST_MAKE_FOURCC('j','p','e','g') -#define FOURCC_mjp2 GST_MAKE_FOURCC('m','j','p','2') -#define FOURCC_jp2h GST_MAKE_FOURCC('j','p','2','h') -#define FOURCC_jp2c GST_MAKE_FOURCC('j','p','2','c') -#define FOURCC_gama GST_MAKE_FOURCC('g','a','m','a') -#define FOURCC_tvsh GST_MAKE_FOURCC('t','v','s','h') -#define FOURCC_tven GST_MAKE_FOURCC('t','v','e','n') -#define FOURCC_tvsn GST_MAKE_FOURCC('t','v','s','n') -#define FOURCC_tves GST_MAKE_FOURCC('t','v','e','s') -#define FOURCC_sonm GST_MAKE_FOURCC('s','o','n','m') -#define FOURCC_soal GST_MAKE_FOURCC('s','o','a','l') -#define FOURCC_soar GST_MAKE_FOURCC('s','o','a','r') -#define FOURCC_soaa GST_MAKE_FOURCC('s','o','a','a') -#define FOURCC_soco GST_MAKE_FOURCC('s','o','c','o') -#define FOURCC_sosn GST_MAKE_FOURCC('s','o','s','n') -#define FOURCC_XMP_ GST_MAKE_FOURCC('X','M','P','_') -#define FOURCC_uuid GST_MAKE_FOURCC('u','u','i','d') - - -/* SVQ3 fourcc */ -#define FOURCC_SEQH GST_MAKE_FOURCC('S','E','Q','H') -#define FOURCC_SMI_ GST_MAKE_FOURCC('S','M','I',' ') - -/* fragmented mp4 */ -#define FOURCC_mvex GST_MAKE_FOURCC('m','v','e','x') -#define FOURCC_mehd GST_MAKE_FOURCC('m','e','h','d') -#define FOURCC_trex GST_MAKE_FOURCC('t','r','e','x') -#define FOURCC_mfra GST_MAKE_FOURCC('m','f','r','a') -#define FOURCC_moof GST_MAKE_FOURCC('m','o','o','f') -#define FOURCC_tfra GST_MAKE_FOURCC('t','f','r','a') -#define FOURCC_tfhd GST_MAKE_FOURCC('t','f','h','d') -#define FOURCC_trun GST_MAKE_FOURCC('t','r','u','n') -#define FOURCC_sdtp GST_MAKE_FOURCC('s','d','t','p') -#define FOURCC_mfro GST_MAKE_FOURCC('m','f','r','o') -#define FOURCC_mfhd GST_MAKE_FOURCC('m','f','h','d') -#define FOURCC_mvhd GST_MAKE_FOURCC('m','v','h','d') -#define FOURCC_traf GST_MAKE_FOURCC('t','r','a','f') - -/* Xiph fourcc */ -#define FOURCC_XiTh GST_MAKE_FOURCC('X','i','T','h') -#define FOURCC_XdxT GST_MAKE_FOURCC('X','d','x','T') -#define FOURCC_tCtH GST_MAKE_FOURCC('t','C','t','H') -#define FOURCC_tCt_ GST_MAKE_FOURCC('t','C','t','#') -#define FOURCC_tCtC GST_MAKE_FOURCC('t','C','t','C') - -/* ilst metatags */ -#define FOURCC_titl GST_MAKE_FOURCC('t','i','t','l') -#define FOURCC__cmt GST_MAKE_FOURCC(0xa9, 'c','m','t') - -/* 3gp tags */ -#define FOURCC_dscp GST_MAKE_FOURCC('d','s','c','p') -#define FOURCC_perf GST_MAKE_FOURCC('p','e','r','f') -#define FOURCC_auth GST_MAKE_FOURCC('a','u','t','h') -#define FOURCC_yrrc GST_MAKE_FOURCC('y','r','r','c') -#define FOURCC_albm GST_MAKE_FOURCC('a','l','b','m') -#define FOURCC_loci GST_MAKE_FOURCC('l','o','c','i') -#define FOURCC_kywd GST_MAKE_FOURCC('k','y','w','d') -#define FOURCC_clsf GST_MAKE_FOURCC('c','l','s','f') - -/* For Microsoft Wave formats embedded in quicktime, the FOURCC is - 'm', 's', then the 16 bit wave codec id */ -#define MS_WAVE_FOURCC(codecid) GST_MAKE_FOURCC( \ - 'm', 's', ((codecid)>>8)&0xff, ((codecid)&0xff)) - -#define FOURCC_owma GST_MAKE_FOURCC('o','w','m','a') -#define FOURCC_ovc1 GST_MAKE_FOURCC('o','v','c','1') - -G_END_DECLS - -#endif /* __FOURCC_H__ */ diff --git a/gst/qtmux/ftypcc.h b/gst/qtmux/ftypcc.h deleted file mode 100644 index 3d31b6dd0b..0000000000 --- a/gst/qtmux/ftypcc.h +++ /dev/null @@ -1,68 +0,0 @@ -/* GStreamer - * Copyright (C) <2008> Thiago Sousa Santos - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* - * Unless otherwise indicated, Source Code is licensed under MIT license. - * See further explanation attached in License Statement (distributed in the file - * LICENSE). - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef __FTYP_CC_H__ -#define __FTYP_CC_H__ - -#include - -G_BEGIN_DECLS - -#define FOURCC_ftyp GST_MAKE_FOURCC('f','t','y','p') -#define FOURCC_isom GST_MAKE_FOURCC('i','s','o','m') -#define FOURCC_iso2 GST_MAKE_FOURCC('i','s','o','2') -#define FOURCC_mp41 GST_MAKE_FOURCC('m','p','4','1') -#define FOURCC_mp42 GST_MAKE_FOURCC('m','p','4','2') -#define FOURCC_mjp2 GST_MAKE_FOURCC('m','j','p','2') -#define FOURCC_3gp4 GST_MAKE_FOURCC('3','g','p','4') -#define FOURCC_3gp6 GST_MAKE_FOURCC('3','g','p','6') -#define FOURCC_3gg6 GST_MAKE_FOURCC('3','g','g','6') -#define FOURCC_3gr6 GST_MAKE_FOURCC('3','g','r','6') -#define FOURCC_3gg7 GST_MAKE_FOURCC('3','g','g','7') -#define FOURCC_avc1 GST_MAKE_FOURCC('a','v','c','1') -#define FOURCC_qt__ GST_MAKE_FOURCC('q','t',' ',' ') -#define FOURCC_isml GST_MAKE_FOURCC('i','s','m','l') -#define FOURCC_piff GST_MAKE_FOURCC('p','i','f','f') - -G_END_DECLS - -#endif /* __FTYP_CC_H__ */ diff --git a/gst/qtmux/gstqtmoovrecover.c b/gst/qtmux/gstqtmoovrecover.c deleted file mode 100644 index 889b2cc4b5..0000000000 --- a/gst/qtmux/gstqtmoovrecover.c +++ /dev/null @@ -1,390 +0,0 @@ -/* Quicktime muxer plugin for GStreamer - * Copyright (C) 2010 Thiago Santos - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* - * Unless otherwise indicated, Source Code is licensed under MIT license. - * See further explanation attached in License Statement (distributed in the file - * LICENSE). - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - - -/** - * SECTION:gstqtmoovrecover - * @short_description: Utility element for recovering unfinished quicktime files - * - * - * - * This element recovers quicktime files created with qtmux using the moov recovery feature. - * - * Example pipelines - * - * - * TODO - * - * - * - * Last reviewed on 2010-02-01 - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#include "gstqtmoovrecover.h" - -GST_DEBUG_CATEGORY_STATIC (gst_qt_moov_recover_debug); -#define GST_CAT_DEFAULT gst_qt_moov_recover_debug - -/* QTMoovRecover signals and args */ -enum -{ - /* FILL ME */ - LAST_SIGNAL -}; - -enum -{ - PROP_0, - PROP_RECOVERY_INPUT, - PROP_BROKEN_INPUT, - PROP_FIXED_OUTPUT, - PROP_FAST_START_MODE -}; - -GST_BOILERPLATE (GstQTMoovRecover, gst_qt_moov_recover, GstPipeline, - GST_TYPE_PIPELINE); - -/* property functions */ -static void gst_qt_moov_recover_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec); -static void gst_qt_moov_recover_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec); - -static GstStateChangeReturn gst_qt_moov_recover_change_state (GstElement * - element, GstStateChange transition); - -static void gst_qt_moov_recover_finalize (GObject * object); - -static void -gst_qt_moov_recover_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); -#if 0 - GstQTMoovRecoverClass *klass = (GstQTMoovRecoverClass *) g_class; -#endif - gst_element_class_set_details_simple (element_class, "QT Moov Recover", - "Util", "Recovers unfinished qtmux files", - "Thiago Santos "); -} - -static void -gst_qt_moov_recover_class_init (GstQTMoovRecoverClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - parent_class = g_type_class_peek_parent (klass); - - gobject_class->finalize = gst_qt_moov_recover_finalize; - gobject_class->get_property = gst_qt_moov_recover_get_property; - gobject_class->set_property = gst_qt_moov_recover_set_property; - - gstelement_class->change_state = gst_qt_moov_recover_change_state; - - g_object_class_install_property (gobject_class, PROP_FIXED_OUTPUT, - g_param_spec_string ("fixed-output", - "Path to write the fixed file", - "Path to write the fixed file to (used as output)", - NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, PROP_BROKEN_INPUT, - g_param_spec_string ("broken-input", - "Path to broken input file", - "Path to broken input file. (If qtmux was on faststart mode, this " - "file is the faststart file)", NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, PROP_RECOVERY_INPUT, - g_param_spec_string ("recovery-input", - "Path to recovery file", - "Path to recovery file (used as input)", NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, PROP_FAST_START_MODE, - g_param_spec_boolean ("faststart-mode", - "If the broken input is from faststart mode", - "If the broken input is from faststart mode", - FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - GST_DEBUG_CATEGORY_INIT (gst_qt_moov_recover_debug, "qtmoovrecover", 0, - "QT Moovie Recover"); -} - -static void -gst_qt_moov_recover_init (GstQTMoovRecover * qtmr, - GstQTMoovRecoverClass * qtmr_klass) -{ -} - -static void -gst_qt_moov_recover_finalize (GObject * object) -{ - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -gst_qt_moov_recover_run (void *data) -{ - FILE *moovrec = NULL; - FILE *mdatinput = NULL; - FILE *output = NULL; - MdatRecovFile *mdat_recov = NULL; - MoovRecovFile *moov_recov = NULL; - GstQTMoovRecover *qtmr = GST_QT_MOOV_RECOVER_CAST (data); - GError *err = NULL; - - GST_LOG_OBJECT (qtmr, "Starting task"); - - GST_DEBUG_OBJECT (qtmr, "Validating properties"); - GST_OBJECT_LOCK (qtmr); - /* validate properties */ - if (qtmr->broken_input == NULL) { - GST_OBJECT_UNLOCK (qtmr); - GST_ELEMENT_ERROR (qtmr, RESOURCE, SETTINGS, - ("Please set broken-input property"), (NULL)); - goto end; - } - if (qtmr->recovery_input == NULL) { - GST_OBJECT_UNLOCK (qtmr); - GST_ELEMENT_ERROR (qtmr, RESOURCE, SETTINGS, - ("Please set recovery-input property"), (NULL)); - goto end; - } - if (qtmr->fixed_output == NULL) { - GST_OBJECT_UNLOCK (qtmr); - GST_ELEMENT_ERROR (qtmr, RESOURCE, SETTINGS, - ("Please set fixed-output property"), (NULL)); - goto end; - } - - GST_DEBUG_OBJECT (qtmr, "Opening input/output files"); - /* open files */ - moovrec = g_fopen (qtmr->recovery_input, "rb"); - if (moovrec == NULL) { - GST_OBJECT_UNLOCK (qtmr); - GST_ELEMENT_ERROR (qtmr, RESOURCE, OPEN_READ, - ("Failed to open recovery-input file"), (NULL)); - goto end; - } - - mdatinput = g_fopen (qtmr->broken_input, "rb"); - if (mdatinput == NULL) { - GST_OBJECT_UNLOCK (qtmr); - GST_ELEMENT_ERROR (qtmr, RESOURCE, OPEN_READ, - ("Failed to open broken-input file"), (NULL)); - goto end; - } - output = g_fopen (qtmr->fixed_output, "wb+"); - if (output == NULL) { - GST_OBJECT_UNLOCK (qtmr); - GST_ELEMENT_ERROR (qtmr, RESOURCE, OPEN_READ_WRITE, - ("Failed to open fixed-output file"), (NULL)); - goto end; - } - GST_OBJECT_UNLOCK (qtmr); - - GST_DEBUG_OBJECT (qtmr, "Parsing input files"); - /* now create our structures */ - mdat_recov = mdat_recov_file_create (mdatinput, qtmr->faststart_mode, &err); - mdatinput = NULL; - if (mdat_recov == NULL) { - GST_ELEMENT_ERROR (qtmr, RESOURCE, FAILED, - ("Broken file could not be parsed correctly"), (NULL)); - goto end; - } - moov_recov = moov_recov_file_create (moovrec, &err); - moovrec = NULL; - if (moov_recov == NULL) { - GST_ELEMENT_ERROR (qtmr, RESOURCE, FAILED, - ("Recovery file could not be parsed correctly"), (NULL)); - goto end; - } - - /* now parse the buffers data from moovrec */ - if (!moov_recov_parse_buffers (moov_recov, mdat_recov, &err)) { - goto end; - } - - GST_DEBUG_OBJECT (qtmr, "Writing fixed file to output"); - if (!moov_recov_write_file (moov_recov, mdat_recov, output, &err)) { - goto end; - } - - /* here means success */ - GST_DEBUG_OBJECT (qtmr, "Finished successfully, posting EOS"); - gst_element_post_message (GST_ELEMENT_CAST (qtmr), - gst_message_new_eos (GST_OBJECT_CAST (qtmr))); - -end: - GST_LOG_OBJECT (qtmr, "Finalizing task"); - if (err) { - GST_ELEMENT_ERROR (qtmr, RESOURCE, FAILED, ("%s", err->message), (NULL)); - g_error_free (err); - } - - if (moov_recov) - moov_recov_file_free (moov_recov); - if (moovrec) - fclose (moovrec); - - if (mdat_recov) - mdat_recov_file_free (mdat_recov); - if (mdatinput) - fclose (mdatinput); - - if (output) - fclose (output); - GST_LOG_OBJECT (qtmr, "Leaving task"); - gst_task_stop (qtmr->task); -} - -static void -gst_qt_moov_recover_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec) -{ - GstQTMoovRecover *qtmr = GST_QT_MOOV_RECOVER_CAST (object); - - GST_OBJECT_LOCK (qtmr); - switch (prop_id) { - case PROP_FAST_START_MODE: - g_value_set_boolean (value, qtmr->faststart_mode); - break; - case PROP_BROKEN_INPUT: - g_value_set_string (value, qtmr->broken_input); - break; - case PROP_RECOVERY_INPUT: - g_value_set_string (value, qtmr->recovery_input); - break; - case PROP_FIXED_OUTPUT: - g_value_set_string (value, qtmr->fixed_output); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } - GST_OBJECT_UNLOCK (qtmr); -} - -static void -gst_qt_moov_recover_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec) -{ - GstQTMoovRecover *qtmr = GST_QT_MOOV_RECOVER_CAST (object); - - GST_OBJECT_LOCK (qtmr); - switch (prop_id) { - case PROP_FAST_START_MODE: - qtmr->faststart_mode = g_value_get_boolean (value); - break; - case PROP_BROKEN_INPUT: - g_free (qtmr->broken_input); - qtmr->broken_input = g_value_dup_string (value); - break; - case PROP_RECOVERY_INPUT: - g_free (qtmr->recovery_input); - qtmr->recovery_input = g_value_dup_string (value); - break; - case PROP_FIXED_OUTPUT: - g_free (qtmr->fixed_output); - qtmr->fixed_output = g_value_dup_string (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } - GST_OBJECT_UNLOCK (qtmr); -} - -static GstStateChangeReturn -gst_qt_moov_recover_change_state (GstElement * element, - GstStateChange transition) -{ - GstStateChangeReturn ret; - GstQTMoovRecover *qtmr = GST_QT_MOOV_RECOVER_CAST (element); - - switch (transition) { - case GST_STATE_CHANGE_NULL_TO_READY: - qtmr->task = gst_task_create (gst_qt_moov_recover_run, qtmr); - qtmr->task_mutex = g_new (GStaticRecMutex, 1); - g_static_rec_mutex_init (qtmr->task_mutex); - gst_task_set_lock (qtmr->task, qtmr->task_mutex); - break; - case GST_STATE_CHANGE_PAUSED_TO_PLAYING: - gst_task_start (qtmr->task); - break; - default: - break; - } - - ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - - switch (transition) { - case GST_STATE_CHANGE_PLAYING_TO_PAUSED: - gst_task_stop (qtmr->task); - gst_task_join (qtmr->task); - break; - case GST_STATE_CHANGE_READY_TO_NULL: - g_assert (gst_task_get_state (qtmr->task) == GST_TASK_STOPPED); - gst_object_unref (qtmr->task); - qtmr->task = NULL; - g_static_rec_mutex_free (qtmr->task_mutex); - break; - default: - break; - } - return ret; -} - - -gboolean -gst_qt_moov_recover_register (GstPlugin * plugin) -{ - return gst_element_register (plugin, "qtmoovrecover", GST_RANK_NONE, - GST_TYPE_QT_MOOV_RECOVER); -} diff --git a/gst/qtmux/gstqtmoovrecover.h b/gst/qtmux/gstqtmoovrecover.h deleted file mode 100644 index 07dc9d9379..0000000000 --- a/gst/qtmux/gstqtmoovrecover.h +++ /dev/null @@ -1,88 +0,0 @@ -/* Quicktime muxer plugin for GStreamer - * Copyright (C) 2010 Thiago Santos - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* - * Unless otherwise indicated, Source Code is licensed under MIT license. - * See further explanation attached in License Statement (distributed in the file - * LICENSE). - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef __GST_QT_MOOV_RECOVER_H__ -#define __GST_QT_MOOV_RECOVER_H__ - -#include - -#include "atoms.h" -#include "atomsrecovery.h" - -G_BEGIN_DECLS - -#define GST_TYPE_QT_MOOV_RECOVER (gst_qt_moov_recover_get_type()) -#define GST_QT_MOOV_RECOVER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_QT_MOOV_RECOVER, GstQTMoovRecover)) -#define GST_QT_MOOV_RECOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_QT_MOOV_RECOVER, GstQTMoovRecover)) -#define GST_IS_QT_MOOV_RECOVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_QT_MOOV_RECOVER)) -#define GST_IS_QT_MOOV_RECOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_QT_MOOV_RECOVER)) -#define GST_QT_MOOV_RECOVER_CAST(obj) ((GstQTMoovRecover*)(obj)) - - -typedef struct _GstQTMoovRecover GstQTMoovRecover; -typedef struct _GstQTMoovRecoverClass GstQTMoovRecoverClass; - -struct _GstQTMoovRecover -{ - GstPipeline pipeline; - - GstTask *task; - GStaticRecMutex *task_mutex; - - /* properties */ - gboolean faststart_mode; - gchar *recovery_input; - gchar *fixed_output; - gchar *broken_input; -}; - -struct _GstQTMoovRecoverClass -{ - GstPipelineClass parent_class; -}; - -GType gst_qt_moov_recover_get_type (void); -gboolean gst_qt_moov_recover_register (GstPlugin * plugin); - -G_END_DECLS - -#endif /* __GST_QT_MOOV_RECOVER_H__ */ diff --git a/gst/qtmux/gstqtmux.c b/gst/qtmux/gstqtmux.c deleted file mode 100644 index 4a38bb02f8..0000000000 --- a/gst/qtmux/gstqtmux.c +++ /dev/null @@ -1,3461 +0,0 @@ -/* Quicktime muxer plugin for GStreamer - * Copyright (C) 2008-2010 Thiago Santos - * Copyright (C) 2008 Mark Nauwelaerts - * Copyright (C) 2010 Nokia Corporation. All rights reserved. - * Contact: Stefan Kost - - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* - * Unless otherwise indicated, Source Code is licensed under MIT license. - * See further explanation attached in License Statement (distributed in the file - * LICENSE). - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - - -/** - * SECTION:element-qtmux - * @short_description: Muxer for quicktime(.mov) files - * - * This element merges streams (audio and video) into QuickTime(.mov) files. - * - * The following background intends to explain why various similar muxers - * are present in this plugin. - * - * The - * QuickTime file format specification served as basis for the MP4 file - * format specification (mp4mux), and as such the QuickTime file structure is - * nearly identical to the so-called ISO Base Media file format defined in - * ISO 14496-12 (except for some media specific parts). - * In turn, the latter ISO Base Media format was further specialized as a - * Motion JPEG-2000 file format in ISO 15444-3 (mj2mux) - * and in various 3GPP(2) specs (gppmux). - * The fragmented file features defined (only) in ISO Base Media are used by - * ISMV files making up (a.o.) Smooth Streaming (ismlmux). - * - * A few properties (movie-timescale, - * trak-timescale) allow adjusting - * some technical parameters, which might be useful in (rare) cases to resolve - * compatibility issues in some situations. - * - * Some other properties influence the result more fundamentally. - * A typical mov/mp4 file's metadata (aka moov) is located at the end of the file, - * somewhat contrary to this usually being called "the header". - * However, a faststart file will - * (with some effort) arrange this to be located near start of the file, - * which then allows it e.g. to be played while downloading. - * Alternatively, rather than having one chunk of metadata at start (or end), - * there can be some metadata at start and most of the other data can be spread - * out into fragments of fragment-duration. - * If such fragmented layout is intended for streaming purposes, then - * streamable allows foregoing to add - * index metadata (at the end of file). - * - * dts-method allows selecting a - * method for managing input timestamps (stay tuned for 0.11 to have this - * automagically settled). The default delta/duration method should handle nice - * (aka perfect streams) just fine, but may experience problems otherwise - * (e.g. input stream with re-ordered B-frames and/or with frame dropping). - * The re-ordering approach re-assigns incoming timestamps in ascending order - * to incoming buffers and offers an alternative in such cases. In cases where - * that might fail, the remaining method can be tried, which is exact and - * according to specs, but might experience playback on not so spec-wise players. - * Note that this latter approach also requires one to enable - * presentation-timestamp. - * - * - * Example pipelines - * |[ - * gst-launch v4l2src num-buffers=500 ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! qtmux ! filesink location=video.mov - * ]| - * Records a video stream captured from a v4l2 device and muxes it into a qt file. - * - * - * Last reviewed on 2010-12-03 - */ - -/* - * Based on avimux - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include -#include - -#include -#ifdef G_OS_WIN32 -#include /* lseek, open, close, read */ -#undef lseek -#define lseek _lseeki64 -#undef off_t -#define off_t guint64 -#endif - -#ifdef _MSC_VER -#define ftruncate g_win32_ftruncate -#endif - -#ifdef HAVE_UNISTD_H -# include -#endif - -#include "gstqtmux.h" - -GST_DEBUG_CATEGORY_STATIC (gst_qt_mux_debug); -#define GST_CAT_DEFAULT gst_qt_mux_debug - -enum -{ - DTS_METHOD_DD, - DTS_METHOD_REORDER, - DTS_METHOD_ASC -}; - -static GType -gst_qt_mux_dts_method_get_type (void) -{ - static GType gst_qt_mux_dts_method = 0; - - if (!gst_qt_mux_dts_method) { - static const GEnumValue dts_methods[] = { - {DTS_METHOD_DD, "delta/duration", "dd"}, - {DTS_METHOD_REORDER, "reorder", "reorder"}, - {DTS_METHOD_ASC, "ascending", "asc"}, - {0, NULL, NULL}, - }; - - gst_qt_mux_dts_method = - g_enum_register_static ("GstQTMuxDtsMethods", dts_methods); - } - - return gst_qt_mux_dts_method; -} - -#define GST_TYPE_QT_MUX_DTS_METHOD \ - (gst_qt_mux_dts_method_get_type ()) - -/* QTMux signals and args */ -enum -{ - /* FILL ME */ - LAST_SIGNAL -}; - -enum -{ - PROP_0, - PROP_MOVIE_TIMESCALE, - PROP_TRAK_TIMESCALE, - PROP_FAST_START, - PROP_FAST_START_TEMP_FILE, - PROP_MOOV_RECOV_FILE, - PROP_FRAGMENT_DURATION, - PROP_STREAMABLE, - PROP_DTS_METHOD, - PROP_DO_CTTS, -}; - -/* some spare for header size as well */ -#define MDAT_LARGE_FILE_LIMIT ((guint64) 1024 * 1024 * 1024 * 2) -#define MAX_TOLERATED_LATENESS (GST_SECOND / 10) - -#define DEFAULT_MOVIE_TIMESCALE 1000 -#define DEFAULT_TRAK_TIMESCALE 0 -#define DEFAULT_DO_CTTS FALSE -#define DEFAULT_FAST_START FALSE -#define DEFAULT_FAST_START_TEMP_FILE NULL -#define DEFAULT_MOOV_RECOV_FILE NULL -#define DEFAULT_FRAGMENT_DURATION 0 -#define DEFAULT_STREAMABLE FALSE -#define DEFAULT_DTS_METHOD DTS_METHOD_DD - - -static void gst_qt_mux_finalize (GObject * object); - -static GstStateChangeReturn gst_qt_mux_change_state (GstElement * element, - GstStateChange transition); - -/* property functions */ -static void gst_qt_mux_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec); -static void gst_qt_mux_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec); - -/* pad functions */ -static GstPad *gst_qt_mux_request_new_pad (GstElement * element, - GstPadTemplate * templ, const gchar * name); -static void gst_qt_mux_release_pad (GstElement * element, GstPad * pad); - -/* event */ -static gboolean gst_qt_mux_sink_event (GstPad * pad, GstEvent * event); - -static GstFlowReturn gst_qt_mux_collected (GstCollectPads * pads, - gpointer user_data); -static GstFlowReturn gst_qt_mux_add_buffer (GstQTMux * qtmux, GstQTPad * pad, - GstBuffer * buf); - -static GstElementClass *parent_class = NULL; - -static void -gst_qt_mux_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - GstQTMuxClass *klass = (GstQTMuxClass *) g_class; - GstQTMuxClassParams *params; - GstPadTemplate *videosinktempl, *audiosinktempl, *srctempl; - gchar *longname, *description; - - params = - (GstQTMuxClassParams *) g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class), - GST_QT_MUX_PARAMS_QDATA); - g_assert (params != NULL); - - /* construct the element details struct */ - longname = g_strdup_printf ("%s Muxer", params->prop->long_name); - description = g_strdup_printf ("Multiplex audio and video into a %s file", - params->prop->long_name); - gst_element_class_set_details_simple (element_class, longname, - "Codec/Muxer", description, - "Thiago Sousa Santos "); - g_free (longname); - g_free (description); - - /* pad templates */ - srctempl = gst_pad_template_new ("src", GST_PAD_SRC, - GST_PAD_ALWAYS, params->src_caps); - gst_element_class_add_pad_template (element_class, srctempl); - - if (params->audio_sink_caps) { - audiosinktempl = gst_pad_template_new ("audio_%d", - GST_PAD_SINK, GST_PAD_REQUEST, params->audio_sink_caps); - gst_element_class_add_pad_template (element_class, audiosinktempl); - } - - if (params->video_sink_caps) { - videosinktempl = gst_pad_template_new ("video_%d", - GST_PAD_SINK, GST_PAD_REQUEST, params->video_sink_caps); - gst_element_class_add_pad_template (element_class, videosinktempl); - } - - klass->format = params->prop->format; -} - -static void -gst_qt_mux_class_init (GstQTMuxClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - parent_class = g_type_class_peek_parent (klass); - - gobject_class->finalize = gst_qt_mux_finalize; - gobject_class->get_property = gst_qt_mux_get_property; - gobject_class->set_property = gst_qt_mux_set_property; - - g_object_class_install_property (gobject_class, PROP_MOVIE_TIMESCALE, - g_param_spec_uint ("movie-timescale", "Movie timescale", - "Timescale to use in the movie (units per second)", - 1, G_MAXUINT32, DEFAULT_MOVIE_TIMESCALE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, PROP_TRAK_TIMESCALE, - g_param_spec_uint ("trak-timescale", "Track timescale", - "Timescale to use for the tracks (units per second, 0 is automatic)", - 0, G_MAXUINT32, DEFAULT_TRAK_TIMESCALE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, PROP_DO_CTTS, - g_param_spec_boolean ("presentation-time", - "Include presentation-time info", - "Calculate and include presentation/composition time " - "(in addition to decoding time) (use with caution)", - DEFAULT_DO_CTTS, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, PROP_DTS_METHOD, - g_param_spec_enum ("dts-method", "dts-method", - "Method to determine DTS time", - GST_TYPE_QT_MUX_DTS_METHOD, DEFAULT_DTS_METHOD, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, PROP_FAST_START, - g_param_spec_boolean ("faststart", "Format file to faststart", - "If the file should be formated for faststart (headers first). ", - DEFAULT_FAST_START, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, PROP_FAST_START_TEMP_FILE, - g_param_spec_string ("faststart-file", "File to use for storing buffers", - "File that will be used temporarily to store data from the stream " - "when creating a faststart file. If null a filepath will be " - "created automatically", DEFAULT_FAST_START_TEMP_FILE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, PROP_MOOV_RECOV_FILE, - g_param_spec_string ("moov-recovery-file", - "File to store data for posterior moov atom recovery", - "File to be used to store " - "data for moov atom making movie file recovery possible in case " - "of a crash during muxing. Null for disabled. (Experimental)", - DEFAULT_MOOV_RECOV_FILE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, PROP_FRAGMENT_DURATION, - g_param_spec_uint ("fragment-duration", "Fragment duration", - "Fragment durations in ms (produce a fragmented file if > 0)", - 0, G_MAXUINT32, klass->format == GST_QT_MUX_FORMAT_ISML ? - 2000 : DEFAULT_FRAGMENT_DURATION, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, PROP_STREAMABLE, - g_param_spec_boolean ("streamable", "Streamable", - "If set to true, the output should be as if it is to be streamed " - "and hence no indexes written or duration written.", - DEFAULT_STREAMABLE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); - - gstelement_class->request_new_pad = - GST_DEBUG_FUNCPTR (gst_qt_mux_request_new_pad); - gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_qt_mux_change_state); - gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_qt_mux_release_pad); -} - -static void -gst_qt_mux_pad_reset (GstQTPad * qtpad) -{ - gint i; - - qtpad->fourcc = 0; - qtpad->is_out_of_order = FALSE; - qtpad->have_dts = FALSE; - qtpad->sample_size = 0; - qtpad->sync = FALSE; - qtpad->last_dts = 0; - qtpad->first_ts = GST_CLOCK_TIME_NONE; - qtpad->prepare_buf_func = NULL; - qtpad->avg_bitrate = 0; - qtpad->max_bitrate = 0; - qtpad->ts_n_entries = 0; - - qtpad->buf_head = 0; - qtpad->buf_tail = 0; - for (i = 0; i < G_N_ELEMENTS (qtpad->buf_entries); i++) { - if (qtpad->buf_entries[i]) { - gst_buffer_unref (qtpad->buf_entries[i]); - qtpad->buf_entries[i] = NULL; - } - } - - if (qtpad->last_buf) - gst_buffer_replace (&qtpad->last_buf, NULL); - - /* reference owned elsewhere */ - qtpad->trak = NULL; - - if (qtpad->traf) { - atom_traf_free (qtpad->traf); - qtpad->traf = NULL; - } - atom_array_clear (&qtpad->fragment_buffers); - - /* reference owned elsewhere */ - qtpad->tfra = NULL; -} - -/* - * Takes GstQTMux back to its initial state - */ -static void -gst_qt_mux_reset (GstQTMux * qtmux, gboolean alloc) -{ - GSList *walk; - - qtmux->state = GST_QT_MUX_STATE_NONE; - qtmux->header_size = 0; - qtmux->mdat_size = 0; - qtmux->mdat_pos = 0; - qtmux->longest_chunk = GST_CLOCK_TIME_NONE; - qtmux->video_pads = 0; - qtmux->audio_pads = 0; - qtmux->fragment_sequence = 0; - - if (qtmux->ftyp) { - atom_ftyp_free (qtmux->ftyp); - qtmux->ftyp = NULL; - } - if (qtmux->moov) { - atom_moov_free (qtmux->moov); - qtmux->moov = NULL; - } - if (qtmux->mfra) { - atom_mfra_free (qtmux->mfra); - qtmux->mfra = NULL; - } - if (qtmux->fast_start_file) { - fclose (qtmux->fast_start_file); - g_remove (qtmux->fast_start_file_path); - qtmux->fast_start_file = NULL; - } - if (qtmux->moov_recov_file) { - fclose (qtmux->moov_recov_file); - qtmux->moov_recov_file = NULL; - } - for (walk = qtmux->extra_atoms; walk; walk = g_slist_next (walk)) { - AtomInfo *ainfo = (AtomInfo *) walk->data; - ainfo->free_func (ainfo->atom); - g_free (ainfo); - } - g_slist_free (qtmux->extra_atoms); - qtmux->extra_atoms = NULL; - - GST_OBJECT_LOCK (qtmux); - gst_tag_setter_reset_tags (GST_TAG_SETTER (qtmux)); - GST_OBJECT_UNLOCK (qtmux); - - /* reset pad data */ - for (walk = qtmux->sinkpads; walk; walk = g_slist_next (walk)) { - GstQTPad *qtpad = (GstQTPad *) walk->data; - gst_qt_mux_pad_reset (qtpad); - - /* hm, moov_free above yanked the traks away from us, - * so do not free, but do clear */ - qtpad->trak = NULL; - } - - if (alloc) { - qtmux->moov = atom_moov_new (qtmux->context); - /* ensure all is as nice and fresh as request_new_pad would provide it */ - for (walk = qtmux->sinkpads; walk; walk = g_slist_next (walk)) { - GstQTPad *qtpad = (GstQTPad *) walk->data; - - qtpad->trak = atom_trak_new (qtmux->context); - atom_moov_add_trak (qtmux->moov, qtpad->trak); - } - } -} - -static void -gst_qt_mux_init (GstQTMux * qtmux, GstQTMuxClass * qtmux_klass) -{ - GstElementClass *klass = GST_ELEMENT_CLASS (qtmux_klass); - GstPadTemplate *templ; - - templ = gst_element_class_get_pad_template (klass, "src"); - qtmux->srcpad = gst_pad_new_from_template (templ, "src"); - gst_pad_use_fixed_caps (qtmux->srcpad); - gst_element_add_pad (GST_ELEMENT (qtmux), qtmux->srcpad); - - qtmux->sinkpads = NULL; - qtmux->collect = gst_collect_pads_new (); - gst_collect_pads_set_function (qtmux->collect, - (GstCollectPadsFunction) GST_DEBUG_FUNCPTR (gst_qt_mux_collected), qtmux); - - /* properties set to default upon construction */ - - /* always need this */ - qtmux->context = - atoms_context_new (gst_qt_mux_map_format_to_flavor (qtmux_klass->format)); - - /* internals to initial state */ - gst_qt_mux_reset (qtmux, TRUE); -} - - -static void -gst_qt_mux_finalize (GObject * object) -{ - GstQTMux *qtmux = GST_QT_MUX_CAST (object); - - gst_qt_mux_reset (qtmux, FALSE); - - g_free (qtmux->fast_start_file_path); - g_free (qtmux->moov_recov_file_path); - - atoms_context_free (qtmux->context); - gst_object_unref (qtmux->collect); - - g_slist_free (qtmux->sinkpads); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static GstBuffer * -gst_qt_mux_prepare_jpc_buffer (GstQTPad * qtpad, GstBuffer * buf, - GstQTMux * qtmux) -{ - GstBuffer *newbuf; - - GST_LOG_OBJECT (qtmux, "Preparing jpc buffer"); - - if (buf == NULL) - return NULL; - - newbuf = gst_buffer_new_and_alloc (GST_BUFFER_SIZE (buf) + 8); - gst_buffer_copy_metadata (newbuf, buf, GST_BUFFER_COPY_ALL); - - GST_WRITE_UINT32_BE (GST_BUFFER_DATA (newbuf), GST_BUFFER_SIZE (newbuf)); - GST_WRITE_UINT32_LE (GST_BUFFER_DATA (newbuf) + 4, FOURCC_jp2c); - - memcpy (GST_BUFFER_DATA (newbuf) + 8, GST_BUFFER_DATA (buf), - GST_BUFFER_SIZE (buf)); - gst_buffer_unref (buf); - - return newbuf; -} - -static void -gst_qt_mux_add_mp4_tag (GstQTMux * qtmux, const GstTagList * list, - const char *tag, const char *tag2, guint32 fourcc) -{ - switch (gst_tag_get_type (tag)) { - /* strings */ - case G_TYPE_STRING: - { - gchar *str = NULL; - - if (!gst_tag_list_get_string (list, tag, &str) || !str) - break; - GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %s", - GST_FOURCC_ARGS (fourcc), str); - atom_moov_add_str_tag (qtmux->moov, fourcc, str); - g_free (str); - break; - } - /* double */ - case G_TYPE_DOUBLE: - { - gdouble value; - - if (!gst_tag_list_get_double (list, tag, &value)) - break; - GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %u", - GST_FOURCC_ARGS (fourcc), (gint) value); - atom_moov_add_uint_tag (qtmux->moov, fourcc, 21, (gint) value); - break; - } - case G_TYPE_UINT: - { - guint value = 0; - if (tag2) { - /* paired unsigned integers */ - guint count = 0; - - if (!(gst_tag_list_get_uint (list, tag, &value) || - gst_tag_list_get_uint (list, tag2, &count))) - break; - GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %u/%u", - GST_FOURCC_ARGS (fourcc), value, count); - atom_moov_add_uint_tag (qtmux->moov, fourcc, 0, - value << 16 | (count & 0xFFFF)); - } else { - /* unpaired unsigned integers */ - if (!gst_tag_list_get_uint (list, tag, &value)) - break; - GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %u", - GST_FOURCC_ARGS (fourcc), value); - atom_moov_add_uint_tag (qtmux->moov, fourcc, 1, value); - } - break; - } - default: - g_assert_not_reached (); - break; - } -} - -static void -gst_qt_mux_add_mp4_date (GstQTMux * qtmux, const GstTagList * list, - const char *tag, const char *tag2, guint32 fourcc) -{ - GDate *date = NULL; - GDateYear year; - GDateMonth month; - GDateDay day; - gchar *str; - - g_return_if_fail (gst_tag_get_type (tag) == GST_TYPE_DATE); - - if (!gst_tag_list_get_date (list, tag, &date) || !date) - return; - - year = g_date_get_year (date); - month = g_date_get_month (date); - day = g_date_get_day (date); - - if (year == G_DATE_BAD_YEAR && month == G_DATE_BAD_MONTH && - day == G_DATE_BAD_DAY) { - GST_WARNING_OBJECT (qtmux, "invalid date in tag"); - return; - } - - str = g_strdup_printf ("%u-%u-%u", year, month, day); - GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %s", - GST_FOURCC_ARGS (fourcc), str); - atom_moov_add_str_tag (qtmux->moov, fourcc, str); - g_free (str); -} - -static void -gst_qt_mux_add_mp4_cover (GstQTMux * qtmux, const GstTagList * list, - const char *tag, const char *tag2, guint32 fourcc) -{ - GValue value = { 0, }; - GstBuffer *buf; - GstCaps *caps; - GstStructure *structure; - gint flags = 0; - - g_return_if_fail (gst_tag_get_type (tag) == GST_TYPE_BUFFER); - - if (!gst_tag_list_copy_value (&value, list, tag)) - return; - - buf = gst_value_get_buffer (&value); - if (!buf) - goto done; - - caps = gst_buffer_get_caps (buf); - if (!caps) { - GST_WARNING_OBJECT (qtmux, "preview image without caps"); - goto done; - } - - GST_DEBUG_OBJECT (qtmux, "preview image caps %" GST_PTR_FORMAT, caps); - - structure = gst_caps_get_structure (caps, 0); - if (gst_structure_has_name (structure, "image/jpeg")) - flags = 13; - else if (gst_structure_has_name (structure, "image/png")) - flags = 14; - gst_caps_unref (caps); - - if (!flags) { - GST_WARNING_OBJECT (qtmux, "preview image format not supported"); - goto done; - } - - GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT - " -> image size %d", GST_FOURCC_ARGS (fourcc), GST_BUFFER_SIZE (buf)); - atom_moov_add_tag (qtmux->moov, fourcc, flags, GST_BUFFER_DATA (buf), - GST_BUFFER_SIZE (buf)); -done: - g_value_unset (&value); -} - -static void -gst_qt_mux_add_3gp_str (GstQTMux * qtmux, const GstTagList * list, - const char *tag, const char *tag2, guint32 fourcc) -{ - gchar *str = NULL; - guint number; - - g_return_if_fail (gst_tag_get_type (tag) == G_TYPE_STRING); - g_return_if_fail (!tag2 || gst_tag_get_type (tag2) == G_TYPE_UINT); - - if (!gst_tag_list_get_string (list, tag, &str) || !str) - return; - - if (tag2) - if (!gst_tag_list_get_uint (list, tag2, &number)) - tag2 = NULL; - - if (!tag2) { - GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %s", - GST_FOURCC_ARGS (fourcc), str); - atom_moov_add_3gp_str_tag (qtmux->moov, fourcc, str); - } else { - GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %s/%d", - GST_FOURCC_ARGS (fourcc), str, number); - atom_moov_add_3gp_str_int_tag (qtmux->moov, fourcc, str, number); - } - - g_free (str); -} - -static void -gst_qt_mux_add_3gp_date (GstQTMux * qtmux, const GstTagList * list, - const char *tag, const char *tag2, guint32 fourcc) -{ - GDate *date = NULL; - GDateYear year; - - g_return_if_fail (gst_tag_get_type (tag) == GST_TYPE_DATE); - - if (!gst_tag_list_get_date (list, tag, &date) || !date) - return; - - year = g_date_get_year (date); - - if (year == G_DATE_BAD_YEAR) { - GST_WARNING_OBJECT (qtmux, "invalid date in tag"); - return; - } - - GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %d", - GST_FOURCC_ARGS (fourcc), year); - atom_moov_add_3gp_uint_tag (qtmux->moov, fourcc, year); -} - -static void -gst_qt_mux_add_3gp_location (GstQTMux * qtmux, const GstTagList * list, - const char *tag, const char *tag2, guint32 fourcc) -{ - gdouble latitude = -360, longitude = -360, altitude = 0; - gchar *location = NULL; - guint8 *data, *ddata; - gint size = 0, len = 0; - gboolean ret = FALSE; - - g_return_if_fail (strcmp (tag, GST_TAG_GEO_LOCATION_NAME) == 0); - - ret = gst_tag_list_get_string (list, tag, &location); - ret |= gst_tag_list_get_double (list, GST_TAG_GEO_LOCATION_LONGITUDE, - &longitude); - ret |= gst_tag_list_get_double (list, GST_TAG_GEO_LOCATION_LATITUDE, - &latitude); - ret |= gst_tag_list_get_double (list, GST_TAG_GEO_LOCATION_ELEVATION, - &altitude); - - if (!ret) - return; - - if (location) - len = strlen (location); - size += len + 1 + 2; - - /* role + (long, lat, alt) + body + notes */ - size += 1 + 3 * 4 + 1 + 1; - - data = ddata = g_malloc (size); - - /* language tag */ - GST_WRITE_UINT16_BE (data, language_code (GST_QT_MUX_DEFAULT_TAG_LANGUAGE)); - /* location */ - if (location) - memcpy (data + 2, location, len); - GST_WRITE_UINT8 (data + 2 + len, 0); - data += len + 1 + 2; - /* role */ - GST_WRITE_UINT8 (data, 0); - /* long, lat, alt */ - GST_WRITE_UINT32_BE (data + 1, (guint32) (longitude * 65536.0)); - GST_WRITE_UINT32_BE (data + 5, (guint32) (latitude * 65536.0)); - GST_WRITE_UINT32_BE (data + 9, (guint32) (altitude * 65536.0)); - /* neither astronomical body nor notes */ - GST_WRITE_UINT16_BE (data + 13, 0); - - GST_DEBUG_OBJECT (qtmux, "Adding tag 'loci'"); - atom_moov_add_3gp_tag (qtmux->moov, fourcc, ddata, size); - g_free (ddata); -} - -static void -gst_qt_mux_add_3gp_keywords (GstQTMux * qtmux, const GstTagList * list, - const char *tag, const char *tag2, guint32 fourcc) -{ - gchar *keywords = NULL; - guint8 *data, *ddata; - gint size = 0, i; - gchar **kwds; - - g_return_if_fail (strcmp (tag, GST_TAG_KEYWORDS) == 0); - - if (!gst_tag_list_get_string (list, tag, &keywords) || !keywords) - return; - - kwds = g_strsplit (keywords, ",", 0); - g_free (keywords); - - size = 0; - for (i = 0; kwds[i]; i++) { - /* size byte + null-terminator */ - size += strlen (kwds[i]) + 1 + 1; - } - - /* language tag + count + keywords */ - size += 2 + 1; - - data = ddata = g_malloc (size); - - /* language tag */ - GST_WRITE_UINT16_BE (data, language_code (GST_QT_MUX_DEFAULT_TAG_LANGUAGE)); - /* count */ - GST_WRITE_UINT8 (data + 2, i); - data += 3; - /* keywords */ - for (i = 0; kwds[i]; ++i) { - gint len = strlen (kwds[i]); - - GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %s", - GST_FOURCC_ARGS (fourcc), kwds[i]); - /* size */ - GST_WRITE_UINT8 (data, len + 1); - memcpy (data + 1, kwds[i], len + 1); - data += len + 2; - } - - g_strfreev (kwds); - - atom_moov_add_3gp_tag (qtmux->moov, fourcc, ddata, size); - g_free (ddata); -} - -static gboolean -gst_qt_mux_parse_classification_string (GstQTMux * qtmux, const gchar * input, - guint32 * p_fourcc, guint16 * p_table, gchar ** p_content) -{ - guint32 fourcc; - gint table; - gint size; - const gchar *data; - - data = input; - size = strlen (input); - - if (size < 4 + 3 + 1 + 1 + 1) { - /* at least the minimum xxxx://y/z */ - GST_WARNING_OBJECT (qtmux, "Classification tag input (%s) too short, " - "ignoring", input); - return FALSE; - } - - /* read the fourcc */ - memcpy (&fourcc, data, 4); - size -= 4; - data += 4; - - if (strncmp (data, "://", 3) != 0) { - goto mismatch; - } - data += 3; - size -= 3; - - /* read the table number */ - if (sscanf (data, "%d", &table) != 1) { - goto mismatch; - } - if (table < 0) { - GST_WARNING_OBJECT (qtmux, "Invalid table number in classification tag (%d)" - ", table numbers should be positive, ignoring tag", table); - return FALSE; - } - - /* find the next / */ - while (size > 0 && data[0] != '/') { - data += 1; - size -= 1; - } - if (size == 0) { - goto mismatch; - } - g_assert (data[0] == '/'); - - /* skip the '/' */ - data += 1; - size -= 1; - if (size == 0) { - goto mismatch; - } - - /* read up the rest of the string */ - *p_content = g_strdup (data); - *p_table = (guint16) table; - *p_fourcc = fourcc; - return TRUE; - -mismatch: - { - GST_WARNING_OBJECT (qtmux, "Ignoring classification tag as " - "input (%s) didn't match the expected entitycode://table/content", - input); - return FALSE; - } -} - -static void -gst_qt_mux_add_3gp_classification (GstQTMux * qtmux, const GstTagList * list, - const char *tag, const char *tag2, guint32 fourcc) -{ - gchar *clsf_data = NULL; - gint size = 0; - guint32 entity = 0; - guint16 table = 0; - gchar *content = NULL; - guint8 *data; - - g_return_if_fail (strcmp (tag, GST_TAG_3GP_CLASSIFICATION) == 0); - - if (!gst_tag_list_get_string (list, tag, &clsf_data) || !clsf_data) - return; - - GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %s", - GST_FOURCC_ARGS (fourcc), clsf_data); - - /* parse the string, format is: - * entityfourcc://table/content - */ - gst_qt_mux_parse_classification_string (qtmux, clsf_data, &entity, &table, - &content); - g_free (clsf_data); - /* +1 for the \0 */ - size = strlen (content) + 1; - - /* now we have everything, build the atom - * atom description is at 3GPP TS 26.244 V8.2.0 (2009-09) */ - data = g_malloc (4 + 2 + 2 + size); - GST_WRITE_UINT32_LE (data, entity); - GST_WRITE_UINT16_BE (data + 4, (guint16) table); - GST_WRITE_UINT16_BE (data + 6, 0); - memcpy (data + 8, content, size); - g_free (content); - - atom_moov_add_3gp_tag (qtmux->moov, fourcc, data, 4 + 2 + 2 + size); - g_free (data); -} - -typedef void (*GstQTMuxAddTagFunc) (GstQTMux * mux, const GstTagList * list, - const char *tag, const char *tag2, guint32 fourcc); - -/* - * Struct to record mappings from gstreamer tags to fourcc codes - */ -typedef struct _GstTagToFourcc -{ - guint32 fourcc; - const gchar *gsttag; - const gchar *gsttag2; - const GstQTMuxAddTagFunc func; -} GstTagToFourcc; - -/* tag list tags to fourcc matching */ -static const GstTagToFourcc tag_matches_mp4[] = { - {FOURCC__alb, GST_TAG_ALBUM, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC_soal, GST_TAG_ALBUM_SORTNAME, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC__ART, GST_TAG_ARTIST, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC_soar, GST_TAG_ARTIST_SORTNAME, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC_aART, GST_TAG_ALBUM_ARTIST, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC_soaa, GST_TAG_ALBUM_ARTIST_SORTNAME, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC__cmt, GST_TAG_COMMENT, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC__wrt, GST_TAG_COMPOSER, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC_soco, GST_TAG_COMPOSER_SORTNAME, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC_tvsh, GST_TAG_SHOW_NAME, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC_sosn, GST_TAG_SHOW_SORTNAME, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC_tvsn, GST_TAG_SHOW_SEASON_NUMBER, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC_tves, GST_TAG_SHOW_EPISODE_NUMBER, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC__gen, GST_TAG_GENRE, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC__nam, GST_TAG_TITLE, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC_sonm, GST_TAG_TITLE_SORTNAME, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC_perf, GST_TAG_PERFORMER, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC__grp, GST_TAG_GROUPING, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC__des, GST_TAG_DESCRIPTION, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC__lyr, GST_TAG_LYRICS, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC__too, GST_TAG_ENCODER, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC_cprt, GST_TAG_COPYRIGHT, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC_keyw, GST_TAG_KEYWORDS, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC__day, GST_TAG_DATE, NULL, gst_qt_mux_add_mp4_date}, - {FOURCC_tmpo, GST_TAG_BEATS_PER_MINUTE, NULL, gst_qt_mux_add_mp4_tag}, - {FOURCC_trkn, GST_TAG_TRACK_NUMBER, GST_TAG_TRACK_COUNT, - gst_qt_mux_add_mp4_tag}, - {FOURCC_disk, GST_TAG_ALBUM_VOLUME_NUMBER, GST_TAG_ALBUM_VOLUME_COUNT, - gst_qt_mux_add_mp4_tag}, - {FOURCC_covr, GST_TAG_PREVIEW_IMAGE, NULL, gst_qt_mux_add_mp4_cover}, - {0, NULL,} -}; - -static const GstTagToFourcc tag_matches_3gp[] = { - {FOURCC_titl, GST_TAG_TITLE, NULL, gst_qt_mux_add_3gp_str}, - {FOURCC_dscp, GST_TAG_DESCRIPTION, NULL, gst_qt_mux_add_3gp_str}, - {FOURCC_cprt, GST_TAG_COPYRIGHT, NULL, gst_qt_mux_add_3gp_str}, - {FOURCC_perf, GST_TAG_ARTIST, NULL, gst_qt_mux_add_3gp_str}, - {FOURCC_auth, GST_TAG_COMPOSER, NULL, gst_qt_mux_add_3gp_str}, - {FOURCC_gnre, GST_TAG_GENRE, NULL, gst_qt_mux_add_3gp_str}, - {FOURCC_kywd, GST_TAG_KEYWORDS, NULL, gst_qt_mux_add_3gp_keywords}, - {FOURCC_yrrc, GST_TAG_DATE, NULL, gst_qt_mux_add_3gp_date}, - {FOURCC_albm, GST_TAG_ALBUM, GST_TAG_TRACK_NUMBER, gst_qt_mux_add_3gp_str}, - {FOURCC_loci, GST_TAG_GEO_LOCATION_NAME, NULL, gst_qt_mux_add_3gp_location}, - {FOURCC_clsf, GST_TAG_3GP_CLASSIFICATION, NULL, - gst_qt_mux_add_3gp_classification}, - {0, NULL,} -}; - -/* qtdemux produces these for atoms it cannot parse */ -#define GST_QT_DEMUX_PRIVATE_TAG "private-qt-tag" - -static void -gst_qt_mux_add_xmp_tags (GstQTMux * qtmux, const GstTagList * list) -{ - GstQTMuxClass *qtmux_klass = (GstQTMuxClass *) (G_OBJECT_GET_CLASS (qtmux)); - - /* adobe specs only have 'quicktime' and 'mp4', - * but I guess we can extrapolate to gpp. - * Keep mj2 out for now as we don't add any tags for it yet. - * If you have further info about xmp on these formats, please share */ - if (qtmux_klass->format == GST_QT_MUX_FORMAT_MJ2) - return; - - GST_DEBUG_OBJECT (qtmux, "Adding xmp tags"); - - if (qtmux_klass->format == GST_QT_MUX_FORMAT_QT) { - atom_moov_add_xmp_tags (qtmux->moov, list); - } else { - /* for isom/mp4, it is a top level uuid atom */ - AtomInfo *ainfo = build_uuid_xmp_atom (list); - if (ainfo) { - qtmux->extra_atoms = g_slist_prepend (qtmux->extra_atoms, ainfo); - } - } -} - -static void -gst_qt_mux_add_metadata_tags (GstQTMux * qtmux, const GstTagList * list) -{ - GstQTMuxClass *qtmux_klass = (GstQTMuxClass *) (G_OBJECT_GET_CLASS (qtmux)); - guint32 fourcc; - gint i; - const gchar *tag, *tag2; - const GstTagToFourcc *tag_matches; - - switch (qtmux_klass->format) { - case GST_QT_MUX_FORMAT_3GP: - tag_matches = tag_matches_3gp; - break; - case GST_QT_MUX_FORMAT_MJ2: - tag_matches = NULL; - break; - default: - /* sort of iTunes style for mp4 and QT (?) */ - tag_matches = tag_matches_mp4; - break; - } - - if (!tag_matches) - return; - - for (i = 0; tag_matches[i].fourcc; i++) { - fourcc = tag_matches[i].fourcc; - tag = tag_matches[i].gsttag; - tag2 = tag_matches[i].gsttag2; - - g_assert (tag_matches[i].func); - tag_matches[i].func (qtmux, list, tag, tag2, fourcc); - } - - /* add unparsed blobs if present */ - if (gst_tag_exists (GST_QT_DEMUX_PRIVATE_TAG)) { - guint num_tags; - - num_tags = gst_tag_list_get_tag_size (list, GST_QT_DEMUX_PRIVATE_TAG); - for (i = 0; i < num_tags; ++i) { - const GValue *val; - GstBuffer *buf; - GstCaps *caps = NULL; - - val = gst_tag_list_get_value_index (list, GST_QT_DEMUX_PRIVATE_TAG, i); - buf = gst_value_get_buffer (val); - - if (buf && (caps = gst_buffer_get_caps (buf))) { - GstStructure *s; - const gchar *style = NULL; - - GST_DEBUG_OBJECT (qtmux, "Found private tag %d/%d; size %d, caps %" - GST_PTR_FORMAT, i, num_tags, GST_BUFFER_SIZE (buf), caps); - s = gst_caps_get_structure (caps, 0); - if (s && (style = gst_structure_get_string (s, "style"))) { - /* try to prevent some style tag ending up into another variant - * (todo: make into a list if more cases) */ - if ((strcmp (style, "itunes") == 0 && - qtmux_klass->format == GST_QT_MUX_FORMAT_MP4) || - (strcmp (style, "iso") == 0 && - qtmux_klass->format == GST_QT_MUX_FORMAT_3GP)) { - GST_DEBUG_OBJECT (qtmux, "Adding private tag"); - atom_moov_add_blob_tag (qtmux->moov, GST_BUFFER_DATA (buf), - GST_BUFFER_SIZE (buf)); - } - } - gst_caps_unref (caps); - } - } - } - - return; -} - -/* - * Gets the tagsetter iface taglist and puts the known tags - * into the output stream - */ -static void -gst_qt_mux_setup_metadata (GstQTMux * qtmux) -{ - const GstTagList *tags; - - GST_OBJECT_LOCK (qtmux); - tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (qtmux)); - GST_OBJECT_UNLOCK (qtmux); - - GST_LOG_OBJECT (qtmux, "tags: %" GST_PTR_FORMAT, tags); - - if (tags && !gst_tag_list_is_empty (tags)) { - GstTagList *copy = gst_tag_list_copy (tags); - - GST_DEBUG_OBJECT (qtmux, "Removing bogus tags"); - gst_tag_list_remove_tag (copy, GST_TAG_VIDEO_CODEC); - gst_tag_list_remove_tag (copy, GST_TAG_AUDIO_CODEC); - gst_tag_list_remove_tag (copy, GST_TAG_CONTAINER_FORMAT); - - GST_DEBUG_OBJECT (qtmux, "Formatting tags"); - gst_qt_mux_add_metadata_tags (qtmux, copy); - gst_qt_mux_add_xmp_tags (qtmux, copy); - gst_tag_list_free (copy); - } else { - GST_DEBUG_OBJECT (qtmux, "No tags received"); - } -} - -static inline GstBuffer * -_gst_buffer_new_take_data (guint8 * data, guint size) -{ - GstBuffer *buf; - - buf = gst_buffer_new (); - GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data; - GST_BUFFER_SIZE (buf) = size; - - return buf; -} - -static GstFlowReturn -gst_qt_mux_send_buffer (GstQTMux * qtmux, GstBuffer * buf, guint64 * offset, - gboolean mind_fast) -{ - GstFlowReturn res; - guint8 *data; - guint size; - - g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR); - - data = GST_BUFFER_DATA (buf); - size = GST_BUFFER_SIZE (buf); - - GST_LOG_OBJECT (qtmux, "sending buffer size %d", size); - - if (mind_fast && qtmux->fast_start_file) { - gint ret; - - GST_LOG_OBJECT (qtmux, "to temporary file"); - ret = fwrite (data, sizeof (guint8), size, qtmux->fast_start_file); - gst_buffer_unref (buf); - if (ret != size) - goto write_error; - else - res = GST_FLOW_OK; - } else { - GST_LOG_OBJECT (qtmux, "downstream"); - - buf = gst_buffer_make_metadata_writable (buf); - gst_buffer_set_caps (buf, GST_PAD_CAPS (qtmux->srcpad)); - res = gst_pad_push (qtmux->srcpad, buf); - } - - if (G_LIKELY (offset)) - *offset += size; - - return res; - - /* ERRORS */ -write_error: - { - GST_ELEMENT_ERROR (qtmux, RESOURCE, WRITE, - ("Failed to write to temporary file"), GST_ERROR_SYSTEM); - return GST_FLOW_ERROR; - } -} - -static gboolean -gst_qt_mux_seek_to_beginning (FILE * f) -{ -#ifdef HAVE_FSEEKO - if (fseeko (f, (off_t) 0, SEEK_SET) != 0) - return FALSE; -#elif defined (G_OS_UNIX) || defined (G_OS_WIN32) - if (lseek (fileno (f), (off_t) 0, SEEK_SET) == (off_t) - 1) - return FALSE; -#else - if (fseek (f, (long) 0, SEEK_SET) != 0) - return FALSE; -#endif - return TRUE; -} - -static GstFlowReturn -gst_qt_mux_send_buffered_data (GstQTMux * qtmux, guint64 * offset) -{ - GstFlowReturn ret = GST_FLOW_OK; - GstBuffer *buf = NULL; - - if (fflush (qtmux->fast_start_file)) - goto flush_failed; - - if (!gst_qt_mux_seek_to_beginning (qtmux->fast_start_file)) - goto seek_failed; - - /* hm, this could all take a really really long time, - * but there may not be another way to get moov atom first - * (somehow optimize copy?) */ - GST_DEBUG_OBJECT (qtmux, "Sending buffered data"); - while (ret == GST_FLOW_OK) { - gint r; - const int bufsize = 4096; - - buf = gst_buffer_new_and_alloc (bufsize); - r = fread (GST_BUFFER_DATA (buf), sizeof (guint8), bufsize, - qtmux->fast_start_file); - if (r == 0) - break; - GST_BUFFER_SIZE (buf) = r; - GST_LOG_OBJECT (qtmux, "Pushing buffered buffer of size %d", r); - ret = gst_qt_mux_send_buffer (qtmux, buf, offset, FALSE); - buf = NULL; - } - if (buf) - gst_buffer_unref (buf); - - if (ftruncate (fileno (qtmux->fast_start_file), 0)) - goto seek_failed; - if (!gst_qt_mux_seek_to_beginning (qtmux->fast_start_file)) - goto seek_failed; - - return ret; - - /* ERRORS */ -flush_failed: - { - GST_ELEMENT_ERROR (qtmux, RESOURCE, WRITE, - ("Failed to flush temporary file"), GST_ERROR_SYSTEM); - ret = GST_FLOW_ERROR; - goto fail; - } -seek_failed: - { - GST_ELEMENT_ERROR (qtmux, RESOURCE, SEEK, - ("Failed to seek temporary file"), GST_ERROR_SYSTEM); - ret = GST_FLOW_ERROR; - goto fail; - } -fail: - { - /* clear descriptor so we don't remove temp file later on, - * might be possible to recover */ - fclose (qtmux->fast_start_file); - qtmux->fast_start_file = NULL; - return ret; - } -} - -/* - * Sends the initial mdat atom fields (size fields and fourcc type), - * the subsequent buffers are considered part of it's data. - * As we can't predict the amount of data that we are going to place in mdat - * we need to record the position of the size field in the stream so we can - * seek back to it later and update when the streams have finished. - */ -static GstFlowReturn -gst_qt_mux_send_mdat_header (GstQTMux * qtmux, guint64 * off, guint64 size, - gboolean extended) -{ - Atom *node_header; - GstBuffer *buf; - guint8 *data = NULL; - guint64 offset = 0; - - GST_DEBUG_OBJECT (qtmux, "Sending mdat's atom header, " - "size %" G_GUINT64_FORMAT, size); - - node_header = g_malloc0 (sizeof (Atom)); - node_header->type = FOURCC_mdat; - if (extended) { - /* use extended size */ - node_header->size = 1; - node_header->extended_size = 0; - if (size) - node_header->extended_size = size + 16; - } else { - node_header->size = size + 8; - } - - size = offset = 0; - if (atom_copy_data (node_header, &data, &size, &offset) == 0) - goto serialize_error; - - buf = _gst_buffer_new_take_data (data, offset); - g_free (node_header); - - GST_LOG_OBJECT (qtmux, "Pushing mdat start"); - return gst_qt_mux_send_buffer (qtmux, buf, off, FALSE); - - /* ERRORS */ -serialize_error: - { - GST_ELEMENT_ERROR (qtmux, STREAM, MUX, (NULL), - ("Failed to serialize mdat")); - return GST_FLOW_ERROR; - } -} - -/* - * We get the position of the mdat size field, seek back to it - * and overwrite with the real value - */ -static GstFlowReturn -gst_qt_mux_update_mdat_size (GstQTMux * qtmux, guint64 mdat_pos, - guint64 mdat_size, guint64 * offset) -{ - GstEvent *event; - GstBuffer *buf; - gboolean large_file; - - large_file = (mdat_size > MDAT_LARGE_FILE_LIMIT); - - if (large_file) - mdat_pos += 8; - - /* seek and rewrite the header */ - event = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_BYTES, - mdat_pos, GST_CLOCK_TIME_NONE, 0); - gst_pad_push_event (qtmux->srcpad, event); - - if (large_file) { - buf = gst_buffer_new_and_alloc (sizeof (guint64)); - GST_WRITE_UINT64_BE (GST_BUFFER_DATA (buf), mdat_size + 16); - } else { - guint8 *data; - - buf = gst_buffer_new_and_alloc (16); - data = GST_BUFFER_DATA (buf); - GST_WRITE_UINT32_BE (data, 8); - GST_WRITE_UINT32_LE (data + 4, FOURCC_free); - GST_WRITE_UINT32_BE (data + 8, mdat_size + 8); - GST_WRITE_UINT32_LE (data + 12, FOURCC_mdat); - } - - return gst_qt_mux_send_buffer (qtmux, buf, offset, FALSE); -} - -static GstFlowReturn -gst_qt_mux_send_ftyp (GstQTMux * qtmux, guint64 * off) -{ - GstBuffer *buf; - guint64 size = 0, offset = 0; - guint8 *data = NULL; - - GST_DEBUG_OBJECT (qtmux, "Sending ftyp atom"); - - if (!atom_ftyp_copy_data (qtmux->ftyp, &data, &size, &offset)) - goto serialize_error; - - buf = _gst_buffer_new_take_data (data, offset); - - GST_LOG_OBJECT (qtmux, "Pushing ftyp"); - return gst_qt_mux_send_buffer (qtmux, buf, off, FALSE); - - /* ERRORS */ -serialize_error: - { - GST_ELEMENT_ERROR (qtmux, STREAM, MUX, (NULL), - ("Failed to serialize ftyp")); - return GST_FLOW_ERROR; - } -} - -static void -gst_qt_mux_prepare_ftyp (GstQTMux * qtmux, AtomFTYP ** p_ftyp, - GstBuffer ** p_prefix) -{ - GstQTMuxClass *qtmux_klass = (GstQTMuxClass *) (G_OBJECT_GET_CLASS (qtmux)); - guint32 major, version; - GList *comp; - GstBuffer *prefix = NULL; - AtomFTYP *ftyp = NULL; - - GST_DEBUG_OBJECT (qtmux, "Preparing ftyp and possible prefix atom"); - - /* init and send context and ftyp based on current property state */ - gst_qt_mux_map_format_to_header (qtmux_klass->format, &prefix, &major, - &version, &comp, qtmux->moov, qtmux->longest_chunk, - qtmux->fast_start_file != NULL); - ftyp = atom_ftyp_new (qtmux->context, major, version, comp); - if (comp) - g_list_free (comp); - if (prefix) { - if (p_prefix) - *p_prefix = prefix; - else - gst_buffer_unref (prefix); - } - *p_ftyp = ftyp; -} - -static GstFlowReturn -gst_qt_mux_prepare_and_send_ftyp (GstQTMux * qtmux) -{ - GstFlowReturn ret = GST_FLOW_OK; - GstBuffer *prefix = NULL; - - GST_DEBUG_OBJECT (qtmux, "Preparing to send ftyp atom"); - - /* init and send context and ftyp based on current property state */ - if (qtmux->ftyp) { - atom_ftyp_free (qtmux->ftyp); - qtmux->ftyp = NULL; - } - gst_qt_mux_prepare_ftyp (qtmux, &qtmux->ftyp, &prefix); - if (prefix) { - ret = gst_qt_mux_send_buffer (qtmux, prefix, &qtmux->header_size, FALSE); - if (ret != GST_FLOW_OK) - return ret; - } - return gst_qt_mux_send_ftyp (qtmux, &qtmux->header_size); -} - -static void -gst_qt_mux_set_header_on_caps (GstQTMux * mux, GstBuffer * buf) -{ - GstStructure *structure; - GValue array = { 0 }; - GValue value = { 0 }; - GstCaps *caps = GST_PAD_CAPS (mux->srcpad); - - caps = gst_caps_copy (GST_PAD_CAPS (mux->srcpad)); - structure = gst_caps_get_structure (caps, 0); - - g_value_init (&array, GST_TYPE_ARRAY); - - GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_IN_CAPS); - g_value_init (&value, GST_TYPE_BUFFER); - gst_value_take_buffer (&value, gst_buffer_ref (buf)); - gst_value_array_append_value (&array, &value); - g_value_unset (&value); - - gst_structure_set_value (structure, "streamheader", &array); - g_value_unset (&array); - gst_pad_set_caps (mux->srcpad, caps); - gst_caps_unref (caps); -} - -static void -gst_qt_mux_configure_moov (GstQTMux * qtmux, guint32 * _timescale) -{ - gboolean fragmented; - guint32 timescale; - - GST_OBJECT_LOCK (qtmux); - timescale = qtmux->timescale; - fragmented = qtmux->fragment_sequence > 0; - GST_OBJECT_UNLOCK (qtmux); - - /* inform lower layers of our property wishes, and determine duration. - * Let moov take care of this using its list of traks; - * so that released pads are also included */ - GST_DEBUG_OBJECT (qtmux, "Updating timescale to %" G_GUINT32_FORMAT, - timescale); - atom_moov_update_timescale (qtmux->moov, timescale); - atom_moov_set_fragmented (qtmux->moov, fragmented); - - atom_moov_update_duration (qtmux->moov); - - if (_timescale) - *_timescale = timescale; -} - -static GstFlowReturn -gst_qt_mux_send_moov (GstQTMux * qtmux, guint64 * _offset, gboolean mind_fast) -{ - guint64 offset = 0, size = 0; - guint8 *data; - GstBuffer *buf; - GstFlowReturn ret = GST_FLOW_OK; - - /* serialize moov */ - offset = size = 0; - data = NULL; - GST_LOG_OBJECT (qtmux, "Copying movie header into buffer"); - if (!atom_moov_copy_data (qtmux->moov, &data, &size, &offset)) - goto serialize_error; - - buf = _gst_buffer_new_take_data (data, offset); - GST_DEBUG_OBJECT (qtmux, "Pushing moov atoms"); - gst_qt_mux_set_header_on_caps (qtmux, buf); - ret = gst_qt_mux_send_buffer (qtmux, buf, _offset, mind_fast); - - return ret; - -serialize_error: - { - g_free (data); - return GST_FLOW_ERROR; - } -} - -/* either calculates size of extra atoms or pushes them */ -static GstFlowReturn -gst_qt_mux_send_extra_atoms (GstQTMux * qtmux, gboolean send, guint64 * offset, - gboolean mind_fast) -{ - GSList *walk; - guint64 loffset = 0, size = 0; - guint8 *data; - GstFlowReturn ret = GST_FLOW_OK; - - for (walk = qtmux->extra_atoms; walk; walk = g_slist_next (walk)) { - AtomInfo *ainfo = (AtomInfo *) walk->data; - - loffset = size = 0; - data = NULL; - if (!ainfo->copy_data_func (ainfo->atom, - send ? &data : NULL, &size, &loffset)) - goto serialize_error; - - if (send) { - GstBuffer *buf; - - GST_DEBUG_OBJECT (qtmux, - "Pushing extra top-level atom %" GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (ainfo->atom->type)); - buf = _gst_buffer_new_take_data (data, loffset); - ret = gst_qt_mux_send_buffer (qtmux, buf, offset, FALSE); - if (ret != GST_FLOW_OK) - break; - } else { - if (offset) - *offset += loffset; - } - } - - return ret; - -serialize_error: - { - g_free (data); - return GST_FLOW_ERROR; - } -} - -static GstFlowReturn -gst_qt_mux_start_file (GstQTMux * qtmux) -{ - GstFlowReturn ret = GST_FLOW_OK; - GstCaps *caps; - - GST_DEBUG_OBJECT (qtmux, "starting file"); - - caps = gst_caps_copy (gst_pad_get_pad_template_caps (qtmux->srcpad)); - gst_pad_set_caps (qtmux->srcpad, caps); - gst_caps_unref (caps); - - /* let downstream know we think in BYTES and expect to do seeking later on */ - gst_pad_push_event (qtmux->srcpad, - gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_BYTES, 0, -1, 0)); - - /* initialize our moov recovery file */ - GST_OBJECT_LOCK (qtmux); - if (qtmux->moov_recov_file_path) { - GST_DEBUG_OBJECT (qtmux, "Openning moov recovery file: %s", - qtmux->moov_recov_file_path); - qtmux->moov_recov_file = g_fopen (qtmux->moov_recov_file_path, "wb+"); - if (qtmux->moov_recov_file == NULL) { - GST_WARNING_OBJECT (qtmux, "Failed to open moov recovery file in %s", - qtmux->moov_recov_file_path); - } else { - GSList *walk; - gboolean fail = FALSE; - AtomFTYP *ftyp = NULL; - GstBuffer *prefix = NULL; - - gst_qt_mux_prepare_ftyp (qtmux, &ftyp, &prefix); - - if (!atoms_recov_write_headers (qtmux->moov_recov_file, ftyp, prefix, - qtmux->moov, qtmux->timescale, - g_slist_length (qtmux->sinkpads))) { - GST_WARNING_OBJECT (qtmux, "Failed to write moov recovery file " - "headers"); - fail = TRUE; - } - - atom_ftyp_free (ftyp); - if (prefix) - gst_buffer_unref (prefix); - - for (walk = qtmux->sinkpads; walk && !fail; walk = g_slist_next (walk)) { - GstCollectData *cdata = (GstCollectData *) walk->data; - GstQTPad *qpad = (GstQTPad *) cdata; - /* write info for each stream */ - fail = atoms_recov_write_trak_info (qtmux->moov_recov_file, qpad->trak); - if (fail) { - GST_WARNING_OBJECT (qtmux, "Failed to write trak info to recovery " - "file"); - } - } - if (fail) { - /* cleanup */ - fclose (qtmux->moov_recov_file); - qtmux->moov_recov_file = NULL; - GST_WARNING_OBJECT (qtmux, "An error was detected while writing to " - "recover file, moov recovery won't work"); - } - } - } - GST_OBJECT_UNLOCK (qtmux); - - /* - * send mdat header if already needed, and mark position for later update. - * We don't send ftyp now if we are on fast start mode, because we can - * better fine tune using the information we gather to create the whole moov - * atom. - */ - if (qtmux->fast_start) { - GST_OBJECT_LOCK (qtmux); - qtmux->fast_start_file = g_fopen (qtmux->fast_start_file_path, "wb+"); - if (!qtmux->fast_start_file) - goto open_failed; - GST_OBJECT_UNLOCK (qtmux); - - /* send a dummy buffer for preroll */ - ret = gst_qt_mux_send_buffer (qtmux, gst_buffer_new (), NULL, FALSE); - if (ret != GST_FLOW_OK) - goto exit; - - } else { - ret = gst_qt_mux_prepare_and_send_ftyp (qtmux); - if (ret != GST_FLOW_OK) { - goto exit; - } - - /* well, it's moov pos if fragmented ... */ - qtmux->mdat_pos = qtmux->header_size; - - if (qtmux->fragment_duration) { - GST_DEBUG_OBJECT (qtmux, "fragment duration %d ms, writing headers", - qtmux->fragment_duration); - /* also used as snapshot marker to indicate fragmented file */ - qtmux->fragment_sequence = 1; - /* prepare moov and/or tags */ - gst_qt_mux_configure_moov (qtmux, NULL); - gst_qt_mux_setup_metadata (qtmux); - ret = gst_qt_mux_send_moov (qtmux, &qtmux->header_size, FALSE); - if (ret != GST_FLOW_OK) - return ret; - /* extra atoms */ - ret = - gst_qt_mux_send_extra_atoms (qtmux, TRUE, &qtmux->header_size, FALSE); - if (ret != GST_FLOW_OK) - return ret; - /* prepare index */ - if (!qtmux->streamable) - qtmux->mfra = atom_mfra_new (qtmux->context); - } else { - /* extended to ensure some spare space */ - ret = gst_qt_mux_send_mdat_header (qtmux, &qtmux->header_size, 0, TRUE); - } - } - -exit: - return ret; - - /* ERRORS */ -open_failed: - { - GST_ELEMENT_ERROR (qtmux, RESOURCE, OPEN_READ_WRITE, - (("Could not open temporary file \"%s\""), qtmux->fast_start_file_path), - GST_ERROR_SYSTEM); - GST_OBJECT_UNLOCK (qtmux); - return GST_FLOW_ERROR; - } -} - -static GstFlowReturn -gst_qt_mux_stop_file (GstQTMux * qtmux) -{ - gboolean ret = GST_FLOW_OK; - guint64 offset = 0, size = 0; - GSList *walk; - gboolean large_file; - guint32 timescale; - GstClockTime first_ts = GST_CLOCK_TIME_NONE; - - GST_DEBUG_OBJECT (qtmux, "Updating remaining values and sending last data"); - - /* pushing last buffers for each pad */ - for (walk = qtmux->collect->data; walk; walk = g_slist_next (walk)) { - GstCollectData *cdata = (GstCollectData *) walk->data; - GstQTPad *qtpad = (GstQTPad *) cdata; - - if (!qtpad->last_buf) { - GST_DEBUG_OBJECT (qtmux, "Pad %s has no buffers", - GST_PAD_NAME (qtpad->collect.pad)); - continue; - } - /* send last buffer */ - GST_DEBUG_OBJECT (qtmux, "Sending the last buffer for pad %s", - GST_PAD_NAME (qtpad->collect.pad)); - ret = gst_qt_mux_add_buffer (qtmux, qtpad, NULL); - if (ret != GST_FLOW_OK) - GST_WARNING_OBJECT (qtmux, "Failed to send last buffer for %s, " - "flow return: %s", GST_PAD_NAME (qtpad->collect.pad), - gst_flow_get_name (ret)); - /* determine max stream duration */ - if (!GST_CLOCK_TIME_IS_VALID (first_ts) || - (GST_CLOCK_TIME_IS_VALID (qtpad->first_ts) && - qtpad->last_dts > first_ts)) { - first_ts = qtpad->last_dts; - } - } - - if (qtmux->fragment_sequence) { - GstEvent *event; - - if (qtmux->mfra) { - guint8 *data = NULL; - GstBuffer *buf; - - size = offset = 0; - GST_DEBUG_OBJECT (qtmux, "adding mfra"); - if (!atom_mfra_copy_data (qtmux->mfra, &data, &size, &offset)) - goto serialize_error; - buf = _gst_buffer_new_take_data (data, offset); - ret = gst_qt_mux_send_buffer (qtmux, buf, NULL, FALSE); - if (ret != GST_FLOW_OK) - return ret; - } else { - /* must have been streamable; no need to write duration */ - GST_DEBUG_OBJECT (qtmux, "streamable file; nothing to stop"); - return GST_FLOW_OK; - } - - - timescale = qtmux->timescale; - /* only mvex duration is updated, - * mvhd should be consistent with empty moov - * (but TODO maybe some clients do not handle that well ?) */ - qtmux->moov->mvex.mehd.fragment_duration = - gst_util_uint64_scale (first_ts, timescale, GST_SECOND); - GST_DEBUG_OBJECT (qtmux, "rewriting moov with mvex duration %" - GST_TIME_FORMAT, GST_TIME_ARGS (first_ts)); - /* seek and rewrite the header */ - event = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_BYTES, - qtmux->mdat_pos, GST_CLOCK_TIME_NONE, 0); - gst_pad_push_event (qtmux->srcpad, event); - /* no need to seek back */ - return gst_qt_mux_send_moov (qtmux, NULL, FALSE); - } - - gst_qt_mux_configure_moov (qtmux, ×cale); - - /* check for late streams */ - first_ts = GST_CLOCK_TIME_NONE; - for (walk = qtmux->collect->data; walk; walk = g_slist_next (walk)) { - GstCollectData *cdata = (GstCollectData *) walk->data; - GstQTPad *qtpad = (GstQTPad *) cdata; - - if (!GST_CLOCK_TIME_IS_VALID (first_ts) || - (GST_CLOCK_TIME_IS_VALID (qtpad->first_ts) && - qtpad->first_ts < first_ts)) { - first_ts = qtpad->first_ts; - } - } - GST_DEBUG_OBJECT (qtmux, "Media first ts selected: %" GST_TIME_FORMAT, - GST_TIME_ARGS (first_ts)); - /* add EDTSs for late streams */ - for (walk = qtmux->collect->data; walk; walk = g_slist_next (walk)) { - GstCollectData *cdata = (GstCollectData *) walk->data; - GstQTPad *qtpad = (GstQTPad *) cdata; - guint32 lateness; - guint32 duration; - - if (GST_CLOCK_TIME_IS_VALID (qtpad->first_ts) && - qtpad->first_ts > first_ts + MAX_TOLERATED_LATENESS) { - GST_DEBUG_OBJECT (qtmux, "Pad %s is a late stream by %" GST_TIME_FORMAT, - GST_PAD_NAME (qtpad->collect.pad), - GST_TIME_ARGS (qtpad->first_ts - first_ts)); - lateness = gst_util_uint64_scale_round (qtpad->first_ts - first_ts, - timescale, GST_SECOND); - duration = qtpad->trak->tkhd.duration; - atom_trak_add_elst_entry (qtpad->trak, lateness, (guint32) - 1, - (guint32) (1 * 65536.0)); - atom_trak_add_elst_entry (qtpad->trak, duration, 0, - (guint32) (1 * 65536.0)); - - /* need to add the empty time to the trak duration */ - qtpad->trak->tkhd.duration += lateness; - } - } - - /* tags into file metadata */ - gst_qt_mux_setup_metadata (qtmux); - - large_file = (qtmux->mdat_size > MDAT_LARGE_FILE_LIMIT); - /* if faststart, update the offset of the atoms in the movie with the offset - * that the movie headers before mdat will cause. - * Also, send the ftyp */ - if (qtmux->fast_start_file) { - GstFlowReturn flow_ret; - offset = size = 0; - - flow_ret = gst_qt_mux_prepare_and_send_ftyp (qtmux); - if (flow_ret != GST_FLOW_OK) { - goto ftyp_error; - } - /* copy into NULL to obtain size */ - if (!atom_moov_copy_data (qtmux->moov, NULL, &size, &offset)) - goto serialize_error; - GST_DEBUG_OBJECT (qtmux, "calculated moov atom size %" G_GUINT64_FORMAT, - offset); - offset += qtmux->header_size + (large_file ? 16 : 8); - - /* sum up with the extra atoms size */ - ret = gst_qt_mux_send_extra_atoms (qtmux, FALSE, &offset, FALSE); - if (ret != GST_FLOW_OK) - return ret; - } else { - offset = qtmux->header_size; - } - atom_moov_chunks_add_offset (qtmux->moov, offset); - - /* moov */ - /* note: as of this point, we no longer care about tracking written data size, - * since there is no more use for it anyway */ - ret = gst_qt_mux_send_moov (qtmux, NULL, FALSE); - if (ret != GST_FLOW_OK) - return ret; - - /* extra atoms */ - ret = gst_qt_mux_send_extra_atoms (qtmux, TRUE, NULL, FALSE); - if (ret != GST_FLOW_OK) - return ret; - - /* if needed, send mdat atom and move buffered data into it */ - if (qtmux->fast_start_file) { - /* mdat_size = accumulated (buffered data) */ - ret = gst_qt_mux_send_mdat_header (qtmux, NULL, qtmux->mdat_size, - large_file); - if (ret != GST_FLOW_OK) - return ret; - ret = gst_qt_mux_send_buffered_data (qtmux, NULL); - if (ret != GST_FLOW_OK) - return ret; - } else { - /* mdat needs update iff not using faststart */ - GST_DEBUG_OBJECT (qtmux, "updating mdat size"); - ret = gst_qt_mux_update_mdat_size (qtmux, qtmux->mdat_pos, - qtmux->mdat_size, NULL); - /* note; no seeking back to the end of file is done, - * since we no longer write anything anyway */ - } - - return ret; - - /* ERRORS */ -serialize_error: - { - GST_ELEMENT_ERROR (qtmux, STREAM, MUX, (NULL), - ("Failed to serialize moov")); - return GST_FLOW_ERROR; - } -ftyp_error: - { - GST_ELEMENT_ERROR (qtmux, STREAM, MUX, (NULL), ("Failed to send ftyp")); - return GST_FLOW_ERROR; - } -} - -static GstFlowReturn -gst_qt_mux_pad_fragment_add_buffer (GstQTMux * qtmux, GstQTPad * pad, - GstBuffer * buf, gboolean force, guint32 nsamples, gint64 dts, - guint32 delta, guint32 size, gboolean sync, gint64 pts_offset) -{ - GstFlowReturn ret = GST_FLOW_OK; - - /* setup if needed */ - if (G_UNLIKELY (!pad->traf || force)) - goto init; - -flush: - /* flush pad fragment if threshold reached, - * or at new keyframe if we should be minding those in the first place */ - if (G_UNLIKELY (force || (sync && pad->sync) || - pad->fragment_duration < (gint64) delta)) { - AtomMOOF *moof; - guint64 size = 0, offset = 0; - guint8 *data = NULL; - GstBuffer *buffer; - guint i, total_size; - - /* now we know where moof ends up, update offset in tfra */ - if (pad->tfra) - atom_tfra_update_offset (pad->tfra, qtmux->header_size); - - moof = atom_moof_new (qtmux->context, qtmux->fragment_sequence); - /* takes ownership */ - atom_moof_add_traf (moof, pad->traf); - pad->traf = NULL; - atom_moof_copy_data (moof, &data, &size, &offset); - buffer = _gst_buffer_new_take_data (data, offset); - GST_LOG_OBJECT (qtmux, "writing moof size %d", GST_BUFFER_SIZE (buffer)); - ret = gst_qt_mux_send_buffer (qtmux, buffer, &qtmux->header_size, FALSE); - - /* and actual data */ - total_size = 0; - for (i = 0; i < atom_array_get_len (&pad->fragment_buffers); i++) { - total_size += - GST_BUFFER_SIZE (atom_array_index (&pad->fragment_buffers, i)); - } - - GST_LOG_OBJECT (qtmux, "writing %d buffers, total_size %d", - atom_array_get_len (&pad->fragment_buffers), total_size); - if (ret == GST_FLOW_OK) - ret = gst_qt_mux_send_mdat_header (qtmux, &qtmux->header_size, total_size, - FALSE); - for (i = 0; i < atom_array_get_len (&pad->fragment_buffers); i++) { - if (G_LIKELY (ret == GST_FLOW_OK)) - ret = gst_qt_mux_send_buffer (qtmux, - atom_array_index (&pad->fragment_buffers, i), &qtmux->header_size, - FALSE); - else - gst_buffer_unref (atom_array_index (&pad->fragment_buffers, i)); - } - - atom_array_clear (&pad->fragment_buffers); - atom_moof_free (moof); - qtmux->fragment_sequence++; - force = FALSE; - } - -init: - if (G_UNLIKELY (!pad->traf)) { - GST_LOG_OBJECT (qtmux, "setting up new fragment"); - pad->traf = atom_traf_new (qtmux->context, atom_trak_get_id (pad->trak)); - atom_array_init (&pad->fragment_buffers, 512); - pad->fragment_duration = gst_util_uint64_scale (qtmux->fragment_duration, - atom_trak_get_timescale (pad->trak), 1000); - - if (G_UNLIKELY (qtmux->mfra && !pad->tfra)) { - pad->tfra = atom_tfra_new (qtmux->context, atom_trak_get_id (pad->trak)); - atom_mfra_add_tfra (qtmux->mfra, pad->tfra); - } - } - - /* add buffer and metadata */ - atom_traf_add_samples (pad->traf, delta, size, sync, pts_offset, - pad->sync && sync); - atom_array_append (&pad->fragment_buffers, buf, 256); - pad->fragment_duration -= delta; - - if (pad->tfra) { - guint32 sn = atom_traf_get_sample_num (pad->traf); - - if ((sync && pad->sync) || (sn == 1 && !pad->sync)) - atom_tfra_add_entry (pad->tfra, dts, sn); - } - - if (G_UNLIKELY (force)) - goto flush; - - return ret; -} - -/* sigh, tiny list helpers to re-order stuff */ -static void -gst_qt_mux_push_ts (GstQTMux * qtmux, GstQTPad * pad, GstClockTime ts) -{ - gint i; - - for (i = 0; (i < QTMUX_NO_OF_TS) && (i < pad->ts_n_entries); i++) { - if (ts > pad->ts_entries[i]) - break; - } - memmove (&pad->ts_entries[i + 1], &pad->ts_entries[i], - sizeof (GstClockTime) * (pad->ts_n_entries - i)); - pad->ts_entries[i] = ts; - pad->ts_n_entries++; -} - -/* takes ownership of @buf */ -static GstBuffer * -gst_qt_mux_get_asc_buffer_ts (GstQTMux * qtmux, GstQTPad * pad, GstBuffer * buf) -{ - const gint wrap = G_N_ELEMENTS (pad->buf_entries); - GstClockTime ts; - - /* store buffer and ts, latter ordered */ - if (buf) { - pad->buf_entries[pad->buf_tail++] = buf; - pad->buf_tail %= wrap; - gst_qt_mux_push_ts (qtmux, pad, GST_BUFFER_TIMESTAMP (buf)); - } - - if (pad->ts_n_entries && (!buf || pad->ts_n_entries >= QTMUX_NO_OF_TS)) { - ts = pad->ts_entries[--pad->ts_n_entries]; - buf = pad->buf_entries[pad->buf_head]; - pad->buf_entries[pad->buf_head++] = NULL; - pad->buf_head %= wrap; - buf = gst_buffer_make_metadata_writable (buf); - GST_BUFFER_TIMESTAMP (buf) = ts; - GST_DEBUG_OBJECT (qtmux, "next buffer uses reordered ts %" GST_TIME_FORMAT, - GST_TIME_ARGS (ts)); - } else { - buf = NULL; - } - - return buf; -} - -/* - * Here we push the buffer and update the tables in the track atoms - */ -static GstFlowReturn -gst_qt_mux_add_buffer (GstQTMux * qtmux, GstQTPad * pad, GstBuffer * buf) -{ - GstBuffer *last_buf = NULL; - GstClockTime duration; - guint nsamples, sample_size; - guint64 chunk_offset; - gint64 last_dts, scaled_duration; - gint64 pts_offset = 0; - gboolean sync = FALSE, do_pts = FALSE; - gboolean drain = (buf == NULL); - GstFlowReturn ret; - - if (!pad->fourcc) - goto not_negotiated; - - /* if this pad has a prepare function, call it */ - if (pad->prepare_buf_func != NULL) { - buf = pad->prepare_buf_func (pad, buf, qtmux); - } - -again: - if (G_UNLIKELY (qtmux->dts_method == DTS_METHOD_REORDER)) { - buf = gst_qt_mux_get_asc_buffer_ts (qtmux, pad, buf); - if (!buf) { - GST_DEBUG_OBJECT (qtmux, "no reordered buffer yet"); - return GST_FLOW_OK; - } - } - - last_buf = pad->last_buf; - if (last_buf == NULL) { -#ifndef GST_DISABLE_GST_DEBUG - if (buf == NULL) { - GST_DEBUG_OBJECT (qtmux, "Pad %s has no previous buffer stored and " - "received NULL buffer, doing nothing", - GST_PAD_NAME (pad->collect.pad)); - } else { - GST_LOG_OBJECT (qtmux, - "Pad %s has no previous buffer stored, storing now", - GST_PAD_NAME (pad->collect.pad)); - } -#endif - pad->last_buf = buf; - return GST_FLOW_OK; - } else - gst_buffer_ref (last_buf); - - /* nasty heuristic mess to guestimate dealing with DTS/PTS, - * while also trying to stay close to input ts to preserve sync, - * so in DTS_METHOD_DD: - * - prefer using input ts where possible - * - if those detected out-of-order (*), mark as out-of-order - * - if in out-of-order, then - * - if duration available, use that as delta - * Also mind to preserve sync between streams, and adding - * durations might drift, so try to resync when we expect - * input ts == (sum of durations), which is at some keyframe input frame. - * - if no duration available, we are actually in serious trouble and need - * to hack around that, so we fail. - * To remedy failure, alternatively, in DTS_METHOD_REORDER: - * - collect some buffers and re-order timestamp, - * then process the oldest buffer with smallest timestamps. - * This should typically compensate for some codec's handywork with ts. - * ... but in case this makes ts end up where not expected: - * - keep each ts with its buffer and still keep a list of most recent X ts, - * use the (ascending) minimum of those as DTS (and the difference as ts delta), - * and use this DTS as a basis to obtain a (positive) CTS offset. - * This should yield exact PTS == buffer ts, but it seems not all players - * out there are aware of ctts pts ... - * - * 0.11 Phew, can we (pretty) please please sort out DTS/PTS on buffers ... - */ - if (G_LIKELY (buf) && !pad->is_out_of_order) { - if (G_LIKELY (GST_BUFFER_TIMESTAMP_IS_VALID (last_buf) && - GST_BUFFER_TIMESTAMP_IS_VALID (buf))) { - if ((GST_BUFFER_TIMESTAMP (buf) < GST_BUFFER_TIMESTAMP (last_buf))) { - GST_DEBUG_OBJECT (qtmux, "detected out-of-order input"); - pad->is_out_of_order = TRUE; - } - } else { - /* this is pretty bad */ - GST_WARNING_OBJECT (qtmux, "missing input timestamp"); - /* fall back to durations */ - pad->is_out_of_order = TRUE; - } - } - - /* would have to be some unusual input, but not impossible */ - if (G_UNLIKELY (qtmux->dts_method == DTS_METHOD_REORDER && - pad->is_out_of_order)) { - goto no_order; - } - - /* fall back to duration if last buffer or - * out-of-order (determined previously), otherwise use input ts */ - if (buf == NULL || - (pad->is_out_of_order && qtmux->dts_method == DTS_METHOD_DD)) { - if (!GST_BUFFER_DURATION_IS_VALID (last_buf)) { - /* be forgiving for some possibly last upstream flushed buffer */ - if (buf) - goto no_time; - GST_WARNING_OBJECT (qtmux, "no duration for last buffer"); - /* iso spec recommends some small value, try 0 */ - duration = 0; - } else { - duration = GST_BUFFER_DURATION (last_buf); - /* avoid drift in sum timestamps, - * so use input timestamp for suitable keyframe */ - if (buf && !GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT) && - GST_BUFFER_TIMESTAMP (buf) >= pad->last_dts) { - GST_DEBUG_OBJECT (qtmux, "resyncing out-of-order input to ts; " - "replacing %" GST_TIME_FORMAT " by %" GST_TIME_FORMAT, - GST_TIME_ARGS (pad->last_dts + duration), - GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf))); - duration = GST_BUFFER_TIMESTAMP (buf) - pad->last_dts; - } - } - } else if (qtmux->dts_method != DTS_METHOD_ASC) { - duration = GST_BUFFER_TIMESTAMP (buf) - GST_BUFFER_TIMESTAMP (last_buf); - } else { - GstClockTime ts; - - g_assert (qtmux->dts_method == DTS_METHOD_ASC); - if (!qtmux->guess_pts) - goto need_pts; - - /* add timestamp to queue; keeps in descending order */ - gst_qt_mux_push_ts (qtmux, pad, GST_BUFFER_TIMESTAMP (last_buf)); - /* chuck out smallest/last one if we have enough */ - if (G_LIKELY (pad->ts_n_entries > QTMUX_NO_OF_TS)) - pad->ts_n_entries--; - /* peek the now smallest timestamp */ - ts = pad->ts_entries[pad->ts_n_entries - 1]; - /* these tails are expected to be (strictly) ascending with - * large enough history */ - GST_DEBUG_OBJECT (qtmux, "ASC method; base timestamp %" GST_TIME_FORMAT, - GST_TIME_ARGS (ts)); - if (ts >= pad->last_dts) { - duration = ts - pad->last_dts; - } else { - /* fallback to previous value, negative ct offset might handle */ - GST_WARNING_OBJECT (qtmux, "unexpected decrease in timestamp"); - duration = 0; - } - /* arrange for small non-zero duration/delta << expected frame time */ - ts = gst_util_uint64_scale (10, GST_SECOND, - atom_trak_get_timescale (pad->trak)); - duration = MAX (duration, ts); - } - - gst_buffer_replace (&pad->last_buf, buf); - - last_dts = gst_util_uint64_scale_round (pad->last_dts, - atom_trak_get_timescale (pad->trak), GST_SECOND); - - /* fragments only deal with 1 buffer == 1 chunk (== 1 sample) */ - if (pad->sample_size && !qtmux->fragment_sequence) { - /* Constant size packets: usually raw audio (with many samples per - buffer (= chunk)), but can also be fixed-packet-size codecs like ADPCM - */ - sample_size = pad->sample_size; - if (GST_BUFFER_SIZE (last_buf) % sample_size != 0) - goto fragmented_sample; - /* note: qt raw audio storage warps it implicitly into a timewise - * perfect stream, discarding buffer times */ - if (GST_BUFFER_DURATION (last_buf) != GST_CLOCK_TIME_NONE) { - nsamples = gst_util_uint64_scale_round (GST_BUFFER_DURATION (last_buf), - atom_trak_get_timescale (pad->trak), GST_SECOND); - } else { - nsamples = GST_BUFFER_SIZE (last_buf) / sample_size; - } - duration = GST_BUFFER_DURATION (last_buf) / nsamples; - - /* timescale = samplerate */ - scaled_duration = 1; - pad->last_dts += duration * nsamples; - } else { - nsamples = 1; - sample_size = GST_BUFFER_SIZE (last_buf); - if (pad->have_dts) { - gint64 scaled_dts; - pad->last_dts = GST_BUFFER_OFFSET_END (last_buf); - if ((gint64) (pad->last_dts) < 0) { - scaled_dts = -gst_util_uint64_scale_round (-pad->last_dts, - atom_trak_get_timescale (pad->trak), GST_SECOND); - } else { - scaled_dts = gst_util_uint64_scale_round (pad->last_dts, - atom_trak_get_timescale (pad->trak), GST_SECOND); - } - scaled_duration = scaled_dts - last_dts; - last_dts = scaled_dts; - } else { - /* first convert intended timestamp (in GstClockTime resolution) to - * trak timescale, then derive delta; - * this ensures sums of (scale)delta add up to converted timestamp, - * which only deviates at most 1/scale from timestamp itself */ - scaled_duration = gst_util_uint64_scale_round (pad->last_dts + duration, - atom_trak_get_timescale (pad->trak), GST_SECOND) - last_dts; - pad->last_dts += duration; - } - } - chunk_offset = qtmux->mdat_size; - - GST_LOG_OBJECT (qtmux, - "Pad (%s) dts updated to %" GST_TIME_FORMAT, - GST_PAD_NAME (pad->collect.pad), GST_TIME_ARGS (pad->last_dts)); - GST_LOG_OBJECT (qtmux, - "Adding %d samples to track, duration: %" G_GUINT64_FORMAT - " size: %" G_GUINT32_FORMAT " chunk offset: %" G_GUINT64_FORMAT, - nsamples, scaled_duration, sample_size, chunk_offset); - - /* might be a sync sample */ - if (pad->sync && - !GST_BUFFER_FLAG_IS_SET (last_buf, GST_BUFFER_FLAG_DELTA_UNIT)) { - GST_LOG_OBJECT (qtmux, "Adding new sync sample entry for track of pad %s", - GST_PAD_NAME (pad->collect.pad)); - sync = TRUE; - } - - /* optionally calculate ctts entry values - * (if composition-time expected different from decoding-time) */ - /* really not recommended: - * - decoder typically takes care of dts/pts issues - * - in case of out-of-order, dts may only be determined as above - * (e.g. sum of duration), which may be totally different from - * buffer timestamps in case of multiple segment, non-perfect streams - * (and just perhaps maybe with some luck segment_to_running_time - * or segment_to_media_time might get near to it) */ - if ((pad->have_dts || qtmux->guess_pts) && pad->is_out_of_order) { - guint64 pts; - - pts = gst_util_uint64_scale_round (GST_BUFFER_TIMESTAMP (last_buf), - atom_trak_get_timescale (pad->trak), GST_SECOND); - pts_offset = (gint64) (pts - last_dts); - do_pts = TRUE; - GST_LOG_OBJECT (qtmux, "Adding ctts entry for pad %s: %" G_GINT64_FORMAT, - GST_PAD_NAME (pad->collect.pad), pts_offset); - } - - /* - * Each buffer starts a new chunk, so we can assume the buffer - * duration is the chunk duration - */ - if (GST_CLOCK_TIME_IS_VALID (duration) && (duration > qtmux->longest_chunk || - !GST_CLOCK_TIME_IS_VALID (qtmux->longest_chunk))) { - GST_DEBUG_OBJECT (qtmux, "New longest chunk found: %" GST_TIME_FORMAT - ", pad %s", GST_TIME_ARGS (duration), GST_PAD_NAME (pad->collect.pad)); - qtmux->longest_chunk = duration; - } - - /* if this is the first buffer, store the timestamp */ - if (G_UNLIKELY (pad->first_ts == GST_CLOCK_TIME_NONE) && last_buf) { - if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (last_buf))) { - pad->first_ts = GST_BUFFER_TIMESTAMP (last_buf); - } else { - GST_DEBUG_OBJECT (qtmux, "First buffer for pad %s has no timestamp, " - "using 0 as first timestamp", GST_PAD_NAME (pad->collect.pad)); - pad->first_ts = 0; - } - GST_DEBUG_OBJECT (qtmux, "Stored first timestamp for pad %s %" - GST_TIME_FORMAT, GST_PAD_NAME (pad->collect.pad), - GST_TIME_ARGS (pad->first_ts)); - } - - /* now we go and register this buffer/sample all over */ - /* note that a new chunk is started each time (not fancy but works) */ - if (qtmux->moov_recov_file) { - if (!atoms_recov_write_trak_samples (qtmux->moov_recov_file, pad->trak, - nsamples, (gint32) scaled_duration, sample_size, chunk_offset, sync, - do_pts, pts_offset)) { - GST_WARNING_OBJECT (qtmux, "Failed to write sample information to " - "recovery file, disabling recovery"); - fclose (qtmux->moov_recov_file); - qtmux->moov_recov_file = NULL; - } - } - - if (buf) - gst_buffer_unref (buf); - - if (qtmux->fragment_sequence) { - /* ensure that always sync samples are marked as such */ - ret = gst_qt_mux_pad_fragment_add_buffer (qtmux, pad, last_buf, - buf == NULL, nsamples, last_dts, (gint32) scaled_duration, sample_size, - !pad->sync || sync, pts_offset); - } else { - atom_trak_add_samples (pad->trak, nsamples, (gint32) scaled_duration, - sample_size, chunk_offset, sync, pts_offset); - ret = gst_qt_mux_send_buffer (qtmux, last_buf, &qtmux->mdat_size, TRUE); - } - - if (G_UNLIKELY (drain && qtmux->dts_method == DTS_METHOD_REORDER && - ret == GST_FLOW_OK)) { - buf = NULL; - goto again; - } - - return ret; - - /* ERRORS */ -bail: - { - if (buf) - gst_buffer_unref (buf); - gst_buffer_unref (last_buf); - return GST_FLOW_ERROR; - } -no_time: - { - GST_ELEMENT_ERROR (qtmux, STREAM, MUX, (NULL), - ("Received buffer without timestamp/duration.")); - goto bail; - } -no_order: - { - GST_ELEMENT_ERROR (qtmux, STREAM, MUX, (NULL), - ("DTS method failed to re-order timestamps.")); - goto bail; - } -need_pts: - { - GST_ELEMENT_ERROR (qtmux, STREAM, MUX, (NULL), - ("Selected DTS method also needs PTS enabled.")); - goto bail; - } -fragmented_sample: - { - GST_ELEMENT_ERROR (qtmux, STREAM, MUX, (NULL), - ("Audio buffer contains fragmented sample.")); - goto bail; - } -not_negotiated: - { - GST_ELEMENT_ERROR (qtmux, CORE, NEGOTIATION, (NULL), - ("format wasn't negotiated before buffer flow on pad %s", - GST_PAD_NAME (pad->collect.pad))); - if (buf) - gst_buffer_unref (buf); - return GST_FLOW_NOT_NEGOTIATED; - } -} - -static GstFlowReturn -gst_qt_mux_collected (GstCollectPads * pads, gpointer user_data) -{ - GstFlowReturn ret = GST_FLOW_OK; - GstQTMux *qtmux = GST_QT_MUX_CAST (user_data); - GSList *walk; - GstQTPad *best_pad = NULL; - GstClockTime time, best_time = GST_CLOCK_TIME_NONE; - GstBuffer *buf; - - if (G_UNLIKELY (qtmux->state == GST_QT_MUX_STATE_STARTED)) { - if ((ret = gst_qt_mux_start_file (qtmux)) != GST_FLOW_OK) - return ret; - else - qtmux->state = GST_QT_MUX_STATE_DATA; - } - - if (G_UNLIKELY (qtmux->state == GST_QT_MUX_STATE_EOS)) - return GST_FLOW_UNEXPECTED; - - /* select the best buffer */ - walk = qtmux->collect->data; - while (walk) { - GstQTPad *pad; - GstCollectData *data; - - data = (GstCollectData *) walk->data; - pad = (GstQTPad *) data; - - walk = g_slist_next (walk); - - buf = gst_collect_pads_peek (pads, data); - if (buf == NULL) { - GST_LOG_OBJECT (qtmux, "Pad %s has no buffers", - GST_PAD_NAME (pad->collect.pad)); - continue; - } - time = GST_BUFFER_TIMESTAMP (buf); - gst_buffer_unref (buf); - - if (best_pad == NULL || !GST_CLOCK_TIME_IS_VALID (time) || - (GST_CLOCK_TIME_IS_VALID (best_time) && time < best_time)) { - best_pad = pad; - best_time = time; - } - } - - if (best_pad != NULL) { - GST_LOG_OBJECT (qtmux, "selected pad %s with time %" GST_TIME_FORMAT, - GST_PAD_NAME (best_pad->collect.pad), GST_TIME_ARGS (best_time)); - buf = gst_collect_pads_pop (pads, &best_pad->collect); - ret = gst_qt_mux_add_buffer (qtmux, best_pad, buf); - } else { - ret = gst_qt_mux_stop_file (qtmux); - if (ret == GST_FLOW_OK) { - GST_DEBUG_OBJECT (qtmux, "Pushing eos"); - gst_pad_push_event (qtmux->srcpad, gst_event_new_eos ()); - ret = GST_FLOW_UNEXPECTED; - } else { - GST_WARNING_OBJECT (qtmux, "Failed to stop file: %s", - gst_flow_get_name (ret)); - } - qtmux->state = GST_QT_MUX_STATE_EOS; - } - - return ret; -} - -static gboolean -check_field (GQuark field_id, const GValue * value, gpointer user_data) -{ - GstStructure *structure = (GstStructure *) user_data; - const GValue *other = gst_structure_id_get_value (structure, field_id); - if (other == NULL) - return FALSE; - return gst_value_compare (value, other) == GST_VALUE_EQUAL; -} - -static gboolean -gst_qtmux_caps_is_subset_full (GstQTMux * qtmux, GstCaps * subset, - GstCaps * superset) -{ - GstStructure *sub_s = gst_caps_get_structure (subset, 0); - GstStructure *sup_s = gst_caps_get_structure (superset, 0); - - return gst_structure_foreach (sub_s, check_field, sup_s); -} - -static gboolean -gst_qt_mux_audio_sink_set_caps (GstPad * pad, GstCaps * caps) -{ - GstQTMux *qtmux = GST_QT_MUX_CAST (gst_pad_get_parent (pad)); - GstQTMuxClass *qtmux_klass = (GstQTMuxClass *) (G_OBJECT_GET_CLASS (qtmux)); - GstQTPad *qtpad = NULL; - GstStructure *structure; - const gchar *mimetype; - gint rate, channels; - const GValue *value = NULL; - const GstBuffer *codec_data = NULL; - GstQTMuxFormat format; - AudioSampleEntry entry = { 0, }; - AtomInfo *ext_atom = NULL; - gint constant_size = 0; - const gchar *stream_format; - GstCaps *current_caps = NULL; - - /* find stream data */ - qtpad = (GstQTPad *) gst_pad_get_element_private (pad); - g_assert (qtpad); - - qtpad->prepare_buf_func = NULL; - - /* does not go well to renegotiate stream mid-way, unless - * the old caps are a subset of the new one (this means upstream - * added more info to the caps, as both should be 'fixed' caps) */ - if (qtpad->fourcc) { - g_object_get (pad, "caps", ¤t_caps, NULL); - g_assert (caps != NULL); - - if (!gst_qtmux_caps_is_subset_full (qtmux, current_caps, caps)) { - goto refuse_renegotiation; - } - GST_DEBUG_OBJECT (qtmux, - "pad %s accepted renegotiation to %" GST_PTR_FORMAT " from %" - GST_PTR_FORMAT, GST_PAD_NAME (pad), caps, GST_PAD_CAPS (pad)); - } - - GST_DEBUG_OBJECT (qtmux, "%s:%s, caps=%" GST_PTR_FORMAT, - GST_DEBUG_PAD_NAME (pad), caps); - - format = qtmux_klass->format; - structure = gst_caps_get_structure (caps, 0); - mimetype = gst_structure_get_name (structure); - - /* common info */ - if (!gst_structure_get_int (structure, "channels", &channels) || - !gst_structure_get_int (structure, "rate", &rate)) { - goto refuse_caps; - } - - /* optional */ - value = gst_structure_get_value (structure, "codec_data"); - if (value != NULL) - codec_data = gst_value_get_buffer (value); - - qtpad->is_out_of_order = FALSE; - qtpad->have_dts = FALSE; - - /* set common properties */ - entry.sample_rate = rate; - entry.channels = channels; - /* default */ - entry.sample_size = 16; - /* this is the typical compressed case */ - if (format == GST_QT_MUX_FORMAT_QT) { - entry.version = 1; - entry.compression_id = -2; - } - - /* now map onto a fourcc, and some extra properties */ - if (strcmp (mimetype, "audio/mpeg") == 0) { - gint mpegversion = 0; - gint layer = -1; - - gst_structure_get_int (structure, "mpegversion", &mpegversion); - switch (mpegversion) { - case 1: - gst_structure_get_int (structure, "layer", &layer); - switch (layer) { - case 3: - /* mp3 */ - /* note: QuickTime player does not like mp3 either way in iso/mp4 */ - if (format == GST_QT_MUX_FORMAT_QT) - entry.fourcc = FOURCC__mp3; - else { - entry.fourcc = FOURCC_mp4a; - ext_atom = - build_esds_extension (qtpad->trak, ESDS_OBJECT_TYPE_MPEG1_P3, - ESDS_STREAM_TYPE_AUDIO, codec_data, qtpad->avg_bitrate, - qtpad->max_bitrate); - } - entry.samples_per_packet = 1152; - entry.bytes_per_sample = 2; - break; - } - break; - case 4: - - /* check stream-format */ - stream_format = gst_structure_get_string (structure, "stream-format"); - if (stream_format) { - if (strcmp (stream_format, "raw") != 0) { - GST_WARNING_OBJECT (qtmux, "Unsupported AAC stream-format %s, " - "please use 'raw'", stream_format); - goto refuse_caps; - } - } else { - GST_WARNING_OBJECT (qtmux, "No stream-format present in caps, " - "assuming 'raw'"); - } - - if (!codec_data || GST_BUFFER_SIZE (codec_data) < 2) - GST_WARNING_OBJECT (qtmux, "no (valid) codec_data for AAC audio"); - else { - guint8 profile = GST_READ_UINT8 (GST_BUFFER_DATA (codec_data)); - - /* warn if not Low Complexity profile */ - profile >>= 3; - if (profile != 2) - GST_WARNING_OBJECT (qtmux, - "non-LC AAC may not run well on (Apple) QuickTime/iTunes"); - } - - /* AAC */ - entry.fourcc = FOURCC_mp4a; - - if (format == GST_QT_MUX_FORMAT_QT) - ext_atom = build_mov_aac_extension (qtpad->trak, codec_data, - qtpad->avg_bitrate, qtpad->max_bitrate); - else - ext_atom = - build_esds_extension (qtpad->trak, ESDS_OBJECT_TYPE_MPEG4_P3, - ESDS_STREAM_TYPE_AUDIO, codec_data, qtpad->avg_bitrate, - qtpad->max_bitrate); - break; - default: - break; - } - } else if (strcmp (mimetype, "audio/AMR") == 0) { - entry.fourcc = FOURCC_samr; - entry.sample_size = 16; - entry.samples_per_packet = 160; - entry.bytes_per_sample = 2; - ext_atom = build_amr_extension (); - } else if (strcmp (mimetype, "audio/AMR-WB") == 0) { - entry.fourcc = FOURCC_sawb; - entry.sample_size = 16; - entry.samples_per_packet = 320; - entry.bytes_per_sample = 2; - ext_atom = build_amr_extension (); - } else if (strcmp (mimetype, "audio/x-raw-int") == 0) { - gint width; - gint depth; - gint endianness; - gboolean sign; - - if (!gst_structure_get_int (structure, "width", &width) || - !gst_structure_get_int (structure, "depth", &depth) || - !gst_structure_get_boolean (structure, "signed", &sign)) { - GST_DEBUG_OBJECT (qtmux, "broken caps, width/depth/signed field missing"); - goto refuse_caps; - } - - if (depth <= 8) { - endianness = G_BYTE_ORDER; - } else if (!gst_structure_get_int (structure, "endianness", &endianness)) { - GST_DEBUG_OBJECT (qtmux, "broken caps, endianness field missing"); - goto refuse_caps; - } - - /* spec has no place for a distinction in these */ - if (width != depth) { - GST_DEBUG_OBJECT (qtmux, "width must be same as depth!"); - goto refuse_caps; - } - - if (sign) { - if (endianness == G_LITTLE_ENDIAN) - entry.fourcc = FOURCC_sowt; - else if (endianness == G_BIG_ENDIAN) - entry.fourcc = FOURCC_twos; - /* maximum backward compatibility; only new version for > 16 bit */ - if (depth <= 16) - entry.version = 0; - /* not compressed in any case */ - entry.compression_id = 0; - /* QT spec says: max at 16 bit even if sample size were actually larger, - * however, most players (e.g. QuickTime!) seem to disagree, so ... */ - entry.sample_size = depth; - entry.bytes_per_sample = depth / 8; - entry.samples_per_packet = 1; - entry.bytes_per_packet = depth / 8; - entry.bytes_per_frame = entry.bytes_per_packet * channels; - } else { - if (width == 8 && depth == 8) { - /* fall back to old 8-bit version */ - entry.fourcc = FOURCC_raw_; - entry.version = 0; - entry.compression_id = 0; - entry.sample_size = 8; - } else { - GST_DEBUG_OBJECT (qtmux, "non 8-bit PCM must be signed"); - goto refuse_caps; - } - } - constant_size = (depth / 8) * channels; - } else if (strcmp (mimetype, "audio/x-alaw") == 0) { - entry.fourcc = FOURCC_alaw; - entry.samples_per_packet = 1023; - entry.bytes_per_sample = 2; - } else if (strcmp (mimetype, "audio/x-mulaw") == 0) { - entry.fourcc = FOURCC_ulaw; - entry.samples_per_packet = 1023; - entry.bytes_per_sample = 2; - } else if (strcmp (mimetype, "audio/x-adpcm") == 0) { - gint blocksize; - if (!gst_structure_get_int (structure, "block_align", &blocksize)) { - GST_DEBUG_OBJECT (qtmux, "broken caps, block_align missing"); - goto refuse_caps; - } - /* Currently only supports WAV-style IMA ADPCM, for which the codec id is - 0x11 */ - entry.fourcc = MS_WAVE_FOURCC (0x11); - /* 4 byte header per channel (including one sample). 2 samples per byte - remaining. Simplifying gives the following (samples per block per - channel) */ - entry.samples_per_packet = 2 * blocksize / channels - 7; - entry.bytes_per_sample = 2; - - entry.bytes_per_frame = blocksize; - entry.bytes_per_packet = blocksize / channels; - /* ADPCM has constant size packets */ - constant_size = 1; - /* TODO: I don't really understand why this helps, but it does! Constant - * size and compression_id of -2 seem to be incompatible, and other files - * in the wild use this too. */ - entry.compression_id = -1; - - ext_atom = build_ima_adpcm_extension (channels, rate, blocksize); - } else if (strcmp (mimetype, "audio/x-alac") == 0) { - GstBuffer *codec_config; - gint len; - - entry.fourcc = FOURCC_alac; - /* let's check if codec data already comes with 'alac' atom prefix */ - if (!codec_data || (len = GST_BUFFER_SIZE (codec_data)) < 28) { - GST_DEBUG_OBJECT (qtmux, "broken caps, codec data missing"); - goto refuse_caps; - } - if (GST_READ_UINT32_LE (GST_BUFFER_DATA (codec_data) + 4) == FOURCC_alac) { - len -= 8; - codec_config = gst_buffer_create_sub ((GstBuffer *) codec_data, 8, len); - } else { - codec_config = gst_buffer_ref ((GstBuffer *) codec_data); - } - if (len != 28) { - /* does not look good, but perhaps some trailing unneeded stuff */ - GST_WARNING_OBJECT (qtmux, "unexpected codec-data size, possibly broken"); - } - if (format == GST_QT_MUX_FORMAT_QT) - ext_atom = build_mov_alac_extension (qtpad->trak, codec_config); - else - ext_atom = build_codec_data_extension (FOURCC_alac, codec_config); - /* set some more info */ - entry.bytes_per_sample = 2; - entry.samples_per_packet = - GST_READ_UINT32_BE (GST_BUFFER_DATA (codec_config) + 4); - gst_buffer_unref (codec_config); - } - - if (!entry.fourcc) - goto refuse_caps; - - /* ok, set the pad info accordingly */ - qtpad->fourcc = entry.fourcc; - qtpad->sample_size = constant_size; - atom_trak_set_audio_type (qtpad->trak, qtmux->context, &entry, - qtmux->trak_timescale ? qtmux->trak_timescale : entry.sample_rate, - ext_atom, constant_size); - - gst_object_unref (qtmux); - return TRUE; - - /* ERRORS */ -refuse_caps: - { - GST_WARNING_OBJECT (qtmux, "pad %s refused caps %" GST_PTR_FORMAT, - GST_PAD_NAME (pad), caps); - gst_object_unref (qtmux); - return FALSE; - } -refuse_renegotiation: - { - GST_WARNING_OBJECT (qtmux, - "pad %s refused renegotiation to %" GST_PTR_FORMAT, - GST_PAD_NAME (pad), caps); - gst_object_unref (qtmux); - return FALSE; - } -} - -/* scale rate up or down by factor of 10 to fit into [1000,10000] interval */ -static guint32 -adjust_rate (guint64 rate) -{ - if (rate == 0) - return 10000; - - while (rate >= 10000) - rate /= 10; - - while (rate < 1000) - rate *= 10; - - return (guint32) rate; -} - -static gboolean -gst_qt_mux_video_sink_set_caps (GstPad * pad, GstCaps * caps) -{ - GstQTMux *qtmux = GST_QT_MUX_CAST (gst_pad_get_parent (pad)); - GstQTMuxClass *qtmux_klass = (GstQTMuxClass *) (G_OBJECT_GET_CLASS (qtmux)); - GstQTPad *qtpad = NULL; - GstStructure *structure; - const gchar *mimetype; - gint width, height, depth = -1; - gint framerate_num, framerate_den; - guint32 rate; - const GValue *value = NULL; - const GstBuffer *codec_data = NULL; - VisualSampleEntry entry = { 0, }; - GstQTMuxFormat format; - AtomInfo *ext_atom = NULL; - GList *ext_atom_list = NULL; - gboolean sync = FALSE; - int par_num, par_den; - GstCaps *current_caps = NULL; - - /* find stream data */ - qtpad = (GstQTPad *) gst_pad_get_element_private (pad); - g_assert (qtpad); - - qtpad->prepare_buf_func = NULL; - - /* does not go well to renegotiate stream mid-way, unless - * the old caps are a subset of the new one (this means upstream - * added more info to the caps, as both should be 'fixed' caps) */ - if (qtpad->fourcc) { - g_object_get (pad, "caps", ¤t_caps, NULL); - g_assert (caps != NULL); - - if (!gst_qtmux_caps_is_subset_full (qtmux, current_caps, caps)) { - goto refuse_renegotiation; - } - GST_DEBUG_OBJECT (qtmux, - "pad %s accepted renegotiation to %" GST_PTR_FORMAT " from %" - GST_PTR_FORMAT, GST_PAD_NAME (pad), caps, GST_PAD_CAPS (pad)); - } - - GST_DEBUG_OBJECT (qtmux, "%s:%s, caps=%" GST_PTR_FORMAT, - GST_DEBUG_PAD_NAME (pad), caps); - - format = qtmux_klass->format; - structure = gst_caps_get_structure (caps, 0); - mimetype = gst_structure_get_name (structure); - - /* required parts */ - if (!gst_structure_get_int (structure, "width", &width) || - !gst_structure_get_int (structure, "height", &height)) - goto refuse_caps; - - /* optional */ - depth = -1; - /* works as a default timebase */ - framerate_num = 10000; - framerate_den = 1; - gst_structure_get_fraction (structure, "framerate", &framerate_num, - &framerate_den); - gst_structure_get_int (structure, "depth", &depth); - value = gst_structure_get_value (structure, "codec_data"); - if (value != NULL) - codec_data = gst_value_get_buffer (value); - - par_num = 1; - par_den = 1; - gst_structure_get_fraction (structure, "pixel-aspect-ratio", &par_num, - &par_den); - - qtpad->is_out_of_order = FALSE; - - /* bring frame numerator into a range that ensures both reasonable resolution - * as well as a fair duration */ - rate = qtmux->trak_timescale ? - qtmux->trak_timescale : adjust_rate (framerate_num); - GST_DEBUG_OBJECT (qtmux, "Rate of video track selected: %" G_GUINT32_FORMAT, - rate); - - /* set common properties */ - entry.width = width; - entry.height = height; - entry.par_n = par_num; - entry.par_d = par_den; - /* should be OK according to qt and iso spec, override if really needed */ - entry.color_table_id = -1; - entry.frame_count = 1; - entry.depth = 24; - - /* sync entries by default */ - sync = TRUE; - - /* now map onto a fourcc, and some extra properties */ - if (strcmp (mimetype, "video/x-raw-rgb") == 0) { - gint bpp; - - entry.fourcc = FOURCC_raw_; - gst_structure_get_int (structure, "bpp", &bpp); - entry.depth = bpp; - sync = FALSE; - } else if (strcmp (mimetype, "video/x-raw-yuv") == 0) { - guint32 format = 0; - - sync = FALSE; - gst_structure_get_fourcc (structure, "format", &format); - switch (format) { - case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'): - if (depth == -1) - depth = 24; - entry.fourcc = FOURCC_2vuy; - entry.depth = depth; - break; - } - } else if (strcmp (mimetype, "video/x-h263") == 0) { - ext_atom = NULL; - if (format == GST_QT_MUX_FORMAT_QT) - entry.fourcc = FOURCC_h263; - else - entry.fourcc = FOURCC_s263; - ext_atom = build_h263_extension (); - if (ext_atom != NULL) - ext_atom_list = g_list_prepend (ext_atom_list, ext_atom); - } else if (strcmp (mimetype, "video/x-divx") == 0 || - strcmp (mimetype, "video/mpeg") == 0) { - gint version = 0; - - if (strcmp (mimetype, "video/x-divx") == 0) { - gst_structure_get_int (structure, "divxversion", &version); - version = version == 5 ? 1 : 0; - } else { - gst_structure_get_int (structure, "mpegversion", &version); - version = version == 4 ? 1 : 0; - } - if (version) { - entry.fourcc = FOURCC_mp4v; - ext_atom = - build_esds_extension (qtpad->trak, ESDS_OBJECT_TYPE_MPEG4_P2, - ESDS_STREAM_TYPE_VISUAL, codec_data, qtpad->avg_bitrate, - qtpad->max_bitrate); - if (ext_atom != NULL) - ext_atom_list = g_list_prepend (ext_atom_list, ext_atom); - if (!codec_data) - GST_WARNING_OBJECT (qtmux, "no codec_data for MPEG4 video; " - "output might not play in Apple QuickTime (try global-headers?)"); - } - } else if (strcmp (mimetype, "video/x-h264") == 0) { - entry.fourcc = FOURCC_avc1; - if (qtpad->avg_bitrate == 0) { - gint avg_bitrate = 0; - gst_structure_get_int (structure, "bitrate", &avg_bitrate); - qtpad->avg_bitrate = avg_bitrate; - } - ext_atom = build_btrt_extension (0, qtpad->avg_bitrate, qtpad->max_bitrate); - if (ext_atom != NULL) - ext_atom_list = g_list_prepend (ext_atom_list, ext_atom); - if (!codec_data) - GST_WARNING_OBJECT (qtmux, "no codec_data in h264 caps"); - ext_atom = build_codec_data_extension (FOURCC_avcC, codec_data); - if (ext_atom != NULL) - ext_atom_list = g_list_prepend (ext_atom_list, ext_atom); - } else if (strcmp (mimetype, "video/x-svq") == 0) { - gint version = 0; - const GstBuffer *seqh = NULL; - const GValue *seqh_value; - gdouble gamma = 0; - - gst_structure_get_int (structure, "svqversion", &version); - if (version == 3) { - entry.fourcc = FOURCC_SVQ3; - entry.version = 3; - entry.depth = 32; - - seqh_value = gst_structure_get_value (structure, "seqh"); - if (seqh_value) { - seqh = gst_value_get_buffer (seqh_value); - ext_atom = build_SMI_atom (seqh); - if (ext_atom) - ext_atom_list = g_list_prepend (ext_atom_list, ext_atom); - } - - /* we need to add the gamma anyway because quicktime might crash - * when it doesn't find it */ - if (!gst_structure_get_double (structure, "applied-gamma", &gamma)) { - /* it seems that using 0 here makes it ignored */ - gamma = 0.0; - } - ext_atom = build_gama_atom (gamma); - if (ext_atom) - ext_atom_list = g_list_prepend (ext_atom_list, ext_atom); - } else { - GST_WARNING_OBJECT (qtmux, "SVQ version %d not supported. Please file " - "a bug at http://bugzilla.gnome.org", version); - } - } else if (strcmp (mimetype, "video/x-dv") == 0) { - gint version = 0; - gboolean pal = TRUE; - - sync = FALSE; - if (framerate_num != 25 || framerate_den != 1) - pal = FALSE; - gst_structure_get_int (structure, "dvversion", &version); - /* fall back to typical one */ - if (!version) - version = 25; - switch (version) { - case 25: - if (pal) - entry.fourcc = GST_MAKE_FOURCC ('d', 'v', 'c', 'p'); - else - entry.fourcc = GST_MAKE_FOURCC ('d', 'v', 'c', ' '); - break; - case 50: - if (pal) - entry.fourcc = GST_MAKE_FOURCC ('d', 'v', '5', 'p'); - else - entry.fourcc = GST_MAKE_FOURCC ('d', 'v', '5', 'n'); - break; - default: - GST_WARNING_OBJECT (qtmux, "unrecognized dv version"); - break; - } - } else if (strcmp (mimetype, "image/jpeg") == 0) { - entry.fourcc = FOURCC_jpeg; - sync = FALSE; - } else if (strcmp (mimetype, "image/x-j2c") == 0 || - strcmp (mimetype, "image/x-jpc") == 0) { - guint32 fourcc; - const GValue *cmap_array; - const GValue *cdef_array; - gint ncomp = 0; - gint fields = 1; - - if (strcmp (mimetype, "image/x-jpc") == 0) { - qtpad->prepare_buf_func = gst_qt_mux_prepare_jpc_buffer; - } - - gst_structure_get_int (structure, "num-components", &ncomp); - gst_structure_get_int (structure, "fields", &fields); - cmap_array = gst_structure_get_value (structure, "component-map"); - cdef_array = gst_structure_get_value (structure, "channel-definitions"); - - ext_atom = NULL; - entry.fourcc = FOURCC_mjp2; - sync = FALSE; - if (gst_structure_get_fourcc (structure, "fourcc", &fourcc) && - (ext_atom = - build_jp2h_extension (qtpad->trak, width, height, fourcc, ncomp, - cmap_array, cdef_array)) != NULL) { - ext_atom_list = g_list_append (ext_atom_list, ext_atom); - - ext_atom = build_fiel_extension (fields); - if (ext_atom) - ext_atom_list = g_list_append (ext_atom_list, ext_atom); - - ext_atom = build_jp2x_extension (codec_data); - if (ext_atom) - ext_atom_list = g_list_append (ext_atom_list, ext_atom); - } else { - GST_DEBUG_OBJECT (qtmux, "missing or invalid fourcc in jp2 caps"); - goto refuse_caps; - } - } else if (strcmp (mimetype, "video/x-vp8") == 0) { - entry.fourcc = FOURCC_VP80; - sync = FALSE; - } else if (strcmp (mimetype, "video/x-qt-part") == 0) { - guint32 fourcc; - - gst_structure_get_fourcc (structure, "format", &fourcc); - entry.fourcc = fourcc; - qtpad->have_dts = TRUE; - } else if (strcmp (mimetype, "video/x-mp4-part") == 0) { - guint32 fourcc; - - gst_structure_get_fourcc (structure, "format", &fourcc); - entry.fourcc = fourcc; - qtpad->have_dts = TRUE; - } - - if (!entry.fourcc) - goto refuse_caps; - - /* ok, set the pad info accordingly */ - qtpad->fourcc = entry.fourcc; - qtpad->sync = sync; - atom_trak_set_video_type (qtpad->trak, qtmux->context, &entry, rate, - ext_atom_list); - - gst_object_unref (qtmux); - return TRUE; - - /* ERRORS */ -refuse_caps: - { - GST_WARNING_OBJECT (qtmux, "pad %s refused caps %" GST_PTR_FORMAT, - GST_PAD_NAME (pad), caps); - gst_object_unref (qtmux); - return FALSE; - } -refuse_renegotiation: - { - GST_WARNING_OBJECT (qtmux, - "pad %s refused renegotiation to %" GST_PTR_FORMAT " from %" - GST_PTR_FORMAT, GST_PAD_NAME (pad), caps, GST_PAD_CAPS (pad)); - gst_object_unref (qtmux); - return FALSE; - } -} - -static gboolean -gst_qt_mux_sink_event (GstPad * pad, GstEvent * event) -{ - gboolean ret; - GstQTMux *qtmux; - guint32 avg_bitrate = 0, max_bitrate = 0; - - qtmux = GST_QT_MUX_CAST (gst_pad_get_parent (pad)); - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_TAG:{ - GstTagList *list; - GstTagSetter *setter = GST_TAG_SETTER (qtmux); - GstTagMergeMode mode; - - GST_OBJECT_LOCK (qtmux); - mode = gst_tag_setter_get_tag_merge_mode (setter); - - GST_DEBUG_OBJECT (qtmux, "received tag event"); - gst_event_parse_tag (event, &list); - - gst_tag_setter_merge_tags (setter, list, mode); - GST_OBJECT_UNLOCK (qtmux); - - if (gst_tag_list_get_uint (list, GST_TAG_BITRATE, &avg_bitrate) | - gst_tag_list_get_uint (list, GST_TAG_MAXIMUM_BITRATE, &max_bitrate)) { - GstQTPad *qtpad = gst_pad_get_element_private (pad); - g_assert (qtpad); - - if (avg_bitrate > 0 && avg_bitrate < G_MAXUINT32) - qtpad->avg_bitrate = avg_bitrate; - if (max_bitrate > 0 && max_bitrate < G_MAXUINT32) - qtpad->max_bitrate = max_bitrate; - } - - break; - } - default: - break; - } - - ret = qtmux->collect_event (pad, event); - gst_object_unref (qtmux); - - return ret; -} - -static void -gst_qt_mux_release_pad (GstElement * element, GstPad * pad) -{ - GstQTMux *mux = GST_QT_MUX_CAST (element); - GSList *walk; - - GST_DEBUG_OBJECT (element, "Releasing %s:%s", GST_DEBUG_PAD_NAME (pad)); - - for (walk = mux->sinkpads; walk; walk = g_slist_next (walk)) { - GstQTPad *qtpad = (GstQTPad *) walk->data; - GST_DEBUG ("Checking %s:%s", GST_DEBUG_PAD_NAME (qtpad->collect.pad)); - if (qtpad->collect.pad == pad) { - /* this is it, remove */ - mux->sinkpads = g_slist_delete_link (mux->sinkpads, walk); - gst_element_remove_pad (element, pad); - break; - } - } - - gst_collect_pads_remove_pad (mux->collect, pad); -} - -static GstPad * -gst_qt_mux_request_new_pad (GstElement * element, - GstPadTemplate * templ, const gchar * req_name) -{ - GstElementClass *klass = GST_ELEMENT_GET_CLASS (element); - GstQTMux *qtmux = GST_QT_MUX_CAST (element); - GstQTPad *collect_pad; - GstPad *newpad; - gboolean audio; - gchar *name; - - if (templ->direction != GST_PAD_SINK) - goto wrong_direction; - - if (qtmux->state > GST_QT_MUX_STATE_STARTED) - goto too_late; - - if (templ == gst_element_class_get_pad_template (klass, "audio_%d")) { - audio = TRUE; - name = g_strdup_printf ("audio_%02d", qtmux->audio_pads++); - } else if (templ == gst_element_class_get_pad_template (klass, "video_%d")) { - audio = FALSE; - name = g_strdup_printf ("video_%02d", qtmux->video_pads++); - } else - goto wrong_template; - - GST_DEBUG_OBJECT (qtmux, "Requested pad: %s", name); - - /* create pad and add to collections */ - newpad = gst_pad_new_from_template (templ, name); - g_free (name); - collect_pad = (GstQTPad *) - gst_collect_pads_add_pad_full (qtmux->collect, newpad, sizeof (GstQTPad), - (GstCollectDataDestroyNotify) (gst_qt_mux_pad_reset)); - /* set up pad */ - gst_qt_mux_pad_reset (collect_pad); - collect_pad->trak = atom_trak_new (qtmux->context); - atom_moov_add_trak (qtmux->moov, collect_pad->trak); - - qtmux->sinkpads = g_slist_append (qtmux->sinkpads, collect_pad); - - /* set up pad functions */ - if (audio) - gst_pad_set_setcaps_function (newpad, - GST_DEBUG_FUNCPTR (gst_qt_mux_audio_sink_set_caps)); - else - gst_pad_set_setcaps_function (newpad, - GST_DEBUG_FUNCPTR (gst_qt_mux_video_sink_set_caps)); - - /* FIXME: hacked way to override/extend the event function of - * GstCollectPads; because it sets its own event function giving the - * element no access to events. - */ - qtmux->collect_event = (GstPadEventFunction) GST_PAD_EVENTFUNC (newpad); - gst_pad_set_event_function (newpad, - GST_DEBUG_FUNCPTR (gst_qt_mux_sink_event)); - - gst_pad_set_active (newpad, TRUE); - gst_element_add_pad (element, newpad); - - return newpad; - - /* ERRORS */ -wrong_direction: - { - GST_WARNING_OBJECT (qtmux, "Request pad that is not a SINK pad."); - return NULL; - } -too_late: - { - GST_WARNING_OBJECT (qtmux, "Not providing request pad after stream start."); - return NULL; - } -wrong_template: - { - GST_WARNING_OBJECT (qtmux, "This is not our template!"); - return NULL; - } -} - -static void -gst_qt_mux_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec) -{ - GstQTMux *qtmux = GST_QT_MUX_CAST (object); - - GST_OBJECT_LOCK (qtmux); - switch (prop_id) { - case PROP_MOVIE_TIMESCALE: - g_value_set_uint (value, qtmux->timescale); - break; - case PROP_TRAK_TIMESCALE: - g_value_set_uint (value, qtmux->trak_timescale); - break; - case PROP_DO_CTTS: - g_value_set_boolean (value, qtmux->guess_pts); - break; - case PROP_DTS_METHOD: - g_value_set_enum (value, qtmux->dts_method); - break; - case PROP_FAST_START: - g_value_set_boolean (value, qtmux->fast_start); - break; - case PROP_FAST_START_TEMP_FILE: - g_value_set_string (value, qtmux->fast_start_file_path); - break; - case PROP_MOOV_RECOV_FILE: - g_value_set_string (value, qtmux->moov_recov_file_path); - break; - case PROP_FRAGMENT_DURATION: - g_value_set_uint (value, qtmux->fragment_duration); - break; - case PROP_STREAMABLE: - g_value_set_boolean (value, qtmux->streamable); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } - GST_OBJECT_UNLOCK (qtmux); -} - -static void -gst_qt_mux_generate_fast_start_file_path (GstQTMux * qtmux) -{ - gchar *tmp; - - g_free (qtmux->fast_start_file_path); - qtmux->fast_start_file_path = NULL; - - tmp = g_strdup_printf ("%s%d", "qtmux", g_random_int ()); - qtmux->fast_start_file_path = g_build_filename (g_get_tmp_dir (), tmp, NULL); - g_free (tmp); -} - -static void -gst_qt_mux_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec) -{ - GstQTMux *qtmux = GST_QT_MUX_CAST (object); - - GST_OBJECT_LOCK (qtmux); - switch (prop_id) { - case PROP_MOVIE_TIMESCALE: - qtmux->timescale = g_value_get_uint (value); - break; - case PROP_TRAK_TIMESCALE: - qtmux->trak_timescale = g_value_get_uint (value); - break; - case PROP_DO_CTTS: - qtmux->guess_pts = g_value_get_boolean (value); - break; - case PROP_DTS_METHOD: - qtmux->dts_method = g_value_get_enum (value); - break; - case PROP_FAST_START: - qtmux->fast_start = g_value_get_boolean (value); - break; - case PROP_FAST_START_TEMP_FILE: - g_free (qtmux->fast_start_file_path); - qtmux->fast_start_file_path = g_value_dup_string (value); - /* NULL means to generate a random one */ - if (!qtmux->fast_start_file_path) { - gst_qt_mux_generate_fast_start_file_path (qtmux); - } - break; - case PROP_MOOV_RECOV_FILE: - g_free (qtmux->moov_recov_file_path); - qtmux->moov_recov_file_path = g_value_dup_string (value); - break; - case PROP_FRAGMENT_DURATION: - qtmux->fragment_duration = g_value_get_uint (value); - break; - case PROP_STREAMABLE: - qtmux->streamable = g_value_get_boolean (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } - GST_OBJECT_UNLOCK (qtmux); -} - -static GstStateChangeReturn -gst_qt_mux_change_state (GstElement * element, GstStateChange transition) -{ - GstStateChangeReturn ret; - GstQTMux *qtmux = GST_QT_MUX_CAST (element); - - switch (transition) { - case GST_STATE_CHANGE_NULL_TO_READY: - break; - case GST_STATE_CHANGE_READY_TO_PAUSED: - gst_collect_pads_start (qtmux->collect); - qtmux->state = GST_QT_MUX_STATE_STARTED; - break; - case GST_STATE_CHANGE_PAUSED_TO_PLAYING: - break; - case GST_STATE_CHANGE_PAUSED_TO_READY: - gst_collect_pads_stop (qtmux->collect); - break; - default: - break; - } - - ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - - switch (transition) { - case GST_STATE_CHANGE_PLAYING_TO_PAUSED: - break; - case GST_STATE_CHANGE_PAUSED_TO_READY: - gst_qt_mux_reset (qtmux, TRUE); - break; - case GST_STATE_CHANGE_READY_TO_NULL: - break; - default: - break; - } - - return ret; -} - -gboolean -gst_qt_mux_register (GstPlugin * plugin) -{ - GTypeInfo typeinfo = { - sizeof (GstQTMuxClass), - (GBaseInitFunc) gst_qt_mux_base_init, - NULL, - (GClassInitFunc) gst_qt_mux_class_init, - NULL, - NULL, - sizeof (GstQTMux), - 0, - (GInstanceInitFunc) gst_qt_mux_init, - }; - static const GInterfaceInfo tag_setter_info = { - NULL, NULL, NULL - }; - GType type; - GstQTMuxFormat format; - GstQTMuxClassParams *params; - guint i = 0; - - GST_DEBUG_CATEGORY_INIT (gst_qt_mux_debug, "qtmux", 0, "QT Muxer"); - - GST_LOG ("Registering muxers"); - - while (TRUE) { - GstQTMuxFormatProp *prop; - - prop = &gst_qt_mux_format_list[i]; - format = prop->format; - if (format == GST_QT_MUX_FORMAT_NONE) - break; - - /* create a cache for these properties */ - params = g_new0 (GstQTMuxClassParams, 1); - params->prop = prop; - params->src_caps = gst_static_caps_get (&prop->src_caps); - params->video_sink_caps = gst_static_caps_get (&prop->video_sink_caps); - params->audio_sink_caps = gst_static_caps_get (&prop->audio_sink_caps); - - /* create the type now */ - type = g_type_register_static (GST_TYPE_ELEMENT, prop->type_name, &typeinfo, - 0); - g_type_set_qdata (type, GST_QT_MUX_PARAMS_QDATA, (gpointer) params); - g_type_add_interface_static (type, GST_TYPE_TAG_SETTER, &tag_setter_info); - - if (!gst_element_register (plugin, prop->name, GST_RANK_PRIMARY, type)) - return FALSE; - - i++; - } - - GST_LOG ("Finished registering muxers"); - - /* FIXME: ideally classification tag should be added and - registered in gstreamer core gsttaglist - */ - - GST_LOG ("Registering tags"); - - gst_tag_register (GST_TAG_3GP_CLASSIFICATION, GST_TAG_FLAG_META, - G_TYPE_STRING, GST_TAG_3GP_CLASSIFICATION, "content classification", - gst_tag_merge_use_first); - - GST_LOG ("Finished registering tags"); - - return TRUE; -} diff --git a/gst/qtmux/gstqtmux.h b/gst/qtmux/gstqtmux.h deleted file mode 100644 index 3a2cb492fe..0000000000 --- a/gst/qtmux/gstqtmux.h +++ /dev/null @@ -1,228 +0,0 @@ -/* Quicktime muxer plugin for GStreamer - * Copyright (C) 2008-2010 Thiago Santos - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* - * Unless otherwise indicated, Source Code is licensed under MIT license. - * See further explanation attached in License Statement (distributed in the file - * LICENSE). - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef __GST_QT_MUX_H__ -#define __GST_QT_MUX_H__ - -#include -#include - -#include "fourcc.h" -#include "atoms.h" -#include "atomsrecovery.h" -#include "gstqtmuxmap.h" - -G_BEGIN_DECLS - -#define GST_TYPE_QT_MUX (gst_qt_mux_get_type()) -#define GST_QT_MUX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_QT_MUX, GstQTMux)) -#define GST_QT_MUX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_QT_MUX, GstQTMux)) -#define GST_IS_QT_MUX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_QT_MUX)) -#define GST_IS_QT_MUX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_QT_MUX)) -#define GST_QT_MUX_CAST(obj) ((GstQTMux*)(obj)) - - -typedef struct _GstQTMux GstQTMux; -typedef struct _GstQTMuxClass GstQTMuxClass; -typedef struct _GstQTPad GstQTPad; - -/* - * GstQTPadPrepareBufferFunc - * - * Receives a buffer (takes ref) and returns a new buffer that should - * replace the passed one. - * - * Useful for when the pad/datatype needs some manipulation before - * being muxed. (Originally added for image/x-jpc support, for which buffers - * need to be wrapped into a isom box) - */ -typedef GstBuffer * (*GstQTPadPrepareBufferFunc) (GstQTPad * pad, - GstBuffer * buf, GstQTMux * qtmux); - -#define QTMUX_NO_OF_TS 10 - -struct _GstQTPad -{ - GstCollectData collect; /* we extend the CollectData */ - - /* fourcc id of stream */ - guint32 fourcc; - /* whether using format that have out of order buffers */ - gboolean is_out_of_order; - /* whether upstream provides valid PTS data */ - gboolean have_dts; - /* if not 0, track with constant sized samples, e.g. raw audio */ - guint sample_size; - /* make sync table entry */ - gboolean sync; - /* bitrates */ - guint32 avg_bitrate, max_bitrate; - - GstBuffer *last_buf; - /* dts of last_buf */ - GstClockTime last_dts; - - /* store the first timestamp for comparing with other streams and - * know if there are late streams */ - GstClockTime first_ts; - GstClockTime ts_entries[QTMUX_NO_OF_TS + 2]; - guint ts_n_entries; - GstBuffer *buf_entries[QTMUX_NO_OF_TS + 2]; - guint buf_head; - guint buf_tail; - - /* all the atom and chunk book-keeping is delegated here - * unowned/uncounted reference, parent MOOV owns */ - AtomTRAK *trak; - /* fragmented support */ - /* meta data book-keeping delegated here */ - AtomTRAF *traf; - /* fragment buffers */ - ATOM_ARRAY (GstBuffer *) fragment_buffers; - /* running fragment duration */ - gint64 fragment_duration; - /* optional fragment index book-keeping */ - AtomTFRA *tfra; - - /* if nothing is set, it won't be called */ - GstQTPadPrepareBufferFunc prepare_buf_func; -}; - -typedef enum _GstQTMuxState -{ - GST_QT_MUX_STATE_NONE, - GST_QT_MUX_STATE_STARTED, - GST_QT_MUX_STATE_DATA, - GST_QT_MUX_STATE_EOS -} GstQTMuxState; - -struct _GstQTMux -{ - GstElement element; - - GstPad *srcpad; - GstCollectPads *collect; - GSList *sinkpads; - - /* state */ - GstQTMuxState state; - - /* size of header (prefix, atoms (ftyp, mdat)) */ - guint64 header_size; - /* accumulated size of raw media data (a priori not including mdat header) */ - guint64 mdat_size; - /* position of mdat atom (for later updating) */ - guint64 mdat_pos; - - /* keep track of the largest chunk to fine-tune brands */ - GstClockTime longest_chunk; - - /* atom helper objects */ - AtomsContext *context; - AtomFTYP *ftyp; - AtomMOOV *moov; - GSList *extra_atoms; /* list of extra top-level atoms (e.g. UUID for xmp) - * Stored as AtomInfo structs */ - - /* fragmented file index */ - AtomMFRA *mfra; - - /* fast start */ - FILE *fast_start_file; - - /* moov recovery */ - FILE *moov_recov_file; - - /* fragment sequence */ - guint32 fragment_sequence; - - /* properties */ - guint32 timescale; - guint32 trak_timescale; - AtomsTreeFlavor flavor; - gboolean fast_start; - gboolean guess_pts; - gint dts_method; - gchar *fast_start_file_path; - gchar *moov_recov_file_path; - guint32 fragment_duration; - gboolean streamable; - - /* for collect pads event handling function */ - GstPadEventFunction collect_event; - - /* for request pad naming */ - guint video_pads, audio_pads; -}; - -struct _GstQTMuxClass -{ - GstElementClass parent_class; - - GstQTMuxFormat format; -}; - -/* type register helper struct */ -typedef struct _GstQTMuxClassParams -{ - GstQTMuxFormatProp *prop; - GstCaps *src_caps; - GstCaps *video_sink_caps; - GstCaps *audio_sink_caps; -} GstQTMuxClassParams; - -#define GST_QT_MUX_PARAMS_QDATA g_quark_from_static_string("qt-mux-params") - -GType gst_qt_mux_get_type (void); -gboolean gst_qt_mux_register (GstPlugin * plugin); - -/* FIXME: ideally classification tag should be added and - * registered in gstreamer core gsttaglist - * - * this tag is a string in the format: entityfourcc://table_num/content - * FIXME Shouldn't we add a field for 'language'? - */ -#define GST_TAG_3GP_CLASSIFICATION "classification" - -G_END_DECLS - -#endif /* __GST_QT_MUX_H__ */ diff --git a/gst/qtmux/gstqtmuxmap.c b/gst/qtmux/gstqtmuxmap.c deleted file mode 100644 index b8859b46ba..0000000000 --- a/gst/qtmux/gstqtmuxmap.c +++ /dev/null @@ -1,368 +0,0 @@ -/* Quicktime muxer plugin for GStreamer - * Copyright (C) 2008 Thiago Sousa Santos - * Copyright (C) 2008 Mark Nauwelaerts - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* - * Unless otherwise indicated, Source Code is licensed under MIT license. - * See further explanation attached in License Statement (distributed in the file - * LICENSE). - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#include "gstqtmuxmap.h" -#include "fourcc.h" -#include "ftypcc.h" - -/* static info related to various format */ - -#define COMMON_VIDEO_CAPS \ - "width = (int) [ 16, 4096 ], " \ - "height = (int) [ 16, 4096 ], " \ - "framerate = (fraction) [ 0, MAX ]" - -#define COMMON_VIDEO_CAPS_NO_FRAMERATE \ - "width = (int) [ 16, 4096 ], " \ - "height = (int) [ 16, 4096 ] " - -#define H263_CAPS \ - "video/x-h263, " \ - COMMON_VIDEO_CAPS - -#define H264_CAPS \ - "video/x-h264, " \ - "stream-format = (string) avc, " \ - COMMON_VIDEO_CAPS - -#define MPEG4V_CAPS \ - "video/mpeg, " \ - "mpegversion = (int) 4, "\ - "systemstream = (boolean) false, " \ - COMMON_VIDEO_CAPS "; " \ - "video/x-divx, " \ - "divxversion = (int) 5, "\ - COMMON_VIDEO_CAPS - -#define SVQ_CAPS \ - "video/x-svq, " \ - "svqversion = (int) 3, " \ - COMMON_VIDEO_CAPS - -#define COMMON_AUDIO_CAPS(c, r) \ - "channels = (int) [ 1, " G_STRINGIFY (c) " ], " \ - "rate = (int) [ 1, " G_STRINGIFY (r) " ]" - -#define PCM_CAPS \ - "audio/x-raw-int, " \ - "width = (int) 8, " \ - "depth = (int) 8, " \ - COMMON_AUDIO_CAPS (2, MAX) ", " \ - "signed = (boolean) { true, false }; " \ - "audio/x-raw-int, " \ - "width = (int) 16, " \ - "depth = (int) 16, " \ - "endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }, " \ - COMMON_AUDIO_CAPS (2, MAX) ", " \ - "signed = (boolean) true " \ - -#define PCM_CAPS_FULL \ - PCM_CAPS "; " \ - "audio/x-raw-int, " \ - "width = (int) 24, " \ - "depth = (int) 24, " \ - "endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }, " \ - COMMON_AUDIO_CAPS (2, MAX) ", " \ - "signed = (boolean) true; " \ - "audio/x-raw-int, " \ - "width = (int) 32, " \ - "depth = (int) 32, " \ - "endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }, " \ - COMMON_AUDIO_CAPS (2, MAX) ", " \ - "signed = (boolean) true " - -#define MP3_CAPS \ - "audio/mpeg, " \ - "mpegversion = (int) 1, " \ - "layer = (int) 3, " \ - COMMON_AUDIO_CAPS (2, MAX) - -#define AAC_CAPS \ - "audio/mpeg, " \ - "mpegversion = (int) 4, " \ - "stream-format = (string) raw, " \ - COMMON_AUDIO_CAPS (8, MAX) - -#define AMR_CAPS \ - "audio/AMR, " \ - "rate = (int) 8000, " \ - "channels = [ 1, 2 ]; " \ - "audio/AMR-WB, " \ - "rate = (int) 16000, " \ - "channels = [ 1, 2 ] " - -#define ADPCM_CAPS \ - "audio/x-adpcm, " \ - "layout = (string)dvi, " \ - "block_align = (int)[64, 8096], " \ - COMMON_AUDIO_CAPS(2, MAX) - -#define ALAC_CAPS \ - "audio/x-alac, " \ - COMMON_AUDIO_CAPS(2, MAX) - -/* FIXME 0.11 - take a look at bugs #580005 and #340375 */ -GstQTMuxFormatProp gst_qt_mux_format_list[] = { - /* original QuickTime format; see Apple site (e.g. qtff.pdf) */ - { - GST_QT_MUX_FORMAT_QT, - "qtmux", - "QuickTime", - "GstQTMux", - GST_STATIC_CAPS ("video/quicktime, variant = (string) apple"), - GST_STATIC_CAPS ("video/x-raw-rgb, " - COMMON_VIDEO_CAPS "; " - "video/x-raw-yuv, " - "format = (fourcc) UYVY, " - COMMON_VIDEO_CAPS "; " - MPEG4V_CAPS "; " - H263_CAPS "; " - H264_CAPS "; " - SVQ_CAPS "; " - "video/x-dv, " - "systemstream = (boolean) false, " - COMMON_VIDEO_CAPS "; " - "image/jpeg, " - COMMON_VIDEO_CAPS_NO_FRAMERATE "; " - "video/x-vp8, " - COMMON_VIDEO_CAPS "; " "video/x-qt-part, " COMMON_VIDEO_CAPS), - GST_STATIC_CAPS (PCM_CAPS_FULL "; " - MP3_CAPS " ; " - AAC_CAPS " ; " - ADPCM_CAPS " ; " - "audio/x-alaw, " COMMON_AUDIO_CAPS (2, MAX) "; " - AMR_CAPS " ; " ALAC_CAPS) - } - , - /* ISO 14496-14: mp42 as ISO base media extension - * (supersedes original ISO 144996-1 mp41) */ - { - GST_QT_MUX_FORMAT_MP4, - "mp4mux", - "MP4", - "GstMP4Mux", - GST_STATIC_CAPS ("video/quicktime, variant = (string) iso"), - GST_STATIC_CAPS (MPEG4V_CAPS "; " H264_CAPS ";" - "video/x-mp4-part," COMMON_VIDEO_CAPS), - GST_STATIC_CAPS (MP3_CAPS "; " AAC_CAPS " ; " ALAC_CAPS) - } - , - /* Microsoft Smooth Streaming fmp4/isml */ - /* TODO add WMV/WMA support */ - { - GST_QT_MUX_FORMAT_ISML, - "ismlmux", - "ISML", - "GstISMLMux", - GST_STATIC_CAPS ("video/quicktime, variant = (string) iso"), - GST_STATIC_CAPS (MPEG4V_CAPS "; " H264_CAPS), - GST_STATIC_CAPS (MP3_CAPS "; " AAC_CAPS) - } - , - /* 3GPP Technical Specification 26.244 V7.3.0 - * (extended in 3GPP2 File Formats for Multimedia Services) */ - { - GST_QT_MUX_FORMAT_3GP, - "gppmux", - "3GPP", - "GstGPPMux", - GST_STATIC_CAPS ("video/quicktime, variant = (string) 3gpp"), - GST_STATIC_CAPS (H263_CAPS "; " MPEG4V_CAPS "; " H264_CAPS), - GST_STATIC_CAPS (AMR_CAPS "; " MP3_CAPS "; " AAC_CAPS) - } - , - /* ISO 15444-3: Motion-JPEG-2000 (also ISO base media extension) */ - { - GST_QT_MUX_FORMAT_MJ2, - "mj2mux", - "MJ2", - "GstMJ2Mux", - GST_STATIC_CAPS ("video/mj2"), - GST_STATIC_CAPS ("image/x-j2c, " COMMON_VIDEO_CAPS "; " - "image/x-jpc, " COMMON_VIDEO_CAPS), - GST_STATIC_CAPS (PCM_CAPS) - } - , - { - GST_QT_MUX_FORMAT_NONE, - } - , -}; - -/* pretty static, but may turn out needed a few times */ -AtomsTreeFlavor -gst_qt_mux_map_format_to_flavor (GstQTMuxFormat format) -{ - if (format == GST_QT_MUX_FORMAT_QT) - return ATOMS_TREE_FLAVOR_MOV; - else if (format == GST_QT_MUX_FORMAT_3GP) - return ATOMS_TREE_FLAVOR_3GP; - else if (format == GST_QT_MUX_FORMAT_ISML) - return ATOMS_TREE_FLAVOR_ISML; - else - return ATOMS_TREE_FLAVOR_ISOM; -} - -static void -gst_qt_mux_map_check_tracks (AtomMOOV * moov, gint * _video, gint * _audio, - gboolean * _has_h264) -{ - GList *it; - gint video = 0, audio = 0; - gboolean has_h264 = FALSE; - - for (it = moov->traks; it != NULL; it = g_list_next (it)) { - AtomTRAK *track = it->data; - - if (track->is_video) { - video++; - if (track->is_h264) - has_h264 = TRUE; - } else - audio++; - } - - if (_video) - *_video = video; - if (_audio) - *_audio = audio; - if (_has_h264) - *_has_h264 = has_h264; -} - -/* pretty static, but possibly dynamic format info */ - -/* notes: - * - avc1 brand is not used, since the specific extensions indicated by it - * are not used (e.g. sample groupings, etc) - * - TODO: maybe even more 3GPP brand fine-tuning ?? - * (but that might need ftyp rewriting at the end) */ -void -gst_qt_mux_map_format_to_header (GstQTMuxFormat format, GstBuffer ** _prefix, - guint32 * _major, guint32 * _version, GList ** _compatible, AtomMOOV * moov, - GstClockTime longest_chunk, gboolean faststart) -{ - static guint32 qt_brands[] = { 0 }; - static guint32 mp4_brands[] = { FOURCC_mp41, FOURCC_isom, FOURCC_iso2, 0 }; - static guint32 isml_brands[] = { FOURCC_iso2, 0 }; - static guint32 gpp_brands[] = { FOURCC_isom, FOURCC_iso2, 0 }; - static guint32 mjp2_brands[] = { FOURCC_isom, FOURCC_iso2, 0 }; - static guint8 mjp2_prefix[] = - { 0, 0, 0, 12, 'j', 'P', ' ', ' ', 0x0D, 0x0A, 0x87, 0x0A }; - guint32 *comp = NULL; - guint32 major = 0, version = 0; - GstBuffer *prefix = NULL; - GList *result = NULL; - - g_return_if_fail (_prefix != NULL); - g_return_if_fail (_major != NULL); - g_return_if_fail (_version != NULL); - g_return_if_fail (_compatible != NULL); - - switch (format) { - case GST_QT_MUX_FORMAT_QT: - major = FOURCC_qt__; - comp = qt_brands; - version = 0x20050300; - break; - case GST_QT_MUX_FORMAT_MP4: - major = FOURCC_mp42; - comp = mp4_brands; - break; - case GST_QT_MUX_FORMAT_ISML: - major = FOURCC_isml; - comp = isml_brands; - break; - case GST_QT_MUX_FORMAT_3GP: - { - gint video, audio; - gboolean has_h264; - - gst_qt_mux_map_check_tracks (moov, &video, &audio, &has_h264); - /* only track restriction really matters for Basic Profile */ - if (video <= 1 && audio <= 1) { - /* it seems only newer spec knows about H264 */ - major = has_h264 ? FOURCC_3gp6 : FOURCC_3gp4; - version = has_h264 ? 0x100 : 0x200; - } else { - major = FOURCC_3gg6; - version = 0x100; - } - comp = gpp_brands; - - /* - * We assume that we have chunks in dts order - */ - if (faststart && longest_chunk <= GST_SECOND) { - /* add progressive download profile */ - result = g_list_append (result, GUINT_TO_POINTER (FOURCC_3gr6)); - } - break; - } - case GST_QT_MUX_FORMAT_MJ2: - major = FOURCC_mjp2; - comp = mjp2_brands; - version = 0; - prefix = gst_buffer_new_and_alloc (sizeof (mjp2_prefix)); - memcpy (GST_BUFFER_DATA (prefix), mjp2_prefix, GST_BUFFER_SIZE (prefix)); - break; - default: - g_assert_not_reached (); - break; - } - - /* convert list to list, hm */ - while (comp && *comp != 0) { - /* order matters over efficiency */ - result = g_list_append (result, GUINT_TO_POINTER (*comp)); - comp++; - } - - *_major = major; - *_version = version; - *_prefix = prefix; - *_compatible = result; - - /* TODO 3GPP may include mp42 as compatible if applicable */ - /* TODO 3GPP major brand 3gp7 if at most 1 video and audio track */ -} diff --git a/gst/qtmux/gstqtmuxmap.h b/gst/qtmux/gstqtmuxmap.h deleted file mode 100644 index 767d62a4a7..0000000000 --- a/gst/qtmux/gstqtmuxmap.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Quicktime muxer plugin for GStreamer - * Copyright (C) 2008 Thiago Sousa Santos - * Copyright (C) 2008 Mark Nauwelaerts - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* - * Unless otherwise indicated, Source Code is licensed under MIT license. - * See further explanation attached in License Statement (distributed in the file - * LICENSE). - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef __GST_QT_MUX_MAP_H__ -#define __GST_QT_MUX_MAP_H__ - -#include "atoms.h" - -#include -#include - -typedef enum _GstQTMuxFormat -{ - GST_QT_MUX_FORMAT_NONE = 0, - GST_QT_MUX_FORMAT_QT, - GST_QT_MUX_FORMAT_MP4, - GST_QT_MUX_FORMAT_3GP, - GST_QT_MUX_FORMAT_MJ2, - GST_QT_MUX_FORMAT_ISML -} GstQTMuxFormat; - -typedef struct _GstQTMuxFormatProp -{ - GstQTMuxFormat format; - const gchar *name; - const gchar *long_name; - const gchar *type_name; - GstStaticCaps src_caps; - GstStaticCaps video_sink_caps; - GstStaticCaps audio_sink_caps; -} GstQTMuxFormatProp; - -extern GstQTMuxFormatProp gst_qt_mux_format_list[]; - -void gst_qt_mux_map_format_to_header (GstQTMuxFormat format, GstBuffer ** _prefix, - guint32 * _major, guint32 * verson, - GList ** _compatible, AtomMOOV * moov, - GstClockTime longest_chunk, - gboolean faststart); - -AtomsTreeFlavor gst_qt_mux_map_format_to_flavor (GstQTMuxFormat format); - -#endif /* __GST_QT_MUX_MAP_H__ */ diff --git a/gst/qtmux/gstqtmuxplugin.c b/gst/qtmux/gstqtmuxplugin.c deleted file mode 100644 index 440b9808a9..0000000000 --- a/gst/qtmux/gstqtmuxplugin.c +++ /dev/null @@ -1,67 +0,0 @@ -/* Quicktime muxer plugin for GStreamer - * Copyright (C) 2008-2010 Thiago Santos - * Copyright (C) 2008 Mark Nauwelaerts - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* - * Unless otherwise indicated, Source Code is licensed under MIT license. - * See further explanation attached in License Statement (distributed in the file - * LICENSE). - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "gstqtmux.h" -#include "gstqtmoovrecover.h" - -static gboolean -gst_qt_mux_plugin_init (GstPlugin * plugin) -{ - if (!gst_qt_mux_register (plugin)) - return FALSE; - if (!gst_qt_moov_recover_register (plugin)) - return FALSE; - - return TRUE; -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "qtmux", - "Quicktime Muxer plugin", - gst_qt_mux_plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, - GST_PACKAGE_ORIGIN); diff --git a/gst/qtmux/properties.c b/gst/qtmux/properties.c deleted file mode 100644 index 8dafb2e214..0000000000 --- a/gst/qtmux/properties.c +++ /dev/null @@ -1,210 +0,0 @@ -/* Quicktime muxer plugin for GStreamer - * Copyright (C) 2008 Thiago Sousa Santos - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* - * Unless otherwise indicated, Source Code is licensed under MIT license. - * See further explanation attached in License Statement (distributed in the file - * LICENSE). - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#include "properties.h" - -/* if needed, re-allocate buffer to ensure size bytes can be written into it - * at offset */ -void -prop_copy_ensure_buffer (guint8 ** buffer, guint64 * bsize, guint64 * offset, - guint64 size) -{ - if (buffer && *bsize - *offset < size) { - *bsize += size + 10 * 1024; - *buffer = g_realloc (*buffer, *bsize); - } -} - -static guint64 -copy_func (void *prop, guint size, guint8 ** buffer, guint64 * bsize, - guint64 * offset) -{ - if (buffer) { - prop_copy_ensure_buffer (buffer, bsize, offset, size); - memcpy (*buffer + *offset, prop, size); - } - *offset += size; - return size; -} - -#define INT_ARRAY_COPY_FUNC_FAST(name, datatype) \ -guint64 prop_copy_ ## name ## _array (datatype *prop, guint size, \ - guint8 ** buffer, guint64 * bsize, guint64 * offset) { \ - return copy_func (prop, sizeof (datatype) * size, buffer, bsize, offset);\ -} - -#define INT_ARRAY_COPY_FUNC(name, datatype) \ -guint64 prop_copy_ ## name ## _array (datatype *prop, guint size, \ - guint8 ** buffer, guint64 * bsize, guint64 * offset) { \ - guint i; \ - \ - for (i = 0; i < size; i++) { \ - prop_copy_ ## name (prop[i], buffer, bsize, offset); \ - } \ - return sizeof (datatype) * size; \ -} - -/* INTEGERS */ -guint64 -prop_copy_uint8 (guint8 prop, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - return copy_func (&prop, sizeof (guint8), buffer, size, offset); -} - -guint64 -prop_copy_uint16 (guint16 prop, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - prop = GUINT16_TO_BE (prop); - return copy_func (&prop, sizeof (guint16), buffer, size, offset); -} - -guint64 -prop_copy_uint32 (guint32 prop, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - prop = GUINT32_TO_BE (prop); - return copy_func (&prop, sizeof (guint32), buffer, size, offset); -} - -guint64 -prop_copy_uint64 (guint64 prop, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - prop = GUINT64_TO_BE (prop); - return copy_func (&prop, sizeof (guint64), buffer, size, offset); -} - -guint64 -prop_copy_int32 (gint32 prop, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - prop = GINT32_TO_BE (prop); - return copy_func (&prop, sizeof (guint32), buffer, size, offset); -} - -/* uint8 can use direct copy in any case, and may be used for large quantity */ -INT_ARRAY_COPY_FUNC_FAST (uint8, guint8); -/* not used in large quantity anyway */ -INT_ARRAY_COPY_FUNC (uint16, guint16); -INT_ARRAY_COPY_FUNC (uint32, guint32); -INT_ARRAY_COPY_FUNC (uint64, guint64); - -/* FOURCC */ -guint64 -prop_copy_fourcc (guint32 prop, guint8 ** buffer, guint64 * size, - guint64 * offset) -{ - prop = GINT32_TO_LE (prop); - return copy_func (&prop, sizeof (guint32), buffer, size, offset); -} - -INT_ARRAY_COPY_FUNC (fourcc, guint32); - -/** - * prop_copy_fixed_size_string: - * @string: the string to be copied - * @str_size: size of the string - * @buffer: the array to copy the string to - * @offset: the position in the buffer array. - * This value is updated to the point right after the copied string. - * - * Copies a string of bytes without placing its size at the beginning. - * - * Returns: the number of bytes copied - */ -guint64 -prop_copy_fixed_size_string (guint8 * string, guint str_size, guint8 ** buffer, - guint64 * size, guint64 * offset) -{ - return copy_func (string, str_size * sizeof (guint8), buffer, size, offset); -} - -/** - * prop_copy_size_string: - * - * @string: the string to be copied - * @str_size: size of the string - * @buffer: the array to copy the string to - * @offset: the position in the buffer array. - * This value is updated to the point right after the copied string. - * - * Copies a string and its size to an array. Example: - * string = 'abc\0' - * result in the array: [3][a][b][c] (each [x] represents a position) - * - * Returns: the number of bytes copied - */ -guint64 -prop_copy_size_string (guint8 * string, guint str_size, guint8 ** buffer, - guint64 * size, guint64 * offset) -{ - guint64 original_offset = *offset; - - prop_copy_uint8 (str_size, buffer, size, offset); - prop_copy_fixed_size_string (string, str_size, buffer, size, offset); - return *offset - original_offset; -} - -/** - * prop_copy_null_terminated_string: - * @string: the string to be copied - * @buffer: the array to copy the string to - * @offset: the position in the buffer array. - * This value is updated to the point right after the copied string. - * - * Copies a string including its null terminating char to an array. - * - * Returns: the number of bytes copied - */ -guint64 -prop_copy_null_terminated_string (gchar * string, guint8 ** buffer, - guint64 * size, guint64 * offset) -{ - guint64 original_offset = *offset; - guint len = strlen (string); - - prop_copy_fixed_size_string ((guint8 *) string, len, buffer, size, offset); - prop_copy_uint8 ('\0', buffer, size, offset); - return *offset - original_offset; -} diff --git a/gst/qtmux/properties.h b/gst/qtmux/properties.h deleted file mode 100644 index ad67e0da03..0000000000 --- a/gst/qtmux/properties.h +++ /dev/null @@ -1,87 +0,0 @@ -/* Quicktime muxer plugin for GStreamer - * Copyright (C) 2008 Thiago Sousa Santos - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -/* - * Unless otherwise indicated, Source Code is licensed under MIT license. - * See further explanation attached in License Statement (distributed in the file - * LICENSE). - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef __PROPERTIES_H__ -#define __PROPERTIES_H__ - -#include -#include - -/** - * Functions for copying atoms properties. - * - * All of them receive, as the input, the property to be copied, the destination - * buffer, and a pointer to an offset in the destination buffer to copy to the right place. - * This offset will be updated to the new value (offset + copied_size) - * The functions return the size of the property that has been copied or 0 - * if it couldn't copy. - */ - -void prop_copy_ensure_buffer (guint8 ** buffer, guint64 * bsize, guint64 * offset, guint64 size); - -guint64 prop_copy_uint8 (guint8 prop, guint8 **buffer, guint64 *size, guint64 *offset); -guint64 prop_copy_uint16 (guint16 prop, guint8 **buffer, guint64 *size, guint64 *offset); -guint64 prop_copy_uint32 (guint32 prop, guint8 **buffer, guint64 *size, guint64 *offset); -guint64 prop_copy_uint64 (guint64 prop, guint8 **buffer, guint64 *size, guint64 *offset); - -guint64 prop_copy_int32 (gint32 prop, guint8 **buffer, guint64 *size, guint64 *offset); - -guint64 prop_copy_uint8_array (guint8 *prop, guint size, - guint8 **buffer, guint64 *bsize, guint64 *offset); -guint64 prop_copy_uint16_array (guint16 *prop, guint size, - guint8 **buffer, guint64 *bsize, guint64 *offset); -guint64 prop_copy_uint32_array (guint32 *prop, guint size, - guint8 **buffer, guint64 *bsize, guint64 *offset); -guint64 prop_copy_uint64_array (guint64 *prop, guint size, - guint8 **buffer, guint64 *bsize, guint64 *offset); - -guint64 prop_copy_fourcc (guint32 prop, guint8 **buffer, guint64 *size, guint64 *offset); -guint64 prop_copy_fourcc_array (guint32 *prop, guint size, - guint8 **buffer, guint64 *bsize, guint64 *offset); -guint64 prop_copy_fixed_size_string (guint8 *string, guint str_size, - guint8 **buffer, guint64 *size, guint64 *offset); -guint64 prop_copy_size_string (guint8 *string, guint str_size, - guint8 **buffer, guint64 *size, guint64 *offset); -guint64 prop_copy_null_terminated_string (gchar *string, - guint8 **buffer, guint64 *size, guint64 *offset); - -#endif /* __PROPERTIES_H__ */ diff --git a/gst/rawparse/Makefile.am b/gst/rawparse/Makefile.am index 491fdd6351..ac0aadc7d4 100644 --- a/gst/rawparse/Makefile.am +++ b/gst/rawparse/Makefile.am @@ -22,3 +22,17 @@ noinst_HEADERS = \ gstaudioparse.h \ gstrawparse.h \ gstvideoparse.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstrawparse -:SHARED libgstrawparse \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstrawparse_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstrawparse_la_CFLAGS) \ + -:LDFLAGS $(libgstrawparse_la_LDFLAGS) \ + $(libgstrawparse_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/rtpmux/Makefile.am b/gst/rtpmux/Makefile.am index b77deeb814..d28d44d77f 100644 --- a/gst/rtpmux/Makefile.am +++ b/gst/rtpmux/Makefile.am @@ -11,3 +11,16 @@ libgstrtpmux_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstrtpmux.h gstrtpdtmfmux.h +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstrtpmux -:SHARED libgstrtpmux \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstrtpmux_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstrtpmux_la_CFLAGS) \ + -:LDFLAGS $(libgstrtpmux_la_LDFLAGS) \ + $(libgstrtpmux_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ \ No newline at end of file diff --git a/gst/rtpvp8/Makefile.am b/gst/rtpvp8/Makefile.am index 05bf5d7c4c..ef7425f1d7 100644 --- a/gst/rtpvp8/Makefile.am +++ b/gst/rtpvp8/Makefile.am @@ -13,3 +13,17 @@ libgstrtpvp8_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstrtp-@GST_MAJORMINOR@ \ $(GST_BASE_LIBS) $(GST_LIBS) libgstrtpvp8_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstrtpvp8_la_LIBTOOLFLAGS = --tag=disable-static + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstrtpvp8 -:SHARED libgstrtpvp8 \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstrtpvp8_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstrtpvp8_la_CFLAGS) \ + -:LDFLAGS $(libgstrtpvp8_la_LDFLAGS) \ + $(libgstrtpvp8_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/scaletempo/Makefile.am b/gst/scaletempo/Makefile.am index c54502b688..092a7eb05c 100644 --- a/gst/scaletempo/Makefile.am +++ b/gst/scaletempo/Makefile.am @@ -12,3 +12,17 @@ libgstscaletempoplugin_la_LIBTOOLFLAGS = --tag=disable-static # headers we need but don't want installed noinst_HEADERS = gstscaletempo.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstscaletempo -:SHARED libgstscaletempo \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstscaletempo_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstscaletempo_la_CFLAGS) \ + -:LDFLAGS $(libgstscaletempo_la_LDFLAGS) \ + $(libgstscaletempo_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/scaletempo/gstscaletempo.c b/gst/scaletempo/gstscaletempo.c index 5f64b41861..ba82a85823 100644 --- a/gst/scaletempo/gstscaletempo.c +++ b/gst/scaletempo/gstscaletempo.c @@ -554,8 +554,13 @@ gst_scaletempo_sink_event (GstBaseTransform * trans, GstEvent * event) applied_rate = priv->scale; rate = 1.0; //gst_event_unref (event); + + if (stop != -1) { + stop = (stop - start) / applied_rate + start; + } + event = gst_event_new_new_segment_full (update, rate, applied_rate, - format, start, (stop - start) / applied_rate + start, position); + format, start, stop, position); gst_pad_push_event (GST_BASE_TRANSFORM_SRC_PAD (trans), event); return FALSE; } diff --git a/gst/sdi/Makefile.am b/gst/sdi/Makefile.am new file mode 100644 index 0000000000..eb30f17dec --- /dev/null +++ b/gst/sdi/Makefile.am @@ -0,0 +1,27 @@ +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 = --tag=disable-static + +noinst_HEADERS = gstsdidemux.h gstsdimux.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstsdi -:SHARED libgstsdi \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstsdi_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstsdi_la_CFLAGS) \ + -:LDFLAGS $(libgstsdi_la_LDFLAGS) \ + $(libgstsdi_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ \ No newline at end of file diff --git a/gst/sdi/gstsdi.c b/gst/sdi/gstsdi.c new file mode 100644 index 0000000000..30101ebaf0 --- /dev/null +++ b/gst/sdi/gstsdi.c @@ -0,0 +1,44 @@ +/* GStreamer + * Copyright (C) 2010 David Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "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 new file mode 100644 index 0000000000..1636b5a94f --- /dev/null +++ b/gst/sdi/gstsdidemux.c @@ -0,0 +1,541 @@ +/* GStreamer + * Copyright (C) 2010 David Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +/** + * SECTION:element-gstsdidemux + * + * The gstsdidemux element does FIXME stuff. + * + * + * Example launch line + * |[ + * gst-launch -v fakesrc ! gstsdidemux ! FIXME ! fakesink + * ]| + * FIXME Describe what the pipeline does. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#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_pad_template (element_class, + gst_static_pad_template_get (&gst_sdi_demux_src_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_sdi_demux_sink_template)); + + gst_element_class_set_details_simple (element_class, + "SDI Demuxer", + "Demuxer", + "Demultiplex SDI streams into raw audio and video", + "David Schleef "); +} + +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); + output_data = GST_BUFFER_DATA (sdidemux->output_buffer); + 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); + guint8 *output_data; + 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); + } + output_data = GST_BUFFER_DATA (sdidemux->output_buffer); + +#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; + 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 TRUE; +} + +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 TRUE; +} diff --git a/gst/sdi/gstsdidemux.h b/gst/sdi/gstsdidemux.h new file mode 100644 index 0000000000..5c6425ad24 --- /dev/null +++ b/gst/sdi/gstsdidemux.h @@ -0,0 +1,76 @@ +/* GStreamer + * Copyright (C) 2010 REAL_NAME + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _GST_SDI_DEMUX_H_ +#define _GST_SDI_DEMUX_H_ + +#include +#include + +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 new file mode 100644 index 0000000000..779add42a1 --- /dev/null +++ b/gst/sdi/gstsdimux.c @@ -0,0 +1,312 @@ +/* GStreamer + * Copyright (C) 2010 David Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +/** + * SECTION:element-gstsdimux + * + * The gstsdimux element does FIXME stuff. + * + * + * Example launch line + * |[ + * gst-launch -v fakesrc ! gstsdimux ! FIXME ! fakesink + * ]| + * FIXME Describe what the pipeline does. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#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_pad_template (element_class, + gst_static_pad_template_get (&gst_sdi_mux_src_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_sdi_mux_sink_template)); + + gst_element_class_set_details_simple (element_class, "SDI Muxer", + "Muxer", + "Multiplex raw audio and video into SDI", + "David Schleef "); +} + +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 TRUE; +} + +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 TRUE; +} diff --git a/gst/sdi/gstsdimux.h b/gst/sdi/gstsdimux.h new file mode 100644 index 0000000000..5955810d51 --- /dev/null +++ b/gst/sdi/gstsdimux.h @@ -0,0 +1,54 @@ +/* GStreamer + * Copyright (C) 2010 REAL_NAME + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _GST_SDI_MUX_H_ +#define _GST_SDI_MUX_H_ + +#include +#include + +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/sdp/Makefile.am b/gst/sdp/Makefile.am index 94ea2bfdc5..77a1a9725f 100644 --- a/gst/sdp/Makefile.am +++ b/gst/sdp/Makefile.am @@ -11,3 +11,17 @@ libgstsdpelem_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstsdpelem_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstsdpdemux.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstsdp -:SHARED libgstsdp \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstsdp_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstsdp_la_CFLAGS) \ + -:LDFLAGS $(libgstsdp_la_LDFLAGS) \ + $(libgstsdp_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/segmentclip/Makefile.am b/gst/segmentclip/Makefile.am index f87feee0ea..82540cbc09 100644 --- a/gst/segmentclip/Makefile.am +++ b/gst/segmentclip/Makefile.am @@ -9,3 +9,16 @@ libgstsegmentclip_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gstsegmentclip.h gstaudiosegmentclip.h gstvideosegmentclip.h +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstsegmentclip -:SHARED libgstsegmentclip \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstsegmentclip_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstsegmentclip_la_CFLAGS) \ + -:LDFLAGS $(libgstsegmentclip_la_LDFLAGS) \ + $(libgstsegmentclip_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ \ No newline at end of file diff --git a/gst/segmentclip/gstsegmentclip.c b/gst/segmentclip/gstsegmentclip.c index f4aae4f531..d328a28ebc 100644 --- a/gst/segmentclip/gstsegmentclip.c +++ b/gst/segmentclip/gstsegmentclip.c @@ -271,7 +271,7 @@ gst_segment_clip_event (GstPad * pad, GstEvent * event) GST_LOG_OBJECT (pad, "Got %s event", GST_EVENT_TYPE_NAME (event)); otherpad = (pad == self->srcpad) ? self->sinkpad : self->srcpad; - ret = gst_pad_push_event (otherpad, event); + ret = gst_pad_push_event (otherpad, gst_event_ref (event)); if (ret) { switch (GST_EVENT_TYPE (event)) { @@ -300,6 +300,8 @@ gst_segment_clip_event (GstPad * pad, GstEvent * event) } } + gst_event_unref (event); + gst_object_unref (self); return ret; } diff --git a/gst/siren/Makefile.am b/gst/siren/Makefile.am index 44ed7d8adc..2be9ede49a 100644 --- a/gst/siren/Makefile.am +++ b/gst/siren/Makefile.am @@ -15,3 +15,16 @@ libgstsiren_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstrtp-@GST_MAJORMINOR@ \ libgstsiren_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstsiren_la_LIBTOOLFLAGS = --tag=disable-static +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstsiren -:SHARED libgstsiren \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstsiren_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstsiren_la_CFLAGS) \ + -:LDFLAGS $(libgstsiren_la_LDFLAGS) \ + $(libgstsiren_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ \ No newline at end of file diff --git a/gst/speed/Makefile.am b/gst/speed/Makefile.am index 07ff3fd2c2..903fa011f2 100644 --- a/gst/speed/Makefile.am +++ b/gst/speed/Makefile.am @@ -16,3 +16,17 @@ noinst_HEADERS = gstspeed.h #demo_mp3_SOURCES = demo-mp3.c #demo_mp3_CFLAGS = $(GTK_CFLAGS) $(GST_CFLAGS) #demo_mp3_LDFLAGS = $(GST_LIBS) $(GTK_LIBS) + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstspeed -:SHARED libgstspeed \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstspeed_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstspeed_la_CFLAGS) \ + -:LDFLAGS $(libgstspeed_la_LDFLAGS) \ + $(libgstspeed_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/stereo/Makefile.am b/gst/stereo/Makefile.am index dd0f550aa1..ee5b5dca42 100644 --- a/gst/stereo/Makefile.am +++ b/gst/stereo/Makefile.am @@ -10,3 +10,17 @@ libgststereo_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gststereo.h EXTRA_DIST = + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgststereo -:SHARED libgststereo \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgststereo_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgststereo_la_CFLAGS) \ + -:LDFLAGS $(libgststereo_la_LDFLAGS) \ + $(libgststereo_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/subenc/Makefile.am b/gst/subenc/Makefile.am index b011d916dc..a55a99d8d0 100644 --- a/gst/subenc/Makefile.am +++ b/gst/subenc/Makefile.am @@ -9,3 +9,17 @@ libgstsubenc_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = \ gstsrtenc.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstsubenc -:SHARED libgstsubenc \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstsubenc_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstsubenc_la_CFLAGS) \ + -:LDFLAGS $(libgstsubenc_la_LDFLAGS) \ + $(libgstsubenc_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/tta/Makefile.am b/gst/tta/Makefile.am index ce4da254e7..fdc9feb994 100644 --- a/gst/tta/Makefile.am +++ b/gst/tta/Makefile.am @@ -12,3 +12,16 @@ libgsttta_la_LIBADD = $(GST_LIBS) $(LIBM) libgsttta_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgsttta_la_LIBTOOLFLAGS = --tag=disable-static +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgsttta -:SHARED libgsttta \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgsttta_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgsttta_la_CFLAGS) \ + -:LDFLAGS $(libgsttta_la_LDFLAGS) \ + $(libgsttta_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ \ No newline at end of file diff --git a/gst/videofilters/Makefile.am b/gst/videofilters/Makefile.am index 0f092eb263..0627ef4c70 100644 --- a/gst/videofilters/Makefile.am +++ b/gst/videofilters/Makefile.am @@ -4,7 +4,10 @@ plugin_LTLIBRARIES = libgstvideofiltersbad.la #include $(top_srcdir)/common/orc.mak libgstvideofiltersbad_la_SOURCES = \ + gstvideofilter2.c \ + gstvideofilter2.h \ gstzebrastripe.c \ + gstscenechange.c \ gstvideofiltersbad.c #nodist_libgstvideofiltersbad_la_SOURCES = $(ORC_NODIST_SOURCES) libgstvideofiltersbad_la_CFLAGS = \ @@ -21,6 +24,19 @@ libgstvideofiltersbad_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstvideofiltersbad_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = \ - gstzebrastripe.h - + gstzebrastripe.h \ + gstscenechange.h +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstvideofilters -:SHARED libgstvideofilters \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstvideofilters_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstvideofilters_la_CFLAGS) \ + -:LDFLAGS $(libgstvideofilters_la_LDFLAGS) \ + $(libgstvideofilters_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/videofilters/gstscenechange.c b/gst/videofilters/gstscenechange.c new file mode 100644 index 0000000000..0cfb8b2746 --- /dev/null +++ b/gst/videofilters/gstscenechange.c @@ -0,0 +1,445 @@ +/* GStreamer + * Copyright (C) 2011 Entropy Wave Inc + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received 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-gstscenechange + * + * The scenechange element detects scene changes (also known as shot + * changes) in a video stream, and sends a signal when this occurs. + * Applications can listen to this signal and make changes to the + * pipeline such as cutting the stream. In addition, whenever a + * scene change is detected, a custom downstream "GstForceKeyUnit" + * event is sent to downstream elements. Most video encoder elements + * will insert synchronization points into the stream when this event + * is received. When used with a tee element, the scenechange element + * can be used to align the synchronization points among multiple + * video encoders, which is useful for segmented streaming. + * + * The scenechange element does not work with compressed video. + * + * + * Example launch line + * |[ + * gst-launch -v filesrc location=some_file.ogv ! decodebin ! + * scenechange ! theoraenc ! fakesink + * ]| + * + */ +/* + * The algorithm used for scene change detection is a modification + * of Jim Easterbrook's shot change detector. I'm not aware of a + * research paper, but the code I got the idea from is here: + * http://sourceforge.net/projects/shot-change/ + * + * The method is relatively simple. Calculate the sum of absolute + * differences of a picture and the previous picture, and compare this + * picture difference value with neighboring pictures. In the original + * algorithm, the value is compared to a configurable number of past + * and future pictures. However, comparing to future frames requires + * introducing latency into the stream, which I did not want. So this + * implementation only compared to previous frames. + * + * This code is more directly derived from the scene change detection + * implementation in Schroedinger. Schro's implementation is closer + * to the Easterbrook algorithm, comparing to future pictures. In + * terms of accuracy, schro's implementation has about 2-3 false positives + * or false negatives per 100 scene changes. This implementation has + * about 5 per 100. The threshold is tuned for minimum total false + * positives or negatives, on the assumption that the badness of a + * false negative is the same as a false positive. + * + * This algorithm is pretty much at its limit for error rate. I + * recommend any future work in this area to increase the complexity + * of detection, and then write an automatic tuning system as opposed + * to the manual tuning I did here. + * + * Inside the TESTING define are some hard-coded (mostly hand-written) + * scene change frame numbers for some easily available sequences. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include "gstvideofilter2.h" +#include "gstscenechange.h" +#include + +GST_DEBUG_CATEGORY_STATIC (gst_scene_change_debug_category); +#define GST_CAT_DEFAULT gst_scene_change_debug_category + +/* prototypes */ + + +static void gst_scene_change_set_property (GObject * object, + guint property_id, const GValue * value, GParamSpec * pspec); +static void gst_scene_change_get_property (GObject * object, + guint property_id, GValue * value, GParamSpec * pspec); +static void gst_scene_change_dispose (GObject * object); +static void gst_scene_change_finalize (GObject * object); + +static gboolean gst_scene_change_start (GstBaseTransform * trans); +static gboolean gst_scene_change_stop (GstBaseTransform * trans); +static GstFlowReturn +gst_scene_change_prefilter (GstVideoFilter2 * videofilter2, GstBuffer * buf); + +static GstVideoFilter2Functions gst_scene_change_filter_functions[]; + +#undef TESTING +#ifdef TESTING +static gboolean is_shot_change (int frame_number); +#endif + +enum +{ + PROP_0 +}; + +/* pad templates */ + + +/* class initialization */ + +#define DEBUG_INIT(bla) \ + GST_DEBUG_CATEGORY_INIT (gst_scene_change_debug_category, "scenechange", 0, \ + "debug category for scenechange element"); + +GST_BOILERPLATE_FULL (GstSceneChange, gst_scene_change, GstVideoFilter2, + GST_TYPE_VIDEO_FILTER2, DEBUG_INIT); + +static void +gst_scene_change_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + + gst_element_class_set_details_simple (element_class, "Scene change detector", + "Video/Filter", "Detects scene changes in video", + "David Schleef "); +} + +static void +gst_scene_change_class_init (GstSceneChangeClass * klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GstBaseTransformClass *base_transform_class = + GST_BASE_TRANSFORM_CLASS (klass); + GstVideoFilter2Class *video_filter2_class = GST_VIDEO_FILTER2_CLASS (klass); + + gobject_class->set_property = gst_scene_change_set_property; + gobject_class->get_property = gst_scene_change_get_property; + gobject_class->dispose = gst_scene_change_dispose; + gobject_class->finalize = gst_scene_change_finalize; + base_transform_class->start = GST_DEBUG_FUNCPTR (gst_scene_change_start); + base_transform_class->stop = GST_DEBUG_FUNCPTR (gst_scene_change_stop); + video_filter2_class->prefilter = + GST_DEBUG_FUNCPTR (gst_scene_change_prefilter); + + gst_video_filter2_class_add_functions (video_filter2_class, + gst_scene_change_filter_functions); + +} + +static void +gst_scene_change_init (GstSceneChange * scenechange, + GstSceneChangeClass * scenechange_class) +{ +} + +void +gst_scene_change_set_property (GObject * object, guint property_id, + const GValue * value, GParamSpec * pspec) +{ + g_return_if_fail (GST_IS_SCENE_CHANGE (object)); + + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +void +gst_scene_change_get_property (GObject * object, guint property_id, + GValue * value, GParamSpec * pspec) +{ + g_return_if_fail (GST_IS_SCENE_CHANGE (object)); + + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +void +gst_scene_change_dispose (GObject * object) +{ + g_return_if_fail (GST_IS_SCENE_CHANGE (object)); + + /* clean up as possible. may be called multiple times */ + + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +void +gst_scene_change_finalize (GObject * object) +{ + GstSceneChange *scenechange; + + g_return_if_fail (GST_IS_SCENE_CHANGE (object)); + scenechange = GST_SCENE_CHANGE (object); + + if (scenechange->oldbuf) + gst_buffer_unref (scenechange->oldbuf); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + + +static gboolean +gst_scene_change_start (GstBaseTransform * trans) +{ + + return TRUE; +} + +static gboolean +gst_scene_change_stop (GstBaseTransform * trans) +{ + + return TRUE; +} + +static GstFlowReturn +gst_scene_change_prefilter (GstVideoFilter2 * video_filter2, GstBuffer * buf) +{ + + return GST_FLOW_OK; +} + +static double +get_frame_score (guint8 * s1, guint8 * s2, int width, int height) +{ + int i; + int j; + int score = 0; + + for (j = 0; j < height; j++) { + for (i = 0; i < width; i++) { + score += ABS (s1[i] - s2[i]); + } + s1 += width; + s2 += width; + } + + return ((double) score) / (width * height); +} + +static GstFlowReturn +gst_scene_change_filter_ip_I420 (GstVideoFilter2 * videofilter2, + GstBuffer * buf, int start, int end) +{ + GstSceneChange *scenechange; + double score_min; + double score_max; + double threshold; + double score; + gboolean change; + int i; + int width; + int height; + + g_return_val_if_fail (GST_IS_SCENE_CHANGE (videofilter2), GST_FLOW_ERROR); + scenechange = GST_SCENE_CHANGE (videofilter2); + + width = GST_VIDEO_FILTER2_WIDTH (videofilter2); + height = GST_VIDEO_FILTER2_HEIGHT (videofilter2); + + if (!scenechange->oldbuf) { + scenechange->n_diffs = 0; + memset (scenechange->diffs, 0, sizeof (double) * SC_N_DIFFS); + scenechange->oldbuf = gst_buffer_ref (buf); + return GST_FLOW_OK; + } + + score = get_frame_score (GST_BUFFER_DATA (scenechange->oldbuf), + GST_BUFFER_DATA (buf), width, height); + + memmove (scenechange->diffs, scenechange->diffs + 1, + sizeof (double) * (SC_N_DIFFS - 1)); + scenechange->diffs[SC_N_DIFFS - 1] = score; + scenechange->n_diffs++; + + gst_buffer_unref (scenechange->oldbuf); + scenechange->oldbuf = gst_buffer_ref (buf); + + score_min = scenechange->diffs[0]; + score_max = scenechange->diffs[0]; + for (i = 1; i < SC_N_DIFFS - 1; i++) { + score_min = MIN (score_min, scenechange->diffs[i]); + score_max = MAX (score_max, scenechange->diffs[i]); + } + + threshold = 1.8 * score_max - 0.8 * score_min; + + if (scenechange->n_diffs > 2) { + if (score < 5) { + change = FALSE; + } else if (score / threshold < 1.0) { + change = FALSE; + } else if (score / threshold > 2.5) { + change = TRUE; + } else if (score > 50) { + change = TRUE; + } else { + change = FALSE; + } + } else { + change = FALSE; + } + +#ifdef TESTING + if (change != is_shot_change (scenechange->n_diffs)) { + g_print ("%d %g %g %g %d\n", scenechange->n_diffs, score / threshold, + score, threshold, change); + } +#endif + + if (change) { + GstEvent *event; + + GST_DEBUG_OBJECT (scenechange, "%d %g %g %g %d", + scenechange->n_diffs, score / threshold, score, threshold, change); + + event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, + gst_structure_new ("GstForceKeyUnit", NULL)); + + gst_pad_push_event (GST_BASE_TRANSFORM_SRC_PAD (scenechange), event); + } + + return GST_FLOW_OK; +} + +static GstVideoFilter2Functions gst_scene_change_filter_functions[] = { + {GST_VIDEO_FORMAT_I420, NULL, gst_scene_change_filter_ip_I420}, + {GST_VIDEO_FORMAT_UNKNOWN} +}; + + + + + + +#ifdef TESTING +/* This is from ds's personal collection. No, you can't have it. */ +int showreel_changes[] = { + 242, 483, 510, 550, 579, 603, 609, 1056, 1067, 1074, 1079, 1096, + 1106, 1113, 1127, 1145, 1156, 1170, 1212, 1228, 1243, 1269, 1274, + 1322, 1349, 1370, 1378, 1423, 1456, 1458, 1508, 1519, 1542, 1679, + 1767, 1837, 1895, 1962, 2006, 2035, 2102, 2139, 2196, 2561, 2664, + 2837, 2895, 2985, 3035, 3077, 3128, 3176, 3218, 3306, 3351, 3388, + 3421, 3470, 3711, 3832, 4029, 4184, 4444, 4686, 4719, 4825, 4941, + 5009, 5091, 5194, 5254, 5286, 5287, 5343, 5431, 5501, 5634, 5695, 5788, + 5839, 5861, 5930, 6030, 6168, 6193, 6237, 6336, 6376, 6421, 6495, + 6550, 6611, 6669, 6733, 6819, 6852, 6944, 7087, 7148, 7189, 7431, + 7540, 7599, 7632, 7661, 7693, 7930, 7963, 8003, 8076, 8109, 8147, + 8177, 8192, 8219, 8278, 8322, 8370, 8409, 8566, 8603, 8747, 8775, + 8873, 8907, 8955, 8969, 8983, 8997, 9026, 9079, 9140, 9165, 9206, + 9276, 9378, 9449, 9523, 9647, 9703, 9749, 9790, 9929, 10056, 10216, + 10307, 10411, 10487, 10557, 10695, 10770, 10854, 11095, 11265, 11517, 11589, + 11686, 11825, 11940, 12004, 12047, 12113, 12179, 12233, 12532, 12586, 12708, + 12793, 12877, 12954, 13030, 13105, 13177, 13279, 13396, 13486, 13538, 13561, + 13591, 13627, 13656, 13709, 13763, 13815, 13842, 13876, 13906, 13929, 13955, + 14003, 14070, 14097, 14127, 14153, 14198, 14269, 14348, 14367, 14440, 14488, + 14548, 14573, 14599, 14630, 14665, 14907, 14962, 15013, 15089, 15148, 15227, + 15314, 15355, 15369, 15451, 15470, 15542, 15570, 15640, 15684, 15781, 15869, + 15938, 16172, 16266, 16429, 16479, 16521, 16563, 16612, 16671, 16692, 16704, + 16720, 16756, 16789, 16802, 16815, 16867, 16908, 16939, 16953, 16977, 17006, + 17014, 17026, 17040, 17062, 17121, 17176, 17226, 17322, 17444, 17496, 17641, + 17698, 17744, 17826, 17913, 17993, 18073, 18219, 18279, 18359, 18475, 18544, + 18587, 18649, 18698, 18756, 18826, 18853, 18866, 19108, 19336, 19481, 19544, + 19720, 19816, 19908, 19982, 20069, 20310, 20355, 20374, 20409, 20469, 20599, + 20607, 20652, 20805, 20822, 20882, 20982, 21029, 21433, 21468, 21561, 21602, + 21661, 21720, 21909, 22045, 22166, 22225, 22323, 22362, 22433, 22477, 22529, + 22571, 22617, 22642, 22676, 22918, 22978, 23084, 23161, 23288, 23409, 23490, + 23613, 23721, 23815, 24131, 24372, 24468, 24507, 24555, 24568, 24616, 24634, + 24829, 24843, 24919, 24992, 25040, 25160, 25288, 25607, 25684, 25717, 25764, + 25821, 25866, 25901, 25925, 25941, 25978, 25998, 26011, 26030, 26055, 26118, + 26133, 26145, 26159, 26175, 26182, 26195, 26205, 26238, 26258, 26316, 26340, + 26581, 26725, 26834, 26874, 26995, 27065, 27178, 27238, 27365, 27607, 27669, + 27694, + 27774, 27800, 27841, 27930, 27985, 28057, 28091, 28132, 28189, 28270, 28545, + 28653, 28711, 28770, 28886, 28966, 29139, 29241, 29356, 29415, 29490, 29576, + 29659, 29776, 29842, 29910, 30029, 30056, 30100, 30129, 30175, 30316, 30376, + 30441, 30551, 30666, 30784, 30843, 30948, 31045, 31286, 31315, 31534, 31607, + 31742, + 31817, 31853, 31984, 32009, 32112, 32162, 32210, 32264 +}; + +/* Sintel */ +int sintel_changes[] = { + 752, 1018, 1036, 1056, 1078, 1100, 1169, 1319, 1339, 1370, + 1425, 1455, 1494, 1552, 1572, 1637, 1663, 1777, 1955, 2060, + 2125, 2429, 2624, 2780, 2835, 2881, 2955, 3032, 3144, 3217, + 3315, 3384, 3740, 3890, 4234, 4261, 4322, 4368, 4425, 4481, + 4555, 4605, 4671, 4714, 4743, 4875, 4920, 5082, 5158, 5267, + 5379, 5956, 6021, 6071, 6112, 6139, 6221, 6318, 6374, 6519, + 6558, 6615, 6691, 6803, 6900, 6944, 7134, 7266, 7351, 7414, + 7467, 7503, 7559, 7573, 7656, 7733, 7876, 7929, 7971, 7985, + 8047, 8099, 8144, 8215, 8394, 8435, 8480, 9133, 9190, 9525, + 9962, +}; + +/* Breathe Out video, http://media.xiph.org/video/misc/ */ +int breatheout_changes[] = { + 143, 263, 334, 426, 462, 563, 583, 618, 655, 707, + 818, 823, 858, 913, 956, 977, 999, 1073, 1124, 1144, + 1166, 1187, 1206, 1227, 1240, 1264, 1289, 1312, 1477, 1535, + 1646, 1692, 1739, 1757, 1798, 1855, 1974, 2048, 2129, 2212, + 2369, 2412, 2463, 2578, 2649, 2699, 2778, 2857, 2923, 3014, + 3107, 3246, 3321, 3350, 3459, 3498, 3541, 3567, 3613, 3636, + 3673, 3709, 3747, 3834, 3862, 3902, 3922, 4022, 4117, 4262, + 4303, 4357, 4556, 4578, 4617, 4716, 4792, 4873, 4895, 4917, + 4932, 4972, 5015, 5034, 5058, 5090, 5162, 5180, 5202, 5222, + 5239, 5258, 5281, 5298, 5397, 5430, + 485, 507, 534, 665, 685, 755, 1023, 1379, 1441, 1503, + 1584, 1621, 1903, 2081, 2281, 2511, 2958, 3071, 3185, 3214, + 3271, 3424, 3479, 3588, 3879, 3979, 4043, 4062, 4143, 4207, + 4237, 4336, 4461, 4476, 4533, 4647, 4815, 4853, 4949, 5075, + 5142, 5316, 5376, + 3514, 3952, 4384, 5337 +}; + +#define changes showreel_changes + +static gboolean +is_shot_change (int frame_number) +{ + int i; + for (i = 0; i < sizeof (changes) / sizeof (changes[0]); i++) { + if (changes[i] == frame_number) + return TRUE; + } + return FALSE; +} +#endif diff --git a/gst/videofilters/gstscenechange.h b/gst/videofilters/gstscenechange.h new file mode 100644 index 0000000000..82ad3e4abd --- /dev/null +++ b/gst/videofilters/gstscenechange.h @@ -0,0 +1,58 @@ +/* GStreamer + * Copyright (C) 2011 FIXME + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _GST_SCENE_CHANGE_H_ +#define _GST_SCENE_CHANGE_H_ + +#include +#include +#include "gstvideofilter2.h" + +G_BEGIN_DECLS + +#define GST_TYPE_SCENE_CHANGE (gst_scene_change_get_type()) +#define GST_SCENE_CHANGE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SCENE_CHANGE,GstSceneChange)) +#define GST_SCENE_CHANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SCENE_CHANGE,GstSceneChangeClass)) +#define GST_IS_SCENE_CHANGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SCENE_CHANGE)) +#define GST_IS_SCENE_CHANGE_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SCENE_CHANGE)) + +typedef struct _GstSceneChange GstSceneChange; +typedef struct _GstSceneChangeClass GstSceneChangeClass; + +#define SC_N_DIFFS 5 + +struct _GstSceneChange +{ + GstVideoFilter2 base_scenechange; + + int n_diffs; + double diffs[SC_N_DIFFS]; + GstBuffer *oldbuf; +}; + +struct _GstSceneChangeClass +{ + GstVideoFilter2Class base_scenechange_class; +}; + +GType gst_scene_change_get_type (void); + +G_END_DECLS + +#endif diff --git a/gst/videofilters/gstvideofilter2.c b/gst/videofilters/gstvideofilter2.c new file mode 100644 index 0000000000..adcdbd23a3 --- /dev/null +++ b/gst/videofilters/gstvideofilter2.c @@ -0,0 +1,269 @@ +/* GStreamer + * Copyright (C) 2011 David Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received 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-gstvideofilter2 + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include "gstvideofilter2.h" + +GST_DEBUG_CATEGORY_STATIC (gst_video_filter2_debug_category); +#define GST_CAT_DEFAULT gst_video_filter2_debug_category + +/* prototypes */ + + +static void gst_video_filter2_set_property (GObject * object, + guint property_id, const GValue * value, GParamSpec * pspec); +static void gst_video_filter2_get_property (GObject * object, + guint property_id, GValue * value, GParamSpec * pspec); +static void gst_video_filter2_dispose (GObject * object); +static void gst_video_filter2_finalize (GObject * object); + +static GstCaps *gst_video_filter2_transform_caps (GstBaseTransform * trans, + GstPadDirection direction, GstCaps * caps); +static gboolean +gst_video_filter2_get_unit_size (GstBaseTransform * trans, GstCaps * caps, + guint * size); +static gboolean +gst_video_filter2_set_caps (GstBaseTransform * trans, GstCaps * incaps, + GstCaps * outcaps); +static gboolean gst_video_filter2_start (GstBaseTransform * trans); +static gboolean gst_video_filter2_stop (GstBaseTransform * trans); +static GstFlowReturn gst_video_filter2_transform (GstBaseTransform * trans, + GstBuffer * inbuf, GstBuffer * outbuf); +static GstFlowReturn gst_video_filter2_transform_ip (GstBaseTransform * trans, + GstBuffer * buf); + +enum +{ + PROP_0 +}; + + +/* class initialization */ + +#define DEBUG_INIT(bla) \ + GST_DEBUG_CATEGORY_INIT (gst_video_filter2_debug_category, "videofilter2", 0, \ + "debug category for videofilter2 element"); + +GST_BOILERPLATE_FULL (GstVideoFilter2, gst_video_filter2, GstBaseTransform, + GST_TYPE_BASE_TRANSFORM, DEBUG_INIT); + +static void +gst_video_filter2_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + int i; + GstCaps *caps = NULL; + + caps = gst_caps_new_empty (); + for (i = GST_VIDEO_FORMAT_I420; i <= GST_VIDEO_FORMAT_I420; i++) { + gst_caps_append (caps, gst_video_format_new_template_caps (i)); + } + + gst_element_class_add_pad_template (element_class, + gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, + gst_caps_ref (caps))); + gst_element_class_add_pad_template (element_class, + gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, caps)); +} + +static void +gst_video_filter2_class_init (GstVideoFilter2Class * klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GstBaseTransformClass *base_transform_class = + GST_BASE_TRANSFORM_CLASS (klass); + + gobject_class->set_property = gst_video_filter2_set_property; + gobject_class->get_property = gst_video_filter2_get_property; + gobject_class->dispose = gst_video_filter2_dispose; + gobject_class->finalize = gst_video_filter2_finalize; + base_transform_class->transform_caps = + GST_DEBUG_FUNCPTR (gst_video_filter2_transform_caps); + base_transform_class->get_unit_size = + GST_DEBUG_FUNCPTR (gst_video_filter2_get_unit_size); + base_transform_class->set_caps = + GST_DEBUG_FUNCPTR (gst_video_filter2_set_caps); + base_transform_class->start = GST_DEBUG_FUNCPTR (gst_video_filter2_start); + base_transform_class->stop = GST_DEBUG_FUNCPTR (gst_video_filter2_stop); + base_transform_class->transform = + GST_DEBUG_FUNCPTR (gst_video_filter2_transform); + base_transform_class->transform_ip = + GST_DEBUG_FUNCPTR (gst_video_filter2_transform_ip); + +} + +static void +gst_video_filter2_init (GstVideoFilter2 * videofilter2, + GstVideoFilter2Class * videofilter2_class) +{ + + gst_base_transform_set_qos_enabled (GST_BASE_TRANSFORM (videofilter2), TRUE); +} + +void +gst_video_filter2_set_property (GObject * object, guint property_id, + const GValue * value, GParamSpec * pspec) +{ + g_return_if_fail (GST_IS_VIDEO_FILTER2 (object)); + + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +void +gst_video_filter2_get_property (GObject * object, guint property_id, + GValue * value, GParamSpec * pspec) +{ + g_return_if_fail (GST_IS_VIDEO_FILTER2 (object)); + + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +void +gst_video_filter2_dispose (GObject * object) +{ + g_return_if_fail (GST_IS_VIDEO_FILTER2 (object)); + + /* clean up as possible. may be called multiple times */ + + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +void +gst_video_filter2_finalize (GObject * object) +{ + g_return_if_fail (GST_IS_VIDEO_FILTER2 (object)); + + /* clean up object here */ + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static GstCaps * +gst_video_filter2_transform_caps (GstBaseTransform * trans, + GstPadDirection direction, GstCaps * caps) +{ + return gst_caps_ref (caps); +} + +static gboolean +gst_video_filter2_get_unit_size (GstBaseTransform * trans, GstCaps * caps, + guint * size) +{ + GstVideoFormat format; + gint width, height; + 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_video_filter2_set_caps (GstBaseTransform * trans, GstCaps * incaps, + GstCaps * outcaps) +{ + GstVideoFilter2 *videofilter2; + gboolean ret; + int width; + int height; + GstVideoFormat format; + + g_return_val_if_fail (GST_IS_VIDEO_FILTER2 (trans), FALSE); + videofilter2 = GST_VIDEO_FILTER2 (trans); + + ret = gst_video_format_parse_caps (incaps, &format, &width, &height); + + if (ret) { + videofilter2->format = format; + videofilter2->width = width; + videofilter2->height = height; + } + + return ret; +} + +static gboolean +gst_video_filter2_start (GstBaseTransform * trans) +{ + + return FALSE; +} + +static gboolean +gst_video_filter2_stop (GstBaseTransform * trans) +{ + + return FALSE; +} + +static GstFlowReturn +gst_video_filter2_transform (GstBaseTransform * trans, GstBuffer * inbuf, + GstBuffer * outbuf) +{ + + return GST_FLOW_ERROR; +} + +static GstFlowReturn +gst_video_filter2_transform_ip (GstBaseTransform * trans, GstBuffer * buf) +{ + GstVideoFilter2 *video_filter2 = GST_VIDEO_FILTER2 (trans); + GstVideoFilter2Class *klass = + GST_VIDEO_FILTER2_CLASS (G_OBJECT_GET_CLASS (trans)); + int i; + GstFlowReturn ret; + + for (i = 0; klass->functions[i].format != GST_VIDEO_FORMAT_UNKNOWN; i++) { + if (klass->functions[i].format == video_filter2->format) { + ret = klass->functions[i].filter_ip (video_filter2, buf, 0, + video_filter2->height); + return ret; + } + } + + return GST_FLOW_ERROR; +} + +/* API */ + +void +gst_video_filter2_class_add_functions (GstVideoFilter2Class * klass, + const GstVideoFilter2Functions * functions) +{ + klass->functions = functions; +} diff --git a/gst/videofilters/gstvideofilter2.h b/gst/videofilters/gstvideofilter2.h new file mode 100644 index 0000000000..fa638d7463 --- /dev/null +++ b/gst/videofilters/gstvideofilter2.h @@ -0,0 +1,81 @@ +/* GStreamer + * Copyright (C) 2011 David Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _GST_VIDEO_FILTER2_H_ +#define _GST_VIDEO_FILTER2_H_ + +#include +#include + +G_BEGIN_DECLS + +#define GST_TYPE_VIDEO_FILTER2 (gst_video_filter2_get_type()) +#define GST_VIDEO_FILTER2(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_FILTER2,GstVideoFilter2)) +#define GST_VIDEO_FILTER2_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_FILTER2,GstVideoFilter2Class)) +#define GST_IS_VIDEO_FILTER2(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_FILTER2)) +#define GST_IS_VIDEO_FILTER2_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_FILTER2)) + +typedef struct _GstVideoFilter2 GstVideoFilter2; +typedef struct _GstVideoFilter2Class GstVideoFilter2Class; +typedef struct _GstVideoFilter2Functions GstVideoFilter2Functions; + +struct _GstVideoFilter2 +{ + GstBaseTransform base_videofilter2; + + GstVideoFormat format; + int width; + int height; + + gpointer _gst_reserved[GST_PADDING_LARGE]; +}; + +struct _GstVideoFilter2Class +{ + GstBaseTransformClass base_videofilter2_class; + + const GstVideoFilter2Functions *functions; + + GstFlowReturn (*prefilter) (GstVideoFilter2 *filter, GstBuffer *inbuf); + + gpointer _gst_reserved[GST_PADDING_LARGE]; +}; + +struct _GstVideoFilter2Functions +{ + GstVideoFormat format; + GstFlowReturn (*filter) (GstVideoFilter2 *filter, GstBuffer *inbuf, + GstBuffer *outbuf, int start, int end); + GstFlowReturn (*filter_ip) (GstVideoFilter2 *filter, GstBuffer *buffer, + int start, int end); + gpointer _gst_reserved[GST_PADDING_LARGE]; +}; + +#define GST_VIDEO_FILTER2_FORMAT(vf) (((GstVideoFilter2 *)vf)->format) +#define GST_VIDEO_FILTER2_WIDTH(vf) (((GstVideoFilter2 *)vf)->width) +#define GST_VIDEO_FILTER2_HEIGHT(vf) (((GstVideoFilter2 *)vf)->height) + +GType gst_video_filter2_get_type (void); + +void gst_video_filter2_class_add_functions (GstVideoFilter2Class *klass, + const GstVideoFilter2Functions *functions); + +G_END_DECLS + +#endif diff --git a/gst/videofilters/gstvideofiltersbad.c b/gst/videofilters/gstvideofiltersbad.c index f05ace5ee8..9f15cea807 100644 --- a/gst/videofilters/gstvideofiltersbad.c +++ b/gst/videofilters/gstvideofiltersbad.c @@ -23,6 +23,7 @@ #include #include +#include "gstscenechange.h" #include "gstzebrastripe.h" @@ -30,6 +31,8 @@ static gboolean plugin_init (GstPlugin * plugin) { + gst_element_register (plugin, "scenechange", GST_RANK_NONE, + gst_scene_change_get_type ()); gst_element_register (plugin, "zebrastripe", GST_RANK_NONE, gst_zebra_stripe_get_type ()); diff --git a/gst/videofilters/gstzebrastripe.c b/gst/videofilters/gstzebrastripe.c index 57134e9753..e4acd3a5dd 100644 --- a/gst/videofilters/gstzebrastripe.c +++ b/gst/videofilters/gstzebrastripe.c @@ -62,19 +62,15 @@ static void gst_zebra_stripe_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); static void gst_zebra_stripe_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void gst_zebra_stripe_dispose (GObject * object); static void gst_zebra_stripe_finalize (GObject * object); -static gboolean -gst_zebra_stripe_get_unit_size (GstBaseTransform * trans, GstCaps * caps, - guint * size); -static gboolean -gst_zebra_stripe_set_caps (GstBaseTransform * trans, GstCaps * incaps, - GstCaps * outcaps); static gboolean gst_zebra_stripe_start (GstBaseTransform * trans); static gboolean gst_zebra_stripe_stop (GstBaseTransform * trans); -static GstFlowReturn gst_zebra_stripe_transform_ip (GstBaseTransform * trans, - GstBuffer * buf); + +static GstFlowReturn +gst_zebra_stripe_prefilter (GstVideoFilter2 * videofilter2, GstBuffer * buf); + +static GstVideoFilter2Functions gst_zebra_stripe_filter_functions[]; enum { @@ -84,44 +80,20 @@ enum #define DEFAULT_THRESHOLD 90 -/* pad templates */ - -static GstStaticPadTemplate gst_zebra_stripe_sink_template = -GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV - ("{I420,YV12,Y41B,Y42B,NV12,NV21,YUV9,YVU9,Y444,UYVY,YVYU,YUY2,AYUV}")) - ); - -static GstStaticPadTemplate gst_zebra_stripe_src_template = -GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV - ("{I420,YV12,Y41B,Y42B,NV12,NV21,YUV9,YVU9,Y444,UYVY,YVYU,YUY2,AYUV}")) - ); - - /* class initialization */ #define DEBUG_INIT(bla) \ GST_DEBUG_CATEGORY_INIT (gst_zebra_stripe_debug_category, "zebrastripe", 0, \ "debug category for zebrastripe element"); -GST_BOILERPLATE_FULL (GstZebraStripe, gst_zebra_stripe, GstBaseTransform, - GST_TYPE_BASE_TRANSFORM, DEBUG_INIT); +GST_BOILERPLATE_FULL (GstZebraStripe, gst_zebra_stripe, GstVideoFilter2, + GST_TYPE_VIDEO_FILTER2, DEBUG_INIT); static void gst_zebra_stripe_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_zebra_stripe_sink_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_zebra_stripe_src_template)); - gst_element_class_set_details_simple (element_class, "Zebra stripe overlay", "Filter/Analysis", "Overlays zebra striping on overexposed areas of video", @@ -132,21 +104,18 @@ static void gst_zebra_stripe_class_init (GstZebraStripeClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GstVideoFilter2Class *video_filter2_class = GST_VIDEO_FILTER2_CLASS (klass); GstBaseTransformClass *base_transform_class = GST_BASE_TRANSFORM_CLASS (klass); gobject_class->set_property = gst_zebra_stripe_set_property; gobject_class->get_property = gst_zebra_stripe_get_property; - gobject_class->dispose = gst_zebra_stripe_dispose; gobject_class->finalize = gst_zebra_stripe_finalize; - base_transform_class->get_unit_size = - GST_DEBUG_FUNCPTR (gst_zebra_stripe_get_unit_size); - base_transform_class->set_caps = - GST_DEBUG_FUNCPTR (gst_zebra_stripe_set_caps); base_transform_class->start = GST_DEBUG_FUNCPTR (gst_zebra_stripe_start); base_transform_class->stop = GST_DEBUG_FUNCPTR (gst_zebra_stripe_stop); - base_transform_class->transform_ip = - GST_DEBUG_FUNCPTR (gst_zebra_stripe_transform_ip); + + video_filter2_class->prefilter = + GST_DEBUG_FUNCPTR (gst_zebra_stripe_prefilter); g_object_class_install_property (gobject_class, PROP_THRESHOLD, g_param_spec_int ("threshold", "Threshold", @@ -154,6 +123,8 @@ gst_zebra_stripe_class_init (GstZebraStripeClass * klass) DEFAULT_THRESHOLD, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); + gst_video_filter2_class_add_functions (video_filter2_class, + gst_zebra_stripe_filter_functions); } static void @@ -161,12 +132,6 @@ gst_zebra_stripe_init (GstZebraStripe * zebrastripe, GstZebraStripeClass * zebrastripe_class) { - zebrastripe->sinkpad = - gst_pad_new_from_static_template (&gst_zebra_stripe_sink_template, - "sink"); - - zebrastripe->srcpad = - gst_pad_new_from_static_template (&gst_zebra_stripe_src_template, "src"); } void @@ -181,6 +146,8 @@ gst_zebra_stripe_set_property (GObject * object, guint property_id, switch (property_id) { case PROP_THRESHOLD: zebrastripe->threshold = g_value_get_int (value); + zebrastripe->y_threshold = + 16 + floor (0.5 + 2.19 * zebrastripe->threshold); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -207,26 +174,10 @@ gst_zebra_stripe_get_property (GObject * object, guint property_id, } } -void -gst_zebra_stripe_dispose (GObject * object) -{ - GstZebraStripe *zebrastripe; - - g_return_if_fail (GST_IS_ZEBRA_STRIPE (object)); - zebrastripe = GST_ZEBRA_STRIPE (object); - - /* clean up as possible. may be called multiple times */ - - G_OBJECT_CLASS (parent_class)->dispose (object); -} - void gst_zebra_stripe_finalize (GObject * object) { - GstZebraStripe *zebrastripe; - g_return_if_fail (GST_IS_ZEBRA_STRIPE (object)); - zebrastripe = GST_ZEBRA_STRIPE (object); /* clean up object here */ @@ -234,39 +185,6 @@ gst_zebra_stripe_finalize (GObject * object) } -static gboolean -gst_zebra_stripe_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_zebra_stripe_set_caps (GstBaseTransform * trans, GstCaps * incaps, - GstCaps * outcaps) -{ - GstZebraStripe *zebrastripe = GST_ZEBRA_STRIPE (trans); - int width, height; - GstVideoFormat format; - gboolean ret; - - ret = gst_video_format_parse_caps (incaps, &format, &width, &height); - if (ret) { - zebrastripe->format = format; - zebrastripe->width = width; - zebrastripe->height = height; - } - - return ret; -} - static gboolean gst_zebra_stripe_start (GstBaseTransform * trans) { @@ -282,72 +200,120 @@ gst_zebra_stripe_stop (GstBaseTransform * trans) } static GstFlowReturn -gst_zebra_stripe_transform_ip (GstBaseTransform * trans, GstBuffer * buf) +gst_zebra_stripe_prefilter (GstVideoFilter2 * videofilter2, GstBuffer * buf) { - GstZebraStripe *zebrastripe = GST_ZEBRA_STRIPE (trans); - int i, j; - int threshold; - int t; - guint8 *ydata; - int ystride; - - threshold = 16 + floor (0.5 + 2.19 * zebrastripe->threshold); - t = zebrastripe->t; - - ydata = GST_BUFFER_DATA (buf); - ystride = gst_video_format_get_row_stride (zebrastripe->format, - 0, zebrastripe->width); - switch (zebrastripe->format) { - case GST_VIDEO_FORMAT_I420: - case GST_VIDEO_FORMAT_YV12: - case GST_VIDEO_FORMAT_Y41B: - case GST_VIDEO_FORMAT_Y42B: - case GST_VIDEO_FORMAT_NV12: - case GST_VIDEO_FORMAT_NV21: - case GST_VIDEO_FORMAT_YUV9: - case GST_VIDEO_FORMAT_YVU9: - case GST_VIDEO_FORMAT_Y444: - for (j = 0; j < zebrastripe->height; j++) { - guint8 *data = ydata + ystride * j; - for (i = 0; i < zebrastripe->width; i++) { - if (data[i] >= threshold) { - if ((i + j + t) & 0x4) - data[i] = 16; - } - } - } - break; - case GST_VIDEO_FORMAT_UYVY: - ydata++; - case GST_VIDEO_FORMAT_YUY2: - case GST_VIDEO_FORMAT_YVYU: - for (j = 0; j < zebrastripe->height; j++) { - guint8 *data = ydata + ystride * j; - for (i = 0; i < zebrastripe->width; i++) { - if (data[2 * i] >= threshold) { - if ((i + j + t) & 0x4) - data[2 * i] = 16; - } - } - } - break; - case GST_VIDEO_FORMAT_AYUV: - ydata++; - for (j = 0; j < zebrastripe->height; j++) { - guint8 *data = ydata + ystride * j; - for (i = 0; i < zebrastripe->width; i++) { - if (data[4 * i] >= threshold) { - if ((i + j + t) & 0x4) - data[4 * i] = 16; - } - } - } - break; - default: - g_assert_not_reached (); - } + GstZebraStripe *zebrastripe = GST_ZEBRA_STRIPE (videofilter2); zebrastripe->t++; return GST_FLOW_OK; } + +static GstFlowReturn +gst_zebra_stripe_filter_ip_planarY (GstVideoFilter2 * videofilter2, + GstBuffer * buf, int start, int end) +{ + GstZebraStripe *zebrastripe = GST_ZEBRA_STRIPE (videofilter2); + int width = GST_VIDEO_FILTER2_WIDTH (zebrastripe); + int i, j; + int threshold = zebrastripe->y_threshold; + int t = zebrastripe->t; + guint8 *ydata; + int ystride; + + ydata = GST_BUFFER_DATA (buf); + ystride = + gst_video_format_get_row_stride (GST_VIDEO_FILTER2_FORMAT (videofilter2), + 0, width); + + for (j = start; j < end; j++) { + guint8 *data = ydata + ystride * j; + for (i = 0; i < width; i++) { + if (data[i] >= threshold) { + if ((i + j + t) & 0x4) + data[i] = 16; + } + } + } + return GST_FLOW_OK; +} + +static GstFlowReturn +gst_zebra_stripe_filter_ip_YxYy (GstVideoFilter2 * videofilter2, + GstBuffer * buf, int start, int end) +{ + GstZebraStripe *zebrastripe = GST_ZEBRA_STRIPE (videofilter2); + GstVideoFormat format = GST_VIDEO_FILTER2_FORMAT (zebrastripe); + int width = GST_VIDEO_FILTER2_WIDTH (zebrastripe); + int i, j; + int threshold = zebrastripe->y_threshold; + int t = zebrastripe->t; + guint8 *ydata; + int ystride; + + ydata = GST_BUFFER_DATA (buf); + ystride = gst_video_format_get_row_stride (format, 0, width); + + if (format == GST_VIDEO_FORMAT_UYVY) { + ydata++; + } + + for (j = start; j < end; j++) { + guint8 *data = ydata + ystride * j; + for (i = 0; i < width; i++) { + if (data[2 * i] >= threshold) { + if ((i + j + t) & 0x4) + data[2 * i] = 16; + } + } + } + return GST_FLOW_OK; +} + +static GstFlowReturn +gst_zebra_stripe_filter_ip_AYUV (GstVideoFilter2 * videofilter2, + GstBuffer * buf, int start, int end) +{ + GstZebraStripe *zebrastripe = GST_ZEBRA_STRIPE (videofilter2); + int width = GST_VIDEO_FILTER2_WIDTH (zebrastripe); + int i, j; + int threshold = zebrastripe->y_threshold; + int t = zebrastripe->t; + guint8 *ydata; + int ystride; + + ydata = GST_BUFFER_DATA (buf); + ystride = + gst_video_format_get_row_stride (GST_VIDEO_FILTER2_FORMAT (videofilter2), + 0, width); + + ydata++; + for (j = start; j < end; j++) { + guint8 *data = ydata + ystride * j; + for (i = 0; i < width; i++) { + if (data[4 * i] >= threshold) { + if ((i + j + t) & 0x4) + data[4 * i] = 16; + } + } + } + + return GST_FLOW_OK; +} + +static GstVideoFilter2Functions gst_zebra_stripe_filter_functions[] = { + {GST_VIDEO_FORMAT_I420, NULL, gst_zebra_stripe_filter_ip_planarY}, + {GST_VIDEO_FORMAT_YV12, NULL, gst_zebra_stripe_filter_ip_planarY}, + {GST_VIDEO_FORMAT_Y41B, NULL, gst_zebra_stripe_filter_ip_planarY}, + {GST_VIDEO_FORMAT_Y42B, NULL, gst_zebra_stripe_filter_ip_planarY}, + {GST_VIDEO_FORMAT_NV12, NULL, gst_zebra_stripe_filter_ip_planarY}, + {GST_VIDEO_FORMAT_NV21, NULL, gst_zebra_stripe_filter_ip_planarY}, + {GST_VIDEO_FORMAT_YUV9, NULL, gst_zebra_stripe_filter_ip_planarY}, + {GST_VIDEO_FORMAT_YVU9, NULL, gst_zebra_stripe_filter_ip_planarY}, + {GST_VIDEO_FORMAT_Y444, NULL, gst_zebra_stripe_filter_ip_planarY}, + {GST_VIDEO_FORMAT_UYVY, NULL, gst_zebra_stripe_filter_ip_YxYy}, + {GST_VIDEO_FORMAT_YUY2, NULL, gst_zebra_stripe_filter_ip_YxYy}, + {GST_VIDEO_FORMAT_YVYU, NULL, gst_zebra_stripe_filter_ip_YxYy}, + {GST_VIDEO_FORMAT_AYUV, NULL, gst_zebra_stripe_filter_ip_AYUV}, + {GST_VIDEO_FORMAT_UNKNOWN} +}; diff --git a/gst/videofilters/gstzebrastripe.h b/gst/videofilters/gstzebrastripe.h index 41a7f170e5..7bd4e1f87c 100644 --- a/gst/videofilters/gstzebrastripe.h +++ b/gst/videofilters/gstzebrastripe.h @@ -1,5 +1,5 @@ /* GStreamer - * Copyright (C) 2011 FIXME + * Copyright (C) 2011 David Schleef * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -20,7 +20,7 @@ #ifndef _GST_ZEBRA_STRIPE_H_ #define _GST_ZEBRA_STRIPE_H_ -#include +#include "gstvideofilter2.h" #include G_BEGIN_DECLS @@ -36,25 +36,20 @@ typedef struct _GstZebraStripeClass GstZebraStripeClass; struct _GstZebraStripe { - GstBaseTransform base_zebrastripe; - - GstPad *sinkpad; - GstPad *srcpad; + GstVideoFilter2 video_filter2; /* properties */ int threshold; /* state */ - GstVideoFormat format; - int width; - int height; int t; + int y_threshold; }; struct _GstZebraStripeClass { - GstBaseTransformClass base_zebrastripe_class; + GstVideoFilter2Class video_filter2_class; }; GType gst_zebra_stripe_get_type (void); diff --git a/gst/videomaxrate/Makefile.am b/gst/videomaxrate/Makefile.am index 595941ed5b..cf21139c8c 100644 --- a/gst/videomaxrate/Makefile.am +++ b/gst/videomaxrate/Makefile.am @@ -9,3 +9,16 @@ libgstvideomaxrate_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) \ libgstvideomaxrate_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstvideomaxrate_la_LIBTOOLFLAGS = --tag=disable-static +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstvideomaxrate -:SHARED libgstvideomaxrate \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstvideomaxrate_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstvideomaxrate_la_CFLAGS) \ + -:LDFLAGS $(libgstvideomaxrate_la_LDFLAGS) \ + $(libgstvideomaxrate_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ \ No newline at end of file diff --git a/gst/videomeasure/Makefile.am b/gst/videomeasure/Makefile.am index 9129d16129..f8829d3380 100644 --- a/gst/videomeasure/Makefile.am +++ b/gst/videomeasure/Makefile.am @@ -17,3 +17,16 @@ libgstvideomeasure_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \ libgstvideomeasure_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstvideomeasure_la_LIBTOOLFLAGS = --tag=disable-static +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstvideomeasure -:SHARED libgstvideomeasure \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstvideomeasure_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstvideomeasure_la_CFLAGS) \ + -:LDFLAGS $(libgstvideomeasure_la_LDFLAGS) \ + $(libgstvideomeasure_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ \ No newline at end of file diff --git a/gst/videomeasure/gstvideomeasure_ssim.c b/gst/videomeasure/gstvideomeasure_ssim.c index a99fa9ff3a..19d03d4ded 100644 --- a/gst/videomeasure/gstvideomeasure_ssim.c +++ b/gst/videomeasure/gstvideomeasure_ssim.c @@ -1183,7 +1183,11 @@ gst_ssim_request_new_pad (GstElement * element, GstPadTemplate * templ, goto could_not_add_sink; else /* increment pad counter */ +#if GLIB_CHECK_VERSION(2,29,5) + padcount = g_atomic_int_add (&ssim->padcount, 1); +#else padcount = g_atomic_int_exchange_and_add (&ssim->padcount, 1); +#endif if (num >= 0) { GstSSimOutputContext *c; diff --git a/gst/videoparsers/Makefile.am b/gst/videoparsers/Makefile.am index 028959d0f7..6cebef5330 100644 --- a/gst/videoparsers/Makefile.am +++ b/gst/videoparsers/Makefile.am @@ -3,16 +3,31 @@ plugin_LTLIBRARIES = libgstvideoparsersbad.la libgstvideoparsersbad_la_SOURCES = plugin.c \ h263parse.c gsth263parse.c \ gsth264parse.c h264parse.c \ - gstdiracparse.c dirac_parse.c + gstdiracparse.c dirac_parse.c \ + gstmpegvideoparse.c mpegvideoparse.c libgstvideoparsersbad_la_CFLAGS = \ - $(GST_PLUGINS_BAD_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) + $(GST_BASE_CFLAGS) $(GST_CFLAGS) libgstvideoparsersbad_la_LIBADD = \ - $(top_builddir)/gst-libs/gst/baseparse/libgstbaseparse-$(GST_MAJORMINOR).la \ $(GST_BASE_LIBS) $(GST_LIBS) libgstvideoparsersbad_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstvideoparsersbad_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gsth263parse.h h263parse.h \ gsth264parse.h h264parse.h \ - gstdiracparse.h dirac_parse.h + gstdiracparse.h dirac_parse.h \ + gstmpegvideoparse.h mpegvideoparse.h +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstvideoparsersbad -:SHARED libgstvideoparsersbad \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstvideoparsersbad_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstvideoparsersbad_la_CFLAGS) \ + -:LDFLAGS $(libgstvideoparsersbad_la_LDFLAGS) \ + $(libgstvideoparsersbad_la_LIBADD) \ + -ldl \ + -:LIBFILTER_STATIC gstbaseparse-@GST_MAJORMINOR@ \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/videoparsers/gstdiracparse.c b/gst/videoparsers/gstdiracparse.c index 00130f8fef..fbd157abb5 100644 --- a/gst/videoparsers/gstdiracparse.c +++ b/gst/videoparsers/gstdiracparse.c @@ -36,7 +36,6 @@ #include #include -#include #include "gstdiracparse.h" /* prototypes */ @@ -77,14 +76,14 @@ static GstStaticPadTemplate gst_dirac_parse_sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("application/unknown") + GST_STATIC_CAPS ("video/x-dirac, parsed=(boolean)FALSE") ); static GstStaticPadTemplate gst_dirac_parse_src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("application/unknown") + GST_STATIC_CAPS ("video/x-dirac, parsed=(boolean)TRUE") ); /* class initialization */ @@ -102,8 +101,9 @@ gst_dirac_parse_base_init (gpointer g_class) gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&gst_dirac_parse_sink_template)); - gst_element_class_set_details_simple (element_class, "FIXME", - "Generic", "FIXME", "David Schleef "); + gst_element_class_set_details_simple (element_class, "Dirac parser", + "Codec/Parser/Video", "Parses Dirac streams", + "David Schleef "); } static void @@ -144,10 +144,7 @@ void gst_dirac_parse_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - GstDiracParse *diracparse; - g_return_if_fail (GST_IS_DIRAC_PARSE (object)); - diracparse = GST_DIRAC_PARSE (object); switch (property_id) { default: @@ -160,10 +157,7 @@ void gst_dirac_parse_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - GstDiracParse *diracparse; - g_return_if_fail (GST_IS_DIRAC_PARSE (object)); - diracparse = GST_DIRAC_PARSE (object); switch (property_id) { default: @@ -175,10 +169,7 @@ gst_dirac_parse_get_property (GObject * object, guint property_id, void gst_dirac_parse_dispose (GObject * object) { - GstDiracParse *diracparse; - g_return_if_fail (GST_IS_DIRAC_PARSE (object)); - diracparse = GST_DIRAC_PARSE (object); /* clean up as possible. may be called multiple times */ @@ -188,10 +179,7 @@ gst_dirac_parse_dispose (GObject * object) void gst_dirac_parse_finalize (GObject * object) { - GstDiracParse *diracparse; - g_return_if_fail (GST_IS_DIRAC_PARSE (object)); - diracparse = GST_DIRAC_PARSE (object); /* clean up object here */ @@ -238,8 +226,8 @@ gst_dirac_parse_check_valid_frame (GstBaseParse * parse, GstDiracParse *diracparse = GST_DIRAC_PARSE (parse); int off; guint32 next_header; - gboolean sync; - gboolean drain; + gboolean lost_sync; + gboolean draining; if (G_UNLIKELY (GST_BUFFER_SIZE (frame->buffer) < 13)) return FALSE; @@ -268,10 +256,10 @@ gst_dirac_parse_check_valid_frame (GstBaseParse * parse, GST_LOG ("framesize %d", *framesize); - sync = GST_BASE_PARSE_FRAME_SYNC (frame); - drain = GST_BASE_PARSE_FRAME_DRAIN (frame); + lost_sync = GST_BASE_PARSE_LOST_SYNC (frame); + draining = GST_BASE_PARSE_DRAINING (frame); - if (!sync && !drain) { + if (lost_sync && !draining) { guint32 next_sync_word = 0; next_header = GST_READ_UINT32_BE (GST_BUFFER_DATA (frame->buffer) + 5); diff --git a/gst/videoparsers/gstdiracparse.h b/gst/videoparsers/gstdiracparse.h index 64a1b8123d..abf3821f15 100644 --- a/gst/videoparsers/gstdiracparse.h +++ b/gst/videoparsers/gstdiracparse.h @@ -21,7 +21,7 @@ #define _GST_DIRAC_PARSE_H_ #include -#include +#include G_BEGIN_DECLS diff --git a/gst/videoparsers/gsth263parse.c b/gst/videoparsers/gsth263parse.c index e6e94acf1a..877c75e44f 100644 --- a/gst/videoparsers/gsth263parse.c +++ b/gst/videoparsers/gsth263parse.c @@ -110,7 +110,7 @@ gst_h263_parse_start (GstBaseParse * parse) h263parse->state = PARSING; - gst_base_parse_set_min_frame_size (parse, 512); + gst_base_parse_set_min_frame_size (parse, 4); return TRUE; } @@ -209,6 +209,10 @@ gst_h263_parse_set_src_caps (GstH263Parse * h263parse, gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION, fr_num, fr_denom, NULL); + if (params->width && params->height) + gst_caps_set_simple (caps, "width", G_TYPE_INT, params->width, + "height", G_TYPE_INT, params->height, NULL); + if (h263parse->state == GOT_HEADER) { gst_caps_set_simple (caps, "annex-d", G_TYPE_BOOLEAN, (params->features & H263_OPTION_UMV_MODE), @@ -273,7 +277,7 @@ gst_h263_parse_check_valid_frame (GstBaseParse * parse, next_psc_pos = find_psc (buffer, next_psc_pos); if (next_psc_pos == -1) { - if (GST_BASE_PARSE_FRAME_DRAIN (frame)) + if (GST_BASE_PARSE_DRAINING (parse)) /* FLUSH/EOS, it's okay if we can't find the next frame */ next_psc_pos = GST_BUFFER_SIZE (buffer); else @@ -290,11 +294,11 @@ gst_h263_parse_check_valid_frame (GstBaseParse * parse, res = gst_h263_parse_get_params (¶ms, buffer, FALSE, &h263parse->state); if (res != GST_FLOW_OK || h263parse->state != GOT_HEADER) { GST_WARNING ("Couldn't parse header - setting passthrough mode"); - gst_base_parse_set_format (parse, - GST_BASE_PARSE_FORMAT_PASSTHROUGH, TRUE); + gst_base_parse_set_passthrough (parse, TRUE); } else { /* Set srcpad caps since we now have sufficient information to do so */ gst_h263_parse_set_src_caps (h263parse, ¶ms); + gst_base_parse_set_passthrough (parse, FALSE); } } @@ -309,8 +313,8 @@ gst_h263_parse_check_valid_frame (GstBaseParse * parse, return TRUE; more: - /* Ask for 1024 bytes more - this is an arbitrary choice */ - gst_base_parse_set_min_frame_size (parse, GST_BUFFER_SIZE (buffer) + 1024); + /* ask for best next available */ + *framesize = G_MAXUINT; *skipsize = psc_pos; @@ -337,7 +341,7 @@ gst_h263_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame) * parse the header, which should not be possible. Either way, go into * passthrough mode and let downstream handle it if it can. */ GST_WARNING ("Couldn't parse header - setting passthrough mode"); - gst_base_parse_set_format (parse, GST_BASE_PARSE_FORMAT_PASSTHROUGH, TRUE); + gst_base_parse_set_passthrough (parse, TRUE); goto out; } diff --git a/gst/videoparsers/gsth263parse.h b/gst/videoparsers/gsth263parse.h index 571f100d5b..f5567f2e6e 100644 --- a/gst/videoparsers/gsth263parse.h +++ b/gst/videoparsers/gsth263parse.h @@ -30,7 +30,7 @@ #include #include -#include +#include #include "h263parse.h" diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c index 799303ea35..d5b539e427 100644 --- a/gst/videoparsers/gsth264parse.c +++ b/gst/videoparsers/gsth264parse.c @@ -25,6 +25,7 @@ #include #include +#include #include "gsth264parse.h" #include @@ -32,13 +33,11 @@ GST_DEBUG_CATEGORY (h264_parse_debug); #define GST_CAT_DEFAULT h264_parse_debug -#define DEFAULT_SPLIT_PACKETIZED FALSE #define DEFAULT_CONFIG_INTERVAL (0) enum { PROP_0, - PROP_SPLIT_PACKETIZED, PROP_CONFIG_INTERVAL, PROP_LAST }; @@ -67,7 +66,8 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/x-h264, parsed = (boolean) true")); -GST_BOILERPLATE (GstH264Parse, gst_h264_parse, GstElement, GST_TYPE_BASE_PARSE); +GST_BOILERPLATE (GstH264Parse, gst_h264_parse, GstBaseParse, + GST_TYPE_BASE_PARSE); static void gst_h264_parse_finalize (GObject * object); @@ -116,10 +116,6 @@ gst_h264_parse_class_init (GstH264ParseClass * klass) gobject_class->set_property = gst_h264_parse_set_property; gobject_class->get_property = gst_h264_parse_get_property; - g_object_class_install_property (gobject_class, PROP_SPLIT_PACKETIZED, - g_param_spec_boolean ("split-packetized", "Split packetized", - "Split NAL units of packetized streams", DEFAULT_SPLIT_PACKETIZED, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_CONFIG_INTERVAL, g_param_spec_uint ("config-interval", "SPS PPS Send Interval", @@ -160,6 +156,8 @@ gst_h264_parse_finalize (GObject * object) GstH264Parse *h264parse = GST_H264_PARSE (object); g_object_unref (h264parse->frame_out); + + G_OBJECT_CLASS (parent_class)->finalize (object); } static void @@ -173,6 +171,7 @@ gst_h264_parse_reset_frame (GstH264Parse * h264parse) h264parse->idr_pos = -1; h264parse->keyframe = FALSE; h264parse->frame_start = FALSE; + gst_adapter_clear (h264parse->frame_out); } static void @@ -200,12 +199,12 @@ gst_h264_parse_start (GstBaseParse * parse) { GstH264Parse *h264parse = GST_H264_PARSE (parse); - GST_DEBUG ("Start"); + GST_DEBUG_OBJECT (parse, "start"); gst_h264_parse_reset (h264parse); gst_h264_params_create (&h264parse->params, GST_ELEMENT (h264parse)); - gst_base_parse_set_min_frame_size (parse, 512); + gst_base_parse_set_min_frame_size (parse, 6); return TRUE; } @@ -215,7 +214,7 @@ gst_h264_parse_stop (GstBaseParse * parse) { GstH264Parse *h264parse = GST_H264_PARSE (parse); - GST_DEBUG ("Stop"); + GST_DEBUG_OBJECT (parse, "stop"); gst_h264_parse_reset (h264parse); gst_h264_params_free (h264parse->params); @@ -248,6 +247,40 @@ gst_h264_parse_get_string (GstH264Parse * parse, gboolean format, gint code) } } +static void +gst_h264_parse_format_from_caps (GstCaps * caps, guint * format, guint * align) +{ + + if (format) + *format = GST_H264_PARSE_FORMAT_NONE; + + if (align) + *align = GST_H264_PARSE_ALIGN_NONE; + + if (caps && gst_caps_get_size (caps) > 0) { + GstStructure *s = gst_caps_get_structure (caps, 0); + const gchar *str = NULL; + + if (format) { + if ((str = gst_structure_get_string (s, "stream-format"))) { + if (strcmp (str, "avc") == 0) + *format = GST_H264_PARSE_FORMAT_AVC; + else if (strcmp (str, "byte-stream") == 0) + *format = GST_H264_PARSE_FORMAT_BYTE; + } + } + + if (align) { + if ((str = gst_structure_get_string (s, "alignment"))) { + if (strcmp (str, "au") == 0) + *align = GST_H264_PARSE_ALIGN_AU; + else if (strcmp (str, "nal") == 0) + *align = GST_H264_PARSE_ALIGN_NAL; + } + } + } +} + /* check downstream caps to configure format and alignment */ static void gst_h264_parse_negotiate (GstH264Parse * h264parse) @@ -259,30 +292,7 @@ gst_h264_parse_negotiate (GstH264Parse * h264parse) caps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (h264parse)); GST_DEBUG_OBJECT (h264parse, "allowed caps: %" GST_PTR_FORMAT, caps); - if (caps && gst_caps_get_size (caps) > 0) { - GstStructure *s = gst_caps_get_structure (caps, 0); - const gchar *str = NULL; - - if ((str = gst_structure_get_string (s, "stream-format"))) { - if (strcmp (str, "avc") == 0) { - format = GST_H264_PARSE_FORMAT_AVC; - } else if (strcmp (str, "byte-stream") == 0) { - format = GST_H264_PARSE_FORMAT_BYTE; - } else { - GST_DEBUG_OBJECT (h264parse, "unknown stream-format: %s", str); - } - } - - if ((str = gst_structure_get_string (s, "alignment"))) { - if (strcmp (str, "au") == 0) { - align = GST_H264_PARSE_ALIGN_AU; - } else if (strcmp (str, "nal") == 0) { - align = GST_H264_PARSE_ALIGN_NAL; - } else { - GST_DEBUG_OBJECT (h264parse, "unknown alignment: %s", str); - } - } - } + gst_h264_parse_format_from_caps (caps, &format, &align); if (caps) gst_caps_unref (caps); @@ -333,9 +343,14 @@ gst_h264_parse_process_nal (GstH264Parse * h264parse, guint8 * data, { guint nal_type; - g_return_if_fail (nal_size >= 2); g_return_if_fail (nal_pos - sc_pos > 0 && nal_pos - sc_pos <= 4); + /* nothing to do for broken input */ + if (G_UNLIKELY (nal_size < 2)) { + GST_DEBUG_OBJECT (h264parse, "not processing nal size %u", nal_size); + return; + } + /* lower layer collects params */ gst_h264_params_parse_nal (h264parse->params, data + nal_pos, nal_size); @@ -445,6 +460,10 @@ gst_h264_parse_find_sc (GstBuffer * buffer, guint skip) return sc_pos; } +/* FIXME move into baseparse, or anything equivalent; + * see https://bugzilla.gnome.org/show_bug.cgi?id=650093 */ +#define GST_BASE_PARSE_FRAME_FLAG_PARSING 0x10000 + static gboolean gst_h264_parse_check_valid_frame (GstBaseParse * parse, GstBaseParseFrame * frame, guint * framesize, gint * skipsize) @@ -464,6 +483,15 @@ gst_h264_parse_check_valid_frame (GstBaseParse * parse, if (G_UNLIKELY (h264parse->format == GST_H264_PARSE_FORMAT_NONE)) gst_h264_parse_negotiate (h264parse); + /* avoid stale cached parsing state */ + if (!(frame->flags & GST_BASE_PARSE_FRAME_FLAG_PARSING)) { + GST_LOG_OBJECT (h264parse, "parsing new frame"); + gst_h264_parse_reset_frame (h264parse); + frame->flags |= GST_BASE_PARSE_FRAME_FLAG_PARSING; + } else { + GST_LOG_OBJECT (h264parse, "resuming frame parsing"); + } + data = GST_BUFFER_DATA (buffer); size = GST_BUFFER_SIZE (buffer); @@ -493,7 +521,7 @@ gst_h264_parse_check_valid_frame (GstBaseParse * parse, sc_pos = 0; } - drain = GST_BASE_PARSE_FRAME_DRAIN (frame); + drain = GST_BASE_PARSE_DRAINING (parse); while (TRUE) { gint prev_sc_pos; @@ -525,6 +553,20 @@ gst_h264_parse_check_valid_frame (GstBaseParse * parse, prev_sc_pos--; /* already consume and gather info from NAL */ + if (G_UNLIKELY (next_sc_pos - nal_pos < 2)) { + GST_WARNING_OBJECT (h264parse, "input stream is corrupt; " + "it contains a NAL unit of length %d", next_sc_pos - nal_pos); + /* broken nal at start -> arrange to skip it, + * otherwise have it terminate current au + * (and so it will be skippd on next frame round) */ + if (prev_sc_pos == sc_pos) { + *skipsize = sc_pos + 2; + return FALSE; + } else { + next_sc_pos = prev_sc_pos; + break; + } + } gst_h264_parse_process_nal (h264parse, data, prev_sc_pos, nal_pos, next_sc_pos - nal_pos); if (next_nal_pos >= size - 1 || @@ -542,14 +584,14 @@ gst_h264_parse_check_valid_frame (GstBaseParse * parse, return TRUE; more: - /* Ask for 1024 bytes more - this is an arbitrary choice */ - gst_base_parse_set_min_frame_size (parse, GST_BUFFER_SIZE (buffer) + 1024); + /* ask for best next available */ + *framesize = G_MAXUINT; /* skip up to initial startcode */ *skipsize = sc_pos; /* resume scanning here next time */ - h264parse->last_nal_pos = nal_pos; - h264parse->next_sc_pos = next_sc_pos; + h264parse->last_nal_pos = nal_pos - sc_pos; + h264parse->next_sc_pos = next_sc_pos - sc_pos; return FALSE; } @@ -626,10 +668,10 @@ gst_h264_parse_make_codec_data (GstH264Parse * h264parse) } static void -gst_h264_parse_update_src_caps (GstH264Parse * h264parse) +gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps) { GstH264ParamsSPS *sps; - GstCaps *caps = NULL, *sink_caps; + GstCaps *sink_caps; gboolean modified = FALSE; GstBuffer *buf = NULL; @@ -638,8 +680,14 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse) else if (G_UNLIKELY (!h264parse->update_caps)) return; + /* if this is being called from the first _setcaps call, caps on the sinkpad + * aren't set yet and so they need to be passed as an argument */ + if (caps) + sink_caps = caps; + else + sink_caps = GST_PAD_CAPS (GST_BASE_PARSE_SINK_PAD (h264parse)); + /* carry over input caps as much as possible; override with our own stuff */ - sink_caps = GST_PAD_CAPS (GST_BASE_PARSE_SINK_PAD (h264parse)); if (sink_caps) gst_caps_ref (sink_caps); else @@ -664,6 +712,7 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse) } } + caps = NULL; if (G_UNLIKELY (!sps)) { caps = gst_caps_copy (sink_caps); } else if (G_UNLIKELY (h264parse->width != sps->width || @@ -682,13 +731,14 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse) GST_TYPE_FRACTION, sps->fps_num, sps->fps_den, NULL); h264parse->fps_num = sps->fps_num; h264parse->fps_den = sps->fps_den; - gst_base_parse_set_frame_props (GST_BASE_PARSE (h264parse), + gst_base_parse_set_frame_rate (GST_BASE_PARSE (h264parse), h264parse->fps_num, h264parse->fps_den, 0, 0); } } if (caps) { - gst_caps_set_simple (caps, "stream-format", G_TYPE_STRING, + gst_caps_set_simple (caps, "parsed", G_TYPE_BOOLEAN, TRUE, + "stream-format", G_TYPE_STRING, gst_h264_parse_get_string (h264parse, TRUE, h264parse->format), "alignment", G_TYPE_STRING, gst_h264_parse_get_string (h264parse, FALSE, h264parse->align), NULL); @@ -722,7 +772,7 @@ gst_h264_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame) h264parse = GST_H264_PARSE (parse); buffer = frame->buffer; - gst_h264_parse_update_src_caps (h264parse); + gst_h264_parse_update_src_caps (h264parse, NULL); gst_h264_params_get_timestamp (h264parse->params, &GST_BUFFER_TIMESTAMP (buffer), &GST_BUFFER_DURATION (buffer), @@ -741,6 +791,7 @@ gst_h264_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame) buf = gst_adapter_take_buffer (h264parse->frame_out, av); gst_buffer_copy_metadata (buf, buffer, GST_BUFFER_COPY_ALL); gst_buffer_replace (&frame->buffer, buf); + gst_buffer_unref (buf); } return GST_FLOW_OK; @@ -864,6 +915,7 @@ gst_h264_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame) new_buf = gst_byte_writer_reset_and_get_buffer (&bw); gst_buffer_copy_metadata (new_buf, buffer, GST_BUFFER_COPY_ALL); gst_buffer_replace (&frame->buffer, new_buf); + gst_buffer_unref (new_buf); } } /* we pushed whatever we had */ @@ -882,8 +934,8 @@ gst_h264_parse_set_caps (GstBaseParse * parse, GstCaps * caps) GstH264Parse *h264parse; GstStructure *str; const GValue *value; - GstBuffer *buffer = NULL; - guint size; + GstBuffer *codec_data = NULL; + guint size, format, align; h264parse = GST_H264_PARSE (parse); @@ -908,11 +960,11 @@ gst_h264_parse_set_caps (GstBaseParse * parse, GstCaps * caps) /* make note for optional split processing */ h264parse->packetized = TRUE; - buffer = gst_value_get_buffer (value); - if (!buffer) + codec_data = gst_value_get_buffer (value); + if (!codec_data) goto wrong_type; - data = GST_BUFFER_DATA (buffer); - size = GST_BUFFER_SIZE (buffer); + data = GST_BUFFER_DATA (codec_data); + size = GST_BUFFER_SIZE (codec_data); /* parse the avcC data */ if (size < 7) @@ -957,6 +1009,8 @@ gst_h264_parse_set_caps (GstBaseParse * parse, GstCaps * caps) data += len + 2; size -= len + 2; } + + h264parse->codec_data = gst_buffer_ref (codec_data); } else { GST_DEBUG_OBJECT (h264parse, "have bytestream h264"); /* nothing to pre-process */ @@ -965,32 +1019,35 @@ gst_h264_parse_set_caps (GstBaseParse * parse, GstCaps * caps) h264parse->nal_length_size = 4; } - if (h264parse->packetized) { - if (h264parse->split_packetized) { - GST_DEBUG_OBJECT (h264parse, - "converting AVC to nal bytestream prior to parsing"); - /* negotiate behaviour with upstream */ - gst_h264_parse_negotiate (h264parse); - if (h264parse->format == GST_H264_PARSE_FORMAT_BYTE) { - /* arrange to insert codec-data in-stream if needed */ - h264parse->push_codec = h264parse->packetized; - } - } else { - GST_DEBUG_OBJECT (h264parse, "passing on packetized AVC"); - /* no choice to negotiate */ - h264parse->format = GST_H264_PARSE_FORMAT_AVC; - h264parse->align = GST_H264_PARSE_ALIGN_AU; - /* fallback codec-data */ - h264parse->codec_data = gst_buffer_ref (buffer); - /* pass through unharmed, though _chain will parse a bit */ - gst_base_parse_set_format (parse, - GST_BASE_PARSE_FORMAT_PASSTHROUGH, TRUE); - /* we did parse codec-data and might supplement src caps */ - gst_h264_parse_update_src_caps (h264parse); - } + /* negotiate with downstream, sets ->format and ->align */ + gst_h264_parse_negotiate (h264parse); + + /* get upstream format and align from caps */ + gst_h264_parse_format_from_caps (caps, &format, &align); + + /* if upstream sets codec_data without setting stream-format and alignment, we + * assume stream-format=avc,alignment=au */ + if (format == GST_H264_PARSE_FORMAT_NONE) { + if (codec_data == NULL) + goto unknown_input_format; + + format = GST_H264_PARSE_FORMAT_AVC; + align = GST_H264_PARSE_ALIGN_AU; + } + + if (format == h264parse->format && align == h264parse->align) { + gst_base_parse_set_passthrough (parse, TRUE); + + /* we did parse codec-data and might supplement src caps */ + gst_h264_parse_update_src_caps (h264parse, caps); + } else if (format == GST_H264_PARSE_FORMAT_AVC && + h264parse->format == GST_H264_PARSE_FORMAT_BYTE) { + /* arrange to insert codec-data in-stream if needed. + * src caps are only arranged for later on */ + h264parse->push_codec = TRUE; + h264parse->split_packetized = TRUE; } - /* src caps are only arranged for later on */ return TRUE; /* ERRORS */ @@ -1009,6 +1066,11 @@ wrong_type: GST_DEBUG_OBJECT (h264parse, "wrong codec-data type"); goto refuse_caps; } +unknown_input_format: + { + GST_DEBUG_OBJECT (h264parse, "unknown stream-format and no codec_data"); + goto refuse_caps; + } refuse_caps: { GST_WARNING_OBJECT (h264parse, "refused caps %" GST_PTR_FORMAT, caps); @@ -1076,21 +1138,24 @@ gst_h264_parse_chain (GstPad * pad, GstBuffer * buffer) gst_byte_reader_skip_unchecked (&br, len); } } - if (h264parse->split_packetized) + if (h264parse->split_packetized) { + gst_buffer_unref (buffer); return ret; + } else { + /* nal processing in pass-through might have collected stuff; + * ensure nothing happens with this later on */ + gst_adapter_clear (h264parse->frame_out); + } } exit: - /* nal processing in pass-through might have collected stuff; - * ensure nothing happens with this later on */ - gst_adapter_clear (h264parse->frame_out); - return h264parse->parse_chain (pad, buffer); /* ERRORS */ not_negotiated: { GST_DEBUG_OBJECT (h264parse, "insufficient data to split input"); + gst_buffer_unref (buffer); return GST_FLOW_NOT_NEGOTIATED; } parse_failed: @@ -1098,6 +1163,7 @@ parse_failed: if (h264parse->split_packetized) { GST_ELEMENT_ERROR (h264parse, STREAM, FAILED, (NULL), ("invalid AVC input data")); + gst_buffer_unref (buffer); return GST_FLOW_ERROR; } else { /* do not meddle to much in this case */ @@ -1116,9 +1182,6 @@ gst_h264_parse_set_property (GObject * object, guint prop_id, parse = GST_H264_PARSE (object); switch (prop_id) { - case PROP_SPLIT_PACKETIZED: - parse->split_packetized = g_value_get_boolean (value); - break; case PROP_CONFIG_INTERVAL: parse->interval = g_value_get_uint (value); break; @@ -1137,9 +1200,6 @@ gst_h264_parse_get_property (GObject * object, guint prop_id, GValue * value, parse = GST_H264_PARSE (object); switch (prop_id) { - case PROP_SPLIT_PACKETIZED: - g_value_set_boolean (value, parse->split_packetized); - break; case PROP_CONFIG_INTERVAL: g_value_set_uint (value, parse->interval); break; diff --git a/gst/videoparsers/gsth264parse.h b/gst/videoparsers/gsth264parse.h index 7f42bc5d99..1aa1323211 100644 --- a/gst/videoparsers/gsth264parse.h +++ b/gst/videoparsers/gsth264parse.h @@ -23,7 +23,7 @@ #define __GST_H264_PARSE_H__ #include -#include +#include #include "h264parse.h" diff --git a/gst/videoparsers/gstmpegvideoparse.c b/gst/videoparsers/gstmpegvideoparse.c new file mode 100644 index 0000000000..7ebbdf36a4 --- /dev/null +++ b/gst/videoparsers/gstmpegvideoparse.c @@ -0,0 +1,703 @@ +/* GStreamer + * Copyright (C) <2007> Jan Schmidt + * Copyright (C) <2011> Mark Nauwelaerts + * Copyright (C) <2011> Collabora Multimedia + * Copyright (C) <2011> Nokia Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "gstmpegvideoparse.h" + +GST_DEBUG_CATEGORY (mpegv_parse_debug); +#define GST_CAT_DEFAULT mpegv_parse_debug + +static GstStaticPadTemplate src_template = +GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("video/mpeg, " + "mpegversion = (int) [1, 2], " + "parsed = (boolean) true, " "systemstream = (boolean) false") + ); + +static GstStaticPadTemplate sink_template = +GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("video/mpeg, " + "mpegversion = (int) [1, 2], " + "parsed = (boolean) false, " "systemstream = (boolean) false") + ); + +/* Properties */ +#define DEFAULT_PROP_DROP TRUE +#define DEFAULT_PROP_GOP_SPLIT FALSE + +enum +{ + PROP_0, + PROP_DROP, + PROP_GOP_SPLIT, + PROP_LAST +}; + +GST_BOILERPLATE (GstMpegvParse, gst_mpegv_parse, GstBaseParse, + GST_TYPE_BASE_PARSE); + +static gboolean gst_mpegv_parse_start (GstBaseParse * parse); +static gboolean gst_mpegv_parse_stop (GstBaseParse * parse); +static gboolean gst_mpegv_parse_check_valid_frame (GstBaseParse * parse, + GstBaseParseFrame * frame, guint * framesize, gint * skipsize); +static GstFlowReturn gst_mpegv_parse_parse_frame (GstBaseParse * parse, + GstBaseParseFrame * frame); +static gboolean gst_mpegv_parse_set_caps (GstBaseParse * parse, GstCaps * caps); + +static void gst_mpegv_parse_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec); +static void gst_mpegv_parse_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec); + +static void +gst_mpegv_parse_base_init (gpointer klass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&src_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_template)); + + gst_element_class_set_details_simple (element_class, + "MPEG video elementary stream parser", + "Codec/Parser/Video", + "Parses and frames MPEG-1 and MPEG-2 elementary video streams", + "Wim Taymans , " + "Jan Schmidt , " + "Mark Nauwelaerts "); + + GST_DEBUG_CATEGORY_INIT (mpegv_parse_debug, "mpegvideoparse", 0, + "MPEG-1/2 video parser"); +} + +static void +gst_mpegv_parse_set_property (GObject * object, guint property_id, + const GValue * value, GParamSpec * pspec) +{ + GstMpegvParse *parse = GST_MPEGVIDEO_PARSE (object); + + switch (property_id) { + case PROP_DROP: + parse->drop = g_value_get_boolean (value); + break; + case PROP_GOP_SPLIT: + parse->gop_split = g_value_get_boolean (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +gst_mpegv_parse_get_property (GObject * object, guint property_id, + GValue * value, GParamSpec * pspec) +{ + GstMpegvParse *parse = GST_MPEGVIDEO_PARSE (object); + + switch (property_id) { + case PROP_DROP: + g_value_set_boolean (value, parse->drop); + break; + case PROP_GOP_SPLIT: + g_value_set_boolean (value, parse->gop_split); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } +} + +static void +gst_mpegv_parse_class_init (GstMpegvParseClass * klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GstBaseParseClass *parse_class = GST_BASE_PARSE_CLASS (klass); + + parent_class = g_type_class_peek_parent (klass); + + gobject_class->set_property = gst_mpegv_parse_set_property; + gobject_class->get_property = gst_mpegv_parse_get_property; + + g_object_class_install_property (gobject_class, PROP_DROP, + g_param_spec_boolean ("drop", "drop", + "Drop data untill valid configuration data is received either " + "in the stream or through caps", DEFAULT_PROP_DROP, + G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (gobject_class, PROP_GOP_SPLIT, + g_param_spec_boolean ("gop-split", "gop-split", + "Split frame when encountering GOP", DEFAULT_PROP_GOP_SPLIT, + G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + /* Override BaseParse vfuncs */ + parse_class->start = GST_DEBUG_FUNCPTR (gst_mpegv_parse_start); + parse_class->stop = GST_DEBUG_FUNCPTR (gst_mpegv_parse_stop); + parse_class->check_valid_frame = + GST_DEBUG_FUNCPTR (gst_mpegv_parse_check_valid_frame); + parse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_mpegv_parse_parse_frame); + parse_class->set_sink_caps = GST_DEBUG_FUNCPTR (gst_mpegv_parse_set_caps); +} + +static void +gst_mpegv_parse_init (GstMpegvParse * parse, GstMpegvParseClass * g_class) +{ +} + +static void +gst_mpegv_parse_reset_frame (GstMpegvParse * mpvparse) +{ + /* done parsing; reset state */ + mpvparse->last_sc = -1; + mpvparse->seq_offset = -1; + mpvparse->pic_offset = -1; +} + +static void +gst_mpegv_parse_reset (GstMpegvParse * mpvparse) +{ + gst_mpegv_parse_reset_frame (mpvparse); + mpvparse->profile = 0; + mpvparse->update_caps = TRUE; + + gst_buffer_replace (&mpvparse->config, NULL); + memset (&mpvparse->params, 0, sizeof (mpvparse->params)); +} + +static gboolean +gst_mpegv_parse_start (GstBaseParse * parse) +{ + GstMpegvParse *mpvparse = GST_MPEGVIDEO_PARSE (parse); + + GST_DEBUG_OBJECT (parse, "start"); + + gst_mpegv_parse_reset (mpvparse); + /* at least this much for a valid frame */ + gst_base_parse_set_min_frame_size (parse, 6); + + return TRUE; +} + +static gboolean +gst_mpegv_parse_stop (GstBaseParse * parse) +{ + GstMpegvParse *mpvparse = GST_MPEGVIDEO_PARSE (parse); + + GST_DEBUG_OBJECT (parse, "stop"); + + gst_mpegv_parse_reset (mpvparse); + + return TRUE; +} + +static gboolean +gst_mpegv_parse_process_config (GstMpegvParse * mpvparse, const guint8 * data, + gsize size) +{ + /* only do stuff if something new */ + if (mpvparse->config && size == GST_BUFFER_SIZE (mpvparse->config) && + memcmp (GST_BUFFER_DATA (mpvparse->config), data, size) == 0) + return TRUE; + + if (!gst_mpeg_video_params_parse_config (&mpvparse->params, data, size)) { + GST_DEBUG_OBJECT (mpvparse, "failed to parse config data (size %" + G_GSSIZE_FORMAT ")", size); + return FALSE; + } + + GST_LOG_OBJECT (mpvparse, "accepting parsed config size %" G_GSSIZE_FORMAT, + size); + + /* parsing ok, so accept it as new config */ + if (mpvparse->config != NULL) + gst_buffer_unref (mpvparse->config); + + mpvparse->config = gst_buffer_new_and_alloc (size); + memcpy (GST_BUFFER_DATA (mpvparse->config), data, size); + + /* trigger src caps update */ + mpvparse->update_caps = TRUE; + + return TRUE; +} + +#ifndef GST_DISABLE_GST_DEBUG +static const gchar * +picture_start_code_name (guint8 psc) +{ + guint i; + const struct + { + guint8 psc; + const gchar *name; + } psc_names[] = { + { + 0x00, "Picture Start"}, { + 0xb0, "Reserved"}, { + 0xb1, "Reserved"}, { + 0xb2, "User Data Start"}, { + 0xb3, "Sequence Header Start"}, { + 0xb4, "Sequence Error"}, { + 0xb5, "Extension Start"}, { + 0xb6, "Reserved"}, { + 0xb7, "Sequence End"}, { + 0xb8, "Group Start"}, { + 0xb9, "Program End"} + }; + if (psc < 0xB0 && psc > 0) + return "Slice Start"; + + for (i = 0; i < G_N_ELEMENTS (psc_names); i++) + if (psc_names[i].psc == psc) + return psc_names[i].name; + + return "UNKNOWN"; +}; + +static const gchar * +picture_type_name (guint8 pct) +{ + guint i; + const struct + { + guint8 pct; + const gchar *name; + } pct_names[] = { + { + 0, "Forbidden"}, { + 1, "I Frame"}, { + 2, "P Frame"}, { + 3, "B Frame"}, { + 4, "DC Intra Coded (Shall Not Be Used!)"} + }; + + for (i = 0; i < G_N_ELEMENTS (pct_names); i++) + if (pct_names[i].pct == pct) + return pct_names[i].name; + + return "Reserved/Unknown"; +} +#endif /* GST_DISABLE_GST_DEBUG */ + +/* caller guarantees at least start code in @buf at @off */ +/* for off == 0 initial code; returns TRUE if code starts a frame, + * otherwise returns TRUE if code terminates preceding frame */ +static gboolean +gst_mpegv_parse_process_sc (GstMpegvParse * mpvparse, GstBuffer * buf, gint off) +{ + gboolean ret = FALSE, do_seq = TRUE; + guint8 *data; + guint code; + + g_return_val_if_fail (buf && GST_BUFFER_SIZE (buf) >= 4, FALSE); + + data = GST_BUFFER_DATA (buf); + code = data[off + 3]; + + GST_LOG_OBJECT (mpvparse, "process startcode %x (%s)", code, + picture_start_code_name (code)); + + switch (code) { + case MPEG_PACKET_PICTURE: + GST_LOG_OBJECT (mpvparse, "startcode is PICTURE"); + /* picture is aggregated with preceding sequence/gop, if any. + * so, picture start code only ends if already a previous one */ + if (mpvparse->pic_offset < 0) + mpvparse->pic_offset = off; + else + ret = TRUE; + if (!off) + ret = TRUE; + break; + case MPEG_PACKET_SEQUENCE: + GST_LOG_OBJECT (mpvparse, "startcode is SEQUENCE"); + if (off == 0) + mpvparse->seq_offset = off; + ret = TRUE; + break; + case MPEG_PACKET_GOP: + GST_LOG_OBJECT (mpvparse, "startcode is GOP"); + if (mpvparse->seq_offset >= 0) + ret = mpvparse->gop_split; + else + ret = TRUE; + break; + default: + do_seq = FALSE; + break; + } + + /* process config data */ + if (G_UNLIKELY (mpvparse->seq_offset >= 0 && off && do_seq)) { + g_assert (mpvparse->seq_offset == 0); + gst_mpegv_parse_process_config (mpvparse, GST_BUFFER_DATA (buf), off); + /* avoid accepting again for a PICTURE sc following a GOP sc */ + mpvparse->seq_offset = -1; + } + + /* extract some picture info if there is any in the frame being terminated */ + if (G_UNLIKELY (ret && off)) { + if (G_LIKELY (mpvparse->pic_offset >= 0 && mpvparse->pic_offset < off)) { + if (G_LIKELY (GST_BUFFER_SIZE (buf) >= mpvparse->pic_offset + 6)) { + gint pct = (data[mpvparse->pic_offset + 5] >> 3) & 0x7; + + GST_LOG_OBJECT (mpvparse, "picture_coding_type %d (%s)", pct, + picture_type_name (pct)); + mpvparse->intra_frame = (pct == MPEG_PICTURE_TYPE_I); + } else { + GST_WARNING_OBJECT (mpvparse, "no data following PICTURE startcode"); + mpvparse->intra_frame = FALSE; + } + } else { + /* frame without picture must be some config, consider as keyframe */ + mpvparse->intra_frame = TRUE; + } + GST_LOG_OBJECT (mpvparse, "ending frame of size %d, is intra %d", off, + mpvparse->intra_frame); + } + + return ret; +} + +static inline guint +scan_for_start_codes (const GstByteReader * reader, guint offset, guint size) +{ + const guint8 *data; + guint32 state; + guint i; + + g_return_val_if_fail (size > 0, -1); + g_return_val_if_fail ((guint64) offset + size <= reader->size - reader->byte, + -1); + + /* we can't find the pattern with less than 4 bytes */ + if (G_UNLIKELY (size < 4)) + return -1; + + data = reader->data + reader->byte + offset; + + /* set the state to something that does not match */ + state = 0xffffffff; + + /* now find data */ + for (i = 0; i < size; i++) { + /* throw away one byte and move in the next byte */ + state = ((state << 8) | data[i]); + if (G_UNLIKELY ((state & 0xffffff00) == 0x00000100)) { + /* we have a match but we need to have skipped at + * least 4 bytes to fill the state. */ + if (G_LIKELY (i >= 3)) + return offset + i - 3; + } + + /* Accelerate search for start code */ + if (data[i] > 1) { + while (i < (size - 4) && data[i] > 1) { + if (data[i + 3] > 1) + i += 4; + else + i += 1; + } + state = 0x00000100; + } + } + + /* nothing found */ + return -1; +} + +/* FIXME move into baseparse, or anything equivalent; + * see https://bugzilla.gnome.org/show_bug.cgi?id=650093 */ +#define GST_BASE_PARSE_FRAME_FLAG_PARSING 0x10000 + +static gboolean +gst_mpegv_parse_check_valid_frame (GstBaseParse * parse, + GstBaseParseFrame * frame, guint * framesize, gint * skipsize) +{ + GstMpegvParse *mpvparse = GST_MPEGVIDEO_PARSE (parse); + GstBuffer *buf = frame->buffer; + GstByteReader reader = GST_BYTE_READER_INIT_FROM_BUFFER (buf); + gint off = 0; + gboolean ret; + +retry: + /* at least start code and subsequent byte */ + if (G_UNLIKELY (GST_BUFFER_SIZE (buf) - off < 5)) + return FALSE; + + /* avoid stale cached parsing state */ + if (!(frame->flags & GST_BASE_PARSE_FRAME_FLAG_PARSING)) { + GST_LOG_OBJECT (mpvparse, "parsing new frame"); + gst_mpegv_parse_reset_frame (mpvparse); + frame->flags |= GST_BASE_PARSE_FRAME_FLAG_PARSING; + } else { + GST_LOG_OBJECT (mpvparse, "resuming frame parsing"); + } + + /* if already found a previous start code, e.g. start of frame, go for next */ + if (mpvparse->last_sc >= 0) { + off = mpvparse->last_sc; + goto next; + } + + off = scan_for_start_codes (&reader, off, GST_BUFFER_SIZE (buf) - off); + + GST_LOG_OBJECT (mpvparse, "possible sync at buffer offset %d", off); + + /* didn't find anything that looks like a sync word, skip */ + if (G_UNLIKELY (off < 0)) { + *skipsize = GST_BUFFER_SIZE (buf) - 3; + return FALSE; + } + + /* possible frame header, but not at offset 0? skip bytes before sync */ + if (G_UNLIKELY (off > 0)) { + *skipsize = off; + return FALSE; + } + + /* note: initial start code is assumed at offset 0 by subsequent code */ + + /* examine start code, see if it looks like an initial start code */ + if (gst_mpegv_parse_process_sc (mpvparse, buf, 0)) { + /* found sc */ + mpvparse->last_sc = 0; + } else { + off++; + goto retry; + } + +next: + /* start is fine as of now */ + *skipsize = 0; + /* position a bit further than last sc */ + off++; + /* so now we have start code at start of data; locate next start code */ + off = scan_for_start_codes (&reader, off, GST_BUFFER_SIZE (buf) - off); + + GST_LOG_OBJECT (mpvparse, "next start code at %d", off); + if (off < 0) { + /* if draining, take all */ + if (GST_BASE_PARSE_DRAINING (parse)) { + off = GST_BUFFER_SIZE (buf); + ret = TRUE; + } else { + /* resume scan where we left it */ + mpvparse->last_sc = GST_BUFFER_SIZE (buf) - 4; + /* request best next available */ + *framesize = G_MAXUINT; + return FALSE; + } + } else { + /* decide whether this startcode ends a frame */ + ret = gst_mpegv_parse_process_sc (mpvparse, buf, off); + } + + if (ret) { + *framesize = off; + } else { + goto next; + } + + return ret; +} + +static void +gst_mpegv_parse_update_src_caps (GstMpegvParse * mpvparse) +{ + GstCaps *caps = NULL; + + /* only update if no src caps yet or explicitly triggered */ + if (G_LIKELY (GST_PAD_CAPS (GST_BASE_PARSE_SRC_PAD (mpvparse)) && + !mpvparse->update_caps)) + return; + + /* carry over input caps as much as possible; override with our own stuff */ + caps = GST_PAD_CAPS (GST_BASE_PARSE_SINK_PAD (mpvparse)); + if (caps) { + caps = gst_caps_copy (caps); + } else { + caps = gst_caps_new_simple ("video/mpeg", NULL); + } + + /* typically we don't output buffers until we have properly parsed some + * config data, so we should at least know about version. + * If not, it means it has been requested not to drop data, and + * upstream and/or app must know what they are doing ... */ + if (G_LIKELY (mpvparse->params.mpeg_version)) + gst_caps_set_simple (caps, + "mpegversion", G_TYPE_INT, mpvparse->params.mpeg_version, NULL); + + gst_caps_set_simple (caps, "systemstream", G_TYPE_BOOLEAN, FALSE, + "parsed", G_TYPE_BOOLEAN, TRUE, NULL); + + if (mpvparse->params.width > 0 && mpvparse->params.height > 0) { + gst_caps_set_simple (caps, "width", G_TYPE_INT, mpvparse->params.width, + "height", G_TYPE_INT, mpvparse->params.height, NULL); + } + + /* perhaps we have a framerate */ + if (mpvparse->params.fps_n > 0 && mpvparse->params.fps_d > 0) { + gint fps_num = mpvparse->params.fps_n; + gint fps_den = mpvparse->params.fps_d; + GstClockTime latency = gst_util_uint64_scale (GST_SECOND, fps_den, fps_num); + + gst_caps_set_simple (caps, "framerate", + GST_TYPE_FRACTION, fps_num, fps_den, NULL); + gst_base_parse_set_frame_rate (GST_BASE_PARSE (mpvparse), + fps_num, fps_den, 0, 0); + gst_base_parse_set_latency (GST_BASE_PARSE (mpvparse), latency, latency); + } + + /* or pixel-aspect-ratio */ + if (mpvparse->params.par_w && mpvparse->params.par_h > 0) { + gst_caps_set_simple (caps, "pixel-aspect-ratio", GST_TYPE_FRACTION, + mpvparse->params.par_w, mpvparse->params.par_h, NULL); + } + + if (mpvparse->config != NULL) { + gst_caps_set_simple (caps, "codec_data", + GST_TYPE_BUFFER, mpvparse->config, NULL); + } + + if (mpvparse->params.mpeg_version == 2) { + const guint profile_c = mpvparse->params.profile; + const guint level_c = mpvparse->params.level; + const gchar *profile = NULL, *level = NULL; + /* + * Profile indication - 1 => High, 2 => Spatially Scalable, + * 3 => SNR Scalable, 4 => Main, 5 => Simple + * 4:2:2 and Multi-view have profile = 0, with the escape bit set to 1 + */ + const gchar *profiles[] = { "high", "spatial", "snr", "main", "simple" }; + /* + * Level indication - 4 => High, 6 => High-1440, 8 => Main, 10 => Low, + * except in the case of profile = 0 + */ + const gchar *levels[] = { "high", "high-1440", "main", "low" }; + + if (profile_c > 0 && profile_c < 6) + profile = profiles[profile_c - 1]; + + if ((level_c > 3) && (level_c < 11) && (level_c % 2 == 0)) + level = levels[(level_c >> 1) - 1]; + + if (profile_c == 8) { + /* Non-hierarchical profile */ + switch (level_c) { + case 2: + level = levels[0]; + case 5: + level = levels[2]; + profile = "4:2:2"; + break; + case 10: + level = levels[0]; + case 11: + level = levels[1]; + case 13: + level = levels[2]; + case 14: + level = levels[3]; + profile = "multiview"; + break; + default: + break; + } + } + + /* FIXME does it make sense to expose profile/level in the caps ? */ + + if (profile) + gst_caps_set_simple (caps, "profile", G_TYPE_STRING, profile, NULL); + else + GST_DEBUG_OBJECT (mpvparse, "Invalid profile - %u", profile_c); + + if (level) + gst_caps_set_simple (caps, "level", G_TYPE_STRING, level, NULL); + else + GST_DEBUG_OBJECT (mpvparse, "Invalid level - %u", level_c); + } + + gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (mpvparse), caps); + gst_caps_unref (caps); +} + +static GstFlowReturn +gst_mpegv_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame) +{ + GstMpegvParse *mpvparse = GST_MPEGVIDEO_PARSE (parse); + GstBuffer *buffer = frame->buffer; + + gst_mpegv_parse_update_src_caps (mpvparse); + + if (G_UNLIKELY (mpvparse->intra_frame)) + GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DELTA_UNIT); + else + GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT); + + /* maybe only sequence in this buffer, though not recommended, + * so mark it as such and force 0 duration */ + if (G_UNLIKELY (mpvparse->pic_offset < 0)) { + GST_DEBUG_OBJECT (mpvparse, "frame holds no picture data"); + frame->flags |= GST_BASE_PARSE_FRAME_FLAG_NO_FRAME; + GST_BUFFER_DURATION (buffer) = 0; + } + + if (G_UNLIKELY (mpvparse->drop && !mpvparse->config)) { + GST_DEBUG_OBJECT (mpvparse, "dropping frame as no config yet"); + return GST_BASE_PARSE_FLOW_DROPPED; + } else + return GST_FLOW_OK; +} + +static gboolean +gst_mpegv_parse_set_caps (GstBaseParse * parse, GstCaps * caps) +{ + GstMpegvParse *mpvparse = GST_MPEGVIDEO_PARSE (parse); + GstStructure *s; + const GValue *value; + GstBuffer *buf; + + GST_DEBUG_OBJECT (parse, "setcaps called with %" GST_PTR_FORMAT, caps); + + s = gst_caps_get_structure (caps, 0); + + if ((value = gst_structure_get_value (s, "codec_data")) != NULL + && (buf = gst_value_get_buffer (value))) { + /* best possible parse attempt, + * src caps are based on sink caps so it will end up in there + * whether sucessful or not */ + gst_mpegv_parse_process_config (mpvparse, GST_BUFFER_DATA (buf), + GST_BUFFER_SIZE (buf)); + } + + /* let's not interfere and accept regardless of config parsing success */ + return TRUE; +} diff --git a/gst/videoparsers/gstmpegvideoparse.h b/gst/videoparsers/gstmpegvideoparse.h new file mode 100644 index 0000000000..a3706a41a4 --- /dev/null +++ b/gst/videoparsers/gstmpegvideoparse.h @@ -0,0 +1,75 @@ +/* GStreamer + * Copyright (C) <2007> Jan Schmidt + * Copyright (C) <2011> Mark Nauwelaerts + * Copyright (C) <2011> Collabora Multimedia + * Copyright (C) <2011> Nokia Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GST_MPEGVIDEO_PARSE_H__ +#define __GST_MPEGVIDEO_PARSE_H__ + +#include +#include + +#include "mpegvideoparse.h" + +G_BEGIN_DECLS + +#define GST_TYPE_MPEGVIDEO_PARSE (gst_mpegv_parse_get_type()) +#define GST_MPEGVIDEO_PARSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\ + GST_TYPE_MPEGVIDEO_PARSE, GstMpegvParse)) +#define GST_MPEGVIDEO_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\ + GST_TYPE_MPEGVIDEO_PARSE, GstMpegvParseClass)) +#define GST_MPEGVIDEO_PARSE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\ + GST_TYPE_MPEGVIDEO_PARSE, GstMpegvParseClass)) +#define GST_IS_MPEGVIDEO_PARSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),\ + GST_TYPE_MPEGVIDEO_PARSE)) +#define GST_IS_MPEGVIDEO_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\ + GST_TYPE_MPEGVIDEO_PARSE)) + +typedef struct _GstMpegvParse GstMpegvParse; +typedef struct _GstMpegvParseClass GstMpegvParseClass; + +struct _GstMpegvParse { + GstBaseParse element; + + /* parse state */ + gint last_sc; + gint seq_offset; + gint pic_offset; + gboolean intra_frame; + gboolean update_caps; + + GstBuffer *config; + guint8 profile; + MPEGVParams params; + + /* properties */ + gboolean drop; + gboolean gop_split; +}; + +struct _GstMpegvParseClass { + GstBaseParseClass parent_class; +}; + +GType gst_mpegv_parse_get_type (void); + +G_END_DECLS + +#endif /* __GST_MPEGVIDEO_PARSE_H__ */ diff --git a/gst/videoparsers/h263parse.c b/gst/videoparsers/h263parse.c index 1fdf22316b..09cbbd4f36 100644 --- a/gst/videoparsers/h263parse.c +++ b/gst/videoparsers/h263parse.c @@ -142,6 +142,8 @@ gst_h263_parse_get_params (H263Params * params, GstBuffer * buffer, /* Fill in width/height based on format */ params->width = sizetable[params->format][0]; params->height = sizetable[params->format][1]; + GST_DEBUG (" Picture width x height: %d x %d", + params->width, params->height); /* Default PAR is 12/11 */ params->parnum = 12; diff --git a/gst/videoparsers/h263parse.h b/gst/videoparsers/h263parse.h index 80eb919ae6..3117e08968 100644 --- a/gst/videoparsers/h263parse.h +++ b/gst/videoparsers/h263parse.h @@ -25,7 +25,6 @@ #include #include -#include G_BEGIN_DECLS diff --git a/gst/videoparsers/h264parse.c b/gst/videoparsers/h264parse.c index f0ec757f87..a556d449cc 100644 --- a/gst/videoparsers/h264parse.c +++ b/gst/videoparsers/h264parse.c @@ -148,16 +148,14 @@ gst_nal_bs_read_se (GstNalBs * bs) /* end parser helper */ static void -gst_h264_params_store_nal (GstH264Params * params, GstBuffer ** store, gint id, - GstNalBs * bs) +gst_h264_params_store_nal (GstH264Params * params, GstBuffer ** store, + gint store_size, gint id, GstNalBs * bs) { const guint8 *data; GstBuffer *buf; guint size; - g_return_if_fail (MAX_SPS_COUNT == MAX_PPS_COUNT); - - if (id >= MAX_SPS_COUNT) { + if (id >= store_size) { GST_DEBUG_OBJECT (params->el, "unable to store nal, id out-of-range %d", id); return; @@ -166,7 +164,11 @@ gst_h264_params_store_nal (GstH264Params * params, GstBuffer ** store, gint id, gst_nal_bs_get_data (bs, &data, &size); buf = gst_buffer_new_and_alloc (size); memcpy (GST_BUFFER_DATA (buf), data, size); - gst_buffer_replace (store + id, buf); + + if (store[id]) + gst_buffer_unref (store[id]); + + store[id] = buf; } static GstH264ParamsSPS * @@ -203,12 +205,6 @@ gst_h264_params_get_pps (GstH264Params * params, guint8 pps_id, gboolean set) g_return_val_if_fail (params != NULL, NULL); - if (G_UNLIKELY (pps_id >= MAX_PPS_COUNT)) { - GST_WARNING_OBJECT (params->el, - "requested pps_id=%04x out of range", pps_id); - return NULL; - } - pps = ¶ms->pps_buffers[pps_id]; if (set) { if (pps->valid) { @@ -391,7 +387,8 @@ gst_h264_params_decode_sps (GstH264Params * params, GstNalBs * bs) if (G_UNLIKELY (sps == NULL)) return FALSE; - gst_h264_params_store_nal (params, params->sps_nals, sps_id, bs); + gst_h264_params_store_nal (params, params->sps_nals, MAX_SPS_COUNT, sps_id, + bs); /* could be redefined mid stream, arrange for clear state */ memset (sps, 0, sizeof (*sps)); @@ -553,10 +550,16 @@ gst_h264_params_decode_sps (GstH264Params * params, GstNalBs * bs) static gboolean gst_h264_params_decode_pps (GstH264Params * params, GstNalBs * bs) { - guint8 pps_id; + gint pps_id; GstH264ParamsPPS *pps = NULL; pps_id = gst_nal_bs_read_ue (bs); + if (G_UNLIKELY (pps_id >= MAX_PPS_COUNT)) { + GST_WARNING_OBJECT (params->el, + "requested pps_id=%04x out of range", pps_id); + return FALSE; + } + pps = gst_h264_params_get_pps (params, pps_id, FALSE); if (G_UNLIKELY (pps == NULL)) @@ -566,7 +569,8 @@ gst_h264_params_decode_pps (GstH264Params * params, GstNalBs * bs) pps->valid = TRUE; params->pps = pps; - gst_h264_params_store_nal (params, params->pps_nals, pps_id, bs); + gst_h264_params_store_nal (params, params->pps_nals, MAX_PPS_COUNT, pps_id, + bs); pps->sps_id = gst_nal_bs_read_ue (bs); GST_LOG_OBJECT (params->el, "pps %d referencing sps %d", pps_id, pps->sps_id); @@ -1036,7 +1040,7 @@ gst_h264_params_free (GstH264Params * params) for (i = 0; i < MAX_SPS_COUNT; i++) gst_buffer_replace (¶ms->sps_nals[i], NULL); for (i = 0; i < MAX_PPS_COUNT; i++) - gst_buffer_replace (¶ms->sps_nals[i], NULL); + gst_buffer_replace (¶ms->pps_nals[i], NULL); g_free (params); } diff --git a/gst/videoparsers/h264parse.h b/gst/videoparsers/h264parse.h index 141564bcef..517c8542b2 100644 --- a/gst/videoparsers/h264parse.h +++ b/gst/videoparsers/h264parse.h @@ -74,7 +74,7 @@ typedef struct _GstH264ParamsSPS GstH264ParamsSPS; typedef struct _GstH264ParamsPPS GstH264ParamsPPS; #define MAX_SPS_COUNT 32 -#define MAX_PPS_COUNT 32 +#define MAX_PPS_COUNT 256 /* SPS: sequential parameter sets */ struct _GstH264ParamsSPS diff --git a/gst/videoparsers/mpegvideoparse.c b/gst/videoparsers/mpegvideoparse.c new file mode 100644 index 0000000000..45f8dd306c --- /dev/null +++ b/gst/videoparsers/mpegvideoparse.c @@ -0,0 +1,270 @@ +/* GStreamer + * Copyright (C) <2007> Jan Schmidt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "mpegvideoparse.h" + +#include +#include + +GST_DEBUG_CATEGORY_EXTERN (mpegv_parse_debug); +#define GST_CAT_DEFAULT mpegv_parse_debug + + +#define GET_BITS(b, num, bits) G_STMT_START { \ + if (!gst_bit_reader_get_bits_uint32(b, bits, num)) \ + goto failed; \ + GST_TRACE ("parsed %d bits: %d", num, *(bits)); \ +} G_STMT_END + +#define MARKER_BIT(b) G_STMT_START { \ + guint32 i; \ + GET_BITS(b, 1, &i); \ + if (i != 0x1) \ + goto failed; \ +} G_STMT_END + +static inline gboolean +find_start_code (GstBitReader * b) +{ + guint32 bits; + + /* 0 bits until byte aligned */ + while (b->bit != 0) { + GET_BITS (b, 1, &bits); + } + + /* 0 bytes until startcode */ + while (gst_bit_reader_peek_bits_uint32 (b, &bits, 32)) { + if (bits >> 8 == 0x1) { + return TRUE; + } else { + gst_bit_reader_skip (b, 8); + } + } + + return FALSE; + +failed: + return FALSE; +} + +static gboolean +gst_mpeg_video_params_parse_extension (MPEGVParams * params, GstBitReader * br) +{ + guint32 bits; + + /* double-check */ + GET_BITS (br, 32, &bits); + if (bits != 0x100 + MPEG_PACKET_EXTENSION) + goto failed; + + /* extension_start_code identifier */ + GET_BITS (br, 4, &bits); + + /* profile_and_level_indication */ + GET_BITS (br, 4, &bits); + params->profile = bits; + GET_BITS (br, 4, &bits); + params->level = bits; + + /* progressive_sequence */ + GET_BITS (br, 1, &bits); + params->progressive = bits; + + /* chroma_format */ + GET_BITS (br, 2, &bits); + + /* horizontal_size_extension */ + GET_BITS (br, 2, &bits); + params->width += (bits << 12); + /* vertical_size_extension */ + GET_BITS (br, 2, &bits); + params->height += (bits << 12); + + /* bit_rate_extension */ + GET_BITS (br, 12, &bits); + if (params->bitrate) + params->bitrate += (bits << 18) * 400; + /* marker_bit */ + MARKER_BIT (br); + /* vbv_buffer_size_extension */ + GET_BITS (br, 8, &bits); + /* low_delay */ + GET_BITS (br, 1, &bits); + + /* frame_rate_extension_n */ + GET_BITS (br, 2, &bits); + params->fps_n *= bits + 1; + /* frame_rate_extension_d */ + GET_BITS (br, 5, &bits); + params->fps_d *= bits + 1; + + return TRUE; + + /* ERRORS */ +failed: + { + GST_WARNING ("Failed to parse sequence extension"); + return FALSE; + } +} + +/* Set the Pixel Aspect Ratio in our hdr from a DAR code in the data */ +static void +set_par_from_dar (MPEGVParams * params, guint8 asr_code) +{ + /* Pixel_width = DAR_width * display_vertical_size */ + /* Pixel_height = DAR_height * display_horizontal_size */ + switch (asr_code) { + case 0x02: /* 3:4 DAR = 4:3 pixels */ + params->par_w = 4 * params->height; + params->par_h = 3 * params->width; + break; + case 0x03: /* 9:16 DAR */ + params->par_w = 16 * params->height; + params->par_h = 9 * params->width; + break; + case 0x04: /* 1:2.21 DAR */ + params->par_w = 221 * params->height; + params->par_h = 100 * params->width; + break; + case 0x01: /* Square pixels */ + params->par_w = params->par_h = 1; + break; + default: + GST_DEBUG ("unknown/invalid aspect_ratio_information %d", asr_code); + break; + } +} + +static void +set_fps_from_code (MPEGVParams * params, guint8 fps_code) +{ + const gint framerates[][2] = { + {30, 1}, {24000, 1001}, {24, 1}, {25, 1}, + {30000, 1001}, {30, 1}, {50, 1}, {60000, 1001}, + {60, 1}, {30, 1} + }; + + if (fps_code && fps_code < 10) { + params->fps_n = framerates[fps_code][0]; + params->fps_d = framerates[fps_code][1]; + } else { + GST_DEBUG ("unknown/invalid frame_rate_code %d", fps_code); + /* Force a valid framerate */ + /* FIXME or should this be kept unknown ?? */ + params->fps_n = 30000; + params->fps_d = 1001; + } +} + +static gboolean +gst_mpeg_video_params_parse_sequence (MPEGVParams * params, GstBitReader * br) +{ + guint32 bits; + + GET_BITS (br, 32, &bits); + if (bits != 0x100 + MPEG_PACKET_SEQUENCE) + goto failed; + + /* assume MPEG-1 till otherwise discovered */ + params->mpeg_version = 1; + + GET_BITS (br, 12, &bits); + params->width = bits; + GET_BITS (br, 12, &bits); + params->height = bits; + + GET_BITS (br, 4, &bits); + set_par_from_dar (params, bits); + GET_BITS (br, 4, &bits); + set_fps_from_code (params, bits); + + GET_BITS (br, 18, &bits); + if (bits == 0x3ffff) { + /* VBR stream */ + params->bitrate = 0; + } else { + /* Value in header is in units of 400 bps */ + params->bitrate *= 400; + } + + /* constrained_parameters_flag */ + GET_BITS (br, 1, &bits); + + /* load_intra_quantiser_matrix */ + GET_BITS (br, 1, &bits); + if (bits) { + if (!gst_bit_reader_skip (br, 8 * 64)) + goto failed; + } + + /* load_non_intra_quantiser_matrix */ + GET_BITS (br, 1, &bits); + if (bits) { + if (!gst_bit_reader_skip (br, 8 * 64)) + goto failed; + } + + /* check for MPEG-2 sequence extension */ + while (find_start_code (br)) { + gst_bit_reader_peek_bits_uint32 (br, &bits, 32); + if (bits == 0x100 + MPEG_PACKET_EXTENSION) { + if (!gst_mpeg_video_params_parse_extension (params, br)) + goto failed; + params->mpeg_version = 2; + } + } + + /* dump some info */ + GST_LOG ("width x height: %d x %d", params->width, params->height); + GST_LOG ("fps: %d/%d", params->fps_n, params->fps_d); + GST_LOG ("par: %d/%d", params->par_w, params->par_h); + GST_LOG ("profile/level: %d/%d", params->profile, params->level); + GST_LOG ("bitrate/progressive: %d/%d", params->bitrate, params->progressive); + + return TRUE; + + /* ERRORS */ +failed: + { + GST_WARNING ("Failed to parse sequence header"); + /* clear out stuff */ + memset (params, 0, sizeof (*params)); + return FALSE; + } +} + +gboolean +gst_mpeg_video_params_parse_config (MPEGVParams * params, const guint8 * data, + guint size) +{ + GstBitReader br; + + if (size < 4) + return FALSE; + + gst_bit_reader_init (&br, data, size); + + return gst_mpeg_video_params_parse_sequence (params, &br); +} diff --git a/gst/videoparsers/mpegvideoparse.h b/gst/videoparsers/mpegvideoparse.h new file mode 100644 index 0000000000..f0092b7137 --- /dev/null +++ b/gst/videoparsers/mpegvideoparse.h @@ -0,0 +1,77 @@ +/* GStreamer + * Copyright (C) <2007> Jan Schmidt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GST_MPEGVIDEO_PARAMS_H__ +#define __GST_MPEGVIDEO_PARAMS_H__ + +#include + +G_BEGIN_DECLS + +/* Packet ID codes for different packet types we + * care about */ +#define MPEG_PACKET_PICTURE 0x00 +#define MPEG_PACKET_SLICE_MIN 0x01 +#define MPEG_PACKET_SLICE_MAX 0xaf +#define MPEG_PACKET_SEQUENCE 0xb3 +#define MPEG_PACKET_EXTENSION 0xb5 +#define MPEG_PACKET_SEQUENCE_END 0xb7 +#define MPEG_PACKET_GOP 0xb8 +#define MPEG_PACKET_NONE 0xff + +/* Extension codes we care about */ +#define MPEG_PACKET_EXT_SEQUENCE 0x01 +#define MPEG_PACKET_EXT_SEQUENCE_DISPLAY 0x02 +#define MPEG_PACKET_EXT_QUANT_MATRIX 0x03 + +/* Flags indicating what type of packets are in this block, some are mutually + * exclusive though - ie, sequence packs are accumulated separately. GOP & + * Picture may occur together or separately */ +#define MPEG_BLOCK_FLAG_SEQUENCE 0x01 +#define MPEG_BLOCK_FLAG_PICTURE 0x02 +#define MPEG_BLOCK_FLAG_GOP 0x04 + +#define MPEG_PICTURE_TYPE_I 0x01 +#define MPEG_PICTURE_TYPE_P 0x02 +#define MPEG_PICTURE_TYPE_B 0x03 +#define MPEG_PICTURE_TYPE_D 0x04 + +typedef struct _MPEGVParams MPEGVParams; + +struct _MPEGVParams +{ + gint mpeg_version; + + gint profile; + gint level; + + gint width, height; + gint par_w, par_h; + gint fps_n, fps_d; + + gint bitrate; + gboolean progressive; +}; + +GstFlowReturn gst_mpeg_video_params_parse_config (MPEGVParams * params, + const guint8 * data, guint size); + +G_END_DECLS + +#endif diff --git a/gst/videoparsers/plugin.c b/gst/videoparsers/plugin.c index cfd8a48285..a6db91d357 100644 --- a/gst/videoparsers/plugin.c +++ b/gst/videoparsers/plugin.c @@ -25,6 +25,7 @@ #include "gsth263parse.h" #include "gsth264parse.h" #include "gstdiracparse.h" +#include "gstmpegvideoparse.h" static gboolean plugin_init (GstPlugin * plugin) @@ -37,6 +38,8 @@ plugin_init (GstPlugin * plugin) GST_RANK_NONE, GST_TYPE_H264_PARSE); ret = gst_element_register (plugin, "diracparse", GST_RANK_NONE, GST_TYPE_DIRAC_PARSE); + ret = gst_element_register (plugin, "mpegvideoparse", + GST_RANK_NONE, GST_TYPE_MPEGVIDEO_PARSE); return ret; } diff --git a/gst/videosignal/Makefile.am b/gst/videosignal/Makefile.am index 4bbd745e6f..a10ab8ead4 100644 --- a/gst/videosignal/Makefile.am +++ b/gst/videosignal/Makefile.am @@ -13,3 +13,16 @@ libgstvideosignal_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-@GST_MAJORMINO libgstvideosignal_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstvideosignal_la_LIBTOOLFLAGS = --tag=disable-static +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstvideosignal -:SHARED libgstvideosignal \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstvideosignal_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstvideosignal_la_CFLAGS) \ + -:LDFLAGS $(libgstvideosignal_la_LDFLAGS) \ + $(libgstvideosignal_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ \ No newline at end of file diff --git a/gst/vmnc/Makefile.am b/gst/vmnc/Makefile.am index 55074c15b7..fd3f2116fb 100644 --- a/gst/vmnc/Makefile.am +++ b/gst/vmnc/Makefile.am @@ -1,8 +1,21 @@ plugin_LTLIBRARIES = libgstvmnc.la libgstvmnc_la_SOURCES = vmncdec.c -libgstvmnc_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(THEORA_CFLAGS) +libgstvmnc_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) libgstvmnc_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) libgstvmnc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstvmnc_la_LIBTOOLFLAGS = --tag=disable-static +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgstvmnc -:SHARED libgstvmnc \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgstvmnc_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgstvmnc_la_CFLAGS) \ + -:LDFLAGS $(libgstvmnc_la_LDFLAGS) \ + $(libgstvmnc_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ \ No newline at end of file diff --git a/gst/y4m/Makefile.am b/gst/y4m/Makefile.am index e8e52421d8..ce35c18326 100644 --- a/gst/y4m/Makefile.am +++ b/gst/y4m/Makefile.am @@ -11,3 +11,17 @@ libgsty4mdec_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgsty4mdec_la_LIBTOOLFLAGS = --tag=disable-static noinst_HEADERS = gsty4mdec.h + +Android.mk: Makefile.am $(BUILT_SOURCES) + androgenizer \ + -:PROJECT libgsty4m -:SHARED libgsty4m \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libgsty4m_la_SOURCES) \ + -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(libgsty4m_la_CFLAGS) \ + -:LDFLAGS $(libgsty4m_la_LDFLAGS) \ + $(libgsty4m_la_LIBADD) \ + -ldl \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ + > $@ diff --git a/gst/y4m/gsty4mdec.c b/gst/y4m/gsty4mdec.c index 0e6c3fab6f..8065bd3d51 100644 --- a/gst/y4m/gsty4mdec.c +++ b/gst/y4m/gsty4mdec.c @@ -146,10 +146,7 @@ void gst_y4m_dec_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - GstY4mDec *y4mdec; - g_return_if_fail (GST_IS_Y4M_DEC (object)); - y4mdec = GST_Y4M_DEC (object); switch (property_id) { default: @@ -162,10 +159,7 @@ void gst_y4m_dec_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - GstY4mDec *y4mdec; - g_return_if_fail (GST_IS_Y4M_DEC (object)); - y4mdec = GST_Y4M_DEC (object); switch (property_id) { default: @@ -194,10 +188,7 @@ gst_y4m_dec_dispose (GObject * object) void gst_y4m_dec_finalize (GObject * object) { - GstY4mDec *y4mdec; - g_return_if_fail (GST_IS_Y4M_DEC (object)); - y4mdec = GST_Y4M_DEC (object); /* clean up object here */ @@ -207,11 +198,9 @@ gst_y4m_dec_finalize (GObject * object) static GstStateChangeReturn gst_y4m_dec_change_state (GstElement * element, GstStateChange transition) { - GstY4mDec *y4mdec; GstStateChangeReturn ret; g_return_val_if_fail (GST_IS_Y4M_DEC (element), GST_STATE_CHANGE_FAILURE); - y4mdec = GST_Y4M_DEC (element); switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: @@ -744,4 +733,5 @@ plugin_init (GstPlugin * plugin) GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, "y4mdec", - "FIXME", plugin_init, VERSION, "LGPL", PACKAGE_NAME, GST_PACKAGE_ORIGIN) + "Demuxes/decodes YUV4MPEG streams", + plugin_init, VERSION, "LGPL", PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/m4/gsettings.m4 b/m4/gsettings.m4 index ac9945e9d7..429d04ba4b 100644 --- a/m4/gsettings.m4 +++ b/m4/gsettings.m4 @@ -37,7 +37,7 @@ mostlyclean-am: clean-gsettings-schemas gsettings__enum_file = $(addsuffix .enums.xml,$(gsettings_ENUM_NAMESPACE)) %.gschema.valid: %.gschema.xml $(gsettings__enum_file) - $(AM_V_GEN) if test -f "$<"; then d=; else d="$(srcdir)/"; fi; $(GLIB_COMPILE_SCHEMAS) --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$${d}$< && touch [$]@ + $(AM_V_GEN) if test -f "$<"; then d=; else d="$(srcdir)/"; fi; $(GLIB_COMPILE_SCHEMAS) --strict --dry-run $(addprefix --schema-file=,$(gsettings__enum_file)) --schema-file=$${d}$< && touch [$]@ all-am: $(gsettings_SCHEMAS:.xml=.valid) uninstall-am: uninstall-gsettings-schemas @@ -45,23 +45,13 @@ install-data-am: install-gsettings-schemas .SECONDARY: $(gsettings_SCHEMAS) -gsettings__base_list = \ - sed "$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g" | \ - sed "$$!N;$$!N;$$!N;$$!N;s/\n/ /g" - -install-gsettings-schemas: $(gsettings_SCHEMAS:.xml=.valid) $(gsettings__enum_file) +install-gsettings-schemas: $(gsettings_SCHEMAS) $(gsettings__enum_file) @$(NORMAL_INSTALL) - test -z "$(gsettingsschemadir)" || $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)" - @list='\''$(gsettings__enum_file) $(gsettings_SCHEMAS)'\''; test -n "$(gsettingsschemadir)" || list=; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(gsettings__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '\''$(DESTDIR)$(gsettingsschemadir)'\''"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(gsettingsschemadir)" || exit $$?; \ - done - test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir) + if test -n "$^"; then \ + test -z "$(gsettingsschemadir)" || $(MKDIR_P) "$(DESTDIR)$(gsettingsschemadir)"; \ + $(INSTALL_DATA) $^ "$(DESTDIR)$(gsettingsschemadir)"; \ + test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); \ + fi uninstall-gsettings-schemas: @$(NORMAL_UNINSTALL) @@ -77,7 +67,7 @@ clean-gsettings-schemas: ifdef gsettings_ENUM_NAMESPACE $(gsettings__enum_file): $(gsettings_ENUM_FILES) - $(AM_V_GEN) glib-mkenums --comments '\'''\'' --fhead "" --vhead " <@type@ id='\''$(gsettings_ENUM_NAMESPACE).@EnumName@'\''>" --vprod " " --vtail " " --ftail "" $(gsettings_ENUM_FILES) > [$]@.tmp && mv [$]@.tmp [$]@ + $(AM_V_GEN) glib-mkenums --comments '\'''\'' --fhead "" --vhead " <@type@ id='\''$(gsettings_ENUM_NAMESPACE).@EnumName@'\''>" --vprod " " --vtail " " --ftail "" [$]^ > [$]@.tmp && mv [$]@.tmp [$]@ endif ' _GSETTINGS_SUBST(GSETTINGS_RULES) diff --git a/po/bg.po b/po/bg.po index 3f3b07b571..977daa077f 100644 --- a/po/bg.po +++ b/po/bg.po @@ -1,15 +1,15 @@ # Bulgarian translation of gst-plugins-bad. -# Copyright (C) 2007, 2008, 2009, 2010 Free Software Fondation, Inc. +# Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Fondation, Inc. # This file is distributed under the same license as the gst-plugins-bad package. -# Alexander Shopov , 2007, 2008, 2009, 2010. +# Alexander Shopov , 2007, 2008, 2009, 2010, 2011. # # msgid "" msgstr "" -"Project-Id-Version: gst-plugins-bad 0.10.18.2\n" +"Project-Id-Version: gst-plugins-bad 0.10.21.2\n" "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n" -"POT-Creation-Date: 2011-01-07 20:26+0000\n" -"PO-Revision-Date: 2010-11-04 14:25+0200\n" +"POT-Creation-Date: 2011-04-27 12:55+0100\n" +"PO-Revision-Date: 2011-04-26 22:30+0300\n" "Last-Translator: Alexander Shopov \n" "Language-Team: Bulgarian \n" "Language: \n" @@ -32,10 +32,11 @@ msgid "" "Could not read DVD. This may be because the DVD is encrypted and a DVD " "decryption library is not installed." msgstr "" +"DVD-то не може да бъде прочетено. Причината може да е, че DVD-то е шифрирано " +"и не е инсталирана библиотека за дешифриране." -#, fuzzy msgid "Could not read DVD." -msgstr "Информацията за заглавните части на DVD-то не може да бъде прочетена." +msgstr "DVD-то не може да бъде прочетено." msgid "No file name specified for writing." msgstr "Не е указано име на файл за запис." diff --git a/po/da.po b/po/da.po index 6b223d5632..5d124a4ee7 100644 --- a/po/da.po +++ b/po/da.po @@ -1,15 +1,15 @@ # Danish translation of gst-plugins-bad. -# Copyright (C) 2009 gst. +# Copyright (C) 2011 gst. # This file is distributed under the same license as the gst-plugins-bad package. # Mogens Jaeger , 2007. -# Joe Hansen , 2008, 2009. +# Joe Hansen , 2008, 2009, 2011. # msgid "" msgstr "" -"Project-Id-Version: gst-plugins-bad-0.10.13.2\n" +"Project-Id-Version: gst-plugins-bad-0.10.21.2\n" "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n" -"POT-Creation-Date: 2010-10-19 23:33+0100\n" -"PO-Revision-Date: 2009-08-12 11:28+0200\n" +"POT-Creation-Date: 2011-04-30 18:56+0100\n" +"PO-Revision-Date: 2011-04-28 11:28+0200\n" "Last-Translator: Joe Hansen \n" "Language-Team: Danish \n" "Language: da\n" @@ -31,10 +31,11 @@ msgid "" "Could not read DVD. This may be because the DVD is encrypted and a DVD " "decryption library is not installed." msgstr "" +"Kunne ikke læse dvd. Dette kan være fordi dvd'en er krypteret og et dvd-" +"dekrypteringsbibliotek ikke er installeret." -#, fuzzy msgid "Could not read DVD." -msgstr "Kunne ikke læse titelinformation for dvd." +msgstr "Kunne ikke læse dvd." msgid "No file name specified for writing." msgstr "Intet filnavn er angivet til skrivning." @@ -69,11 +70,367 @@ msgstr "Kunne ikke hente indstillinger fra forende-enheden »%s«." msgid "Could not open file \"%s\" for reading." msgstr "Kunne ikke åbne filen »%s« for læsning." +#~ msgid "Internal clock error." +#~ msgstr "Intern urfejl." + +#~ msgid "Could not open audio device for mixer control handling." +#~ msgstr "Kunne ikke åbne lydenhed til mikserpulthåndtering." + +#~ msgid "" +#~ "Could not open audio device for mixer control handling. This version of " +#~ "the Open Sound System is not supported by this element." +#~ msgstr "" +#~ "Kunne ikke åbne lydenhed til mikserpulthåndtering. Denne version af Open " +#~ "Sound System er ikke understøttet af dette element." + +#~ msgid "Volume" +#~ msgstr "Lydstyrke" + +#~ msgid "Master" +#~ msgstr "Master" + +#~ msgid "Front" +#~ msgstr "Front" + +# bagende eller eller "Bag" hvis det er den bagerste lydkanal +# vi snakker om +#~ msgid "Rear" +#~ msgstr "Bag" + +#~ msgid "Headphones" +#~ msgstr "Høretelefoner" + +#~ msgid "Center" +#~ msgstr "Center" + +#~ msgid "LFE" +#~ msgstr "LFE" + +#~ msgid "Surround" +#~ msgstr "Surround" + +#~ msgid "Side" +#~ msgstr "Side" + +#~ msgid "Built-in Speaker" +#~ msgstr "Indbygget højtaler" + +#~ msgid "AUX 1 Out" +#~ msgstr "AUX 1 ud" + +#~ msgid "AUX 2 Out" +#~ msgstr "AUX 2 ud" + +#~ msgid "AUX Out" +#~ msgstr "AUX ud" + +#~ msgid "Bass" +#~ msgstr "Bas" + +#~ msgid "Treble" +#~ msgstr "Diskant" + +#~ msgid "3D Depth" +#~ msgstr "3D-dybde" + +#~ msgid "3D Center" +#~ msgstr "3D-center" + +# (ændret fra 3D-forbedring) +#~ msgid "3D Enhance" +#~ msgstr "3D-fremhævelse" + +#~ msgid "Telephone" +#~ msgstr "Telefon" + +#~ msgid "Microphone" +#~ msgstr "Mikrofon" + +#~ msgid "Line Out" +#~ msgstr "Linje ud" + +#~ msgid "Line In" +#~ msgstr "Linje ind" + +#~ msgid "Internal CD" +#~ msgstr "Intern cd" + +#~ msgid "Video In" +#~ msgstr "Video ind" + +#~ msgid "AUX 1 In" +#~ msgstr "AUX 1 ind" + +#~ msgid "AUX 2 In" +#~ msgstr "AUX 2 ind" + +#~ msgid "AUX In" +#~ msgstr "AUX ind" + +#~ msgid "PCM" +#~ msgstr "PCM" + +#~ msgid "Record Gain" +#~ msgstr "Optagelsesforøgelse" + +#~ msgid "Output Gain" +#~ msgstr "Uddataforøgelse" + +#~ msgid "Microphone Boost" +#~ msgstr "Mikrofonløft" + +#~ msgid "Loopback" +#~ msgstr "Sløjfe" + +#~ msgid "Diagnostic" +#~ msgstr "Diagnosticering" + +#~ msgid "Bass Boost" +#~ msgstr "Basløft" + +#~ msgid "Playback Ports" +#~ msgstr "Afspilningsporte" + +#~ msgid "Input" +#~ msgstr "Inddata" + +#~ msgid "Record Source" +#~ msgstr "Optagelseskilde" + +# overvåg eller skærm ?, mangler lidt info her. +#~ msgid "Monitor Source" +#~ msgstr "Overvåg kilde" + +#~ msgid "Keyboard Beep" +#~ msgstr "Tastaturbip" + +# overvåg eller skærm? +#~ msgid "Monitor" +#~ msgstr "Overvåg" + +#~ msgid "Simulate Stereo" +#~ msgstr "Simuler stereo" + +#~ msgid "Stereo" +#~ msgstr "Stereo" + +#~ msgid "Surround Sound" +#~ msgstr "Surroundlyd" + +#~ msgid "Microphone Gain" +#~ msgstr "Mikrofonforøgelse" + +#~ msgid "Speaker Source" +#~ msgstr "Højtalerkilde" + +#~ msgid "Microphone Source" +#~ msgstr "Mikrofonkilde" + +# ikke nem den her +# Tror det er en fysisk enhed, måske indgang +#~ msgid "Jack" +#~ msgstr "Indgang" + +#~ msgid "Center / LFE" +#~ msgstr "Center / LFE" + +# rød ordbog 4. (lyd) miksning. +#~ msgid "Stereo Mix" +#~ msgstr "Stereomiksning" + +#~ msgid "Mono Mix" +#~ msgstr "Monomiksning" + +#~ msgid "Input Mix" +#~ msgstr "Inddatamiksning" + +#~ msgid "SPDIF In" +#~ msgstr "SPDIF ind" + +#~ msgid "SPDIF Out" +#~ msgstr "SPDIF ud" + +#~ msgid "Microphone 1" +#~ msgstr "Mikrofon 1" + +#~ msgid "Microphone 2" +#~ msgstr "Mikrofon 2" + +#~ msgid "Digital Out" +#~ msgstr "Digitalt ud" + +#~ msgid "Digital In" +#~ msgstr "Digitalt ind" + +#~ msgid "HDMI" +#~ msgstr "HDMI" + +#~ msgid "Modem" +#~ msgstr "Modem" + +#~ msgid "Handset" +#~ msgstr "Håndsæt" + +#~ msgid "Other" +#~ msgstr "Andet" + +#~ msgid "None" +#~ msgstr "Ingen" + +#~ msgid "On" +#~ msgstr "Tændt" + +#~ msgid "Off" +#~ msgstr "Slukket" + +# slukket, dæmpet, stum +#~ msgid "Mute" +#~ msgstr "Dæmpet" + +#~ msgid "Fast" +#~ msgstr "Hurtig" + +#~ msgid "Very Low" +#~ msgstr "Meget lavt" + +#~ msgid "Low" +#~ msgstr "Lav" + +#~ msgid "Medium" +#~ msgstr "Medium" + +#~ msgid "High" +#~ msgstr "Højt" + +#~ msgid "Very High" +#~ msgstr "Meget højt" + +#~ msgid "Production" +#~ msgstr "Produktion" + +#~ msgid "Front Panel Microphone" +#~ msgstr "Frontpanelmikrofon" + +#~ msgid "Front Panel Line In" +#~ msgstr "Frontpanel linje ind" + +#~ msgid "Front Panel Headphones" +#~ msgstr "Frontpanel høretelefoner" + +#~ msgid "Front Panel Line Out" +#~ msgstr "Frontpanel linje ud" + +#~ msgid "Green Connector" +#~ msgstr "Grøn forbindelse" + +#~ msgid "Pink Connector" +#~ msgstr "Lyserød forbindelse" + +#~ msgid "Blue Connector" +#~ msgstr "Blå forbindelse" + +#~ msgid "White Connector" +#~ msgstr "Hvid forbindelse" + +#~ msgid "Black Connector" +#~ msgstr "Sort forbindelse" + +#~ msgid "Gray Connector" +#~ msgstr "Grå forbindelse" + +#~ msgid "Orange Connector" +#~ msgstr "Orange forbindelse" + +#~ msgid "Red Connector" +#~ msgstr "Rød forbindelse" + +#~ msgid "Yellow Connector" +#~ msgstr "Gul forbindelse" + +#~ msgid "Green Front Panel Connector" +#~ msgstr "Grøn frontpanelforbindelse" + +#~ msgid "Pink Front Panel Connector" +#~ msgstr "Lyserød frontpanelforbindelse" + +#~ msgid "Blue Front Panel Connector" +#~ msgstr "Blå frontpanelforbindelse" + +#~ msgid "White Front Panel Connector" +#~ msgstr "Hvid frontpanelforbindelse" + +#~ msgid "Black Front Panel Connector" +#~ msgstr "Sort frontpanelforbindelse" + +#~ msgid "Gray Front Panel Connector" +#~ msgstr "Grå frontpanelforbindelse" + +#~ msgid "Orange Front Panel Connector" +#~ msgstr "Orange frontpanelforbindelse" + +#~ msgid "Red Front Panel Connector" +#~ msgstr "Rød frontpanelforbindelse" + +#~ msgid "Yellow Front Panel Connector" +#~ msgstr "Gul frontpanelforbindelse" + +#~ msgid "Spread Output" +#~ msgstr "Spred uddata" + +# har ingen anelse om hvad det her er? +#~ msgid "Downmix" +#~ msgstr "Downmix" + +#~ msgid "Virtual Mixer Input" +#~ msgstr "Virtuelle mikserinddata" + +#~ msgid "Virtual Mixer Output" +#~ msgstr "Virtuelle mikseruddata" + +#~ msgid "Virtual Mixer Channels" +#~ msgstr "Virtuelle mikserkanaler" + +#~ msgid "%s Function" +#~ msgstr "%s funktion" + #~ msgid "%s %d" #~ msgstr "%s %d" -#~ msgid "Internal clock error." -#~ msgstr "Intern urfejl." +#~ msgid "" +#~ "Could not open audio device for playback. Device is being used by another " +#~ "application." +#~ msgstr "" +#~ "Kunne ikke åbne lydenhed til afspilning. Enheden bruges af et andet " +#~ "program." + +#~ msgid "" +#~ "Could not open audio device for playback. You don't have permission to " +#~ "open the device." +#~ msgstr "" +#~ "Kunne ikke åbne lydenhed til afspilning. Du har ikke rettigheder til at " +#~ "åbne enheden." + +#~ msgid "Could not open audio device for playback." +#~ msgstr "Kunne ikke åbne lydenhed til afspilning." + +#~ msgid "" +#~ "Could not open audio device for playback. This version of the Open Sound " +#~ "System is not supported by this element." +#~ msgstr "" +#~ "Kunne ikke åbne lydenhed for afspilning. Denne version af Open Sound " +#~ "System er ikke understøttet af dette element." + +#~ msgid "Playback is not supported by this audio device." +#~ msgstr "Afspilning er ikke understøttet af denne lydenhed." + +#~ msgid "Audio playback error." +#~ msgstr "Fejl ved lydafspilning." + +#~ msgid "Recording is not supported by this audio device." +#~ msgstr "Optagelse er ikke understøttet af denne lydenhed." + +#~ msgid "Error recording from audio device." +#~ msgstr "Fejl under optagelse fra lydenhed." #~ msgid "PCM 1" #~ msgstr "PCM 1" diff --git a/po/de.po b/po/de.po index 3088f1dcfd..20cb2d2ad3 100644 --- a/po/de.po +++ b/po/de.po @@ -1,15 +1,15 @@ -# German po for gst-plugins-bad +# German po for gst-plugins-bad 0.10.21.2 # Copyright (C) 2007 Free Software Foundation, Inc. # This file is distributed under the same license as the gst-plugins-bad package. # Andre Klapper , 2008. -# Christian Kirbach , 2009. +# Christian Kirbach , 2009, 2011. # msgid "" msgstr "" -"Project-Id-Version: gst-plugins-bad 0.10.13.2\n" +"Project-Id-Version: gst-plugins-bad 0.10.21.2\n" "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n" -"POT-Creation-Date: 2010-10-19 23:33+0100\n" -"PO-Revision-Date: 2009-08-22 16:58+0200\n" +"POT-Creation-Date: 2011-04-30 18:56+0100\n" +"PO-Revision-Date: 2011-04-28 00:04+0200\n" "Last-Translator: Christian Kirbach \n" "Language-Team: German \n" "Language: de\n" @@ -32,10 +32,12 @@ msgid "" "Could not read DVD. This may be because the DVD is encrypted and a DVD " "decryption library is not installed." msgstr "" +"DVD konnten nicht gelesen werden. Dies könnte daran liegen, dass die DVD " +"verschlüsselt ist und eine Bibliothek zur DVD-Entschlüsselung nicht " +"installiert ist." -#, fuzzy msgid "Could not read DVD." -msgstr "Die Titelinformationen der DVD konnten nicht gelesen werden." +msgstr "DVD konnten nicht gelesen werden." msgid "No file name specified for writing." msgstr "Kein Dateiname zum Schreiben angegeben." @@ -71,11 +73,359 @@ msgstr "" msgid "Could not open file \"%s\" for reading." msgstr "Datei »%s« konnte nicht zum Lesen geöffnet werden." +#~ msgid "Internal clock error." +#~ msgstr "Interner Zeitfehler." + +#~ msgid "Could not open audio device for mixer control handling." +#~ msgstr "Audio-Gerät konnte nicht zum Regeln geöffnet werden." + +#~ msgid "" +#~ "Could not open audio device for mixer control handling. This version of " +#~ "the Open Sound System is not supported by this element." +#~ msgstr "" +#~ "Audio-Gerät konnte nicht zum Regeln geöffnet werden. Diese Version des " +#~ "Open Sound System (OSS) wird nicht von diesem Element unterstützt." + +#~ msgid "Volume" +#~ msgstr "Lautstärke" + +#~ msgid "Master" +#~ msgstr "Hauptregler" + +#~ msgid "Front" +#~ msgstr "Vorne" + +#~ msgid "Rear" +#~ msgstr "Hinten" + +#~ msgid "Headphones" +#~ msgstr "Kopfhörer" + +#~ msgid "Center" +#~ msgstr "Mitte" + +#~ msgid "LFE" +#~ msgstr "LFE" + +#~ msgid "Surround" +#~ msgstr "Surround" + +#~ msgid "Side" +#~ msgstr "Seite" + +#~ msgid "Built-in Speaker" +#~ msgstr "Eingebauter Lautsprecher" + +#~ msgid "AUX 1 Out" +#~ msgstr "AUX-Ausgang 1" + +#~ msgid "AUX 2 Out" +#~ msgstr "AUX-Ausgang 2" + +#~ msgid "AUX Out" +#~ msgstr "AUX-Ausgang" + +#~ msgid "Bass" +#~ msgstr "Bass" + +#~ msgid "Treble" +#~ msgstr "Höhen" + +#~ msgid "3D Depth" +#~ msgstr "3D-Tiefe" + +#~ msgid "3D Center" +#~ msgstr "3D-Mitte" + +#~ msgid "3D Enhance" +#~ msgstr "3D-Erweiterung" + +#~ msgid "Telephone" +#~ msgstr "Telefon" + +#~ msgid "Microphone" +#~ msgstr "Mikrofon" + +#~ msgid "Line Out" +#~ msgstr "Line-Ausgang" + +#~ msgid "Line In" +#~ msgstr "Line-Eingang" + +#~ msgid "Internal CD" +#~ msgstr "Interne CD" + +#~ msgid "Video In" +#~ msgstr "Video-Eingang" + +#~ msgid "AUX 1 In" +#~ msgstr "AUX-Eingang 1" + +#~ msgid "AUX 2 In" +#~ msgstr "AUX-Eingang 2" + +#~ msgid "AUX In" +#~ msgstr "AUX-Eingang" + +#~ msgid "PCM" +#~ msgstr "PCM" + +#~ msgid "Record Gain" +#~ msgstr "Aufnahmepegel" + +#~ msgid "Output Gain" +#~ msgstr "Ausgabepegel" + +#~ msgid "Microphone Boost" +#~ msgstr "Mikrofon-Boost" + +#~ msgid "Loopback" +#~ msgstr "Schleife" + +#~ msgid "Diagnostic" +#~ msgstr "Zur Diagnose" + +#~ msgid "Bass Boost" +#~ msgstr "Bass-Boost" + +#~ msgid "Playback Ports" +#~ msgstr "Wiedergabe-Ports" + +#~ msgid "Input" +#~ msgstr "Eingang" + +#~ msgid "Record Source" +#~ msgstr "Aufnahmequelle" + +#~ msgid "Monitor Source" +#~ msgstr "Beobachtungsquelle" + +#~ msgid "Keyboard Beep" +#~ msgstr "Tastaturpiepsen" + +#~ msgid "Monitor" +#~ msgstr "Beobachtung" + +#~ msgid "Simulate Stereo" +#~ msgstr "Stereo simulieren" + +#~ msgid "Stereo" +#~ msgstr "Stereo" + +#~ msgid "Surround Sound" +#~ msgstr "Surround-Ton" + +#~ msgid "Microphone Gain" +#~ msgstr "Mikrofonpegel" + +#~ msgid "Speaker Source" +#~ msgstr "Lautsprecherquelle" + +#~ msgid "Microphone Source" +#~ msgstr "Mikrofonquelle" + +#~ msgid "Jack" +#~ msgstr "Stecker" + +#~ msgid "Center / LFE" +#~ msgstr "Mitte / LFE" + +#~ msgid "Stereo Mix" +#~ msgstr "Stereo-Mischer" + +#~ msgid "Mono Mix" +#~ msgstr "Mono-Mischer" + +#~ msgid "Input Mix" +#~ msgstr "Aufnahme-Mischer" + +#~ msgid "SPDIF In" +#~ msgstr "SPDIF-Eingang" + +#~ msgid "SPDIF Out" +#~ msgstr "SPDIF-Ausgang" + +#~ msgid "Microphone 1" +#~ msgstr "Mikrofon 1" + +#~ msgid "Microphone 2" +#~ msgstr "Mikrofon 2" + +#~ msgid "Digital Out" +#~ msgstr "Digitaler Ausgang" + +#~ msgid "Digital In" +#~ msgstr "Digitaler Eingang" + +#~ msgid "HDMI" +#~ msgstr "HDMI" + +#~ msgid "Modem" +#~ msgstr "Modem" + +#~ msgid "Handset" +#~ msgstr "Hörer" + +#~ msgid "Other" +#~ msgstr "Andere" + +#~ msgid "None" +#~ msgstr "Keine" + +#~ msgid "On" +#~ msgstr "Ein" + +#~ msgid "Off" +#~ msgstr "Aus" + +#~ msgid "Mute" +#~ msgstr "Stumm" + +#~ msgid "Fast" +#~ msgstr "Schnell" + +#~ msgid "Very Low" +#~ msgstr "Sehr tief" + +#~ msgid "Low" +#~ msgstr "Tief" + +#~ msgid "Medium" +#~ msgstr "Mittel" + +#~ msgid "High" +#~ msgstr "Hoch" + +#~ msgid "Very High" +#~ msgstr "Sehr hoch" + +#~ msgid "Production" +#~ msgstr "Produktion" + +#~ msgid "Front Panel Microphone" +#~ msgstr "Mikrofon an der Front" + +#~ msgid "Front Panel Line In" +#~ msgstr "Line-Eingang an der Front" + +#~ msgid "Front Panel Headphones" +#~ msgstr "Kopfhörer an der Front" + +#~ msgid "Front Panel Line Out" +#~ msgstr "Line-Ausgang an der Front" + +#~ msgid "Green Connector" +#~ msgstr "Grüner Stecker" + +#~ msgid "Pink Connector" +#~ msgstr "Rosa Stecker" + +#~ msgid "Blue Connector" +#~ msgstr "Blauer Stecker" + +#~ msgid "White Connector" +#~ msgstr "Weißer Stecker" + +#~ msgid "Black Connector" +#~ msgstr "Schwarzer Stecker" + +#~ msgid "Gray Connector" +#~ msgstr "Grauer Stecker" + +#~ msgid "Orange Connector" +#~ msgstr "Oranger Stecker" + +#~ msgid "Red Connector" +#~ msgstr "Roter Stecker" + +#~ msgid "Yellow Connector" +#~ msgstr "Gelber Stecker" + +#~ msgid "Green Front Panel Connector" +#~ msgstr "Grüner Frontstecker" + +#~ msgid "Pink Front Panel Connector" +#~ msgstr "Rosa Frontstecker" + +#~ msgid "Blue Front Panel Connector" +#~ msgstr "Blauer Frontstecker" + +#~ msgid "White Front Panel Connector" +#~ msgstr "Weißer Frontstecker" + +#~ msgid "Black Front Panel Connector" +#~ msgstr "Schwarzer Frontstecker" + +#~ msgid "Gray Front Panel Connector" +#~ msgstr "Grauer Frontstecker" + +#~ msgid "Orange Front Panel Connector" +#~ msgstr "Oranger Frontstecker" + +#~ msgid "Red Front Panel Connector" +#~ msgstr "Roter Frontstecker" + +#~ msgid "Yellow Front Panel Connector" +#~ msgstr "Gelber Frontstecker" + +#~ msgid "Spread Output" +#~ msgstr "Verteilter Ausgang" + +# Als Downmix wird im Bereich der Tontechnik ein manuelles oder automatisches Verfahren bezeichnet, bei dem der Ton eines Mehrkanal-Tonformats zu einer Fassung mit weniger unabhängigen Kanälen zusammengefasst wird. In den meisten Fällen ist dies eine Stereo-Fassung. +#~ msgid "Downmix" +#~ msgstr "Downmix" + +#~ msgid "Virtual Mixer Input" +#~ msgstr "Eingang des virtuellen Mischers" + +#~ msgid "Virtual Mixer Output" +#~ msgstr "Ausgang des virtuellen Mischers" + +#~ msgid "Virtual Mixer Channels" +#~ msgstr "Kanäle des virtuellen Mischers" + +#~ msgid "%s Function" +#~ msgstr "%s-Funktion" + #~ msgid "%s %d" #~ msgstr "%s %d" -#~ msgid "Internal clock error." -#~ msgstr "Interner Zeitfehler." +#~ msgid "" +#~ "Could not open audio device for playback. Device is being used by another " +#~ "application." +#~ msgstr "" +#~ "Das Audio-Gerät konnte nicht zur Wiedergabe geöffnet werden. Das Gerät " +#~ "wird von einer anderen Anwendung verwendet." + +#~ msgid "" +#~ "Could not open audio device for playback. You don't have permission to " +#~ "open the device." +#~ msgstr "" +#~ "Das Audio-Gerät konnte nicht zur Wiedergabe geöffnet werden. Sie haben " +#~ "nicht die Berechtigungen zum Öffnen des Gerätes." + +#~ msgid "Could not open audio device for playback." +#~ msgstr "Das Audio-Gerät konnte nicht zur Wiedergabe geöffnet werden. " + +#~ msgid "" +#~ "Could not open audio device for playback. This version of the Open Sound " +#~ "System is not supported by this element." +#~ msgstr "" +#~ "Das Audio-Gerät konnte nicht zur Wiedergabe geöffnet werden. Diese " +#~ "Version des Open Sound System (OSS) wird nicht von diesem Element " +#~ "unterstützt." + +#~ msgid "Playback is not supported by this audio device." +#~ msgstr "Die Wiedergabe wird nicht von diesem Audio-Gerät unterstützt." + +#~ msgid "Audio playback error." +#~ msgstr "Fehler bei Audio-Wiedergabe." + +#~ msgid "Recording is not supported by this audio device." +#~ msgstr "Die Aufnahme wird nicht von diesem Audio-Gerät unterstützt." + +#~ msgid "Error recording from audio device." +#~ msgstr "Fehler bei der Aufnahme vom Audio-Gerät." #~ msgid "PCM 1" #~ msgstr "PCM 1" diff --git a/po/fr.po b/po/fr.po index bede0d6a7d..c54bb6b6e7 100644 --- a/po/fr.po +++ b/po/fr.po @@ -1,15 +1,15 @@ # Translation of gst-plugins-bad to French -# Copyright (C) 2003-2009 GStreamer core team +# Copyright (C) 2003-2011 GStreamer core team # This file is distributed under the same license as the gst-plugins-bad package. # -# Claude Paroz , 2008-2009. +# Claude Paroz , 2008-2011. # msgid "" msgstr "" -"Project-Id-Version: gst-plugins-bad 0.10.13.2\n" +"Project-Id-Version: gst-plugins-bad 0.10.21.2\n" "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n" -"POT-Creation-Date: 2010-10-19 23:33+0100\n" -"PO-Revision-Date: 2009-09-22 20:27+0200\n" +"POT-Creation-Date: 2011-04-30 18:56+0100\n" +"PO-Revision-Date: 2011-04-28 09:13+0200\n" "Last-Translator: Claude Paroz \n" "Language-Team: French \n" "Language: fr\n" @@ -31,10 +31,11 @@ msgid "" "Could not read DVD. This may be because the DVD is encrypted and a DVD " "decryption library is not installed." msgstr "" +"Impossible de lire le DVD. Il se peut que le DVD soit chiffré et qu'aucune " +"biblithèque de déchiffrement ne soit disponible." -#, fuzzy msgid "Could not read DVD." -msgstr "Impossible de lire les informations de titre du DVD." +msgstr "Impossible de lire le DVD." msgid "No file name specified for writing." msgstr "Aucun nom de fichier indiqué pour l'écriture." @@ -68,9 +69,3 @@ msgstr "Impossible d'obtenir les paramètres du périphérique frontal « %s  #, c-format msgid "Could not open file \"%s\" for reading." msgstr "Impossible d'ouvrir le fichier « %s » en lecture." - -#~ msgid "%s %d" -#~ msgstr "%s %d" - -#~ msgid "Internal clock error." -#~ msgstr "Erreur d'horloge interne." diff --git a/po/ja.po b/po/ja.po index 878d34b242..98be03b7e5 100644 --- a/po/ja.po +++ b/po/ja.po @@ -1,13 +1,13 @@ # Japanese traslation for gst-plugins-bad # This file is put in the public domain. # -# Makoto Kato , 2009-2010. +# Makoto Kato , 2009-2011. msgid "" msgstr "" -"Project-Id-Version: gst-plugins-bad 0.10.18.2\n" +"Project-Id-Version: gst-plugins-bad 0.10.21.2\n" "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n" -"POT-Creation-Date: 2011-01-07 20:26+0000\n" -"PO-Revision-Date: 2010-10-26 16:31+0900\n" +"POT-Creation-Date: 2011-04-27 12:55+0100\n" +"PO-Revision-Date: 2011-04-26 19:38+0900\n" "Last-Translator: Makoto Kato \n" "Language-Team: Japanese \n" "Language: ja\n" @@ -18,11 +18,11 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" msgid "Could not read title information for DVD." -msgstr "DVD のタイトル情報を読み込むことができませんでした。" +msgstr "DVDのタイトル情報を読み込むことができませんでした。" #, c-format msgid "Failed to open DVD device '%s'." -msgstr "DVD デバイス '%s' のオープンに失敗しました" +msgstr "DVDデバイス '%s' のオープンに失敗しました。" msgid "Failed to set PGC based seeking." msgstr "PGCを利用したシークに失敗しました。" @@ -31,27 +31,28 @@ msgid "" "Could not read DVD. This may be because the DVD is encrypted and a DVD " "decryption library is not installed." msgstr "" +"DVDを読み込むことができませんでした。DVDが暗号化されているかDVDを解読するライ" +"ブラリがインストールされていないからかもしれません。" -#, fuzzy msgid "Could not read DVD." -msgstr "DVD のタイトル情報を読み込むことができませんでした。" +msgstr "DVDを読み込むことができませんでした。" msgid "No file name specified for writing." -msgstr "書き込み用にファイル名が指定されていません" +msgstr "書き込み用にファイル名が指定されていません。" #, c-format msgid "Could not open file \"%s\" for writing." msgstr "書き込み用にファイル \"%s\" を開くことができませんでした。" msgid "Internal data stream error." -msgstr "内部データフローエラー" +msgstr "内部データストリームエラー。" #, c-format msgid "Could not write to file \"%s\"." msgstr "ファイル \"%s\" へ書き込むことができませんでした。" msgid "Internal data flow error." -msgstr "内部データフローエラー" +msgstr "内部データフローエラー。" #, c-format msgid "Device \"%s\" does not exist." @@ -59,7 +60,7 @@ msgstr "デバイス \"%s\" は存在しません。" #, c-format msgid "Could not open frontend device \"%s\"." -msgstr "フロントデバイス \"%s\" を開くことができません。" +msgstr "フロントエンドデバイス \"%s\" を開くことができません。" #, c-format msgid "Could not get settings from frontend device \"%s\"." diff --git a/po/nl.po b/po/nl.po index 77beaa5145..15aa0be834 100644 --- a/po/nl.po +++ b/po/nl.po @@ -1,16 +1,16 @@ -# translation of gst-plugins-bad-0.10.13.2.nl.po to Dutch +# translation of gst-plugins-bad-0.10.21.2.nl.po to Dutch # translation of gst-plugins-bad to Dutch # Copyright (C) 2004, 2007, 2008, 2009 Free Software Foundation, Inc. # # This file is distributed under the same license as the gst-plugins-bad package. -# Freek de Kruijf , 2007, 2008, 2009. +# Freek de Kruijf , 2007, 2008, 2009, 2011. msgid "" msgstr "" -"Project-Id-Version: gst-plugins-bad 0.10.13.2\n" +"Project-Id-Version: gst-plugins-bad 0.10.21.2\n" "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n" -"POT-Creation-Date: 2010-10-19 23:33+0100\n" -"PO-Revision-Date: 2009-08-13 00:06+0200\n" -"Last-Translator: Freek de Kruijf \n" +"POT-Creation-Date: 2011-04-27 12:55+0100\n" +"PO-Revision-Date: 2011-04-27 00:16+0200\n" +"Last-Translator: Freek de Kruijf \n" "Language-Team: Dutch \n" "Language: nl\n" "MIME-Version: 1.0\n" @@ -33,10 +33,11 @@ msgid "" "Could not read DVD. This may be because the DVD is encrypted and a DVD " "decryption library is not installed." msgstr "" +"Kon de dvd niet lezen. Dit kan zo zijn omdat de dvd versleuteld is en een " +"bibliotheek voor ontcijferen niet is geïnstalleerd" -#, fuzzy msgid "Could not read DVD." -msgstr "Kan de titelinformatie voor de DVD niet lezen." +msgstr "Kon de dvd niet lezen." msgid "No file name specified for writing." msgstr "Geen bestandsnaam gespecificeerd voor de uitvoer." @@ -71,8 +72,354 @@ msgstr "Kan de instellingen van het frontend-apparaat \"%s\" niet verkrijgen." msgid "Could not open file \"%s\" for reading." msgstr "Kan bestand \"%s\" niet openen om te lezen." +#~ msgid "Internal clock error." +#~ msgstr "Interne fout met de klok." + +#~ msgid "Could not open audio device for mixer control handling." +#~ msgstr "Kan het audio-apparaat niet openen voor de mixerbesturing." + +#~ msgid "" +#~ "Could not open audio device for mixer control handling. This version of " +#~ "the Open Sound System is not supported by this element." +#~ msgstr "" +#~ "Kan het audio-apparaat niet openen voor de mixerbesturing. Deze versie " +#~ "van het Open Soundsysteem wordt niet ondersteund door dit element." + +#~ msgid "Volume" +#~ msgstr "Volume" + +#~ msgid "Master" +#~ msgstr "Master" + +#~ msgid "Front" +#~ msgstr "Voorzijde" + +#~ msgid "Rear" +#~ msgstr "Achterzijde" + +#~ msgid "Headphones" +#~ msgstr "Hoofdtelefoon" + +#~ msgid "Center" +#~ msgstr "Midden" + +#~ msgid "LFE" +#~ msgstr "LFE" + +#~ msgid "Surround" +#~ msgstr "Surround" + +#~ msgid "Side" +#~ msgstr "Zijkant" + +#~ msgid "Built-in Speaker" +#~ msgstr "Ingebouwde luidspreker" + +#~ msgid "AUX 1 Out" +#~ msgstr "AUX 1-out" + +#~ msgid "AUX 2 Out" +#~ msgstr "AUX 2-out" + +#~ msgid "AUX Out" +#~ msgstr "AUX-out" + +#~ msgid "Bass" +#~ msgstr "Lage tonen" + +#~ msgid "Treble" +#~ msgstr "Hoge tonen" + +#~ msgid "3D Depth" +#~ msgstr "3D diepte" + +#~ msgid "3D Center" +#~ msgstr "3D midden" + +#~ msgid "3D Enhance" +#~ msgstr "3D verbeteren" + +#~ msgid "Telephone" +#~ msgstr "Telefoon" + +#~ msgid "Microphone" +#~ msgstr "Microfoon" + +#~ msgid "Line Out" +#~ msgstr "Line-out" + +#~ msgid "Line In" +#~ msgstr "Line-in" + +#~ msgid "Internal CD" +#~ msgstr "Interne cd" + +#~ msgid "Video In" +#~ msgstr "Video-in" + +#~ msgid "AUX 1 In" +#~ msgstr "AUX 1-in" + +#~ msgid "AUX 2 In" +#~ msgstr "AUX 2-in" + +#~ msgid "AUX In" +#~ msgstr "AUX-in" + +#~ msgid "PCM" +#~ msgstr "PCM" + +#~ msgid "Record Gain" +#~ msgstr "Opnameversterking" + +#~ msgid "Output Gain" +#~ msgstr "Uitgangversterking" + +#~ msgid "Microphone Boost" +#~ msgstr "Microfoon-boost" + +#~ msgid "Loopback" +#~ msgstr "Terugkoppeling" + +#~ msgid "Diagnostic" +#~ msgstr "Diagnostiek" + +#~ msgid "Bass Boost" +#~ msgstr "Lage tonen-boost" + +#~ msgid "Playback Ports" +#~ msgstr "Afspeelpoorten" + +#~ msgid "Input" +#~ msgstr "Invoer" + +#~ msgid "Record Source" +#~ msgstr "Opnamebron" + +#~ msgid "Monitor Source" +#~ msgstr "Monitorbron" + +#~ msgid "Keyboard Beep" +#~ msgstr "Toetsenbordpiep" + +#~ msgid "Monitor" +#~ msgstr "Monitor" + +#~ msgid "Simulate Stereo" +#~ msgstr "Stereo simuleren" + +#~ msgid "Stereo" +#~ msgstr "Stereo" + +#~ msgid "Surround Sound" +#~ msgstr "Surround geluid" + +#~ msgid "Microphone Gain" +#~ msgstr "Microfoonversterking" + +#~ msgid "Speaker Source" +#~ msgstr "Luidsprekerbron" + +#~ msgid "Microphone Source" +#~ msgstr "Microfoonbron" + +#~ msgid "Jack" +#~ msgstr "Jack" + +#~ msgid "Center / LFE" +#~ msgstr "Midden / LFE" + +#~ msgid "Stereo Mix" +#~ msgstr "Stereo mix" + +#~ msgid "Mono Mix" +#~ msgstr "Mono mix" + +#~ msgid "Input Mix" +#~ msgstr "Invoer mix" + +#~ msgid "SPDIF In" +#~ msgstr "SPDIF-in" + +#~ msgid "SPDIF Out" +#~ msgstr "SPDIF-out" + +#~ msgid "Microphone 1" +#~ msgstr "Microfoon 1" + +#~ msgid "Microphone 2" +#~ msgstr "Microfoon 2" + +#~ msgid "Digital Out" +#~ msgstr "Digitaal-out" + +#~ msgid "Digital In" +#~ msgstr "Digitaal-in" + +#~ msgid "HDMI" +#~ msgstr "HDMI" + +#~ msgid "Modem" +#~ msgstr "Modem" + +#~ msgid "Handset" +#~ msgstr "Mobieltje" + +#~ msgid "Other" +#~ msgstr "Overige" + +#~ msgid "None" +#~ msgstr "Geen" + +#~ msgid "On" +#~ msgstr "Aan" + +#~ msgid "Off" +#~ msgstr "Uit" + +#~ msgid "Mute" +#~ msgstr "Gedempt" + +#~ msgid "Fast" +#~ msgstr "Snel" + +#~ msgid "Very Low" +#~ msgstr "Zeer laag" + +#~ msgid "Low" +#~ msgstr "Laag" + +#~ msgid "Medium" +#~ msgstr "Gemiddeld" + +#~ msgid "High" +#~ msgstr "Hoog" + +#~ msgid "Very High" +#~ msgstr "Zeer hoog" + +#~ msgid "Production" +#~ msgstr "Productie" + +#~ msgid "Front Panel Microphone" +#~ msgstr "Microfoon in frontpaneel" + +#~ msgid "Front Panel Line In" +#~ msgstr "Lijn-in in frontpaneel" + +#~ msgid "Front Panel Headphones" +#~ msgstr "Hoofdtelefoon in frontpaneel" + +#~ msgid "Front Panel Line Out" +#~ msgstr "Lijn-in in frontpaneel" + +#~ msgid "Green Connector" +#~ msgstr "Groene connector" + +#~ msgid "Pink Connector" +#~ msgstr "Roze connector" + +#~ msgid "Blue Connector" +#~ msgstr "Blauwe connector" + +#~ msgid "White Connector" +#~ msgstr "Witte connector" + +#~ msgid "Black Connector" +#~ msgstr "Zwarte connector" + +#~ msgid "Gray Connector" +#~ msgstr "Grijze connector" + +#~ msgid "Orange Connector" +#~ msgstr "Oranje connector" + +#~ msgid "Red Connector" +#~ msgstr "Rode connector" + +#~ msgid "Yellow Connector" +#~ msgstr "Gele connector" + +#~ msgid "Green Front Panel Connector" +#~ msgstr "Groene connector in frontpaneel" + +#~ msgid "Pink Front Panel Connector" +#~ msgstr "Roze connector in frontpaneel" + +#~ msgid "Blue Front Panel Connector" +#~ msgstr "Blauwe connector in frontpaneel" + +#~ msgid "White Front Panel Connector" +#~ msgstr "Witte connector in frontpaneel" + +#~ msgid "Black Front Panel Connector" +#~ msgstr "Zwarte connector in frontpaneel" + +#~ msgid "Gray Front Panel Connector" +#~ msgstr "Grijze connector in frontpaneel" + +#~ msgid "Orange Front Panel Connector" +#~ msgstr "Oranje connector in frontpaneel" + +#~ msgid "Red Front Panel Connector" +#~ msgstr "Rode connector in frontpaneel" + +#~ msgid "Yellow Front Panel Connector" +#~ msgstr "Gele connector in frontpaneel" + +#~ msgid "Spread Output" +#~ msgstr "Spread Output" + +#~ msgid "Downmix" +#~ msgstr "Downmix" + +#~ msgid "Virtual Mixer Input" +#~ msgstr "Virtuele mixer-invoer" + +#~ msgid "Virtual Mixer Output" +#~ msgstr "Virtuele mixer-uitvoer" + +#~ msgid "Virtual Mixer Channels" +#~ msgstr "Virtuele mixer-kanalen" + +#~ msgid "%s Function" +#~ msgstr "%s-functie" + #~ msgid "%s %d" #~ msgstr "%s %d" -#~ msgid "Internal clock error." -#~ msgstr "Interne fout met de klok." +#~ msgid "" +#~ "Could not open audio device for playback. Device is being used by another " +#~ "application." +#~ msgstr "" +#~ "Kan het audio-apparaat niet openen voor afspelen. Apparaat is in gebruik " +#~ "bij een andere applicatie." + +#~ msgid "" +#~ "Could not open audio device for playback. You don't have permission to " +#~ "open the device." +#~ msgstr "" +#~ "Kan het audio-apparaat niet openen voor afspelen. U hebt geen toestemming " +#~ "om het apparaat te openen." + +#~ msgid "Could not open audio device for playback." +#~ msgstr "Kan het audio-apparaat niet openen voor afspelen." + +#~ msgid "" +#~ "Could not open audio device for playback. This version of the Open Sound " +#~ "System is not supported by this element." +#~ msgstr "" +#~ "Kan het audio-apparaat niet openen voor afspelen. Deze versie van het " +#~ "Open Soundsysteem wordt niet ondersteund door dit element." + +#~ msgid "Playback is not supported by this audio device." +#~ msgstr "Afspelen wordt door dit audio-apparaat niet ondersteund." + +#~ msgid "Audio playback error." +#~ msgstr "Fout bij audio-afspelen." + +#~ msgid "Recording is not supported by this audio device." +#~ msgstr "Opnemen wordt door dit audio-apparaat niet ondersteund." + +#~ msgid "Error recording from audio device." +#~ msgstr "Fout bij opnemen met dit audio-apparaat." diff --git a/po/pl.po b/po/pl.po index b2005dfdcc..59c56d4a59 100644 --- a/po/pl.po +++ b/po/pl.po @@ -1,13 +1,13 @@ # Polish translation for gst-plugins-bad. # This file is distributed under the same license as the gst-plugins-bad package. -# Jakub Bogusz , 2007-2009. +# Jakub Bogusz , 2007-2011. # msgid "" msgstr "" -"Project-Id-Version: gst-plugins-bad 0.10.13.2\n" +"Project-Id-Version: gst-plugins-bad 0.10.21.2\n" "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n" -"POT-Creation-Date: 2010-10-19 23:33+0100\n" -"PO-Revision-Date: 2009-08-26 16:52+0200\n" +"POT-Creation-Date: 2011-04-27 12:55+0100\n" +"PO-Revision-Date: 2011-04-26 17:57+0200\n" "Last-Translator: Jakub Bogusz \n" "Language-Team: Polish \n" "Language: pl\n" @@ -29,10 +29,11 @@ msgid "" "Could not read DVD. This may be because the DVD is encrypted and a DVD " "decryption library is not installed." msgstr "" +"Nie udało się odczytać DVD. Powodem może być to, że płyta jest zaszyfrowana, " +"a biblioteka odszyfrowująca nie została zainstalowana." -#, fuzzy msgid "Could not read DVD." -msgstr "Nie udało się odczytać informacji o tytułach dla DVD." +msgstr "Nie udało się odczytać DVD." msgid "No file name specified for writing." msgstr "Nie określono nazwy pliku do zapisu." @@ -66,9 +67,3 @@ msgstr "Nie udało się pobrać ustawień z urządzenia frontendu \"%s\"." #, c-format msgid "Could not open file \"%s\" for reading." msgstr "Nie udało się otworzyć pliku \"%s\" do odczytu." - -#~ msgid "%s %d" -#~ msgstr "%s %d" - -#~ msgid "Internal clock error." -#~ msgstr "Błąd wewnętrzny zegara." diff --git a/po/ru.po b/po/ru.po index 743bef5bd5..9d7536da59 100644 --- a/po/ru.po +++ b/po/ru.po @@ -1,20 +1,24 @@ # Translation for gst-plugins-bad messages to Russian # This file is put in the public domain. +# # Артём Попов , 2009. # Pavel Maryanov , 2009. -# +# Yuri Kozlov , 2011. msgid "" msgstr "" -"Project-Id-Version: gst-plugins-bad 0.10.9.3\n" +"Project-Id-Version: gst-plugins-bad 0.10.21.2\n" "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n" -"POT-Creation-Date: 2010-10-19 23:33+0100\n" -"PO-Revision-Date: 2009-02-12 15:00+0200\n" -"Last-Translator: Pavel Maryanov \n" +"POT-Creation-Date: 2011-04-27 12:55+0100\n" +"PO-Revision-Date: 2011-04-26 20:31+0400\n" +"Last-Translator: Yuri Kozlov \n" "Language-Team: Russian \n" "Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"X-Generator: Lokalize 1.0\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" msgid "Could not read title information for DVD." msgstr "Не удалось прочесть информацию о структуре DVD." @@ -30,10 +34,11 @@ msgid "" "Could not read DVD. This may be because the DVD is encrypted and a DVD " "decryption library is not installed." msgstr "" +"Не удалось прочесть DVD. Это могло произойти из-за того, что DVD закодирован " +"и не установлена библиотека декодирования DVD." -#, fuzzy msgid "Could not read DVD." -msgstr "Не удалось прочесть информацию о структуре DVD." +msgstr "Не удалось прочесть DVD." msgid "No file name specified for writing." msgstr "Не указано имя файла для записи." @@ -82,6 +87,74 @@ msgstr "Не удалось открыть для чтения файл «%s»." #~ "Запрашиваемый битрейт %d кбит/с недопустим для свойства «%s». Битрейт " #~ "изменён на %d кбит/с." +#~ msgid "Could not open audio device for mixer control handling." +#~ msgstr "" +#~ "Не удалось открыть аудио-устройство для обработки параметров микшера." + +#~ msgid "" +#~ "Could not open audio device for mixer control handling. This version of " +#~ "the Open Sound System is not supported by this element." +#~ msgstr "" +#~ "Не удалось открыть аудио-устройство для обработки параметров микшера. " +#~ "Данная версия Open Sound System не поддерживается этим элементом." + +#~ msgid "Fast" +#~ msgstr "Скорость" + +#~ msgid "Low" +#~ msgstr "Низкое" + +#~ msgid "Medium" +#~ msgstr "Среднее" + +#~ msgid "High" +#~ msgstr "Высокое" + +#~ msgid "Very high" +#~ msgstr "Очень высокое" + +#~ msgid "Production" +#~ msgstr "Продукция" + +#~ msgid "Off" +#~ msgstr "Выкл" + +#~ msgid "On" +#~ msgstr "Вкл" + +#~ msgid "Stereo" +#~ msgstr "Стерео" + +#~ msgid "Surround sound" +#~ msgstr "Объёмный звук" + +#~ msgid "Input mix" +#~ msgstr "Уровень входа" + +#~ msgid "Front" +#~ msgstr "Фронт" + +#~ msgid "Rear" +#~ msgstr "Тыл" + +#~ msgid "Side" +#~ msgstr "Боковые" + +#~ msgid "Center / LFE" +#~ msgstr "Центр / Сабвуфер" + +#~ msgid "Microphone" +#~ msgstr "Микрофон" + +#~ msgid "Front panel microphone" +#~ msgstr "Фронтальный микрофон" + +#~ msgid "Input" +#~ msgstr "Вход" + +#~ msgid "Line-in" +#~ msgstr "Линейный вход" + #~ msgid "PCM 1" #~ msgstr "PCM 1" @@ -94,6 +167,60 @@ msgstr "Не удалось открыть для чтения файл «%s»." #~ msgid "PCM 4" #~ msgstr "PCM 4" +#~ msgid "Green connector" +#~ msgstr "Зелёный разъём" + +#~ msgid "Green front panel connector" +#~ msgstr "Фронтальный зелёный разъём" + +#~ msgid "Pink connector" +#~ msgstr "Розовый разъём" + +#~ msgid "Pink front panel connector" +#~ msgstr "Фронтальный розовый разъём" + +#~ msgid "Blue connector" +#~ msgstr "Синий разъём" + +#~ msgid "Blue front panel connector" +#~ msgstr "Фронтальный синий разъём" + +#~ msgid "Orange connector" +#~ msgstr "Оранжевый разъём" + +#~ msgid "Orange front panel connector" +#~ msgstr "Фронтальный оранжевый разъём" + +#~ msgid "Black connector" +#~ msgstr "Чёрный разъём" + +#~ msgid "Black front panel connector" +#~ msgstr "Фронтальный чёрный разъём" + +#~ msgid "Gray connector" +#~ msgstr "Серый разъём" + +#~ msgid "Gray front panel connector" +#~ msgstr "Фронтальный серый разъём" + +#~ msgid "White connector" +#~ msgstr "Белый разъём" + +#~ msgid "White front panel connector" +#~ msgstr "Фронтальный белый разъём" + +#~ msgid "Red connector" +#~ msgstr "Красный разъём" + +#~ msgid "Red front panel connector" +#~ msgstr "Фронтальный красный разъём" + +#~ msgid "Yellow connector" +#~ msgstr "Жёлтый разъём" + +#~ msgid "Yellow front panel connector" +#~ msgstr "Фронтальный жёлтый разъём" + #~ msgid "Green connector function" #~ msgstr "Функция зелёного разъёма" @@ -148,5 +275,59 @@ msgstr "Не удалось открыть для чтения файл «%s»." #~ msgid "Yellow front panel connector function" #~ msgstr "Функция фронтального жёлтого разъёма" +#~ msgid "Front panel line-in" +#~ msgstr "Фронтальный линейный вход" + +#~ msgid "Headphones" +#~ msgstr "Наушники" + +#~ msgid "Front panel headphones" +#~ msgstr "Фронтальные наушники" + +#~ msgid "PCM" +#~ msgstr "PCM" + +#~ msgid "Virtual mixer input" +#~ msgstr "Виртуальный вход микшера" + +#~ msgid "Virtual mixer output" +#~ msgstr "Виртуальный выход микшера" + #~ msgid "Virtual mixer channel configuration" #~ msgstr "Конфигурация виртуальных каналов микшера" + +#~ msgid "" +#~ "Could not open audio device for playback. Device is being used by another " +#~ "application." +#~ msgstr "" +#~ "Не удалось открыть аудио-устройство для воспроизведения. Устройство " +#~ "используется другим приложением." + +#~ msgid "" +#~ "Could not open audio device for playback. You don't have permission to " +#~ "open the device." +#~ msgstr "" +#~ "Не удалось открыть аудио-устройство для воспроизведения. Отсутствуют " +#~ "права доступа к устройству." + +#~ msgid "Could not open audio device for playback." +#~ msgstr "Не удалось открыть аудио-устройство для воспроизведения." + +#~ msgid "" +#~ "Could not open audio device for playback. This version of the Open Sound " +#~ "System is not supported by this element." +#~ msgstr "" +#~ "Не удалось открыть аудио-устройство для воспроизведения. Данная версия " +#~ "Open Sound System не поддерживается этим элементом." + +#~ msgid "Playback is not supported by this audio device." +#~ msgstr "Воспроизведение не поддерживается данным аудио-устройством." + +#~ msgid "Audio playback error." +#~ msgstr "Ошибка воспроизведения аудио." + +#~ msgid "Recording is not supported by this audio device." +#~ msgstr "Запись не поддерживается данным аудио-устройством." + +#~ msgid "Error recording from audio device." +#~ msgstr "Ошибка записи с аудио-устройства." diff --git a/po/sl.po b/po/sl.po index 6bd5d7be0a..bff09d3764 100644 --- a/po/sl.po +++ b/po/sl.po @@ -1,16 +1,16 @@ -# -*- mode:po; coding:utf-8; -*- Slovenian message catalogue for gst-plugins-bad. +# Slovenian translation for gst-plugins-bad. +# Copyright (C) 2005 - 2011 Free Software Foundation, Inc. # This file is distributed under the same license as the gst-plugins-bad package. -# Copyright (C) 2005 Free Software Foundation, Inc. -# # Matej Urbančič , 2010. +# Klemen Košir , 2011. # msgid "" msgstr "" -"Project-Id-Version: gst-plugins-bad 0.10.18.2\n" +"Project-Id-Version: gst-plugins-bad 0.10.21.2\n" "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n" -"POT-Creation-Date: 2010-10-19 23:33+0100\n" -"PO-Revision-Date: 2010-07-01 17:42+0100\n" -"Last-Translator: Matej Urbančič \n" +"POT-Creation-Date: 2011-04-27 12:55+0100\n" +"PO-Revision-Date: 2011-04-26 15:21+0100\n" +"Last-Translator: Klemen Košir \n" "Language-Team: Slovenian \n" "Language: sl\n" "MIME-Version: 1.0\n" @@ -23,56 +23,57 @@ msgstr "" "X-Poedit-SourceCharset: utf-8\n" msgid "Could not read title information for DVD." -msgstr "Ni mogoče prebrati podrobnosti naslova na nosilcu DVD." +msgstr "Podatkov naslova DVD-ja ni mogoče prebrati." #, c-format msgid "Failed to open DVD device '%s'." -msgstr "Napaka med odpiranjem DVD naprave '%s'." +msgstr "Napaka med odpiranjem DVD naprave \"%s\"." msgid "Failed to set PGC based seeking." -msgstr "Napaka med nastavljanjem PGC iskanja." +msgstr "Napaka med nastavljanjem iskanja PGC." msgid "" "Could not read DVD. This may be because the DVD is encrypted and a DVD " "decryption library is not installed." msgstr "" +"DVD-ja ni mogoče prebrati. Verjetno je DVD šifriran, knjižnica za " +"dešifriranje pa ni nameščena." -#, fuzzy msgid "Could not read DVD." -msgstr "Ni mogoče prebrati podrobnosti naslova na nosilcu DVD." +msgstr "DVD-ja ni mogoče prebrati." msgid "No file name specified for writing." -msgstr "Ni določenega imena datoteke za zapisovanje." +msgstr "Ni navedenega imena datoteke za pisanje." #, c-format msgid "Could not open file \"%s\" for writing." -msgstr "Ni mogoče odpreti datoteke \"%s\" za pisanje." +msgstr "Datoteke \"%s\" ni mogoče odpreti za pisanje." msgid "Internal data stream error." msgstr "Notranja napaka pretoka podatkov." #, c-format msgid "Could not write to file \"%s\"." -msgstr "Ni mogoče pisati v datoteko \"%s\"." +msgstr "V datoteko \"%s\" ni mogoče pisati." msgid "Internal data flow error." msgstr "Notranja napaka pretočnosti podatkov." #, c-format msgid "Device \"%s\" does not exist." -msgstr "Naprava \"%s\" ne obstaja" +msgstr "Naprava \"%s\" ne obstaja." #, c-format msgid "Could not open frontend device \"%s\"." -msgstr "Ni mogoče odpreti čelne naprave \"%s\"." +msgstr "Čelne naprave \"%s\" ni mogoče odpreti." #, c-format msgid "Could not get settings from frontend device \"%s\"." -msgstr "Ni mogoče pridobiti nastavitev čelne naprave \"%s\"." +msgstr "Nastavitev čelne naprave \"%s\" ni mogoče pridobiti." #, c-format msgid "Could not open file \"%s\" for reading." -msgstr "Ni mogoče odpreti datoteke \"%s\" za branje." +msgstr "Datoteke \"%s\" ni mogoče odpreti za branje." #~ msgid "Volume" #~ msgstr "Glasnost" diff --git a/po/tr.po b/po/tr.po index 8b0d370c4c..667758ecfa 100644 --- a/po/tr.po +++ b/po/tr.po @@ -1,13 +1,13 @@ -# translation of gst-plugins-bad-0.10.10.2.po to Turkish +# translation of gst-plugins-bad-0.10.21.2.po to Turkish # This file is put in the public domain. # # Server Acim , 2009. msgid "" msgstr "" -"Project-Id-Version: gst-plugins-bad-0.10.13.2\n" +"Project-Id-Version: gst-plugins-bad-0.10.21.2\n" "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n" -"POT-Creation-Date: 2010-10-19 23:33+0100\n" -"PO-Revision-Date: 2009-08-12 19:51+0200\n" +"POT-Creation-Date: 2011-04-27 12:55+0100\n" +"PO-Revision-Date: 2011-04-26 19:21+0200\n" "Last-Translator: Server Acim \n" "Language-Team: Turkish \n" "Language: tr\n" @@ -30,10 +30,11 @@ msgid "" "Could not read DVD. This may be because the DVD is encrypted and a DVD " "decryption library is not installed." msgstr "" +"DVD okunamıyor. DVD şifrelenmiş veya DVD şifre çözme kitaplığı kurulmamış " +"olabilir." -#, fuzzy msgid "Could not read DVD." -msgstr "DVD'deki başlık bilgisi okunamıyor." +msgstr "DVD okunamıyor." msgid "No file name specified for writing." msgstr "Yazmak için dosya adı belirtilmedi." @@ -68,11 +69,355 @@ msgstr "Aygıt ayarları bulunamadı \"%s\"." msgid "Could not open file \"%s\" for reading." msgstr "Dosyayı \"%s\" okumak için açamıyor." +#~ msgid "Internal clock error." +#~ msgstr "İç saat hatası." + +#~ msgid "Could not open audio device for mixer control handling." +#~ msgstr "Karıştırıcı işlemi için ses aygıtı açılamıyor." + +#~ msgid "" +#~ "Could not open audio device for mixer control handling. This version of " +#~ "the Open Sound System is not supported by this element." +#~ msgstr "" +#~ "Karıştırıcı işlemi için ses aygıtı açılamıyor. Bu öğe tarafından Açık Ses " +#~ "Sistemi'nin bu sürümü desteklenmiyor." + +#~ msgid "Volume" +#~ msgstr "Gürlük" + +#~ msgid "Master" +#~ msgstr "Ana" + +#~ msgid "Front" +#~ msgstr "Ön" + +#~ msgid "Rear" +#~ msgstr "Arka" + +#~ msgid "Headphones" +#~ msgstr "Kulaklıklar" + +#~ msgid "Center" +#~ msgstr "Merkez" + +#~ msgid "LFE" +#~ msgstr "LFE" + +#~ msgid "Surround" +#~ msgstr "Surround" + +#~ msgid "Side" +#~ msgstr "Yan" + +#~ msgid "Built-in Speaker" +#~ msgstr "Varsayılan Hoparlör" + +#~ msgid "AUX 1 Out" +#~ msgstr "AUX 1 Çıkış" + +#~ msgid "AUX 2 Out" +#~ msgstr "AUX 2 Çıkış" + +#~ msgid "AUX Out" +#~ msgstr "AUX Çıkış" + +#~ msgid "Bass" +#~ msgstr "Bas" + +#~ msgid "Treble" +#~ msgstr "Tiz" + +#~ msgid "3D Depth" +#~ msgstr "3D Derinlik" + +#~ msgid "3D Center" +#~ msgstr "3D Merkez" + +#~ msgid "3D Enhance" +#~ msgstr "3D Genişlik" + +#~ msgid "Telephone" +#~ msgstr "Telefon" + +#~ msgid "Microphone" +#~ msgstr "Mikrofon" + +#~ msgid "Line Out" +#~ msgstr "Hat Çıkışı" + +#~ msgid "Line In" +#~ msgstr "Hat girişi" + +#~ msgid "Internal CD" +#~ msgstr "Dahili CD" + +#~ msgid "Video In" +#~ msgstr "Vidyo Girişi" + +#~ msgid "AUX 1 In" +#~ msgstr "AUX 1 Giriş" + +#~ msgid "AUX 2 In" +#~ msgstr "AUX 2 Giriş" + +#~ msgid "AUX In" +#~ msgstr "AUX Giriş" + +#~ msgid "PCM" +#~ msgstr "PCM" + +#~ msgid "Record Gain" +#~ msgstr "Kayıt Kazancı" + +#~ msgid "Output Gain" +#~ msgstr "Çıkış Kazancı" + +#~ msgid "Microphone Boost" +#~ msgstr "Mikrofon güçlendirme" + +#~ msgid "Loopback" +#~ msgstr "Döngü" + +#~ msgid "Diagnostic" +#~ msgstr "Yapılandırma" + +#~ msgid "Bass Boost" +#~ msgstr "Bass Boost" + +#~ msgid "Playback Ports" +#~ msgstr "Çalma Portları" + +#~ msgid "Input" +#~ msgstr "Giriş" + +#~ msgid "Record Source" +#~ msgstr "Kayıt Kaynağı" + +#~ msgid "Monitor Source" +#~ msgstr "Hoparlör Kaynağı" + +#~ msgid "Keyboard Beep" +#~ msgstr "Klavye Biplemesi" + +#~ msgid "Monitor" +#~ msgstr "Hoparlör" + +#~ msgid "Simulate Stereo" +#~ msgstr "Stereo Benzeşimi" + +#~ msgid "Stereo" +#~ msgstr "Stereo" + +#~ msgid "Surround Sound" +#~ msgstr "Surround Ses" + +#~ msgid "Microphone Gain" +#~ msgstr "Mikrofon Kazancı" + +#~ msgid "Speaker Source" +#~ msgstr "Hoparlör Kaynağı" + +#~ msgid "Microphone Source" +#~ msgstr "Mikrofon Kaynağı" + +#~ msgid "Jack" +#~ msgstr "Jack" + +#~ msgid "Center / LFE" +#~ msgstr "Merkez / LFE" + +#~ msgid "Stereo Mix" +#~ msgstr "Stereo Karışım" + +#~ msgid "Mono Mix" +#~ msgstr "Mono Karışım" + +#~ msgid "Input Mix" +#~ msgstr "Giriş Karışımı" + +#~ msgid "SPDIF In" +#~ msgstr "SPDIF Girişi" + +#~ msgid "SPDIF Out" +#~ msgstr "SPDIF Çıkışı" + +#~ msgid "Microphone 1" +#~ msgstr "Mikrofon 1" + +#~ msgid "Microphone 2" +#~ msgstr "Mikrofon 2" + +#~ msgid "Digital Out" +#~ msgstr "Sayısal Çıkış" + +#~ msgid "Digital In" +#~ msgstr "Sayısal Giriş" + +#~ msgid "HDMI" +#~ msgstr "HDMI" + +#~ msgid "Modem" +#~ msgstr "Modem" + +#~ msgid "Handset" +#~ msgstr "Elde taşıma" + +#~ msgid "Other" +#~ msgstr "Diğer" + +#~ msgid "None" +#~ msgstr "Yok" + +#~ msgid "On" +#~ msgstr "Açık" + +#~ msgid "Off" +#~ msgstr "Kapalı" + +#~ msgid "Mute" +#~ msgstr "Kapat" + +#~ msgid "Fast" +#~ msgstr "Hızlı" + +#~ msgid "Very Low" +#~ msgstr "Çok düşük" + +#~ msgid "Low" +#~ msgstr "Düşük" + +#~ msgid "Medium" +#~ msgstr "Orta" + +#~ msgid "High" +#~ msgstr "Yüksek" + +#~ msgid "Very High" +#~ msgstr "Çok Yüksek" + +#~ msgid "Production" +#~ msgstr "Yapım" + +#~ msgid "Front Panel Microphone" +#~ msgstr "Ön panel Mikrofonu" + +#~ msgid "Front Panel Line In" +#~ msgstr "Ön Panel Hat Girişi" + +#~ msgid "Front Panel Headphones" +#~ msgstr "Ön Panel Kulaklıkları" + +#~ msgid "Front Panel Line Out" +#~ msgstr "Ön Panel Hat Çıkışı" + +#~ msgid "Green Connector" +#~ msgstr "Yeşil Konnektör" + +#~ msgid "Pink Connector" +#~ msgstr "Pembe Konnektör" + +#~ msgid "Blue Connector" +#~ msgstr "Mavi Konnektör" + +#~ msgid "White Connector" +#~ msgstr "Beyaz Konnektör" + +#~ msgid "Black Connector" +#~ msgstr "Siyah Konnektör" + +#~ msgid "Gray Connector" +#~ msgstr "Gri Konnektör" + +#~ msgid "Orange Connector" +#~ msgstr "Portakal rengi Konnektör" + +#~ msgid "Red Connector" +#~ msgstr "Kırmızı Konnektör" + +#~ msgid "Yellow Connector" +#~ msgstr "Sarı Konnektör" + +#~ msgid "Green Front Panel Connector" +#~ msgstr "Yeşil Ön Panel Konnektörü" + +#~ msgid "Pink Front Panel Connector" +#~ msgstr "Pembe Ön Panel Könnektörü" + +#~ msgid "Blue Front Panel Connector" +#~ msgstr "Mavi Ön Panel Konnektörü" + +#~ msgid "White Front Panel Connector" +#~ msgstr "Beyaz Ön Panel Konnektörü" + +#~ msgid "Black Front Panel Connector" +#~ msgstr "Siyah Ön Panel Konnektörü" + +#~ msgid "Gray Front Panel Connector" +#~ msgstr "Gri Ön Panel Konnektörü" + +#~ msgid "Orange Front Panel Connector" +#~ msgstr "Portakal rengi Ön Panel Konnektörü" + +#~ msgid "Red Front Panel Connector" +#~ msgstr "Kırmızı Ön Panel Konnektörü" + +#~ msgid "Yellow Front Panel Connector" +#~ msgstr "Sarı Ön Panel Konnektörü" + +#~ msgid "Spread Output" +#~ msgstr "Çıkışı Yay" + +#~ msgid "Downmix" +#~ msgstr "Sonuç Karışımı" + +#~ msgid "Virtual Mixer Input" +#~ msgstr "Sanal Karıştırıcı Girişi" + +#~ msgid "Virtual Mixer Output" +#~ msgstr "Sanal Karıştırıcı Çıkışı" + +#~ msgid "Virtual Mixer Channels" +#~ msgstr "Sanal Karıştırıcı Kanalları" + +#~ msgid "%s Function" +#~ msgstr "%s İşlev" + #~ msgid "%s %d" #~ msgstr "%s %d" -#~ msgid "Internal clock error." -#~ msgstr "İç saat hatası." +#~ msgid "" +#~ "Could not open audio device for playback. Device is being used by another " +#~ "application." +#~ msgstr "" +#~ "Çalmak için ses aygıtı açılamıyor. Aygıt başka bir uygulama tarafından " +#~ "kullanılıyor." + +#~ msgid "" +#~ "Could not open audio device for playback. You don't have permission to " +#~ "open the device." +#~ msgstr "Çalmak için ses aygıtı açılamıyor. Aygıtı açma izniniz bulunmuyor." + +#~ msgid "Could not open audio device for playback." +#~ msgstr "Çalmak için ses aygıtı açılamıyor." + +#~ msgid "" +#~ "Could not open audio device for playback. This version of the Open Sound " +#~ "System is not supported by this element." +#~ msgstr "" +#~ "Çalmak için ses aygıtı açılamıyor. Açık Ses Sistemi'nin bu sürümü bu öğe " +#~ "tarafından desteklenmiyor." + +#~ msgid "Playback is not supported by this audio device." +#~ msgstr "Bu ses aygıtı çalma işlevini desteklemiyor." + +#~ msgid "Audio playback error." +#~ msgstr "Ses çalma hatası." + +#~ msgid "Recording is not supported by this audio device." +#~ msgstr "Bu ses aygıtı kayıt işlevini desteklemiyor." + +#~ msgid "Error recording from audio device." +#~ msgstr "Ses aygıtı ile kayıtta hata." #~ msgid "PCM 1" #~ msgstr "PCM 1" diff --git a/po/uk.po b/po/uk.po index 43dd49b7f8..5f6c97e546 100644 --- a/po/uk.po +++ b/po/uk.po @@ -1,15 +1,16 @@ # Ukrainian translation to gst-plugins-bad # Copyright (C) 2004 Free Software Foundation, Inc. # This file is distributed under the same license as the gst-plugins-bad package. -# Maxim V. Dziumanenko , 2004-2007. # +# Maxim V. Dziumanenko , 2004-2007. +# Yuri Chornoivan , 2011. msgid "" msgstr "" -"Project-Id-Version: gst-plugins-bad 0.10.5\n" +"Project-Id-Version: gst-plugins-bad 0.10.21.2\n" "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/\n" -"POT-Creation-Date: 2010-10-19 23:33+0100\n" -"PO-Revision-Date: 2007-07-04 12:19+0200\n" -"Last-Translator: Maxim V. Dziumanenko \n" +"POT-Creation-Date: 2011-04-30 18:56+0100\n" +"PO-Revision-Date: 2011-04-30 14:00+0300\n" +"Last-Translator: Yuri Chornoivan \n" "Language-Team: Ukrainian \n" "Language: uk\n" "MIME-Version: 1.0\n" @@ -17,54 +18,57 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"X-Generator: Lokalize 1.2\n" msgid "Could not read title information for DVD." -msgstr "" +msgstr "Не вдалося прочитати дані щодо записів на DVD." -#, fuzzy, c-format +#, c-format msgid "Failed to open DVD device '%s'." -msgstr "Не вдається відкрити пристрій відтворення \"%s\"." +msgstr "Не вдалося відкрити пристрій DVD «%s»." msgid "Failed to set PGC based seeking." -msgstr "" +msgstr "Не вдалося позиціювання на основі програмної послідовності." msgid "" "Could not read DVD. This may be because the DVD is encrypted and a DVD " "decryption library is not installed." msgstr "" +"Не вдалося прочитати DVD. Причиною може бути те, що DVD зашифровано, а " +"бібліотеку розшифрування DVD не встановлено." msgid "Could not read DVD." -msgstr "" +msgstr "Не вдалося прочитати DVD." msgid "No file name specified for writing." -msgstr "" +msgstr "Не вказано назви файла для запису." -#, fuzzy, c-format +#, c-format msgid "Could not open file \"%s\" for writing." -msgstr "Не вдається відкрити файл \"%s\" для читання." +msgstr "Не вдалося відкрити файл «%s» для запису." msgid "Internal data stream error." -msgstr "" +msgstr "Помилка внутрішнього потоку даних." -#, fuzzy, c-format +#, c-format msgid "Could not write to file \"%s\"." -msgstr "Не вдається відкрити пристрій відтворення \"%s\"." +msgstr "Спроба запису до файла «%s» завершилася невдало" msgid "Internal data flow error." -msgstr "" +msgstr "Помилка внутрішнього перенесення даних." #, c-format msgid "Device \"%s\" does not exist." -msgstr "Пристрій \"%s\" не існує." +msgstr "Пристрою «%s» не існує." #, c-format msgid "Could not open frontend device \"%s\"." -msgstr "Не вдається відкрити пристрій відтворення \"%s\"." +msgstr "Не вдалося відкрити пристрій відтворення «%s»." #, c-format msgid "Could not get settings from frontend device \"%s\"." -msgstr "Не вдається отримати параметри пристрою відтворення \"%s\"." +msgstr "Не вдалося отримати параметри пристрою відтворення «%s»." #, c-format msgid "Could not open file \"%s\" for reading." -msgstr "Не вдається відкрити файл \"%s\" для читання." +msgstr "Не вдалося відкрити файл «%s» для читання." diff --git a/sys/Makefile.am b/sys/Makefile.am index ca9d2688ad..4c7486e44a 100644 --- a/sys/Makefile.am +++ b/sys/Makefile.am @@ -22,6 +22,18 @@ endif # CDROM_DIR= # endif +if USE_DIRECT3D +D3DVIDEOSINK_DIR=d3dvideosink +else +D3DVIDEOSINK_DIR= +endif + +if USE_DECKLINK +DECKLINK_DIR=decklink +else +DECKLINK_DIR= +endif + if USE_DIRECTDRAW DIRECTDRAW_DIR=directdraw else @@ -46,6 +58,13 @@ else DVB_DIR= endif +if USE_LINSYS +LINSYS_DIR=linsys +else +LINSYS_DIR= +endif + + if USE_APPLE_MEDIA APPLE_MEDIA_DIR=applemedia else @@ -88,9 +107,15 @@ else SHM_DIR= endif -SUBDIRS = $(ACM_DIR) $(APPLE_MEDIA_DIR) $(DIRECTDRAW_DIR) $(DIRECTSOUND_DIR) $(DVB_DIR) $(FBDEV_DIR) $(OSX_VIDEO_DIR) $(QT_DIR) $(SHM_DIR) $(VCD_DIR) $(VDPAU_DIR) $(WININET_DIR) +if USE_AVC +AVC_DIR=avc +else +AVC_DIR= +endif -DIST_SUBDIRS = acmenc acmmp3dec applemedia directdraw directsound dvb fbdev dshowdecwrapper dshowsrcwrapper dshowvideosink \ +SUBDIRS = $(ACM_DIR) $(APPLE_MEDIA_DIR) $(AVC_DIR) $(D3DVIDEOSINK) $(DECKLINK_DIR) $(DIRECTDRAW_DIR) $(DIRECTSOUND_DIR) $(DVB_DIR) $(FBDEV_DIR) $(LINSYS_DIR) $(OSX_VIDEO_DIR) $(QT_DIR) $(SHM_DIR) $(VCD_DIR) $(VDPAU_DIR) $(WININET_DIR) + +DIST_SUBDIRS = acmenc acmmp3dec applemedia avc d3dvideosink decklink directdraw directsound dvb linsys fbdev dshowdecwrapper dshowsrcwrapper dshowvideosink \ osxvideo qtwrapper shm vcd vdpau wasapi wininet winks winscreencap include $(top_srcdir)/common/parallel-subdirs.mak diff --git a/sys/applemedia/plugin.m b/sys/applemedia/plugin.m index 1bcd3cff03..02f7ca0cbe 100644 --- a/sys/applemedia/plugin.m +++ b/sys/applemedia/plugin.m @@ -58,7 +58,7 @@ plugin_init (GstPlugin * plugin) #else enable_mt_mode (); - res = gst_element_register (plugin, "qtkitvideosrc", GST_RANK_NONE, + res = gst_element_register (plugin, "qtkitvideosrc", GST_RANK_PRIMARY, GST_TYPE_QTKIT_VIDEO_SRC); res &= gst_element_register (plugin, "miovideosrc", GST_RANK_NONE, GST_TYPE_MIO_VIDEO_SRC); diff --git a/sys/audioflingersink/Android.mk b/sys/audioflingersink/Android.mk deleted file mode 100644 index cfa49e3f30..0000000000 --- a/sys/audioflingersink/Android.mk +++ /dev/null @@ -1,89 +0,0 @@ -# external/gstreamer/gstplayer/Android.mk -# -# Copyright 2009 STN wireless -# -ifeq ($(USE_HARDWARE_MM),true) - -LOCAL_PATH:= $(call my-dir) - -# ------------------------------------- -# gstaudioflinger library -# -include $(CLEAR_VARS) - -LOCAL_ARM_MODE := arm - -gstaudioflinger_FILES := \ - audioflinger_wrapper.cpp \ - gstaudioflingersink.c \ - GstAndroid.cpp - -gstaudioflinger_C_INCLUDES := \ - $(LOCAL_PATH)/ \ - $(LOCAL_PATH)/audioflingersink \ - $(TARGET_OUT_HEADERS)/gstreamer-0.10 \ - $(TARGET_OUT_HEADERS)/gstreamer-0.10/gst/audio \ - $(TARGET_OUT_HEADERS)/glib-2.0 \ - $(TARGET_OUT_HEADERS)/glib-2.0/glib \ - external/gst/gstreamer/android \ - external/libxml2/include \ - external/icebird/gstreamer-icb-video \ - external/icebird/include \ - frameworks/base/libs/audioflinger \ - frameworks/base/media/libmediaplayerservice \ - frameworks/base/media/libmedia \ - frameworks/base/include/media - -ifeq ($(STECONF_ANDROID_VERSION),"FROYO") -gstaudioflinger_C_INCLUDES += external/icu4c/common -endif - -LOCAL_SRC_FILES := $(gstaudioflinger_FILES) - -LOCAL_C_INCLUDES += $(gstaudioflinger_C_INCLUDES) - -LOCAL_CFLAGS += -DHAVE_CONFIG_H -LOCAL_CFLAGS += -Wall -Wdeclaration-after-statement -g -O2 -LOCAL_CFLAGS += -DANDROID_USE_GSTREAMER - -ifeq ($(USE_AUDIO_PURE_CODEC),true) -LOCAL_CFLAGS += -DAUDIO_PURE_CODEC -endif - -LOCAL_SHARED_LIBRARIES += libdl -LOCAL_SHARED_LIBRARIES += \ - libgstreamer-0.10 \ - libgstbase-0.10 \ - libglib-2.0 \ - libgthread-2.0 \ - libgmodule-2.0 \ - libgobject-2.0 \ - libgstvideo-0.10 \ - libgstaudio-0.10 - -LOCAL_SHARED_LIBRARIES += \ - libutils \ - libcutils \ - libui \ - libhardware \ - libandroid_runtime \ - libmedia - - -LOCAL_MODULE:= libgstaudioflinger -LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/gstreamer-0.10 - -# -# define LOCAL_PRELINK_MODULE to false to not use pre-link map -# -LOCAL_PRELINK_MODULE := false - -ifeq ($(STECONF_ANDROID_VERSION),"DONUT") -LOCAL_CFLAGS += -DSTECONF_ANDROID_VERSION_DONUT -endif - - -include $(BUILD_SHARED_LIBRARY) - - -endif # USE_HARDWARE_MM == true diff --git a/sys/audioflingersink/GstAndroid.cpp b/sys/audioflingersink/GstAndroid.cpp deleted file mode 100644 index 275638b17c..0000000000 --- a/sys/audioflingersink/GstAndroid.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -/* Helper functions */ -#include - -/* Object header */ -#include "gstaudioflingersink.h" - -static gboolean plugin_init (GstPlugin * plugin) -{ - gboolean ret = TRUE; - - ret &= gst_audioflinger_sink_plugin_init (plugin); - - return ret; -} - -/* Version number of package */ -#define VERSION "0.0.1" -/* package name */ -#define PACKAGE "Android ST-ERICSSON" - - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "audioflinger", - "Android audioflinger library for gstreamer", - plugin_init, VERSION, "LGPL", "libgstaudioflinger.so", "http://www.stericsson.com") - diff --git a/sys/audioflingersink/audioflinger_wrapper.cpp b/sys/audioflingersink/audioflinger_wrapper.cpp deleted file mode 100644 index 64ad7faf0f..0000000000 --- a/sys/audioflingersink/audioflinger_wrapper.cpp +++ /dev/null @@ -1,470 +0,0 @@ -/* GStreamer - * Copyright (C) <2009> Prajnashi S - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#define ENABLE_GST_PLAYER_LOG -#include -#include -#include -#include -#include -#include "audioflinger_wrapper.h" -#include -//#include - - -#define LOG_NDEBUG 0 - -#undef LOG_TAG -#define LOG_TAG "audioflinger_wrapper" - - -using namespace android; - - -typedef struct _AudioFlingerDevice -{ - AudioTrack* audio_track; - bool init; - sp audio_sink; - bool audio_sink_specified; -} AudioFlingerDevice; - - -/* commonly used macro */ -#define AUDIO_FLINGER_DEVICE(handle) ((AudioFlingerDevice*)handle) -#define AUDIO_FLINGER_DEVICE_TRACK(handle) \ - (AUDIO_FLINGER_DEVICE(handle)->audio_track) -#define AUDIO_FLINGER_DEVICE_SINK(handle) \ - (AUDIO_FLINGER_DEVICE(handle)->audio_sink) - - -AudioFlingerDeviceHandle audioflinger_device_create() -{ - AudioFlingerDevice* audiodev = NULL; - AudioTrack *audiotr = NULL; - - // create a new instance of AudioFlinger - audiodev = new AudioFlingerDevice; - if (audiodev == NULL) { - LOGE("Error to create AudioFlingerDevice\n"); - return NULL; - } - - // create AudioTrack - audiotr = new AudioTrack (); - if (audiotr == NULL) { - LOGE("Error to create AudioTrack\n"); - return NULL; - } - - audiodev->init = false; - audiodev->audio_track = (AudioTrack *) audiotr; - audiodev->audio_sink = 0; - audiodev->audio_sink_specified = false; - LOGD("Create AudioTrack successfully %p\n",audiodev); - - return (AudioFlingerDeviceHandle)audiodev; -} - -AudioFlingerDeviceHandle audioflinger_device_open(void* audio_sink) -{ - AudioFlingerDevice* audiodev = NULL; - - // audio_sink shall be an MediaPlayerBase::AudioSink instance - if(audio_sink == NULL) - return NULL; - - // create a new instance of AudioFlinger - audiodev = new AudioFlingerDevice; - if (audiodev == NULL) { - LOGE("Error to create AudioFlingerDevice\n"); - return NULL; - } - - // set AudioSink - - audiodev->audio_sink = (MediaPlayerBase::AudioSink*)audio_sink; - audiodev->audio_track = NULL; - audiodev->init = false; - audiodev->audio_sink_specified = true; - LOGD("Open AudioSink successfully : %p\n",audiodev); - - return (AudioFlingerDeviceHandle)audiodev; -} - -int audioflinger_device_set (AudioFlingerDeviceHandle handle, - int streamType, int channelCount, uint32_t sampleRate, int bufferCount) -{ - status_t status = NO_ERROR; -#ifndef STECONF_ANDROID_VERSION_DONUT - uint32_t channels = 0; -#endif - - int format = AudioSystem::PCM_16_BIT; - - if (handle == NULL) - return -1; - - if(AUDIO_FLINGER_DEVICE_TRACK(handle)) { - // bufferCount is not the number of internal buffer, but the internal - // buffer size -#ifdef STECONF_ANDROID_VERSION_DONUT - status = AUDIO_FLINGER_DEVICE_TRACK(handle)->set(streamType, sampleRate, - format, channelCount); - LOGD("SET : handle : %p : Set AudioTrack, status: %d, streamType: %d, sampleRate: %d, " - "channelCount: %d, bufferCount: %d\n",handle, status, streamType, sampleRate, - channelCount, bufferCount); -#else - switch (channelCount) - { - case 1: - channels = AudioSystem::CHANNEL_OUT_FRONT_LEFT; - break; - case 2: - channels = AudioSystem::CHANNEL_OUT_STEREO; - break; - case 0: - default: - channels = 0; - break; - } - status = AUDIO_FLINGER_DEVICE_TRACK(handle)->set(streamType, sampleRate, - format, channels/*, bufferCount*/); - LOGD("SET handle : %p : Set AudioTrack, status: %d, streamType: %d, sampleRate: %d, " - "channelCount: %d(%d), bufferCount: %d\n",handle, status, streamType, sampleRate, - channelCount, channels, bufferCount); -#endif - AUDIO_FLINGER_DEVICE_TRACK(handle)->setPositionUpdatePeriod(bufferCount); - - } - else if(AUDIO_FLINGER_DEVICE_SINK(handle).get()) { -#ifdef STECONF_ANDROID_VERSION_DONUT - status = AUDIO_FLINGER_DEVICE_SINK(handle)->open(sampleRate, channelCount, - format/*, bufferCount*/); //SDA - - LOGD("OPEN : handle : %p : Set AudioSink, status: %d, streamType: %d, sampleRate: %d," - "channelCount: %d, bufferCount: %d\n", handle, status, streamType, sampleRate, - channelCount, bufferCount); -#else - channels = channelCount; - status = AUDIO_FLINGER_DEVICE_SINK(handle)->open(sampleRate, channels, - format/*, bufferCount*/); - LOGD("OPEN handle : %p : Set AudioSink, status: %d, streamType: %d, sampleRate: %d," - "channelCount: %d(%d), bufferCount: %d\n", handle, status, streamType, sampleRate, - channelCount, channels, bufferCount); -#endif - AUDIO_FLINGER_DEVICE_TRACK(handle) = (AudioTrack *)(AUDIO_FLINGER_DEVICE_SINK(handle)->getTrack()); - if(AUDIO_FLINGER_DEVICE_TRACK(handle)) { - AUDIO_FLINGER_DEVICE_TRACK(handle)->setPositionUpdatePeriod(bufferCount); - } - } - - if (status != NO_ERROR) - return -1; - - AUDIO_FLINGER_DEVICE(handle)->init = true; - - return 0; -} - -void audioflinger_device_release (AudioFlingerDeviceHandle handle) -{ - if (handle == NULL) - return; - - LOGD("Enter\n"); - if(! AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified ) { - if (AUDIO_FLINGER_DEVICE_TRACK(handle) ) { - LOGD("handle : %p Release AudioTrack\n", handle); - delete AUDIO_FLINGER_DEVICE_TRACK(handle); - } - } - if (AUDIO_FLINGER_DEVICE_SINK(handle).get()) { - LOGD("handle : %p Release AudioSink\n", handle); - AUDIO_FLINGER_DEVICE_SINK(handle).clear(); - AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified = false; - } - - delete AUDIO_FLINGER_DEVICE(handle); -} - - -void audioflinger_device_start (AudioFlingerDeviceHandle handle) -{ - if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false) - return; - - LOGD("handle : %p Start Device\n", handle); - - if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) { - AUDIO_FLINGER_DEVICE_SINK(handle)->start(); - } - else { - AUDIO_FLINGER_DEVICE_TRACK(handle)->start(); - } -} - -void audioflinger_device_stop (AudioFlingerDeviceHandle handle) -{ - if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false) - return; - - LOGD("handle : %p Stop Device\n", handle); - - if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) { - AUDIO_FLINGER_DEVICE_SINK(handle)->stop(); - } - else { - AUDIO_FLINGER_DEVICE_TRACK(handle)->stop(); - } - -} - -void audioflinger_device_flush (AudioFlingerDeviceHandle handle) -{ - if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false) - return; - - LOGD("handle : %p Flush device\n", handle); - - if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) { - AUDIO_FLINGER_DEVICE_SINK(handle)->flush(); - } - else { - AUDIO_FLINGER_DEVICE_TRACK(handle)->flush(); - } -} - -void audioflinger_device_pause (AudioFlingerDeviceHandle handle) -{ - if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false) - return; - - LOGD("handle : %p Pause Device\n", handle); - - - if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) { - AUDIO_FLINGER_DEVICE_SINK(handle)->pause(); - } - else { - AUDIO_FLINGER_DEVICE_TRACK(handle)->pause(); - } - -} - -void audioflinger_device_mute (AudioFlingerDeviceHandle handle, int mute) -{ - if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false) - return; - - LOGD("handle : %p Mute Device\n", handle); - - if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) { - // do nothing here, because the volume/mute is set in media service layer - } - else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) { - AUDIO_FLINGER_DEVICE_TRACK(handle)->mute((bool)mute); - } -} - -int audioflinger_device_muted (AudioFlingerDeviceHandle handle) -{ - if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false) - return -1; - - if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) { - // do nothing here, because the volume/mute is set in media service layer - return -1; - } - else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) { - return (int) AUDIO_FLINGER_DEVICE_TRACK(handle)->muted (); - } - return -1; -} - - -void audioflinger_device_set_volume (AudioFlingerDeviceHandle handle, float left, - float right) -{ - if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false) - return; - - LOGD("handle : %p Set volume Device %f,%f\n", handle,left,right); - - if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) { - // do nothing here, because the volume/mute is set in media service layer - return ; - } - else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) { - AUDIO_FLINGER_DEVICE_TRACK(handle)->setVolume (left, right); - } -} - -ssize_t audioflinger_device_write (AudioFlingerDeviceHandle handle, const void *buffer, - size_t size) -{ - if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false) - return -1; - - if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) { - return AUDIO_FLINGER_DEVICE_SINK(handle)->write(buffer, size); - } - else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) { - return AUDIO_FLINGER_DEVICE_TRACK(handle)->write(buffer, size); - } -#ifndef STECONF_ANDROID_VERSION_DONUT - return -1; -#endif -} - -int audioflinger_device_frameCount (AudioFlingerDeviceHandle handle) -{ - if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false) - return -1; - - if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) { - return (int)AUDIO_FLINGER_DEVICE_SINK(handle)->frameCount(); - } - else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) { - return (int)AUDIO_FLINGER_DEVICE_TRACK(handle)->frameCount(); - } - return -1; -} - -int audioflinger_device_frameSize (AudioFlingerDeviceHandle handle) -{ - if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false) - return -1; - - if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) { - return (int)AUDIO_FLINGER_DEVICE_SINK(handle)->frameSize(); - } - else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) { - return (int)AUDIO_FLINGER_DEVICE_TRACK(handle)->frameSize(); - } -#ifndef STECONF_ANDROID_VERSION_DONUT - return -1; -#endif -} - -int64_t audioflinger_device_latency (AudioFlingerDeviceHandle handle) -{ - if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false) - return -1; - - if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) { - return (int64_t)AUDIO_FLINGER_DEVICE_SINK(handle)->latency(); - } - else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) { - return (int64_t)AUDIO_FLINGER_DEVICE_TRACK(handle)->latency(); - } - return -1; -} - -int audioflinger_device_format (AudioFlingerDeviceHandle handle) -{ - if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false) - return -1; - - if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) { - // do nothing here, MediaPlayerBase::AudioSink doesn't provide format() - // interface - return -1; - } - else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) { - return (int)AUDIO_FLINGER_DEVICE_TRACK(handle)->format(); - } - return -1; -} - -int audioflinger_device_channelCount (AudioFlingerDeviceHandle handle) -{ - if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false) - return -1; - if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) { - return (int)AUDIO_FLINGER_DEVICE_SINK(handle)->channelCount(); - } - else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) { - return (int)AUDIO_FLINGER_DEVICE_TRACK(handle)->channelCount(); - } - return -1; -} - -uint32_t audioflinger_device_sampleRate (AudioFlingerDeviceHandle handle) -{ - if (handle == NULL || AUDIO_FLINGER_DEVICE(handle)->init == false) - return 0; - if(AUDIO_FLINGER_DEVICE(handle)->audio_sink_specified) { - // do nothing here, MediaPlayerBase::AudioSink doesn't provide sampleRate() - // interface - return -1; - } - else if (AUDIO_FLINGER_DEVICE_TRACK(handle)) { - return (int)AUDIO_FLINGER_DEVICE_TRACK(handle)->getSampleRate(); -} - return(-1); -} - -int audioflinger_device_obtain_buffer (AudioFlingerDeviceHandle handle, - void **buffer_handle, int8_t **data, size_t *samples, uint64_t offset) -{ - AudioTrack *track = AUDIO_FLINGER_DEVICE_TRACK (handle); - status_t res; - AudioTrack::Buffer *audioBuffer; - - if(track == 0) return(-1); - audioBuffer = new AudioTrack::Buffer(); - audioBuffer->frameCount = *samples; - res = track->obtainBufferAtOffset (audioBuffer, offset, -1); - if (res < 0) { - delete audioBuffer; - - return (int) res; - } - - *samples = audioBuffer->frameCount; - *buffer_handle = static_cast (audioBuffer); - *data = audioBuffer->i8; - - return res; -} - -void audioflinger_device_release_buffer (AudioFlingerDeviceHandle handle, - void *buffer_handle) -{ - AudioTrack *track = AUDIO_FLINGER_DEVICE_TRACK (handle); - AudioTrack::Buffer *audioBuffer = static_cast(buffer_handle); - - if(track == 0) return; - - track->releaseBuffer (audioBuffer); - delete audioBuffer; -} - -uint32_t audioflinger_device_get_position (AudioFlingerDeviceHandle handle) -{ - status_t status; - uint32_t ret = -1; - AudioTrack *track = AUDIO_FLINGER_DEVICE_TRACK (handle); - - if(track == 0) return(-1); - - status = track->getPosition (&ret); - - return ret; -} diff --git a/sys/audioflingersink/audioflinger_wrapper.h b/sys/audioflingersink/audioflinger_wrapper.h deleted file mode 100644 index 07e7693312..0000000000 --- a/sys/audioflingersink/audioflinger_wrapper.h +++ /dev/null @@ -1,85 +0,0 @@ -/* GStreamer - * Copyright (C) <2009> Prajnashi S - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * This file defines APIs to convert C++ AudioFlinder/AudioTrack - * interface to C interface - */ -#ifndef __AUDIOFLINGER_WRAPPER_H__ -#define __AUDIOFLINGER_WRAPPER_H__ - -#define LATE 0x80000002 - -#ifdef __cplusplus -extern "C" { -#endif -typedef void* AudioFlingerDeviceHandle; - -AudioFlingerDeviceHandle audioflinger_device_create(); - -AudioFlingerDeviceHandle audioflinger_device_open(void* audio_sink); - -int audioflinger_device_set (AudioFlingerDeviceHandle handle, - int streamType, int channelCount, uint32_t sampleRate, int bufferCount); - -void audioflinger_device_release(AudioFlingerDeviceHandle handle); - -void audioflinger_device_start(AudioFlingerDeviceHandle handle); - -void audioflinger_device_stop(AudioFlingerDeviceHandle handle); - -ssize_t audioflinger_device_write(AudioFlingerDeviceHandle handle, - const void* buffer, size_t size); - -void audioflinger_device_flush(AudioFlingerDeviceHandle handle); - -void audioflinger_device_pause(AudioFlingerDeviceHandle handle); - -void audioflinger_device_mute(AudioFlingerDeviceHandle handle, int mute); - -int audioflinger_device_muted(AudioFlingerDeviceHandle handle); - -void audioflinger_device_set_volume(AudioFlingerDeviceHandle handle, - float left, float right); - -int audioflinger_device_frameCount(AudioFlingerDeviceHandle handle); - -int audioflinger_device_frameSize(AudioFlingerDeviceHandle handle); - -int64_t audioflinger_device_latency(AudioFlingerDeviceHandle handle); - -int audioflinger_device_format(AudioFlingerDeviceHandle handle); - -int audioflinger_device_channelCount(AudioFlingerDeviceHandle handle); - -uint32_t audioflinger_device_sampleRate(AudioFlingerDeviceHandle handle); - -int audioflinger_device_obtain_buffer (AudioFlingerDeviceHandle handle, - void **buffer_handle, int8_t **data, size_t *samples, uint64_t offset); -void audioflinger_device_release_buffer (AudioFlingerDeviceHandle handle, - void *buffer_handle); - -uint32_t audioflinger_device_get_position (AudioFlingerDeviceHandle handle); - - -#ifdef __cplusplus -} -#endif - -#endif /* __AUDIOFLINGER_WRAPPER_H__ */ diff --git a/sys/audioflingersink/gstaudioflingerringbuffer.h b/sys/audioflingersink/gstaudioflingerringbuffer.h deleted file mode 100644 index 8ccd7bbdba..0000000000 --- a/sys/audioflingersink/gstaudioflingerringbuffer.h +++ /dev/null @@ -1,90 +0,0 @@ -/* GStreamer - * Copyright (C) 2010 Alessandro Decina - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef GST_AUDIO_FLINGER_RING_BUFFER_H -#define GST_AUDIO_FLINGER_RING_BUFFER_H - -#include - -#include "gstaudiosink.h" - -GST_DEBUG_CATEGORY_STATIC (gst_audio_sink_debug); -#define GST_CAT_DEFAULT gst_audio_sink_debug - -#define GST_TYPE_AUDIORING_BUFFER \ - (gst_audioringbuffer_get_type()) -#define GST_AUDIORING_BUFFER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIORING_BUFFER,GstAudioRingBuffer)) -#define GST_AUDIORING_BUFFER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIORING_BUFFER,GstAudioRingBufferClass)) -#define GST_AUDIORING_BUFFER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AUDIORING_BUFFER, GstAudioRingBufferClass)) -#define GST_AUDIORING_BUFFER_CAST(obj) \ - ((GstAudioRingBuffer *)obj) -#define GST_IS_AUDIORING_BUFFER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIORING_BUFFER)) -#define GST_IS_AUDIORING_BUFFER_CLASS(klass)\ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIORING_BUFFER)) - -typedef struct _GstAudioRingBuffer GstAudioRingBuffer; -typedef struct _GstAudioRingBufferClass GstAudioRingBufferClass; - -#define GST_AUDIORING_BUFFER_GET_COND(buf) (((GstAudioRingBuffer *)buf)->cond) -#define GST_AUDIORING_BUFFER_WAIT(buf) (g_cond_wait (GST_AUDIORING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf))) -#define GST_AUDIORING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_AUDIORING_BUFFER_GET_COND (buf))) -#define GST_AUDIORING_BUFFER_BROADCAST(buf)(g_cond_broadcast (GST_AUDIORING_BUFFER_GET_COND (buf))) - -struct _GstAudioRingBuffer -{ - GstRingBuffer object; - - gboolean running; - gint queuedseg; - - GCond *cond; -}; - -struct _GstAudioRingBufferClass -{ - GstRingBufferClass parent_class; -}; - -static void gst_audioringbuffer_class_init (GstAudioRingBufferClass * klass); -static void gst_audioringbuffer_init (GstAudioRingBuffer * ringbuffer, - GstAudioRingBufferClass * klass); -static void gst_audioringbuffer_dispose (GObject * object); -static void gst_audioringbuffer_finalize (GObject * object); - -static GstRingBufferClass *ring_parent_class = NULL; - -static gboolean gst_audioringbuffer_open_device (GstRingBuffer * buf); -static gboolean gst_audioringbuffer_close_device (GstRingBuffer * buf); -static gboolean gst_audioringbuffer_acquire (GstRingBuffer * buf, - GstRingBufferSpec * spec); -static gboolean gst_audioringbuffer_release (GstRingBuffer * buf); -static gboolean gst_audioringbuffer_start (GstRingBuffer * buf); -static gboolean gst_audioringbuffer_pause (GstRingBuffer * buf); -static gboolean gst_audioringbuffer_stop (GstRingBuffer * buf); -static guint gst_audioringbuffer_delay (GstRingBuffer * buf); -static gboolean gst_audioringbuffer_activate (GstRingBuffer * buf, - gboolean active); - -GType gst_audioringbuffer_get_type (void); - -#endif /* GST_AUDIO_FLINGER_RING_BUFFER_H */ diff --git a/sys/audioflingersink/gstaudioflingersink.c b/sys/audioflingersink/gstaudioflingersink.c deleted file mode 100755 index df1256ceb5..0000000000 --- a/sys/audioflingersink/gstaudioflingersink.c +++ /dev/null @@ -1,1655 +0,0 @@ -/* GStreamer - * Copyright (C) <2009> Prajnashi S - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/** - * SECTION:element-audioflindersink - * - * This element lets you output sound using the Audio Flinger system in Android - * - * Note that you should almost always use generic audio conversion elements - * like audioconvert and audioresample in front of an audiosink to make sure - * your pipeline works under all circumstances (those conversion elements will - * act in passthrough-mode if no conversion is necessary). - */ - -#ifdef HAVE_CONFIG_H -//#include "config.h" -#endif -#include "gstaudioflingersink.h" -#include - - - -#define LOG_NDEBUG 0 - -#undef LOG_TAG -#define LOG_TAG "GstAudioFlingerSink" - - -#define DEFAULT_BUFFERTIME (500*GST_MSECOND) / (GST_USECOND) -#define DEFAULT_LATENCYTIME (50*GST_MSECOND) / (GST_USECOND) -#define DEFAULT_VOLUME 10.0 -#define DEFAULT_MUTE FALSE -#define DEFAULT_EXPORT_SYSTEM_AUDIO_CLOCK TRUE - -/* - * PROPERTY_ID - */ -enum -{ - PROP_NULL, - PROP_VOLUME, - PROP_MUTE, - PROP_AUDIO_SINK, -}; - -GST_DEBUG_CATEGORY_STATIC (audioflinger_debug); -#define GST_CAT_DEFAULT audioflinger_debug - -/* elementfactory information */ -static const GstElementDetails gst_audioflinger_sink_details = -GST_ELEMENT_DETAILS ("Audio Sink (AudioFlinger)", - "Sink/Audio", - "Output to android's AudioFlinger", - "Prajnashi S , " - "Alessandro Decina "); - -#define GST_TYPE_ANDROID_AUDIORING_BUFFER \ - (gst_android_audioringbuffer_get_type()) -#define GST_ANDROID_AUDIORING_BUFFER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ANDROID_AUDIORING_BUFFER,GstAndroidAudioRingBuffer)) -#define GST_ANDROID_AUDIORING_BUFFER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ANDROID_AUDIORING_BUFFER,GstAndroidAudioRingBufferClass)) -#define GST_ANDROID_AUDIORING_BUFFER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_ANDROID_AUDIORING_BUFFER, GstAndroidAudioRingBufferClass)) -#define GST_ANDROID_AUDIORING_BUFFER_CAST(obj) \ - ((GstAndroidAudioRingBuffer *)obj) -#define GST_IS_ANDROID_AUDIORING_BUFFER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ANDROID_AUDIORING_BUFFER)) -#define GST_IS_ANDROID_AUDIORING_BUFFER_CLASS(klass)\ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ANDROID_AUDIORING_BUFFER)) - -typedef struct _GstAndroidAudioRingBuffer GstAndroidAudioRingBuffer; -typedef struct _GstAndroidAudioRingBufferClass GstAndroidAudioRingBufferClass; - -#define GST_ANDROID_AUDIORING_BUFFER_GET_COND(buf) (((GstAndroidAudioRingBuffer *)buf)->cond) -#define GST_ANDROID_AUDIORING_BUFFER_WAIT(buf) (g_cond_wait (GST_ANDROID_ANDROID_AUDIORING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf))) -#define GST_ANDROID_AUDIORING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_ANDROID_ANDROID_AUDIORING_BUFFER_GET_COND (buf))) -#define GST_ANDROID_AUDIORING_BUFFER_BROADCAST(buf)(g_cond_broadcast (GST_ANDROID_ANDROID_AUDIORING_BUFFER_GET_COND (buf))) - -struct _GstAndroidAudioRingBuffer -{ - GstRingBuffer object; - - gboolean running; - gint queuedseg; - - GCond *cond; -}; - -struct _GstAndroidAudioRingBufferClass -{ - GstRingBufferClass parent_class; -}; - -static void -gst_android_audioringbuffer_class_init (GstAndroidAudioRingBufferClass * klass); -static void gst_android_audioringbuffer_init (GstAndroidAudioRingBuffer * - ringbuffer, GstAndroidAudioRingBufferClass * klass); -static void gst_android_audioringbuffer_dispose (GObject * object); -static void gst_android_audioringbuffer_finalize (GObject * object); - -static GstRingBufferClass *ring_parent_class = NULL; - -static gboolean gst_android_audioringbuffer_open_device (GstRingBuffer * buf); -static gboolean gst_android_audioringbuffer_close_device (GstRingBuffer * buf); -static gboolean gst_android_audioringbuffer_acquire (GstRingBuffer * buf, - GstRingBufferSpec * spec); -static gboolean gst_android_audioringbuffer_release (GstRingBuffer * buf); -static gboolean gst_android_audioringbuffer_start (GstRingBuffer * buf); -static gboolean gst_android_audioringbuffer_pause (GstRingBuffer * buf); -static gboolean gst_android_audioringbuffer_stop (GstRingBuffer * buf); -static gboolean gst_android_audioringbuffer_activate (GstRingBuffer * buf, - gboolean active); -static void gst_android_audioringbuffer_clear (GstRingBuffer * buf); -static guint gst_android_audioringbuffer_commit (GstRingBuffer * buf, - guint64 * sample, guchar * data, gint in_samples, gint out_samples, - gint * accum); - -static void gst_audioflinger_sink_base_init (gpointer g_class); -static void gst_audioflinger_sink_class_init (GstAudioFlingerSinkClass * klass); -static void gst_audioflinger_sink_init (GstAudioFlingerSink * - audioflinger_sink); - -static void gst_audioflinger_sink_dispose (GObject * object); -static void gst_audioflinger_sink_finalise (GObject * object); - -static void gst_audioflinger_sink_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); -static void gst_audioflinger_sink_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); - -static GstCaps *gst_audioflinger_sink_getcaps (GstBaseSink * bsink); - -static gboolean gst_audioflinger_sink_open (GstAudioFlingerSink * asink); -static gboolean gst_audioflinger_sink_close (GstAudioFlingerSink * asink); -static gboolean gst_audioflinger_sink_prepare (GstAudioFlingerSink * asink, - GstRingBufferSpec * spec); -static gboolean gst_audioflinger_sink_unprepare (GstAudioFlingerSink * asink); -static void gst_audioflinger_sink_reset (GstAudioFlingerSink * asink, - gboolean create_clock); -static void gst_audioflinger_sink_set_mute (GstAudioFlingerSink * - audioflinger_sink, gboolean mute); -static void gst_audioflinger_sink_set_volume (GstAudioFlingerSink * - audioflinger_sink, float volume); -static gboolean gst_audioflinger_sink_event (GstBaseSink * bsink, - GstEvent * event); -static GstRingBuffer *gst_audioflinger_sink_create_ringbuffer (GstBaseAudioSink - * sink); -static GstClockTime gst_audioflinger_sink_get_time (GstClock * clock, - gpointer user_data); -static GstFlowReturn gst_audioflinger_sink_preroll (GstBaseSink * bsink, - GstBuffer * buffer); -static GstClockTime gst_audioflinger_sink_system_audio_clock_get_time (GstClock - * clock, gpointer user_data); -static GstClock *gst_audioflinger_sink_provide_clock (GstElement * elem); -static GstStateChangeReturn gst_audioflinger_sink_change_state (GstElement * - element, GstStateChange transition); - -static GstStaticPadTemplate audioflingersink_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 }, " - "width = (int) 16, " - "depth = (int) 16, " - "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]; ") - ); - -static GType -gst_android_audioringbuffer_get_type (void) -{ - static GType ringbuffer_type = 0; - - if (!ringbuffer_type) { - static const GTypeInfo ringbuffer_info = { - sizeof (GstAndroidAudioRingBufferClass), - NULL, - NULL, - (GClassInitFunc) gst_android_audioringbuffer_class_init, - NULL, - NULL, - sizeof (GstAndroidAudioRingBuffer), - 0, - (GInstanceInitFunc) gst_android_audioringbuffer_init, - NULL - }; - - ringbuffer_type = - g_type_register_static (GST_TYPE_RING_BUFFER, - "GstAndroidAudioSinkRingBuffer", &ringbuffer_info, 0); - } - return ringbuffer_type; -} - -static void -gst_android_audioringbuffer_class_init (GstAndroidAudioRingBufferClass * klass) -{ - GObjectClass *gobject_class; - GstRingBufferClass *gstringbuffer_class; - - gobject_class = G_OBJECT_CLASS (klass); - gstringbuffer_class = GST_RING_BUFFER_CLASS (klass); - - ring_parent_class = g_type_class_peek_parent (klass); - - gobject_class->dispose = gst_android_audioringbuffer_dispose; - gobject_class->finalize = gst_android_audioringbuffer_finalize; - - gstringbuffer_class->open_device = - GST_DEBUG_FUNCPTR (gst_android_audioringbuffer_open_device); - gstringbuffer_class->close_device = - GST_DEBUG_FUNCPTR (gst_android_audioringbuffer_close_device); - gstringbuffer_class->acquire = - GST_DEBUG_FUNCPTR (gst_android_audioringbuffer_acquire); - gstringbuffer_class->release = - GST_DEBUG_FUNCPTR (gst_android_audioringbuffer_release); - gstringbuffer_class->start = - GST_DEBUG_FUNCPTR (gst_android_audioringbuffer_start); - gstringbuffer_class->pause = - GST_DEBUG_FUNCPTR (gst_android_audioringbuffer_pause); - gstringbuffer_class->resume = - GST_DEBUG_FUNCPTR (gst_android_audioringbuffer_start); - gstringbuffer_class->stop = - GST_DEBUG_FUNCPTR (gst_android_audioringbuffer_stop); - gstringbuffer_class->clear_all = - GST_DEBUG_FUNCPTR (gst_android_audioringbuffer_clear); - gstringbuffer_class->commit = - GST_DEBUG_FUNCPTR (gst_android_audioringbuffer_commit); - -#if 0 - gstringbuffer_class->delay = - GST_DEBUG_FUNCPTR (gst_android_audioringbuffer_delay); -#endif - gstringbuffer_class->activate = - GST_DEBUG_FUNCPTR (gst_android_audioringbuffer_activate); -} - -static void -gst_android_audioringbuffer_init (G_GNUC_UNUSED GstAndroidAudioRingBuffer * - ringbuffer, G_GNUC_UNUSED GstAndroidAudioRingBufferClass * g_class) -{ -} - -static void -gst_android_audioringbuffer_dispose (GObject * object) -{ - G_OBJECT_CLASS (ring_parent_class)->dispose (object); -} - -static void -gst_android_audioringbuffer_finalize (GObject * object) -{ - G_OBJECT_CLASS (ring_parent_class)->finalize (object); -} - -static gboolean -gst_android_audioringbuffer_open_device (GstRingBuffer * buf) -{ - GstAudioFlingerSink *sink; - gboolean result = TRUE; - LOGD (">gst_android_audioringbuffer_open_device"); - sink = GST_AUDIOFLINGERSINK (GST_OBJECT_PARENT (buf)); - result = gst_audioflinger_sink_open (sink); - - if (!result) - goto could_not_open; - - return result; - -could_not_open: - { - GST_DEBUG_OBJECT (sink, "could not open device"); - LOGE ("could not open device"); - return FALSE; - } -} - -static gboolean -gst_android_audioringbuffer_close_device (GstRingBuffer * buf) -{ - GstAudioFlingerSink *sink; - gboolean result = TRUE; - - LOGD (">gst_android_audioringbuffer_close_device"); - - sink = GST_AUDIOFLINGERSINK (GST_OBJECT_PARENT (buf)); - - result = gst_audioflinger_sink_close (sink); - - if (!result) - goto could_not_close; - - return result; - -could_not_close: - { - GST_DEBUG_OBJECT (sink, "could not close device"); - LOGE ("could not close device"); - return FALSE; - } -} - -static gboolean -gst_android_audioringbuffer_acquire (GstRingBuffer * buf, - GstRingBufferSpec * spec) -{ - GstAudioFlingerSink *sink; - gboolean result = FALSE; - - LOGD (">gst_android_audioringbuffer_acquire"); - - sink = GST_AUDIOFLINGERSINK (GST_OBJECT_PARENT (buf)); - - result = gst_audioflinger_sink_prepare (sink, spec); - - if (!result) - goto could_not_prepare; - - return TRUE; - - /* ERRORS */ -could_not_prepare: - { - GST_DEBUG_OBJECT (sink, "could not prepare device"); - LOGE ("could not close device"); - return FALSE; - } -} - -static gboolean -gst_android_audioringbuffer_activate (G_GNUC_UNUSED GstRingBuffer * buf, - G_GNUC_UNUSED gboolean active) -{ - return TRUE; -} - -/* function is called with LOCK */ -static gboolean -gst_android_audioringbuffer_release (GstRingBuffer * buf) -{ - GstAudioFlingerSink *sink; - gboolean result = FALSE; - LOGD (">gst_android_audioringbuffer_release"); - - sink = GST_AUDIOFLINGERSINK (GST_OBJECT_PARENT (buf)); - - result = gst_audioflinger_sink_unprepare (sink); - - if (!result) - goto could_not_unprepare; - - GST_DEBUG_OBJECT (sink, "unprepared"); - LOGD ("unprepared"); - - return result; - -could_not_unprepare: - { - GST_DEBUG_OBJECT (sink, "could not unprepare device"); - LOGE ("could not unprepare device"); - return FALSE; - } -} - -static gboolean -gst_android_audioringbuffer_start (GstRingBuffer * buf) -{ - GstAudioFlingerSink *asink; - GstAndroidAudioRingBuffer *abuf; - - abuf = GST_ANDROID_AUDIORING_BUFFER_CAST (buf); - asink = GST_AUDIOFLINGERSINK (GST_OBJECT_PARENT (abuf)); - - GST_INFO_OBJECT (buf, "starting ringbuffer"); - LOGD ("starting ringbuffer"); - - audioflinger_device_start (asink->audioflinger_device); - - return TRUE; -} - -static gboolean -gst_android_audioringbuffer_pause (GstRingBuffer * buf) -{ - GstAudioFlingerSink *asink; - GstAndroidAudioRingBuffer *abuf; - - abuf = GST_ANDROID_AUDIORING_BUFFER_CAST (buf); - asink = GST_AUDIOFLINGERSINK (GST_OBJECT_PARENT (abuf)); - - GST_INFO_OBJECT (buf, "pausing ringbuffer"); - LOGD ("pausing ringbuffer"); - - audioflinger_device_pause (asink->audioflinger_device); - - return TRUE; -} - -static gboolean -gst_android_audioringbuffer_stop (GstRingBuffer * buf) -{ - GstAudioFlingerSink *asink; - GstAndroidAudioRingBuffer *abuf; - - abuf = GST_ANDROID_AUDIORING_BUFFER_CAST (buf); - asink = GST_AUDIOFLINGERSINK (GST_OBJECT_PARENT (abuf)); - - GST_INFO_OBJECT (buf, "stopping ringbuffer"); - LOGD ("stopping ringbuffer"); - - audioflinger_device_stop (asink->audioflinger_device); - - return TRUE; -} - -#if 0 -static guint -gst_android_audioringbuffer_delay (GstRingBuffer * buf) -{ - return 0; -} -#endif - -static void -gst_android_audioringbuffer_clear (GstRingBuffer * buf) -{ - GstAudioFlingerSink *asink; - GstAndroidAudioRingBuffer *abuf; - - abuf = GST_ANDROID_AUDIORING_BUFFER_CAST (buf); - asink = GST_AUDIOFLINGERSINK (GST_OBJECT_PARENT (abuf)); - - GST_INFO_OBJECT (buf, "clearing ringbuffer"); - LOGD ("clearing ringbuffer"); - - if (asink->audioflinger_device == NULL) - return; - - GST_INFO_OBJECT (asink, "resetting clock"); - gst_audio_clock_reset (GST_AUDIO_CLOCK (asink->audio_clock), 0); - - audioflinger_device_flush (asink->audioflinger_device); -} - -#define FWD_SAMPLES(s,se,d,de) \ -G_STMT_START { \ - /* no rate conversion */ \ - guint towrite = MIN (se + bps - s, de - d); \ - /* simple copy */ \ - if (!skip) \ - memcpy (d, s, towrite); \ - in_samples -= towrite / bps; \ - out_samples -= towrite / bps; \ - s += towrite; \ - GST_LOG ("copy %u bytes", towrite); \ -} G_STMT_END - -/* in_samples >= out_samples, rate > 1.0 */ -#define FWD_UP_SAMPLES(s,se,d,de) \ -G_STMT_START { \ - guint8 *sb = s, *db = d; \ - while (s <= se && d < de) { \ - if (!skip) \ - memcpy (d, s, bps); \ - s += bps; \ - *accum += outr; \ - if ((*accum << 1) >= inr) { \ - *accum -= inr; \ - d += bps; \ - } \ - } \ - in_samples -= (s - sb)/bps; \ - out_samples -= (d - db)/bps; \ - GST_DEBUG ("fwd_up end %d/%d",*accum,*toprocess); \ -} G_STMT_END - -/* out_samples > in_samples, for rates smaller than 1.0 */ -#define FWD_DOWN_SAMPLES(s,se,d,de) \ -G_STMT_START { \ - guint8 *sb = s, *db = d; \ - while (s <= se && d < de) { \ - if (!skip) \ - memcpy (d, s, bps); \ - d += bps; \ - *accum += inr; \ - if ((*accum << 1) >= outr) { \ - *accum -= outr; \ - s += bps; \ - } \ - } \ - in_samples -= (s - sb)/bps; \ - out_samples -= (d - db)/bps; \ - GST_DEBUG ("fwd_down end %d/%d",*accum,*toprocess); \ -} G_STMT_END - -#define REV_UP_SAMPLES(s,se,d,de) \ -G_STMT_START { \ - guint8 *sb = se, *db = d; \ - while (s <= se && d < de) { \ - if (!skip) \ - memcpy (d, se, bps); \ - se -= bps; \ - *accum += outr; \ - while (d < de && (*accum << 1) >= inr) { \ - *accum -= inr; \ - d += bps; \ - } \ - } \ - in_samples -= (sb - se)/bps; \ - out_samples -= (d - db)/bps; \ - GST_DEBUG ("rev_up end %d/%d",*accum,*toprocess); \ -} G_STMT_END - -#define REV_DOWN_SAMPLES(s,se,d,de) \ -G_STMT_START { \ - guint8 *sb = se, *db = d; \ - while (s <= se && d < de) { \ - if (!skip) \ - memcpy (d, se, bps); \ - d += bps; \ - *accum += inr; \ - while (s <= se && (*accum << 1) >= outr) { \ - *accum -= outr; \ - se -= bps; \ - } \ - } \ - in_samples -= (sb - se)/bps; \ - out_samples -= (d - db)/bps; \ - GST_DEBUG ("rev_down end %d/%d",*accum,*toprocess); \ -} G_STMT_END - -static guint -gst_android_audioringbuffer_commit (GstRingBuffer * buf, guint64 * sample, - guchar * data, gint in_samples, gint out_samples, gint * accum) -{ - GstBaseAudioSink *baseaudiosink; - GstAudioFlingerSink *asink; - GstAndroidAudioRingBuffer *abuf; - guint result; - guint8 *data_end; - gboolean reverse; - gint *toprocess; - gint inr, outr, bps; - guint bufsize; - gboolean skip = FALSE; - guint32 position; - gboolean slaved; - guint64 corrected_sample; - gboolean sync; - - abuf = GST_ANDROID_AUDIORING_BUFFER_CAST (buf); - asink = GST_AUDIOFLINGERSINK (GST_OBJECT_PARENT (abuf)); - baseaudiosink = GST_BASE_AUDIO_SINK (asink); - sync = gst_base_sink_get_sync (GST_BASE_SINK_CAST (asink)); - - GST_LOG_OBJECT (asink, "entering commit"); - - /* make sure the ringbuffer is started */ - if (G_UNLIKELY (g_atomic_int_get (&buf->state) != - GST_RING_BUFFER_STATE_STARTED)) { - /* see if we are allowed to start it */ - if (G_UNLIKELY (g_atomic_int_get (&buf->abidata.ABI.may_start) == FALSE)) - goto no_start; - - GST_LOG_OBJECT (buf, "start!"); - LOGD ("start!"); - if (!gst_ring_buffer_start (buf)) - goto start_failed; - } - - slaved = GST_ELEMENT_CLOCK (baseaudiosink) != asink->exported_clock; - if (asink->last_resync_sample == -1 || - (gint64) baseaudiosink->next_sample == -1) { - if (slaved) { - /* we're writing a discont buffer. Disable slaving for a while in order to - * fill the initial buffer needed by the audio mixer thread. This avoids - * some cases where audioflinger removes us from the list of active tracks - * because we aren't writing enough data. - */ - GST_INFO_OBJECT (asink, "no previous sample, now %" G_GINT64_FORMAT - " disabling slaving", *sample); - LOGD ("no previous sample, now %ld disabling slaving", *sample); - - asink->last_resync_sample = *sample; - g_object_set (asink, "slave-method", GST_BASE_AUDIO_SINK_SLAVE_NONE, - NULL); - asink->slaving_disabled = TRUE; - } else { -/* Trace displayed too much time : remove it - GST_INFO_OBJECT (asink, "no previous sample but not slaved"); - LOGD("no previous sample but not slaved"); -*/ - } - } - - if (slaved && asink->slaving_disabled) { - guint64 threshold; - - threshold = gst_util_uint64_scale_int (buf->spec.rate, 5, 1); - threshold += asink->last_resync_sample; - - if (*sample >= threshold) { - GST_INFO_OBJECT (asink, "last sync %" G_GINT64_FORMAT - " reached sample %" G_GINT64_FORMAT ", enabling slaving", - asink->last_resync_sample, *sample); - g_object_set (asink, "slave-method", GST_BASE_AUDIO_SINK_SLAVE_SKEW, - NULL); - asink->slaving_disabled = FALSE; - } - } - - bps = buf->spec.bytes_per_sample; - bufsize = buf->spec.segsize * buf->spec.segtotal; - - /* our toy resampler for trick modes */ - reverse = out_samples < 0; - out_samples = ABS (out_samples); - - if (in_samples >= out_samples) - toprocess = &in_samples; - else - toprocess = &out_samples; - - inr = in_samples - 1; - outr = out_samples - 1; - - GST_LOG_OBJECT (asink, "in %d, out %d reverse %d sync %d", inr, outr, - reverse, sync); - - /* data_end points to the last sample we have to write, not past it. This is - * needed to properly handle reverse playback: it points to the last sample. */ - data_end = data + (bps * inr); - - while (*toprocess > 0) { - if (sync) { - size_t avail; - guint towrite; - gint err; - guint8 *d, *d_end; - gpointer buffer_handle; - - position = audioflinger_device_get_position (asink->audioflinger_device); - avail = out_samples; - buffer_handle = NULL; - GST_LOG_OBJECT (asink, "calling obtain buffer, position %d" - " offset %" G_GINT64_FORMAT " samples %" G_GSSIZE_FORMAT, - position, *sample, avail); - err = audioflinger_device_obtain_buffer (asink->audioflinger_device, - &buffer_handle, (int8_t **) & d, &avail, *sample); - GST_LOG_OBJECT (asink, "obtain buffer returned"); - if (err < 0) { - GST_LOG_OBJECT (asink, "obtain buffer error %d, state %d", - err, buf->state); - LOGD ("obtain buffer error 0x%x, state %d", err, buf->state); - - if (err == LATE) - skip = TRUE; - else if (buf->state != GST_RING_BUFFER_STATE_STARTED) - goto done; - else - goto obtain_buffer_failed; - } - - towrite = avail * bps; - d_end = d + towrite; - - GST_LOG_OBJECT (asink, "writing %u samples at offset %" G_GUINT64_FORMAT, - (guint) avail, *sample); - - if (G_LIKELY (inr == outr && !reverse)) { - FWD_SAMPLES (data, data_end, d, d_end); - } else if (!reverse) { - if (inr >= outr) { - /* forward speed up */ - FWD_UP_SAMPLES (data, data_end, d, d_end); - } else { - /* forward slow down */ - FWD_DOWN_SAMPLES (data, data_end, d, d_end); - } - } else { - if (inr >= outr) - /* reverse speed up */ - REV_UP_SAMPLES (data, data_end, d, d_end); - else - /* reverse slow down */ - REV_DOWN_SAMPLES (data, data_end, d, d_end); - } - - *sample += avail; - - if (buffer_handle) - audioflinger_device_release_buffer (asink->audioflinger_device, - buffer_handle); - } else { - gint written; - - written = audioflinger_device_write (asink->audioflinger_device, data, - *toprocess * bps); - if (written > 0) { - *toprocess -= written / bps; - data += written; - } else { - LOGE ("Error to write buffer(error=%d)", written); - GST_LOG_OBJECT (asink, "Error to write buffer(error=%d)", written); - goto start_failed; - } - } - } -skip: - /* we consumed all samples here */ - data = data_end + bps; - -done: - result = inr - ((data_end - data) / bps); - GST_LOG_OBJECT (asink, "wrote %d samples", result); - - return result; - - /* ERRORS */ -no_start: - { - GST_LOG_OBJECT (asink, "we can not start"); - LOGE ("we can not start"); - return 0; - } -start_failed: - { - GST_LOG_OBJECT (asink, "failed to start the ringbuffer"); - LOGE ("failed to start the ringbuffer"); - return 0; - } -obtain_buffer_failed: - { - GST_ELEMENT_ERROR (asink, RESOURCE, FAILED, - ("obtain_buffer failed"), (NULL)); - LOGE ("obtain_buffer failed"); - return -1; - } -} - -static GstElementClass *parent_class = NULL; - -GType -gst_audioflinger_sink_get_type (void) -{ - static GType audioflingersink_type = 0; - - if (!audioflingersink_type) { - static const GTypeInfo audioflingersink_info = { - sizeof (GstAudioFlingerSinkClass), - gst_audioflinger_sink_base_init, - NULL, - (GClassInitFunc) gst_audioflinger_sink_class_init, - NULL, - NULL, - sizeof (GstAudioFlingerSink), - 0, - (GInstanceInitFunc) gst_audioflinger_sink_init, - }; - - audioflingersink_type = - g_type_register_static (GST_TYPE_AUDIO_SINK, "GstAudioFlingerSink", - &audioflingersink_info, 0); - } - - return audioflingersink_type; -} - -static void -gst_audioflinger_sink_dispose (GObject * object) -{ - GstAudioFlingerSink *audioflinger_sink = GST_AUDIOFLINGERSINK (object); - - if (audioflinger_sink->probed_caps) { - gst_caps_unref (audioflinger_sink->probed_caps); - audioflinger_sink->probed_caps = NULL; - } - - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -gst_audioflinger_sink_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details (element_class, &gst_audioflinger_sink_details); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&audioflingersink_sink_factory)); - GST_DEBUG_CATEGORY_INIT (audioflinger_debug, "audioflingersink", 0, - "audioflinger sink trace"); -} - -static void -gst_audioflinger_sink_class_init (GstAudioFlingerSinkClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - GstBaseSinkClass *gstbasesink_class; - GstBaseAudioSinkClass *gstbaseaudiosink_class; - GstAudioSinkClass *gstaudiosink_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - gstbasesink_class = (GstBaseSinkClass *) klass; - gstbaseaudiosink_class = (GstBaseAudioSinkClass *) klass; - gstaudiosink_class = (GstAudioSinkClass *) klass; - - parent_class = g_type_class_peek_parent (klass); - - gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_audioflinger_sink_dispose); - gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_audioflinger_sink_finalise); - gobject_class->get_property = - GST_DEBUG_FUNCPTR (gst_audioflinger_sink_get_property); - gobject_class->set_property = - GST_DEBUG_FUNCPTR (gst_audioflinger_sink_set_property); - - gstelement_class->provide_clock = - GST_DEBUG_FUNCPTR (gst_audioflinger_sink_provide_clock); - gstelement_class->change_state = - GST_DEBUG_FUNCPTR (gst_audioflinger_sink_change_state); - - gstbasesink_class->get_caps = - GST_DEBUG_FUNCPTR (gst_audioflinger_sink_getcaps); - - gstbaseaudiosink_class->create_ringbuffer = - GST_DEBUG_FUNCPTR (gst_audioflinger_sink_create_ringbuffer); - - gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_audioflinger_sink_event); - gstbasesink_class->preroll = - GST_DEBUG_FUNCPTR (gst_audioflinger_sink_preroll); - - /* Install properties */ - g_object_class_install_property (gobject_class, PROP_MUTE, - g_param_spec_boolean ("mute", "Mute", - "Mute output", DEFAULT_MUTE, G_PARAM_READWRITE)); - g_object_class_install_property (gobject_class, PROP_VOLUME, - g_param_spec_double ("volume", "Volume", - "control volume size", 0.0, 10.0, DEFAULT_VOLUME, G_PARAM_READWRITE)); - g_object_class_install_property (gobject_class, PROP_AUDIO_SINK, - g_param_spec_pointer ("audiosink", "AudioSink", - "The pointer of MediaPlayerBase::AudioSink", G_PARAM_WRITABLE)); -} - -static void -gst_audioflinger_sink_init (GstAudioFlingerSink * audioflinger_sink) -{ - GST_DEBUG_OBJECT (audioflinger_sink, "initializing audioflinger_sink"); - LOGD ("initializing audioflinger_sink"); - - audioflinger_sink->audio_clock = NULL; - audioflinger_sink->system_clock = NULL; - audioflinger_sink->system_audio_clock = NULL; - audioflinger_sink->exported_clock = NULL; - audioflinger_sink->export_system_audio_clock = - DEFAULT_EXPORT_SYSTEM_AUDIO_CLOCK; - gst_audioflinger_sink_reset (audioflinger_sink, TRUE); -} - -static void -gst_audioflinger_sink_reset (GstAudioFlingerSink * sink, gboolean create_clocks) -{ - - if (sink->audioflinger_device != NULL) { - audioflinger_device_release (sink->audioflinger_device); - sink->audioflinger_device = NULL; - } - - sink->audioflinger_device = NULL; - sink->m_volume = DEFAULT_VOLUME; - sink->m_mute = DEFAULT_MUTE; - sink->m_init = FALSE; - sink->m_audiosink = NULL; - sink->eos = FALSE; - sink->may_provide_clock = TRUE; - sink->last_resync_sample = -1; - - if (sink->system_clock) { - GstClock *clock = sink->system_clock; - - GST_INFO_OBJECT (sink, "destroying system_clock %d", - GST_OBJECT_REFCOUNT (sink->system_clock)); - gst_clock_set_master (sink->system_clock, NULL); - gst_object_replace ((GstObject **) & sink->system_clock, NULL); - GST_INFO_OBJECT (sink, "destroyed system_clock"); - GST_INFO_OBJECT (sink, "destroying system_audio_clock %d", - GST_OBJECT_REFCOUNT (sink->system_audio_clock)); - gst_object_replace ((GstObject **) & sink->system_audio_clock, NULL); - GST_INFO_OBJECT (sink, "destroyed system_audio_clock"); - } - - if (sink->audio_clock) { - GST_INFO_OBJECT (sink, "destroying audio clock %d", - GST_OBJECT_REFCOUNT (sink->audio_clock)); - - gst_object_replace ((GstObject **) & sink->audio_clock, NULL); - } - - if (sink->exported_clock) { - GST_INFO_OBJECT (sink, "destroying exported clock %d", - GST_OBJECT_REFCOUNT (sink->exported_clock)); - gst_object_replace ((GstObject **) & sink->exported_clock, NULL); - GST_INFO_OBJECT (sink, "destroyed exported clock"); - } - - if (create_clocks) { - GstClockTime external, internal; - - /* create the audio clock that uses the ringbuffer as its audio source */ - sink->audio_clock = gst_audio_clock_new ("GstAudioFlingerSinkClock", - gst_audioflinger_sink_get_time, sink); - - /* always set audio_clock as baseaudiosink's provided_clock */ - gst_object_replace ((GstObject **) & - GST_BASE_AUDIO_SINK (sink)->provided_clock, - GST_OBJECT (sink->audio_clock)); - - /* create the system_audio_clock, which is an *audio clock* that uses an - * instance of the system clock as its time source */ - sink->system_audio_clock = - gst_audio_clock_new ("GstAudioFlingerSystemAudioClock", - gst_audioflinger_sink_system_audio_clock_get_time, sink); - - /* create an instance of the system clock, that we slave to - * sink->audio_clock to have an audio clock with an higher resolution than - * the segment size (50ms) */ - sink->system_clock = g_object_new (GST_TYPE_SYSTEM_CLOCK, - "name", "GstAudioFlingerSystemClock", NULL); - - /* calibrate the clocks */ - external = gst_clock_get_time (sink->audio_clock); - internal = gst_clock_get_internal_time (sink->system_clock); - gst_clock_set_calibration (sink->system_clock, internal, external, 1, 1); - - /* slave the system clock to the audio clock */ - GST_OBJECT_FLAG_SET (sink->system_clock, GST_CLOCK_FLAG_CAN_SET_MASTER); - g_object_set (sink->system_clock, "timeout", 50 * GST_MSECOND, NULL); - gst_clock_set_master (sink->system_clock, sink->audio_clock); - } - -} - -static void -gst_audioflinger_sink_finalise (GObject * object) -{ - GstAudioFlingerSink *audioflinger_sink = GST_AUDIOFLINGERSINK (object); - - GST_INFO_OBJECT (object, "finalize"); - - gst_audioflinger_sink_reset (audioflinger_sink, FALSE); - - G_OBJECT_CLASS (parent_class)->finalize ((GObject *) (object)); -} - -static GstRingBuffer * -gst_audioflinger_sink_create_ringbuffer (GstBaseAudioSink * sink) -{ - GstRingBuffer *buffer; - - GST_DEBUG_OBJECT (sink, "creating ringbuffer"); - LOGD ("creating ringbuffer"); - buffer = g_object_new (GST_TYPE_ANDROID_AUDIORING_BUFFER, NULL); - GST_DEBUG_OBJECT (sink, "created ringbuffer @%p", buffer); - LOGD ("created ringbuffer @%p", buffer); - - return buffer; -} - -static void -gst_audioflinger_sink_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec) -{ - GstAudioFlingerSink *audioflinger_sink; - - audioflinger_sink = GST_AUDIOFLINGERSINK (object); - g_return_if_fail (audioflinger_sink != NULL); - - switch (prop_id) { - case PROP_MUTE: - g_value_set_boolean (value, audioflinger_sink->m_mute); - GST_DEBUG_OBJECT (audioflinger_sink, "get mute: %d", - audioflinger_sink->m_mute); - LOGD ("get mute: %d", audioflinger_sink->m_mute); - break; - case PROP_VOLUME: - g_value_set_double (value, audioflinger_sink->m_volume); - GST_DEBUG_OBJECT (audioflinger_sink, "get volume: %f", - audioflinger_sink->m_volume); - LOGD ("get volume: %f", audioflinger_sink->m_volume); - break; - case PROP_AUDIO_SINK: - GST_ERROR_OBJECT (audioflinger_sink, "Shall not go here!"); - LOGD ("Shall not go here!"); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_audioflinger_sink_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstAudioFlingerSink *audioflinger_sink; - audioflinger_sink = GST_AUDIOFLINGERSINK (object); - - g_return_if_fail (audioflinger_sink != NULL); - GST_OBJECT_LOCK (audioflinger_sink); - switch (prop_id) { - case PROP_MUTE: - audioflinger_sink->m_mute = g_value_get_boolean (value); - GST_DEBUG_OBJECT (audioflinger_sink, "set mute: %d", - audioflinger_sink->m_mute); - LOGD ("set mute: %d", audioflinger_sink->m_mute); - /* set device if it's initialized */ - if (audioflinger_sink->audioflinger_device && audioflinger_sink->m_init) - gst_audioflinger_sink_set_mute (audioflinger_sink, - (int) (audioflinger_sink->m_mute)); - break; - case PROP_VOLUME: - audioflinger_sink->m_volume = g_value_get_double (value); - GST_DEBUG_OBJECT (audioflinger_sink, "set volume: %f", - audioflinger_sink->m_volume); - LOGD ("set volume: %f", audioflinger_sink->m_volume); - /* set device if it's initialized */ - if (audioflinger_sink->audioflinger_device && audioflinger_sink->m_init) - gst_audioflinger_sink_set_volume (audioflinger_sink, - (float) audioflinger_sink->m_volume); - break; - case PROP_AUDIO_SINK: - audioflinger_sink->m_audiosink = g_value_get_pointer (value); - GST_DEBUG_OBJECT (audioflinger_sink, "set audiosink: %p", - audioflinger_sink->m_audiosink); - LOGD ("set audiosink: %p", audioflinger_sink->m_audiosink); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } - GST_OBJECT_UNLOCK (audioflinger_sink); -} - -static GstCaps * -gst_audioflinger_sink_getcaps (GstBaseSink * bsink) -{ - GstAudioFlingerSink *audioflinger_sink; - GstCaps *caps; - - audioflinger_sink = GST_AUDIOFLINGERSINK (bsink); - GST_DEBUG_OBJECT (audioflinger_sink, "enter,%p", - audioflinger_sink->audioflinger_device); - LOGD ("gst_audioflinger_sink_getcaps,%p", - audioflinger_sink->audioflinger_device); - if (audioflinger_sink->audioflinger_device == NULL - || audioflinger_sink->m_init == FALSE) { - caps = - gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SINK_PAD - (bsink))); - } else if (audioflinger_sink->probed_caps) { - caps = gst_caps_copy (audioflinger_sink->probed_caps); - } else { - caps = gst_caps_new_any (); - if (caps && !gst_caps_is_empty (caps)) { - audioflinger_sink->probed_caps = gst_caps_copy (caps); - } - } - - return caps; -} - -static gboolean -gst_audioflinger_sink_open (GstAudioFlingerSink * audioflinger) -{ - GstBaseAudioSink *baseaudiosink = (GstBaseAudioSink *) audioflinger; - - GST_DEBUG_OBJECT (audioflinger, "enter"); - LOGD ("gst_audioflinger_sink_open"); - g_return_val_if_fail (audioflinger != NULL, FALSE); - - baseaudiosink->buffer_time = DEFAULT_BUFFERTIME; - baseaudiosink->latency_time = DEFAULT_LATENCYTIME; - - if (audioflinger->audioflinger_device == NULL) { - if (audioflinger->m_audiosink) { - if (!(audioflinger->audioflinger_device = - audioflinger_device_open (audioflinger->m_audiosink))) - goto failed_creation; - GST_DEBUG_OBJECT (audioflinger, "open an existed flinger, %p", - audioflinger->audioflinger_device); - LOGD ("open an existed flinger, %p", audioflinger->audioflinger_device); - } else { - if (!(audioflinger->audioflinger_device = audioflinger_device_create ())) - goto failed_creation; - GST_DEBUG_OBJECT (audioflinger, "create a new flinger, %p", - audioflinger->audioflinger_device); - LOGD ("create a new flinger, %p", audioflinger->audioflinger_device); - } - } - return TRUE; - - /* ERRORS */ -failed_creation: - { - GST_ELEMENT_ERROR (audioflinger, RESOURCE, SETTINGS, (NULL), - ("Failed to create AudioFlinger")); - LOGE ("Failed to create AudioFlinger"); - return FALSE; - } -} - -static gboolean -gst_audioflinger_sink_close (GstAudioFlingerSink * audioflinger) -{ - GST_DEBUG_OBJECT (audioflinger, "enter"); - LOGD ("gst_audioflinger_sink_close"); - - if (audioflinger->audioflinger_device != NULL) { - GST_DEBUG_OBJECT (audioflinger, "release flinger device"); - LOGD ("release flinger device"); - audioflinger_device_stop (audioflinger->audioflinger_device); - audioflinger_device_release (audioflinger->audioflinger_device); - audioflinger->audioflinger_device = NULL; - } - return TRUE; -} - -static gboolean -gst_audioflinger_sink_prepare (GstAudioFlingerSink * audioflinger, - GstRingBufferSpec * spec) -{ - GST_DEBUG_OBJECT (audioflinger, "enter"); - LOGD ("gst_audioflinger_sink_prepare"); - - /* FIXME: - * - * Pipeline crashes in audioflinger_device_set(), after releasing audio - * flinger device and creating it again. In most cases, it will happen when - * playing the same audio again. - * - * It seems the root cause is we create and release audio flinger sink in - * different thread in playbin2. Till now, I haven't found way to - * create/release device in the same thread. Fortunately, it will not effect - * the gst-launch usage - */ - if (audioflinger_device_set (audioflinger->audioflinger_device, - 3, spec->channels, spec->rate, spec->segsize) == -1) - goto failed_creation; - - audioflinger->m_init = TRUE; -// gst_audioflinger_sink_set_volume (audioflinger, audioflinger->m_volume); -// gst_audioflinger_sink_set_mute (audioflinger, audioflinger->m_mute); - spec->bytes_per_sample = (spec->width / 8) * spec->channels; - audioflinger->bytes_per_sample = spec->bytes_per_sample; - - spec->segsize = - audioflinger_device_frameCount (audioflinger->audioflinger_device); - - GST_DEBUG_OBJECT (audioflinger, - "channels: %d, rate: %d, width: %d, got segsize: %d, segtotal: %d, " - "frame count: %d, frame size: %d", - spec->channels, spec->rate, spec->width, spec->segsize, spec->segtotal, - audioflinger_device_frameCount (audioflinger->audioflinger_device), - audioflinger_device_frameSize (audioflinger->audioflinger_device) - ); - LOGD ("channels: %d, rate: %d, width: %d, got segsize: %d, segtotal: %d, " - "frame count: %d, frame size: %d", - spec->channels, spec->rate, spec->width, spec->segsize, spec->segtotal, - audioflinger_device_frameCount (audioflinger->audioflinger_device), - audioflinger_device_frameSize (audioflinger->audioflinger_device) - ); - -#if 0 - GST_DEBUG_OBJECT (audioflinger, "pause device"); - LOGD ("pause device"); - audioflinger_device_pause (audioflinger->audioflinger_device); -#endif - - return TRUE; - - /* ERRORS */ -failed_creation: - { - GST_ELEMENT_ERROR (audioflinger, RESOURCE, SETTINGS, (NULL), - ("Failed to create AudioFlinger for format %d", spec->format)); - LOGE ("Failed to create AudioFlinger for format %d", spec->format); - return FALSE; - } -dodgy_width: - { - GST_ELEMENT_ERROR (audioflinger, RESOURCE, SETTINGS, (NULL), - ("Unhandled width %d", spec->width)); - LOGE ("Unhandled width %d", spec->width); - return FALSE; - } -} - -static gboolean -gst_audioflinger_sink_unprepare (GstAudioFlingerSink * audioflinger) -{ - GST_DEBUG_OBJECT (audioflinger, "enter"); - LOGD ("gst_audioflinger_sink_unprepare"); - - if (audioflinger->audioflinger_device != NULL) { - GST_DEBUG_OBJECT (audioflinger, "release flinger device"); - LOGD ("release flinger device"); - audioflinger_device_stop (audioflinger->audioflinger_device); - audioflinger->m_init = FALSE; - } - - return TRUE; -} - -static void -gst_audioflinger_sink_set_mute (GstAudioFlingerSink * audioflinger_sink, - gboolean mute) -{ - GST_DEBUG_OBJECT (audioflinger_sink, "set PROP_MUTE = %d\n", mute); - LOGD ("set PROP_MUTE = %d\n", mute); - - if (audioflinger_sink->audioflinger_device) - audioflinger_device_mute (audioflinger_sink->audioflinger_device, mute); - audioflinger_sink->m_mute = mute; -} - -static void -gst_audioflinger_sink_set_volume (GstAudioFlingerSink * audioflinger_sink, - float volume) -{ - GST_DEBUG_OBJECT (audioflinger_sink, "set PROP_VOLUME = %f\n", volume); - LOGD ("set PROP_VOLUME = %f\n", volume); - - if (audioflinger_sink->audioflinger_device != NULL) { - audioflinger_device_set_volume (audioflinger_sink->audioflinger_device, - volume, volume); - } -} - -gboolean -gst_audioflinger_sink_plugin_init (GstPlugin * plugin) -{ - return gst_element_register (plugin, "audioflingersink", GST_RANK_PRIMARY, - GST_TYPE_AUDIOFLINGERSINK); -} - -/* -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, "audioflingersink", - "audioflinger sink audio", plugin_init, VERSION, "LGPL", "GStreamer", - "http://gstreamer.net/") - */ - -static GstClock * -gst_audioflinger_sink_provide_clock (GstElement * elem) -{ - GstBaseAudioSink *sink; - GstAudioFlingerSink *asink; - GstClock *clock; - - sink = GST_BASE_AUDIO_SINK (elem); - asink = GST_AUDIOFLINGERSINK (elem); - - /* we have no ringbuffer (must be NULL state) */ - if (sink->ringbuffer == NULL) - goto wrong_state; - - if (!gst_ring_buffer_is_acquired (sink->ringbuffer)) - goto wrong_state; - - GST_OBJECT_LOCK (sink); - if (!asink->may_provide_clock) - goto already_playing; - - if (!sink->provide_clock) - goto clock_disabled; - - clock = GST_CLOCK_CAST (gst_object_ref (asink->exported_clock)); - GST_INFO_OBJECT (asink, "providing clock %p %s", clock, - clock == NULL ? NULL : GST_OBJECT_NAME (clock)); - GST_OBJECT_UNLOCK (sink); - - return clock; - - /* ERRORS */ -wrong_state: - { - GST_DEBUG_OBJECT (sink, "ringbuffer not acquired"); - LOGD ("ringbuffer not acquired"); - return NULL; - } -already_playing: - { - GST_INFO_OBJECT (sink, "we went to playing already"); - GST_OBJECT_UNLOCK (sink); - return NULL; - } -clock_disabled: - { - GST_DEBUG_OBJECT (sink, "clock provide disabled"); - LOGD ("clock provide disabled"); - GST_OBJECT_UNLOCK (sink); - return NULL; - } -} - -static GstStateChangeReturn -gst_audioflinger_sink_change_state (GstElement * element, - GstStateChange transition) -{ - GstStateChangeReturn ret; - GstClockTime time; - GstAudioFlingerSink *sink = GST_AUDIOFLINGERSINK (element); - - switch (transition) { - case GST_STATE_CHANGE_PAUSED_TO_PLAYING: - sink->may_provide_clock = FALSE; - if (sink->exported_clock == sink->system_audio_clock) { - GstClockTime cinternal, cexternal, crate_num, crate_denom; - - /* take the slave lock to make sure that the slave_callback doesn't run - * while we're moving sink->audio_clock forward, causing - * sink->system_clock to jump as well */ - GST_CLOCK_SLAVE_LOCK (sink->system_clock); - gst_clock_get_calibration (sink->audio_clock, NULL, NULL, - &crate_num, &crate_denom); - cinternal = gst_clock_get_internal_time (sink->audio_clock); - cexternal = gst_clock_get_time (GST_ELEMENT_CLOCK (sink)); - gst_clock_set_calibration (sink->audio_clock, cinternal, cexternal, - crate_num, crate_denom); - /* reset observations */ - sink->system_clock->filling = TRUE; - sink->system_clock->time_index = 0; - GST_CLOCK_SLAVE_UNLOCK (sink->system_clock); - - time = gst_clock_get_time (sink->audio_clock); - GST_INFO_OBJECT (sink, "PAUSED_TO_PLAYING," - " base_time %" GST_TIME_FORMAT - " after %" GST_TIME_FORMAT - " internal %" GST_TIME_FORMAT " external %" GST_TIME_FORMAT, - GST_TIME_ARGS (GST_ELEMENT (sink)->base_time), - GST_TIME_ARGS (time), - GST_TIME_ARGS (cinternal), GST_TIME_ARGS (cexternal)); - } - break; - default: - break; - } - - ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - - switch (transition) { - case GST_STATE_CHANGE_PLAYING_TO_PAUSED: - break; - default: - break; - } - return ret; -} - -static GstFlowReturn -gst_audioflinger_sink_preroll (GstBaseSink * bsink, GstBuffer * buffer) -{ - GstFlowReturn ret; - gboolean us_live = FALSE; - GstQuery *query; - GstAudioFlingerSink *asink = GST_AUDIOFLINGERSINK (bsink); - GstBaseAudioSink *baseaudiosink = GST_BASE_AUDIO_SINK (bsink); - GstClock *clock; - - GST_INFO_OBJECT (bsink, "preroll"); - - ret = GST_BASE_SINK_CLASS (parent_class)->preroll (bsink, buffer); - if (ret != GST_FLOW_OK) - goto done; - - if (asink->exported_clock != NULL) { - GST_INFO_OBJECT (bsink, "clock already exported"); - goto done; - } - - query = gst_query_new_latency (); - - /* ask the peer for the latency */ - if (gst_pad_peer_query (bsink->sinkpad, query)) { - /* get upstream min and max latency */ - gst_query_parse_latency (query, &us_live, NULL, NULL); - GST_INFO_OBJECT (bsink, "query result live: %d", us_live); - } else { - GST_WARNING_OBJECT (bsink, "latency query failed"); - } - gst_query_unref (query); - - if (!us_live && asink->export_system_audio_clock) { - clock = asink->system_audio_clock; - /* set SLAVE_NONE so that baseaudiosink doesn't try to slave audio_clock to - * system_audio_clock - */ - g_object_set (asink, "slave-method", GST_BASE_AUDIO_SINK_SLAVE_NONE, NULL); - } else { - clock = asink->audio_clock; - } - - GST_INFO_OBJECT (bsink, "using %s clock", - clock == asink->audio_clock ? "audio" : "system_audio"); - gst_object_replace ((GstObject **) & asink->exported_clock, - GST_OBJECT (clock)); - GST_OBJECT_UNLOCK (asink); - -done: - return ret; -} - -static gboolean -gst_audioflinger_sink_event (GstBaseSink * bsink, GstEvent * event) -{ - GstAudioFlingerSink *asink = GST_AUDIOFLINGERSINK (bsink); - GstBaseAudioSink *baseaudiosink = GST_BASE_AUDIO_SINK (bsink); - GstRingBuffer *ringbuf = baseaudiosink->ringbuffer; - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_EOS: - GST_INFO_OBJECT (asink, "got EOS"); - asink->eos = TRUE; - - if (baseaudiosink->next_sample) { - guint64 next_sample, sample; - gint sps; - GstFlowReturn ret; - GstBuffer *buf; - - sps = ringbuf->spec.segsize / ringbuf->spec.bytes_per_sample; - sample = baseaudiosink->next_sample; - next_sample = baseaudiosink->next_sample / sps; - if (next_sample < ringbuf->spec.segsize) { - gint samples, out_samples, accum, size; - GstClockTime timestamp, before, after; - guchar *data, *data_start; - gint64 drift_tolerance; - guint written; - gint64 offset; - - samples = (ringbuf->spec.segsize - next_sample) * 4; - - size = samples * ringbuf->spec.bytes_per_sample; - - timestamp = gst_util_uint64_scale_int (baseaudiosink->next_sample, - GST_SECOND, ringbuf->spec.rate); - - before = gst_clock_get_internal_time (asink->audio_clock); - GST_INFO_OBJECT (asink, "%" G_GINT64_FORMAT " < %d, " - "padding with silence, samples %d size %d ts %" GST_TIME_FORMAT, - next_sample, ringbuf->spec.segsize, samples, size, - GST_TIME_ARGS (timestamp)); - LOGD ("PADDING"); - - data_start = data = g_malloc0 (size); - offset = baseaudiosink->next_sample; - out_samples = samples; - - GST_STATE_LOCK (bsink); - do { - written = - gst_ring_buffer_commit_full (ringbuf, &offset, data, samples, - out_samples, &accum); - - GST_DEBUG_OBJECT (bsink, "wrote %u of %u", written, samples); - /* if we wrote all, we're done */ - if (written == samples) - break; - - /* else something interrupted us and we wait for preroll. */ - if ((ret = gst_base_sink_wait_preroll (bsink)) != GST_FLOW_OK) - break; - - /* update the output samples. FIXME, this will just skip them when pausing - * during trick mode */ - if (out_samples > written) { - out_samples -= written; - accum = 0; - } else - break; - - samples -= written; - data += written * ringbuf->spec.bytes_per_sample; - } while (TRUE); - - - GST_STATE_UNLOCK (bsink); - - g_free (data_start); - after = gst_clock_get_internal_time (asink->audio_clock); - - GST_INFO_OBJECT (asink, "padded, left %d before %" GST_TIME_FORMAT - " after %" GST_TIME_FORMAT, samples, - GST_TIME_ARGS (before), GST_TIME_ARGS (after)); - - - } else { - LOGD ("NOT PADDING 1"); - } - } else { - LOGD ("NOT PADDING 2"); - } - - break; - case GST_EVENT_BUFFERING_START: - GST_INFO_OBJECT (asink, "buffering start"); - break; - case GST_EVENT_BUFFERING_STOP: - { - gboolean slaved; - GstClockTime cinternal, cexternal, crate_num, crate_denom; - GstClockTime before, after; - - gst_clock_get_calibration (asink->audio_clock, &cinternal, &cexternal, - &crate_num, &crate_denom); - - before = gst_clock_get_time (asink->audio_clock); - - cinternal = gst_clock_get_internal_time (asink->audio_clock); - cexternal = gst_clock_get_time (GST_ELEMENT_CLOCK (asink)); - gst_clock_set_calibration (asink->audio_clock, cinternal, - cexternal, crate_num, crate_denom); - - after = gst_clock_get_time (asink->audio_clock); - - GST_INFO_OBJECT (asink, "buffering stopped, clock recalibrated" - " before %" GST_TIME_FORMAT " after %" GST_TIME_FORMAT, - GST_TIME_ARGS (before), GST_TIME_ARGS (after)); - - /* force baseaudiosink to resync from the next buffer */ - GST_BASE_AUDIO_SINK (asink)->next_sample = -1; - - /* reset this so we allow some time before enabling slaving again */ - asink->last_resync_sample = -1; - slaved = GST_ELEMENT_CLOCK (asink) != asink->exported_clock; - if (slaved) { - GST_INFO_OBJECT (asink, "disabling slaving"); - g_object_set (asink, "slave-method", GST_BASE_AUDIO_SINK_SLAVE_NONE, - NULL); - asink->slaving_disabled = TRUE; - } - - g_object_set (asink, "drift-tolerance", 200 * GST_MSECOND, NULL); - break; - } - default: - break; - } - - return GST_BASE_SINK_CLASS (parent_class)->event (bsink, event); -} - -static GstClockTime -gst_audioflinger_sink_get_time (GstClock * clock, gpointer user_data) -{ - GstBaseAudioSink *sink = GST_BASE_AUDIO_SINK (user_data); - uint32_t position = -1; - GstAudioFlingerSink *asink = GST_AUDIOFLINGERSINK (sink); - GstClockTime time = GST_CLOCK_TIME_NONE; - GstClockTime ptime = GST_CLOCK_TIME_NONE; - GstClockTime system_audio_clock_time = GST_CLOCK_TIME_NONE; - GstClockTime offset = GST_CLOCK_TIME_NONE; - GstClockTime adjusted_time = GST_CLOCK_TIME_NONE; - GstClockTime cinternal, cexternal, crate_num, crate_denom; - - gst_clock_get_calibration (clock, &cinternal, &cexternal, - &crate_num, &crate_denom); - - if (!asink->audioflinger_device || !asink->m_init) { - GST_DEBUG_OBJECT (sink, "device not created yet"); - - goto out; - } - - if (!asink->audioflinger_device || !asink->m_init) { - GST_DEBUG_OBJECT (sink, "device not created yet"); - - goto out; - } - - if (!sink->ringbuffer) { - GST_DEBUG_OBJECT (sink, "NULL ringbuffer"); - - goto out; - } - - if (!sink->ringbuffer->acquired) { - GST_DEBUG_OBJECT (sink, "ringbuffer not acquired"); - - goto out; - } - - position = audioflinger_device_get_position (asink->audioflinger_device); - if (position == -1) - goto out; - - time = gst_util_uint64_scale_int (position, GST_SECOND, - sink->ringbuffer->spec.rate); - - offset = gst_audio_clock_adjust (GST_CLOCK (clock), 0); - adjusted_time = gst_audio_clock_adjust (GST_CLOCK (clock), time); - - if (asink->system_audio_clock) - system_audio_clock_time = gst_clock_get_time (asink->system_audio_clock); - - if (GST_ELEMENT_CLOCK (asink) - && asink->audio_clock != GST_ELEMENT_CLOCK (asink)) - ptime = gst_clock_get_time (GST_ELEMENT_CLOCK (asink)); - -out: - GST_DEBUG_OBJECT (sink, - "clock %s processed samples %" G_GINT32_FORMAT " offset %" GST_TIME_FORMAT - " time %" GST_TIME_FORMAT " pipeline time %" GST_TIME_FORMAT - " system audio clock %" GST_TIME_FORMAT " adjusted_time %" GST_TIME_FORMAT - " cinternal %" GST_TIME_FORMAT " cexternal %" GST_TIME_FORMAT, - GST_OBJECT_NAME (clock), position, GST_TIME_ARGS (offset), - GST_TIME_ARGS (time), GST_TIME_ARGS (ptime), - GST_TIME_ARGS (system_audio_clock_time), GST_TIME_ARGS (adjusted_time), - GST_TIME_ARGS (cinternal), GST_TIME_ARGS (cexternal)); - - return time; -} - -static GstClockTime -gst_audioflinger_sink_system_audio_clock_get_time (GstClock * clock, - gpointer user_data) -{ - GstClockTime time, offset; - GstAudioFlingerSink *sink = GST_AUDIOFLINGERSINK (user_data); - - time = gst_clock_get_time (sink->system_clock); - offset = gst_audio_clock_adjust (clock, (GstClockTime) 0); - time -= offset; - - return time; -} diff --git a/sys/audioflingersink/gstaudioflingersink.h b/sys/audioflingersink/gstaudioflingersink.h deleted file mode 100644 index 02e6a928ed..0000000000 --- a/sys/audioflingersink/gstaudioflingersink.h +++ /dev/null @@ -1,70 +0,0 @@ -/* GStreamer - * Copyright (C) <2009> Prajnashi S - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __GST_AUDIOFLINGERSINK_H__ -#define __GST_AUDIOFLINGERSINK_H__ - - -#include -#include "gstaudiosink.h" -#include "audioflinger_wrapper.h" - - -G_BEGIN_DECLS - -#define GST_TYPE_AUDIOFLINGERSINK (gst_audioflinger_sink_get_type()) -#define GST_AUDIOFLINGERSINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIOFLINGERSINK,GstAudioFlingerSink)) -#define GST_AUDIOFLINGERSINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIOFLINGERSINK,GstAudioFlingerSinkClass)) -#define GST_IS_AUDIOFLINGERSINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIOFLINGERSINK)) -#define GST_IS_AUDIOFLINGERSINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOFLINGERSINK)) - -typedef struct _GstAudioFlingerSink GstAudioFlingerSink; -typedef struct _GstAudioFlingerSinkClass GstAudioFlingerSinkClass; - -struct _GstAudioFlingerSink { - GstAudioSink sink; - - AudioFlingerDeviceHandle audioflinger_device; - gboolean m_init; - gint bytes_per_sample; - gdouble m_volume; - gboolean m_mute; - gpointer m_audiosink; - GstCaps *probed_caps; - gboolean eos; - GstClock *audio_clock; - GstClock *system_clock; - GstClock *system_audio_clock; - GstClock *exported_clock; - gboolean export_system_audio_clock; - gboolean may_provide_clock; - gboolean slaving_disabled; - guint64 last_resync_sample; -}; - -struct _GstAudioFlingerSinkClass { - GstAudioSinkClass parent_class; -}; - -GType gst_audioflinger_sink_get_type(void); - - gboolean gst_audioflinger_sink_plugin_init (GstPlugin * plugin); - -G_END_DECLS - -#endif /* __GST_AUDIOFLINGERSINK_H__ */ diff --git a/sys/avc/Makefile.am b/sys/avc/Makefile.am new file mode 100644 index 0000000000..9bde7510b7 --- /dev/null +++ b/sys/avc/Makefile.am @@ -0,0 +1,25 @@ + +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_MAJORMINOR) \ + -lgstinterfaces-$(GST_MAJORMINOR) \ + $(GST_BASE_LIBS) \ + $(GST_LIBS) + +libgstavc_la_LIBTOOLFLAGS = --tag=disable-static + +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 new file mode 100644 index 0000000000..0763210809 --- /dev/null +++ b/sys/avc/gstavcplugin.cpp @@ -0,0 +1,41 @@ +/* GStreamer + * Copyright (C) 2011 David Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received 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 +#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 new file mode 100644 index 0000000000..c63c9853ad --- /dev/null +++ b/sys/avc/gstavcsrc.cpp @@ -0,0 +1,424 @@ +/* GStreamer + * Copyright (C) 2011 David Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received 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. + * + * + * Example launch line + * |[ + * gst-launch -v avcsrc ! decodebin ! osxvideosink + * ]| + * + * This pipeline captures from an AVC source, decodes the stream (either + * DV or HDV), and displays the video. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +using namespace AVS; + +#include +#include +#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_pad_template (element_class, + gst_static_pad_template_get (&gst_avc_src_src_template)); + + gst_element_class_set_details_simple (element_class, + "AVC Video Services Source", "Video/Source", + "Captures DV or HDV video from Firewire port", + "David Schleef "); +} + +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_WRONG_STATE; + } + + 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 new file mode 100644 index 0000000000..e0fcf437ef --- /dev/null +++ b/sys/avc/gstavcsrc.h @@ -0,0 +1,67 @@ +/* GStreamer + * Copyright (C) 2011 FIXME + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _GST_AVC_SRC_H_ +#define _GST_AVC_SRC_H_ + +#include +#include +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/d3dvideosink/Makefile.am b/sys/d3dvideosink/Makefile.am new file mode 100644 index 0000000000..6e0ecf316c --- /dev/null +++ b/sys/d3dvideosink/Makefile.am @@ -0,0 +1,16 @@ +plugin_LTLIBRARIES = libgstd3dvideosink.la + +libgstd3dvideosink_la_SOURCES = d3dvideosink.c directx/d3d.c directx/dx.c \ + directx/directx9/dx9.c directx/directx9/dx9_d3d.c \ + directx/directx10/dx10.c directx/directx10/dx10_d3d.c \ + directx/directx11/dx11.c directx/directx11/dx11_d3d.c +libgstd3dvideosink_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_CFLAGS) +libgstd3dvideosink_la_LIBADD = $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) \ + -lgstvideo-$(GST_MAJORMINOR) -lgstinterfaces-$(GST_MAJORMINOR) +libgstd3dvideosink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -lgdi32 +libgstd3dvideosink_la_LIBTOOLFLAGS = --tag=disable-static + +noinst_HEADERS = d3dvideosink.h directx/d3d.h directx/dx.h directx/directx.h \ + directx/directx9/dx9.h directx/directx9/dx9_d3d.h \ + directx/directx10/dx10.h directx/directx10/dx10_d3d.h \ + directx/directx11/dx11.h directx/directx11/dx11_d3d.h diff --git a/sys/d3dvideosink/d3dvideosink.c b/sys/d3dvideosink/d3dvideosink.c new file mode 100644 index 0000000000..9ca6b960e2 --- /dev/null +++ b/sys/d3dvideosink/d3dvideosink.c @@ -0,0 +1,2624 @@ +/* GStreamer + * Copyright (C) 2010-2011 David Hoyt + * Copyright (C) 2010 Andoni Morales + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "d3dvideosink.h" + +#define IPC_SET_WINDOW 1 +#define IDT_DEVICELOST 1 + +/* Provide access to data that will be shared among all instantiations of this element */ +#define GST_D3DVIDEOSINK_SHARED_D3D_LOCK g_static_mutex_lock (&shared_d3d_lock); +#define GST_D3DVIDEOSINK_SHARED_D3D_UNLOCK g_static_mutex_unlock (&shared_d3d_lock); +#define GST_D3DVIDEOSINK_SHARED_D3D_DEV_LOCK g_static_mutex_lock (&shared_d3d_dev_lock); +#define GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK g_static_mutex_unlock (&shared_d3d_dev_lock); +#define GST_D3DVIDEOSINK_SHARED_D3D_HOOK_LOCK g_static_mutex_lock (&shared_d3d_hook_lock); +#define GST_D3DVIDEOSINK_SHARED_D3D_HOOK_UNLOCK g_static_mutex_unlock (&shared_d3d_hook_lock); +typedef struct _GstD3DVideoSinkShared GstD3DVideoSinkShared; +struct _GstD3DVideoSinkShared +{ + LPDIRECT3D9 d3d; + LPDIRECT3DDEVICE9 d3ddev; + D3DCAPS9 d3dcaps; + D3DFORMAT d3ddmformat; + D3DFORMAT d3dformat; + D3DFORMAT d3dfourcc; + D3DFORMAT d3dstencilformat; + D3DTEXTUREFILTERTYPE d3dfiltertype; + gboolean d3dEnableAutoDepthStencil; + + GList *element_list; + gint32 element_count; + + gboolean device_lost; + UINT_PTR device_lost_timer; + + HWND hidden_window_handle; + HANDLE hidden_window_created_signal; + GThread *hidden_window_thread; + + GHashTable *hook_tbl; +}; +typedef struct _GstD3DVideoSinkHookData GstD3DVideoSinkHookData; +struct _GstD3DVideoSinkHookData +{ + HHOOK hook; + HWND window_handle; + DWORD thread_id; + DWORD process_id; +}; +/* Holds our shared information */ +static GstD3DVideoSinkShared shared; +/* Define a shared lock to synchronize the creation/destruction of the d3d device */ +static GStaticMutex shared_d3d_lock = G_STATIC_MUTEX_INIT; +static GStaticMutex shared_d3d_dev_lock = G_STATIC_MUTEX_INIT; +static GStaticMutex shared_d3d_hook_lock = G_STATIC_MUTEX_INIT; +/* Hold a reference to our dll's HINSTANCE */ +static HINSTANCE g_hinstDll = NULL; + +typedef struct _IPCData IPCData; +struct _IPCData +{ + HWND hwnd; + LONG_PTR wnd_proc; +}; +/* Holds data that may be used to communicate across processes */ +/*static IPCData ipc_data;*/ +/*static COPYDATASTRUCT ipc_cds;*/ + +GST_DEBUG_CATEGORY (d3dvideosink_debug); +#define GST_CAT_DEFAULT d3dvideosink_debug + +/* TODO: Support RGB! */ +static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ YUY2, UYVY, YV12, I420 }")) + //";" GST_VIDEO_CAPS_RGBx) + ); + +static void gst_d3dvideosink_init_interfaces (GType type); + +GST_BOILERPLATE_FULL (GstD3DVideoSink, gst_d3dvideosink, GstVideoSink, + GST_TYPE_VIDEO_SINK, gst_d3dvideosink_init_interfaces); + +enum +{ + PROP_0, PROP_KEEP_ASPECT_RATIO, PROP_PIXEL_ASPECT_RATIO, + PROP_ENABLE_NAVIGATION_EVENTS, PROP_LAST +}; + +/* GObject methods */ +static void gst_d3dvideosink_finalize (GObject * gobject); +static void gst_d3dvideosink_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec); +static void gst_d3dvideosink_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec); + +/* GstElement methods */ +static GstStateChangeReturn gst_d3dvideosink_change_state (GstElement * element, + GstStateChange transition); + +/* GstBaseSink methods */ +static gboolean gst_d3dvideosink_start (GstBaseSink * bsink); +static gboolean gst_d3dvideosink_stop (GstBaseSink * bsink); +static gboolean gst_d3dvideosink_set_caps (GstBaseSink * bsink, GstCaps * caps); +static GstCaps *gst_d3dvideosink_get_caps (GstBaseSink * bsink); +static GstFlowReturn gst_d3dvideosink_show_frame (GstVideoSink * sink, + GstBuffer * buffer); + +/* GstXOverlay methods */ +static void gst_d3dvideosink_set_window_handle (GstXOverlay * overlay, + guintptr window_id); +static void gst_d3dvideosink_expose (GstXOverlay * overlay); + +/* GstNavigation methods */ +static void gst_d3dvideosink_navigation_send_event (GstNavigation * navigation, + GstStructure * structure); + +/* WndProc methods */ +LRESULT APIENTRY WndProc (HWND hWnd, UINT message, WPARAM wParam, + LPARAM lParam); +LRESULT APIENTRY SharedHiddenWndProc (HWND hWnd, UINT message, WPARAM wParam, + LPARAM lParam); +static void gst_d3dvideosink_wnd_proc (GstD3DVideoSink * sink, HWND hWnd, + UINT message, WPARAM wParam, LPARAM lParam); + +/* HookProc methods */ +LRESULT APIENTRY WndProcHook (HWND hWnd, UINT message, WPARAM wParam, + LPARAM lParam); +LRESULT CALLBACK gst_d3dvideosink_hook_proc (int nCode, WPARAM wParam, + LPARAM lParam); + +/* Paint/update methods */ +static void gst_d3dvideosink_update (GstBaseSink * bsink); +static gboolean gst_d3dvideosink_refresh (GstD3DVideoSink * sink); +static gboolean gst_d3dvideosink_update_all (GstD3DVideoSink * sink); +static gboolean gst_d3dvideosink_refresh_all (GstD3DVideoSink * sink); +static void gst_d3dvideosink_stretch (GstD3DVideoSink * sink, + LPDIRECT3DSURFACE9 backBuffer); + +/* Misc methods */ +BOOL WINAPI DllMain (HINSTANCE hinstDll, DWORD fdwReason, PVOID fImpLoad); +static void gst_d3dvideosink_remove_window_for_renderer (GstD3DVideoSink * + sink); +static gboolean gst_d3dvideosink_initialize_direct3d (GstD3DVideoSink * sink); +static gboolean gst_d3dvideosink_initialize_d3d_device (GstD3DVideoSink * sink); +static gboolean gst_d3dvideosink_initialize_swap_chain (GstD3DVideoSink * sink); +static gboolean gst_d3dvideosink_resize_swap_chain (GstD3DVideoSink * sink, + gint width, gint height); +static gboolean gst_d3dvideosink_notify_device_lost (GstD3DVideoSink * sink); +static gboolean gst_d3dvideosink_notify_device_reset (GstD3DVideoSink * sink); +static gboolean gst_d3dvideosink_device_lost (GstD3DVideoSink * sink); +static gboolean gst_d3dvideosink_release_swap_chain (GstD3DVideoSink * sink); +static gboolean gst_d3dvideosink_release_d3d_device (GstD3DVideoSink * sink); +static gboolean gst_d3dvideosink_release_direct3d (GstD3DVideoSink * sink); +static gboolean gst_d3dvideosink_window_size (GstD3DVideoSink * sink, + gint * width, gint * height); +static gboolean gst_d3dvideosink_direct3d_supported (GstD3DVideoSink * sink); +static gboolean gst_d3dvideosink_shared_hidden_window_thread (GstD3DVideoSink * + sink); +static void gst_d3dvideosink_hook_window_for_renderer (GstD3DVideoSink * sink); +static void gst_d3dvideosink_unhook_window_for_renderer (GstD3DVideoSink * + sink); +static void gst_d3dvideosink_unhook_all_windows (void); +static void gst_d3dvideosink_log_debug (const gchar * file, + const gchar * function, gint line, const gchar * format, va_list args); +static void gst_d3dvideosink_log_warning (const gchar * file, + const gchar * function, gint line, const gchar * format, va_list args); +static void gst_d3dvideosink_log_error (const gchar * file, + const gchar * function, gint line, const gchar * format, va_list args); + +static DirectXInitParams directx_init_params = { + gst_d3dvideosink_log_debug, gst_d3dvideosink_log_warning, + gst_d3dvideosink_log_error +}; + +/* TODO: event, preroll, buffer_alloc? + * buffer_alloc won't generally be all that useful because the renderers require a + * different stride to GStreamer's implicit values. + */ + +BOOL WINAPI +DllMain (HINSTANCE hinstDll, DWORD fdwReason, PVOID fImpLoad) +{ + switch (fdwReason) { + case DLL_PROCESS_ATTACH: + g_hinstDll = hinstDll; + break; + case DLL_THREAD_ATTACH: + break; + case DLL_THREAD_DETACH: + break; + case DLL_PROCESS_DETACH: + gst_d3dvideosink_unhook_all_windows (); + break; + } + return TRUE; +} + +static gboolean +gst_d3dvideosink_interface_supported (GstImplementsInterface * iface, + GType type) +{ + return (type == GST_TYPE_X_OVERLAY || type == GST_TYPE_NAVIGATION); +} + +static void +gst_d3dvideosink_interface_init (GstImplementsInterfaceClass * klass) +{ + klass->supported = gst_d3dvideosink_interface_supported; +} + +static void +gst_d3dvideosink_xoverlay_interface_init (GstXOverlayClass * iface) +{ + iface->set_window_handle = gst_d3dvideosink_set_window_handle; + iface->expose = gst_d3dvideosink_expose; +} + +static void +gst_d3dvideosink_navigation_interface_init (GstNavigationInterface * iface) +{ + iface->send_event = gst_d3dvideosink_navigation_send_event; +} + +static void +gst_d3dvideosink_init_interfaces (GType type) +{ + static const GInterfaceInfo iface_info = { + (GInterfaceInitFunc) gst_d3dvideosink_interface_init, + NULL, + NULL + }; + + static const GInterfaceInfo xoverlay_info = { + (GInterfaceInitFunc) gst_d3dvideosink_xoverlay_interface_init, + NULL, + NULL + }; + + static const GInterfaceInfo navigation_info = { + (GInterfaceInitFunc) gst_d3dvideosink_navigation_interface_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_DEBUG_CATEGORY_INIT (d3dvideosink_debug, "d3dvideosink", 0, + "Direct3D video sink"); +} + +static void +gst_d3dvideosink_base_init (gpointer klass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_template)); + + gst_element_class_set_details_simple (element_class, "Direct3D video sink", + "Sink/Video", + "Display data using a Direct3D video renderer", + "David Hoyt "); +} + +static void +gst_d3dvideosink_class_init (GstD3DVideoSinkClass * klass) +{ + GObjectClass *gobject_class; + GstElementClass *gstelement_class; + GstBaseSinkClass *gstbasesink_class; + GstVideoSinkClass *gstvideosink_class; + + gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; + gstbasesink_class = (GstBaseSinkClass *) klass; + gstvideosink_class = (GstVideoSinkClass *) klass; + + gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_d3dvideosink_finalize); + gobject_class->set_property = + GST_DEBUG_FUNCPTR (gst_d3dvideosink_set_property); + gobject_class->get_property = + GST_DEBUG_FUNCPTR (gst_d3dvideosink_get_property); + + gstelement_class->change_state = + GST_DEBUG_FUNCPTR (gst_d3dvideosink_change_state); + + gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_d3dvideosink_get_caps); + gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_d3dvideosink_set_caps); + gstbasesink_class->start = GST_DEBUG_FUNCPTR (gst_d3dvideosink_start); + gstbasesink_class->stop = GST_DEBUG_FUNCPTR (gst_d3dvideosink_stop); + /*gstbasesink_class->unlock = GST_DEBUG_FUNCPTR (gst_d3dvideosink_unlock); */ + /*gstbasesink_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_d3dvideosink_unlock_stop); */ + + gstvideosink_class->show_frame = + GST_DEBUG_FUNCPTR (gst_d3dvideosink_show_frame); + + /* Add properties */ + g_object_class_install_property (G_OBJECT_CLASS (klass), + PROP_KEEP_ASPECT_RATIO, g_param_spec_boolean ("force-aspect-ratio", + "Force aspect ratio", + "When enabled, scaling will respect original aspect ratio", FALSE, + (GParamFlags) G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), + PROP_PIXEL_ASPECT_RATIO, g_param_spec_string ("pixel-aspect-ratio", + "Pixel Aspect Ratio", + "The pixel aspect ratio of the device", "1/1", + (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); + g_object_class_install_property (G_OBJECT_CLASS (klass), + PROP_ENABLE_NAVIGATION_EVENTS, + g_param_spec_boolean ("enable-navigation-events", + "Enable navigation events", + "When enabled, navigation events are sent upstream", TRUE, + (GParamFlags) G_PARAM_READWRITE)); + + /* Initialize DirectX abstraction */ + GST_DEBUG ("Initializing DirectX abstraction layer"); + directx_initialize (&directx_init_params); + + /* Initialize DirectX API */ + if (!directx_initialize_best_available_api ()) + GST_DEBUG ("Unable to initialize DirectX"); + + /* Determine DirectX version */ + klass->directx_api = directx_get_best_available_api (); + klass->directx_version = + (klass->directx_api != + NULL ? klass->directx_api->version : DIRECTX_VERSION_UNKNOWN); + klass->is_directx_supported = directx_is_supported (); +} + +static void +gst_d3dvideosink_clear (GstD3DVideoSink * sink) +{ + sink->enable_navigation_events = TRUE; + sink->keep_aspect_ratio = FALSE; + + sink->window_closed = FALSE; + sink->window_handle = NULL; + sink->is_new_window = FALSE; + sink->is_hooked = FALSE; +} + +static void +gst_d3dvideosink_init (GstD3DVideoSink * sink, GstD3DVideoSinkClass * klass) +{ + gst_d3dvideosink_clear (sink); + + sink->d3d_swap_chain_lock = g_mutex_new (); + + sink->par = g_new0 (GValue, 1); + g_value_init (sink->par, GST_TYPE_FRACTION); + gst_value_set_fraction (sink->par, 1, 1); + + /* TODO: Copied from GstVideoSink; should we use that as base class? */ + /* 20ms is more than enough, 80-130ms is noticable */ + gst_base_sink_set_max_lateness (GST_BASE_SINK (sink), 20 * GST_MSECOND); + gst_base_sink_set_qos_enabled (GST_BASE_SINK (sink), TRUE); +} + +static void +gst_d3dvideosink_finalize (GObject * gobject) +{ + GstD3DVideoSink *sink = GST_D3DVIDEOSINK (gobject); + + if (sink->par) { + g_free (sink->par); + sink->par = NULL; + } + + g_mutex_free (sink->d3d_swap_chain_lock); + sink->d3d_swap_chain_lock = NULL; + + G_OBJECT_CLASS (parent_class)->finalize (gobject); +} + +static void +gst_d3dvideosink_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) +{ + GstD3DVideoSink *sink = GST_D3DVIDEOSINK (object); + + switch (prop_id) { + case PROP_ENABLE_NAVIGATION_EVENTS: + sink->enable_navigation_events = g_value_get_boolean (value); + break; + case PROP_KEEP_ASPECT_RATIO: + sink->keep_aspect_ratio = g_value_get_boolean (value); + break; + case PROP_PIXEL_ASPECT_RATIO: + g_free (sink->par); + sink->par = g_new0 (GValue, 1); + g_value_init (sink->par, GST_TYPE_FRACTION); + if (!g_value_transform (value, sink->par)) { + g_warning ("Could not transform string to aspect ratio"); + gst_value_set_fraction (sink->par, 1, 1); + } + GST_DEBUG_OBJECT (sink, "set PAR to %d/%d", + gst_value_get_fraction_numerator (sink->par), + gst_value_get_fraction_denominator (sink->par)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gst_d3dvideosink_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec) +{ + GstD3DVideoSink *sink = GST_D3DVIDEOSINK (object); + + switch (prop_id) { + case PROP_ENABLE_NAVIGATION_EVENTS: + g_value_set_boolean (value, sink->enable_navigation_events); + break; + case PROP_KEEP_ASPECT_RATIO: + g_value_set_boolean (value, sink->keep_aspect_ratio); + break; + case PROP_PIXEL_ASPECT_RATIO: + g_value_transform (sink->par, value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static GstCaps * +gst_d3dvideosink_get_caps (GstBaseSink * basesink) +{ + GstD3DVideoSink *sink = GST_D3DVIDEOSINK (basesink); + + return + gst_caps_copy (gst_pad_get_pad_template_caps (GST_VIDEO_SINK_PAD (sink))); +} + +static void +gst_d3dvideosink_close_window (GstD3DVideoSink * sink) +{ + if (!sink || !sink->window_handle) + return; + + if (!sink->is_new_window) { + gst_d3dvideosink_remove_window_for_renderer (sink); + return; + } + + SendMessage (sink->window_handle, WM_CLOSE, (WPARAM) NULL, (WPARAM) NULL); + g_thread_join (sink->window_thread); + sink->is_new_window = FALSE; +} + +static gboolean +gst_d3dvideosink_create_shared_hidden_window (GstD3DVideoSink * sink) +{ + GST_DEBUG ("Creating Direct3D hidden window"); + + shared.hidden_window_created_signal = CreateSemaphore (NULL, 0, 1, NULL); + if (shared.hidden_window_created_signal == NULL) + goto failed; + + shared.hidden_window_thread = g_thread_create ((GThreadFunc) + gst_d3dvideosink_shared_hidden_window_thread, sink, TRUE, NULL); + + /* wait maximum 60 seconds for window to be created */ + if (WaitForSingleObject (shared.hidden_window_created_signal, + 60000) != WAIT_OBJECT_0) + goto failed; + + CloseHandle (shared.hidden_window_created_signal); + + GST_DEBUG ("Successfully created Direct3D hidden window, handle: %p", + shared.hidden_window_handle); + + return (shared.hidden_window_handle != NULL); + +failed: + CloseHandle (shared.hidden_window_created_signal); + GST_ELEMENT_ERROR (sink, RESOURCE, WRITE, + ("Error creating Direct3D hidden window"), (NULL)); + return FALSE; +} + +static gboolean +gst_d3dvideosink_shared_hidden_window_created (GstD3DVideoSink * sink) +{ + /* Should only be called from the shared window thread. */ + ReleaseSemaphore (shared.hidden_window_created_signal, 1, NULL); + return TRUE; +} + +static gboolean +gst_d3dvideosink_shared_hidden_window_thread (GstD3DVideoSink * sink) +{ + WNDCLASS WndClass; + HWND hWnd; + MSG msg; + + memset (&WndClass, 0, sizeof (WNDCLASS)); + WndClass.hInstance = GetModuleHandle (NULL); + WndClass.lpszClassName = TEXT ("GST-Shared-Hidden-D3DSink"); + WndClass.lpfnWndProc = SharedHiddenWndProc; + if (!RegisterClass (&WndClass)) { + GST_ERROR ("Unable to register Direct3D hidden window class"); + return FALSE; + } + + hWnd = CreateWindowEx (0, WndClass.lpszClassName, + TEXT ("GStreamer Direct3D hidden window"), + WS_POPUP, 0, 0, 1, 1, HWND_MESSAGE, NULL, WndClass.hInstance, sink); + + if (hWnd == NULL) { + GST_ERROR_OBJECT (sink, "Failed to create Direct3D hidden window"); + goto error; + } + + GST_DEBUG ("Direct3D hidden window handle: %p", hWnd); + + shared.hidden_window_handle = hWnd; + shared.device_lost_timer = 0; + + GST_DEBUG ("Initializing Direct3D"); + SendMessage (shared.hidden_window_handle, WM_DIRECTX_D3D_INIT_DEVICE, 0, 0); + GST_DEBUG ("Direct3D initialization complete"); + + gst_d3dvideosink_shared_hidden_window_created (sink); + + GST_DEBUG ("Entering Direct3D hidden window message loop"); + + /* start message loop processing */ + while (TRUE) { + while (GetMessage (&msg, NULL, 0, 0)) { + TranslateMessage (&msg); + DispatchMessage (&msg); + } + + if (msg.message == WM_QUIT || msg.message == WM_CLOSE) + break; + } + + GST_DEBUG ("Leaving Direct3D hidden window message loop"); + +/*success:*/ + /* Kill the device lost timer if it's running */ + if (shared.device_lost_timer != 0) + KillTimer (hWnd, shared.device_lost_timer); + UnregisterClass (WndClass.lpszClassName, WndClass.hInstance); + + shared.device_lost_timer = 0; + return TRUE; + +error: + /* Kill the device lost timer if it's running */ + if (shared.device_lost_timer != 0) + KillTimer (hWnd, shared.device_lost_timer); + if (hWnd) + DestroyWindow (hWnd); + UnregisterClass (WndClass.lpszClassName, WndClass.hInstance); + + shared.hidden_window_handle = NULL; + shared.device_lost_timer = 0; + + ReleaseSemaphore (shared.hidden_window_created_signal, 1, NULL); + return FALSE; +} + +LRESULT APIENTRY +SharedHiddenWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + GstD3DVideoSink *sink; + + if (message == WM_CREATE) { + /* lParam holds a pointer to a CREATESTRUCT instance which in turn holds the parameter used when creating the window. */ + sink = (GstD3DVideoSink *) ((LPCREATESTRUCT) lParam)->lpCreateParams; + + /* In our case, this is a pointer to the sink. So we immediately attach it for use in subsequent calls. */ + SetWindowLongPtr (hWnd, GWLP_USERDATA, (LONG_PTR) sink); + } + + sink = (GstD3DVideoSink *) GetWindowLongPtr (hWnd, GWLP_USERDATA); + + switch (message) { + case WM_DIRECTX_D3D_INIT_DEVICE: + { + gst_d3dvideosink_initialize_d3d_device (sink); + break; + } + case WM_DIRECTX_D3D_INIT_DEVICELOST: + { + if (!shared.device_lost) { + //GST_D3DVIDEOSINK_SHARED_D3D_DEV_LOCK + //GST_D3DVIDEOSINK_SHARED_D3D_LOCK + + shared.device_lost = TRUE; + + /* Handle device lost by creating a timer and posting WM_D3D_DEVICELOST twice a second */ + /* Create a timer to periodically check the d3d device and attempt to recreate it */ + shared.device_lost_timer = SetTimer (hWnd, IDT_DEVICELOST, 500, NULL); + + /* Try it once immediately */ + SendMessage (hWnd, WM_DIRECTX_D3D_DEVICELOST, 0, 0); + } + break; + } + case WM_TIMER: + { + /* Did we receive a message to check if the device is available again? */ + if (wParam == IDT_DEVICELOST) { + /* This will synchronously call SharedHiddenWndProc() because this thread is the one that created the window. */ + SendMessage (hWnd, WM_DIRECTX_D3D_DEVICELOST, 0, 0); + return 0; + } + break; + } + case WM_DIRECTX_D3D_DEVICELOST: + { + gst_d3dvideosink_device_lost (sink); + break; + } + case WM_DIRECTX_D3D_END_DEVICELOST: + { + if (shared.device_lost) { + /* gst_d3dvideosink_notify_device_reset() sends this message. */ + if (shared.device_lost_timer != 0) + KillTimer (hWnd, shared.device_lost_timer); + + shared.device_lost_timer = 0; + shared.device_lost = FALSE; + + /* Refresh the video with the last buffer */ + gst_d3dvideosink_update_all (sink); + + /* Then redraw just in case we don't have a last buffer */ + gst_d3dvideosink_refresh_all (sink); + + //GST_D3DVIDEOSINK_SHARED_D3D_UNLOCK + //GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK + } + break; + } + case WM_DESTROY: + { + PostQuitMessage (0); + return 0; + } + } + + return DefWindowProc (hWnd, message, wParam, lParam); +} + +static void +gst_d3dvideosink_close_shared_hidden_window (GstD3DVideoSink * sink) +{ + if (!shared.hidden_window_handle) + return; + + SendMessage (shared.hidden_window_handle, WM_CLOSE, (WPARAM) NULL, + (WPARAM) NULL); + if (shared.hidden_window_thread) { + g_thread_join (shared.hidden_window_thread); + shared.hidden_window_thread = NULL; + } + shared.hidden_window_handle = NULL; + + GST_DEBUG ("Successfully closed Direct3D hidden window"); +} + +/* WNDPROC for application-supplied windows */ +LRESULT APIENTRY +WndProcHook (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + /* Handle certain actions specially on the window passed to us. + * Then forward back to the original window. + */ + GstD3DVideoSink *sink = + (GstD3DVideoSink *) GetProp (hWnd, TEXT ("GstD3DVideoSink")); + + switch (message) { + case WM_ERASEBKGND: + return TRUE; + case WM_COPYDATA: + { + gst_d3dvideosink_wnd_proc (sink, hWnd, message, wParam, lParam); + return TRUE; + } + case WM_PAINT: + { + LRESULT ret; + ret = CallWindowProc (sink->prevWndProc, hWnd, message, wParam, lParam); + /* Call this afterwards to ensure that our paint happens last */ + gst_d3dvideosink_wnd_proc (sink, hWnd, message, wParam, lParam); + return ret; + } + default: + { + /* Check it */ + gst_d3dvideosink_wnd_proc (sink, hWnd, message, wParam, lParam); + return CallWindowProc (sink->prevWndProc, hWnd, message, wParam, lParam); + } + } +} + +/* WndProc for our default window, if the application didn't supply one */ +LRESULT APIENTRY +WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + GstD3DVideoSink *sink; + + if (message == WM_CREATE) { + /* lParam holds a pointer to a CREATESTRUCT instance which in turn holds the parameter used when creating the window. */ + GstD3DVideoSink *sink = + (GstD3DVideoSink *) ((LPCREATESTRUCT) lParam)->lpCreateParams; + + /* In our case, this is a pointer to the sink. So we immediately attach it for use in subsequent calls. */ + SetWindowLongPtr (hWnd, GWLP_USERDATA, (LONG_PTR) sink); + + /* signal application we created a window */ + gst_x_overlay_got_window_handle (GST_X_OVERLAY (sink), (guintptr) hWnd); + } + + + sink = (GstD3DVideoSink *) GetWindowLongPtr (hWnd, GWLP_USERDATA); + gst_d3dvideosink_wnd_proc (sink, hWnd, message, wParam, lParam); + + switch (message) { + case WM_ERASEBKGND: + case WM_COPYDATA: + return TRUE; + + case WM_DESTROY: + { + PostQuitMessage (0); + return 0; + } + } + + return DefWindowProc (hWnd, message, wParam, lParam); +} + +static void +gst_d3dvideosink_wnd_proc (GstD3DVideoSink * sink, HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam) +{ + switch (message) { + case WM_COPYDATA: + { + PCOPYDATASTRUCT p_ipc_cds; + p_ipc_cds = (PCOPYDATASTRUCT) lParam; + switch (p_ipc_cds->dwData) { + case IPC_SET_WINDOW: + { + IPCData *p_ipc_data; + p_ipc_data = (IPCData *) p_ipc_cds->dwData; + + GST_DEBUG ("Received IPC call to subclass the window handler"); + + sink->window_handle = p_ipc_data->hwnd; + sink->prevWndProc = + (WNDPROC) SetWindowLongPtr (sink->window_handle, GWLP_WNDPROC, + (LONG_PTR) p_ipc_data->wnd_proc); + break; + } + } + break; + } + case WM_PAINT: + { + gst_d3dvideosink_refresh (sink); + break; + } + case WM_SIZE: + case WM_DIRECTX_D3D_RESIZE: + { + gint width; + gint height; + gst_d3dvideosink_window_size (sink, &width, &height); + gst_d3dvideosink_resize_swap_chain (sink, width, height); + gst_d3dvideosink_refresh (sink); + //gst_d3dvideosink_resize_swap_chain(sink, MAX(1, ABS(LOWORD(lParam))), MAX(1, ABS(HIWORD(lParam)))); + break; + } + case WM_CLOSE: + case WM_DESTROY: + { + sink->window_closed = TRUE; + //GST_ELEMENT_ERROR (sink, RESOURCE, NOT_FOUND, ("Output window was closed"), (NULL)); + break; + } + case WM_CHAR: + case WM_KEYDOWN: + case WM_KEYUP: + { + if (!sink->enable_navigation_events) + break; + } + { + gunichar2 wcrep[128]; + if (GetKeyNameTextW (lParam, (LPWSTR) wcrep, 128)) { + gchar *utfrep = g_utf16_to_utf8 (wcrep, 128, NULL, NULL, NULL); + if (utfrep) { + if (message == WM_CHAR || message == WM_KEYDOWN) + gst_navigation_send_key_event (GST_NAVIGATION (sink), "key-press", + utfrep); + if (message == WM_CHAR || message == WM_KEYUP) + gst_navigation_send_key_event (GST_NAVIGATION (sink), + "key-release", utfrep); + g_free (utfrep); + } + } + break; + } + case WM_LBUTTONDOWN: + case WM_LBUTTONUP: + case WM_RBUTTONDOWN: + case WM_RBUTTONUP: + case WM_MBUTTONDOWN: + case WM_MBUTTONUP: + case WM_MOUSEMOVE: + { + if (!sink->enable_navigation_events) + break; + } + { + gint x, y, button; + const gchar *action; + + switch (message) { + case WM_MOUSEMOVE: + button = 0; + action = "mouse-move"; + break; + case WM_LBUTTONDOWN: + button = 1; + action = "mouse-button-press"; + break; + case WM_LBUTTONUP: + button = 1; + action = "mouse-button-release"; + break; + case WM_RBUTTONDOWN: + button = 2; + action = "mouse-button-press"; + break; + case WM_RBUTTONUP: + button = 2; + action = "mouse-button-release"; + break; + case WM_MBUTTONDOWN: + button = 3; + action = "mouse-button-press"; + break; + case WM_MBUTTONUP: + button = 3; + action = "mouse-button-release"; + break; + default: + button = 4; + action = NULL; + break; + } + + x = LOWORD (lParam); + y = HIWORD (lParam); + + if (button == 0) { + GST_DEBUG_OBJECT (sink, "Mouse moved to %dx%d", x, y); + } else + GST_DEBUG_OBJECT (sink, "Mouse button %d pressed at %dx%d", button, x, + y); + + if (button < 4) + gst_navigation_send_mouse_event (GST_NAVIGATION (sink), action, + button, x, y); + + break; + } + } +} + +static gpointer +gst_d3dvideosink_window_thread (GstD3DVideoSink * sink) +{ + WNDCLASS WndClass; + int width, height; + int offx, offy; + DWORD exstyle, style; + HWND video_window; + RECT rect; + int screenwidth; + int screenheight; + MSG msg; + + memset (&WndClass, 0, sizeof (WNDCLASS)); + WndClass.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; + WndClass.hInstance = GetModuleHandle (NULL); + WndClass.lpszClassName = TEXT ("GST-D3DSink"); + WndClass.hbrBackground = (HBRUSH) GetStockObject (BLACK_BRUSH); + WndClass.hCursor = LoadCursor (NULL, IDC_ARROW); + WndClass.hIcon = LoadIcon (NULL, IDI_APPLICATION); + WndClass.cbClsExtra = 0; + WndClass.cbWndExtra = 0; + WndClass.lpfnWndProc = WndProc; + RegisterClass (&WndClass); + + /* By default, create a normal top-level window, the size of the video. */ + + /* GST_VIDEO_SINK_WIDTH() is the aspect-ratio-corrected size of the video. */ + /* GetSystemMetrics() returns the width of the dialog's border (doubled b/c of left and right borders). */ + width = GST_VIDEO_SINK_WIDTH (sink) + GetSystemMetrics (SM_CXSIZEFRAME) * 2; + height = GST_VIDEO_SINK_HEIGHT (sink) + GetSystemMetrics (SM_CYCAPTION) + + (GetSystemMetrics (SM_CYSIZEFRAME) * 2); + + SystemParametersInfo (SPI_GETWORKAREA, 0, &rect, 0); + screenwidth = rect.right - rect.left; + screenheight = rect.bottom - rect.top; + offx = rect.left; + offy = rect.top; + + /* Make it fit into the screen without changing the aspect ratio. */ + if (width > screenwidth) { + double ratio = (double) screenwidth / (double) width; + width = screenwidth; + height = (int) (height * ratio); + } + + if (height > screenheight) { + double ratio = (double) screenheight / (double) height; + height = screenheight; + width = (int) (width * ratio); + } + + style = WS_OVERLAPPEDWINDOW; /* Normal top-level window */ + exstyle = 0; + + video_window = CreateWindowEx (exstyle, TEXT ("GST-D3DSink"), + TEXT ("GStreamer Direct3D sink default window"), + style, offx, offy, width, height, NULL, NULL, WndClass.hInstance, sink); + + if (video_window == NULL) { + GST_ERROR_OBJECT (sink, "Failed to create window"); + return NULL; + } + + sink->is_new_window = TRUE; + sink->window_handle = video_window; + + /* Now show the window, as appropriate */ + ShowWindow (video_window, SW_SHOWNORMAL); + + /* Trigger the initial paint of the window */ + UpdateWindow (video_window); + + ReleaseSemaphore (sink->window_created_signal, 1, NULL); + + /* start message loop processing our default window messages */ + while (TRUE) { + //while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + while (GetMessage (&msg, NULL, 0, 0)) { + TranslateMessage (&msg); + DispatchMessage (&msg); + } + + if (msg.message == WM_QUIT || msg.message == WM_CLOSE) + break; + } + + UnregisterClass (WndClass.lpszClassName, WndClass.hInstance); + sink->window_handle = NULL; + return NULL; + +/*destroy_window:*/ +/* if (video_window) { */ +/* DestroyWindow(video_window); */ +/* UnregisterClass(WndClass.lpszClassName, WndClass.hInstance); */ +/* } */ +/* sink->window_handle = NULL; */ +/* ReleaseSemaphore (sink->window_created_signal, 1, NULL); */ +/* return NULL; */ +} + +static gboolean +gst_d3dvideosink_create_default_window (GstD3DVideoSink * sink) +{ + if (shared.device_lost) + return FALSE; + + sink->window_created_signal = CreateSemaphore (NULL, 0, 1, NULL); + if (sink->window_created_signal == NULL) + goto failed; + + sink->window_thread = + g_thread_create ((GThreadFunc) gst_d3dvideosink_window_thread, sink, TRUE, + NULL); + + /* wait maximum 10 seconds for window to be created */ + if (WaitForSingleObject (sink->window_created_signal, 10000) != WAIT_OBJECT_0) + goto failed; + + CloseHandle (sink->window_created_signal); + return (sink->window_handle != NULL); + +failed: + CloseHandle (sink->window_created_signal); + GST_ELEMENT_ERROR (sink, RESOURCE, WRITE, + ("Error creating our default window"), (NULL)); + return FALSE; +} + +static void +gst_d3dvideosink_set_window_handle (GstXOverlay * overlay, guintptr window_id) +{ + GstD3DVideoSink *sink = GST_D3DVIDEOSINK (overlay); + HWND hWnd = (HWND) window_id; + + if (hWnd == sink->window_handle) { + GST_DEBUG ("Window already set"); + return; + } + + GST_D3DVIDEOSINK_SHARED_D3D_DEV_LOCK GST_D3DVIDEOSINK_SWAP_CHAIN_LOCK (sink); + { + /* If we're already playing/paused, then we need to lock the swap chain, and recreate it with the new window. */ + gboolean init_swap_chain = sink->d3d_swap_chain != NULL; + + gst_d3dvideosink_release_swap_chain (sink); + + /* Close our existing window if there is one */ + gst_d3dvideosink_close_window (sink); + + /* Save our window id */ + sink->window_handle = hWnd; + + if (init_swap_chain) + gst_d3dvideosink_initialize_swap_chain (sink); + } + +/*success:*/ + GST_DEBUG ("Direct3D window id successfully changed for sink %p to %p", sink, + hWnd); + GST_D3DVIDEOSINK_SWAP_CHAIN_UNLOCK (sink); + GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK return; +/*error:*/ +/* GST_DEBUG("Error attempting to change the window id for sink %d to %d", sink, hWnd); */ +/* GST_D3DVIDEOSINK_SWAP_CHAIN_UNLOCK(sink); */ +/* GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK */ +/* return; */ +} + +/* Hook for out-of-process rendering */ +LRESULT CALLBACK +gst_d3dvideosink_hook_proc (int nCode, WPARAM wParam, LPARAM lParam) +{ + //LPCWPSTRUCT p = (LPCWPSTRUCT)lParam; + // + //if (p && p->hwnd) + // WndProcHook(p->hwnd, p->message, p->wParam, p->lParam); + return CallNextHookEx (NULL, nCode, wParam, lParam); +} + +static void +gst_d3dvideosink_set_window_for_renderer (GstD3DVideoSink * sink) +{ + WNDPROC currWndProc; + + /* Application has requested a specific window ID */ + sink->is_new_window = FALSE; + currWndProc = (WNDPROC) GetWindowLongPtr (sink->window_handle, GWLP_WNDPROC); + if (sink->prevWndProc != currWndProc && currWndProc != WndProcHook) + sink->prevWndProc = + (WNDPROC) SetWindowLongPtr (sink->window_handle, GWLP_WNDPROC, + (LONG_PTR) WndProcHook); + + /* Allows us to pick up the video sink inside the msg handler */ + SetProp (sink->window_handle, TEXT ("GstD3DVideoSink"), sink); + + if (!(sink->prevWndProc)) { + /* If we were unable to set the window procedure, it's possible we're attempting to render into the */ + /* window from a separate process. In that case, we need to use a windows hook to see the messages */ + /* going to the window we're drawing on. We must take special care that our hook is properly removed */ + /* when we're done. */ + GST_DEBUG ("Unable to set window procedure. Error: %s", + g_win32_error_message (GetLastError ())); + GST_D3DVIDEOSINK_SHARED_D3D_HOOK_LOCK + gst_d3dvideosink_hook_window_for_renderer (sink); + GST_D3DVIDEOSINK_SHARED_D3D_HOOK_UNLOCK} else { + GST_DEBUG ("Set wndproc to %p from %p", WndProcHook, sink->prevWndProc); + GST_DEBUG ("Set renderer window to %p", sink->window_handle); + } + + sink->is_new_window = FALSE; +} + +static HHOOK +gst_d3dvideosink_find_hook (DWORD pid, DWORD tid) +{ + HWND key; + GHashTableIter iter; + GstD3DVideoSinkHookData *value; + + if (!shared.hook_tbl) + return NULL; + + g_hash_table_iter_init (&iter, shared.hook_tbl); + while (g_hash_table_iter_next (&iter, (gpointer) & key, (gpointer) & value)) { + if (value && value->process_id == pid && value->thread_id == tid) + return value->hook; + } + return NULL; +} + +static GstD3DVideoSinkHookData * +gst_d3dvideosink_hook_data (HWND window_id) +{ + if (!shared.hook_tbl) + return NULL; + return (GstD3DVideoSinkHookData *) g_hash_table_lookup (shared.hook_tbl, + window_id); +} + +static GstD3DVideoSinkHookData * +gst_d3dvideosink_register_hook_data (HWND window_id) +{ + GstD3DVideoSinkHookData *data; + if (!shared.hook_tbl) + shared.hook_tbl = g_hash_table_new (NULL, NULL); + data = + (GstD3DVideoSinkHookData *) g_hash_table_lookup (shared.hook_tbl, + window_id); + if (!data) { + data = + (GstD3DVideoSinkHookData *) g_malloc (sizeof (GstD3DVideoSinkHookData)); + memset (data, 0, sizeof (GstD3DVideoSinkHookData)); + g_hash_table_insert (shared.hook_tbl, window_id, data); + } + return data; +} + +static gboolean +gst_d3dvideosink_unregister_hook_data (HWND window_id) +{ + GstD3DVideoSinkHookData *data; + if (!shared.hook_tbl) + return FALSE; + data = + (GstD3DVideoSinkHookData *) g_hash_table_lookup (shared.hook_tbl, + window_id); + if (!data) + return TRUE; + if (g_hash_table_remove (shared.hook_tbl, window_id)) + g_free (data); + return TRUE; +} + +static void +gst_d3dvideosink_hook_window_for_renderer (GstD3DVideoSink * sink) +{ + /* Ensure that our window hook isn't already installed. */ + if (!sink->is_new_window && !sink->is_hooked && sink->window_handle) { + DWORD pid; + DWORD tid; + + GST_DEBUG ("Attempting to apply a windows hook in process %lu.", + GetCurrentProcessId ()); + + /* Get thread id of the window in question. */ + tid = GetWindowThreadProcessId (sink->window_handle, &pid); + + if (tid) { + HHOOK hook; + GstD3DVideoSinkHookData *data; + + /* Only apply a hook if there's not one already there. It's possible this is the case if there are multiple */ + /* embedded windows that we're hooking inside of the same dialog/thread. */ + + hook = gst_d3dvideosink_find_hook (pid, tid); + data = gst_d3dvideosink_register_hook_data (sink->window_handle); + if (data && !hook) { + GST_DEBUG + ("No other hooks exist for pid %lu and tid %lu. Attempting to add one.", + pid, tid); + hook = + SetWindowsHookEx (WH_CALLWNDPROCRET, gst_d3dvideosink_hook_proc, + g_hinstDll, tid); + } + + sink->is_hooked = (hook ? TRUE : FALSE); + + if (sink->is_hooked) { + data->hook = hook; + data->process_id = pid; + data->thread_id = tid; + data->window_handle = sink->window_handle; + + PostThreadMessage (tid, WM_NULL, 0, 0); + + GST_DEBUG ("Window successfully hooked. GetLastError() returned: %s", + g_win32_error_message (GetLastError ())); + } else { + /* Ensure that we clean up any allocated memory. */ + if (data) + gst_d3dvideosink_unregister_hook_data (sink->window_handle); + GST_DEBUG + ("Unable to hook the window. The system provided error was: %s", + g_win32_error_message (GetLastError ())); + } + } + } +} + +static void +gst_d3dvideosink_unhook_window_for_renderer (GstD3DVideoSink * sink) +{ + if (!sink->is_new_window && sink->is_hooked && sink->window_handle) { + GstD3DVideoSinkHookData *data; + + GST_DEBUG ("Unhooking a window in process %lu.", GetCurrentProcessId ()); + + data = gst_d3dvideosink_hook_data (sink->window_handle); + if (data) { + DWORD pid; + DWORD tid; + HHOOK hook; + + /* Save off a temp ref to the data */ + hook = data->hook; + tid = data->thread_id; + pid = data->process_id; + + /* Free the memory */ + if (gst_d3dvideosink_unregister_hook_data (sink->window_handle)) { + /* Check if there's anyone else who still has the hook. If so, then we do nothing. */ + /* If not, then go ahead and unhook. */ + if (gst_d3dvideosink_find_hook (pid, tid)) { + UnhookWindowsHookEx (hook); + GST_DEBUG ("Unhooked the window for process %lu and thread %lu.", pid, + tid); + } + } + } + + sink->is_hooked = FALSE; + + GST_DEBUG ("Window successfully unhooked in process %lu.", + GetCurrentProcessId ()); + } +} + +static void +gst_d3dvideosink_unhook_all_windows (void) +{ + /* Unhook all windows that may be currently hooked. This is mainly a precaution in case */ + /* a wayward process doesn't properly set state back to NULL (which would remove the hook). */ + GST_D3DVIDEOSINK_SHARED_D3D_DEV_LOCK + GST_D3DVIDEOSINK_SHARED_D3D_LOCK GST_D3DVIDEOSINK_SHARED_D3D_HOOK_LOCK { + GList *item; + GstD3DVideoSink *s; + + GST_DEBUG ("Attempting to unhook all windows for process %lu", + GetCurrentProcessId ()); + + for (item = g_list_first (shared.element_list); item; item = item->next) { + s = (GstD3DVideoSink *) item->data; + gst_d3dvideosink_unhook_window_for_renderer (s); + } + } +GST_D3DVIDEOSINK_SHARED_D3D_HOOK_UNLOCK + GST_D3DVIDEOSINK_SHARED_D3D_UNLOCK GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK} + +static void +gst_d3dvideosink_remove_window_for_renderer (GstD3DVideoSink * sink) +{ + //GST_D3DVIDEOSINK_SHARED_D3D_DEV_LOCK + //GST_D3DVIDEOSINK_SHARED_D3D_LOCK + //GST_D3DVIDEOSINK_SWAP_CHAIN_LOCK(sink); + { + GST_DEBUG ("Removing custom rendering window procedure"); + if (!sink->is_new_window && sink->window_handle) { + WNDPROC currWndProc; + + /* Retrieve current msg handler */ + currWndProc = + (WNDPROC) GetWindowLongPtr (sink->window_handle, GWLP_WNDPROC); + + /* Return control of application window */ + if (sink->prevWndProc != NULL && currWndProc == WndProcHook) { + SetWindowLongPtr (sink->window_handle, GWLP_WNDPROC, + (LONG_PTR) sink->prevWndProc); + + sink->prevWndProc = NULL; + sink->window_handle = NULL; + sink->is_new_window = FALSE; + } + } + + GST_D3DVIDEOSINK_SHARED_D3D_HOOK_LOCK + gst_d3dvideosink_unhook_window_for_renderer (sink); + GST_D3DVIDEOSINK_SHARED_D3D_HOOK_UNLOCK + /* Remove the property associating our sink with the window */ + RemoveProp (sink->window_handle, TEXT ("GstD3DVideoSink")); + } + //GST_D3DVIDEOSINK_SWAP_CHAIN_UNLOCK(sink); + //GST_D3DVIDEOSINK_SHARED_D3D_UNLOCK + //GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK +} + +static void +gst_d3dvideosink_prepare_window (GstD3DVideoSink * sink) +{ + /* Give the app a last chance to supply a window id */ + if (!sink->window_handle) { + gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (sink)); + } + + /* If the app supplied one, use it. Otherwise, go ahead + * and create (and use) our own window */ + if (sink->window_handle) { + gst_d3dvideosink_set_window_for_renderer (sink); + } else { + gst_d3dvideosink_create_default_window (sink); + } + + gst_d3dvideosink_initialize_swap_chain (sink); +} + +static GstStateChangeReturn +gst_d3dvideosink_change_state (GstElement * element, GstStateChange transition) +{ + GstD3DVideoSink *sink = GST_D3DVIDEOSINK (element); + GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; + + switch (transition) { + case GST_STATE_CHANGE_NULL_TO_READY: + gst_d3dvideosink_initialize_direct3d (sink); + 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: + break; + } + + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + if (ret == GST_STATE_CHANGE_FAILURE) + return ret; + + switch (transition) { + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: + break; + case GST_STATE_CHANGE_PAUSED_TO_READY: + gst_d3dvideosink_remove_window_for_renderer (sink); + break; + case GST_STATE_CHANGE_READY_TO_NULL: + gst_d3dvideosink_release_direct3d (sink); + gst_d3dvideosink_clear (sink); + break; + case GST_STATE_CHANGE_NULL_TO_READY: + break; + case GST_STATE_CHANGE_READY_TO_PAUSED: + break; + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: + break; + } + + return ret; +} + +static gboolean +gst_d3dvideosink_start (GstBaseSink * bsink) +{ + GstD3DVideoSink *sink = GST_D3DVIDEOSINK (bsink); + + /* Determine if Direct 3D is supported */ + return gst_d3dvideosink_direct3d_supported (sink); +} + +static gboolean +gst_d3dvideosink_set_caps (GstBaseSink * bsink, GstCaps * caps) +{ + GstD3DVideoSink *sink; + GstCaps *sink_caps; + gint video_width, video_height; + gint video_par_n, video_par_d; /* video's PAR */ + gint display_par_n, display_par_d; /* display's PAR */ + gint fps_n, fps_d; + guint num, den; + + sink = GST_D3DVIDEOSINK (bsink); + sink_caps = gst_static_pad_template_get_caps (&sink_template); + + GST_DEBUG_OBJECT (sink, + "In setcaps. Possible caps %" GST_PTR_FORMAT ", setting caps %" + GST_PTR_FORMAT, sink_caps, caps); + + if (!gst_caps_can_intersect (sink_caps, caps)) + goto incompatible_caps; + + if (!gst_video_format_parse_caps (caps, &sink->format, &video_width, + &video_height)) + goto invalid_format; + + if (!gst_video_parse_caps_framerate (caps, &fps_n, &fps_d) || + !video_width || !video_height) + goto incomplete_caps; + + /* get aspect ratio from caps if it's present, and + * convert video width and height to a display width and height + * using wd / hd = wv / hv * PARv / PARd */ + + /* get video's PAR */ + if (!gst_video_parse_caps_pixel_aspect_ratio (caps, &video_par_n, + &video_par_d)) { + video_par_n = 1; + video_par_d = 1; + } + /* get display's PAR */ + if (sink->par) { + display_par_n = gst_value_get_fraction_numerator (sink->par); + display_par_d = gst_value_get_fraction_denominator (sink->par); + } else { + display_par_n = 1; + display_par_d = 1; + } + + if (!gst_video_calculate_display_ratio (&num, &den, video_width, + video_height, video_par_n, video_par_d, display_par_n, display_par_d)) + goto no_disp_ratio; + + GST_DEBUG_OBJECT (sink, + "video width/height: %dx%d, calculated display ratio: %d/%d", + video_width, video_height, num, den); + + /* now find a width x height that respects this display ratio. + * prefer those that have one of w/h the same as the incoming video + * using wd / hd = num / den */ + + /* start with same height, because of interlaced video */ + /* check hd / den is an integer scale factor, and scale wd with the PAR */ + if (video_height % den == 0) { + GST_DEBUG_OBJECT (sink, "keeping video height"); + GST_VIDEO_SINK_WIDTH (sink) = (guint) + gst_util_uint64_scale_int (video_height, num, den); + GST_VIDEO_SINK_HEIGHT (sink) = video_height; + } else if (video_width % num == 0) { + GST_DEBUG_OBJECT (sink, "keeping video width"); + GST_VIDEO_SINK_WIDTH (sink) = video_width; + GST_VIDEO_SINK_HEIGHT (sink) = (guint) + gst_util_uint64_scale_int (video_width, den, num); + } else { + GST_DEBUG_OBJECT (sink, "approximating while keeping video height"); + GST_VIDEO_SINK_WIDTH (sink) = (guint) + gst_util_uint64_scale_int (video_height, num, den); + GST_VIDEO_SINK_HEIGHT (sink) = video_height; + } + GST_DEBUG_OBJECT (sink, "scaling to %dx%d", + GST_VIDEO_SINK_WIDTH (sink), GST_VIDEO_SINK_HEIGHT (sink)); + + if (GST_VIDEO_SINK_WIDTH (sink) <= 0 || GST_VIDEO_SINK_HEIGHT (sink) <= 0) + goto no_display_size; + + sink->width = video_width; + sink->height = video_height; + + /* Create a window (or start using an application-supplied one, then connect the graph */ + gst_d3dvideosink_prepare_window (sink); + + return TRUE; + /* ERRORS */ +incompatible_caps: + { + GST_ERROR_OBJECT (sink, "caps incompatible"); + return FALSE; + } +incomplete_caps: + { + GST_DEBUG_OBJECT (sink, "Failed to retrieve either width, " + "height or framerate from intersected caps"); + return FALSE; + } +invalid_format: + { + gchar *caps_txt = gst_caps_to_string (caps); + GST_DEBUG_OBJECT (sink, + "Could not locate image format from caps %s", caps_txt); + g_free (caps_txt); + return FALSE; + } +no_disp_ratio: + { + GST_ELEMENT_ERROR (sink, CORE, NEGOTIATION, (NULL), + ("Error calculating the output display ratio of the video.")); + return FALSE; + } +no_display_size: + { + GST_ELEMENT_ERROR (sink, CORE, NEGOTIATION, (NULL), + ("Error calculating the output display ratio of the video.")); + return FALSE; + } +} + +static gboolean +gst_d3dvideosink_stop (GstBaseSink * bsink) +{ + GstD3DVideoSink *sink = GST_D3DVIDEOSINK (bsink); + gst_d3dvideosink_close_window (sink); + gst_d3dvideosink_release_swap_chain (sink); + return TRUE; +} + +static GstFlowReturn +gst_d3dvideosink_show_frame (GstVideoSink * vsink, GstBuffer * buffer) +{ + GstD3DVideoSink *sink = GST_D3DVIDEOSINK (vsink); + + GST_D3DVIDEOSINK_SHARED_D3D_DEV_LOCK GST_D3DVIDEOSINK_SWAP_CHAIN_LOCK (sink); + { + HRESULT hr; + LPDIRECT3DSURFACE9 backBuffer; + + if (!shared.d3ddev) { + if (!shared.device_lost) { + GST_WARNING ("No Direct3D device has been created, stopping"); + goto error; + } else { + GST_WARNING + ("Direct3D device is lost. Maintaining flow until it has been reset."); + goto success; + } + } + + if (!sink->d3d_offscreen_surface) { + GST_WARNING ("No Direct3D offscreen surface has been created, stopping"); + goto error; + } + + if (!sink->d3d_swap_chain) { + GST_WARNING ("No Direct3D swap chain has been created, stopping"); + goto error; + } + + if (sink->window_closed) { + GST_WARNING ("Window has been closed, stopping"); + goto error; + } + + if (sink->window_handle && !sink->is_new_window) { + if (shared.d3ddev) { + gint win_width = 0, win_height = 0; + D3DPRESENT_PARAMETERS d3dpp; + + ZeroMemory (&d3dpp, sizeof (d3dpp)); + + if (gst_d3dvideosink_window_size (sink, &win_width, &win_height)) { + IDirect3DSwapChain9_GetPresentParameters (sink->d3d_swap_chain, + &d3dpp); + if ((d3dpp.BackBufferWidth > 0 && d3dpp.BackBufferHeight > 0 + && win_width != d3dpp.BackBufferWidth) + || win_height != d3dpp.BackBufferHeight) + gst_d3dvideosink_resize_swap_chain (sink, win_width, win_height); + } + } + } + + /* Set the render target to our swap chain */ + IDirect3DSwapChain9_GetBackBuffer (sink->d3d_swap_chain, 0, + D3DBACKBUFFER_TYPE_MONO, &backBuffer); + IDirect3DDevice9_SetRenderTarget (shared.d3ddev, 0, backBuffer); + IDirect3DSurface9_Release (backBuffer); + + /* Clear the target */ + IDirect3DDevice9_Clear (shared.d3ddev, 0, NULL, D3DCLEAR_TARGET, + D3DCOLOR_XRGB (0, 0, 0), 1.0f, 0); + + if (SUCCEEDED (IDirect3DDevice9_BeginScene (shared.d3ddev))) { + if (GST_BUFFER_DATA (buffer)) { + D3DLOCKED_RECT lr; + guint8 *dest, *source; + int srcstride, dststride, i; + + IDirect3DSurface9_LockRect (sink->d3d_offscreen_surface, &lr, NULL, 0); + dest = (guint8 *) lr.pBits; + source = GST_BUFFER_DATA (buffer); + + if (dest) { + if (gst_video_format_is_yuv (sink->format)) { + guint32 fourcc = gst_video_format_to_fourcc (sink->format); + + switch (fourcc) { + case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): + case GST_MAKE_FOURCC ('Y', 'U', 'Y', 'V'): + case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'): + dststride = lr.Pitch; + srcstride = GST_BUFFER_SIZE (buffer) / sink->height; + for (i = 0; i < sink->height; ++i) + memcpy (dest + dststride * i, source + srcstride * i, + srcstride); + break; + case GST_MAKE_FOURCC ('I', '4', '2', '0'): + case GST_MAKE_FOURCC ('Y', 'V', '1', '2'): + { + int srcystride, srcvstride, srcustride; + int dstystride, dstvstride, dstustride; + int rows; + guint8 *srcv, *srcu, *dstv, *dstu; + + rows = sink->height; + + /* Source y, u and v strides */ + srcystride = GST_ROUND_UP_4 (sink->width); + srcustride = GST_ROUND_UP_8 (sink->width) / 2; + srcvstride = GST_ROUND_UP_8 (srcystride) / 2; + + /* Destination y, u and v strides */ + dstystride = lr.Pitch; + dstustride = dstystride / 2; + dstvstride = dstustride; + + srcu = source + srcystride * GST_ROUND_UP_2 (rows); + srcv = srcu + srcustride * GST_ROUND_UP_2 (rows) / 2; + + if (fourcc == GST_MAKE_FOURCC ('I', '4', '2', '0')) { + /* swap u and v planes */ + dstv = dest + dstystride * rows; + dstu = dstv + dstustride * rows / 2; + } else { + dstu = dest + dstystride * rows; + dstv = dstu + dstustride * rows / 2; + } + + for (i = 0; i < rows; ++i) { + /* Copy the y plane */ + memcpy (dest + dstystride * i, source + srcystride * i, + srcystride); + } + + for (i = 0; i < rows / 2; ++i) { + /* Copy the u plane */ + memcpy (dstu + dstustride * i, srcu + srcustride * i, + srcustride); + /* Copy the v plane */ + memcpy (dstv + dstvstride * i, srcv + srcvstride * i, + srcvstride); + } + break; + } + default: + g_assert_not_reached (); + } + } else if (gst_video_format_is_rgb (sink->format)) { + dststride = lr.Pitch; + srcstride = GST_BUFFER_SIZE (buffer) / sink->height; + for (i = 0; i < sink->height; ++i) + memcpy (dest + dststride * i, source + srcstride * i, srcstride); + } + } + + IDirect3DSurface9_UnlockRect (sink->d3d_offscreen_surface); + } + gst_d3dvideosink_stretch (sink, backBuffer); + IDirect3DDevice9_EndScene (shared.d3ddev); + } + /* Swap back and front buffers on video card and present to the user */ + if (FAILED (hr = + IDirect3DSwapChain9_Present (sink->d3d_swap_chain, NULL, NULL, NULL, + NULL, 0))) { + switch (hr) { + case D3DERR_DEVICELOST: + case D3DERR_DEVICENOTRESET: + gst_d3dvideosink_notify_device_lost (sink); + break; + default: + goto wrong_state; + } + } + } + +success: + GST_D3DVIDEOSINK_SWAP_CHAIN_UNLOCK (sink); + GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK return GST_FLOW_OK; +wrong_state: + GST_D3DVIDEOSINK_SWAP_CHAIN_UNLOCK (sink); + GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK return GST_FLOW_WRONG_STATE; +/*unexpected:*/ +/* GST_D3DVIDEOSINK_SWAP_CHAIN_UNLOCK(sink); */ +/* GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK */ +/* return GST_FLOW_UNEXPECTED; */ +error: + GST_D3DVIDEOSINK_SWAP_CHAIN_UNLOCK (sink); + GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK return GST_FLOW_ERROR; +} + +/* Simply redraws the last item on our offscreen surface to the window */ +static gboolean +gst_d3dvideosink_refresh (GstD3DVideoSink * sink) +{ + GST_D3DVIDEOSINK_SHARED_D3D_DEV_LOCK GST_D3DVIDEOSINK_SWAP_CHAIN_LOCK (sink); + { + HRESULT hr; + LPDIRECT3DSURFACE9 backBuffer; + + if (!shared.d3ddev) { + if (!shared.device_lost) + GST_DEBUG ("No Direct3D device has been created"); + goto error; + } + + if (!sink->d3d_offscreen_surface) { + GST_DEBUG ("No Direct3D offscreen surface has been created"); + goto error; + } + + if (!sink->d3d_swap_chain) { + GST_DEBUG ("No Direct3D swap chain has been created"); + goto error; + } + + if (sink->window_closed) { + GST_DEBUG ("Window has been closed"); + goto error; + } + + /* Set the render target to our swap chain */ + IDirect3DSwapChain9_GetBackBuffer (sink->d3d_swap_chain, 0, + D3DBACKBUFFER_TYPE_MONO, &backBuffer); + IDirect3DDevice9_SetRenderTarget (shared.d3ddev, 0, backBuffer); + IDirect3DSurface9_Release (backBuffer); + + /* Clear the target */ + IDirect3DDevice9_Clear (shared.d3ddev, 0, NULL, D3DCLEAR_TARGET, + D3DCOLOR_XRGB (0, 0, 0), 1.0f, 0); + + if (SUCCEEDED (IDirect3DDevice9_BeginScene (shared.d3ddev))) { + gst_d3dvideosink_stretch (sink, backBuffer); + IDirect3DDevice9_EndScene (shared.d3ddev); + } + + /* Swap back and front buffers on video card and present to the user */ + if (FAILED (hr = + IDirect3DSwapChain9_Present (sink->d3d_swap_chain, NULL, NULL, NULL, + NULL, 0))) { + switch (hr) { + case D3DERR_DEVICELOST: + case D3DERR_DEVICENOTRESET: + gst_d3dvideosink_notify_device_lost (sink); + break; + default: + goto error; + } + } + } + +/*success:*/ + GST_D3DVIDEOSINK_SWAP_CHAIN_UNLOCK (sink); + GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK return TRUE; +error: + GST_D3DVIDEOSINK_SWAP_CHAIN_UNLOCK (sink); + GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK return FALSE; +} + +static gboolean +gst_d3dvideosink_update_all (GstD3DVideoSink * sink) +{ + GST_D3DVIDEOSINK_SHARED_D3D_DEV_LOCK GST_D3DVIDEOSINK_SHARED_D3D_LOCK + { + GList *item; + GstD3DVideoSink *s; + for (item = g_list_first (shared.element_list); item; item = item->next) { + s = (GstD3DVideoSink *) item->data; + gst_d3dvideosink_update (GST_BASE_SINK (s)); + } + } +/*success:*/ + GST_D3DVIDEOSINK_SHARED_D3D_UNLOCK + GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK return TRUE; +/*error:*/ +/* GST_D3DVIDEOSINK_SHARED_D3D_UNLOCK */ +/* GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK */ +/* return FALSE; */ +} + +static gboolean +gst_d3dvideosink_refresh_all (GstD3DVideoSink * sink) +{ + GST_D3DVIDEOSINK_SHARED_D3D_DEV_LOCK GST_D3DVIDEOSINK_SHARED_D3D_LOCK + { + GList *item; + GstD3DVideoSink *s; + for (item = g_list_first (shared.element_list); item; item = item->next) { + s = (GstD3DVideoSink *) item->data; + gst_d3dvideosink_refresh (s); + } + } +/*success:*/ + GST_D3DVIDEOSINK_SHARED_D3D_UNLOCK + GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK return TRUE; +/*error:*/ +/* GST_D3DVIDEOSINK_SHARED_D3D_UNLOCK */ +/* GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK */ +/* return FALSE; */ +} + +static void +gst_d3dvideosink_stretch (GstD3DVideoSink * sink, LPDIRECT3DSURFACE9 backBuffer) +{ + if (sink->keep_aspect_ratio) { + gint window_width; + gint window_height; + RECT r; + GstVideoRectangle src; + GstVideoRectangle dst; + GstVideoRectangle result; + + gst_d3dvideosink_window_size (sink, &window_width, &window_height); + + src.w = GST_VIDEO_SINK_WIDTH (sink); + src.h = GST_VIDEO_SINK_HEIGHT (sink); + + dst.w = window_width; + dst.h = window_height; + + gst_video_sink_center_rect (src, dst, &result, TRUE); + + r.left = result.x; + r.top = result.y; + r.right = result.x + result.w; + r.bottom = result.y + result.h; + + IDirect3DDevice9_StretchRect (shared.d3ddev, sink->d3d_offscreen_surface, + NULL, backBuffer, &r, sink->d3dfiltertype); + } else { + IDirect3DDevice9_StretchRect (shared.d3ddev, sink->d3d_offscreen_surface, + NULL, backBuffer, NULL, sink->d3dfiltertype); + } +} + +static void +gst_d3dvideosink_expose (GstXOverlay * overlay) +{ + GstD3DVideoSink *sink = GST_D3DVIDEOSINK (overlay); + GstBuffer *last_buffer; + + last_buffer = gst_base_sink_get_last_buffer (GST_BASE_SINK (sink)); + if (last_buffer) { + gst_d3dvideosink_show_frame (GST_VIDEO_SINK (sink), last_buffer); + gst_buffer_unref (last_buffer); + } +} + +static void +gst_d3dvideosink_update (GstBaseSink * bsink) +{ + GstBuffer *last_buffer; + + last_buffer = gst_base_sink_get_last_buffer (bsink); + if (last_buffer) { + gst_d3dvideosink_show_frame (GST_VIDEO_SINK (bsink), last_buffer); + gst_buffer_unref (last_buffer); + } +} + +/* TODO: How can we implement these? Figure that out... */ +/* +static gboolean +gst_d3dvideosink_unlock (GstBaseSink * bsink) +{ + GstD3DVideoSink *sink = GST_D3DVIDEOSINK (bsink); + + return TRUE; +} + +static gboolean +gst_d3dvideosink_unlock_stop (GstBaseSink * bsink) +{ + GstD3DVideoSink *sink = GST_D3DVIDEOSINK (bsink); + + return TRUE; +} +*/ + +static gboolean +gst_d3dvideosink_initialize_direct3d (GstD3DVideoSink * sink) +{ + /* Let's hope this is never a problem (they have millions of d3d elements going at the same time) */ + if (shared.element_count >= G_MAXINT32) { + GST_ERROR + ("There are too many d3dvideosink elements. Creating more elements would put this element into an unknown state."); + return FALSE; + } + + GST_D3DVIDEOSINK_SHARED_D3D_DEV_LOCK GST_D3DVIDEOSINK_SHARED_D3D_LOCK + /* Add to our GList containing all of our elements. */ + /* GLists are doubly-linked lists and calling prepend() prevents it from having to traverse the entire list just to add one item. */ + shared.element_list = g_list_prepend (shared.element_list, sink); + + /* Increment our count of the number of elements we have */ + shared.element_count++; + if (shared.element_count > 1) + goto success; + + /* We want to initialize direct3d only for the first element that's using it. */ + /* We'll destroy this once all elements using direct3d have been finalized. */ + /* See gst_d3dvideosink_release_direct3d() for details. */ + + /* We create a window that's hidden and used by the Direct3D device. The */ + /* device is shared among all d3dvideosink windows. */ + + GST_DEBUG ("Creating hidden window for Direct3D"); + if (!gst_d3dvideosink_create_shared_hidden_window (sink)) + goto error; + +success: + GST_D3DVIDEOSINK_SHARED_D3D_UNLOCK + GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK return TRUE; +error: + GST_D3DVIDEOSINK_SHARED_D3D_UNLOCK + GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK return FALSE; +} + +static gboolean +gst_d3dvideosink_initialize_d3d_device (GstD3DVideoSink * sink) +{ + HRESULT hr; + DWORD d3dcreate; + LPDIRECT3D9 d3d; + D3DCAPS9 d3dcaps; + D3DFORMAT d3ddmformat; + D3DDISPLAYMODE d3ddm; + LPDIRECT3DDEVICE9 d3ddev; + D3DPRESENT_PARAMETERS d3dpp; + D3DTEXTUREFILTERTYPE d3dfiltertype; + GstD3DVideoSinkClass *klass; + DirectXAPI *api; + + if (!sink) { + GST_WARNING ("Missing gobject instance."); + goto error; + } + + klass = GST_D3DVIDEOSINK_GET_CLASS (sink); + if (!klass) { + GST_WARNING ("Unable to retrieve gobject class"); + goto error; + } + + api = klass->directx_api; + if (!api) { + GST_WARNING ("Missing DirectX api"); + goto error; + } + //d3d = Direct3DCreate9(D3D_SDK_VERSION); + d3d = + (LPDIRECT3D9) DX9_D3D_COMPONENT_CALL_FUNC (DIRECTX_D3D (api), + Direct3DCreate9, D3D_SDK_VERSION); + if (!d3d) { + GST_WARNING ("Unable to create Direct3D interface"); + goto error; + } + + if (FAILED (IDirect3D9_GetAdapterDisplayMode (d3d, D3DADAPTER_DEFAULT, + &d3ddm))) { + /* Prevent memory leak */ + IDirect3D9_Release (d3d); + GST_WARNING ("Unable to request adapter display mode"); + goto error; + } + + if (FAILED (IDirect3D9_GetDeviceCaps (d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + &d3dcaps))) { + /* Prevent memory leak */ + IDirect3D9_Release (d3d); + GST_WARNING ("Unable to request device caps"); + goto error; + } + + /* Ask DirectX to please not clobber the FPU state when making DirectX API calls. */ + /* This can cause libraries such as cairo to misbehave in certain scenarios. */ + d3dcreate = 0 | D3DCREATE_FPU_PRESERVE; + + /* Determine vertex processing capabilities. Some cards have issues using software vertex processing. */ + /* Courtesy http://www.chadvernon.com/blog/resources/directx9/improved-direct3d-initialization/ */ + if ((d3dcaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == + D3DDEVCAPS_HWTRANSFORMANDLIGHT) { + d3dcreate |= D3DCREATE_HARDWARE_VERTEXPROCESSING; + /* if ((d3dcaps.DevCaps & D3DDEVCAPS_PUREDEVICE) == D3DDEVCAPS_PUREDEVICE) */ + /* d3dcreate |= D3DCREATE_PUREDEVICE; */ + } else { + d3dcreate |= D3DCREATE_SOFTWARE_VERTEXPROCESSING; + } + + /* Check the filter type. */ + if ((d3dcaps.StretchRectFilterCaps & D3DPTFILTERCAPS_MINFLINEAR) == + D3DPTFILTERCAPS_MINFLINEAR + && (d3dcaps.StretchRectFilterCaps & D3DPTFILTERCAPS_MAGFLINEAR) == + D3DPTFILTERCAPS_MAGFLINEAR) { + d3dfiltertype = D3DTEXF_LINEAR; + } else { + d3dfiltertype = D3DTEXF_NONE; + } + + /* Setup the display mode format. */ + d3ddmformat = d3ddm.Format; + + ZeroMemory (&d3dpp, sizeof (d3dpp)); + //d3dpp.Flags = D3DPRESENTFLAG_VIDEO; + d3dpp.Windowed = TRUE; + d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; + d3dpp.BackBufferCount = 1; + d3dpp.BackBufferFormat = d3ddmformat; + d3dpp.BackBufferWidth = 1; + d3dpp.BackBufferHeight = 1; + d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE; + d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; //D3DPRESENT_INTERVAL_IMMEDIATE; + + GST_DEBUG ("Creating Direct3D device for hidden window %p", + shared.hidden_window_handle); + + if (FAILED (hr = IDirect3D9_CreateDevice (d3d, + D3DADAPTER_DEFAULT, + D3DDEVTYPE_HAL, + shared.hidden_window_handle, d3dcreate, &d3dpp, &d3ddev))) { + /* Prevent memory leak */ + IDirect3D9_Release (d3d); + GST_WARNING ("Unable to create Direct3D device. Result: %ld (0x%lx)", hr, + hr); + goto error; + } + //if (FAILED(IDirect3DDevice9_GetDeviceCaps( + // d3ddev, + // &d3dcaps + //))) { + // /* Prevent memory leak */ + // IDirect3D9_Release(d3d); + // GST_WARNING ("Unable to retrieve Direct3D device caps"); + // goto error; + //} + + shared.d3d = d3d; + shared.d3ddev = d3ddev; + shared.d3ddmformat = d3ddmformat; + shared.d3dfiltertype = d3dfiltertype; + +/*success:*/ + return TRUE; +error: + return FALSE; +} + +static gboolean +gst_d3dvideosink_initialize_swap_chain (GstD3DVideoSink * sink) +{ + GST_D3DVIDEOSINK_SHARED_D3D_DEV_LOCK GST_D3DVIDEOSINK_SWAP_CHAIN_LOCK (sink); + { + gint width; + gint height; + //D3DDISPLAYMODE mode; + D3DPRESENT_PARAMETERS d3dpp; + D3DFORMAT d3dformat; + D3DFORMAT d3dfourcc; + //D3DFORMAT d3dstencilformat; + LPDIRECT3DSWAPCHAIN9 d3dswapchain; + LPDIRECT3DSURFACE9 d3dsurface; + D3DTEXTUREFILTERTYPE d3dfiltertype; + //gboolean d3dEnableAutoDepthStencil; + + /* This should always work since gst_d3dvideosink_initialize_direct3d() should have always been called previously */ + if (!shared.d3ddev) { + GST_ERROR ("Direct3D device has not been initialized"); + goto error; + } + + GST_DEBUG ("Initializing Direct3D swap chain for sink %p", sink); + + if (gst_video_format_is_yuv (sink->format)) { + switch (gst_video_format_to_fourcc (sink->format)) { + case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): + d3dformat = D3DFMT_X8R8G8B8; + d3dfourcc = (D3DFORMAT) MAKEFOURCC ('Y', 'U', 'Y', '2'); + break; + //case GST_MAKE_FOURCC ('Y', 'U', 'V', 'Y'): + // d3dformat = D3DFMT_X8R8G8B8; + // d3dfourcc = (D3DFORMAT)MAKEFOURCC('Y', 'U', 'V', 'Y'); + // break; + case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'): + d3dformat = D3DFMT_X8R8G8B8; + d3dfourcc = (D3DFORMAT) MAKEFOURCC ('U', 'Y', 'V', 'Y'); + break; + case GST_MAKE_FOURCC ('Y', 'V', '1', '2'): + case GST_MAKE_FOURCC ('I', '4', '2', '0'): + d3dformat = D3DFMT_X8R8G8B8; + d3dfourcc = (D3DFORMAT) MAKEFOURCC ('Y', 'V', '1', '2'); + break; + default: + g_assert_not_reached (); + goto error; + } + } else if (gst_video_format_is_rgb (sink->format)) { + d3dformat = D3DFMT_X8R8G8B8; + d3dfourcc = D3DFMT_X8R8G8B8; + } else { + g_assert_not_reached (); + goto error; + } + + GST_DEBUG ("Determined Direct3D format: %d", d3dfourcc); + + //Stencil/depth buffers aren't created by default when using swap chains + //if (SUCCEEDED(IDirect3D9_CheckDeviceFormat(shared.d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3dformat, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_D32))) { + // d3dstencilformat = D3DFMT_D32; + // d3dEnableAutoDepthStencil = TRUE; + //} else if (SUCCEEDED(IDirect3D9_CheckDeviceFormat(shared.d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3dformat, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_D24X8))) { + // d3dstencilformat = D3DFMT_D24X8; + // d3dEnableAutoDepthStencil = TRUE; + //} else if (SUCCEEDED(IDirect3D9_CheckDeviceFormat(shared.d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3dformat, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_D16))) { + // d3dstencilformat = D3DFMT_D16; + // d3dEnableAutoDepthStencil = TRUE; + //} else { + // d3dstencilformat = D3DFMT_X8R8G8B8; + // d3dEnableAutoDepthStencil = FALSE; + //} + // + //GST_DEBUG("Determined Direct3D stencil format: %d", d3dstencilformat); + + GST_DEBUG ("Direct3D back buffer size: %dx%d", GST_VIDEO_SINK_WIDTH (sink), + GST_VIDEO_SINK_HEIGHT (sink)); + + /* Get the current size of the window */ + gst_d3dvideosink_window_size (sink, &width, &height); + + ZeroMemory (&d3dpp, sizeof (d3dpp)); + d3dpp.Windowed = TRUE; + d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; + d3dpp.hDeviceWindow = sink->window_handle; + d3dpp.BackBufferFormat = d3dformat; + d3dpp.BackBufferWidth = width; + d3dpp.BackBufferHeight = height; + + if (FAILED (IDirect3DDevice9_CreateAdditionalSwapChain (shared.d3ddev, + &d3dpp, &d3dswapchain))) + goto error; + + if (FAILED (IDirect3DDevice9_CreateOffscreenPlainSurface (shared.d3ddev, + sink->width, sink->height, d3dfourcc, D3DPOOL_DEFAULT, + &d3dsurface, NULL))) { + /* Ensure that we release our newly created swap chain to prevent memory leaks */ + IDirect3DSwapChain9_Release (d3dswapchain); + goto error; + } + + /* Determine texture filtering support. If it's supported for this format, use the filter type determined when we created the dev and checked the dev caps. */ + if (SUCCEEDED (IDirect3D9_CheckDeviceFormat (shared.d3d, D3DADAPTER_DEFAULT, + D3DDEVTYPE_HAL, shared.d3ddmformat, D3DUSAGE_QUERY_FILTER, + D3DRTYPE_TEXTURE, d3dformat))) { + d3dfiltertype = shared.d3dfiltertype; + } else { + d3dfiltertype = D3DTEXF_NONE; + } + + GST_DEBUG ("Direct3D stretch rect texture filter: %d", d3dfiltertype); + + sink->d3dformat = d3dformat; + sink->d3dfourcc = d3dfourcc; + sink->d3dfiltertype = d3dfiltertype; + sink->d3d_swap_chain = d3dswapchain; + sink->d3d_offscreen_surface = d3dsurface; + } + +/*success:*/ + GST_D3DVIDEOSINK_SWAP_CHAIN_UNLOCK (sink); + GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK return TRUE; +error: + GST_D3DVIDEOSINK_SWAP_CHAIN_UNLOCK (sink); + GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK return FALSE; +} + +static gboolean +gst_d3dvideosink_resize_swap_chain (GstD3DVideoSink * sink, gint width, + gint height) +{ + if (width <= 0 || height <= 0 || width > GetSystemMetrics (SM_CXFULLSCREEN) + || height > GetSystemMetrics (SM_CYFULLSCREEN)) { + GST_DEBUG ("Invalid size"); + return FALSE; + } + + GST_D3DVIDEOSINK_SHARED_D3D_DEV_LOCK GST_D3DVIDEOSINK_SWAP_CHAIN_LOCK (sink); + { + int ref_count; + D3DPRESENT_PARAMETERS d3dpp; + LPDIRECT3DSWAPCHAIN9 d3dswapchain; + + GST_DEBUG ("Resizing Direct3D swap chain for sink %p to %dx%d", sink, width, + height); + + if (!shared.d3d || !shared.d3ddev) { + if (!shared.device_lost) + GST_WARNING ("Direct3D device has not been initialized"); + goto error; + } + + if (!sink->d3d_swap_chain) { + GST_DEBUG ("Direct3D swap chain has not been initialized"); + goto error; + } + + /* Get the parameters used to create this swap chain */ + if (FAILED (IDirect3DSwapChain9_GetPresentParameters (sink->d3d_swap_chain, + &d3dpp))) { + GST_DEBUG + ("Unable to determine Direct3D present parameters for swap chain"); + goto error; + } + + /* Release twice because IDirect3DSwapChain9_GetPresentParameters() adds a reference */ + while ((ref_count = + IDirect3DSwapChain9_Release (sink->d3d_swap_chain)) > 0); + sink->d3d_swap_chain = NULL; + GST_DEBUG ("Old Direct3D swap chain released. Reference count: %d", + ref_count); + + /* Adjust back buffer width/height */ + d3dpp.BackBufferWidth = width; + d3dpp.BackBufferHeight = height; + + if (FAILED (IDirect3DDevice9_CreateAdditionalSwapChain (shared.d3ddev, + &d3dpp, &d3dswapchain))) + goto error; + + sink->d3d_swap_chain = d3dswapchain; + } + +/*success:*/ + GST_DEBUG ("Direct3D swap chain successfully resized for sink %p", sink); + GST_D3DVIDEOSINK_SWAP_CHAIN_UNLOCK (sink); + GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK return TRUE; +error: + GST_DEBUG ("Error attempting to resize the Direct3D swap chain for sink %p", + sink); + GST_D3DVIDEOSINK_SWAP_CHAIN_UNLOCK (sink); + GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK return FALSE; +} + +static gboolean +gst_d3dvideosink_release_swap_chain (GstD3DVideoSink * sink) +{ + GST_D3DVIDEOSINK_SHARED_D3D_DEV_LOCK GST_D3DVIDEOSINK_SWAP_CHAIN_LOCK (sink); + { + GST_DEBUG ("Releasing Direct3D swap chain for sink %p", sink); + + /* This should always work since gst_d3dvideosink_initialize_direct3d() should have always been called previously */ + if (!shared.d3d || !shared.d3ddev) { + if (!shared.device_lost) + GST_ERROR ("Direct3D device has not been initialized"); + goto error; + } + + if (!sink->d3d_swap_chain && !sink->d3d_offscreen_surface) + goto success; + + if (sink->d3d_offscreen_surface) { + int ref_count; + while ((ref_count = + IDirect3DSurface9_Release (sink->d3d_offscreen_surface)) > 0); + sink->d3d_offscreen_surface = NULL; + GST_DEBUG + ("Direct3D offscreen surface released for sink %p. Reference count: %d", + sink, ref_count); + } + + if (sink->d3d_swap_chain) { + int ref_count; + while ((ref_count = + IDirect3DSwapChain9_Release (sink->d3d_swap_chain)) > 0); + sink->d3d_swap_chain = NULL; + GST_DEBUG + ("Direct3D swap chain released for sink %p. Reference count: %d", + sink, ref_count); + } + } + +success: + GST_DEBUG ("Direct3D swap chain successfully released for sink %p", sink); + GST_D3DVIDEOSINK_SWAP_CHAIN_UNLOCK (sink); + GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK return TRUE; +error: + GST_DEBUG ("Error attempting to release the Direct3D swap chain for sink %p", + sink); + GST_D3DVIDEOSINK_SWAP_CHAIN_UNLOCK (sink); + GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK return FALSE; +} + +static gboolean +gst_d3dvideosink_notify_device_lost (GstD3DVideoSink * sink) +{ + GST_D3DVIDEOSINK_SHARED_D3D_DEV_LOCK GST_D3DVIDEOSINK_SHARED_D3D_LOCK + { + /* Send notification asynchronously */ + PostMessage (shared.hidden_window_handle, WM_DIRECTX_D3D_INIT_DEVICELOST, 0, + 0); + } +/*success:*/ + GST_DEBUG ("Successfully sent notification of device lost event for sink %p", + sink); + GST_D3DVIDEOSINK_SHARED_D3D_UNLOCK GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK + return TRUE; +/*error:*/ +/* GST_DEBUG("Error attempting to send notification of device lost event for sink %d", sink); */ +/* GST_D3DVIDEOSINK_SHARED_D3D_UNLOCK */ +/* GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK */ +/* return FALSE; */ +} + +static gboolean +gst_d3dvideosink_notify_device_reset (GstD3DVideoSink * sink) +{ + GST_D3DVIDEOSINK_SHARED_D3D_DEV_LOCK GST_D3DVIDEOSINK_SHARED_D3D_LOCK + { + /* Send notification synchronously -- let's ensure the timer's been killed before returning */ + SendMessage (shared.hidden_window_handle, WM_DIRECTX_D3D_END_DEVICELOST, 0, + 0); + } +/*success:*/ + GST_DEBUG ("Successfully sent notification of device reset event for sink %p", + sink); + GST_D3DVIDEOSINK_SHARED_D3D_UNLOCK GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK + return TRUE; +/*error:*/ +/* GST_DEBUG("Error attempting to send notification of reset lost event for sink %d", sink); */ +/* GST_D3DVIDEOSINK_SHARED_D3D_UNLOCK */ +/* GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK */ +/* return FALSE; */ +} + +static gboolean +gst_d3dvideosink_device_lost (GstD3DVideoSink * sink) +{ + /* Must be called from hidden window's message loop! */ + + GST_D3DVIDEOSINK_SHARED_D3D_DEV_LOCK GST_D3DVIDEOSINK_SHARED_D3D_LOCK + { + GST_DEBUG ("Direct3D device lost. Resetting the device."); + + if (g_thread_self () != shared.hidden_window_thread) + { + GST_ERROR + ("Direct3D device can only be reset by the thread that created it."); + goto error; + } + + if (!shared.device_lost && (!shared.d3d || !shared.d3ddev)) + { + GST_ERROR ("Direct3D device has not been initialized"); + goto error; + } + + { + GList *item; + GstD3DVideoSink *s; + + /* This is technically a bit different from the normal. We don't call reset(), instead */ + /* we recreate everything from scratch. */ + + /* Release all swap chains, surfaces, buffers, etc. */ + for (item = g_list_first (shared.element_list); item; item = item->next) { + s = (GstD3DVideoSink *) item->data; + gst_d3dvideosink_release_swap_chain (s); + } + + /* Release the device */ + if (!gst_d3dvideosink_release_d3d_device (NULL)) + goto error; + + /* Recreate device */ + if (!gst_d3dvideosink_initialize_d3d_device (sink)) + goto error; + + /* Reinitialize all swap chains, surfaces, buffers, etc. */ + for (item = g_list_first (shared.element_list); item; item = item->next) { + s = (GstD3DVideoSink *) item->data; + gst_d3dvideosink_initialize_swap_chain (s); + } + } + + /* Let the hidden window know that it's okay to kill the timer */ + gst_d3dvideosink_notify_device_reset (sink); + } + +/*success:*/ + GST_DEBUG ("Direct3D device has successfully been reset."); + GST_D3DVIDEOSINK_SHARED_D3D_UNLOCK + GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK return TRUE; +error: + GST_DEBUG ("Unable to successfully reset the Direct3D device."); + GST_D3DVIDEOSINK_SHARED_D3D_UNLOCK + GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK return FALSE; +} + +static gboolean +gst_d3dvideosink_release_d3d_device (GstD3DVideoSink * sink) +{ + GST_DEBUG ("Cleaning all Direct3D objects"); + + if (shared.d3ddev) { + int ref_count; + ref_count = IDirect3DDevice9_Release (shared.d3ddev); + shared.d3ddev = NULL; + GST_DEBUG ("Direct3D device released. Reference count: %d", ref_count); + } + + if (shared.d3d) { + int ref_count; + ref_count = IDirect3D9_Release (shared.d3d); + shared.d3d = NULL; + GST_DEBUG ("Direct3D object released. Reference count: %d", ref_count); + } + + return TRUE; +} + +static gboolean +gst_d3dvideosink_release_direct3d (GstD3DVideoSink * sink) +{ + GST_D3DVIDEOSINK_SHARED_D3D_DEV_LOCK GST_D3DVIDEOSINK_SHARED_D3D_LOCK + /* Be absolutely sure that we've released this sink's hook (if any). */ + gst_d3dvideosink_unhook_window_for_renderer (sink); + + /* Remove item from the list */ + shared.element_list = g_list_remove (shared.element_list, sink); + + /* Decrement our count of the number of elements we have */ + shared.element_count--; + if (shared.element_count < 0) + shared.element_count = 0; + if (shared.element_count > 0) + goto success; + + gst_d3dvideosink_release_d3d_device (sink); + + GST_DEBUG ("Closing hidden Direct3D window"); + gst_d3dvideosink_close_shared_hidden_window (sink); + +success: + GST_D3DVIDEOSINK_SHARED_D3D_UNLOCK + GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK return TRUE; +/*error:*/ +/* GST_D3DVIDEOSINK_SHARED_D3D_UNLOCK */ +/* GST_D3DVIDEOSINK_SHARED_D3D_DEV_UNLOCK */ +/* return FALSE; */ +} + +static gboolean +gst_d3dvideosink_window_size (GstD3DVideoSink * sink, gint * width, + gint * height) +{ + if (!sink || !sink->window_handle) { + if (width && height) { + *width = 0; + *height = 0; + } + return FALSE; + } + + { + RECT sz; + GetClientRect (sink->window_handle, &sz); + + *width = MAX (1, ABS (sz.right - sz.left)); + *height = MAX (1, ABS (sz.bottom - sz.top)); + } + return TRUE; +} + +static void +gst_d3dvideosink_navigation_send_event (GstNavigation * navigation, + GstStructure * structure) +{ + GstD3DVideoSink *sink = GST_D3DVIDEOSINK (navigation); + gint window_width; + gint window_height; + GstEvent *e; + GstVideoRectangle src, dst, result; + double x, y, old_x, old_y; + GstPad *pad = NULL; + + gst_d3dvideosink_window_size (sink, &window_width, &window_height); + + src.w = GST_VIDEO_SINK_WIDTH (sink); + src.h = GST_VIDEO_SINK_HEIGHT (sink); + dst.w = window_width; + dst.h = window_height; + + e = gst_event_new_navigation (structure); + + if (sink->keep_aspect_ratio) { + gst_video_sink_center_rect (src, dst, &result, TRUE); + } else { + result.x = 0; + result.y = 0; + result.w = dst.w; + result.h = dst.h; + } + + /* 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 = 0; + } else if (x >= result.x + result.w) { + x = src.w; + } else { + x = MAX (0, MIN (src.w, MAX (0, x - result.x) / result.w * src.w)); + } + GST_DEBUG_OBJECT (sink, + "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 = 0; + } else if (y >= result.y + result.h) { + y = src.h; + } else { + y = MAX (0, MIN (src.h, MAX (0, y - result.y) / result.h * src.h)); + } + GST_DEBUG_OBJECT (sink, + "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 (sink)); + + if (GST_IS_PAD (pad) && GST_IS_EVENT (e)) { + gst_pad_send_event (pad, e); + gst_object_unref (pad); + } +} + +static gboolean +gst_d3dvideosink_direct3d_supported (GstD3DVideoSink * sink) +{ + GstD3DVideoSinkClass *klass = GST_D3DVIDEOSINK_GET_CLASS (sink); + + return (klass != NULL && klass->is_directx_supported); +} + +static void +gst_d3dvideosink_log_debug (const gchar * file, const gchar * function, + gint line, const gchar * format, va_list args) +{ + if (G_UNLIKELY (GST_LEVEL_DEBUG <= __gst_debug_min)) + gst_debug_log_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, file, function, + line, NULL, format, args); +} + +static void +gst_d3dvideosink_log_warning (const gchar * file, const gchar * function, + gint line, const gchar * format, va_list args) +{ + if (G_UNLIKELY (GST_LEVEL_WARNING <= __gst_debug_min)) + gst_debug_log_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, file, function, + line, NULL, format, args); +} + +static void +gst_d3dvideosink_log_error (const gchar * file, const gchar * function, + gint line, const gchar * format, va_list args) +{ + if (G_UNLIKELY (GST_LEVEL_ERROR <= __gst_debug_min)) + gst_debug_log_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, file, function, + line, NULL, format, args); +} + +/* Plugin entry point */ +static gboolean +plugin_init (GstPlugin * plugin) +{ + /* PRIMARY: this is the best videosink to use on windows */ + if (!gst_element_register (plugin, "d3dvideosink", + GST_RANK_PRIMARY, GST_TYPE_D3DVIDEOSINK)) + return FALSE; + + return TRUE; +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "d3dsinkwrapper", + "Direct3D sink wrapper plugin", + plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/sys/d3dvideosink/d3dvideosink.h b/sys/d3dvideosink/d3dvideosink.h new file mode 100644 index 0000000000..e067dd3f16 --- /dev/null +++ b/sys/d3dvideosink/d3dvideosink.h @@ -0,0 +1,106 @@ +/* GStreamer + * Copyright (C) 2010 David Hoyt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __D3DVIDEOSINK_H__ +#define __D3DVIDEOSINK_H__ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "directx/directx.h" + +#ifdef _MSC_VER +#pragma warning( disable : 4090 4024) +#endif + +G_BEGIN_DECLS +#define GST_TYPE_D3DVIDEOSINK (gst_d3dvideosink_get_type()) +#define GST_D3DVIDEOSINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_D3DVIDEOSINK,GstD3DVideoSink)) +#define GST_D3DVIDEOSINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_D3DVIDEOSINK,GstD3DVideoSinkClass)) +#define GST_D3DVIDEOSINK_GET_CLASS(obj) (GST_D3DVIDEOSINK_CLASS(G_OBJECT_GET_CLASS(obj))) +#define GST_IS_D3DVIDEOSINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_D3DVIDEOSINK)) +#define GST_IS_D3DVIDEOSINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_D3DVIDEOSINK)) + +typedef struct _GstD3DVideoSink GstD3DVideoSink; +typedef struct _GstD3DVideoSinkClass GstD3DVideoSinkClass; + +#define GST_D3DVIDEOSINK_SWAP_CHAIN_LOCK(sink) g_mutex_lock (GST_D3DVIDEOSINK (sink)->d3d_swap_chain_lock); +#define GST_D3DVIDEOSINK_SWAP_CHAIN_UNLOCK(sink) g_mutex_unlock (GST_D3DVIDEOSINK (sink)->d3d_swap_chain_lock); + +struct _GstD3DVideoSink +{ + GstVideoSink sink; + + /* source rectangle */ + gint width; + gint height; + + GstVideoFormat format; + + gboolean enable_navigation_events; + + gboolean keep_aspect_ratio; + GValue *par; + + /* If the window is closed, we set this and error out */ + gboolean window_closed; + + /* The video window set through GstXOverlay */ + HWND window_handle; + + /* If we created the window, it needs to be closed in ::stop() */ + gboolean is_new_window; + + /* If we create our own window, we run it from another thread */ + GThread *window_thread; + HANDLE window_created_signal; + + /* If we use an app-supplied window, we need to hook its WNDPROC */ + WNDPROC prevWndProc; + gboolean is_hooked; + + GMutex *d3d_swap_chain_lock; + LPDIRECT3DSWAPCHAIN9 d3d_swap_chain; + LPDIRECT3DSURFACE9 d3d_offscreen_surface; + + D3DFORMAT d3dformat; + D3DFORMAT d3dfourcc; + D3DTEXTUREFILTERTYPE d3dfiltertype; +}; + +struct _GstD3DVideoSinkClass +{ + GstVideoSinkClass parent_class; + + gboolean is_directx_supported; + gint directx_version; + DirectXAPI *directx_api; +}; + +GType gst_d3dvideosink_get_type (void); + +G_END_DECLS +#endif /* __D3DVIDEOSINK_H__ */ diff --git a/sys/d3dvideosink/directx/d3d.c b/sys/d3dvideosink/directx/d3d.c new file mode 100644 index 0000000000..33589a3804 --- /dev/null +++ b/sys/d3dvideosink/directx/d3d.c @@ -0,0 +1,65 @@ +/* GStreamer + * Copyright (C) 2011 David Hoyt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "directx.h" + +const DirectXD3D * +directx_d3d_create (const DirectXAPI * api) +{ + if (!api) + return NULL; + + return DIRECTX_D3D_CALL_API_FUNCTION (api, create, api); +} + +gboolean +directx_d3d_resize (const DirectXD3D * d3d) +{ + if (!d3d) + return FALSE; + + return DIRECTX_D3D_CALL_FUNCTION (d3d, resize, d3d); +} + +gboolean +directx_d3d_device_lost (const DirectXD3D * d3d) +{ + if (!d3d) + return FALSE; + + return DIRECTX_D3D_CALL_FUNCTION (d3d, device_lost, d3d); +} + +gboolean +directx_d3d_notify_device_reset (const DirectXD3D * d3d) +{ + if (!d3d) + return FALSE; + + return DIRECTX_D3D_CALL_FUNCTION (d3d, notify_device_reset, d3d); +} + +gboolean +directx_d3d_release (const DirectXD3D * d3d) +{ + if (!d3d) + return FALSE; + + return DIRECTX_D3D_CALL_FUNCTION (d3d, release, d3d); +} diff --git a/sys/d3dvideosink/directx/d3d.h b/sys/d3dvideosink/directx/d3d.h new file mode 100644 index 0000000000..c58310fd9f --- /dev/null +++ b/sys/d3dvideosink/directx/d3d.h @@ -0,0 +1,99 @@ +/* GStreamer + * Copyright (C) 2011 David Hoyt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __DIRECTX_D3D_H__ +#define __DIRECTX_D3D_H__ + +#include + +#include "dx.h" + +G_BEGIN_DECLS + +#define WM_DIRECTX_D3D_INIT_DEVICE WM_DIRECTX + 1 +#define WM_DIRECTX_D3D_INIT_DEVICELOST WM_DIRECTX + 2 +#define WM_DIRECTX_D3D_DEVICELOST WM_DIRECTX + 3 +#define WM_DIRECTX_D3D_END_DEVICELOST WM_DIRECTX + 4 +#define WM_DIRECTX_D3D_RESIZE WM_DIRECTX + 5 + +#define DIRECTX_D3D_API(version, dispatch_table, init_function, create_function, resize_function, device_lost_function, notify_device_reset_function, release_function) \ + static gpointer DIRECTX_API_COMPONENT_D3D_ ## version ## _DISPATCH_TABLE = &dispatch_table; \ + static DirectXAPIComponentD3D DIRECTX_API_COMPONENT_D3D_ ## version ## _INIT = { \ + create_function /*create_function*/ \ + , resize_function /*resize_function*/ \ + , device_lost_function /*device_lost_function*/ \ + , notify_device_reset_function /*notify_device_reset_function*/ \ + , release_function /*release_function*/ \ + , NULL /*private_data*/ \ + }; \ + static void init_directx_api_component_d3d_ ## version ## _(const DirectXAPI* api) { \ + gpointer private_data = &DIRECTX_API_COMPONENT_D3D_ ## version ## _INIT; \ + gpointer vtable = DIRECTX_API_COMPONENT_D3D_ ## version ## _DISPATCH_TABLE; \ + DIRECTX_SET_COMPONENT_INIT(DIRECTX_D3D(api), init_function); \ + DIRECTX_SET_COMPONENT_DATA(DIRECTX_D3D(api), private_data); \ + DIRECTX_SET_COMPONENT_DISPATCH_TABLE(DIRECTX_D3D(api), vtable); \ + } + +#define INITIALIZE_DIRECTX_D3D_API(version, api) \ + init_directx_api_component_d3d_ ## version ## _(api); + +#define DIRECTX_D3D_FUNCTIONS(d3d) ((DirectXAPIComponentD3D*)d3d->d3d_component) +#define DIRECTX_D3D_API_FUNCTIONS(api) ((DirectXAPIComponentD3D*)DIRECTX_D3D_COMPONENT_DATA(api)) +#define DIRECTX_D3D_CALL_FUNCTION(d3d, func_name, ...) (DIRECTX_D3D_FUNCTIONS(d3d)->func_name(__VA_ARGS__)) +#define DIRECTX_D3D_CALL_API_FUNCTION(api, func_name, ...) (DIRECTX_D3D_API_FUNCTIONS(api)->func_name(__VA_ARGS__)) + +typedef struct _DirectXD3D DirectXD3D; +typedef struct _DirectXAPIComponentD3D DirectXAPIComponentD3D; + +/* Function pointers */ +typedef DirectXD3D* (*DirectXD3DCreateFunction) (const DirectXAPI* api); +typedef gboolean (*DirectXD3DResizeFunction) (const DirectXD3D* d3d); +typedef gboolean (*DirectXD3DDeviceLostFunction) (const DirectXD3D* d3d); +typedef gboolean (*DirectXD3DNotifyDeviceResetFunction) (const DirectXD3D* d3d); +typedef gboolean (*DirectXD3DReleaseFunction) (const DirectXD3D* d3d); + +struct _DirectXAPIComponentD3D +{ + DirectXD3DCreateFunction create; + DirectXD3DResizeFunction resize; + DirectXD3DDeviceLostFunction device_lost; + DirectXD3DNotifyDeviceResetFunction notify_device_reset; + DirectXD3DReleaseFunction release; + + gpointer private_data; +}; + +struct _DirectXD3D +{ + DirectXAPI* api; + DirectXAPIComponent* api_component; + DirectXAPIComponentD3D* d3d_component; + + gpointer private_data; +}; + +const DirectXD3D* directx_d3d_create(const DirectXAPI* api); +gboolean directx_d3d_resize(const DirectXD3D* d3d); +gboolean directx_d3d_device_lost(const DirectXD3D* d3d); +gboolean directx_d3d_notify_device_reset(const DirectXD3D* d3d); +gboolean directx_d3d_release(const DirectXD3D* d3d); + +G_END_DECLS + +#endif /* __DIRECTX_D3D_H__ */ diff --git a/sys/d3dvideosink/directx/directx.h b/sys/d3dvideosink/directx/directx.h new file mode 100644 index 0000000000..40c33dda60 --- /dev/null +++ b/sys/d3dvideosink/directx/directx.h @@ -0,0 +1,33 @@ +/* GStreamer + * Copyright (C) 2011 David Hoyt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __DIRECTX_DIRECTX_H__ +#define __DIRECTX_DIRECTX_H__ + +#include "dx.h" +#include "d3d.h" + +/* TODO: Remove these headers -- they should not be publically distributed. */ +/* They're included for now only for expediancy in getting d3dvideosink */ +/* out the door. */ +#include "directx9/dx9.h" +#include "directx10/dx10.h" +#include "directx11/dx11.h" + +#endif /* __DIRECTX_DIRECTX_H__ */ diff --git a/sys/d3dvideosink/directx/directx10/dx10.c b/sys/d3dvideosink/directx/directx10/dx10.c new file mode 100644 index 0000000000..f902db4d5b --- /dev/null +++ b/sys/d3dvideosink/directx/directx10/dx10.c @@ -0,0 +1,27 @@ +/* GStreamer + * Copyright (C) 2011 David Hoyt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "dx10.h" + +void +dx10_init (const DirectXAPI * api) +{ + DIRECTX_DEBUG ("Initializing DirectX10 API"); + INITIALIZE_DIRECTX_D3D_API (DIRECTX_10, api); +} diff --git a/sys/d3dvideosink/directx/directx10/dx10.h b/sys/d3dvideosink/directx/directx10/dx10.h new file mode 100644 index 0000000000..a0965eb67f --- /dev/null +++ b/sys/d3dvideosink/directx/directx10/dx10.h @@ -0,0 +1,39 @@ +/* GStreamer + * Copyright (C) 2011 David Hoyt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __DIRECTX_DIRECTX10_DX10_H__ +#define __DIRECTX_DIRECTX10_DX10_H__ + +#include "../dx.h" + +#include "dx10_d3d.h" + +/* Function declarations */ +void dx10_init(const DirectXAPI* api); + +DIRECTX_API( + DIRECTX_10, + dx10_init, + "d3d10", + "D3D10CreateDevice", + "DirectX10Description", + "DirectX 10.0" +) + +#endif /* __DIRECTX_DIRECTX10_DX10_H__ */ diff --git a/sys/d3dvideosink/directx/directx10/dx10_d3d.c b/sys/d3dvideosink/directx/directx10/dx10_d3d.c new file mode 100644 index 0000000000..04a0c33892 --- /dev/null +++ b/sys/d3dvideosink/directx/directx10/dx10_d3d.c @@ -0,0 +1,77 @@ +/* GStreamer + * Copyright (C) 2011 David Hoyt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#define CINTERFACE +#define D3D10_IGNORE_SDK_LAYERS + +#include +#include + +#include "dx10_d3d.h" + +void +dx10_d3d_init (DirectXAPIComponent * component, gpointer data) +{ + DIRECTX_DEBUG ("Initializing Direct3D"); + DIRECTX_OPEN_COMPONENT_MODULE (component, "d3d10"); + DIRECTX_DEBUG ("Completed Initializing Direct3D"); + + DIRECTX_DEBUG ("Setting Direct3D dispatch table"); + DIRECTX_OPEN_COMPONENT_SYMBOL (component, D3D10DispatchTable, + D3D10CreateDevice); + + //{ + // ID3D10Device* pDevice = NULL; + // DIRECTX_DEBUG("Calling D3D10CreateDevice"); + // DX10_D3D_COMPONENT_CALL_FUNC(component, D3D10CreateDevice, NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, D3D10_SDK_VERSION, &pDevice); + // DIRECTX_DEBUG("Releasing D3D10 device"); + // ID3D10Device_Release(pDevice); + // DIRECTX_DEBUG("Released D3D10 device"); + //} +} + +DirectXD3D * +dx10_d3d_create (const DirectXAPI * api) +{ + return NULL; +} + +gboolean +dx10_d3d_resize (const DirectXD3D * d3d) +{ + return TRUE; +} + +gboolean +dx10_d3d_device_lost (const DirectXD3D * d3d) +{ + return TRUE; +} + +gboolean +dx10_d3d_notify_device_reset (const DirectXD3D * d3d) +{ + return TRUE; +} + +gboolean +dx10_d3d_release (const DirectXD3D * d3d) +{ + return TRUE; +} diff --git a/sys/d3dvideosink/directx/directx10/dx10_d3d.h b/sys/d3dvideosink/directx/directx10/dx10_d3d.h new file mode 100644 index 0000000000..a91c4f684b --- /dev/null +++ b/sys/d3dvideosink/directx/directx10/dx10_d3d.h @@ -0,0 +1,72 @@ +/* GStreamer + * Copyright (C) 2011 David Hoyt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __DIRECTX_DIRECTX10_DX10_D3D_H__ +#define __DIRECTX_DIRECTX10_DX10_D3D_H__ + +#include + +#include "../d3d.h" + +#define DX10_D3D_API_CALL_FUNC(api, func_name, ...) (DIRECTX_CALL_COMPONENT_SYMBOL(DIRECTX_D3D(api), D3D10DispatchTable, func_name, __VA_ARGS__)) +#define DX10_D3D_COMPONENT_CALL_FUNC(component, func_name, ...) (DIRECTX_CALL_COMPONENT_SYMBOL(component, D3D10DispatchTable, func_name, __VA_ARGS__)) + +/* Structs */ +typedef struct _D3D10 D3D10; +typedef struct _D3D10DispatchTable D3D10DispatchTable; + +/* Functions */ +/* Courtesy http://code.google.com/p/theaimworldeditor/source/browse/trunk/DXUT/Core/DXUTmisc.cpp */ +typedef HRESULT (WINAPI *LPD3D10CREATEDEVICE)(gpointer /* IDXGIAdapter* */, UINT /* D3D10_DRIVER_TYPE */, HMODULE, UINT, UINT32, gpointer* /* ID3D10Device** */ ); + +struct _D3D10DispatchTable +{ + LPD3D10CREATEDEVICE D3D10CreateDevice; +}; + +/* Global data */ +struct _D3D10 +{ + D3D10DispatchTable vtable; +}; + +/* Global vars */ +static D3D10 dx10_d3d; + +/* Function declarations */ + +void dx10_d3d_init(DirectXAPIComponent* component, gpointer data); +DirectXD3D* dx10_d3d_create(const DirectXAPI* api); +gboolean dx10_d3d_resize(const DirectXD3D* d3d); +gboolean dx10_d3d_device_lost(const DirectXD3D* d3d); +gboolean dx10_d3d_notify_device_reset(const DirectXD3D* d3d); +gboolean dx10_d3d_release(const DirectXD3D* d3d); + +DIRECTX_D3D_API( + DIRECTX_10, + dx10_d3d.vtable, + dx10_d3d_init, + dx10_d3d_create, + dx10_d3d_resize, + dx10_d3d_device_lost, + dx10_d3d_notify_device_reset, + dx10_d3d_release +) + +#endif /* __DIRECTX_DIRECTX10_DX10_D3D_H__ */ diff --git a/sys/d3dvideosink/directx/directx11/dx11.c b/sys/d3dvideosink/directx/directx11/dx11.c new file mode 100644 index 0000000000..2cfe187460 --- /dev/null +++ b/sys/d3dvideosink/directx/directx11/dx11.c @@ -0,0 +1,27 @@ +/* GStreamer + * Copyright (C) 2011 David Hoyt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "dx11.h" + +void +dx11_init (const DirectXAPI * api) +{ + DIRECTX_DEBUG ("Initializing DirectX11 API"); + INITIALIZE_DIRECTX_D3D_API (DIRECTX_11, api); +} diff --git a/sys/d3dvideosink/directx/directx11/dx11.h b/sys/d3dvideosink/directx/directx11/dx11.h new file mode 100644 index 0000000000..3df04a1a27 --- /dev/null +++ b/sys/d3dvideosink/directx/directx11/dx11.h @@ -0,0 +1,39 @@ +/* GStreamer + * Copyright (C) 2011 David Hoyt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __DIRECTX_DIRECTX11_DX11_H__ +#define __DIRECTX_DIRECTX11_DX11_H__ + +#include "../dx.h" + +#include "dx11_d3d.h" + +/* Function declarations */ +void dx11_init(const DirectXAPI* api); + +DIRECTX_API( + DIRECTX_11, + dx11_init, + "d3d11", + "D3D11CreateDevice", + "DirectX11Description", + "DirectX 11.0" +) + +#endif /* __DIRECTX_DIRECTX10_DX10_H__ */ diff --git a/sys/d3dvideosink/directx/directx11/dx11_d3d.c b/sys/d3dvideosink/directx/directx11/dx11_d3d.c new file mode 100644 index 0000000000..2b62b9cc7a --- /dev/null +++ b/sys/d3dvideosink/directx/directx11/dx11_d3d.c @@ -0,0 +1,75 @@ +/* GStreamer + * Copyright (C) 2011 David Hoyt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#define CINTERFACE + +#include +//#include + +#include "dx11_d3d.h" + +void +dx11_d3d_init (DirectXAPIComponent * component, gpointer data) +{ + DIRECTX_DEBUG ("Initializing Direct3D"); + DIRECTX_OPEN_COMPONENT_MODULE (component, "d3d11"); + DIRECTX_DEBUG ("Completed Initializing Direct3D"); + + DIRECTX_DEBUG ("Setting Direct3D dispatch table"); + //DIRECTX_OPEN_COMPONENT_SYMBOL(component, D3D11DispatchTable, D3D11CreateDevice); + + //{ + // ID3D11Device* pDevice = NULL; + // DIRECTX_DEBUG("Calling D3D11CreateDevice"); + // DX11_D3D_COMPONENT_CALL_FUNC(component, D3D11CreateDevice, NULL, D3D11_DRIVER_TYPE_HARDWARE, NULL, 0, D3D11_SDK_VERSION, &pDevice); + // DIRECTX_DEBUG("Releasing D3D11 device"); + // ID3D11Device_Release(pDevice); + // DIRECTX_DEBUG("Released D3D11 device"); + //} +} + +DirectXD3D * +dx11_d3d_create (const DirectXAPI * api) +{ + return NULL; +} + +gboolean +dx11_d3d_resize (const DirectXD3D * d3d) +{ + return TRUE; +} + +gboolean +dx11_d3d_device_lost (const DirectXD3D * d3d) +{ + return TRUE; +} + +gboolean +dx11_d3d_notify_device_reset (const DirectXD3D * d3d) +{ + return TRUE; +} + +gboolean +dx11_d3d_release (const DirectXD3D * d3d) +{ + return TRUE; +} diff --git a/sys/d3dvideosink/directx/directx11/dx11_d3d.h b/sys/d3dvideosink/directx/directx11/dx11_d3d.h new file mode 100644 index 0000000000..6eb158ba9c --- /dev/null +++ b/sys/d3dvideosink/directx/directx11/dx11_d3d.h @@ -0,0 +1,72 @@ +/* GStreamer + * Copyright (C) 2011 David Hoyt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __DIRECTX_DIRECTX11_DX11_D3D_H__ +#define __DIRECTX_DIRECTX11_DX11_D3D_H__ + +#include + +#include "../d3d.h" + +#define DX11_D3D_API_CALL_FUNC(api, func_name, ...) (DIRECTX_CALL_COMPONENT_SYMBOL(DIRECTX_D3D(api), D3D11DispatchTable, func_name, __VA_ARGS__)) +#define DX11_D3D_COMPONENT_CALL_FUNC(component, func_name, ...) (DIRECTX_CALL_COMPONENT_SYMBOL(component, D3D11DispatchTable, func_name, __VA_ARGS__)) + +/* Structs */ +typedef struct _D3D11 D3D11; +typedef struct _D3D11DispatchTable D3D11DispatchTable; + +/* Functions */ +/* Courtesy http://code.google.com/p/theaimworldeditor/source/browse/trunk/DXUT/Core/DXUTmisc.cpp */ +typedef HRESULT (WINAPI *LPD3D11CREATEDEVICE)(gpointer /* IDXGIAdapter* */, UINT /* D3D11_DRIVER_TYPE */, HMODULE, UINT, UINT32, gpointer* /* ID3D11Device** */ ); + +struct _D3D11DispatchTable +{ + LPD3D11CREATEDEVICE D3D11CreateDevice; +}; + +/* Global data */ +struct _D3D11 +{ + D3D11DispatchTable vtable; +}; + +/* Global vars */ +static D3D11 dx11_d3d; + +/* Function declarations */ + +void dx11_d3d_init(DirectXAPIComponent* component, gpointer data); +DirectXD3D* dx11_d3d_create(const DirectXAPI* api); +gboolean dx11_d3d_resize(const DirectXD3D* d3d); +gboolean dx11_d3d_device_lost(const DirectXD3D* d3d); +gboolean dx11_d3d_notify_device_reset(const DirectXD3D* d3d); +gboolean dx11_d3d_release(const DirectXD3D* d3d); + +DIRECTX_D3D_API( + DIRECTX_11, + dx11_d3d.vtable, + dx11_d3d_init, + dx11_d3d_create, + dx11_d3d_resize, + dx11_d3d_device_lost, + dx11_d3d_notify_device_reset, + dx11_d3d_release +) + +#endif /* __DIRECTX_DIRECTX11_DX11_D3D_H__ */ diff --git a/sys/d3dvideosink/directx/directx9/dx9.c b/sys/d3dvideosink/directx/directx9/dx9.c new file mode 100644 index 0000000000..6d39afa996 --- /dev/null +++ b/sys/d3dvideosink/directx/directx9/dx9.c @@ -0,0 +1,27 @@ +/* GStreamer + * Copyright (C) 2011 David Hoyt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "dx9.h" + +void +dx9_init (const DirectXAPI * api) +{ + DIRECTX_DEBUG ("Initializing DirectX9 API"); + INITIALIZE_DIRECTX_D3D_API (DIRECTX_9, api); +} diff --git a/sys/d3dvideosink/directx/directx9/dx9.h b/sys/d3dvideosink/directx/directx9/dx9.h new file mode 100644 index 0000000000..6fb64026ae --- /dev/null +++ b/sys/d3dvideosink/directx/directx9/dx9.h @@ -0,0 +1,38 @@ +/* GStreamer + * Copyright (C) 2011 David Hoyt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __DIRECTX_DIRECTX9_DX10_H__ +#define __DIRECTX_DIRECTX9_DX10_H__ + +#include "../dx.h" + +#include "dx9_d3d.h" + +void dx9_init(const DirectXAPI* api); + +DIRECTX_API( + DIRECTX_9, + dx9_init, + "d3d9", + "Direct3DCreate9", + "DirectX9Description", + "DirectX 9.0" +) + +#endif /* __DIRECTX_DIRECTX9_DX10_H__ */ diff --git a/sys/d3dvideosink/directx/directx9/dx9_d3d.c b/sys/d3dvideosink/directx/directx9/dx9_d3d.c new file mode 100644 index 0000000000..5b50aba0b4 --- /dev/null +++ b/sys/d3dvideosink/directx/directx9/dx9_d3d.c @@ -0,0 +1,73 @@ +/* GStreamer + * Copyright (C) 2011 David Hoyt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include + +#include "dx9_d3d.h" + +void +dx9_d3d_init (DirectXAPIComponent * component, gpointer data) +{ + DIRECTX_DEBUG ("Initializing Direct3D"); + DIRECTX_OPEN_COMPONENT_MODULE (component, "d3d9"); + + DIRECTX_DEBUG ("Setting Direct3D dispatch table"); + DIRECTX_OPEN_COMPONENT_SYMBOL (component, D3D9DispatchTable, Direct3DCreate9); + + //{ + // IDirect3D9* blah; + // DIRECTX_DEBUG("CALLING CREATE9!"); + // //blah = DX9_CALL_FUNC(data, Direct3DCreate9, D3D_SDK_VERSION); + // blah = DX9_D3D_COMPONENT_CALL_FUNC(component, Direct3DCreate9, D3D_SDK_VERSION); + // DIRECTX_DEBUG("RELEASING CREATE9!"); + // IDirect3D9_Release(blah); + // DIRECTX_DEBUG("RELEASED CREATE9!"); + //} +} + +DirectXD3D * +dx9_d3d_create (const DirectXAPI * api) +{ + return NULL; +} + +gboolean +dx9_d3d_resize (const DirectXD3D * d3d) +{ + return TRUE; +} + +gboolean +dx9_d3d_device_lost (const DirectXD3D * d3d) +{ + return TRUE; +} + +gboolean +dx9_d3d_notify_device_reset (const DirectXD3D * d3d) +{ + return TRUE; +} + +gboolean +dx9_d3d_release (const DirectXD3D * d3d) +{ + return TRUE; +} diff --git a/sys/d3dvideosink/directx/directx9/dx9_d3d.h b/sys/d3dvideosink/directx/directx9/dx9_d3d.h new file mode 100644 index 0000000000..28e27fe1eb --- /dev/null +++ b/sys/d3dvideosink/directx/directx9/dx9_d3d.h @@ -0,0 +1,71 @@ +/* GStreamer + * Copyright (C) 2011 David Hoyt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __DIRECTX_DIRECTX9_DX9_D3D_H__ +#define __DIRECTX_DIRECTX9_DX9_D3D_H__ + +#include + +#include "../d3d.h" + +#define DX9_D3D_API_CALL_FUNC(api, func_name, ...) (DIRECTX_CALL_COMPONENT_SYMBOL(DIRECTX_D3D(api), D3D9DispatchTable, func_name, __VA_ARGS__)) +#define DX9_D3D_COMPONENT_CALL_FUNC(component, func_name, ...) (DIRECTX_CALL_COMPONENT_SYMBOL(component, D3D9DispatchTable, func_name, __VA_ARGS__)) + +/* Structs */ +typedef struct _D3D9 D3D9; +typedef struct _D3D9DispatchTable D3D9DispatchTable; + +/* Functions */ +typedef gpointer /* IDirect3D9* */ (WINAPI *LPDIRECT3DCREATE9) (UINT); + +struct _D3D9DispatchTable +{ + LPDIRECT3DCREATE9 Direct3DCreate9; +}; + +/* Global data */ +struct _D3D9 +{ + D3D9DispatchTable vtable; +}; + +/* Global vars */ +static D3D9 dx9_d3d; + +/* Function declarations */ + +void dx9_d3d_init(DirectXAPIComponent* component, gpointer data); +DirectXD3D* dx9_d3d_create(const DirectXAPI* api); +gboolean dx9_d3d_resize(const DirectXD3D* d3d); +gboolean dx9_d3d_device_lost(const DirectXD3D* d3d); +gboolean dx9_d3d_notify_device_reset(const DirectXD3D* d3d); +gboolean dx9_d3d_release(const DirectXD3D* d3d); + +DIRECTX_D3D_API( + DIRECTX_9, + dx9_d3d.vtable, + dx9_d3d_init, + dx9_d3d_create, + dx9_d3d_resize, + dx9_d3d_device_lost, + dx9_d3d_notify_device_reset, + dx9_d3d_release +) + +#endif /* __DIRECTX_DIRECTX9_DX9_D3D_H__ */ diff --git a/sys/d3dvideosink/directx/dx.c b/sys/d3dvideosink/directx/dx.c new file mode 100644 index 0000000000..b52e51f564 --- /dev/null +++ b/sys/d3dvideosink/directx/dx.c @@ -0,0 +1,282 @@ +/* GStreamer + * Copyright (C) 2011 David Hoyt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include +#include + +#include "dx.h" +#include "directx9/dx9.h" +#include "directx10/dx10.h" +#include "directx11/dx11.h" + + + +static void +init_supported_apis (void) +{ + /* Gather information we'll need about each version of DirectX. */ + /* Insert in reverse order of desired priority due to the g_list_prepend() call in directx_determine_best_available_api(). */ + INITIALIZE_SUPPORTED_DIRECTX_API (DIRECTX_9); + /* TODO: Add DirectX 10 support. */ + /*INITIALIZE_SUPPORTED_DIRECTX_API(DIRECTX_10); */ + /* TODO: Add DirectX 11 support. */ + /*INITIALIZE_SUPPORTED_DIRECTX_API(DIRECTX_11); */ +} + + + +/* Function declarations */ +static DirectXAPI *directx_determine_best_available_api (void); + +/* Mutex macros */ +#define DIRECTX_LOCK g_static_rec_mutex_lock (&dx_lock); +#define DIRECTX_UNLOCK g_static_rec_mutex_unlock (&dx_lock); + +typedef struct _DirectXInfo DirectXInfo; +struct _DirectXInfo +{ + gboolean initialized; + gboolean supported; + + DirectXInitParams *init_params; + DirectXAPI *best_api; + GList *supported_api_list; + gint32 supported_api_count; +}; + +/* Private vars */ +static DirectXInfo dx; +static GStaticRecMutex dx_lock = G_STATIC_REC_MUTEX_INIT; + +gboolean +directx_initialize (DirectXInitParams * init_params) +{ + DIRECTX_LOCK if (dx.initialized) + goto success; + + dx.init_params = NULL; + dx.init_params = init_params; + + init_supported_apis (); + + dx.best_api = directx_determine_best_available_api (); + dx.supported = (dx.best_api != NULL + && !DIRECTX_VERSION_IS_UNKNOWN (dx.best_api->version)); + dx.initialized = TRUE; + +success: + DIRECTX_UNLOCK return TRUE; +} + +gboolean +directx_api_initialize (DirectXAPI * api) +{ + if (!api) + return FALSE; + + DIRECTX_LOCK if (!directx_is_initialized ()) + goto error; + + if (api->initialized) + goto success; + + /* API init */ + api->initialize (api); + + /* Component initialization */ + DIRECTX_COMPONENT_INIT (DIRECTX_D3D (api)); + DIRECTX_COMPONENT_INIT (DIRECTX_DINPUT (api)); + DIRECTX_COMPONENT_INIT (DIRECTX_DSOUND (api)); + DIRECTX_COMPONENT_INIT (DIRECTX_DWRITE (api)); + DIRECTX_COMPONENT_INIT (DIRECTX_D2D (api)); + DIRECTX_COMPONENT_INIT (DIRECTX_DCOMPUTE (api)); + + /* All done */ + api->initialized = TRUE; + +success: + DIRECTX_UNLOCK return TRUE; +error: + DIRECTX_UNLOCK return FALSE; +} + +gboolean +directx_initialize_best_available_api (void) +{ + return directx_api_initialize (directx_get_best_available_api ()); +} + +gboolean +directx_is_initialized (void) +{ + gboolean initialized = FALSE; + + DIRECTX_LOCK initialized = dx.initialized; + DIRECTX_UNLOCK return initialized; +} + +gboolean +directx_api_is_initialized (const DirectXAPI * api) +{ + if (!api) + return FALSE; + { + gboolean initialized; + + DIRECTX_LOCK initialized = api->initialized; + DIRECTX_UNLOCK return initialized; + } +} + +gboolean +directx_best_available_api_is_initialized (void) +{ + return directx_api_is_initialized (directx_get_best_available_api ()); +} + +gboolean +directx_is_supported (void) +{ + return dx.supported; +} + +GList * +directx_get_supported_apis (void) +{ + return dx.supported_api_list; +} + +gint32 +directx_get_supported_api_count (void) +{ + return dx.supported_api_count; +} + +DirectXAPI * +directx_get_best_available_api (void) +{ + return dx.best_api; +} + +void +directx_log_debug (const gchar * file, const gchar * function, gint line, + const gchar * format, ...) +{ + if (!dx.init_params || !dx.init_params->log_debug) + return; + { + va_list args; + va_start (args, format); + dx.init_params->log_debug (file, function, line, format, args); + va_end (args); + } +} + +void +directx_log_warning (const gchar * file, const gchar * function, gint line, + const gchar * format, ...) +{ + if (!dx.init_params || !dx.init_params->log_warning) + return; + { + va_list args; + va_start (args, format); + dx.init_params->log_warning (file, function, line, format, args); + va_end (args); + } +} + +void +directx_log_error (const gchar * file, const gchar * function, gint line, + const gchar * format, ...) +{ + if (!dx.init_params || !dx.init_params->log_error) + return; + { + va_list args; + va_start (args, format); + dx.init_params->log_error (file, function, line, format, args); + va_end (args); + } +} + +/* This should only be called through use of the DIRECTX_API() macro. It should never be called directly. */ +gboolean +directx_add_supported_api (DirectXAPI * api) +{ + if (!api) + return FALSE; + + DIRECTX_LOCK { + + /* Add to our GList containing all of our supported APIs. */ + /* GLists are doubly-linked lists and calling prepend() prevents it from having to traverse the entire list just to add one item. */ + dx.supported_api_list = g_list_prepend (dx.supported_api_list, api); + dx.supported_api_count++; + + } +/*success:*/ + DIRECTX_UNLOCK return TRUE; +} + +static DirectXAPI * +directx_determine_best_available_api (void) +{ + if (!g_module_supported ()) + return NULL; + + { + GList *item; + GModule *lib; + DirectXAPI *dxlib = NULL; + + DIRECTX_LOCK { + /* Search supported APIs (DirectX9, DirectX10, etc.) looking for the first one that works. */ + DIRECTX_DEBUG + ("Searching supported DirectX APIs for the best (most recent) one available"); + for (item = g_list_first (dx.supported_api_list); item; item = item->next) { + if ((dxlib = (DirectXAPI *) item->data) == NULL) + continue; + + DIRECTX_DEBUG ("Determining support for %s", dxlib->description); + DIRECTX_DEBUG ("Searching for module \"%s\" with the symbol \"%s\"", + dxlib->module_test, dxlib->symbol_test); + + /* Can we locate and open a Direct3D library (e.g. d3d9.dll or d3d10.dll)? */ + if ((lib = + g_module_open (dxlib->module_test, + G_MODULE_BIND_LAZY)) != NULL) { + /* Look for a symbol/function (e.g. "Direct3DCreate9") in the module and if it exists, we found one! */ + gpointer symbol; + if (g_module_symbol (lib, dxlib->symbol_test, &symbol)) { + g_module_close (lib); + DIRECTX_DEBUG ("Selected %s", dxlib->description); + goto done; + } + /* Ensure we don't have a mem leak. */ + g_module_close (lib); + } + } + + } + done: + DIRECTX_UNLOCK return dxlib; + } +} diff --git a/sys/d3dvideosink/directx/dx.h b/sys/d3dvideosink/directx/dx.h new file mode 100644 index 0000000000..60dd6d869c --- /dev/null +++ b/sys/d3dvideosink/directx/dx.h @@ -0,0 +1,265 @@ +/* GStreamer + * Copyright (C) 2011 David Hoyt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __DIRECTX_DX_H__ +#define __DIRECTX_DX_H__ + +#include +#include + +G_BEGIN_DECLS + +#define WM_DIRECTX WM_USER + 500 + +#define DIRECTX_VERSION_UNKNOWN 0 + +#define DIRECTX_VERSION_ENCODE_FULL(major, minor, micro) ( \ + ((major) * 10000) \ + + ((minor) * 100) \ + + ((micro) * 1)) + +#define DIRECTX_VERSION_ENCODE(major) \ + DIRECTX_VERSION_ENCODE_FULL(major, 0, 0) + +typedef enum +{ + DIRECTX_UNKNOWN = DIRECTX_VERSION_UNKNOWN, + DIRECTX_9 = DIRECTX_VERSION_ENCODE(9), + DIRECTX_10 = DIRECTX_VERSION_ENCODE(10), + DIRECTX_10_1 = DIRECTX_VERSION_ENCODE_FULL(10, 1, 0), + DIRECTX_11 = DIRECTX_VERSION_ENCODE(11) +} DirectXVersion; + +#define DIRECTX_API(version, initialization_function, module_test, symbol_test, i18n_key, description) \ + static DirectXAPIComponent DIRECTX_ ## version ## _DIRECT3D_COMPONENT = { \ + NULL /*api*/ \ + , FALSE /*initialized*/ \ + , NULL /*initialize*/ \ + , NULL /*module*/ \ + , NULL /*module_name*/ \ + , NULL /*private_data*/ \ + }; \ + static DirectXAPIComponent DIRECTX_ ## version ## _DIRECTINPUT_COMPONENT = { \ + NULL /*api*/ \ + , FALSE /*initialized*/ \ + , NULL /*initialize*/ \ + , NULL /*module*/ \ + , NULL /*module_name*/ \ + , NULL /*private_data*/ \ + }; \ + static DirectXAPIComponent DIRECTX_ ## version ## _DIRECTSOUND_COMPONENT = { \ + NULL /*api*/ \ + , FALSE /*initialized*/ \ + , NULL /*initialize*/ \ + , NULL /*module*/ \ + , NULL /*module_name*/ \ + , NULL /*private_data*/ \ + }; \ + static DirectXAPIComponent DIRECTX_ ## version ## _DIRECTWRITE_COMPONENT = { \ + NULL /*api*/ \ + , FALSE /*initialized*/ \ + , NULL /*initialize*/ \ + , NULL /*module*/ \ + , NULL /*module_name*/ \ + , NULL /*private_data*/ \ + }; \ + static DirectXAPIComponent DIRECTX_ ## version ## _DIRECT2D_COMPONENT = { \ + NULL /*api*/ \ + , FALSE /*initialized*/ \ + , NULL /*initialize*/ \ + , NULL /*module*/ \ + , NULL /*module_name*/ \ + , NULL /*private_data*/ \ + }; \ + static DirectXAPIComponent DIRECTX_ ## version ## _DIRECTCOMPUTE_COMPONENT = { \ + NULL /*api*/ \ + , FALSE /*initialized*/ \ + , NULL /*initialize*/ \ + , NULL /*module*/ \ + , NULL /*module_name*/ \ + , NULL /*private_data*/ \ + }; \ + static DirectXAPI DIRECTX_ ## version ## _API = { \ + version \ + , module_test "." G_MODULE_SUFFIX \ + , symbol_test \ + , i18n_key \ + , description \ + , FALSE \ + , initialization_function \ + , &DIRECTX_ ## version ## _DIRECT3D_COMPONENT \ + , &DIRECTX_ ## version ## _DIRECTINPUT_COMPONENT \ + , &DIRECTX_ ## version ## _DIRECTSOUND_COMPONENT \ + , &DIRECTX_ ## version ## _DIRECTWRITE_COMPONENT \ + , &DIRECTX_ ## version ## _DIRECT2D_COMPONENT \ + , &DIRECTX_ ## version ## _DIRECTCOMPUTE_COMPONENT \ + , {NULL, NULL, NULL} /*reserved*/ \ + }; \ + static void init_directx_ ## version ## _supported_api(void) { \ + DirectXAPI* api; \ + api = &DIRECTX_ ## version ## _API; \ + api->d3d->api = api; \ + api->dinput->api = api; \ + api->dsound->api = api; \ + api->dwrite->api = api; \ + api->d2d->api = api; \ + api->dcompute->api = api; \ + directx_add_supported_api(api); \ + } + +#define INITIALIZE_SUPPORTED_DIRECTX_API(version) \ + init_directx_ ## version ## _supported_api(); + +#define DIRECTX_COMPONENT_INIT(component) \ + { \ + if (component != NULL && component->initialize != NULL && !component->initialized) { \ + component->initialize(component, DIRECTX_COMPONENT_DATA(component)); \ + } \ + } + +#define DIRECTX_OPEN_COMPONENT_MODULE(component, component_module_name) \ + { \ + GModule* lib; \ + if (component && component->module == NULL && (lib = g_module_open(component_module_name "." G_MODULE_SUFFIX, G_MODULE_BIND_LAZY)) != NULL) { \ + component->module_name = component_module_name "." G_MODULE_SUFFIX; \ + component->module = lib; \ + } \ + } + +#define DIRECTX_OPEN_COMPONENT_SYMBOL(component, dispatch_table_type, component_symbol_name) \ + { \ + gpointer symbol; \ + if (component && component->module && g_module_symbol(component->module, #component_symbol_name, &symbol)) { \ + ((dispatch_table_type*)component->vtable)->component_symbol_name = symbol; \ + } \ + } + +#define DIRECTX_CALL_COMPONENT_SYMBOL(component, dispatch_table_type, component_symbol_name, ...) \ + (((dispatch_table_type*)component->vtable)->component_symbol_name(__VA_ARGS__)) + + +/* Borrowed from GST_FUNCTION */ +#ifndef DIRECTX_FUNCTION +#if defined (__GNUC__) || (defined (_MSC_VER) && _MSC_VER >= 1300) +# define DIRECTX_FUNCTION ((const char*) (__FUNCTION__)) +#elif defined (__STDC__) && defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +# define DIRECTX_FUNCTION ((const char*) (__func__)) +#else +# define DIRECTX_FUNCTION ((const char*) ("???")) +#endif +#endif + +#define DIRECTX_DEBUG(...) (directx_log_debug(__FILE__, DIRECTX_FUNCTION, __LINE__, __VA_ARGS__)) +#define DIRECTX_WARNING(...) (directx_log_warning(__FILE__, DIRECTX_FUNCTION, __LINE__, __VA_ARGS__)) +#define DIRECTX_ERROR(...) (directx_log_error(__FILE__, DIRECTX_FUNCTION, __LINE__, __VA_ARGS__)) + +#define DIRECTX_COMPONENT_API(component) (component->api) +#define DIRECTX_COMPONENT_DATA(component) (component->private_data) +#define DIRECTX_SET_COMPONENT_DATA(component, data) (component->private_data = data) +#define DIRECTX_SET_COMPONENT_INIT(component, init_function) (component->initialize = init_function) +#define DIRECTX_SET_COMPONENT_DISPATCH_TABLE(component, dispatch_table) (component->vtable = dispatch_table) +#define DIRECTX_VERSION_IS_UNKNOWN(version) (version == DIRECTX_VERSION_UNKNOWN) +#define DIRECTX_SUPPORTED_API_IS_LAST(lib) (lib == NULL || lib->version == DIRECTX_VERSION_UNKNOWN || lib->module_name == NULL) + +typedef struct _DirectXInitParams DirectXInitParams; +typedef struct _DirectXAPI DirectXAPI; +typedef struct _DirectXAPIComponent DirectXAPIComponent; + +/* Function pointers */ +typedef void (*DirectXInitializationFunction) (const DirectXAPI* api); +typedef void (*DirectXLogFunction) (const gchar* file, const gchar* function, gint line, const gchar* format, va_list args); /* vprintf-style logging function */ + +struct _DirectXInitParams +{ + DirectXLogFunction log_debug; + DirectXLogFunction log_warning; + DirectXLogFunction log_error; +}; + +struct _DirectXAPI +{ + gint version; + const gchar* module_test; + const gchar* symbol_test; + const gchar* i18n_key; + const gchar* description; + gboolean initialized; + DirectXInitializationFunction initialize; + DirectXAPIComponent* d3d; + DirectXAPIComponent* dinput; + DirectXAPIComponent* dsound; + DirectXAPIComponent* dwrite; + DirectXAPIComponent* d2d; + DirectXAPIComponent* dcompute; + gpointer reserved[3]; +}; + +#define DIRECTX_D3D(api) (api->d3d) +#define DIRECTX_DINPUT(api) (api->dinput) +#define DIRECTX_DSOUND(api) (api->dsound) +#define DIRECTX_DWRITE(api) (api->dwrite) +#define DIRECTX_D2D(api) (api->d2d) +#define DIRECTX_DCOMPUTE(api) (api->dcompute) + +#define DIRECTX_D3D_COMPONENT_DATA(api) (DIRECTX_COMPONENT_DATA(DIRECTX_D3D(api))) +#define DIRECTX_DINPUT_COMPONENT_DATA(api) (DIRECTX_COMPONENT_DATA(DIRECTX_DINPUT(api))) +#define DIRECTX_DSOUND_COMPONENT_DATA(api) (DIRECTX_COMPONENT_DATA(DIRECTX_DSOUND(api))) +#define DIRECTX_DWRITE_COMPONENT_DATA(api) (DIRECTX_COMPONENT_DATA(DIRECTX_DWRITE(api))) +#define DIRECTX_D2D_COMPONENT_DATA(api) (DIRECTX_COMPONENT_DATA(DIRECTX_D2D(api))) +#define DIRECTX_DCOMPUTE_COMPONENT_DATA(api) (DIRECTX_COMPONENT_DATA(DIRECTX_DCOMPUTE(api))) + +/* DirectX component function table */ +typedef void (*DirectXComponentInitializeFunction) (DirectXAPIComponent* d3d, gpointer data); +struct _DirectXAPIComponent +{ + DirectXAPI* api; + gboolean initialized; + DirectXComponentInitializeFunction initialize; + + GModule* module; + const gchar* module_name; + + gpointer vtable; + + gpointer private_data; +}; + +gboolean directx_initialize (DirectXInitParams* init_params); +gboolean directx_is_initialized (void); + +gboolean directx_is_supported (void); + +void directx_log_debug(const gchar* file, const gchar* function, gint line, const gchar * format, ...); +void directx_log_warning(const gchar* file, const gchar* function, gint line, const gchar * format, ...); +void directx_log_error(const gchar* file, const gchar* function, gint line, const gchar * format, ...); + +GList* directx_get_supported_apis (void); +gint32 directx_get_supported_api_count (void); +gboolean directx_add_supported_api (DirectXAPI* api); + +DirectXAPI* directx_get_best_available_api (void); +gboolean directx_initialize_best_available_api (void); +gboolean directx_best_available_api_is_initialized (void); + +gboolean directx_api_initialize (DirectXAPI* api); +gboolean directx_api_is_initialized (const DirectXAPI* api); + +G_END_DECLS + +#endif /* __DIRECTX_DX_H__ */ diff --git a/sys/decklink/DeckLinkAPI.h b/sys/decklink/DeckLinkAPI.h new file mode 100644 index 0000000000..19eb07e9cd --- /dev/null +++ b/sys/decklink/DeckLinkAPI.h @@ -0,0 +1,1095 @@ +/* -LICENSE-START- +** Copyright (c) 2009 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation covered by +** this license (the "Software") to use, reproduce, display, distribute, +** execute, and transmit the Software, and to prepare derivative works of the +** Software, and to permit third-parties to whom the Software is furnished to +** do so, all subject to the following: +** +** The copyright notices in the Software and this entire statement, including +** the above license grant, this restriction and the following disclaimer, +** must be included in all copies of the Software, in whole or in part, and +** all derivative works of the Software, unless such copies or derivative +** works are solely in the form of machine-executable object code generated by +** a source language processor. +** +** 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** -LICENSE-END- +*/ + +/* DeckLinkAPI.h */ + +#ifndef __DeckLink_API_h__ +#define __DeckLink_API_h__ + +#include +#include "LinuxCOM.h" + +#define BLACKMAGIC_DECKLINK_API_MAGIC 1 + +// Type Declarations + +typedef int64_t BMDTimeValue; +typedef int64_t BMDTimeScale; +typedef uint32_t BMDTimecodeBCD; +typedef uint32_t BMDTimecodeUserBits; + + +// Interface ID Declarations + +#define IID_IDeckLinkVideoOutputCallback /* 20AA5225-1958-47CB-820B-80A8D521A6EE */ (REFIID){0x20,0xAA,0x52,0x25,0x19,0x58,0x47,0xCB,0x82,0x0B,0x80,0xA8,0xD5,0x21,0xA6,0xEE} +#define IID_IDeckLinkInputCallback /* DD04E5EC-7415-42AB-AE4A-E80C4DFC044A */ (REFIID){0xDD,0x04,0xE5,0xEC,0x74,0x15,0x42,0xAB,0xAE,0x4A,0xE8,0x0C,0x4D,0xFC,0x04,0x4A} +#define IID_IDeckLinkMemoryAllocator /* B36EB6E7-9D29-4AA8-92EF-843B87A289E8 */ (REFIID){0xB3,0x6E,0xB6,0xE7,0x9D,0x29,0x4A,0xA8,0x92,0xEF,0x84,0x3B,0x87,0xA2,0x89,0xE8} +#define IID_IDeckLinkAudioOutputCallback /* 403C681B-7F46-4A12-B993-2BB127084EE6 */ (REFIID){0x40,0x3C,0x68,0x1B,0x7F,0x46,0x4A,0x12,0xB9,0x93,0x2B,0xB1,0x27,0x08,0x4E,0xE6} +#define IID_IDeckLinkIterator /* 74E936FC-CC28-4A67-81A0-1E94E52D4E69 */ (REFIID){0x74,0xE9,0x36,0xFC,0xCC,0x28,0x4A,0x67,0x81,0xA0,0x1E,0x94,0xE5,0x2D,0x4E,0x69} +#define IID_IDeckLinkAPIInformation /* 7BEA3C68-730D-4322-AF34-8A7152B532A4 */ (REFIID){0x7B,0xEA,0x3C,0x68,0x73,0x0D,0x43,0x22,0xAF,0x34,0x8A,0x71,0x52,0xB5,0x32,0xA4} +#define IID_IDeckLinkDisplayModeIterator /* 9C88499F-F601-4021-B80B-032E4EB41C35 */ (REFIID){0x9C,0x88,0x49,0x9F,0xF6,0x01,0x40,0x21,0xB8,0x0B,0x03,0x2E,0x4E,0xB4,0x1C,0x35} +#define IID_IDeckLinkDisplayMode /* 3EB2C1AB-0A3D-4523-A3AD-F40D7FB14E78 */ (REFIID){0x3E,0xB2,0xC1,0xAB,0x0A,0x3D,0x45,0x23,0xA3,0xAD,0xF4,0x0D,0x7F,0xB1,0x4E,0x78} +#define IID_IDeckLink /* 62BFF75D-6569-4E55-8D4D-66AA03829ABC */ (REFIID){0x62,0xBF,0xF7,0x5D,0x65,0x69,0x4E,0x55,0x8D,0x4D,0x66,0xAA,0x03,0x82,0x9A,0xBC} +#define IID_IDeckLinkOutput /* A3EF0963-0862-44ED-92A9-EE89ABF431C7 */ (REFIID){0xA3,0xEF,0x09,0x63,0x08,0x62,0x44,0xED,0x92,0xA9,0xEE,0x89,0xAB,0xF4,0x31,0xC7} +#define IID_IDeckLinkInput /* 6D40EF78-28B9-4E21-990D-95BB7750A04F */ (REFIID){0x6D,0x40,0xEF,0x78,0x28,0xB9,0x4E,0x21,0x99,0x0D,0x95,0xBB,0x77,0x50,0xA0,0x4F} +#define IID_IDeckLinkTimecode /* BC6CFBD3-8317-4325-AC1C-1216391E9340 */ (REFIID){0xBC,0x6C,0xFB,0xD3,0x83,0x17,0x43,0x25,0xAC,0x1C,0x12,0x16,0x39,0x1E,0x93,0x40} +#define IID_IDeckLinkVideoFrame /* 3F716FE0-F023-4111-BE5D-EF4414C05B17 */ (REFIID){0x3F,0x71,0x6F,0xE0,0xF0,0x23,0x41,0x11,0xBE,0x5D,0xEF,0x44,0x14,0xC0,0x5B,0x17} +#define IID_IDeckLinkMutableVideoFrame /* 69E2639F-40DA-4E19-B6F2-20ACE815C390 */ (REFIID){0x69,0xE2,0x63,0x9F,0x40,0xDA,0x4E,0x19,0xB6,0xF2,0x20,0xAC,0xE8,0x15,0xC3,0x90} +#define IID_IDeckLinkVideoFrame3DExtensions /* DA0F7E4A-EDC7-48A8-9CDD-2DB51C729CD7 */ (REFIID){0xDA,0x0F,0x7E,0x4A,0xED,0xC7,0x48,0xA8,0x9C,0xDD,0x2D,0xB5,0x1C,0x72,0x9C,0xD7} +#define IID_IDeckLinkVideoInputFrame /* 05CFE374-537C-4094-9A57-680525118F44 */ (REFIID){0x05,0xCF,0xE3,0x74,0x53,0x7C,0x40,0x94,0x9A,0x57,0x68,0x05,0x25,0x11,0x8F,0x44} +#define IID_IDeckLinkVideoFrameAncillary /* 732E723C-D1A4-4E29-9E8E-4A88797A0004 */ (REFIID){0x73,0x2E,0x72,0x3C,0xD1,0xA4,0x4E,0x29,0x9E,0x8E,0x4A,0x88,0x79,0x7A,0x00,0x04} +#define IID_IDeckLinkAudioInputPacket /* E43D5870-2894-11DE-8C30-0800200C9A66 */ (REFIID){0xE4,0x3D,0x58,0x70,0x28,0x94,0x11,0xDE,0x8C,0x30,0x08,0x00,0x20,0x0C,0x9A,0x66} +#define IID_IDeckLinkScreenPreviewCallback /* B1D3F49A-85FE-4C5D-95C8-0B5D5DCCD438 */ (REFIID){0xB1,0xD3,0xF4,0x9A,0x85,0xFE,0x4C,0x5D,0x95,0xC8,0x0B,0x5D,0x5D,0xCC,0xD4,0x38} +#define IID_IDeckLinkGLScreenPreviewHelper /* 504E2209-CAC7-4C1A-9FB4-C5BB6274D22F */ (REFIID){0x50,0x4E,0x22,0x09,0xCA,0xC7,0x4C,0x1A,0x9F,0xB4,0xC5,0xBB,0x62,0x74,0xD2,0x2F} +#define IID_IDeckLinkConfiguration /* C679A35B-610C-4D09-B748-1D0478100FC0 */ (REFIID){0xC6,0x79,0xA3,0x5B,0x61,0x0C,0x4D,0x09,0xB7,0x48,0x1D,0x04,0x78,0x10,0x0F,0xC0} +#define IID_IDeckLinkAttributes /* ABC11843-D966-44CB-96E2-A1CB5D3135C4 */ (REFIID){0xAB,0xC1,0x18,0x43,0xD9,0x66,0x44,0xCB,0x96,0xE2,0xA1,0xCB,0x5D,0x31,0x35,0xC4} +#define IID_IDeckLinkKeyer /* 89AFCAF5-65F8-421E-98F7-96FE5F5BFBA3 */ (REFIID){0x89,0xAF,0xCA,0xF5,0x65,0xF8,0x42,0x1E,0x98,0xF7,0x96,0xFE,0x5F,0x5B,0xFB,0xA3} +#define IID_IDeckLinkVideoConversion /* 3BBCB8A2-DA2C-42D9-B5D8-88083644E99A */ (REFIID){0x3B,0xBC,0xB8,0xA2,0xDA,0x2C,0x42,0xD9,0xB5,0xD8,0x88,0x08,0x36,0x44,0xE9,0x9A} +#define IID_IDeckLinkDeckControlStatusCallback /* E5F693C1-4283-4716-B18F-C1431521955B */ (REFIID){0xE5,0xF6,0x93,0xC1,0x42,0x83,0x47,0x16,0xB1,0x8F,0xC1,0x43,0x15,0x21,0x95,0x5B} +#define IID_IDeckLinkDeckControl /* A4D81043-0619-42B7-8ED6-602D29041DF7 */ (REFIID){0xA4,0xD8,0x10,0x43,0x06,0x19,0x42,0xB7,0x8E,0xD6,0x60,0x2D,0x29,0x04,0x1D,0xF7} + + +/* Enum BMDDisplayMode - Video display modes */ + +typedef uint32_t BMDDisplayMode; +enum _BMDDisplayMode { + + /* SD Modes */ + + bmdModeNTSC = /* 'ntsc' */ 0x6E747363, + bmdModeNTSC2398 = /* 'nt23' */ 0x6E743233, // 3:2 pulldown + bmdModePAL = /* 'pal ' */ 0x70616C20, + bmdModeNTSCp = /* 'ntsp' */ 0x6E747370, + bmdModePALp = /* 'palp' */ 0x70616C70, + + /* HD 1080 Modes */ + + bmdModeHD1080p2398 = /* '23ps' */ 0x32337073, + bmdModeHD1080p24 = /* '24ps' */ 0x32347073, + bmdModeHD1080p25 = /* 'Hp25' */ 0x48703235, + bmdModeHD1080p2997 = /* 'Hp29' */ 0x48703239, + bmdModeHD1080p30 = /* 'Hp30' */ 0x48703330, + bmdModeHD1080i50 = /* 'Hi50' */ 0x48693530, + bmdModeHD1080i5994 = /* 'Hi59' */ 0x48693539, + bmdModeHD1080i6000 = /* 'Hi60' */ 0x48693630, // N.B. This _really_ is 60.00 Hz. + bmdModeHD1080p50 = /* 'Hp50' */ 0x48703530, + bmdModeHD1080p5994 = /* 'Hp59' */ 0x48703539, + bmdModeHD1080p6000 = /* 'Hp60' */ 0x48703630, // N.B. This _really_ is 60.00 Hz. + + /* HD 720 Modes */ + + bmdModeHD720p50 = /* 'hp50' */ 0x68703530, + bmdModeHD720p5994 = /* 'hp59' */ 0x68703539, + bmdModeHD720p60 = /* 'hp60' */ 0x68703630, + + /* 2k Modes */ + + bmdMode2k2398 = /* '2k23' */ 0x326B3233, + bmdMode2k24 = /* '2k24' */ 0x326B3234, + bmdMode2k25 = /* '2k25' */ 0x326B3235 +}; + + +/* Enum BMDFieldDominance - Video field dominance */ + +typedef uint32_t BMDFieldDominance; +enum _BMDFieldDominance { + bmdUnknownFieldDominance = 0, + bmdLowerFieldFirst = /* 'lowr' */ 0x6C6F7772, + bmdUpperFieldFirst = /* 'uppr' */ 0x75707072, + bmdProgressiveFrame = /* 'prog' */ 0x70726F67, + bmdProgressiveSegmentedFrame = /* 'psf ' */ 0x70736620 +}; + + +/* Enum BMDPixelFormat - Video pixel formats supported for output/input */ + +typedef uint32_t BMDPixelFormat; +enum _BMDPixelFormat { + bmdFormat8BitYUV = /* '2vuy' */ 0x32767579, + bmdFormat10BitYUV = /* 'v210' */ 0x76323130, + bmdFormat8BitARGB = 32, + bmdFormat8BitBGRA = /* 'BGRA' */ 0x42475241, + bmdFormat10BitRGB = /* 'r210' */ 0x72323130 // Big-endian RGB 10-bit per component with SMPTE video levels (64-960). Packed as 2:10:10:10 +}; + + +/* Enum BMDDisplayModeFlags - Flags to describe the characteristics of an IDeckLinkDisplayMode. */ + +typedef uint32_t BMDDisplayModeFlags; +enum _BMDDisplayModeFlags { + bmdDisplayModeSupports3D = 1 << 0, + bmdDisplayModeColorspaceRec601 = 1 << 1, + bmdDisplayModeColorspaceRec709 = 1 << 2 +}; + + +/* Enum BMDVideoOutputFlags - Flags to control the output of ancillary data along with video. */ + +typedef uint32_t BMDVideoOutputFlags; +enum _BMDVideoOutputFlags { + bmdVideoOutputFlagDefault = 0, + bmdVideoOutputVANC = 1 << 0, + bmdVideoOutputVITC = 1 << 1, + bmdVideoOutputRP188 = 1 << 2, + bmdVideoOutputDualStream3D = 1 << 4 +}; + + +/* Enum BMDFrameFlags - Frame flags */ + +typedef uint32_t BMDFrameFlags; +enum _BMDFrameFlags { + bmdFrameFlagDefault = 0, + bmdFrameFlagFlipVertical = 1 << 0, + + /* Flags that are applicable only to instances of IDeckLinkVideoInputFrame */ + + bmdFrameHasNoInputSource = 1 << 31 +}; + + +/* Enum BMDVideoInputFlags - Flags applicable to video input */ + +typedef uint32_t BMDVideoInputFlags; +enum _BMDVideoInputFlags { + bmdVideoInputFlagDefault = 0, + bmdVideoInputEnableFormatDetection = 1 << 0, + bmdVideoInputDualStream3D = 1 << 1 +}; + + +/* Enum BMDVideoInputFormatChangedEvents - Bitmask passed to the VideoInputFormatChanged notification to identify the properties of the input signal that have changed */ + +typedef uint32_t BMDVideoInputFormatChangedEvents; +enum _BMDVideoInputFormatChangedEvents { + bmdVideoInputDisplayModeChanged = 1 << 0, + bmdVideoInputFieldDominanceChanged = 1 << 1, + bmdVideoInputColorspaceChanged = 1 << 2 +}; + + +/* Enum BMDDetectedVideoInputFormatFlags - Flags passed to the VideoInputFormatChanged notification to describe the detected video input signal */ + +typedef uint32_t BMDDetectedVideoInputFormatFlags; +enum _BMDDetectedVideoInputFormatFlags { + bmdDetectedVideoInputYCbCr422 = 1 << 0, + bmdDetectedVideoInputRGB444 = 1 << 1 +}; + + +/* Enum BMDOutputFrameCompletionResult - Frame Completion Callback */ + +typedef uint32_t BMDOutputFrameCompletionResult; +enum _BMDOutputFrameCompletionResult { + bmdOutputFrameCompleted, + bmdOutputFrameDisplayedLate, + bmdOutputFrameDropped, + bmdOutputFrameFlushed +}; + + +/* Enum BMDReferenceStatus - GenLock input status */ + +typedef uint32_t BMDReferenceStatus; +enum _BMDReferenceStatus { + bmdReferenceNotSupportedByHardware = 1 << 0, + bmdReferenceLocked = 1 << 1 +}; + + +/* Enum BMDAudioSampleRate - Audio sample rates supported for output/input */ + +typedef uint32_t BMDAudioSampleRate; +enum _BMDAudioSampleRate { + bmdAudioSampleRate48kHz = 48000 +}; + + +/* Enum BMDAudioSampleType - Audio sample sizes supported for output/input */ + +typedef uint32_t BMDAudioSampleType; +enum _BMDAudioSampleType { + bmdAudioSampleType16bitInteger = 16, + bmdAudioSampleType32bitInteger = 32 +}; + + +/* Enum BMDAudioOutputStreamType - Audio output stream type */ + +typedef uint32_t BMDAudioOutputStreamType; +enum _BMDAudioOutputStreamType { + bmdAudioOutputStreamContinuous, + bmdAudioOutputStreamContinuousDontResample, + bmdAudioOutputStreamTimestamped +}; + + +/* Enum BMDDisplayModeSupport - Output mode supported flags */ + +typedef uint32_t BMDDisplayModeSupport; +enum _BMDDisplayModeSupport { + bmdDisplayModeNotSupported = 0, + bmdDisplayModeSupported, + bmdDisplayModeSupportedWithConversion +}; + + +/* Enum BMDTimecodeFormat - Timecode formats for frame metadata */ + +typedef uint32_t BMDTimecodeFormat; +enum _BMDTimecodeFormat { + bmdTimecodeRP188 = /* 'rp18' */ 0x72703138, + bmdTimecodeVITC = /* 'vitc' */ 0x76697463, + bmdTimecodeSerial = /* 'seri' */ 0x73657269 +}; + + +/* Enum BMDTimecodeFlags - Timecode flags */ + +typedef uint32_t BMDTimecodeFlags; +enum _BMDTimecodeFlags { + bmdTimecodeFlagDefault = 0, + bmdTimecodeIsDropFrame = 1 << 0 +}; + + +/* Enum BMDVideoConnection - Video connection types */ + +typedef uint32_t BMDVideoConnection; +enum _BMDVideoConnection { + bmdVideoConnectionSDI = 1 << 0, + bmdVideoConnectionHDMI = 1 << 1, + bmdVideoConnectionOpticalSDI = 1 << 2, + bmdVideoConnectionComponent = 1 << 3, + bmdVideoConnectionComposite = 1 << 4, + bmdVideoConnectionSVideo = 1 << 5 +}; + + +/* Enum BMDAnalogVideoFlags - Analog video display flags */ + +typedef uint32_t BMDAnalogVideoFlags; +enum _BMDAnalogVideoFlags { + bmdAnalogVideoFlagCompositeSetup75 = 1 << 0, + bmdAnalogVideoFlagComponentBetacamLevels = 1 << 1 +}; + + +/* Enum BMDAudioConnection - Audio connection types */ + +typedef uint32_t BMDAudioConnection; +enum _BMDAudioConnection { + bmdAudioConnectionEmbedded = /* 'embd' */ 0x656D6264, + bmdAudioConnectionAESEBU = /* 'aes ' */ 0x61657320, + bmdAudioConnectionAnalog = /* 'anlg' */ 0x616E6C67 +}; + + +/* Enum BMDAudioOutputAnalogAESSwitch - Audio output Analog/AESEBU switch */ + +typedef uint32_t BMDAudioOutputAnalogAESSwitch; +enum _BMDAudioOutputAnalogAESSwitch { + bmdAudioOutputSwitchAESEBU = /* 'aes ' */ 0x61657320, + bmdAudioOutputSwitchAnalog = /* 'anlg' */ 0x616E6C67 +}; + + +/* Enum BMDVideoOutputConversionMode - Video/audio conversion mode */ + +typedef uint32_t BMDVideoOutputConversionMode; +enum _BMDVideoOutputConversionMode { + bmdNoVideoOutputConversion = /* 'none' */ 0x6E6F6E65, + bmdVideoOutputLetterboxDownconversion = /* 'ltbx' */ 0x6C746278, + bmdVideoOutputAnamorphicDownconversion = /* 'amph' */ 0x616D7068, + bmdVideoOutputHD720toHD1080Conversion = /* '720c' */ 0x37323063, + bmdVideoOutputHardwareLetterboxDownconversion = /* 'HWlb' */ 0x48576C62, + bmdVideoOutputHardwareAnamorphicDownconversion = /* 'HWam' */ 0x4857616D, + bmdVideoOutputHardwareCenterCutDownconversion = /* 'HWcc' */ 0x48576363, + bmdVideoOutputHardware720p1080pCrossconversion = /* 'xcap' */ 0x78636170, + bmdVideoOutputHardwareAnamorphic720pUpconversion = /* 'ua7p' */ 0x75613770, + bmdVideoOutputHardwareAnamorphic1080iUpconversion = /* 'ua1i' */ 0x75613169, + bmdVideoOutputHardwareAnamorphic149To720pUpconversion = /* 'u47p' */ 0x75343770, + bmdVideoOutputHardwareAnamorphic149To1080iUpconversion = /* 'u41i' */ 0x75343169, + bmdVideoOutputHardwarePillarbox720pUpconversion = /* 'up7p' */ 0x75703770, + bmdVideoOutputHardwarePillarbox1080iUpconversion = /* 'up1i' */ 0x75703169 +}; + + +/* Enum BMDVideoInputConversionMode - Video input conversion mode */ + +typedef uint32_t BMDVideoInputConversionMode; +enum _BMDVideoInputConversionMode { + bmdNoVideoInputConversion = /* 'none' */ 0x6E6F6E65, + bmdVideoInputLetterboxDownconversionFromHD1080 = /* '10lb' */ 0x31306C62, + bmdVideoInputAnamorphicDownconversionFromHD1080 = /* '10am' */ 0x3130616D, + bmdVideoInputLetterboxDownconversionFromHD720 = /* '72lb' */ 0x37326C62, + bmdVideoInputAnamorphicDownconversionFromHD720 = /* '72am' */ 0x3732616D, + bmdVideoInputLetterboxUpconversion = /* 'lbup' */ 0x6C627570, + bmdVideoInputAnamorphicUpconversion = /* 'amup' */ 0x616D7570 +}; + + +/* Enum BMDVideo3DPackingFormat - Video 3D packing format */ + +typedef uint32_t BMDVideo3DPackingFormat; +enum _BMDVideo3DPackingFormat { + bmdVideo3DPackingSidebySideHalf = /* 'sbsh' */ 0x73627368, + bmdVideo3DPackingLinebyLine = /* 'lbyl' */ 0x6C62796C, + bmdVideo3DPackingTopAndBottom = /* 'tabo' */ 0x7461626F, + bmdVideo3DPackingFramePacking = /* 'frpk' */ 0x6672706B, + bmdVideo3DPackingLeftOnly = /* 'left' */ 0x6C656674, + bmdVideo3DPackingRightOnly = /* 'righ' */ 0x72696768 +}; + + +/* Enum BMDDeckLinkConfigurationID - DeckLink Configuration ID */ + +typedef uint32_t BMDDeckLinkConfigurationID; +enum _BMDDeckLinkConfigurationID { + + /* Video Input/Output Flags */ + + bmdDeckLinkConfigUse1080pNotPsF = /* 'fpro' */ 0x6670726F, + + /* Video Input/Output Integers */ + + bmdDeckLinkConfigHDMI3DPackingFormat = /* '3dpf' */ 0x33647066, + + /* Audio Input/Output Flags */ + + bmdDeckLinkConfigAnalogAudioConsumerLevels = /* 'aacl' */ 0x6161636C, + + /* Video output flags */ + + bmdDeckLinkConfigFieldFlickerRemoval = /* 'fdfr' */ 0x66646672, + bmdDeckLinkConfigHD1080p24ToHD1080i5994Conversion = /* 'to59' */ 0x746F3539, + bmdDeckLinkConfig444SDIVideoOutput = /* '444o' */ 0x3434346F, + bmdDeckLinkConfig3GBpsVideoOutput = /* '3gbs' */ 0x33676273, + bmdDeckLinkConfigBlackVideoOutputDuringCapture = /* 'bvoc' */ 0x62766F63, + bmdDeckLinkConfigLowLatencyVideoOutput = /* 'llvo' */ 0x6C6C766F, + + /* Video Output Integers */ + + bmdDeckLinkConfigVideoOutputConnection = /* 'vocn' */ 0x766F636E, + bmdDeckLinkConfigVideoOutputConversionMode = /* 'vocm' */ 0x766F636D, + bmdDeckLinkConfigAnalogVideoOutputFlags = /* 'avof' */ 0x61766F66, + bmdDeckLinkConfigReferenceInputTimingOffset = /* 'glot' */ 0x676C6F74, + + /* Video Input Integers */ + + bmdDeckLinkConfigVideoInputConnection = /* 'vicn' */ 0x7669636E, + bmdDeckLinkConfigAnalogVideoInputFlags = /* 'avif' */ 0x61766966, + bmdDeckLinkConfigVideoInputConversionMode = /* 'vicm' */ 0x7669636D, + bmdDeckLinkConfig32PulldownSequenceInitialTimecodeFrame = /* 'pdif' */ 0x70646966, + bmdDeckLinkConfigVANCSourceLine1Mapping = /* 'vsl1' */ 0x76736C31, + bmdDeckLinkConfigVANCSourceLine2Mapping = /* 'vsl2' */ 0x76736C32, + bmdDeckLinkConfigVANCSourceLine3Mapping = /* 'vsl3' */ 0x76736C33, + + /* Audio Input Integers */ + + bmdDeckLinkConfigAudioInputConnection = /* 'aicn' */ 0x6169636E, + + /* Audio Input Floats */ + + bmdDeckLinkConfigAnalogAudioInputScaleChannel1 = /* 'ais1' */ 0x61697331, + bmdDeckLinkConfigAnalogAudioInputScaleChannel2 = /* 'ais2' */ 0x61697332, + bmdDeckLinkConfigAnalogAudioInputScaleChannel3 = /* 'ais3' */ 0x61697333, + bmdDeckLinkConfigAnalogAudioInputScaleChannel4 = /* 'ais4' */ 0x61697334, + bmdDeckLinkConfigDigitalAudioInputScale = /* 'dais' */ 0x64616973, + + /* Audio Output Integers */ + + bmdDeckLinkConfigAudioOutputAESAnalogSwitch = /* 'aoaa' */ 0x616F6161, + + /* Audio Output Floats */ + + bmdDeckLinkConfigAnalogAudioOutputScaleChannel1 = /* 'aos1' */ 0x616F7331, + bmdDeckLinkConfigAnalogAudioOutputScaleChannel2 = /* 'aos2' */ 0x616F7332, + bmdDeckLinkConfigAnalogAudioOutputScaleChannel3 = /* 'aos3' */ 0x616F7333, + bmdDeckLinkConfigAnalogAudioOutputScaleChannel4 = /* 'aos4' */ 0x616F7334, + bmdDeckLinkConfigDigitalAudioOutputScale = /* 'daos' */ 0x64616F73 +}; + + +/* Enum BMDDeckLinkAttributeID - DeckLink Attribute ID */ + +typedef uint32_t BMDDeckLinkAttributeID; +enum _BMDDeckLinkAttributeID { + + /* Flags */ + + BMDDeckLinkSupportsInternalKeying = /* 'keyi' */ 0x6B657969, + BMDDeckLinkSupportsExternalKeying = /* 'keye' */ 0x6B657965, + BMDDeckLinkSupportsHDKeying = /* 'keyh' */ 0x6B657968, + BMDDeckLinkSupportsInputFormatDetection = /* 'infd' */ 0x696E6664, + BMDDeckLinkHasReferenceInput = /* 'hrin' */ 0x6872696E, + BMDDeckLinkHasSerialPort = /* 'hspt' */ 0x68737074, + + /* Integers */ + + BMDDeckLinkMaximumAudioChannels = /* 'mach' */ 0x6D616368, + BMDDeckLinkNumberOfSubDevices = /* 'nsbd' */ 0x6E736264, + BMDDeckLinkSubDeviceIndex = /* 'subi' */ 0x73756269, + BMDDeckLinkVideoOutputConnections = /* 'vocn' */ 0x766F636E, + BMDDeckLinkVideoInputConnections = /* 'vicn' */ 0x7669636E, + + /* Strings */ + + BMDDeckLinkSerialPortDeviceName = /* 'slpn' */ 0x736C706E +}; + + +/* Enum BMDDeckLinkAPIInformationID - DeckLinkAPI information ID */ + +typedef uint32_t BMDDeckLinkAPIInformationID; +enum _BMDDeckLinkAPIInformationID { + BMDDeckLinkAPIVersion = /* 'vers' */ 0x76657273 +}; + + +/* Enum BMDDeckControlMode - DeckControl mode */ + +typedef uint32_t BMDDeckControlMode; +enum _BMDDeckControlMode { + bmdDeckControlNotOpened = /* 'ntop' */ 0x6E746F70, + bmdDeckControlVTRControlMode = /* 'vtrc' */ 0x76747263, + bmdDeckControlExportMode = /* 'expm' */ 0x6578706D, + bmdDeckControlCaptureMode = /* 'capm' */ 0x6361706D +}; + + +/* Enum BMDDeckControlEvent - DeckControl event */ + +typedef uint32_t BMDDeckControlEvent; +enum _BMDDeckControlEvent { + bmdDeckControlAbortedEvent = /* 'abte' */ 0x61627465, // This event is triggered when a capture or edit-to-tape operation is aborted. + + /* Export-To-Tape events */ + + bmdDeckControlPrepareForExportEvent = /* 'pfee' */ 0x70666565, // This event is triggered a few frames before reaching the in-point. IDeckLinkInput::StartScheduledPlayback() should be called at this point. + bmdDeckControlExportCompleteEvent = /* 'exce' */ 0x65786365, // This event is triggered a few frames after reaching the out-point. At this point, it is safe to stop playback. + + /* Capture events */ + + bmdDeckControlPrepareForCaptureEvent = /* 'pfce' */ 0x70666365, // This event is triggered a few frames before reaching the in-point. The serial timecode attached to IDeckLinkVideoInputFrames is now valid. + bmdDeckControlCaptureCompleteEvent = /* 'ccev' */ 0x63636576 // This event is triggered a few frames after reaching the out-point. +}; + + +/* Enum BMDDeckControlVTRControlState - VTR Control state */ + +typedef uint32_t BMDDeckControlVTRControlState; +enum _BMDDeckControlVTRControlState { + bmdDeckControlNotInVTRControlMode = /* 'nvcm' */ 0x6E76636D, + bmdDeckControlVTRControlPlaying = /* 'vtrp' */ 0x76747270, + bmdDeckControlVTRControlRecording = /* 'vtrr' */ 0x76747272, + bmdDeckControlVTRControlStill = /* 'vtra' */ 0x76747261, + bmdDeckControlVTRControlSeeking = /* 'vtrs' */ 0x76747273, + bmdDeckControlVTRControlStopped = /* 'vtro' */ 0x7674726F +}; + + +/* Enum BMDDeckControlStatusFlags - Deck Control status flags */ + +typedef uint32_t BMDDeckControlStatusFlags; +enum _BMDDeckControlStatusFlags { + bmdDeckControlStatusDeckConnected = 1 << 0, + bmdDeckControlStatusRemoteMode = 1 << 1, + bmdDeckControlStatusRecordInhibited = 1 << 2, + bmdDeckControlStatusCassetteOut = 1 << 3 +}; + + +/* Enum BMDDeckControlExportModeOpsFlags - Export mode flags */ + +typedef uint32_t BMDDeckControlExportModeOpsFlags; +enum _BMDDeckControlExportModeOpsFlags { + bmdDeckControlExportModeInsertVideo = 1 << 0, + bmdDeckControlExportModeInsertAudio1 = 1 << 1, + bmdDeckControlExportModeInsertAudio2 = 1 << 2, + bmdDeckControlExportModeInsertAudio3 = 1 << 3, + bmdDeckControlExportModeInsertAudio4 = 1 << 4, + bmdDeckControlExportModeInsertAudio5 = 1 << 5, + bmdDeckControlExportModeInsertAudio6 = 1 << 6, + bmdDeckControlExportModeInsertAudio7 = 1 << 7, + bmdDeckControlExportModeInsertAudio8 = 1 << 8, + bmdDeckControlExportModeInsertAudio9 = 1 << 9, + bmdDeckControlExportModeInsertAudio10 = 1 << 10, + bmdDeckControlExportModeInsertAudio11 = 1 << 11, + bmdDeckControlExportModeInsertAudio12 = 1 << 12, + bmdDeckControlExportModeInsertTimeCode = 1 << 13, + bmdDeckControlExportModeInsertAssemble = 1 << 14, + bmdDeckControlExportModeInsertPreview = 1 << 15, + bmdDeckControlUseManualExport = 1 << 16 +}; + + +/* Enum BMDDeckControlError - Deck Control error */ + +typedef uint32_t BMDDeckControlError; +enum _BMDDeckControlError { + bmdDeckControlNoError = /* 'noer' */ 0x6E6F6572, + bmdDeckControlModeError = /* 'moer' */ 0x6D6F6572, + bmdDeckControlMissedInPointError = /* 'mier' */ 0x6D696572, + bmdDeckControlDeckTimeoutError = /* 'dter' */ 0x64746572, + bmdDeckControlCommandFailedError = /* 'cfer' */ 0x63666572, + bmdDeckControlDeviceAlreadyOpenedError = /* 'dalo' */ 0x64616C6F, + bmdDeckControlFailedToOpenDeviceError = /* 'fder' */ 0x66646572, + bmdDeckControlInLocalModeError = /* 'lmer' */ 0x6C6D6572, + bmdDeckControlEndOfTapeError = /* 'eter' */ 0x65746572, + bmdDeckControlUserAbortError = /* 'uaer' */ 0x75616572, + bmdDeckControlNoTapeInDeckError = /* 'nter' */ 0x6E746572, + bmdDeckControlNoVideoFromCardError = /* 'nvfc' */ 0x6E766663, + bmdDeckControlNoCommunicationError = /* 'ncom' */ 0x6E636F6D, + bmdDeckControlUnknownError = /* 'uner' */ 0x756E6572 +}; + + +/* Enum BMD3DPreviewFormat - Linked Frame preview format */ + +typedef uint32_t BMD3DPreviewFormat; +enum _BMD3DPreviewFormat { + bmd3DPreviewFormatDefault = /* 'defa' */ 0x64656661, + bmd3DPreviewFormatLeftOnly = /* 'left' */ 0x6C656674, + bmd3DPreviewFormatRightOnly = /* 'righ' */ 0x72696768, + bmd3DPreviewFormatSideBySide = /* 'side' */ 0x73696465, + bmd3DPreviewFormatTopBottom = /* 'topb' */ 0x746F7062 +}; + + +#if defined(__cplusplus) + +// Forward Declarations + +class IDeckLinkVideoOutputCallback; +class IDeckLinkInputCallback; +class IDeckLinkMemoryAllocator; +class IDeckLinkAudioOutputCallback; +class IDeckLinkIterator; +class IDeckLinkAPIInformation; +class IDeckLinkDisplayModeIterator; +class IDeckLinkDisplayMode; +class IDeckLink; +class IDeckLinkOutput; +class IDeckLinkInput; +class IDeckLinkTimecode; +class IDeckLinkVideoFrame; +class IDeckLinkMutableVideoFrame; +class IDeckLinkVideoFrame3DExtensions; +class IDeckLinkVideoInputFrame; +class IDeckLinkVideoFrameAncillary; +class IDeckLinkAudioInputPacket; +class IDeckLinkScreenPreviewCallback; +class IDeckLinkGLScreenPreviewHelper; +class IDeckLinkConfiguration; +class IDeckLinkAttributes; +class IDeckLinkKeyer; +class IDeckLinkVideoConversion; +class IDeckLinkDeckControlStatusCallback; +class IDeckLinkDeckControl; + + +/* Interface IDeckLinkVideoOutputCallback - Frame completion callback. */ + +class IDeckLinkVideoOutputCallback : public IUnknown +{ +public: + virtual HRESULT ScheduledFrameCompleted (/* in */ IDeckLinkVideoFrame *completedFrame, /* in */ BMDOutputFrameCompletionResult result) = 0; + virtual HRESULT ScheduledPlaybackHasStopped (void) = 0; + +protected: + virtual ~IDeckLinkVideoOutputCallback () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkInputCallback - Frame arrival callback. */ + +class IDeckLinkInputCallback : public IUnknown +{ +public: + virtual HRESULT VideoInputFormatChanged (/* in */ BMDVideoInputFormatChangedEvents notificationEvents, /* in */ IDeckLinkDisplayMode *newDisplayMode, /* in */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0; + virtual HRESULT VideoInputFrameArrived (/* in */ IDeckLinkVideoInputFrame* videoFrame, /* in */ IDeckLinkAudioInputPacket* audioPacket) = 0; + +protected: + virtual ~IDeckLinkInputCallback () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkMemoryAllocator - Memory allocator for video frames. */ + +class IDeckLinkMemoryAllocator : public IUnknown +{ +public: + virtual HRESULT AllocateBuffer (/* in */ uint32_t bufferSize, /* out */ void **allocatedBuffer) = 0; + virtual HRESULT ReleaseBuffer (/* in */ void *buffer) = 0; + + virtual HRESULT Commit (void) = 0; + virtual HRESULT Decommit (void) = 0; +}; + + +/* Interface IDeckLinkAudioOutputCallback - Optional callback to allow audio samples to be pulled as required. */ + +class IDeckLinkAudioOutputCallback : public IUnknown +{ +public: + virtual HRESULT RenderAudioSamples (/* in */ bool preroll) = 0; +}; + + +/* Interface IDeckLinkIterator - enumerates installed DeckLink hardware */ + +class IDeckLinkIterator : public IUnknown +{ +public: + virtual HRESULT Next (/* out */ IDeckLink **deckLinkInstance) = 0; +}; + + +/* Interface IDeckLinkAPIInformation - DeckLinkAPI attribute interface */ + +class IDeckLinkAPIInformation : public IUnknown +{ +public: + virtual HRESULT GetFlag (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ bool *value) = 0; + virtual HRESULT GetInt (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ int64_t *value) = 0; + virtual HRESULT GetFloat (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ double *value) = 0; + virtual HRESULT GetString (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ const char **value) = 0; + +protected: + virtual ~IDeckLinkAPIInformation () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkDisplayModeIterator - enumerates over supported input/output display modes. */ + +class IDeckLinkDisplayModeIterator : public IUnknown +{ +public: + virtual HRESULT Next (/* out */ IDeckLinkDisplayMode **deckLinkDisplayMode) = 0; + +protected: + virtual ~IDeckLinkDisplayModeIterator () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkDisplayMode - represents a display mode */ + +class IDeckLinkDisplayMode : public IUnknown +{ +public: + virtual HRESULT GetName (/* out */ const char **name) = 0; + virtual BMDDisplayMode GetDisplayMode (void) = 0; + virtual long GetWidth (void) = 0; + virtual long GetHeight (void) = 0; + virtual HRESULT GetFrameRate (/* out */ BMDTimeValue *frameDuration, /* out */ BMDTimeScale *timeScale) = 0; + virtual BMDFieldDominance GetFieldDominance (void) = 0; + virtual BMDDisplayModeFlags GetFlags (void) = 0; + +protected: + virtual ~IDeckLinkDisplayMode () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLink - represents a DeckLink device */ + +class IDeckLink : public IUnknown +{ +public: + virtual HRESULT GetModelName (/* out */ const char **modelName) = 0; +}; + + +/* Interface IDeckLinkOutput - Created by QueryInterface from IDeckLink. */ + +class IDeckLinkOutput : public IUnknown +{ +public: + virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoOutputFlags flags, /* out */ BMDDisplayModeSupport *result, /* out */ IDeckLinkDisplayMode **resultDisplayMode) = 0; + virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator **iterator) = 0; + + virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; + + /* Video Output */ + + virtual HRESULT EnableVideoOutput (/* in */ BMDDisplayMode displayMode, /* in */ BMDVideoOutputFlags flags) = 0; + virtual HRESULT DisableVideoOutput (void) = 0; + + virtual HRESULT SetVideoOutputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator *theAllocator) = 0; + virtual HRESULT CreateVideoFrame (/* in */ int32_t width, /* in */ int32_t height, /* in */ int32_t rowBytes, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDFrameFlags flags, /* out */ IDeckLinkMutableVideoFrame **outFrame) = 0; + virtual HRESULT CreateAncillaryData (/* in */ BMDPixelFormat pixelFormat, /* out */ IDeckLinkVideoFrameAncillary **outBuffer) = 0; + + virtual HRESULT DisplayVideoFrameSync (/* in */ IDeckLinkVideoFrame *theFrame) = 0; + virtual HRESULT ScheduleVideoFrame (/* in */ IDeckLinkVideoFrame *theFrame, /* in */ BMDTimeValue displayTime, /* in */ BMDTimeValue displayDuration, /* in */ BMDTimeScale timeScale) = 0; + virtual HRESULT SetScheduledFrameCompletionCallback (/* in */ IDeckLinkVideoOutputCallback *theCallback) = 0; + virtual HRESULT GetBufferedVideoFrameCount (/* out */ uint32_t *bufferedFrameCount) = 0; + + /* Audio Output */ + + virtual HRESULT EnableAudioOutput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount, /* in */ BMDAudioOutputStreamType streamType) = 0; + virtual HRESULT DisableAudioOutput (void) = 0; + + virtual HRESULT WriteAudioSamplesSync (/* in */ void *buffer, /* in */ uint32_t sampleFrameCount, /* out */ uint32_t *sampleFramesWritten) = 0; + + virtual HRESULT BeginAudioPreroll (void) = 0; + virtual HRESULT EndAudioPreroll (void) = 0; + virtual HRESULT ScheduleAudioSamples (/* in */ void *buffer, /* in */ uint32_t sampleFrameCount, /* in */ BMDTimeValue streamTime, /* in */ BMDTimeScale timeScale, /* out */ uint32_t *sampleFramesWritten) = 0; + + virtual HRESULT GetBufferedAudioSampleFrameCount (/* out */ uint32_t *bufferedSampleFrameCount) = 0; + virtual HRESULT FlushBufferedAudioSamples (void) = 0; + + virtual HRESULT SetAudioCallback (/* in */ IDeckLinkAudioOutputCallback *theCallback) = 0; + + /* Output Control */ + + virtual HRESULT StartScheduledPlayback (/* in */ BMDTimeValue playbackStartTime, /* in */ BMDTimeScale timeScale, /* in */ double playbackSpeed) = 0; + virtual HRESULT StopScheduledPlayback (/* in */ BMDTimeValue stopPlaybackAtTime, /* out */ BMDTimeValue *actualStopTime, /* in */ BMDTimeScale timeScale) = 0; + virtual HRESULT IsScheduledPlaybackRunning (/* out */ bool *active) = 0; + virtual HRESULT GetScheduledStreamTime (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *streamTime, /* out */ double *playbackSpeed) = 0; + virtual HRESULT GetReferenceStatus (/* out */ BMDReferenceStatus *referenceStatus) = 0; + + /* Hardware Timing */ + + virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0; + +protected: + virtual ~IDeckLinkOutput () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkInput - Created by QueryInterface from IDeckLink. */ + +class IDeckLinkInput : public IUnknown +{ +public: + virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags, /* out */ BMDDisplayModeSupport *result, /* out */ IDeckLinkDisplayMode **resultDisplayMode) = 0; + virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator **iterator) = 0; + + virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; + + /* Video Input */ + + virtual HRESULT EnableVideoInput (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags) = 0; + virtual HRESULT DisableVideoInput (void) = 0; + virtual HRESULT GetAvailableVideoFrameCount (/* out */ uint32_t *availableFrameCount) = 0; + + /* Audio Input */ + + virtual HRESULT EnableAudioInput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount) = 0; + virtual HRESULT DisableAudioInput (void) = 0; + virtual HRESULT GetAvailableAudioSampleFrameCount (/* out */ uint32_t *availableSampleFrameCount) = 0; + + /* Input Control */ + + virtual HRESULT StartStreams (void) = 0; + virtual HRESULT StopStreams (void) = 0; + virtual HRESULT PauseStreams (void) = 0; + virtual HRESULT FlushStreams (void) = 0; + virtual HRESULT SetCallback (/* in */ IDeckLinkInputCallback *theCallback) = 0; + + /* Hardware Timing */ + + virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0; + +protected: + virtual ~IDeckLinkInput () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkTimecode - Used for video frame timecode representation. */ + +class IDeckLinkTimecode : public IUnknown +{ +public: + virtual BMDTimecodeBCD GetBCD (void) = 0; + virtual HRESULT GetComponents (/* out */ uint8_t *hours, /* out */ uint8_t *minutes, /* out */ uint8_t *seconds, /* out */ uint8_t *frames) = 0; + virtual HRESULT GetString (/* out */ const char **timecode) = 0; + virtual BMDTimecodeFlags GetFlags (void) = 0; + virtual HRESULT GetTimecodeUserBits (/* out */ BMDTimecodeUserBits *userBits) = 0; + +protected: + virtual ~IDeckLinkTimecode () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkVideoFrame - Interface to encapsulate a video frame; can be caller-implemented. */ + +class IDeckLinkVideoFrame : public IUnknown +{ +public: + virtual long GetWidth (void) = 0; + virtual long GetHeight (void) = 0; + virtual long GetRowBytes (void) = 0; + virtual BMDPixelFormat GetPixelFormat (void) = 0; + virtual BMDFrameFlags GetFlags (void) = 0; + virtual HRESULT GetBytes (/* out */ void **buffer) = 0; + + virtual HRESULT GetTimecode (/* in */ BMDTimecodeFormat format, /* out */ IDeckLinkTimecode **timecode) = 0; + virtual HRESULT GetAncillaryData (/* out */ IDeckLinkVideoFrameAncillary **ancillary) = 0; + +protected: + virtual ~IDeckLinkVideoFrame () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkMutableVideoFrame - Created by IDeckLinkOutput::CreateVideoFrame. */ + +class IDeckLinkMutableVideoFrame : public IDeckLinkVideoFrame +{ +public: + virtual HRESULT SetFlags (/* in */ BMDFrameFlags newFlags) = 0; + + virtual HRESULT SetTimecode (/* in */ BMDTimecodeFormat format, /* in */ IDeckLinkTimecode *timecode) = 0; + virtual HRESULT SetTimecodeFromComponents (/* in */ BMDTimecodeFormat format, /* in */ uint8_t hours, /* in */ uint8_t minutes, /* in */ uint8_t seconds, /* in */ uint8_t frames, /* in */ BMDTimecodeFlags flags) = 0; + virtual HRESULT SetAncillaryData (/* in */ IDeckLinkVideoFrameAncillary *ancillary) = 0; + virtual HRESULT SetTimecodeUserBits (/* in */ BMDTimecodeFormat format, /* in */ BMDTimecodeUserBits userBits) = 0; + +protected: + virtual ~IDeckLinkMutableVideoFrame () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkVideoFrame3DExtensions - Optional interface implemented on IDeckLinkVideoFrame to support 3D frames */ + +class IDeckLinkVideoFrame3DExtensions : public IUnknown +{ +public: + virtual BMDVideo3DPackingFormat Get3DPackingFormat (void) = 0; + virtual HRESULT GetFrameForRightEye (/* out */ IDeckLinkVideoFrame* *rightEyeFrame) = 0; + +protected: + virtual ~IDeckLinkVideoFrame3DExtensions () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkVideoInputFrame - Provided by the IDeckLinkVideoInput frame arrival callback. */ + +class IDeckLinkVideoInputFrame : public IDeckLinkVideoFrame +{ +public: + virtual HRESULT GetStreamTime (/* out */ BMDTimeValue *frameTime, /* out */ BMDTimeValue *frameDuration, /* in */ BMDTimeScale timeScale) = 0; + virtual HRESULT GetHardwareReferenceTimestamp (/* in */ BMDTimeScale timeScale, /* out */ BMDTimeValue *frameTime, /* out */ BMDTimeValue *frameDuration) = 0; + +protected: + virtual ~IDeckLinkVideoInputFrame () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkVideoFrameAncillary - Obtained through QueryInterface() on an IDeckLinkVideoFrame object. */ + +class IDeckLinkVideoFrameAncillary : public IUnknown +{ +public: + + virtual HRESULT GetBufferForVerticalBlankingLine (/* in */ uint32_t lineNumber, /* out */ void **buffer) = 0; + virtual BMDPixelFormat GetPixelFormat (void) = 0; + virtual BMDDisplayMode GetDisplayMode (void) = 0; + +protected: + virtual ~IDeckLinkVideoFrameAncillary () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkAudioInputPacket - Provided by the IDeckLinkInput callback. */ + +class IDeckLinkAudioInputPacket : public IUnknown +{ +public: + virtual long GetSampleFrameCount (void) = 0; + virtual HRESULT GetBytes (/* out */ void **buffer) = 0; + virtual HRESULT GetPacketTime (/* out */ BMDTimeValue *packetTime, /* in */ BMDTimeScale timeScale) = 0; + +protected: + virtual ~IDeckLinkAudioInputPacket () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkScreenPreviewCallback - Screen preview callback */ + +class IDeckLinkScreenPreviewCallback : public IUnknown +{ +public: + virtual HRESULT DrawFrame (/* in */ IDeckLinkVideoFrame *theFrame) = 0; + +protected: + virtual ~IDeckLinkScreenPreviewCallback () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkGLScreenPreviewHelper - Created with CoCreateInstance(). */ + +class IDeckLinkGLScreenPreviewHelper : public IUnknown +{ +public: + + /* Methods must be called with OpenGL context set */ + + virtual HRESULT InitializeGL (void) = 0; + virtual HRESULT PaintGL (void) = 0; + virtual HRESULT SetFrame (/* in */ IDeckLinkVideoFrame *theFrame) = 0; + virtual HRESULT Set3DPreviewFormat (/* in */ BMD3DPreviewFormat previewFormat) = 0; + +protected: + virtual ~IDeckLinkGLScreenPreviewHelper () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkConfiguration - DeckLink Configuration interface */ + +class IDeckLinkConfiguration : public IUnknown +{ +public: + virtual HRESULT SetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ bool value) = 0; + virtual HRESULT GetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ bool *value) = 0; + virtual HRESULT SetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ int64_t value) = 0; + virtual HRESULT GetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ int64_t *value) = 0; + virtual HRESULT SetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ double value) = 0; + virtual HRESULT GetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ double *value) = 0; + virtual HRESULT SetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ const char *value) = 0; + virtual HRESULT GetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ const char **value) = 0; + virtual HRESULT WriteConfigurationToPreferences (void) = 0; + +protected: + virtual ~IDeckLinkConfiguration () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkAttributes - DeckLink Attribute interface */ + +class IDeckLinkAttributes : public IUnknown +{ +public: + virtual HRESULT GetFlag (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ bool *value) = 0; + virtual HRESULT GetInt (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ int64_t *value) = 0; + virtual HRESULT GetFloat (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ double *value) = 0; + virtual HRESULT GetString (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ const char **value) = 0; + +protected: + virtual ~IDeckLinkAttributes () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkKeyer - DeckLink Keyer interface */ + +class IDeckLinkKeyer : public IUnknown +{ +public: + virtual HRESULT Enable (/* in */ bool isExternal) = 0; + virtual HRESULT SetLevel (/* in */ uint8_t level) = 0; + virtual HRESULT RampUp (/* in */ uint32_t numberOfFrames) = 0; + virtual HRESULT RampDown (/* in */ uint32_t numberOfFrames) = 0; + virtual HRESULT Disable (void) = 0; + +protected: + virtual ~IDeckLinkKeyer () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkVideoConversion - Created with CoCreateInstance(). */ + +class IDeckLinkVideoConversion : public IUnknown +{ +public: + virtual HRESULT ConvertFrame (/* in */ IDeckLinkVideoFrame* srcFrame, /* in */ IDeckLinkVideoFrame* dstFrame) = 0; + +protected: + virtual ~IDeckLinkVideoConversion () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkDeckControlStatusCallback - Deck control state change callback. */ + +class IDeckLinkDeckControlStatusCallback : public IUnknown +{ +public: + virtual HRESULT TimecodeUpdate (/* in */ BMDTimecodeBCD currentTimecode) = 0; + virtual HRESULT VTRControlStateChanged (/* in */ BMDDeckControlVTRControlState newState, /* in */ BMDDeckControlError error) = 0; + virtual HRESULT DeckControlEventReceived (/* in */ BMDDeckControlEvent event, /* in */ BMDDeckControlError error) = 0; + virtual HRESULT DeckControlStatusChanged (/* in */ BMDDeckControlStatusFlags flags, /* in */ uint32_t mask) = 0; + +protected: + virtual ~IDeckLinkDeckControlStatusCallback () {}; // call Release method to drop reference count +}; + + +/* Interface IDeckLinkDeckControl - Deck Control main interface */ + +class IDeckLinkDeckControl : public IUnknown +{ +public: + virtual HRESULT Open (/* in */ BMDTimeScale timeScale, /* in */ BMDTimeValue timeValue, /* in */ bool timecodeIsDropFrame, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Close (/* in */ bool standbyOn) = 0; + virtual HRESULT GetCurrentState (/* out */ BMDDeckControlMode *mode, /* out */ BMDDeckControlVTRControlState *vtrControlState, /* out */ BMDDeckControlStatusFlags *flags) = 0; + virtual HRESULT SetStandby (/* in */ bool standbyOn) = 0; + virtual HRESULT Play (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Stop (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT TogglePlayStop (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Eject (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GoToTimecode (/* in */ BMDTimecodeBCD timecode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT FastForward (/* in */ bool viewTape, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Rewind (/* in */ bool viewTape, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT StepForward (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT StepBack (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Jog (/* in */ double rate, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Shuttle (/* in */ double rate, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GetTimecodeString (/* out */ const char **currentTimeCode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GetTimecode (/* out */ IDeckLinkTimecode **currentTimecode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GetTimecodeBCD (/* out */ BMDTimecodeBCD *currentTimecode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT SetPreroll (/* in */ uint32_t prerollSeconds) = 0; + virtual HRESULT GetPreroll (/* out */ uint32_t *prerollSeconds) = 0; + virtual HRESULT SetExportOffset (/* in */ int32_t exportOffsetFields) = 0; + virtual HRESULT GetExportOffset (/* out */ int32_t *exportOffsetFields) = 0; + virtual HRESULT GetManualExportOffset (/* out */ int32_t *deckManualExportOffsetFields) = 0; + virtual HRESULT SetCaptureOffset (/* in */ int32_t captureOffsetFields) = 0; + virtual HRESULT GetCaptureOffset (/* out */ int32_t *captureOffsetFields) = 0; + virtual HRESULT StartExport (/* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* in */ BMDDeckControlExportModeOpsFlags exportModeOps, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT StartCapture (/* in */ bool useVITC, /* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GetDeviceID (/* out */ uint16_t *deviceId, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Abort (void) = 0; + virtual HRESULT CrashRecordStart (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT CrashRecordStop (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT SetCallback (/* in */ IDeckLinkDeckControlStatusCallback *callback) = 0; + +protected: + virtual ~IDeckLinkDeckControl () {}; // call Release method to drop reference count +}; + + +/* Functions */ + +extern "C" { + + IDeckLinkIterator* CreateDeckLinkIteratorInstance (void); + IDeckLinkGLScreenPreviewHelper* CreateOpenGLScreenPreviewHelper (void); + IDeckLinkVideoConversion* CreateVideoConversionInstance (void); + +}; + + +#endif // defined(__cplusplus) +#endif // __DeckLink_API_h__ diff --git a/sys/decklink/DeckLinkAPIDispatch.cpp b/sys/decklink/DeckLinkAPIDispatch.cpp new file mode 100644 index 0000000000..72607782dc --- /dev/null +++ b/sys/decklink/DeckLinkAPIDispatch.cpp @@ -0,0 +1,110 @@ +/* -LICENSE-START- +** Copyright (c) 2009 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation covered by +** this license (the "Software") to use, reproduce, display, distribute, +** execute, and transmit the Software, and to prepare derivative works of the +** Software, and to permit third-parties to whom the Software is furnished to +** do so, all subject to the following: +** +** The copyright notices in the Software and this entire statement, including +** the above license grant, this restriction and the following disclaimer, +** must be included in all copies of the Software, in whole or in part, and +** all derivative works of the Software, unless such copies or derivative +** works are solely in the form of machine-executable object code generated by +** a source language processor. +** +** 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** -LICENSE-END- +**/ + +#include +#include +#include + +#include "DeckLinkAPI.h" + +#define kDeckLinkAPI_Name "libDeckLinkAPI.so" +#define KDeckLinkPreviewAPI_Name "libDeckLinkPreviewAPI.so" + +typedef IDeckLinkIterator* (*CreateIteratorFunc)(void); +typedef IDeckLinkGLScreenPreviewHelper* (*CreateOpenGLScreenPreviewHelperFunc)(void); +typedef IDeckLinkVideoConversion* (*CreateVideoConversionInstanceFunc)(void); + +static pthread_once_t gDeckLinkOnceControl = PTHREAD_ONCE_INIT; +static pthread_once_t gPreviewOnceControl = PTHREAD_ONCE_INIT; + +static CreateIteratorFunc gCreateIteratorFunc = NULL; +static CreateOpenGLScreenPreviewHelperFunc gCreateOpenGLPreviewFunc = NULL; +static CreateVideoConversionInstanceFunc gCreateVideoConversionFunc = NULL; + +static +void InitDeckLinkAPI (void) +{ + void *libraryHandle; + + libraryHandle = dlopen(kDeckLinkAPI_Name, RTLD_NOW|RTLD_GLOBAL); + if (!libraryHandle) + { + fprintf(stderr, "%s\n", dlerror()); + return; + } + gCreateIteratorFunc = (CreateIteratorFunc)dlsym(libraryHandle, "CreateDeckLinkIteratorInstance_0001"); + if (!gCreateIteratorFunc) + fprintf(stderr, "%s\n", dlerror()); + gCreateVideoConversionFunc = (CreateVideoConversionInstanceFunc)dlsym(libraryHandle, "CreateVideoConversionInstance_0001"); + if (!gCreateVideoConversionFunc) + fprintf(stderr, "%s\n", dlerror()); +} + +static +void InitDeckLinkPreviewAPI (void) +{ + void *libraryHandle; + + libraryHandle = dlopen(KDeckLinkPreviewAPI_Name, RTLD_NOW|RTLD_GLOBAL); + if (!libraryHandle) + { + fprintf(stderr, "%s\n", dlerror()); + return; + } + gCreateOpenGLPreviewFunc = (CreateOpenGLScreenPreviewHelperFunc)dlsym(libraryHandle, "CreateOpenGLScreenPreviewHelper_0001"); + if (!gCreateOpenGLPreviewFunc) + fprintf(stderr, "%s\n", dlerror()); +} + +IDeckLinkIterator* CreateDeckLinkIteratorInstance (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateIteratorFunc == NULL) + return NULL; + return gCreateIteratorFunc(); +} + +IDeckLinkGLScreenPreviewHelper* CreateOpenGLScreenPreviewHelper (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + pthread_once(&gPreviewOnceControl, InitDeckLinkPreviewAPI); + + if (gCreateOpenGLPreviewFunc == NULL) + return NULL; + return gCreateOpenGLPreviewFunc(); +} + +IDeckLinkVideoConversion* CreateVideoConversionInstance (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateVideoConversionFunc == NULL) + return NULL; + return gCreateVideoConversionFunc(); +} + diff --git a/sys/decklink/LinuxCOM.h b/sys/decklink/LinuxCOM.h new file mode 100644 index 0000000000..2b13697d2b --- /dev/null +++ b/sys/decklink/LinuxCOM.h @@ -0,0 +1,99 @@ +/* -LICENSE-START- +** Copyright (c) 2009 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation covered by +** this license (the "Software") to use, reproduce, display, distribute, +** execute, and transmit the Software, and to prepare derivative works of the +** Software, and to permit third-parties to whom the Software is furnished to +** do so, all subject to the following: +** +** The copyright notices in the Software and this entire statement, including +** the above license grant, this restriction and the following disclaimer, +** must be included in all copies of the Software, in whole or in part, and +** all derivative works of the Software, unless such copies or derivative +** works are solely in the form of machine-executable object code generated by +** a source language processor. +** +** 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** -LICENSE-END- +*/ + +#ifndef __LINUX_COM_H_ +#define __LINUX_COM_H_ + +struct REFIID +{ + unsigned char byte0; + unsigned char byte1; + unsigned char byte2; + unsigned char byte3; + unsigned char byte4; + unsigned char byte5; + unsigned char byte6; + unsigned char byte7; + unsigned char byte8; + unsigned char byte9; + unsigned char byte10; + unsigned char byte11; + unsigned char byte12; + unsigned char byte13; + unsigned char byte14; + unsigned char byte15; +}; + +typedef REFIID CFUUIDBytes; +#define CFUUIDGetUUIDBytes(x) x + +typedef int HRESULT; +typedef unsigned long ULONG; +typedef void *LPVOID; + +#define SUCCEEDED(Status) ((HRESULT)(Status) >= 0) +#define FAILED(Status) ((HRESULT)(Status)<0) + +#define IS_ERROR(Status) ((unsigned long)(Status) >> 31 == SEVERITY_ERROR) +#define HRESULT_CODE(hr) ((hr) & 0xFFFF) +#define HRESULT_FACILITY(hr) (((hr) >> 16) & 0x1fff) +#define HRESULT_SEVERITY(hr) (((hr) >> 31) & 0x1) +#define SEVERITY_SUCCESS 0 +#define SEVERITY_ERROR 1 + +#define MAKE_HRESULT(sev,fac,code) ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) ) + +#define S_OK ((HRESULT)0x00000000L) +#define S_FALSE ((HRESULT)0x00000001L) +#define E_UNEXPECTED ((HRESULT)0x8000FFFFL) +#define E_NOTIMPL ((HRESULT)0x80000001L) +#define E_OUTOFMEMORY ((HRESULT)0x80000002L) +#define E_INVALIDARG ((HRESULT)0x80000003L) +#define E_NOINTERFACE ((HRESULT)0x80000004L) +#define E_POINTER ((HRESULT)0x80000005L) +#define E_HANDLE ((HRESULT)0x80000006L) +#define E_ABORT ((HRESULT)0x80000007L) +#define E_FAIL ((HRESULT)0x80000008L) +#define E_ACCESSDENIED ((HRESULT)0x80000009L) + +#define STDMETHODCALLTYPE + +#define IID_IUnknown (REFIID){0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46} +#define IUnknownUUID IID_IUnknown + +#ifdef __cplusplus +class IUnknown +{ + public: + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) = 0; + virtual ULONG STDMETHODCALLTYPE AddRef(void) = 0; + virtual ULONG STDMETHODCALLTYPE Release(void) = 0; +}; +#endif + +#endif + diff --git a/sys/decklink/Makefile.am b/sys/decklink/Makefile.am new file mode 100644 index 0000000000..ffa4ac25cc --- /dev/null +++ b/sys/decklink/Makefile.am @@ -0,0 +1,28 @@ +plugin_LTLIBRARIES = libgstdecklink.la + +libgstdecklink_la_CPPFLAGS = \ + $(GST_BASE_CFLAGS) \ + $(GST_CXXFLAGS) \ + $(DECKLINK_CXXFLAGS) +libgstdecklink_la_LIBADD = \ + $(GST_BASE_LIBS) \ + $(GST_LIBS) \ + $(DECKLINK_LIBS) \ + $(LIBM) +libgstdecklink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstdecklink_la_LIBTOOLFLAGS = --tag=disable-static + +libgstdecklink_la_SOURCES = \ + gstdecklinksrc.cpp \ + gstdecklinksink.cpp \ + gstdecklink.cpp \ + capture.cpp \ + DeckLinkAPIDispatch.cpp + +noinst_HEADERS = \ + gstdecklinksrc.h \ + gstdecklinksink.h \ + capture.h \ + DeckLinkAPI.h \ + LinuxCOM.h + diff --git a/sys/decklink/capture.cpp b/sys/decklink/capture.cpp new file mode 100644 index 0000000000..20bd660c9c --- /dev/null +++ b/sys/decklink/capture.cpp @@ -0,0 +1,430 @@ +/* -LICENSE-START- +** Copyright (c) 2009 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation covered by +** this license (the "Software") to use, reproduce, display, distribute, +** execute, and transmit the Software, and to prepare derivative works of the +** Software, and to permit third-parties to whom the Software is furnished to +** do so, all subject to the following: +** +** The copyright notices in the Software and this entire statement, including +** the above license grant, this restriction and the following disclaimer, +** must be included in all copies of the Software, in whole or in part, and +** all derivative works of the Software, unless such copies or derivative +** works are solely in the form of machine-executable object code generated by +** a source language processor. +** +** 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** -LICENSE-END- +*/ + +#include +#include +#include +#include +#include +#include + +#include "gstdecklinksrc.h" + +#include "DeckLinkAPI.h" +#include "capture.h" + + +int videoOutputFile = -1; +int audioOutputFile = -1; + +IDeckLink *deckLink; +IDeckLinkInput *deckLinkInput; +IDeckLinkDisplayModeIterator *displayModeIterator; + +static BMDTimecodeFormat g_timecodeFormat = 0; + +DeckLinkCaptureDelegate::DeckLinkCaptureDelegate ():m_refCount (0) +{ + pthread_mutex_init (&m_mutex, NULL); +} + +DeckLinkCaptureDelegate::~DeckLinkCaptureDelegate () +{ + pthread_mutex_destroy (&m_mutex); +} + +ULONG +DeckLinkCaptureDelegate::AddRef (void) +{ + pthread_mutex_lock (&m_mutex); + m_refCount++; + pthread_mutex_unlock (&m_mutex); + + return (ULONG) m_refCount; +} + +ULONG +DeckLinkCaptureDelegate::Release (void) +{ + pthread_mutex_lock (&m_mutex); + m_refCount--; + pthread_mutex_unlock (&m_mutex); + + if (m_refCount == 0) { + delete this; + return 0; + } + + return (ULONG) m_refCount; +} + +HRESULT +DeckLinkCaptureDelegate::VideoInputFrameArrived (IDeckLinkVideoInputFrame * + videoFrame, IDeckLinkAudioInputPacket * audioFrame) +{ + GstDecklinkSrc *decklinksrc = GST_DECKLINK_SRC (priv); + + // Handle Video Frame + if (videoFrame) { + if (videoFrame->GetFlags () & bmdFrameHasNoInputSource) { + GST_DEBUG("Frame received - No input signal detected"); + } else { + const char *timecodeString = NULL; + if (g_timecodeFormat != 0) { + IDeckLinkTimecode *timecode; + if (videoFrame->GetTimecode (g_timecodeFormat, &timecode) == S_OK) { + timecode->GetString (&timecodeString); + } + } + + GST_DEBUG("Frame received [%s] - %s - Size: %li bytes", + timecodeString != NULL ? timecodeString : "No timecode", + "Valid Frame", + videoFrame->GetRowBytes () * videoFrame->GetHeight ()); + + if (timecodeString) + free ((void *) timecodeString); + + g_mutex_lock (decklinksrc->mutex); + if (decklinksrc->video_frame != NULL) { + decklinksrc->dropped_frames++; + } else { + videoFrame->AddRef(); + decklinksrc->video_frame = videoFrame; + if (audioFrame) { + audioFrame->AddRef(); + decklinksrc->audio_frame = audioFrame; + } + } + g_cond_signal (decklinksrc->cond); + g_mutex_unlock (decklinksrc->mutex); + } + } + return S_OK; +} + +HRESULT +DeckLinkCaptureDelegate:: +VideoInputFormatChanged (BMDVideoInputFormatChangedEvents events, + IDeckLinkDisplayMode * mode, BMDDetectedVideoInputFormatFlags) +{ + GST_ERROR("moo"); + return S_OK; +} + +#ifdef unused +int +usage (int status) +{ + HRESULT result; + IDeckLinkDisplayMode *displayMode; + int displayModeCount = 0; + + fprintf (stderr, + "Usage: Capture -m [OPTIONS]\n" "\n" " -m :\n"); + + while (displayModeIterator->Next (&displayMode) == S_OK) { + char *displayModeString = NULL; + + result = displayMode->GetName ((const char **) &displayModeString); + if (result == S_OK) { + BMDTimeValue frameRateDuration, frameRateScale; + displayMode->GetFrameRate (&frameRateDuration, &frameRateScale); + + fprintf (stderr, " %2d: %-20s \t %li x %li \t %g FPS\n", + displayModeCount, displayModeString, displayMode->GetWidth (), + displayMode->GetHeight (), + (double) frameRateScale / (double) frameRateDuration); + + free (displayModeString); + displayModeCount++; + } + // Release the IDeckLinkDisplayMode object to prevent a leak + displayMode->Release (); + } + + fprintf (stderr, + " -p \n" + " 0: 8 bit YUV (4:2:2) (default)\n" + " 1: 10 bit YUV (4:2:2)\n" + " 2: 10 bit RGB (4:4:4)\n" + " -t Print timecode\n" + " rp188: RP 188\n" + " vitc: VITC\n" + " serial: Serial Timecode\n" + " -f Filename raw video will be written to\n" + " -a Filename raw audio will be written to\n" + " -c Audio Channels (2, 8 or 16 - default is 2)\n" + " -s Audio Sample Depth (16 or 32 - default is 16)\n" + " -n Number of frames to capture (default is unlimited)\n" + " -3 Capture Stereoscopic 3D (Requires 3D Hardware support)\n" + "\n" + "Capture video and/or audio to a file. Raw video and/or audio can be viewed with mplayer eg:\n" + "\n" + " Capture -m2 -n 50 -f video.raw -a audio.raw\n" + " mplayer video.raw -demuxer rawvideo -rawvideo pal:uyvy -audiofile audio.raw -audio-demuxer 20 -rawaudio rate=48000\n"); + + exit (status); +} + +int +main (int argc, char *argv[]) +{ + IDeckLinkIterator *deckLinkIterator = CreateDeckLinkIteratorInstance (); + DeckLinkCaptureDelegate *delegate; + IDeckLinkDisplayMode *displayMode; + BMDVideoInputFlags inputFlags = 0; + BMDDisplayMode selectedDisplayMode = bmdModeNTSC; + BMDPixelFormat pixelFormat = bmdFormat8BitYUV; + int displayModeCount = 0; + int exitStatus = 1; + int ch; + bool foundDisplayMode = false; + HRESULT result; + + pthread_mutex_init (&sleepMutex, NULL); + pthread_cond_init (&sleepCond, NULL); + + if (!deckLinkIterator) { + fprintf (stderr, + "This application requires the DeckLink drivers installed.\n"); + goto bail; + } + + /* Connect to the first DeckLink instance */ + result = deckLinkIterator->Next (&deckLink); + if (result != S_OK) { + fprintf (stderr, "No DeckLink PCI cards found.\n"); + goto bail; + } + + if (deckLink->QueryInterface (IID_IDeckLinkInput, + (void **) &deckLinkInput) != S_OK) + goto bail; + + delegate = new DeckLinkCaptureDelegate (); + deckLinkInput->SetCallback (delegate); + + // Obtain an IDeckLinkDisplayModeIterator to enumerate the display modes supported on output + result = deckLinkInput->GetDisplayModeIterator (&displayModeIterator); + if (result != S_OK) { + fprintf (stderr, + "Could not obtain the video output display mode iterator - result = %08x\n", + result); + goto bail; + } + // Parse command line options + while ((ch = getopt (argc, argv, "?h3c:s:f:a:m:n:p:t:")) != -1) { + switch (ch) { + case 'm': + g_videoModeIndex = atoi (optarg); + break; + case 'c': + g_audioChannels = atoi (optarg); + if (g_audioChannels != 2 && + g_audioChannels != 8 && g_audioChannels != 16) { + fprintf (stderr, + "Invalid argument: Audio Channels must be either 2, 8 or 16\n"); + goto bail; + } + break; + case 's': + g_audioSampleDepth = atoi (optarg); + if (g_audioSampleDepth != 16 && g_audioSampleDepth != 32) { + fprintf (stderr, + "Invalid argument: Audio Sample Depth must be either 16 bits or 32 bits\n"); + goto bail; + } + break; + case 'f': + g_videoOutputFile = optarg; + break; + case 'a': + g_audioOutputFile = optarg; + break; + case 'n': + g_maxFrames = atoi (optarg); + break; + case '3': + inputFlags |= bmdVideoInputDualStream3D; + break; + case 'p': + switch (atoi (optarg)) { + case 0: + pixelFormat = bmdFormat8BitYUV; + break; + case 1: + pixelFormat = bmdFormat10BitYUV; + break; + case 2: + pixelFormat = bmdFormat10BitRGB; + break; + default: + fprintf (stderr, "Invalid argument: Pixel format %d is not valid", + atoi (optarg)); + goto bail; + } + break; + case 't': + if (!strcmp (optarg, "rp188")) + g_timecodeFormat = bmdTimecodeRP188; + else if (!strcmp (optarg, "vitc")) + g_timecodeFormat = bmdTimecodeVITC; + else if (!strcmp (optarg, "serial")) + g_timecodeFormat = bmdTimecodeSerial; + else { + fprintf (stderr, + "Invalid argument: Timecode format \"%s\" is invalid\n", optarg); + goto bail; + } + break; + case '?': + case 'h': + usage (0); + } + } + + if (g_videoModeIndex < 0) { + fprintf (stderr, "No video mode specified\n"); + usage (0); + } + + if (g_videoOutputFile != NULL) { + videoOutputFile = + open (g_videoOutputFile, O_WRONLY | O_CREAT | O_TRUNC, 0664); + if (videoOutputFile < 0) { + fprintf (stderr, "Could not open video output file \"%s\"\n", + g_videoOutputFile); + goto bail; + } + } + if (g_audioOutputFile != NULL) { + audioOutputFile = + open (g_audioOutputFile, O_WRONLY | O_CREAT | O_TRUNC, 0664); + if (audioOutputFile < 0) { + fprintf (stderr, "Could not open audio output file \"%s\"\n", + g_audioOutputFile); + goto bail; + } + } + + while (displayModeIterator->Next (&displayMode) == S_OK) { + if (g_videoModeIndex == displayModeCount) { + BMDDisplayModeSupport result; + const char *displayModeName; + + foundDisplayMode = true; + displayMode->GetName (&displayModeName); + selectedDisplayMode = displayMode->GetDisplayMode (); + + deckLinkInput->DoesSupportVideoMode (selectedDisplayMode, pixelFormat, + bmdVideoInputFlagDefault, &result, NULL); + + if (result == bmdDisplayModeNotSupported) { + fprintf (stderr, + "The display mode %s is not supported with the selected pixel format\n", + displayModeName); + goto bail; + } + + if (inputFlags & bmdVideoInputDualStream3D) { + if (!(displayMode->GetFlags () & bmdDisplayModeSupports3D)) { + fprintf (stderr, "The display mode %s is not supported with 3D\n", + displayModeName); + goto bail; + } + } + + break; + } + displayModeCount++; + displayMode->Release (); + } + + if (!foundDisplayMode) { + fprintf (stderr, "Invalid mode %d specified\n", g_videoModeIndex); + goto bail; + } + + result = + deckLinkInput->EnableVideoInput (selectedDisplayMode, pixelFormat, + inputFlags); + if (result != S_OK) { + fprintf (stderr, + "Failed to enable video input. Is another application using the card?\n"); + goto bail; + } + + result = + deckLinkInput->EnableAudioInput (bmdAudioSampleRate48kHz, + g_audioSampleDepth, g_audioChannels); + if (result != S_OK) { + goto bail; + } + + result = deckLinkInput->StartStreams (); + if (result != S_OK) { + goto bail; + } + // All Okay. + exitStatus = 0; + + // Block main thread until signal occurs + pthread_mutex_lock (&sleepMutex); + pthread_cond_wait (&sleepCond, &sleepMutex); + pthread_mutex_unlock (&sleepMutex); + fprintf (stderr, "Stopping Capture\n"); + +bail: + + if (videoOutputFile) + close (videoOutputFile); + if (audioOutputFile) + close (audioOutputFile); + + if (displayModeIterator != NULL) { + displayModeIterator->Release (); + displayModeIterator = NULL; + } + + if (deckLinkInput != NULL) { + deckLinkInput->Release (); + deckLinkInput = NULL; + } + + if (deckLink != NULL) { + deckLink->Release (); + deckLink = NULL; + } + + if (deckLinkIterator != NULL) + deckLinkIterator->Release (); + + return exitStatus; +} +#endif + diff --git a/sys/decklink/capture.h b/sys/decklink/capture.h new file mode 100644 index 0000000000..3c1ab46951 --- /dev/null +++ b/sys/decklink/capture.h @@ -0,0 +1,25 @@ +#ifndef __CAPTURE_H__ +#define __CAPTURE_H__ + +#include "DeckLinkAPI.h" + +class DeckLinkCaptureDelegate : public IDeckLinkInputCallback +{ + public: + DeckLinkCaptureDelegate(); + ~DeckLinkCaptureDelegate(); + + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; } + virtual ULONG STDMETHODCALLTYPE AddRef(void); + virtual ULONG STDMETHODCALLTYPE Release(void); + virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(BMDVideoInputFormatChangedEvents, IDeckLinkDisplayMode*, BMDDetectedVideoInputFormatFlags); + virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(IDeckLinkVideoInputFrame*, IDeckLinkAudioInputPacket*); + + void *priv; + + private: + ULONG m_refCount; + pthread_mutex_t m_mutex; +}; + +#endif diff --git a/sys/decklink/gstdecklink.cpp b/sys/decklink/gstdecklink.cpp new file mode 100644 index 0000000000..4d4ed445ae --- /dev/null +++ b/sys/decklink/gstdecklink.cpp @@ -0,0 +1,44 @@ +/* GStreamer + * Copyright (C) 2011 David Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received 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 +#include "gstdecklinksrc.h" +#include "gstdecklinksink.h" + +static gboolean +plugin_init (GstPlugin * plugin) +{ + + gst_element_register (plugin, "decklinksrc", GST_RANK_NONE, + gst_decklink_src_get_type ()); + gst_element_register (plugin, "decklinksink", GST_RANK_NONE, + gst_decklink_sink_get_type ()); + + return TRUE; +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "decklink", + "Blackmagic Decklink plugin", + plugin_init, VERSION, "LGPL", PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/sys/decklink/gstdecklinksink.cpp b/sys/decklink/gstdecklinksink.cpp new file mode 100644 index 0000000000..43f78ebcf1 --- /dev/null +++ b/sys/decklink/gstdecklinksink.cpp @@ -0,0 +1,1050 @@ +/* GStreamer + * Copyright (C) 2011 David Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received 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-gstdecklinksink + * + * The decklinksink element is a sink element for BlackMagic DeckLink + * cards. + * + * + * Example launch line + * |[ + * gst-launch -v videotestsrc ! decklinksink + * ]| + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include "gstdecklinksink.h" +#include + +GST_DEBUG_CATEGORY_STATIC (gst_decklink_sink_debug_category); +#define GST_CAT_DEFAULT gst_decklink_sink_debug_category + +/* prototypes */ + + +static void gst_decklink_sink_set_property (GObject * object, + guint property_id, const GValue * value, GParamSpec * pspec); +static void gst_decklink_sink_get_property (GObject * object, + guint property_id, GValue * value, GParamSpec * pspec); +static void gst_decklink_sink_dispose (GObject * object); +static void gst_decklink_sink_finalize (GObject * object); + +static GstStateChangeReturn +gst_decklink_sink_change_state (GstElement * element, + GstStateChange transition); +static GstClock *gst_decklink_sink_provide_clock (GstElement * element); +static gboolean gst_decklink_sink_set_clock (GstElement * element, + GstClock * clock); +static GstIndex *gst_decklink_sink_get_index (GstElement * element); +static void gst_decklink_sink_set_index (GstElement * element, + GstIndex * index); +static gboolean gst_decklink_sink_send_event (GstElement * element, + GstEvent * event); +static gboolean gst_decklink_sink_query (GstElement * element, + GstQuery * query); + +static GstCaps *gst_decklink_sink_videosink_getcaps (GstPad * pad); +static gboolean gst_decklink_sink_videosink_setcaps (GstPad * pad, GstCaps * caps); +static gboolean gst_decklink_sink_videosink_acceptcaps (GstPad * pad, + GstCaps * caps); +static gboolean gst_decklink_sink_videosink_activate (GstPad * pad); +static gboolean gst_decklink_sink_videosink_activatepush (GstPad * pad, + gboolean active); +static gboolean gst_decklink_sink_videosink_activatepull (GstPad * pad, + gboolean active); +static GstPadLinkReturn gst_decklink_sink_videosink_link (GstPad * pad, + GstPad * peer); +static GstFlowReturn gst_decklink_sink_videosink_chain (GstPad * pad, + GstBuffer * buffer); +static GstFlowReturn gst_decklink_sink_videosink_chainlist (GstPad * pad, + GstBufferList * bufferlist); +static gboolean gst_decklink_sink_videosink_event (GstPad * pad, GstEvent * event); +static gboolean gst_decklink_sink_videosink_query (GstPad * pad, GstQuery * query); +static GstFlowReturn gst_decklink_sink_videosink_bufferalloc (GstPad * pad, + guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf); +static GstIterator *gst_decklink_sink_videosink_iterintlink (GstPad * pad); + + +static GstCaps *gst_decklink_sink_audiosink_getcaps (GstPad * pad); +static gboolean gst_decklink_sink_audiosink_setcaps (GstPad * pad, GstCaps * caps); +static gboolean gst_decklink_sink_audiosink_acceptcaps (GstPad * pad, + GstCaps * caps); +static gboolean gst_decklink_sink_audiosink_activate (GstPad * pad); +static gboolean gst_decklink_sink_audiosink_activatepush (GstPad * pad, + gboolean active); +static gboolean gst_decklink_sink_audiosink_activatepull (GstPad * pad, + gboolean active); +static GstPadLinkReturn gst_decklink_sink_audiosink_link (GstPad * pad, + GstPad * peer); +static GstFlowReturn gst_decklink_sink_audiosink_chain (GstPad * pad, + GstBuffer * buffer); +static GstFlowReturn gst_decklink_sink_audiosink_chainlist (GstPad * pad, + GstBufferList * bufferlist); +static gboolean gst_decklink_sink_audiosink_event (GstPad * pad, GstEvent * event); +static gboolean gst_decklink_sink_audiosink_query (GstPad * pad, GstQuery * query); +static GstFlowReturn gst_decklink_sink_audiosink_bufferalloc (GstPad * pad, + guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf); +static GstIterator *gst_decklink_sink_audiosink_iterintlink (GstPad * pad); + + +enum +{ + PROP_0 +}; + +/* pad templates */ + +#define MODE(w,h,n,d,i) \ + "video/x-raw-yuv,format=(fourcc)UYVY,width=" #w ",height=" #h \ + ",framerate=" #n "/" #d ",interlaced=" #i + +static GstStaticPadTemplate gst_decklink_sink_videosink_template = +GST_STATIC_PAD_TEMPLATE ("videosink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ( + MODE(720,486,30000,1001,true) + )); +#if 0 + MODE(720,486,24000,1001,true) ";" + MODE(720,576,25,1,true) ";" + MODE(1920,1080,24000,1001,false) ";" + MODE(1920,1080,24,1,false) ";" + MODE(1920,1080,25,1,false) ";" + MODE(1920,1080,30000,1001,false) ";" + MODE(1920,1080,30,1,false) ";" + MODE(1920,1080,25,1,true) ";" + MODE(1920,1080,30000,1001,true) ";" + MODE(1920,1080,30,1,true) ";" + MODE(1280,720,50,1,true) ";" + MODE(1280,720,60000,1001,true) ";" + MODE(1280,720,60,1,true) +#endif + +static GstStaticPadTemplate gst_decklink_sink_audiosink_template = +GST_STATIC_PAD_TEMPLATE ("audiosink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw-int,width=16,depth=16,channels=2,rate=48000") + ); + +typedef struct _DecklinkMode DecklinkMode; +struct _DecklinkMode { + BMDDisplayMode mode; + int width; + int height; + int fps_n; + int fps_d; + gboolean interlaced; +}; + +static DecklinkMode modes[] = { + { bmdModeNTSC, 720,486,30000,1001,true }, + { bmdModeNTSC2398, 720,486,24000,1001,true }, + { bmdModePAL, 720,576,25,1,true }, + { bmdModeHD1080p2398, 1920,1080,24000,1001,false }, + { bmdModeHD1080p24, 1920,1080,24,1,false }, + { bmdModeHD1080p25, 1920,1080,25,1,false }, + { bmdModeHD1080p2997, 1920,1080,30000,1001,false }, + { bmdModeHD1080p30, 1920,1080,30,1,false }, + { bmdModeHD1080i50, 1920,1080,25,1,true }, + { bmdModeHD1080i5994, 1920,1080,30000,1001,true }, + { bmdModeHD1080i6000, 1920,1080,30,1,true }, + { bmdModeHD720p50, 1280,720,50,1,true }, + { bmdModeHD720p5994, 1280,720,60000,1001,true }, + { bmdModeHD720p60, 1280,720,60,1,true } +}; + + +/* class initialization */ + +#define DEBUG_INIT(bla) \ + GST_DEBUG_CATEGORY_INIT (gst_decklink_sink_debug_category, "decklinksink", 0, \ + "debug category for decklinksink element"); + +GST_BOILERPLATE_FULL (GstDecklinkSink, gst_decklink_sink, GstElement, + GST_TYPE_ELEMENT, DEBUG_INIT); + +static void +gst_decklink_sink_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_decklink_sink_videosink_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_decklink_sink_audiosink_template)); + + gst_element_class_set_details_simple (element_class, "Decklink Sink", + "Video/Sink", "Decklink Sink", "David Schleef "); +} + +static void +gst_decklink_sink_class_init (GstDecklinkSinkClass * klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + + gobject_class->set_property = gst_decklink_sink_set_property; + gobject_class->get_property = gst_decklink_sink_get_property; + gobject_class->dispose = gst_decklink_sink_dispose; + gobject_class->finalize = gst_decklink_sink_finalize; + element_class->change_state = + GST_DEBUG_FUNCPTR (gst_decklink_sink_change_state); + element_class->provide_clock = + GST_DEBUG_FUNCPTR (gst_decklink_sink_provide_clock); + element_class->set_clock = GST_DEBUG_FUNCPTR (gst_decklink_sink_set_clock); + element_class->get_index = GST_DEBUG_FUNCPTR (gst_decklink_sink_get_index); + element_class->set_index = GST_DEBUG_FUNCPTR (gst_decklink_sink_set_index); + element_class->send_event = GST_DEBUG_FUNCPTR (gst_decklink_sink_send_event); + element_class->query = GST_DEBUG_FUNCPTR (gst_decklink_sink_query); + +} + +static void +gst_decklink_sink_init (GstDecklinkSink * decklinksink, + GstDecklinkSinkClass * decklinksink_class) +{ + + decklinksink->videosinkpad = + gst_pad_new_from_static_template (&gst_decklink_sink_videosink_template, + "sink"); + gst_pad_set_getcaps_function (decklinksink->videosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_getcaps)); + gst_pad_set_setcaps_function (decklinksink->videosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_setcaps)); + gst_pad_set_acceptcaps_function (decklinksink->videosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_acceptcaps)); + gst_pad_set_activate_function (decklinksink->videosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_activate)); + gst_pad_set_activatepush_function (decklinksink->videosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_activatepush)); + gst_pad_set_activatepull_function (decklinksink->videosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_activatepull)); + gst_pad_set_link_function (decklinksink->videosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_link)); + gst_pad_set_chain_function (decklinksink->videosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_chain)); + gst_pad_set_chain_list_function (decklinksink->videosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_chainlist)); + gst_pad_set_event_function (decklinksink->videosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_event)); + gst_pad_set_query_function (decklinksink->videosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_query)); + gst_pad_set_bufferalloc_function (decklinksink->videosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_bufferalloc)); + gst_pad_set_iterate_internal_links_function (decklinksink->videosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_iterintlink)); + gst_element_add_pad (GST_ELEMENT (decklinksink), decklinksink->videosinkpad); + + + + decklinksink->audiosinkpad = + gst_pad_new_from_static_template (&gst_decklink_sink_audiosink_template, + "audiosink"); + gst_pad_set_getcaps_function (decklinksink->audiosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_getcaps)); + gst_pad_set_setcaps_function (decklinksink->audiosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_setcaps)); + gst_pad_set_acceptcaps_function (decklinksink->audiosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_acceptcaps)); + gst_pad_set_activate_function (decklinksink->audiosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_activate)); + gst_pad_set_activatepush_function (decklinksink->audiosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_activatepush)); + gst_pad_set_activatepull_function (decklinksink->audiosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_activatepull)); + gst_pad_set_link_function (decklinksink->audiosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_link)); + gst_pad_set_chain_function (decklinksink->audiosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_chain)); + gst_pad_set_chain_list_function (decklinksink->audiosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_chainlist)); + gst_pad_set_event_function (decklinksink->audiosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_event)); + gst_pad_set_query_function (decklinksink->audiosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_query)); + gst_pad_set_bufferalloc_function (decklinksink->audiosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_bufferalloc)); + gst_pad_set_iterate_internal_links_function (decklinksink->audiosinkpad, + GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_iterintlink)); + gst_element_add_pad (GST_ELEMENT (decklinksink), decklinksink->audiosinkpad); + + + decklinksink->cond = g_cond_new(); + decklinksink->mutex = g_mutex_new(); + + decklinksink->mode = 0; + + decklinksink->width = modes[decklinksink->mode].width; + decklinksink->height = modes[decklinksink->mode].height; + decklinksink->fps_n = modes[decklinksink->mode].fps_n; + decklinksink->fps_d = modes[decklinksink->mode].fps_d; + decklinksink->interlaced = modes[decklinksink->mode].interlaced; + decklinksink->bmd_mode = modes[decklinksink->mode].mode; + + decklinksink->callback = new Output; + decklinksink->callback->decklinksink = decklinksink; +} + +void +gst_decklink_sink_set_property (GObject * object, guint property_id, + const GValue * value, GParamSpec * pspec) +{ + g_return_if_fail (GST_IS_DECKLINK_SINK (object)); + + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +void +gst_decklink_sink_get_property (GObject * object, guint property_id, + GValue * value, GParamSpec * pspec) +{ + g_return_if_fail (GST_IS_DECKLINK_SINK (object)); + + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +void +gst_decklink_sink_dispose (GObject * object) +{ + g_return_if_fail (GST_IS_DECKLINK_SINK (object)); + + /* clean up as possible. may be called multiple times */ + + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +void +gst_decklink_sink_finalize (GObject * object) +{ + GstDecklinkSink *decklinksink; + + g_return_if_fail (GST_IS_DECKLINK_SINK (object)); + decklinksink = GST_DECKLINK_SINK (object); + + /* clean up object here */ + g_cond_free (decklinksink->cond); + g_mutex_free (decklinksink->mutex); + + delete decklinksink->callback; + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static gboolean +gst_decklink_sink_start (GstDecklinkSink *decklinksink) +{ + IDeckLinkIterator *iterator; + HRESULT ret; + IDeckLinkDisplayModeIterator *mode_iterator; + IDeckLinkDisplayMode *mode; + BMDTimeValue fps_n; + BMDTimeScale fps_d; + + iterator = CreateDeckLinkIteratorInstance (); + if (iterator == NULL) { + GST_ERROR("no driver"); + return FALSE; + } + + ret = iterator->Next (&decklinksink->decklink); + if (ret != S_OK) { + GST_ERROR("no card"); + return FALSE; + } + + ret = decklinksink->decklink->QueryInterface (IID_IDeckLinkOutput, + (void **)&decklinksink->output); + if (ret != S_OK) { + GST_ERROR ("no output"); + return FALSE; + } + + decklinksink->output->SetAudioCallback (decklinksink->callback); + + ret = decklinksink->output->GetDisplayModeIterator (&mode_iterator); + if (ret != S_OK) { + GST_ERROR ("failed to get display mode iterator"); + return FALSE; + } + + while (mode_iterator->Next (&mode) == S_OK) { + break; + } + if (!mode) { + GST_ERROR ("bad mode"); + return FALSE; + } + + decklinksink->width = mode->GetWidth (); + decklinksink->height = mode->GetHeight (); + mode->GetFrameRate (&fps_n, &fps_d); + decklinksink->fps_n = fps_n; + decklinksink->fps_d = fps_d; + + decklinksink->display_mode = mode->GetDisplayMode (); + + ret = decklinksink->output->EnableVideoOutput (decklinksink->display_mode, + bmdVideoOutputFlagDefault); + if (ret != S_OK) { + GST_ERROR ("failed to enable video output"); + return FALSE; + } + //decklinksink->video_enabled = TRUE; + + decklinksink->output->SetScheduledFrameCompletionCallback (decklinksink->callback); + + if (0) { + ret = decklinksink->output->EnableAudioOutput (bmdAudioSampleRate48kHz, + 16, 2, bmdAudioOutputStreamContinuous); + if (ret != S_OK) { + GST_ERROR ("failed to enable audio output"); + return FALSE; + } + } + + decklinksink->num_frames = 0; + + return TRUE; +} + +static gboolean +gst_decklink_sink_force_stop (GstDecklinkSink *decklinksink) +{ + g_mutex_lock (decklinksink->mutex); + decklinksink->stop = TRUE; + g_cond_signal (decklinksink->cond); + g_mutex_unlock (decklinksink->mutex); + + return TRUE; +} + +static gboolean +gst_decklink_sink_stop (GstDecklinkSink *decklinksink) +{ + decklinksink->output->StopScheduledPlayback (0, NULL, 0); + decklinksink->output->DisableAudioOutput (); + decklinksink->output->DisableVideoOutput (); + + return TRUE; +} + +static GstStateChangeReturn +gst_decklink_sink_change_state (GstElement * element, GstStateChange transition) +{ + GstDecklinkSink *decklinksink; + GstStateChangeReturn ret; + + g_return_val_if_fail (GST_IS_DECKLINK_SINK (element), + GST_STATE_CHANGE_FAILURE); + decklinksink = GST_DECKLINK_SINK (element); + + switch (transition) { + case GST_STATE_CHANGE_NULL_TO_READY: + if (!gst_decklink_sink_start (decklinksink)) { + ret = GST_STATE_CHANGE_FAILURE; + goto out; + } + break; + case GST_STATE_CHANGE_READY_TO_PAUSED: + break; + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: + break; + default: + break; + } + + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + + switch (transition) { + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: + gst_decklink_sink_force_stop (decklinksink); + break; + case GST_STATE_CHANGE_PAUSED_TO_READY: + break; + case GST_STATE_CHANGE_READY_TO_NULL: + gst_decklink_sink_stop (decklinksink); + break; + default: + break; + } + +out: + return ret; +} + +static GstClock * +gst_decklink_sink_provide_clock (GstElement * element) +{ + + return NULL; +} + +static gboolean +gst_decklink_sink_set_clock (GstElement * element, GstClock * clock) +{ + + return TRUE; +} + +static GstIndex * +gst_decklink_sink_get_index (GstElement * element) +{ + + return NULL; +} + +static void +gst_decklink_sink_set_index (GstElement * element, GstIndex * index) +{ + +} + +static gboolean +gst_decklink_sink_send_event (GstElement * element, GstEvent * event) +{ + + return TRUE; +} + +static gboolean +gst_decklink_sink_query (GstElement * element, GstQuery * query) +{ + + return FALSE; +} + +static GstCaps * +gst_decklink_sink_videosink_getcaps (GstPad * pad) +{ + GstDecklinkSink *decklinksink; + GstCaps *caps; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "getcaps"); + + caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); + + gst_object_unref (decklinksink); + return caps; +} + +static gboolean +gst_decklink_sink_videosink_setcaps (GstPad * pad, GstCaps * caps) +{ + GstDecklinkSink *decklinksink; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "setcaps"); + + + gst_object_unref (decklinksink); + return TRUE; +} + +static gboolean +gst_decklink_sink_videosink_acceptcaps (GstPad * pad, GstCaps * caps) +{ + GstDecklinkSink *decklinksink; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "acceptcaps"); + + + gst_object_unref (decklinksink); + return TRUE; +} + +static gboolean +gst_decklink_sink_videosink_activate (GstPad * pad) +{ + GstDecklinkSink *decklinksink; + gboolean ret; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "activate"); + + if (gst_pad_check_pull_range (pad)) { + GST_DEBUG_OBJECT (pad, "activating pull"); + ret = gst_pad_activate_pull (pad, TRUE); + } else { + GST_DEBUG_OBJECT (pad, "activating push"); + ret = gst_pad_activate_push (pad, TRUE); + } + + gst_object_unref (decklinksink); + return ret; +} + +static gboolean +gst_decklink_sink_videosink_activatepush (GstPad * pad, gboolean active) +{ + GstDecklinkSink *decklinksink; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "activatepush"); + + + gst_object_unref (decklinksink); + return TRUE; +} + +static gboolean +gst_decklink_sink_videosink_activatepull (GstPad * pad, gboolean active) +{ + GstDecklinkSink *decklinksink; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "activatepull"); + + + gst_object_unref (decklinksink); + return TRUE; +} + +static GstPadLinkReturn +gst_decklink_sink_videosink_link (GstPad * pad, GstPad * peer) +{ + GstDecklinkSink *decklinksink; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "link"); + + + gst_object_unref (decklinksink); + return GST_PAD_LINK_OK; +} + +static GstFlowReturn +gst_decklink_sink_videosink_chain (GstPad * pad, GstBuffer * buffer) +{ + GstDecklinkSink *decklinksink; + IDeckLinkMutableVideoFrame *frame; + void *data; + GstFlowReturn ret; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "chain"); + +#if 0 + if (!decklinksink->video_enabled) { + HRESULT ret; + ret = decklinksink->output->EnableVideoOutput (decklinksink->display_mode, + bmdVideoOutputFlagDefault); + if (ret != S_OK) { + GST_ERROR ("failed to enable video output"); + //return FALSE; + } + decklinksink->video_enabled = TRUE; + } +#endif + + decklinksink->output->CreateVideoFrame (decklinksink->width, + decklinksink->height, decklinksink->width * 2, bmdFormat8BitYUV, + bmdFrameFlagDefault, &frame); + + frame->GetBytes (&data); + memcpy (data, GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer)); + gst_buffer_unref (buffer); + + g_mutex_lock (decklinksink->mutex); + while (decklinksink->queued_frames > 2 && !decklinksink->stop) { + g_cond_wait (decklinksink->cond, decklinksink->mutex); + } + if (!decklinksink->stop) { + decklinksink->queued_frames++; + } + g_mutex_unlock (decklinksink->mutex); + + if (!decklinksink->stop) { + decklinksink->output->ScheduleVideoFrame (frame, + decklinksink->num_frames * decklinksink->fps_n, + decklinksink->fps_n, decklinksink->fps_d); + decklinksink->num_frames++; + + if (!decklinksink->sched_started) { + decklinksink->output->StartScheduledPlayback (0, 100, 1.0); + decklinksink->sched_started = TRUE; + } + + ret = GST_FLOW_OK; + } else { + ret = GST_FLOW_WRONG_STATE; + } + + frame->Release (); + + gst_object_unref (decklinksink); + return ret; +} + +static GstFlowReturn +gst_decklink_sink_videosink_chainlist (GstPad * pad, GstBufferList * bufferlist) +{ + GstDecklinkSink *decklinksink; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "chainlist"); + + + gst_object_unref (decklinksink); + return GST_FLOW_OK; +} + +static gboolean +gst_decklink_sink_videosink_event (GstPad * pad, GstEvent * event) +{ + gboolean res; + GstDecklinkSink *decklinksink; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "event"); + + switch (GST_EVENT_TYPE (event)) { + default: + res = gst_pad_event_default (pad, event); + break; + } + + gst_object_unref (decklinksink); + return res; +} + +static gboolean +gst_decklink_sink_videosink_query (GstPad * pad, GstQuery * query) +{ + gboolean res; + GstDecklinkSink *decklinksink; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "query"); + + switch (GST_QUERY_TYPE (query)) { + default: + res = gst_pad_query_default (pad, query); + break; + } + + gst_object_unref (decklinksink); + return res; +} + +static GstFlowReturn +gst_decklink_sink_videosink_bufferalloc (GstPad * pad, guint64 offset, guint size, + GstCaps * caps, GstBuffer ** buf) +{ + GstDecklinkSink *decklinksink; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "bufferalloc"); + + + *buf = gst_buffer_new_and_alloc (size); + gst_buffer_set_caps (*buf, caps); + + gst_object_unref (decklinksink); + return GST_FLOW_OK; +} + +static GstIterator * +gst_decklink_sink_videosink_iterintlink (GstPad * pad) +{ + GstDecklinkSink *decklinksink; + GstIterator *iter; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "iterintlink"); + + iter = gst_pad_iterate_internal_links_default (pad); + + gst_object_unref (decklinksink); + return iter; +} + + +static GstCaps * +gst_decklink_sink_audiosink_getcaps (GstPad * pad) +{ + GstDecklinkSink *decklinksink; + GstCaps *caps; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "getcaps"); + + caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); + + gst_object_unref (decklinksink); + return caps; +} + +static gboolean +gst_decklink_sink_audiosink_setcaps (GstPad * pad, GstCaps * caps) +{ + GstDecklinkSink *decklinksink; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "setcaps"); + + + gst_object_unref (decklinksink); + return TRUE; +} + +static gboolean +gst_decklink_sink_audiosink_acceptcaps (GstPad * pad, GstCaps * caps) +{ + GstDecklinkSink *decklinksink; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "acceptcaps"); + + + gst_object_unref (decklinksink); + return TRUE; +} + +static gboolean +gst_decklink_sink_audiosink_activate (GstPad * pad) +{ + GstDecklinkSink *decklinksink; + gboolean ret; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "activate"); + + if (gst_pad_check_pull_range (pad)) { + GST_DEBUG_OBJECT (pad, "activating pull"); + ret = gst_pad_activate_pull (pad, TRUE); + } else { + GST_DEBUG_OBJECT (pad, "activating push"); + ret = gst_pad_activate_push (pad, TRUE); + } + + gst_object_unref (decklinksink); + return ret; +} + +static gboolean +gst_decklink_sink_audiosink_activatepush (GstPad * pad, gboolean active) +{ + GstDecklinkSink *decklinksink; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "activatepush"); + + + gst_object_unref (decklinksink); + return TRUE; +} + +static gboolean +gst_decklink_sink_audiosink_activatepull (GstPad * pad, gboolean active) +{ + GstDecklinkSink *decklinksink; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "activatepull"); + + + gst_object_unref (decklinksink); + return TRUE; +} + +static GstPadLinkReturn +gst_decklink_sink_audiosink_link (GstPad * pad, GstPad * peer) +{ + GstDecklinkSink *decklinksink; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "link"); + + + gst_object_unref (decklinksink); + return GST_PAD_LINK_OK; +} + +static GstFlowReturn +gst_decklink_sink_audiosink_chain (GstPad * pad, GstBuffer * buffer) +{ + GstDecklinkSink *decklinksink; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "chain"); + + + gst_object_unref (decklinksink); + return GST_FLOW_OK; +} + +static GstFlowReturn +gst_decklink_sink_audiosink_chainlist (GstPad * pad, GstBufferList * bufferlist) +{ + GstDecklinkSink *decklinksink; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "chainlist"); + + + gst_object_unref (decklinksink); + return GST_FLOW_OK; +} + +static gboolean +gst_decklink_sink_audiosink_event (GstPad * pad, GstEvent * event) +{ + gboolean res; + GstDecklinkSink *decklinksink; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "event"); + + switch (GST_EVENT_TYPE (event)) { + default: + res = gst_pad_event_default (pad, event); + break; + } + + gst_object_unref (decklinksink); + return res; +} + +static gboolean +gst_decklink_sink_audiosink_query (GstPad * pad, GstQuery * query) +{ + gboolean res; + GstDecklinkSink *decklinksink; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "query"); + + switch (GST_QUERY_TYPE (query)) { + default: + res = gst_pad_query_default (pad, query); + break; + } + + gst_object_unref (decklinksink); + return res; +} + +static GstFlowReturn +gst_decklink_sink_audiosink_bufferalloc (GstPad * pad, guint64 offset, guint size, + GstCaps * caps, GstBuffer ** buf) +{ + GstDecklinkSink *decklinksink; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "bufferalloc"); + + + *buf = gst_buffer_new_and_alloc (size); + gst_buffer_set_caps (*buf, caps); + + gst_object_unref (decklinksink); + return GST_FLOW_OK; +} + +static GstIterator * +gst_decklink_sink_audiosink_iterintlink (GstPad * pad) +{ + GstDecklinkSink *decklinksink; + GstIterator *iter; + + decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksink, "iterintlink"); + + iter = gst_pad_iterate_internal_links_default (pad); + + gst_object_unref (decklinksink); + return iter; +} + + + +HRESULT +Output::ScheduledFrameCompleted (IDeckLinkVideoFrame * completedFrame, + BMDOutputFrameCompletionResult result) +{ + GST_DEBUG("ScheduledFrameCompleted"); + + g_mutex_lock (decklinksink->mutex); + g_cond_signal (decklinksink->cond); + decklinksink->queued_frames--; + g_mutex_unlock (decklinksink->mutex); + + return S_OK; +} + +HRESULT +Output::ScheduledPlaybackHasStopped () +{ + GST_ERROR("ScheduledPlaybackHasStopped"); + return S_OK; +} + +HRESULT +Output::RenderAudioSamples (bool preroll) +{ + GST_ERROR("RenderAudioSamples"); + + return S_OK; +} + diff --git a/sys/decklink/gstdecklinksink.h b/sys/decklink/gstdecklinksink.h new file mode 100644 index 0000000000..2f0d1d799b --- /dev/null +++ b/sys/decklink/gstdecklinksink.h @@ -0,0 +1,92 @@ +/* GStreamer + * Copyright (C) 2011 David Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _GST_DECKLINK_SINK_H_ +#define _GST_DECKLINK_SINK_H_ + +#include +#include "DeckLinkAPI.h" + +G_BEGIN_DECLS + +#define GST_TYPE_DECKLINK_SINK (gst_decklink_sink_get_type()) +#define GST_DECKLINK_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DECKLINK_SINK,GstDecklinkSink)) +#define GST_DECKLINK_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DECKLINK_SINK,GstDecklinkSinkClass)) +#define GST_IS_DECKLINK_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DECKLINK_SINK)) +#define GST_IS_DECKLINK_SINK_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DECKLINK_SINK)) + +typedef struct _GstDecklinkSink GstDecklinkSink; +typedef struct _GstDecklinkSinkClass GstDecklinkSinkClass; + +class Output : public IDeckLinkVideoOutputCallback, +public IDeckLinkAudioOutputCallback +{ + public: + GstDecklinkSink *decklinksink; + + virtual HRESULT STDMETHODCALLTYPE QueryInterface (REFIID iid, LPVOID *ppv) {return E_NOINTERFACE;} + virtual ULONG STDMETHODCALLTYPE AddRef () {return 1;} + virtual ULONG STDMETHODCALLTYPE Release () {return 1;} + virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted (IDeckLinkVideoFrame* completedFrame, BMDOutputFrameCompletionResult result); + virtual HRESULT STDMETHODCALLTYPE ScheduledPlaybackHasStopped (); + virtual HRESULT STDMETHODCALLTYPE RenderAudioSamples (bool preroll); +}; + +struct _GstDecklinkSink +{ + GstElement base_decklinksink; + + GstPad *videosinkpad; + GstPad *audiosinkpad; + + GMutex *mutex; + GCond *cond; + int queued_frames; + gboolean stop; + + IDeckLink *decklink; + IDeckLinkOutput *output; + Output *callback; + BMDDisplayMode display_mode; + gboolean video_enabled; + gboolean sched_started; + + int num_frames; + int fps_n; + int fps_d; + int width; + int height; + gboolean interlaced; + BMDDisplayMode bmd_mode; + + /* properties */ + int mode; + +}; + +struct _GstDecklinkSinkClass +{ + GstElementClass base_decklinksink_class; +}; + +GType gst_decklink_sink_get_type (void); + +G_END_DECLS + +#endif diff --git a/sys/decklink/gstdecklinksrc.cpp b/sys/decklink/gstdecklinksrc.cpp new file mode 100644 index 0000000000..373cd96156 --- /dev/null +++ b/sys/decklink/gstdecklinksrc.cpp @@ -0,0 +1,1085 @@ +/* GStreamer + * Copyright (C) 2011 David Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received 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-gstdecklinksrc + * + * The decklinksrc element is a source element for Blackmagic + * Decklink cards. + * + * + * Example launch line + * |[ + * gst-launch -v decklinksrc ! xvimagesink + * ]| + * + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include "gstdecklinksrc.h" +#include "capture.h" +#include + +GST_DEBUG_CATEGORY_STATIC (gst_decklink_src_debug_category); +#define GST_CAT_DEFAULT gst_decklink_src_debug_category + +/* prototypes */ + + +static void gst_decklink_src_set_property (GObject * object, + guint property_id, const GValue * value, GParamSpec * pspec); +static void gst_decklink_src_get_property (GObject * object, + guint property_id, GValue * value, GParamSpec * pspec); +static void gst_decklink_src_dispose (GObject * object); +static void gst_decklink_src_finalize (GObject * object); + +static GstPad *gst_decklink_src_request_new_pad (GstElement * element, + GstPadTemplate * templ, const gchar * name); +static void gst_decklink_src_release_pad (GstElement * element, GstPad * pad); +static GstStateChangeReturn +gst_decklink_src_change_state (GstElement * element, GstStateChange transition); +static GstClock *gst_decklink_src_provide_clock (GstElement * element); +static gboolean gst_decklink_src_set_clock (GstElement * element, + GstClock * clock); +static GstIndex *gst_decklink_src_get_index (GstElement * element); +static void gst_decklink_src_set_index (GstElement * element, GstIndex * index); +static gboolean gst_decklink_src_send_event (GstElement * element, + GstEvent * event); +static gboolean gst_decklink_src_query (GstElement * element, GstQuery * query); + +static GstCaps *gst_decklink_src_audio_src_getcaps (GstPad * pad); +static gboolean gst_decklink_src_audio_src_setcaps (GstPad * pad, GstCaps * caps); +static gboolean gst_decklink_src_audio_src_acceptcaps (GstPad * pad, GstCaps * caps); +static void gst_decklink_src_audio_src_fixatecaps (GstPad * pad, GstCaps * caps); +static gboolean gst_decklink_src_audio_src_activate (GstPad * pad); +static gboolean gst_decklink_src_audio_src_activatepush (GstPad * pad, + gboolean active); +static gboolean gst_decklink_src_audio_src_activatepull (GstPad * pad, + gboolean active); +static GstPadLinkReturn gst_decklink_src_audio_src_link (GstPad * pad, GstPad * peer); +static GstFlowReturn gst_decklink_src_audio_src_getrange (GstPad * pad, + guint64 offset, guint length, GstBuffer ** buffer); +static gboolean gst_decklink_src_audio_src_event (GstPad * pad, GstEvent * event); +static gboolean gst_decklink_src_audio_src_query (GstPad * pad, GstQuery * query); +static GstIterator *gst_decklink_src_audio_src_iterintlink (GstPad * pad); + + +static GstCaps *gst_decklink_src_video_src_getcaps (GstPad * pad); +static gboolean gst_decklink_src_video_src_setcaps (GstPad * pad, GstCaps * caps); +static gboolean gst_decklink_src_video_src_acceptcaps (GstPad * pad, GstCaps * caps); +static void gst_decklink_src_video_src_fixatecaps (GstPad * pad, GstCaps * caps); +static gboolean gst_decklink_src_video_src_activate (GstPad * pad); +static gboolean gst_decklink_src_video_src_activatepush (GstPad * pad, + gboolean active); +static gboolean gst_decklink_src_video_src_activatepull (GstPad * pad, + gboolean active); +static GstPadLinkReturn gst_decklink_src_video_src_link (GstPad * pad, GstPad * peer); +static GstFlowReturn gst_decklink_src_video_src_getrange (GstPad * pad, + guint64 offset, guint length, GstBuffer ** buffer); +static gboolean gst_decklink_src_video_src_event (GstPad * pad, GstEvent * event); +static gboolean gst_decklink_src_video_src_query (GstPad * pad, GstQuery * query); +static GstIterator *gst_decklink_src_video_src_iterintlink (GstPad * pad); + +static void gst_decklink_src_task (void *priv); + +enum +{ + PROP_0 +}; + +/* pad templates */ + +static GstStaticPadTemplate gst_decklink_src_audio_src_template = +GST_STATIC_PAD_TEMPLATE ("audiosrc", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("audio/x-raw-int,width=16,depth=16,channels=2,rate=48000") + ); + +#define MODE(w,h,n,d,i) \ + "video/x-raw-yuv,format=(fourcc)UYVY,width=" #w ",height=" #h \ + ",framerate=" #n "/" #d ",interlaced=" #i + +static GstStaticPadTemplate gst_decklink_src_video_src_template = +GST_STATIC_PAD_TEMPLATE ("videosrc", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ( + MODE(720,486,30000,1001,true) ";" + MODE(720,486,24000,1001,true) ";" + MODE(720,576,25,1,true) ";" + MODE(1920,1080,24000,1001,false) ";" + MODE(1920,1080,24,1,false) ";" + MODE(1920,1080,25,1,false) ";" + MODE(1920,1080,30000,1001,false) ";" + MODE(1920,1080,30,1,false) ";" + MODE(1920,1080,25,1,true) ";" + MODE(1920,1080,30000,1001,true) ";" + MODE(1920,1080,30,1,true) ";" + MODE(1280,720,50,1,true) ";" + MODE(1280,720,60000,1001,true) ";" + MODE(1280,720,60,1,true) + )); + +typedef struct _DecklinkMode DecklinkMode; +struct _DecklinkMode { + BMDDisplayMode mode; + int width; + int height; + int fps_n; + int fps_d; + gboolean interlaced; +}; + +static DecklinkMode modes[] = { + { bmdModeNTSC, 720,486,30000,1001,true }, + { bmdModeNTSC2398, 720,486,24000,1001,true }, + { bmdModePAL, 720,576,25,1,true }, + { bmdModeHD1080p2398, 1920,1080,24000,1001,false }, + { bmdModeHD1080p24, 1920,1080,24,1,false }, + { bmdModeHD1080p25, 1920,1080,25,1,false }, + { bmdModeHD1080p2997, 1920,1080,30000,1001,false }, + { bmdModeHD1080p30, 1920,1080,30,1,false }, + { bmdModeHD1080i50, 1920,1080,25,1,true }, + { bmdModeHD1080i5994, 1920,1080,30000,1001,true }, + { bmdModeHD1080i6000, 1920,1080,30,1,true }, + { bmdModeHD720p50, 1280,720,50,1,true }, + { bmdModeHD720p5994, 1280,720,60000,1001,true }, + { bmdModeHD720p60, 1280,720,60,1,true } +}; + + +/* class initialization */ + +#define DEBUG_INIT(bla) \ + GST_DEBUG_CATEGORY_INIT (gst_decklink_src_debug_category, "decklinksrc", 0, \ + "debug category for decklinksrc element"); + +GST_BOILERPLATE_FULL (GstDecklinkSrc, gst_decklink_src, GstElement, + GST_TYPE_ELEMENT, DEBUG_INIT); + +static void +gst_decklink_src_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_decklink_src_audio_src_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_decklink_src_video_src_template)); + + gst_element_class_set_details_simple (element_class, "Decklink source", + "Source/Video", "DeckLink Source", "David Schleef "); +} + +static void +gst_decklink_src_class_init (GstDecklinkSrcClass * klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + + gobject_class->set_property = gst_decklink_src_set_property; + gobject_class->get_property = gst_decklink_src_get_property; + gobject_class->dispose = gst_decklink_src_dispose; + gobject_class->finalize = gst_decklink_src_finalize; + element_class->request_new_pad = + GST_DEBUG_FUNCPTR (gst_decklink_src_request_new_pad); + element_class->release_pad = GST_DEBUG_FUNCPTR (gst_decklink_src_release_pad); + element_class->change_state = + GST_DEBUG_FUNCPTR (gst_decklink_src_change_state); + element_class->provide_clock = + GST_DEBUG_FUNCPTR (gst_decklink_src_provide_clock); + element_class->set_clock = GST_DEBUG_FUNCPTR (gst_decklink_src_set_clock); + element_class->get_index = GST_DEBUG_FUNCPTR (gst_decklink_src_get_index); + element_class->set_index = GST_DEBUG_FUNCPTR (gst_decklink_src_set_index); + element_class->send_event = GST_DEBUG_FUNCPTR (gst_decklink_src_send_event); + element_class->query = GST_DEBUG_FUNCPTR (gst_decklink_src_query); + +} + +static void +gst_decklink_src_init (GstDecklinkSrc * decklinksrc, + GstDecklinkSrcClass * decklinksrc_class) +{ + g_static_rec_mutex_init (&decklinksrc->task_mutex); + decklinksrc->task = gst_task_create (gst_decklink_src_task, decklinksrc); + gst_task_set_lock (decklinksrc->task, &decklinksrc->task_mutex); + + decklinksrc->audiosrcpad = + gst_pad_new_from_static_template (&gst_decklink_src_audio_src_template, "audiosrc"); + gst_pad_set_getcaps_function (decklinksrc->audiosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_getcaps)); + gst_pad_set_setcaps_function (decklinksrc->audiosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_setcaps)); + gst_pad_set_acceptcaps_function (decklinksrc->audiosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_acceptcaps)); + gst_pad_set_fixatecaps_function (decklinksrc->audiosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_fixatecaps)); + gst_pad_set_activate_function (decklinksrc->audiosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_activate)); + gst_pad_set_activatepush_function (decklinksrc->audiosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_activatepush)); + gst_pad_set_activatepull_function (decklinksrc->audiosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_activatepull)); + gst_pad_set_link_function (decklinksrc->audiosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_link)); + gst_pad_set_getrange_function (decklinksrc->audiosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_getrange)); + gst_pad_set_event_function (decklinksrc->audiosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_event)); + gst_pad_set_query_function (decklinksrc->audiosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_query)); + gst_pad_set_iterate_internal_links_function (decklinksrc->audiosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_iterintlink)); + gst_element_add_pad (GST_ELEMENT (decklinksrc), decklinksrc->audiosrcpad); + + + + decklinksrc->videosrcpad = + gst_pad_new_from_static_template (&gst_decklink_src_video_src_template, "videosrc"); + gst_pad_set_getcaps_function (decklinksrc->videosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_getcaps)); + gst_pad_set_setcaps_function (decklinksrc->videosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_setcaps)); + gst_pad_set_acceptcaps_function (decklinksrc->videosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_acceptcaps)); + gst_pad_set_fixatecaps_function (decklinksrc->videosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_fixatecaps)); + gst_pad_set_activate_function (decklinksrc->videosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_activate)); + gst_pad_set_activatepush_function (decklinksrc->videosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_activatepush)); + gst_pad_set_activatepull_function (decklinksrc->videosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_activatepull)); + gst_pad_set_link_function (decklinksrc->videosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_link)); + gst_pad_set_getrange_function (decklinksrc->videosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_getrange)); + gst_pad_set_event_function (decklinksrc->videosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_event)); + gst_pad_set_query_function (decklinksrc->videosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_query)); + gst_pad_set_iterate_internal_links_function (decklinksrc->videosrcpad, + GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_iterintlink)); + gst_element_add_pad (GST_ELEMENT (decklinksrc), decklinksrc->videosrcpad); + + + decklinksrc->cond = g_cond_new(); + decklinksrc->mutex = g_mutex_new(); + + decklinksrc->copy_data = TRUE; + decklinksrc->mode = 0; + + decklinksrc->width = modes[decklinksrc->mode].width; + decklinksrc->height = modes[decklinksrc->mode].height; + decklinksrc->fps_n = modes[decklinksrc->mode].fps_n; + decklinksrc->fps_d = modes[decklinksrc->mode].fps_d; + decklinksrc->interlaced = modes[decklinksrc->mode].interlaced; + decklinksrc->bmd_mode = modes[decklinksrc->mode].mode; + +} + +void +gst_decklink_src_set_property (GObject * object, guint property_id, + const GValue * value, GParamSpec * pspec) +{ + g_return_if_fail (GST_IS_DECKLINK_SRC (object)); + + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +void +gst_decklink_src_get_property (GObject * object, guint property_id, + GValue * value, GParamSpec * pspec) +{ + g_return_if_fail (GST_IS_DECKLINK_SRC (object)); + + switch (property_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +void +gst_decklink_src_dispose (GObject * object) +{ + g_return_if_fail (GST_IS_DECKLINK_SRC (object)); + + /* clean up as possible. may be called multiple times */ + + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +void +gst_decklink_src_finalize (GObject * object) +{ + GstDecklinkSrc *decklinksrc; + + g_return_if_fail (GST_IS_DECKLINK_SRC (object)); + decklinksrc = GST_DECKLINK_SRC (object); + + /* clean up object here */ + + g_cond_free (decklinksrc->cond); + g_mutex_free (decklinksrc->mutex); + gst_task_set_lock (decklinksrc->task, NULL); + g_object_unref (decklinksrc->task); + if (decklinksrc->audio_caps) { + gst_caps_unref (decklinksrc->audio_caps); + } + if (decklinksrc->video_caps) { + gst_caps_unref (decklinksrc->video_caps); + } + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + + + +static GstPad * +gst_decklink_src_request_new_pad (GstElement * element, GstPadTemplate * templ, + const gchar * name) +{ + + return NULL; +} + +static void +gst_decklink_src_release_pad (GstElement * element, GstPad * pad) +{ + +} + +static gboolean +gst_decklink_src_start (GstElement * element) +{ + GstDecklinkSrc *decklinksrc = GST_DECKLINK_SRC (element); + IDeckLinkIterator *iterator; + DeckLinkCaptureDelegate *delegate; + IDeckLinkDisplayModeIterator *mode_iterator; + IDeckLinkDisplayMode *mode; + int i; + int sample_depth; + int channels; + BMDVideoInputFlags input_flags; + BMDDisplayMode selected_mode; + BMDPixelFormat pixel_format; + HRESULT ret; + + GST_DEBUG_OBJECT (decklinksrc, "start"); + + iterator = CreateDeckLinkIteratorInstance (); + if (iterator == NULL) { + GST_ERROR("no driver"); + return FALSE; + } + + ret = iterator->Next (&decklinksrc->decklink); + if (ret != S_OK) { + GST_ERROR("no card"); + return FALSE; + } + + ret = decklinksrc->decklink->QueryInterface (IID_IDeckLinkInput, + (void **) &decklinksrc->input); + if (ret != S_OK) { + GST_ERROR ("query interface failed"); + return FALSE; + } + + delegate = new DeckLinkCaptureDelegate (); + delegate->priv = decklinksrc; + decklinksrc->input->SetCallback (delegate); + + ret = decklinksrc->input->GetDisplayModeIterator (&mode_iterator); + if (ret != S_OK) { + GST_ERROR("failed to get display mode iterator"); + return FALSE; + } + + i = 0; + while (mode_iterator->Next (&mode) == S_OK) { + const char *mode_name; + + mode->GetName (&mode_name); + + GST_ERROR("%d: mode name: %s", i, mode_name); + + mode->Release (); + i++; + } + + pixel_format = bmdFormat8BitYUV; + selected_mode = decklinksrc->bmd_mode; + input_flags = 0; + ret = decklinksrc->input->EnableVideoInput (selected_mode, pixel_format, + input_flags); + if (ret != S_OK){ + GST_ERROR("enable video input failed"); + return FALSE; + } + + sample_depth = 16; + channels = 2; + ret = decklinksrc->input->EnableAudioInput (bmdAudioSampleRate48kHz, sample_depth, + channels); + if (ret != S_OK){ + GST_ERROR("enable video input failed"); + return FALSE; + } + + ret = decklinksrc->input->StartStreams (); + if (ret != S_OK) { + GST_ERROR("start streams failed"); + return FALSE; + } + + g_static_rec_mutex_lock (&decklinksrc->task_mutex); + gst_task_start (decklinksrc->task); + g_static_rec_mutex_unlock (&decklinksrc->task_mutex); + + return TRUE; +} + +static gboolean +gst_decklink_src_stop (GstElement * element) +{ + GstDecklinkSrc *decklinksrc = GST_DECKLINK_SRC (element); + + gst_task_stop (decklinksrc->task); + + g_mutex_lock (decklinksrc->mutex); + decklinksrc->stop = TRUE; + g_cond_signal (decklinksrc->cond); + g_mutex_unlock (decklinksrc->mutex); + + gst_task_join (decklinksrc->task); + + return TRUE; +} + +static GstStateChangeReturn +gst_decklink_src_change_state (GstElement * element, GstStateChange transition) +{ + GstStateChangeReturn ret; + gboolean no_preroll = FALSE; + + g_return_val_if_fail (GST_IS_DECKLINK_SRC (element), + GST_STATE_CHANGE_FAILURE); + + switch (transition) { + case GST_STATE_CHANGE_NULL_TO_READY: + if (!gst_decklink_src_start (element)) { + ret = GST_STATE_CHANGE_FAILURE; + goto out; + } + break; + case GST_STATE_CHANGE_READY_TO_PAUSED: + no_preroll = TRUE; + 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: + no_preroll = TRUE; + break; + case GST_STATE_CHANGE_PAUSED_TO_READY: + break; + case GST_STATE_CHANGE_READY_TO_NULL: + gst_decklink_src_stop (element); + break; + default: + break; + } + + if (no_preroll && ret == GST_STATE_CHANGE_SUCCESS) + ret = GST_STATE_CHANGE_NO_PREROLL; + +out: + return ret; +} + +static GstClock * +gst_decklink_src_provide_clock (GstElement * element) +{ + + return NULL; +} + +static gboolean +gst_decklink_src_set_clock (GstElement * element, GstClock * clock) +{ + + return TRUE; +} + +static GstIndex * +gst_decklink_src_get_index (GstElement * element) +{ + + return NULL; +} + +static void +gst_decklink_src_set_index (GstElement * element, GstIndex * index) +{ + +} + +static gboolean +gst_decklink_src_send_event (GstElement * element, GstEvent * event) +{ + + return TRUE; +} + +static gboolean +gst_decklink_src_query (GstElement * element, GstQuery * query) +{ + + return FALSE; +} + +static GstCaps * +gst_decklink_src_audio_src_getcaps (GstPad * pad) +{ + GstDecklinkSrc *decklinksrc; + GstCaps *caps; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "getcaps"); + + caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); + + gst_object_unref (decklinksrc); + return caps; +} + +static gboolean +gst_decklink_src_audio_src_setcaps (GstPad * pad, GstCaps * caps) +{ + GstDecklinkSrc *decklinksrc; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "setcaps"); + + + gst_object_unref (decklinksrc); + return TRUE; +} + +static gboolean +gst_decklink_src_audio_src_acceptcaps (GstPad * pad, GstCaps * caps) +{ + GstDecklinkSrc *decklinksrc; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "acceptcaps"); + + + gst_object_unref (decklinksrc); + return TRUE; +} + +static void +gst_decklink_src_audio_src_fixatecaps (GstPad * pad, GstCaps * caps) +{ + GstDecklinkSrc *decklinksrc; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "fixatecaps"); + + + gst_object_unref (decklinksrc); +} + +static gboolean +gst_decklink_src_audio_src_activate (GstPad * pad) +{ + GstDecklinkSrc *decklinksrc; + gboolean ret; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "activate"); + + if (gst_pad_check_pull_range (pad)) { + GST_DEBUG_OBJECT (pad, "activating pull"); + ret = gst_pad_activate_pull (pad, TRUE); + } else { + GST_DEBUG_OBJECT (pad, "activating push"); + ret = gst_pad_activate_push (pad, TRUE); + } + + gst_object_unref (decklinksrc); + return ret; +} + +static gboolean +gst_decklink_src_audio_src_activatepush (GstPad * pad, gboolean active) +{ + GstDecklinkSrc *decklinksrc; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "activatepush"); + + + gst_object_unref (decklinksrc); + return TRUE; +} + +static gboolean +gst_decklink_src_audio_src_activatepull (GstPad * pad, gboolean active) +{ + GstDecklinkSrc *decklinksrc; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "activatepull"); + + + gst_object_unref (decklinksrc); + return TRUE; +} + +static GstPadLinkReturn +gst_decklink_src_audio_src_link (GstPad * pad, GstPad * peer) +{ + GstDecklinkSrc *decklinksrc; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "link"); + + + gst_object_unref (decklinksrc); + return GST_PAD_LINK_OK; +} + +static GstFlowReturn +gst_decklink_src_audio_src_getrange (GstPad * pad, guint64 offset, guint length, + GstBuffer ** buffer) +{ + GstDecklinkSrc *decklinksrc; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "getrange"); + + + gst_object_unref (decklinksrc); + return GST_FLOW_OK; +} + +static gboolean +gst_decklink_src_audio_src_event (GstPad * pad, GstEvent * event) +{ + gboolean res; + GstDecklinkSrc *decklinksrc; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "event"); + + switch (GST_EVENT_TYPE (event)) { + default: + res = gst_pad_event_default (pad, event); + break; + } + + gst_object_unref (decklinksrc); + return res; +} + +static gboolean +gst_decklink_src_audio_src_query (GstPad * pad, GstQuery * query) +{ + gboolean res; + GstDecklinkSrc *decklinksrc; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "query"); + + switch (GST_QUERY_TYPE (query)) { + default: + res = gst_pad_query_default (pad, query); + break; + } + + gst_object_unref (decklinksrc); + return res; +} + +static GstIterator * +gst_decklink_src_audio_src_iterintlink (GstPad * pad) +{ + GstDecklinkSrc *decklinksrc; + GstIterator *iter; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "iterintlink"); + + iter = gst_pad_iterate_internal_links_default (pad); + + gst_object_unref (decklinksrc); + return iter; +} + + +static GstCaps * +gst_decklink_src_video_src_getcaps (GstPad * pad) +{ + GstDecklinkSrc *decklinksrc; + GstCaps *caps; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "getcaps"); + + caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); + + gst_object_unref (decklinksrc); + return caps; +} + +static gboolean +gst_decklink_src_video_src_setcaps (GstPad * pad, GstCaps * caps) +{ + GstDecklinkSrc *decklinksrc; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "setcaps"); + + + gst_object_unref (decklinksrc); + return TRUE; +} + +static gboolean +gst_decklink_src_video_src_acceptcaps (GstPad * pad, GstCaps * caps) +{ + GstDecklinkSrc *decklinksrc; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "acceptcaps"); + + + gst_object_unref (decklinksrc); + return TRUE; +} + +static void +gst_decklink_src_video_src_fixatecaps (GstPad * pad, GstCaps * caps) +{ + GstDecklinkSrc *decklinksrc; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "fixatecaps"); + + + gst_object_unref (decklinksrc); +} + +static gboolean +gst_decklink_src_video_src_activate (GstPad * pad) +{ + GstDecklinkSrc *decklinksrc; + gboolean ret; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "activate"); + + if (gst_pad_check_pull_range (pad)) { + GST_DEBUG_OBJECT (pad, "activating pull"); + ret = gst_pad_activate_pull (pad, TRUE); + } else { + GST_DEBUG_OBJECT (pad, "activating push"); + ret = gst_pad_activate_push (pad, TRUE); + } + + gst_object_unref (decklinksrc); + return ret; +} + +static gboolean +gst_decklink_src_video_src_activatepush (GstPad * pad, gboolean active) +{ + GstDecklinkSrc *decklinksrc; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "activatepush"); + + + gst_object_unref (decklinksrc); + return TRUE; +} + +static gboolean +gst_decklink_src_video_src_activatepull (GstPad * pad, gboolean active) +{ + GstDecklinkSrc *decklinksrc; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "activatepull"); + + + gst_object_unref (decklinksrc); + return TRUE; +} + +static GstPadLinkReturn +gst_decklink_src_video_src_link (GstPad * pad, GstPad * peer) +{ + GstDecklinkSrc *decklinksrc; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "link"); + + + gst_object_unref (decklinksrc); + return GST_PAD_LINK_OK; +} + +static GstFlowReturn +gst_decklink_src_video_src_getrange (GstPad * pad, guint64 offset, guint length, + GstBuffer ** buffer) +{ + GstDecklinkSrc *decklinksrc; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "getrange"); + + + gst_object_unref (decklinksrc); + return GST_FLOW_OK; +} + +static gboolean +gst_decklink_src_video_src_event (GstPad * pad, GstEvent * event) +{ + gboolean res; + GstDecklinkSrc *decklinksrc; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "event"); + + switch (GST_EVENT_TYPE (event)) { + default: + res = gst_pad_event_default (pad, event); + break; + } + + gst_object_unref (decklinksrc); + return res; +} + +static gboolean +gst_decklink_src_video_src_query (GstPad * pad, GstQuery * query) +{ + gboolean res; + GstDecklinkSrc *decklinksrc; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "query"); + + switch (GST_QUERY_TYPE (query)) { + default: + res = gst_pad_query_default (pad, query); + break; + } + + gst_object_unref (decklinksrc); + return res; +} + +static GstIterator * +gst_decklink_src_video_src_iterintlink (GstPad * pad) +{ + GstDecklinkSrc *decklinksrc; + GstIterator *iter; + + decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad)); + + GST_DEBUG_OBJECT (decklinksrc, "iterintlink"); + + iter = gst_pad_iterate_internal_links_default (pad); + + gst_object_unref (decklinksrc); + return iter; +} + + +static void +video_frame_free (void *data) +{ + IDeckLinkVideoInputFrame *video_frame = (IDeckLinkVideoInputFrame *)data; + + video_frame->Release (); +} + +static void +gst_decklink_src_task (void *priv) +{ + GstDecklinkSrc *decklinksrc = GST_DECKLINK_SRC (priv); + GstBuffer *buffer; + GstBuffer *audio_buffer; + IDeckLinkVideoInputFrame *video_frame; + IDeckLinkAudioInputPacket *audio_frame; + int dropped_frames; + void *data; + int n_samples; + GstFlowReturn ret; + + GST_DEBUG_OBJECT (decklinksrc, "task"); + + g_mutex_lock (decklinksrc->mutex); + while (decklinksrc->video_frame == NULL && !decklinksrc->stop) { + g_cond_wait (decklinksrc->cond, decklinksrc->mutex); + } + video_frame = decklinksrc->video_frame; + audio_frame = decklinksrc->audio_frame; + dropped_frames = decklinksrc->dropped_frames; + decklinksrc->video_frame = NULL; + decklinksrc->audio_frame = NULL; + g_mutex_unlock (decklinksrc->mutex); + + if (decklinksrc->stop) { + GST_ERROR("stopping task"); + return; + } + + if (dropped_frames > 0) { + GST_ELEMENT_ERROR(decklinksrc, RESOURCE, READ, (NULL), (NULL)); + /* ERROR */ + return; + } + + video_frame->GetBytes (&data); + if (decklinksrc->copy_data) { + buffer = gst_buffer_new_and_alloc (decklinksrc->width * decklinksrc->height * 2); + + memcpy (GST_BUFFER_DATA (buffer), data, decklinksrc->width * decklinksrc->height * 2); + + video_frame->Release (); + } else { + buffer = gst_buffer_new (); + GST_BUFFER_SIZE (buffer) = decklinksrc->width * decklinksrc->height * 2; + + GST_BUFFER_DATA (buffer) = (guint8 *)data; + + GST_BUFFER_FREE_FUNC (buffer) = video_frame_free; + GST_BUFFER_MALLOCDATA (buffer) = (guint8 *)video_frame; + } + + GST_BUFFER_TIMESTAMP (buffer) = + gst_util_uint64_scale_int (decklinksrc->num_frames * GST_SECOND, + decklinksrc->fps_d, decklinksrc->fps_n); + GST_BUFFER_DURATION (buffer) = + gst_util_uint64_scale_int ((decklinksrc->num_frames + 1) * GST_SECOND, + decklinksrc->fps_d, decklinksrc->fps_n) - + GST_BUFFER_TIMESTAMP (buffer); + GST_BUFFER_OFFSET (buffer) = decklinksrc->num_frames; + if (decklinksrc->num_frames == 0) { + GST_BUFFER_FLAG_SET(buffer, GST_BUFFER_FLAG_DISCONT); + } + decklinksrc->num_frames ++; + + if (decklinksrc->video_caps == NULL) { + decklinksrc->video_caps = gst_caps_new_simple ("video/x-raw-yuv", + "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC('U','Y','V','Y'), + "width", G_TYPE_INT, decklinksrc->width, + "height", G_TYPE_INT, decklinksrc->height, + "framerate", GST_TYPE_FRACTION, + decklinksrc->fps_n, decklinksrc->fps_d, + "interlaced", G_TYPE_BOOLEAN, decklinksrc->interlaced, + NULL); + } + gst_buffer_set_caps (buffer, decklinksrc->video_caps); + + ret = gst_pad_push (decklinksrc->videosrcpad, buffer); + if (ret != GST_FLOW_OK) { + GST_ELEMENT_ERROR(decklinksrc, CORE, NEGOTIATION, (NULL), (NULL)); + } + + + n_samples = audio_frame->GetSampleFrameCount(); + audio_frame->GetBytes (&data); + audio_buffer = gst_buffer_new_and_alloc (n_samples * 2 * 2); + memcpy (GST_BUFFER_DATA (audio_buffer), data, n_samples * 2 * 2); + audio_frame->Release (); + + GST_BUFFER_TIMESTAMP (audio_buffer) = + gst_util_uint64_scale_int (decklinksrc->num_audio_samples * GST_SECOND, + 1, 48000); + GST_BUFFER_DURATION (audio_buffer) = + gst_util_uint64_scale_int ((decklinksrc->num_audio_samples + n_samples) * GST_SECOND, + 1, 48000) - GST_BUFFER_TIMESTAMP (audio_buffer); + decklinksrc->num_audio_samples += n_samples; + + if (decklinksrc->audio_caps == NULL) { + decklinksrc->audio_caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, + "signed", G_TYPE_BOOLEAN, TRUE, + "depth", G_TYPE_INT, 16, + "width", G_TYPE_INT, 16, + "channels", G_TYPE_INT, 2, + "rate", G_TYPE_INT, 48000, + NULL); + } + gst_buffer_set_caps (audio_buffer, decklinksrc->audio_caps); + + ret = gst_pad_push (decklinksrc->audiosrcpad, audio_buffer); + if (ret != GST_FLOW_OK) { + GST_ELEMENT_ERROR(decklinksrc, CORE, NEGOTIATION, (NULL), (NULL)); + } +} + + diff --git a/sys/decklink/gstdecklinksrc.h b/sys/decklink/gstdecklinksrc.h new file mode 100644 index 0000000000..e191675fc1 --- /dev/null +++ b/sys/decklink/gstdecklinksrc.h @@ -0,0 +1,84 @@ +/* GStreamer + * Copyright (C) 2011 David Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _GST_DECKLINK_SRC_H_ +#define _GST_DECKLINK_SRC_H_ + +#include +#include "DeckLinkAPI.h" + +G_BEGIN_DECLS + +#define GST_TYPE_DECKLINK_SRC (gst_decklink_src_get_type()) +#define GST_DECKLINK_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DECKLINK_SRC,GstDecklinkSrc)) +#define GST_DECKLINK_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DECKLINK_SRC,GstDecklinkSrcClass)) +#define GST_IS_DECKLINK_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DECKLINK_SRC)) +#define GST_IS_DECKLINK_SRC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DECKLINK_SRC)) + +typedef struct _GstDecklinkSrc GstDecklinkSrc; +typedef struct _GstDecklinkSrcClass GstDecklinkSrcClass; + +struct _GstDecklinkSrc +{ + GstElement base_decklinksrc; + + GstPad *audiosrcpad; + GstPad *videosrcpad; + + GstCaps *audio_caps; + + IDeckLink *decklink; + IDeckLinkInput *input; + + GMutex *mutex; + GCond *cond; + int dropped_frames; + gboolean stop; + IDeckLinkVideoInputFrame *video_frame; + IDeckLinkAudioInputPacket * audio_frame; + + GstTask *task; + GStaticRecMutex task_mutex; + + guint64 num_audio_samples; + + GstCaps *video_caps; + guint64 num_frames; + int fps_n; + int fps_d; + int width; + int height; + gboolean interlaced; + BMDDisplayMode bmd_mode; + + /* properties */ + gboolean copy_data; + int mode; +}; + +struct _GstDecklinkSrcClass +{ + GstElementClass base_decklinksrc_class; +}; + +GType gst_decklink_src_get_type (void); + +G_END_DECLS + +#endif diff --git a/sys/directdraw/gstdirectdrawplugin.c b/sys/directdraw/gstdirectdrawplugin.c index 190bd02ef7..7872037369 100644 --- a/sys/directdraw/gstdirectdrawplugin.c +++ b/sys/directdraw/gstdirectdrawplugin.c @@ -33,7 +33,7 @@ static gboolean plugin_init (GstPlugin * plugin) { - if (!gst_element_register (plugin, "directdrawsink", GST_RANK_PRIMARY, + if (!gst_element_register (plugin, "directdrawsink", GST_RANK_SECONDARY, GST_TYPE_DIRECTDRAW_SINK)) return FALSE; diff --git a/sys/directdraw/gstdirectdrawsink.c b/sys/directdraw/gstdirectdrawsink.c index 05c81367ad..429aa7ad1c 100644 --- a/sys/directdraw/gstdirectdrawsink.c +++ b/sys/directdraw/gstdirectdrawsink.c @@ -44,6 +44,7 @@ #endif #include "gstdirectdrawsink.h" +#include GST_DEBUG_CATEGORY_STATIC (directdrawsink_debug); #define GST_CAT_DEFAULT directdrawsink_debug @@ -539,11 +540,17 @@ gst_directdraw_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) GstStructure *structure = NULL; gboolean ret; const GValue *fps; + gint par_n, par_d; structure = gst_caps_get_structure (caps, 0); if (!structure) return FALSE; + if (!gst_video_parse_caps_pixel_aspect_ratio (caps, &par_n, &par_d)) { + par_n = 1; + par_d = 1; + } + ret = gst_structure_get_int (structure, "width", &ddrawsink->video_width); ret &= gst_structure_get_int (structure, "height", &ddrawsink->video_height); fps = gst_structure_get_value (structure, "framerate"); @@ -556,7 +563,7 @@ gst_directdraw_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) ("Failed to get caps properties from caps"), (NULL)); return FALSE; } - GST_VIDEO_SINK_WIDTH (ddrawsink) = ddrawsink->video_width; + GST_VIDEO_SINK_WIDTH (ddrawsink) = ddrawsink->video_width * par_n / par_d; GST_VIDEO_SINK_HEIGHT (ddrawsink) = ddrawsink->video_height; ddrawsink->fps_n = gst_value_get_fraction_numerator (fps); @@ -575,8 +582,10 @@ gst_directdraw_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) /* if we are rendering to our own window, resize it to video size */ if (ddrawsink->video_window && ddrawsink->our_video_window) { SetWindowPos (ddrawsink->video_window, NULL, - 0, 0, ddrawsink->video_width + (GetSystemMetrics (SM_CXSIZEFRAME) * 2), - ddrawsink->video_height + GetSystemMetrics (SM_CYCAPTION) + + 0, 0, + GST_VIDEO_SINK_WIDTH (ddrawsink) + + (GetSystemMetrics (SM_CXSIZEFRAME) * 2), + GST_VIDEO_SINK_HEIGHT (ddrawsink) + GetSystemMetrics (SM_CYCAPTION) + (GetSystemMetrics (SM_CYSIZEFRAME) * 2), SWP_SHOWWINDOW | SWP_NOMOVE); } @@ -923,8 +932,8 @@ gst_directdraw_sink_show_frame (GstBaseSink * bsink, GstBuffer * buf) /* center image to dest image keeping aspect ratio */ src_rect.top = 0; src_rect.left = 0; - src_rect.bottom = ddrawsink->video_height; - src_rect.right = ddrawsink->video_width; + src_rect.bottom = GST_VIDEO_SINK_HEIGHT (ddrawsink); + src_rect.right = GST_VIDEO_SINK_WIDTH (ddrawsink); gst_directdraw_sink_center_rect (ddrawsink, src_rect, destsurf_rect, &destsurf_rect); gst_directdraw_sink_draw_borders (ddrawsink, destsurf_rect); @@ -1744,9 +1753,9 @@ gst_directdraw_sink_get_depth (LPDDPIXELFORMAT lpddpfPixelFormat) gint order = 0, binary; binary = - lpddpfPixelFormat-> - dwRBitMask | lpddpfPixelFormat->dwGBitMask | lpddpfPixelFormat-> - dwBBitMask | lpddpfPixelFormat->dwRGBAlphaBitMask; + lpddpfPixelFormat->dwRBitMask | lpddpfPixelFormat-> + dwGBitMask | lpddpfPixelFormat->dwBBitMask | lpddpfPixelFormat-> + dwRGBAlphaBitMask; while (binary != 0) { if ((binary % 2) == 1) order++; diff --git a/sys/dshowdecwrapper/gstdshowaudiodec.cpp b/sys/dshowdecwrapper/gstdshowaudiodec.cpp index 1f4bd989a6..f10ac8cdc8 100644 --- a/sys/dshowdecwrapper/gstdshowaudiodec.cpp +++ b/sys/dshowdecwrapper/gstdshowaudiodec.cpp @@ -1,6 +1,6 @@ /* * GStreamer DirectShow codecs wrapper - * Copyright <2006, 2007, 2008> Fluendo + * Copyright <2006, 2007, 2008, 2009, 2010> Fluendo * Copyright <2006, 2007, 2008> Pioneers of the Inevitable * Copyright <2007,2008> Sebastien Moutte * @@ -58,8 +58,6 @@ GST_DEBUG_CATEGORY_STATIC (dshowaudiodec_debug); GST_BOILERPLATE (GstDshowAudioDec, gst_dshowaudiodec, GstElement, GST_TYPE_ELEMENT); -static const AudioCodecEntry *tmp; - static void gst_dshowaudiodec_dispose (GObject * object); static GstStateChangeReturn gst_dshowaudiodec_change_state (GstElement * element, GstStateChange transition); @@ -314,15 +312,25 @@ gst_dshowaudiodec_base_init (gpointer klass) GstPadTemplate *src, *sink; GstCaps *srccaps, *sinkcaps; GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - char *description; + GstElementDetails details; + const AudioCodecEntry *tmp; + gpointer qdata; - audiodec_class->entry = tmp; - description = g_strdup_printf ("DirectShow %s Decoder Wrapper", + qdata = g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), DSHOW_CODEC_QDATA); + + /* element details */ + tmp = audiodec_class->entry = (AudioCodecEntry *) qdata; + + details.longname = g_strdup_printf ("DirectShow %s Decoder Wrapper", tmp->element_longname); - gst_element_class_set_details_simple (element_class, description, - "Codec/Decoder/Audio", description, - "Sebastien Moutte "); - g_free (description); + details.klass = g_strdup ("Codec/Decoder/Audio"); + details.description = g_strdup_printf ("DirectShow %s Decoder Wrapper", + tmp->element_longname); + details.author = "Sebastien Moutte "; + gst_element_class_set_details (element_class, &details); + g_free (details.longname); + g_free (details.klass); + g_free (details.description); sinkcaps = gst_caps_from_string (tmp->sinkcaps); @@ -357,12 +365,48 @@ gst_dshowaudiodec_class_init (GstDshowAudioDecClass * klass) parent_class = (GstElementClass *) g_type_class_peek_parent (klass); } +static void +gst_dshowaudiodec_com_thread (GstDshowAudioDec * adec) +{ + HRESULT res; + + g_mutex_lock (adec->com_init_lock); + + /* Initialize COM with a MTA for this process. This thread will + * be the first one to enter the apartement and the last one to leave + * it, unitializing COM properly */ + + res = CoInitializeEx (0, COINIT_MULTITHREADED); + if (res == S_FALSE) + GST_WARNING_OBJECT (adec, "COM has been already initialized in the same process"); + else if (res == RPC_E_CHANGED_MODE) + GST_WARNING_OBJECT (adec, "The concurrency model of COM has changed."); + else + GST_INFO_OBJECT (adec, "COM intialized succesfully"); + + adec->comInitialized = TRUE; + + /* Signal other threads waiting on this condition that COM was initialized */ + g_cond_signal (adec->com_initialized); + + g_mutex_unlock (adec->com_init_lock); + + /* Wait until the unitialize condition is met to leave the COM apartement */ + g_mutex_lock (adec->com_deinit_lock); + g_cond_wait (adec->com_uninitialize, adec->com_deinit_lock); + + CoUninitialize (); + GST_INFO_OBJECT (adec, "COM unintialized succesfully"); + adec->comInitialized = FALSE; + g_cond_signal (adec->com_uninitialized); + g_mutex_unlock (adec->com_deinit_lock); +} + static void gst_dshowaudiodec_init (GstDshowAudioDec * adec, GstDshowAudioDecClass * adec_class) { GstElementClass *element_class = GST_ELEMENT_GET_CLASS (adec); - HRESULT hr; /* setup pads */ adec->sinkpad = @@ -399,10 +443,21 @@ gst_dshowaudiodec_init (GstDshowAudioDec * adec, adec->last_ret = GST_FLOW_OK; - hr = CoInitialize (0); - if (SUCCEEDED(hr)) { - adec->comInitialized = TRUE; - } + adec->com_init_lock = g_mutex_new(); + adec->com_deinit_lock = g_mutex_new(); + adec->com_initialized = g_cond_new(); + adec->com_uninitialize = g_cond_new(); + adec->com_uninitialized = g_cond_new(); + + g_mutex_lock (adec->com_init_lock); + + /* create the COM initialization thread */ + g_thread_create ((GThreadFunc)gst_dshowaudiodec_com_thread, + adec, FALSE, NULL); + + /* wait until the COM thread signals that COM has been initialized */ + g_cond_wait (adec->com_initialized, adec->com_init_lock); + g_mutex_unlock (adec->com_init_lock); } static void @@ -420,11 +475,20 @@ gst_dshowaudiodec_dispose (GObject * object) adec->codec_data = NULL; } + /* signal the COM thread that it sould uninitialize COM */ if (adec->comInitialized) { - CoUninitialize (); - adec->comInitialized = FALSE; + g_mutex_lock (adec->com_deinit_lock); + g_cond_signal (adec->com_uninitialize); + g_cond_wait (adec->com_uninitialized, adec->com_deinit_lock); + g_mutex_unlock (adec->com_deinit_lock); } + g_mutex_free (adec->com_init_lock); + g_mutex_free (adec->com_deinit_lock); + g_cond_free (adec->com_initialized); + g_cond_free (adec->com_uninitialize); + g_cond_free (adec->com_uninitialized); + G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -1103,9 +1167,9 @@ dshow_adec_register (GstPlugin * plugin) { GST_DEBUG ("Registering %s", audio_dec_codecs[i].element_name); - tmp = &audio_dec_codecs[i]; type = g_type_register_static (GST_TYPE_ELEMENT, audio_dec_codecs[i].element_name, &info, (GTypeFlags)0); + g_type_set_qdata (type, DSHOW_CODEC_QDATA, (gpointer) (audio_dec_codecs + i)); if (!gst_element_register (plugin, audio_dec_codecs[i].element_name, GST_RANK_SECONDARY, type)) { return FALSE; diff --git a/sys/dshowdecwrapper/gstdshowaudiodec.h b/sys/dshowdecwrapper/gstdshowaudiodec.h index 77d7891932..5f52cb888f 100644 --- a/sys/dshowdecwrapper/gstdshowaudiodec.h +++ b/sys/dshowdecwrapper/gstdshowaudiodec.h @@ -1,6 +1,6 @@ /* * GStreamer DirectShow codecs wrapper - * Copyright <2006, 2007, 2008> Fluendo + * Copyright <2006, 2007, 2008, 2009, 2010> Fluendo * Copyright <2006, 2007, 2008> Pioneers of the Inevitable * Copyright <2007,2008> Sebastien Moutte * @@ -113,6 +113,11 @@ struct _GstDshowAudioDec GstClockTime timestamp; gboolean comInitialized; + GMutex *com_init_lock; + GMutex *com_deinit_lock; + GCond *com_initialized; + GCond *com_uninitialize; + GCond *com_uninitialized; }; struct _GstDshowAudioDecClass diff --git a/sys/dshowdecwrapper/gstdshowutil.h b/sys/dshowdecwrapper/gstdshowutil.h index 80299fb275..3cea05e1ff 100644 --- a/sys/dshowdecwrapper/gstdshowutil.h +++ b/sys/dshowdecwrapper/gstdshowutil.h @@ -1,4 +1,5 @@ /* GStreamer + * Copyright <2006, 2007, 2008, 2009, 2010> Fluendo * Copyright (C) 2007 Sebastien Moutte * * gstdshow.h: @@ -45,4 +46,7 @@ IBaseFilter * gst_dshow_find_filter(CLSID input_majortype, CLSID input_subtype, CLSID output_majortype, CLSID output_subtype, PreferredFilter *preferred_filters); + +#define DSHOW_CODEC_QDATA g_quark_from_string ("dshow-codec") + #endif /* _GST_DSHOW_UTIL_H_ */ diff --git a/sys/dshowdecwrapper/gstdshowvideodec.cpp b/sys/dshowdecwrapper/gstdshowvideodec.cpp index 6be02fe45d..663e980437 100644 --- a/sys/dshowdecwrapper/gstdshowvideodec.cpp +++ b/sys/dshowdecwrapper/gstdshowvideodec.cpp @@ -1,6 +1,6 @@ /* * GStreamer DirectShow codecs wrapper - * Copyright <2006, 2007, 2008> Fluendo + * Copyright <2006, 2007, 2008, 2009, 2010> Fluendo * Copyright <2006, 2007, 2008> Pioneers of the Inevitable * Copyright <2007,2008> Sebastien Moutte * @@ -58,7 +58,6 @@ GST_DEBUG_CATEGORY_STATIC (dshowvideodec_debug); GST_BOILERPLATE (GstDshowVideoDec, gst_dshowvideodec, GstElement, GST_TYPE_ELEMENT); -static const VideoCodecEntry *tmp; static void gst_dshowvideodec_dispose (GObject * object); static GstStateChangeReturn gst_dshowvideodec_change_state @@ -369,16 +368,25 @@ gst_dshowvideodec_base_init (gpointer klass) GstPadTemplate *src, *sink; GstCaps *srccaps, *sinkcaps; GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - char *description; + GstElementDetails details; + const VideoCodecEntry *tmp; + gpointer qdata; - videodec_class->entry = tmp; + qdata = g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), DSHOW_CODEC_QDATA); - description = g_strdup_printf ("DirectShow %s Decoder Wrapper", + /* element details */ + tmp = videodec_class->entry = (VideoCodecEntry *) qdata; + + details.longname = g_strdup_printf ("DirectShow %s Decoder Wrapper", tmp->element_longname); - gst_element_class_set_details_simple (element_class, description, - "Codec/Decoder/Video", description, - "Sebastien Moutte "); - g_free (description); + details.klass = g_strdup ("Codec/Decoder/Video"); + details.description = g_strdup_printf ("DirectShow %s Decoder Wrapper", + tmp->element_longname); + details.author = "Sebastien Moutte "; + gst_element_class_set_details (element_class, &details); + g_free (details.longname); + g_free (details.klass); + g_free (details.description); sinkcaps = gst_caps_from_string (tmp->sinkcaps); gst_caps_set_simple (sinkcaps, @@ -409,12 +417,48 @@ gst_dshowvideodec_class_init (GstDshowVideoDecClass * klass) parent_class = (GstElementClass *) g_type_class_peek_parent (klass); } +static void +gst_dshowvideodec_com_thread (GstDshowVideoDec * vdec) +{ + HRESULT res; + + g_mutex_lock (vdec->com_init_lock); + + /* Initialize COM with a MTA for this process. This thread will + * be the first one to enter the apartement and the last one to leave + * it, unitializing COM properly */ + + res = CoInitializeEx (0, COINIT_MULTITHREADED); + if (res == S_FALSE) + GST_WARNING_OBJECT (vdec, "COM has been already initialized in the same process"); + else if (res == RPC_E_CHANGED_MODE) + GST_WARNING_OBJECT (vdec, "The concurrency model of COM has changed."); + else + GST_INFO_OBJECT (vdec, "COM intialized succesfully"); + + vdec->comInitialized = TRUE; + + /* Signal other threads waiting on this condition that COM was initialized */ + g_cond_signal (vdec->com_initialized); + + g_mutex_unlock (vdec->com_init_lock); + + /* Wait until the unitialize condition is met to leave the COM apartement */ + g_mutex_lock (vdec->com_deinit_lock); + g_cond_wait (vdec->com_uninitialize, vdec->com_deinit_lock); + + CoUninitialize (); + GST_INFO_OBJECT (vdec, "COM unintialized succesfully"); + vdec->comInitialized = FALSE; + g_cond_signal (vdec->com_uninitialized); + g_mutex_unlock (vdec->com_deinit_lock); +} + static void gst_dshowvideodec_init (GstDshowVideoDec * vdec, GstDshowVideoDecClass * vdec_class) { GstElementClass *element_class = GST_ELEMENT_GET_CLASS (vdec); - HRESULT hr; /* setup pads */ vdec->sinkpad = @@ -447,10 +491,21 @@ gst_dshowvideodec_init (GstDshowVideoDec * vdec, vdec->setup = FALSE; - hr = CoInitialize (0); - if (SUCCEEDED(hr)) { - vdec->comInitialized = TRUE; - } + vdec->com_init_lock = g_mutex_new(); + vdec->com_deinit_lock = g_mutex_new(); + vdec->com_initialized = g_cond_new(); + vdec->com_uninitialize = g_cond_new(); + vdec->com_uninitialized = g_cond_new(); + + g_mutex_lock (vdec->com_init_lock); + + /* create the COM initialization thread */ + g_thread_create ((GThreadFunc)gst_dshowvideodec_com_thread, + vdec, FALSE, NULL); + + /* wait until the COM thread signals that COM has been initialized */ + g_cond_wait (vdec->com_initialized, vdec->com_init_lock); + g_mutex_unlock (vdec->com_init_lock); } static void @@ -463,11 +518,20 @@ gst_dshowvideodec_dispose (GObject * object) vdec->segment = NULL; } + /* signal the COM thread that it sould uninitialize COM */ if (vdec->comInitialized) { - CoUninitialize (); - vdec->comInitialized = FALSE; + g_mutex_lock (vdec->com_deinit_lock); + g_cond_signal (vdec->com_uninitialize); + g_cond_wait (vdec->com_uninitialized, vdec->com_deinit_lock); + g_mutex_unlock (vdec->com_deinit_lock); } + g_mutex_free (vdec->com_init_lock); + g_mutex_free (vdec->com_deinit_lock); + g_cond_free (vdec->com_initialized); + g_cond_free (vdec->com_uninitialize); + g_cond_free (vdec->com_uninitialized); + G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -1193,10 +1257,9 @@ dshow_vdec_register (GstPlugin * plugin) GST_DEBUG ("Registering %s", video_dec_codecs[i].element_name); - tmp = &video_dec_codecs[i]; - type = - g_type_register_static (GST_TYPE_ELEMENT, + type = g_type_register_static (GST_TYPE_ELEMENT, video_dec_codecs[i].element_name, &info, (GTypeFlags)0); + g_type_set_qdata (type, DSHOW_CODEC_QDATA, (gpointer) (video_dec_codecs + i)); if (!gst_element_register (plugin, video_dec_codecs[i].element_name, GST_RANK_PRIMARY, type)) { return FALSE; diff --git a/sys/dshowdecwrapper/gstdshowvideodec.h b/sys/dshowdecwrapper/gstdshowvideodec.h index 4e2d7dc48e..b5253a6f47 100644 --- a/sys/dshowdecwrapper/gstdshowvideodec.h +++ b/sys/dshowdecwrapper/gstdshowvideodec.h @@ -1,6 +1,6 @@ /* * GStreamer DirectShow codecs wrapper - * Copyright <2006, 2007, 2008> Fluendo + * Copyright <2006, 2007, 2008, 2009, 2010> Fluendo * Copyright <2006, 2007, 2008> Pioneers of the Inevitable * Copyright <2007,2008> Sebastien Moutte * @@ -113,6 +113,11 @@ struct _GstDshowVideoDec gboolean setup; gboolean comInitialized; + GMutex *com_init_lock; + GMutex *com_deinit_lock; + GCond *com_initialized; + GCond *com_uninitialize; + GCond *com_uninitialized; }; struct _GstDshowVideoDecClass diff --git a/sys/dshowsrcwrapper/gstdshow.cpp b/sys/dshowsrcwrapper/gstdshow.cpp index b2d577b71d..11ea159d67 100644 --- a/sys/dshowsrcwrapper/gstdshow.cpp +++ b/sys/dshowsrcwrapper/gstdshow.cpp @@ -123,13 +123,10 @@ gst_dshow_new_pin_mediatype_from_streamcaps (IPin * pin, gint id, IAMStreamConfi void gst_dshow_free_pins_mediatypes (GList * pins_mediatypes) { - guint i = 0; - for (; i < g_list_length (pins_mediatypes); i++) { - GList *mylist = g_list_nth (pins_mediatypes, i); - if (mylist && mylist->data) - gst_dshow_free_pin_mediatype ((GstCapturePinMediaType *) mylist->data); + while (pins_mediatypes != NULL) { + gst_dshow_free_pin_mediatype (pins_mediatypes->data); + pins_mediatypes = g_list_remove_link (pins_mediatypes, pins_mediatypes); } - g_list_free (pins_mediatypes); } gboolean diff --git a/sys/dshowvideosink/dshowvideosink.cpp b/sys/dshowvideosink/dshowvideosink.cpp index 1e4f219cd2..8b8554ca63 100644 --- a/sys/dshowvideosink/dshowvideosink.cpp +++ b/sys/dshowvideosink/dshowvideosink.cpp @@ -106,7 +106,7 @@ gst_dshowvideosink_interface_init (GstImplementsInterfaceClass * klass) } static void -gst_dshowvideosink_set_window_id (GstXOverlay * overlay, ULONG window_id) +gst_dshowvideosink_set_window_handle (GstXOverlay * overlay, guintptr window_id) { GstDshowVideoSink *sink = GST_DSHOWVIDEOSINK (overlay); HWND previous_window = sink->window_id; @@ -154,7 +154,7 @@ gst_dshowvideosink_expose (GstXOverlay * overlay) static void gst_dshowvideosink_xoverlay_interface_init (GstXOverlayClass * iface) { - iface->set_xwindow_id = gst_dshowvideosink_set_window_id; + iface->set_window_handle = gst_dshowvideosink_set_window_handle; iface->expose = gst_dshowvideosink_expose; } @@ -713,7 +713,7 @@ gst_dshowvideosink_window_thread (GstDshowVideoSink * sink) sink->window_id = video_window; /* signal application we created a window */ - gst_x_overlay_got_xwindow_id (GST_X_OVERLAY (sink), + gst_x_overlay_got_window_handle (GST_X_OVERLAY (sink), (gulong)video_window); /* Set the renderer's clipping window */ diff --git a/sys/dvb/camapplicationinfo.c b/sys/dvb/camapplicationinfo.c index c05e827de5..c70d8daa90 100644 --- a/sys/dvb/camapplicationinfo.c +++ b/sys/dvb/camapplicationinfo.c @@ -121,7 +121,7 @@ handle_application_info_reply (CamApplicationInfo * info, { guint8 type; guint8 menu_length; - gchar menu[255]; + gchar menu[256]; type = buffer[0]; menu_length = buffer[5]; diff --git a/sys/dvb/gstdvbsrc.c b/sys/dvb/gstdvbsrc.c index 2f18431ada..d0bd1d442d 100644 --- a/sys/dvb/gstdvbsrc.c +++ b/sys/dvb/gstdvbsrc.c @@ -87,7 +87,8 @@ enum ARG_DVBSRC_HIERARCHY_INF, ARG_DVBSRC_TUNE, ARG_DVBSRC_INVERSION, - ARG_DVBSRC_STATS_REPORTING_INTERVAL + ARG_DVBSRC_STATS_REPORTING_INTERVAL, + ARG_DVBSRC_TIMEOUT, }; #define DEFAULT_ADAPTER 0 @@ -106,6 +107,7 @@ enum #define DEFAULT_HIERARCHY HIERARCHY_1 #define DEFAULT_INVERSION INVERSION_ON #define DEFAULT_STATS_REPORTING_INTERVAL 100 +#define DEFAULT_TIMEOUT 1000000 /* 1 second */ #define DEFAULT_BUFFER_SIZE 8192 /* not a property */ @@ -444,6 +446,11 @@ gst_dvbsrc_class_init (GstDvbSrcClass * klass) "stats-reporting-interval", "The number of reads before reporting frontend stats", 0, G_MAXUINT, DEFAULT_STATS_REPORTING_INTERVAL, G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_DVBSRC_TIMEOUT, + g_param_spec_uint64 ("timeout", "Timeout", + "Post a message after timeout microseconds (0 = disabled)", 0, + G_MAXUINT64, DEFAULT_TIMEOUT, G_PARAM_READWRITE)); } /* initialize the new element @@ -488,6 +495,7 @@ gst_dvbsrc_init (GstDvbSrc * object, GstDvbSrcClass * klass) object->stats_interval = DEFAULT_STATS_REPORTING_INTERVAL; object->tune_mutex = g_mutex_new (); + object->timeout = DEFAULT_TIMEOUT; } @@ -625,10 +633,12 @@ gst_dvbsrc_set_property (GObject * _object, guint prop_id, object->stats_interval = g_value_get_uint (value); object->stats_counter = 0; break; + case ARG_DVBSRC_TIMEOUT: + object->timeout = g_value_get_uint64 (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } - } static void @@ -689,6 +699,9 @@ gst_dvbsrc_get_property (GObject * _object, guint prop_id, case ARG_DVBSRC_STATS_REPORTING_INTERVAL: g_value_set_uint (value, object->stats_interval); break; + case ARG_DVBSRC_TIMEOUT: + g_value_set_uint64 (value, object->timeout); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } @@ -888,80 +901,62 @@ gst_dvbsrc_plugin_init (GstPlugin * plugin) } static GstBuffer * -read_device (int fd, int adapter_number, int frontend_number, int size, - GstDvbSrc * object) +gst_dvbsrc_read_device (GstDvbSrc * object, int size) { - int count = 0; - struct pollfd pfd[1]; - int ret_val = 0; - guint attempts = 0; - const int TIMEOUT = 100; - + gint count = 0; + gint ret_val = 0; GstBuffer *buf = gst_buffer_new_and_alloc (size); + GstClockTime timeout = object->timeout * GST_USECOND; g_return_val_if_fail (GST_IS_BUFFER (buf), NULL); - if (fd < 0) { + if (object->fd_dvr < 0) return NULL; - } - pfd[0].fd = fd; - pfd[0].events = POLLIN; + while (count < size) { + ret_val = gst_poll_wait (object->poll, timeout); + GST_LOG_OBJECT (object, "select returned %d", ret_val); + if (G_UNLIKELY (ret_val < 0)) { + if (errno == EBUSY) + goto stopped; + else + goto select_error; + } else if (G_UNLIKELY (ret_val == 0)) { + /* timeout, post element message */ + gst_element_post_message (GST_ELEMENT_CAST (object), + gst_message_new_element (GST_OBJECT (object), + gst_structure_empty_new ("dvb-read-failure"))); + } else { + int nread = + read (object->fd_dvr, GST_BUFFER_DATA (buf) + count, size - count); - while (count < size && !object->need_unlock) { - ret_val = poll (pfd, 1, TIMEOUT); - if (ret_val > 0) { - if (pfd[0].revents & POLLIN) { - int tmp = 0; - - tmp = read (fd, GST_BUFFER_DATA (buf) + count, size - count); - if (tmp < 0) { - GST_WARNING - ("Unable to read from device: /dev/dvb/adapter%d/dvr%d (%d)", - adapter_number, frontend_number, errno); - attempts += 1; - if (attempts % 10 == 0) { - GST_WARNING - ("Unable to read from device after %u attempts: /dev/dvb/adapter%d/dvr%d", - attempts, adapter_number, frontend_number); - } - - } else - count = count + tmp; - } else { - GST_LOG ("revents = %d\n", pfd[0].revents); - } - } else if (ret_val == 0) { // poll timeout - attempts += 1; - GST_INFO ("Reading from device /dev/dvb/adapter%d/dvr%d timedout (%d)", - adapter_number, frontend_number, attempts); - - if (attempts % 10 == 0) { - GST_WARNING - ("Unable to read after %u attempts from device: /dev/dvb/adapter%d/dvr%d (%d)", - attempts, adapter_number, frontend_number, errno); + if (G_UNLIKELY (nread < 0)) { + GST_WARNING_OBJECT + (object, + "Unable to read from device: /dev/dvb/adapter%d/dvr%d (%d)", + object->adapter_number, object->frontend_number, errno); gst_element_post_message (GST_ELEMENT_CAST (object), gst_message_new_element (GST_OBJECT (object), gst_structure_empty_new ("dvb-read-failure"))); - - } - } else if (errno == -EINTR) { // poll interrupted - if (attempts % 50 == 0) { - gst_buffer_unref (buf); - return NULL; - }; + } else + count = count + nread; } - - } - - if (!count) { - gst_buffer_unref (buf); - return NULL; } GST_BUFFER_SIZE (buf) = count; GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE; return buf; + +stopped: + GST_DEBUG_OBJECT (object, "stop called"); + gst_buffer_unref (buf); + return NULL; + +select_error: + GST_ELEMENT_ERROR (object, RESOURCE, READ, (NULL), + ("select error %d: %s (%d)", ret_val, g_strerror (errno), errno)); + gst_buffer_unref (buf); + return NULL; } static GstFlowReturn @@ -984,8 +979,7 @@ gst_dvbsrc_create (GstPushSrc * element, GstBuffer ** buf) if (object->fd_dvr > -1) { /* --- Read TS from DVR device --- */ GST_DEBUG_OBJECT (object, "Reading from DVR device"); - *buf = read_device (object->fd_dvr, object->adapter_number, - object->frontend_number, buffer_size, object); + *buf = gst_dvbsrc_read_device (object, buffer_size); if (*buf != NULL) { GstCaps *caps; @@ -994,11 +988,6 @@ gst_dvbsrc_create (GstPushSrc * element, GstBuffer ** buf) caps = gst_pad_get_caps (GST_BASE_SRC_PAD (object)); gst_buffer_set_caps (*buf, caps); gst_caps_unref (caps); - } else { - GST_DEBUG_OBJECT (object, "Failed to read from device"); - gst_element_post_message (GST_ELEMENT_CAST (object), - gst_message_new_element (GST_OBJECT (object), - gst_structure_empty_new ("dvb-read-failure"))); } if (object->stats_interval != 0 && @@ -1062,7 +1051,19 @@ gst_dvbsrc_start (GstBaseSrc * bsrc) close (src->fd_frontend); return FALSE; } - src->need_unlock = FALSE; + if (!(src->poll = gst_poll_new (TRUE))) { + GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ_WRITE, (NULL), + ("could not create an fdset: %s (%d)", g_strerror (errno), errno)); + /* unset filters also */ + gst_dvbsrc_unset_pes_filters (src); + close (src->fd_frontend); + return FALSE; + } else { + gst_poll_fd_init (&src->poll_fd_dvr); + src->poll_fd_dvr.fd = src->fd_dvr; + gst_poll_add_fd (src->poll, &src->poll_fd_dvr); + gst_poll_fd_ctl_read (src->poll, &src->poll_fd_dvr, TRUE); + } return TRUE; } @@ -1073,6 +1074,11 @@ gst_dvbsrc_stop (GstBaseSrc * bsrc) GstDvbSrc *src = GST_DVBSRC (bsrc); gst_dvbsrc_close_devices (src); + if (src->poll) { + gst_poll_free (src->poll); + src->poll = NULL; + } + return TRUE; } @@ -1081,7 +1087,7 @@ gst_dvbsrc_unlock (GstBaseSrc * bsrc) { GstDvbSrc *src = GST_DVBSRC (bsrc); - src->need_unlock = TRUE; + gst_poll_set_flushing (src->poll, TRUE); return TRUE; } @@ -1090,7 +1096,7 @@ gst_dvbsrc_unlock_stop (GstBaseSrc * bsrc) { GstDvbSrc *src = GST_DVBSRC (bsrc); - src->need_unlock = FALSE; + gst_poll_set_flushing (src->poll, FALSE); return TRUE; } diff --git a/sys/dvb/gstdvbsrc.h b/sys/dvb/gstdvbsrc.h index b6777f2a09..8feac593f2 100644 --- a/sys/dvb/gstdvbsrc.h +++ b/sys/dvb/gstdvbsrc.h @@ -52,6 +52,8 @@ G_BEGIN_DECLS int fd_frontend; int fd_dvr; int fd_filters[MAX_FILTERS]; + GstPoll *poll; + GstPollFD poll_fd_dvr; guint16 pids[MAX_FILTERS]; unsigned int freq; @@ -68,11 +70,11 @@ G_BEGIN_DECLS int transmission_mode; int hierarchy_information; int inversion; + guint64 timeout; GstDvbSrcPol pol; guint stats_interval; guint stats_counter; - gboolean need_unlock; }; struct _GstDvbSrcClass diff --git a/sys/fbdev/gstfbdevsink.c b/sys/fbdev/gstfbdevsink.c index 989d48f152..8925f3d307 100644 --- a/sys/fbdev/gstfbdevsink.c +++ b/sys/fbdev/gstfbdevsink.c @@ -351,11 +351,9 @@ gst_fbdevsink_get_property (GObject * object, guint prop_id, GValue * value, static GstStateChangeReturn gst_fbdevsink_change_state (GstElement * element, GstStateChange transition) { - GstFBDEVSink *fbdevsink; GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; g_return_val_if_fail (GST_IS_FBDEVSINK (element), GST_STATE_CHANGE_FAILURE); - fbdevsink = GST_FBDEVSINK (element); ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); diff --git a/sys/linsys/Makefile.am b/sys/linsys/Makefile.am new file mode 100644 index 0000000000..3362738746 --- /dev/null +++ b/sys/linsys/Makefile.am @@ -0,0 +1,26 @@ + + +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) + diff --git a/sys/linsys/gstlinsys.c b/sys/linsys/gstlinsys.c new file mode 100644 index 0000000000..208c573b34 --- /dev/null +++ b/sys/linsys/gstlinsys.c @@ -0,0 +1,48 @@ +/* GStreamer + * Copyright (C) 2010 FIXME + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#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 new file mode 100644 index 0000000000..3e9ad165b5 --- /dev/null +++ b/sys/linsys/gstlinsyssdisink.c @@ -0,0 +1,483 @@ +/* GStreamer + * Copyright (C) 2010 David Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include "gstlinsyssdisink.h" + +#include +#include +#include +#include +#include + +#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_pad_template (element_class, + gst_static_pad_template_get (&gst_linsys_sdi_sink_sink_template)); + + gst_element_class_set_details_simple (element_class, "SDI video sink", + "Sink/Video", "Writes video from SDI transmit device", + "David Schleef "); +} + +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) +{ + g_return_if_fail (GST_IS_LINSYS_SDI_SINK (object)); + + /* clean up as possible. may be called multiple times */ + + 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 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 new file mode 100644 index 0000000000..2f4105f3b0 --- /dev/null +++ b/sys/linsys/gstlinsyssdisink.h @@ -0,0 +1,59 @@ +/* GStreamer + * Copyright (C) 2010 FIXME + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _GST_LINSYS_SDI_SINK_H_ +#define _GST_LINSYS_SDI_SINK_H_ + +#include +#include + + +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 new file mode 100644 index 0000000000..c5a928c686 --- /dev/null +++ b/sys/linsys/gstlinsyssdisrc.c @@ -0,0 +1,548 @@ +/* GStreamer + * Copyright (C) 2010 David Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include "gstlinsyssdisrc.h" + +#include +#include +#include +#include +#include + +#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_pad_template (element_class, + gst_static_pad_template_get (&gst_linsys_sdi_src_src_template)); + + gst_element_class_set_details_simple (element_class, "SDI video source", + "Source/Video", "Reads video from SDI capture device", + "David Schleef "); +} + +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) +{ + g_return_if_fail (GST_IS_LINSYS_SDI_SRC (object)); + + /* clean up as possible. may be called multiple times */ + + 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_WRONG_STATE; + + 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 new file mode 100644 index 0000000000..e43c9cb671 --- /dev/null +++ b/sys/linsys/gstlinsyssdisrc.h @@ -0,0 +1,62 @@ +/* GStreamer + * Copyright (C) 2010 FIXME + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _GST_LINSYS_SDI_SRC_H_ +#define _GST_LINSYS_SDI_SRC_H_ + +#include +#include + +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 new file mode 100644 index 0000000000..89635886dd --- /dev/null +++ b/sys/linsys/include/asi.h @@ -0,0 +1,255 @@ +/* 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 + * 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 . + * + */ + +#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 new file mode 100644 index 0000000000..1d005c668a --- /dev/null +++ b/sys/linsys/include/master.h @@ -0,0 +1,69 @@ +/* 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 . + * + */ + +#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 new file mode 100644 index 0000000000..659c41847c --- /dev/null +++ b/sys/linsys/include/sdi.h @@ -0,0 +1,115 @@ +/* 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 . + * + */ + +#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 new file mode 100644 index 0000000000..1df6f86eb1 --- /dev/null +++ b/sys/linsys/include/sdiaudio.h @@ -0,0 +1,149 @@ +/* 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 . + * + */ + +#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 new file mode 100644 index 0000000000..e894f6b999 --- /dev/null +++ b/sys/linsys/include/sdivideo.h @@ -0,0 +1,155 @@ +/* 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 . + * + */ + +#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/qtwrapper/audiodecoders.c b/sys/qtwrapper/audiodecoders.c index 718d30cb27..32f8e1d436 100644 --- a/sys/qtwrapper/audiodecoders.c +++ b/sys/qtwrapper/audiodecoders.c @@ -62,6 +62,8 @@ #define QTWRAPPER_ADEC_PARAMS_QDATA g_quark_from_static_string("qtwrapper-adec-params") +#define NO_MORE_INPUT_DATA 42 + static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, @@ -745,9 +747,10 @@ process_buffer_cb (ComponentInstance inAudioConverter, return noErr; } - GST_LOG_OBJECT (qtwrapper, "No remaining input data, returning 42 for hack"); + GST_LOG_OBJECT (qtwrapper, + "No remaining input data, returning NO_MORE_INPUT_DATA"); - return 42; + return NO_MORE_INPUT_DATA; } static GstFlowReturn @@ -805,8 +808,7 @@ qtwrapper_audio_decoder_chain (GstPad * pad, GstBuffer * buf) (SCAudioInputDataProc) process_buffer_cb, qtwrapper, (UInt32 *) & outsamples, qtwrapper->bufferlist, NULL); - /* TODO: What's this '42' crap?? It does seem to be needed, though. */ - if ((status != noErr) && (status != 42)) { + if ((status != noErr) && (status != NO_MORE_INPUT_DATA)) { if (status < 0) GST_WARNING_OBJECT (qtwrapper, "Error in SCAudioFillBuffer() : %d", (gint32) status); @@ -864,7 +866,7 @@ qtwrapper_audio_decoder_chain (GstPad * pad, GstBuffer * buf) GST_DEBUG_OBJECT (qtwrapper, "Read %d bytes, could have read up to %d bytes", realbytes, savedbytes); - } while (realbytes == savedbytes); + } while (status != NO_MORE_INPUT_DATA); beach: gst_buffer_unref (buf); diff --git a/sys/shm/gstshmsink.c b/sys/shm/gstshmsink.c index 0cec9eac23..a7d7e52073 100644 --- a/sys/shm/gstshmsink.c +++ b/sys/shm/gstshmsink.c @@ -56,7 +56,8 @@ struct GstShmClient #define DEFAULT_SIZE ( 256 * 1024 ) #define DEFAULT_WAIT_FOR_CONNECTION (TRUE) -#define DEFAULT_PERMS (S_IRWXU | S_IRWXG) +/* Default is user read/write, group read */ +#define DEFAULT_PERMS ( S_IRUSR | S_IWUSR | S_IRGRP ) GST_DEBUG_CATEGORY_STATIC (shmsink_debug); @@ -117,11 +118,9 @@ static void gst_shm_sink_class_init (GstShmSinkClass * klass) { GObjectClass *gobject_class; - GstElementClass *gstelement_class; GstBaseSinkClass *gstbasesink_class; gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; gstbasesink_class = (GstBaseSinkClass *) klass; gobject_class->finalize = gst_shm_sink_finalize; @@ -298,6 +297,7 @@ gst_shm_sink_start (GstBaseSink * bsink) return FALSE; } + sp_set_data (self->pipe, self); g_free (self->socket_path); self->socket_path = g_strdup (sp_writer_get_path (self->pipe)); @@ -411,8 +411,17 @@ gst_shm_sink_render (GstBaseSink * bsink, GstBuffer * buf) static void gst_shm_sink_free_buffer (gpointer data) { + ShmPipe *pipe; ShmBlock *block = data; + GstShmSink *self; + + pipe = sp_writer_block_get_pipe (block); + self = sp_get_data (pipe); + + GST_OBJECT_LOCK (self); sp_writer_free_block (block); + GST_OBJECT_UNLOCK (self); + g_object_unref (self); } static GstFlowReturn @@ -426,8 +435,10 @@ gst_shm_sink_buffer_alloc (GstBaseSink * sink, guint64 offset, guint size, GST_OBJECT_LOCK (self); block = sp_writer_alloc_block (self->pipe, size); - if (block) + if (block) { buf = sp_writer_block_get_buf (block); + g_object_ref (self); + } GST_OBJECT_UNLOCK (self); if (block) { @@ -503,6 +514,11 @@ pollthread_func (gpointer data) self->clients = g_list_prepend (self->clients, gclient); g_signal_emit (self, signals[SIGNAL_CLIENT_CONNECTED], 0, gclient->pollfd.fd); + /* we need to call gst_poll_wait before calling gst_poll_* status + functions on that new descriptor, so restart the loop, so _wait + will have been called on all elements of self->poll, whether + they have just been added or not. */ + continue; } again: diff --git a/sys/shm/gstshmsrc.c b/sys/shm/gstshmsrc.c index a451790c34..bbeadcd7d0 100644 --- a/sys/shm/gstshmsrc.c +++ b/sys/shm/gstshmsrc.c @@ -64,12 +64,15 @@ static void gst_shm_src_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_shm_src_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); +static void gst_shm_src_finalize (GObject * object); static gboolean gst_shm_src_start (GstBaseSrc * bsrc); static gboolean gst_shm_src_stop (GstBaseSrc * bsrc); static GstFlowReturn gst_shm_src_create (GstPushSrc * psrc, GstBuffer ** outbuf); static gboolean gst_shm_src_unlock (GstBaseSrc * bsrc); static gboolean gst_shm_src_unlock_stop (GstBaseSrc * bsrc); +static GstStateChangeReturn gst_shm_src_change_state (GstElement * element, + GstStateChange transition); static void gst_shm_pipe_inc (GstShmPipe * pipe); static void gst_shm_pipe_dec (GstShmPipe * pipe); @@ -89,22 +92,27 @@ gst_shm_src_base_init (gpointer g_class) "Shared Memory Source", "Source", "Receive data from the sharem memory sink", - "Olivier Crete "); } static void gst_shm_src_class_init (GstShmSrcClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstBaseSrcClass *gstbasesrc_class; GstPushSrcClass *gstpush_src_class; gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; gstbasesrc_class = (GstBaseSrcClass *) klass; gstpush_src_class = (GstPushSrcClass *) klass; gobject_class->set_property = gst_shm_src_set_property; gobject_class->get_property = gst_shm_src_get_property; + gobject_class->finalize = gst_shm_src_finalize; + + gstelement_class->change_state = gst_shm_src_change_state; gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_shm_src_start); gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_shm_src_stop); @@ -130,6 +138,18 @@ gst_shm_src_class_init (GstShmSrcClass * klass) static void gst_shm_src_init (GstShmSrc * self, GstShmSrcClass * g_class) { + self->poll = gst_poll_new (TRUE); + gst_poll_fd_init (&self->pollfd); +} + +static void +gst_shm_src_finalize (GObject * object) +{ + GstShmSrc *self = GST_SHM_SRC (object); + + gst_poll_free (self->poll); + + G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -183,28 +203,27 @@ gst_shm_src_get_property (GObject * object, guint prop_id, } static gboolean -gst_shm_src_start (GstBaseSrc * bsrc) +gst_shm_src_start_reading (GstShmSrc * self) { - GstShmSrc *self = GST_SHM_SRC (bsrc); GstShmPipe *gstpipe = g_slice_new0 (GstShmPipe); gstpipe->use_count = 1; gstpipe->src = gst_object_ref (self); if (!self->socket_path) { - GST_ELEMENT_ERROR (bsrc, RESOURCE, NOT_FOUND, + GST_ELEMENT_ERROR (self, RESOURCE, NOT_FOUND, ("No path specified for socket."), (NULL)); return FALSE; } - GST_DEBUG ("Opening socket %s", self->socket_path); + GST_DEBUG_OBJECT (self, "Opening socket %s", self->socket_path); GST_OBJECT_LOCK (self); gstpipe->pipe = sp_client_open (self->socket_path); GST_OBJECT_UNLOCK (self); if (!gstpipe->pipe) { - GST_ELEMENT_ERROR (bsrc, RESOURCE, OPEN_READ_WRITE, + GST_ELEMENT_ERROR (self, RESOURCE, OPEN_READ_WRITE, ("Could not open socket %s: %d %s", self->socket_path, errno, strerror (errno)), (NULL)); gst_shm_pipe_dec (gstpipe); @@ -213,7 +232,8 @@ gst_shm_src_start (GstBaseSrc * bsrc) self->pipe = gstpipe; - self->poll = gst_poll_new (TRUE); + gst_poll_set_flushing (self->poll, FALSE); + gst_poll_fd_init (&self->pollfd); self->pollfd.fd = sp_get_fd (self->pipe->pipe); gst_poll_add_fd (self->poll, &self->pollfd); @@ -222,11 +242,9 @@ gst_shm_src_start (GstBaseSrc * bsrc) return TRUE; } -static gboolean -gst_shm_src_stop (GstBaseSrc * bsrc) +static void +gst_shm_src_stop_reading (GstShmSrc * self) { - GstShmSrc *self = GST_SHM_SRC (bsrc); - GST_DEBUG_OBJECT (self, "Stopping %p", self); if (self->pipe) { @@ -234,8 +252,26 @@ gst_shm_src_stop (GstBaseSrc * bsrc) self->pipe = NULL; } - gst_poll_free (self->poll); - self->poll = NULL; + gst_poll_remove_fd (self->poll, &self->pollfd); + gst_poll_fd_init (&self->pollfd); + + gst_poll_set_flushing (self->poll, TRUE); +} + +static gboolean +gst_shm_src_start (GstBaseSrc * bsrc) +{ + if (gst_base_src_is_live (bsrc)) + return TRUE; + else + return gst_shm_src_start_reading (GST_SHM_SRC (bsrc)); +} + +static gboolean +gst_shm_src_stop (GstBaseSrc * bsrc) +{ + if (!gst_base_src_is_live (bsrc)) + gst_shm_src_stop_reading (GST_SHM_SRC (bsrc)); return TRUE; } @@ -322,15 +358,43 @@ gst_shm_src_create (GstPushSrc * psrc, GstBuffer ** outbuf) return GST_FLOW_OK; } +static GstStateChangeReturn +gst_shm_src_change_state (GstElement * element, GstStateChange transition) +{ + GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; + GstShmSrc *self = GST_SHM_SRC (element); + + switch (transition) { + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: + if (gst_base_src_is_live (GST_BASE_SRC (element))) + if (!gst_shm_src_start_reading (self)) + return GST_STATE_CHANGE_FAILURE; + default: + break; + } + + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + if (ret == GST_STATE_CHANGE_FAILURE) + return ret; + + switch (transition) { + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: + if (gst_base_src_is_live (GST_BASE_SRC (element))) + gst_shm_src_stop_reading (self); + default: + break; + } + + return ret; +} + static gboolean gst_shm_src_unlock (GstBaseSrc * bsrc) { GstShmSrc *self = GST_SHM_SRC (bsrc); self->unlocked = TRUE; - - if (self->poll) - gst_poll_set_flushing (self->poll, TRUE); + gst_poll_set_flushing (self->poll, TRUE); return TRUE; } @@ -341,9 +405,7 @@ gst_shm_src_unlock_stop (GstBaseSrc * bsrc) GstShmSrc *self = GST_SHM_SRC (bsrc); self->unlocked = FALSE; - - if (self->poll) - gst_poll_set_flushing (self->poll, FALSE); + gst_poll_set_flushing (self->poll, FALSE); return TRUE; } diff --git a/sys/shm/shmpipe.c b/sys/shm/shmpipe.c index 9d1ab56240..c629ea05c2 100644 --- a/sys/shm/shmpipe.c +++ b/sys/shm/shmpipe.c @@ -119,6 +119,8 @@ struct _ShmPipe { int main_socket; char *socket_path; + int use_count; + void *data; ShmArea *shm_area; @@ -190,12 +192,13 @@ sp_writer_create (const char *path, size_t size, mode_t perms) { ShmPipe *self = spalloc_new (ShmPipe); int flags; - struct sockaddr_un sun; + struct sockaddr_un sock_un; int i = 0; memset (self, 0, sizeof (ShmPipe)); self->main_socket = socket (PF_UNIX, SOCK_STREAM, 0); + self->use_count = 1; if (self->main_socket < 0) RETURN_ERROR ("Could not create socket (%d): %s\n", errno, @@ -208,10 +211,10 @@ sp_writer_create (const char *path, size_t size, mode_t perms) if (fcntl (self->main_socket, F_SETFL, flags | O_NONBLOCK | FD_CLOEXEC) < 0) RETURN_ERROR ("fcntl(F_SETFL) failed (%d): %s\n", errno, strerror (errno)); - sun.sun_family = AF_UNIX; - strncpy (sun.sun_path, path, sizeof (sun.sun_path) - 1); + sock_un.sun_family = AF_UNIX; + strncpy (sock_un.sun_path, path, sizeof (sock_un.sun_path) - 1); - while (bind (self->main_socket, (struct sockaddr *) &sun, + while (bind (self->main_socket, (struct sockaddr *) &sock_un, sizeof (struct sockaddr_un)) < 0) { if (errno != EADDRINUSE) RETURN_ERROR ("bind() failed (%d): %s\n", errno, strerror (errno)); @@ -219,11 +222,11 @@ sp_writer_create (const char *path, size_t size, mode_t perms) if (i > 256) RETURN_ERROR ("Could not find a free socket name for %s", path); - snprintf (sun.sun_path, sizeof (sun.sun_path), "%s.%d", path, i); + snprintf (sock_un.sun_path, sizeof (sock_un.sun_path), "%s.%d", path, i); i++; } - self->socket_path = strdup (sun.sun_path); + self->socket_path = strdup (sock_un.sun_path); if (listen (self->main_socket, LISTEN_BACKLOG) < 0) RETURN_ERROR ("listen() failed (%d): %s\n", errno, strerror (errno)); @@ -259,7 +262,7 @@ static ShmArea * sp_open_shm (char *path, int id, mode_t perms, size_t size) { ShmArea *area = spalloc_new (ShmArea); - char tmppath[PATH_MAX]; + char tmppath[32]; int flags; int prot; int i = 0; @@ -282,7 +285,7 @@ sp_open_shm (char *path, int id, mode_t perms, size_t size) area->shm_fd = shm_open (path, flags, perms); } else { do { - snprintf (tmppath, PATH_MAX, "/shmpipe.5%d.%5d", getpid (), i++); + snprintf (tmppath, sizeof (tmppath), "/shmpipe.%5d.%5d", getpid (), i++); area->shm_fd = shm_open (tmppath, flags, perms); } while (area->shm_fd < 0 && errno == EEXIST); } @@ -372,6 +375,38 @@ sp_shm_area_dec (ShmPipe * self, ShmArea * area) } } +void * +sp_get_data (ShmPipe * self) +{ + return self->data; +} + +void +sp_set_data (ShmPipe * self, void *data) +{ + self->data = data; +} + +static void +sp_inc (ShmPipe * self) +{ + self->use_count++; +} + +static void +sp_dec (ShmPipe * self) +{ + self->use_count--; + + if (self->use_count > 0) + return; + + while (self->shm_area) + sp_shm_area_dec (self, self->shm_area); + + spalloc_free (ShmPipe, self); +} + void sp_close (ShmPipe * self) { @@ -386,10 +421,7 @@ sp_close (ShmPipe * self) while (self->clients) sp_writer_close_client (self, self->clients); - while (self->shm_area) - sp_shm_area_dec (self, self->shm_area); - - spalloc_free (ShmPipe, self); + sp_dec (self); } int @@ -481,6 +513,7 @@ sp_writer_alloc_block (ShmPipe * self, size_t size) block->pipe = self; block->area = self->shm_area; block->ablock = ablock; + sp_inc (self); return block; } @@ -491,11 +524,18 @@ sp_writer_block_get_buf (ShmBlock * block) shm_alloc_space_alloc_block_get_offset (block->ablock); } +ShmPipe * +sp_writer_block_get_pipe (ShmBlock * block) +{ + return block->pipe; +} + void sp_writer_free_block (ShmBlock * block) { shm_alloc_space_block_dec (block->ablock); sp_shm_area_dec (block->pipe, block->area); + sp_dec (block->pipe); spalloc_free (ShmBlock, block); } @@ -581,7 +621,7 @@ long int sp_client_recv (ShmPipe * self, char **buf) { char *area_name = NULL; - ShmArea *newarea, *oldarea; + ShmArea *newarea; ShmArea *area; struct CommandBuffer cb; int retval; @@ -608,13 +648,8 @@ sp_client_recv (ShmPipe * self, char **buf) if (!newarea) return -4; - oldarea = self->shm_area; newarea->next = self->shm_area; self->shm_area = newarea; - /* - if (oldarea) - sp_shm_area_dec (self, oldarea); - */ break; case COMMAND_CLOSE_SHM_AREA: @@ -704,18 +739,20 @@ ShmPipe * sp_client_open (const char *path) { ShmPipe *self = spalloc_new (ShmPipe); - struct sockaddr_un sun; + struct sockaddr_un sock_un; memset (self, 0, sizeof (ShmPipe)); self->main_socket = socket (PF_UNIX, SOCK_STREAM, 0); + self->use_count = 1; + if (self->main_socket < 0) goto error; - sun.sun_family = AF_UNIX; - strncpy (sun.sun_path, path, sizeof (sun.sun_path) - 1); + sock_un.sun_family = AF_UNIX; + strncpy (sock_un.sun_path, path, sizeof (sock_un.sun_path) - 1); - if (connect (self->main_socket, (struct sockaddr *) &sun, + if (connect (self->main_socket, (struct sockaddr *) &sock_un, sizeof (struct sockaddr_un)) < 0) goto error; diff --git a/sys/shm/shmpipe.h b/sys/shm/shmpipe.h index a6e092f6a9..c4475b8534 100644 --- a/sys/shm/shmpipe.h +++ b/sys/shm/shmpipe.h @@ -75,6 +75,8 @@ typedef struct _ShmBlock ShmBlock; ShmPipe *sp_writer_create (const char *path, size_t size, mode_t perms); const char *sp_writer_get_path (ShmPipe *pipe); void sp_close (ShmPipe * self); +void *sp_get_data (ShmPipe * self); +void sp_set_data (ShmPipe * self, void *data); int sp_writer_setperms_shm (ShmPipe * self, mode_t perms); int sp_writer_resize (ShmPipe * self, size_t size); @@ -86,6 +88,7 @@ ShmBlock *sp_writer_alloc_block (ShmPipe * self, size_t size); void sp_writer_free_block (ShmBlock *block); int sp_writer_send_buf (ShmPipe * self, char *buf, size_t size); char *sp_writer_block_get_buf (ShmBlock *block); +ShmPipe *sp_writer_block_get_pipe (ShmBlock *block); ShmClient * sp_writer_accept_client (ShmPipe * self); void sp_writer_close_client (ShmPipe *self, ShmClient * client); diff --git a/sys/vdpau/basevideodecoder/gstbasevideodecoder.c b/sys/vdpau/basevideodecoder/gstbasevideodecoder.c index a22d8bfc61..7bbfb4ea57 100644 --- a/sys/vdpau/basevideodecoder/gstbasevideodecoder.c +++ b/sys/vdpau/basevideodecoder/gstbasevideodecoder.c @@ -499,20 +499,20 @@ gst_base_video_decoder_sink_query (GstPad * pad, GstQuery * query) return res; } -void +gboolean gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder * base_video_decoder) { GstCaps *caps; GstVideoState *state = &base_video_decoder->state; if (base_video_decoder->have_src_caps) - return; + return TRUE; caps = gst_pad_get_allowed_caps (base_video_decoder->srcpad); if (!caps) - goto null_caps; + goto null_allowed_caps; if (gst_caps_is_empty (caps)) - goto empty_caps; + goto empty_allowed_caps; gst_caps_set_simple (caps, "width", G_TYPE_INT, state->width, @@ -526,25 +526,26 @@ gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder * base_video_decoder) gst_pad_fixate_caps (base_video_decoder->srcpad, caps); - - GST_DEBUG ("setting caps %" GST_PTR_FORMAT, caps); - gst_pad_set_caps (GST_BASE_VIDEO_DECODER_SRC_PAD (base_video_decoder), caps); + base_video_decoder->have_src_caps = + gst_pad_set_caps (GST_BASE_VIDEO_DECODER_SRC_PAD (base_video_decoder), + caps); + gst_caps_unref (caps); - base_video_decoder->have_src_caps = TRUE; + return base_video_decoder->have_src_caps; + +null_allowed_caps: + GST_ERROR_OBJECT (base_video_decoder, + "Got null from gst_pad_get_allowed_caps"); + return FALSE; + +empty_allowed_caps: + GST_ERROR_OBJECT (base_video_decoder, + "Got EMPTY caps from gst_pad_get_allowed_caps"); gst_caps_unref (caps); - return; - -null_caps: - GST_WARNING ("Got null caps from get_allowed_caps"); - return; - -empty_caps: - GST_WARNING ("Got empty caps from get_allowed_caps"); - gst_caps_unref (caps); - return; + return FALSE; } static GstFlowReturn @@ -870,6 +871,10 @@ gst_base_video_decoder_finish_frame (GstBaseVideoDecoder * base_video_decoder, base_video_decoder_class = GST_BASE_VIDEO_DECODER_GET_CLASS (base_video_decoder); + + if (!gst_base_video_decoder_set_src_caps (base_video_decoder)) + return GST_FLOW_NOT_NEGOTIATED; + gst_base_video_decoder_calculate_timestamps (base_video_decoder, frame, &presentation_timestamp, &presentation_duration); @@ -913,8 +918,6 @@ gst_base_video_decoder_finish_frame (GstBaseVideoDecoder * base_video_decoder, GST_DEBUG ("pushing frame %" GST_TIME_FORMAT, GST_TIME_ARGS (presentation_timestamp)); - gst_base_video_decoder_set_src_caps (base_video_decoder); - if (base_video_decoder->sink_clipping) { gint64 start = GST_BUFFER_TIMESTAMP (src_buffer); gint64 stop = GST_BUFFER_TIMESTAMP (src_buffer) + @@ -1050,7 +1053,6 @@ gst_base_video_decoder_set_state (GstBaseVideoDecoder * base_video_decoder, base_video_decoder->state = state; base_video_decoder->have_src_caps = FALSE; - gst_base_video_decoder_set_src_caps (base_video_decoder); } void diff --git a/sys/vdpau/basevideodecoder/gstbasevideodecoder.h b/sys/vdpau/basevideodecoder/gstbasevideodecoder.h index 85fe7675ca..87aab2e3f8 100644 --- a/sys/vdpau/basevideodecoder/gstbasevideodecoder.h +++ b/sys/vdpau/basevideodecoder/gstbasevideodecoder.h @@ -169,7 +169,7 @@ gst_base_video_decoder_have_frame (GstBaseVideoDecoder *base_video_decoder, GstVideoState gst_base_video_decoder_get_state (GstBaseVideoDecoder *base_video_decoder); void gst_base_video_decoder_set_state (GstBaseVideoDecoder *base_video_decoder, GstVideoState state); -void gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder * base_video_decoder); +gboolean gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder * base_video_decoder); void gst_base_video_decoder_lost_sync (GstBaseVideoDecoder *base_video_decoder); diff --git a/sys/vdpau/gstvdp/gstvdpdecoder.c b/sys/vdpau/gstvdp/gstvdpdecoder.c index 5c7a66cb1f..977f6e6b28 100644 --- a/sys/vdpau/gstvdp/gstvdpdecoder.c +++ b/sys/vdpau/gstvdp/gstvdpdecoder.c @@ -154,6 +154,10 @@ gst_vdp_decoder_init_decoder (GstVdpDecoder * vdp_decoder, goto destroy_decoder_error; } + if (!gst_base_video_decoder_set_src_caps (GST_BASE_VIDEO_DECODER + (vdp_decoder))) + return GST_FLOW_NOT_NEGOTIATED; + state = gst_base_video_decoder_get_state (GST_BASE_VIDEO_DECODER (vdp_decoder)); diff --git a/sys/vdpau/gstvdpau.c b/sys/vdpau/gstvdpau.c index a8bd629d74..63c7215516 100644 --- a/sys/vdpau/gstvdpau.c +++ b/sys/vdpau/gstvdpau.c @@ -1,5 +1,5 @@ #ifdef HAVE_CONFIG_H -# include +#include #endif diff --git a/sys/vdpau/gstvdpsink.c b/sys/vdpau/gstvdpsink.c index 43afc559a0..31a3d5926d 100644 --- a/sys/vdpau/gstvdpsink.c +++ b/sys/vdpau/gstvdpsink.c @@ -158,20 +158,54 @@ gst_vdp_sink_window_set_title (VdpSink * vdp_sink, } } +static void +gst_vdp_sink_window_setup_vdpau (VdpSink * vdp_sink, GstVdpWindow * window) +{ + GstVdpDevice *device = vdp_sink->device; + VdpStatus status; + VdpColor color = { 0, }; + + status = device->vdp_presentation_queue_target_create_x11 (device->device, + window->win, &window->target); + if (status != VDP_STATUS_OK) { + GST_ELEMENT_ERROR (vdp_sink, RESOURCE, READ, + ("Could not create presentation target"), + ("Error returned from vdpau was: %s", + device->vdp_get_error_string (status))); + } + + status = + device->vdp_presentation_queue_create (device->device, window->target, + &window->queue); + if (status != VDP_STATUS_OK) { + GST_ELEMENT_ERROR (vdp_sink, RESOURCE, READ, + ("Could not create presentation queue"), + ("Error returned from vdpau was: %s", + device->vdp_get_error_string (status))); + } + + status = + device->vdp_presentation_queue_set_background_color (window->queue, + &color); + if (status != VDP_STATUS_OK) { + GST_ELEMENT_ERROR (vdp_sink, RESOURCE, READ, + ("Could not set background color"), + ("Error returned from vdpau was: %s", + device->vdp_get_error_string (status))); + } +} + /* This function handles a GstVdpWindow creation */ static GstVdpWindow * gst_vdp_sink_window_new (VdpSink * vdp_sink, gint width, gint height) { - GstVdpWindow *window = NULL; GstVdpDevice *device = vdp_sink->device; + GstVdpWindow *window = NULL; Window root; gint screen_num; gulong black; - VdpStatus status; - VdpColor color = { 0, }; - g_return_val_if_fail (GST_IS_VDP_SINK (vdp_sink), NULL); window = g_new0 (GstVdpWindow, 1); @@ -218,35 +252,7 @@ gst_vdp_sink_window_new (VdpSink * vdp_sink, gint width, gint height) g_mutex_unlock (vdp_sink->x_lock); gst_vdp_sink_window_decorate (vdp_sink, window); - - status = device->vdp_presentation_queue_target_create_x11 (device->device, - window->win, &window->target); - if (status != VDP_STATUS_OK) { - GST_ELEMENT_ERROR (vdp_sink, RESOURCE, READ, - ("Could not create presentation target"), - ("Error returned from vdpau was: %s", - device->vdp_get_error_string (status))); - } - - status = - device->vdp_presentation_queue_create (device->device, window->target, - &window->queue); - if (status != VDP_STATUS_OK) { - GST_ELEMENT_ERROR (vdp_sink, RESOURCE, READ, - ("Could not create presentation queue"), - ("Error returned from vdpau was: %s", - device->vdp_get_error_string (status))); - } - - status = - device->vdp_presentation_queue_set_background_color (window->queue, - &color); - if (status != VDP_STATUS_OK) { - GST_ELEMENT_ERROR (vdp_sink, RESOURCE, READ, - ("Could not set background color"), - ("Error returned from vdpau was: %s", - device->vdp_get_error_string (status))); - } + gst_vdp_sink_window_setup_vdpau (vdp_sink, window); gst_x_overlay_got_window_handle (GST_X_OVERLAY (vdp_sink), (guintptr) window->win); @@ -1161,8 +1167,9 @@ gst_vdp_sink_set_window_handle (GstXOverlay * overlay, guintptr window_handle) StructureNotifyMask | PointerMotionMask | KeyPressMask | KeyReleaseMask); } - g_mutex_unlock (vdp_sink->x_lock); + + gst_vdp_sink_window_setup_vdpau (vdp_sink, window); } if (window) diff --git a/sys/vdpau/gstvdpvideopostprocess.c b/sys/vdpau/gstvdpvideopostprocess.c index 0b6f338705..ced168fec4 100644 --- a/sys/vdpau/gstvdpvideopostprocess.c +++ b/sys/vdpau/gstvdpvideopostprocess.c @@ -526,11 +526,9 @@ gst_vdp_vpp_sink_setcaps (GstPad * pad, GstCaps * caps) allowed_caps = gst_pad_get_allowed_caps (vpp->srcpad); if (G_UNLIKELY (!allowed_caps)) - goto allowed_caps_error; - if (G_UNLIKELY (gst_caps_is_empty (allowed_caps))) { - gst_caps_unref (allowed_caps); - goto allowed_caps_error; - } + goto null_allowed_caps; + if (G_UNLIKELY (gst_caps_is_empty (allowed_caps))) + goto empty_allowed_caps; GST_DEBUG ("allowed_caps: %" GST_PTR_FORMAT, allowed_caps); output_caps = gst_vdp_video_to_output_caps (video_caps); @@ -569,8 +567,14 @@ done: return res; -allowed_caps_error: - GST_ERROR_OBJECT (vpp, "Got invalid allowed caps"); +null_allowed_caps: + GST_ERROR_OBJECT (vpp, "Got null from gst_pad_get_allowed_caps"); + goto done; + +empty_allowed_caps: + GST_ERROR_OBJECT (vpp, "Got EMPTY caps from gst_pad_get_allowed_caps"); + + gst_caps_unref (allowed_caps); goto done; not_negotiated: diff --git a/sys/vdpau/h264/gsth264dpb.c b/sys/vdpau/h264/gsth264dpb.c index 11a7d2c3ca..71a04e9635 100644 --- a/sys/vdpau/h264/gsth264dpb.c +++ b/sys/vdpau/h264/gsth264dpb.c @@ -81,21 +81,24 @@ gst_h264_dpb_remove (GstH264DPB * dpb, guint idx) frames[i] = frames[i + 1]; } -static void +static GstFlowReturn gst_h264_dpb_output (GstH264DPB * dpb, guint idx) { + GstFlowReturn ret; GstH264Frame *frame = dpb->frames[idx]; gst_video_frame_ref (GST_VIDEO_FRAME_CAST (frame)); - dpb->output (dpb, frame, dpb->user_data); + ret = dpb->output (dpb, frame, dpb->user_data); frame->output_needed = FALSE; if (!frame->is_reference) gst_h264_dpb_remove (dpb, idx); + + return ret; } static gboolean -gst_h264_dpb_bump (GstH264DPB * dpb, guint poc) +gst_h264_dpb_bump (GstH264DPB * dpb, guint poc, GstFlowReturn * ret) { GstH264Frame **frames; guint i; @@ -118,7 +121,7 @@ gst_h264_dpb_bump (GstH264DPB * dpb, guint poc) } if (frames[bump_idx]->poc < poc) { - gst_h264_dpb_output (dpb, bump_idx); + *ret = gst_h264_dpb_output (dpb, bump_idx); return TRUE; } } @@ -126,10 +129,11 @@ gst_h264_dpb_bump (GstH264DPB * dpb, guint poc) return FALSE; } -gboolean +GstFlowReturn gst_h264_dpb_add (GstH264DPB * dpb, GstH264Frame * h264_frame) { GstH264Frame **frames; + GstFlowReturn ret; GST_DEBUG ("add frame with poc: %d", h264_frame->poc); @@ -140,33 +144,40 @@ gst_h264_dpb_add (GstH264DPB * dpb, GstH264Frame * h264_frame) h264_frame->is_reference = FALSE; if (h264_frame->is_reference) { + + ret = GST_FLOW_OK; while (dpb->n_frames == dpb->max_frames) { - if (!gst_h264_dpb_bump (dpb, G_MAXUINT)) { + if (!gst_h264_dpb_bump (dpb, G_MAXUINT, &ret)) { GST_ERROR_OBJECT (dpb, "Couldn't make room in DPB"); - return FALSE; + return GST_FLOW_OK; } } dpb->frames[dpb->n_frames++] = h264_frame; } else { - while (gst_h264_dpb_bump (dpb, h264_frame->poc)); - dpb->output (dpb, h264_frame, dpb->user_data); + while (gst_h264_dpb_bump (dpb, h264_frame->poc, &ret)) { + if (ret != GST_FLOW_OK) + return ret; + } + + ret = dpb->output (dpb, h264_frame, dpb->user_data); } - return TRUE; + return ret; } void gst_h264_dpb_flush (GstH264DPB * dpb, gboolean output) { + GstFlowReturn ret; GstVideoFrame **frames; guint i; GST_DEBUG ("flush"); if (output) - while (gst_h264_dpb_bump (dpb, G_MAXUINT)); + while (gst_h264_dpb_bump (dpb, G_MAXUINT, &ret)); frames = (GstVideoFrame **) dpb->frames; for (i = 0; i < dpb->n_frames; i++) @@ -334,11 +345,12 @@ gst_h264_dpb_set_property (GObject * object, guint property_id, switch (property_id) { case PROP_NUM_REF_FRAMES: { + GstFlowReturn ret; guint i; dpb->max_frames = g_value_get_uint (value); for (i = dpb->n_frames; i > dpb->max_frames; i--) - gst_h264_dpb_bump (dpb, G_MAXUINT); + gst_h264_dpb_bump (dpb, G_MAXUINT, &ret); break; } diff --git a/sys/vdpau/h264/gsth264dpb.h b/sys/vdpau/h264/gsth264dpb.h index 993c5524ac..4eb17fc9f6 100644 --- a/sys/vdpau/h264/gsth264dpb.h +++ b/sys/vdpau/h264/gsth264dpb.h @@ -42,7 +42,7 @@ G_BEGIN_DECLS typedef struct _GstH264DPB GstH264DPB; typedef struct _GstH264DPBClass GstH264DPBClass; -typedef void (*GstH264DPBOutputFunc) (GstH264DPB *dpb, GstH264Frame *h264_frame, gpointer user_data); +typedef GstFlowReturn (*GstH264DPBOutputFunc) (GstH264DPB *dpb, GstH264Frame *h264_frame, gpointer user_data); struct _GstH264DPB { diff --git a/sys/vdpau/h264/gsth264frame.c b/sys/vdpau/h264/gsth264frame.c index 4b6952f212..421de0fe37 100644 --- a/sys/vdpau/h264/gsth264frame.c +++ b/sys/vdpau/h264/gsth264frame.c @@ -54,11 +54,7 @@ gst_h264_frame_finalize (GstH264Frame * h264_frame) { g_ptr_array_foreach (h264_frame->slices, (GFunc) gst_buffer_unref, NULL); -#if GLIB_CHECK_VERSION (2,22,0) g_ptr_array_unref (h264_frame->slices); -#else - g_ptr_array_free (h264_frame->slices, TRUE); -#endif GST_MINI_OBJECT_CLASS (gst_h264_frame_parent_class)->finalize (GST_MINI_OBJECT (h264_frame)); diff --git a/sys/vdpau/h264/gstvdph264dec.c b/sys/vdpau/h264/gstvdph264dec.c index 4abc009616..8d7e3fa4ec 100644 --- a/sys/vdpau/h264/gstvdph264dec.c +++ b/sys/vdpau/h264/gstvdph264dec.c @@ -151,7 +151,7 @@ gst_vdp_h264_dec_set_sink_caps (GstBaseVideoDecoder * base_video_decoder, return TRUE; } -static void +static GstFlowReturn gst_vdp_h264_dec_output (GstH264DPB * dpb, GstH264Frame * h264_frame, gpointer user_data) { @@ -159,7 +159,7 @@ gst_vdp_h264_dec_output (GstH264DPB * dpb, GstH264Frame * h264_frame, GST_DEBUG ("poc: %d", h264_frame->poc); - gst_base_video_decoder_finish_frame (base_video_decoder, + return gst_base_video_decoder_finish_frame (base_video_decoder, GST_VIDEO_FRAME_CAST (h264_frame)); } @@ -259,7 +259,7 @@ gst_vdp_h264_dec_calculate_par (GstH264VUIParameters * vui, guint16 * par_n, return FALSE; } -static gboolean +static GstFlowReturn gst_vdp_h264_dec_idr (GstVdpH264Dec * h264_dec, GstH264Frame * h264_frame) { GstH264Slice *slice; @@ -496,7 +496,7 @@ gst_vdp_h264_dec_handle_frame (GstBaseVideoDecoder * base_video_decoder, h264_dec->got_idr = TRUE; else { gst_base_video_decoder_skip_frame (base_video_decoder, frame); - return ret; + return GST_FLOW_OK; } } @@ -585,9 +585,7 @@ gst_vdp_h264_dec_handle_frame (GstBaseVideoDecoder * base_video_decoder, gst_h264_dpb_mark_sliding (h264_dec->dpb); } - gst_h264_dpb_add (h264_dec->dpb, h264_frame); - - return GST_FLOW_OK; + return gst_h264_dpb_add (h264_dec->dpb, h264_frame); } static gint diff --git a/sys/vdpau/mpeg/gstvdpmpegdec.c b/sys/vdpau/mpeg/gstvdpmpegdec.c index 3263e6ec7e..3de0eec65b 100644 --- a/sys/vdpau/mpeg/gstvdpmpegdec.c +++ b/sys/vdpau/mpeg/gstvdpmpegdec.c @@ -290,7 +290,7 @@ gst_vdp_mpeg_dec_handle_frame (GstBaseVideoDecoder * base_video_decoder, VdpPictureInfoMPEG1Or2 *info; GstVdpMpegFrame *mpeg_frame; - GstFlowReturn ret; + GstFlowReturn ret = GST_FLOW_OK; VdpBitstreamBuffer vbit[1]; GstVdpVideoBuffer *outbuf; @@ -356,7 +356,7 @@ gst_vdp_mpeg_dec_handle_frame (GstBaseVideoDecoder * base_video_decoder, if (info->picture_coding_type != B_FRAME) { if (info->backward_reference != VDP_INVALID_HANDLE) { - gst_base_video_decoder_finish_frame (base_video_decoder, + ret = gst_base_video_decoder_finish_frame (base_video_decoder, mpeg_dec->b_frame); } @@ -371,6 +371,11 @@ gst_vdp_mpeg_dec_handle_frame (GstBaseVideoDecoder * base_video_decoder, info->backward_reference = VDP_INVALID_HANDLE; } + if (ret != GST_FLOW_OK) { + gst_base_video_decoder_skip_frame (base_video_decoder, frame); + return ret; + } + /* decode */ vbit[0].struct_version = VDP_BITSTREAM_BUFFER_VERSION; vbit[0].bitstream = GST_BUFFER_DATA (mpeg_frame->slices); @@ -384,13 +389,13 @@ gst_vdp_mpeg_dec_handle_frame (GstBaseVideoDecoder * base_video_decoder, frame->src_buffer = GST_BUFFER_CAST (outbuf); if (info->picture_coding_type == B_FRAME) { - gst_base_video_decoder_finish_frame (base_video_decoder, frame); + ret = gst_base_video_decoder_finish_frame (base_video_decoder, frame); } else { info->backward_reference = GST_VDP_VIDEO_BUFFER (outbuf)->surface; mpeg_dec->b_frame = gst_video_frame_ref (frame); } - return GST_FLOW_OK; + return ret; } static GstVideoFrame * diff --git a/sys/vdpau/mpeg4/gstvdpmpeg4dec.c b/sys/vdpau/mpeg4/gstvdpmpeg4dec.c index de1497aed6..2ecf434e11 100644 --- a/sys/vdpau/mpeg4/gstvdpmpeg4dec.c +++ b/sys/vdpau/mpeg4/gstvdpmpeg4dec.c @@ -244,7 +244,7 @@ gst_vdp_mpeg4_dec_handle_frame (GstBaseVideoDecoder * base_video_decoder, if (vop.coding_type != B_VOP) { if (mpeg4_dec->b_frame) { - gst_base_video_decoder_finish_frame (base_video_decoder, + ret = gst_base_video_decoder_finish_frame (base_video_decoder, GST_VIDEO_FRAME_CAST (mpeg4_dec->b_frame)); if (mpeg4_dec->f_frame) diff --git a/sys/wininet/gstwininetsrc.c b/sys/wininet/gstwininetsrc.c index b29b4de74b..8104f7cea7 100644 --- a/sys/wininet/gstwininetsrc.c +++ b/sys/wininet/gstwininetsrc.c @@ -408,7 +408,7 @@ gst_win_inet_src_uri_get_protocols (void) return (gchar **) protocols; } -static G_CONST_RETURN gchar * +static const gchar * gst_win_inet_src_uri_get_uri (GstURIHandler * handler) { GstWinInetSrc *src = GST_WIN_INET_SRC (handler); diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 9de5de2919..8b76b2a2ae 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -14,7 +14,12 @@ TESTS_ENVIRONMENT = \ GST_PLUGIN_SYSTEM_PATH= \ GST_PLUGIN_PATH=$(top_builddir)/gst:$(top_builddir)/sys:$(top_builddir)/ext:$(GST_PLUGINS_FFMPEG_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-ffmpeg:gst-plugins-bad@$(top_builddir)" \ - GST_STATE_IGNORE_ELEMENTS="apexsink camerabin camerabin2 cdaudio dc1394src dccpclientsrc dccpclientsink dccpserversrc dccpserversink dvbsrc dvbbasebin dfbvideosink festival gsettingsvideosrc gsettingsvideosink gsettingsaudiosrc gsettingsaudiosink nassink rsndvdbin sdlaudiosink sdlvideosink vcdsrc rfbsrc vdpauyuvvideo vdpauvideoyuv vdpaumpegdec vdpaumpeg4dec vdpauh264dec vdpauvideopostprocess vdpausink neonhttpsrc" + GST_STATE_IGNORE_ELEMENTS="apexsink camerabin camerabin2 cdaudio dc1394src \ + dccpclientsrc dccpclientsink dccpserversrc dccpserversink decklinksrc \ + decklinksink dvbsrc dvbbasebin dfbvideosink festival gsettingsvideosrc \ + gsettingsvideosink gsettingsaudiosrc gsettingsaudiosink linsyssdisrc linsyssdisink nassink \ + rsndvdbin sdlaudiosink sdlvideosink vcdsrc rfbsrc vdpauyuvvideo vdpauvideoyuv \ + vdpaumpegdec vdpaumpeg4dec vdpauh264dec vdpauvideopostprocess vdpausink neonhttpsrc" plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@ @@ -46,12 +51,24 @@ else check_faad = endif +if USE_VOAACENC +check_voaacenc = elements/voaacenc +else +check_voaacenc = +endif + if USE_EXIF check_jifmux = elements/jifmux else check_jifmux = endif +if USE_COG +check_logoinsert = elements/logoinsert +else +check_logoinsert = +endif + if USE_MPEG2ENC check_mpeg2enc = elements/mpeg2enc else @@ -67,13 +84,13 @@ endif if USE_NEON check_neon = elements/neonhttpsrc else -check_neon = +check_neon = endif if USE_OFA check_ofa = elements/ofa else -check_ofa = +check_ofa = endif if USE_SCHRO @@ -129,7 +146,6 @@ VALGRIND_TESTS_DISABLE = \ if BUILD_EXPERIMENTAL EXPERIMENTAL_CHECKS=elements/camerabin2 \ - elements/imagecapturebin \ elements/viewfinderbin endif @@ -143,28 +159,29 @@ check_PROGRAMS = \ $(check_assrender) \ $(check_faac) \ $(check_faad) \ + $(check_voaacenc) \ $(check_mpeg2enc) \ $(check_mplex) \ $(check_ofa) \ $(check_timidity) \ $(check_kate) \ - elements/aacparse \ - elements/ac3parse \ - elements/amrparse \ elements/autoconvert \ elements/autovideoconvert \ elements/asfmux \ + elements/baseaudiovisualizer \ elements/camerabin \ elements/dataurisrc \ - elements/flacparse \ elements/legacyresample \ $(check_jifmux) \ elements/jpegparse \ - elements/qtmux \ + $(check_logoinsert) \ + elements/h263parse \ + elements/h264parse \ + elements/mpegvideoparse \ + elements/mpeg4videoparse \ elements/mxfdemux \ elements/mxfmux \ elements/id3mux \ - elements/mpegaudioparse \ pipelines/mxf \ $(check_mimic) \ elements/rtpmux \ @@ -172,7 +189,6 @@ check_PROGRAMS = \ $(check_vp8) \ $(check_zbar) \ $(check_orc) \ - pipelines/tagschecking \ $(EXPERIMENTAL_CHECKS) noinst_HEADERS = elements/mxfdemux.h @@ -184,6 +200,39 @@ AM_CFLAGS = $(GST_CHECK_CFLAGS) $(GST_OPTION_CFLAGS) \ -UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS LDADD = $(GST_CHECK_LIBS) +# parser unit test convenience lib +noinst_LTLIBRARIES = libparser.la +libparser_la_SOURCES = elements/parser.c elements/parser.h +libparser_la_CFLAGS = \ + -I$(top_srcdir)/tests/check \ + $(GST_CHECK_CFLAGS) $(GST_OPTION_CFLAGS) + +elements_mpegvideoparse_LDADD = libparser.la $(LDADD) + +elements_mpeg4videoparse_LDADD = libparser.la $(LDADD) + +elements_h263parse_LDADD = libparser.la $(LDADD) + +elements_h264parse_LDADD = libparser.la $(LDADD) + +elements_voaacenc_CFLAGS = \ + $(GST_PLUGINS_BASE_CFLAGS) \ + $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS) +elements_voaacenc_LDADD = \ + $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) $(LDADD) \ + -lgstaudio-@GST_MAJORMINOR@ + +elements_baseaudiovisualizer_SOURCES = elements/baseaudiovisualizer.c \ + $(top_srcdir)/gst/audiovisualizers/gstbaseaudiovisualizer.c \ + $(top_srcdir)/gst/audiovisualizers/gstbaseaudiovisualizer.h +elements_baseaudiovisualizer_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) \ + -I$(top_srcdir)/gst/audiovisualizers $(GST_PLUGINS_BASE_CFLAGS) \ + $(GST_BASE_CFLAGS) $(GST_CONTROLLER_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS) +elements_baseaudiovisualizer_LDADD = \ + $(GST_PLUGINS_BASE_LIBS) -lgstaudio-@GST_MAJORMINOR@ \ + -lgstvideo-@GST_MAJORMINOR@ $(GST_BASE_LIBS) $(GST_CONTROLLER_LIBS) \ + $(GST_LIBS) $(LDADD) + elements_camerabin_CFLAGS = \ $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \ $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS) -DGST_USE_UNSTABLE_API @@ -205,13 +254,6 @@ elements_camerabin2_LDADD = \ $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) $(LDADD) elements_camerabin2_SOURCES = elements/camerabin2.c -elements_imagecapturebin_CFLAGS = \ - $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \ - $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS) -DGST_USE_UNSTABLE_API -elements_imagecapturebin_LDADD = \ - $(GST_PLUGINS_BASE_LIBS) -lgstapp-@GST_MAJORMINOR@ \ - $(GST_BASE_LIBS) $(GST_LIBS) $(LDADD) -elements_imagecapturebin_SOURCES = elements/imagecapturebin.c endif elements_jifmux_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(EXIF_CFLAGS) $(AM_CFLAGS) @@ -230,23 +272,6 @@ elements_rtpmux_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstrtp-0.10 $(GST_BASE_LIBS) elements_assrender_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM_CFLAGS) elements_assrender_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-0.10 -lgstapp-0.10 $(GST_BASE_LIBS) $(LDADD) -# parser unit test convenience lib -noinst_LTLIBRARIES = libparser.la -libparser_la_SOURCES = elements/parser.c elements/parser.h -libparser_la_CFLAGS = \ - -I$(top_srcdir)/tests/check \ - $(GST_CHECK_CFLAGS) $(GST_OPTION_CFLAGS) - -elements_aacparse_LDADD = libparser.la $(LDADD) - -elements_ac3parse_LDADD = libparser.la $(LDADD) - -elements_amrparse_LDADD = libparser.la $(LDADD) - -elements_flacparse_LDADD = libparser.la $(LDADD) - -elements_mpegaudioparse_LDADD = libparser.la $(LDADD) - EXTRA_DIST = gst-plugins-bad.supp orc_cog_CFLAGS = $(ORC_CFLAGS) diff --git a/tests/check/elements/.gitignore b/tests/check/elements/.gitignore index 8a748233c3..4554222b92 100644 --- a/tests/check/elements/.gitignore +++ b/tests/check/elements/.gitignore @@ -1,18 +1,15 @@ .dirstamp -aacparse -ac3parse -amrparse asfmux assrender autoconvert autovideoconvert +baseaudiovisualizer camerabin camerabin2 deinterleave dataurisrc faac faad -flacparse gdpdepay gdppay id3mux @@ -22,14 +19,13 @@ jifmux jpegparse kate legacyresample +logoinsert mpeg2enc -mpegaudioparse mplex mxfdemux mxfmux neonhttpsrc ofa -qtmux rganalysis rglimiter rgvolume diff --git a/tests/check/elements/aacparse.c b/tests/check/elements/aacparse.c deleted file mode 100644 index af10a27798..0000000000 --- a/tests/check/elements/aacparse.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * GStreamer - * - * unit test for aacparse - * - * Copyright (C) 2008 Nokia Corporation. All rights reserved. - * - * Contact: Stefan Kost - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "parser.h" - -#define SRC_CAPS_CDATA "audio/mpeg, framed=(boolean)false, codec_data=(buffer)1190" -#define SRC_CAPS_TMPL "audio/mpeg, framed=(boolean)false, mpegversion=(int){2,4}" - -#define SINK_CAPS \ - "audio/mpeg, framed=(boolean)true" -#define SINK_CAPS_MPEG2 \ - "audio/mpeg, framed=(boolean)true, mpegversion=2, rate=48000, channels=2" -#define SINK_CAPS_MPEG4 \ - "audio/mpeg, framed=(boolean)true, mpegversion=4, rate=96000, channels=2" -#define SINK_CAPS_TMPL "audio/mpeg, framed=(boolean)true, mpegversion=(int){2,4}" - -GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (SINK_CAPS_TMPL) - ); - -GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (SRC_CAPS_TMPL) - ); - -/* some data */ -static guint8 adif_header[] = { - 'A', 'D', 'I', 'F' -}; - -static guint8 adts_frame_mpeg2[] = { - 0xff, 0xf9, 0x4c, 0x80, 0x01, 0xff, 0xfc, 0x21, 0x10, 0xd3, 0x20, 0x0c, - 0x32, 0x00, 0xc7 -}; - -static guint8 adts_frame_mpeg4[] = { - 0xff, 0xf1, 0x4c, 0x80, 0x01, 0xff, 0xfc, 0x21, 0x10, 0xd3, 0x20, 0x0c, - 0x32, 0x00, 0xc7 -}; - -static guint8 garbage_frame[] = { - 0xff, 0xff, 0xff, 0xff, 0xff -}; - -/* - * Test if the parser pushes data with ADIF header properly and detects the - * stream to MPEG4 properly. - */ -GST_START_TEST (test_parse_adif_normal) -{ - GstParserTest ptest; - - /* ADIF header */ - gst_parser_test_init (&ptest, adif_header, sizeof (adif_header), 1); - /* well, no garbage, followed by random data */ - ptest.series[2].size = 100; - ptest.series[2].num = 3; - /* and we do not really expect output frames */ - ptest.framed = FALSE; - /* Check that the negotiated caps are as expected */ - /* For ADIF parser assumes that data is always version 4 */ - ptest.sink_caps = - gst_caps_from_string (SINK_CAPS_MPEG4 ", stream-format=(string)adif"); - - gst_parser_test_run (&ptest, NULL); - - gst_caps_unref (ptest.sink_caps); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_adts_normal) -{ - gst_parser_test_normal (adts_frame_mpeg4, sizeof (adts_frame_mpeg4)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_adts_drain_single) -{ - gst_parser_test_drain_single (adts_frame_mpeg4, sizeof (adts_frame_mpeg4)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_adts_drain_garbage) -{ - gst_parser_test_drain_garbage (adts_frame_mpeg4, sizeof (adts_frame_mpeg4), - garbage_frame, sizeof (garbage_frame)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_adts_split) -{ - gst_parser_test_split (adts_frame_mpeg4, sizeof (adts_frame_mpeg4)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_adts_skip_garbage) -{ - gst_parser_test_skip_garbage (adts_frame_mpeg4, sizeof (adts_frame_mpeg4), - garbage_frame, sizeof (garbage_frame)); -} - -GST_END_TEST; - - -/* - * Test if the src caps are set according to stream format (MPEG version). - */ -GST_START_TEST (test_parse_adts_detect_mpeg_version) -{ - gst_parser_test_output_caps (adts_frame_mpeg2, sizeof (adts_frame_mpeg2), - NULL, SINK_CAPS_MPEG2 ", stream-format=(string)adts"); -} - -GST_END_TEST; - -#define structure_get_int(s,f) \ - (g_value_get_int(gst_structure_get_value(s,f))) -#define fail_unless_structure_field_int_equals(s,field,num) \ - fail_unless_equals_int (structure_get_int(s,field), num) -/* - * Test if the parser handles raw stream and codec_data info properly. - */ -GST_START_TEST (test_parse_handle_codec_data) -{ - GstCaps *caps; - GstStructure *s; - const gchar *stream_format; - - /* Push random data. It should get through since the parser should be - * initialized because it got codec_data in the caps */ - caps = gst_parser_test_get_output_caps (NULL, 100, SRC_CAPS_CDATA); - fail_unless (caps != NULL); - - /* Check that the negotiated caps are as expected */ - /* When codec_data is present, parser assumes that data is version 4 */ - GST_LOG ("aac output caps: %" GST_PTR_FORMAT, caps); - s = gst_caps_get_structure (caps, 0); - fail_unless (gst_structure_has_name (s, "audio/mpeg")); - fail_unless_structure_field_int_equals (s, "mpegversion", 4); - fail_unless_structure_field_int_equals (s, "channels", 2); - fail_unless_structure_field_int_equals (s, "rate", 48000); - fail_unless (gst_structure_has_field (s, "codec_data")); - fail_unless (gst_structure_has_field (s, "stream-format")); - stream_format = gst_structure_get_string (s, "stream-format"); - fail_unless (strcmp (stream_format, "raw") == 0); - - gst_caps_unref (caps); -} - -GST_END_TEST; - - -static Suite * -aacparse_suite (void) -{ - Suite *s = suite_create ("aacparse"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - /* ADIF tests */ - tcase_add_test (tc_chain, test_parse_adif_normal); - - /* ADTS tests */ - tcase_add_test (tc_chain, test_parse_adts_normal); - tcase_add_test (tc_chain, test_parse_adts_drain_single); - tcase_add_test (tc_chain, test_parse_adts_drain_garbage); - tcase_add_test (tc_chain, test_parse_adts_split); - tcase_add_test (tc_chain, test_parse_adts_skip_garbage); - tcase_add_test (tc_chain, test_parse_adts_detect_mpeg_version); - - /* Other tests */ - tcase_add_test (tc_chain, test_parse_handle_codec_data); - - return s; -} - - -/* - * TODO: - * - Both push- and pull-modes need to be tested - * * Pull-mode & EOS - */ - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = aacparse_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - /* init test context */ - ctx_factory = "aacparse"; - ctx_sink_template = &sinktemplate; - ctx_src_template = &srctemplate; - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/tests/check/elements/ac3parse.c b/tests/check/elements/ac3parse.c deleted file mode 100644 index 03e8e1dc85..0000000000 --- a/tests/check/elements/ac3parse.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * GStreamer - * - * unit test for ac3parse - * - * Copyright (C) 2008 Nokia Corporation. All rights reserved. - * - * Contact: Stefan Kost - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "parser.h" - -#define SRC_CAPS_TMPL "audio/x-ac3, framed=(boolean)false" -#define SINK_CAPS_TMPL "audio/x-ac3, framed=(boolean)true" - -GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (SINK_CAPS_TMPL) - ); - -GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (SRC_CAPS_TMPL) - ); - -/* some data */ - -static guint8 ac3_frame[512] = { - 0x0b, 0x77, 0xb6, 0xa8, 0x10, 0x40, 0x2f, 0x84, - 0x29, 0xcb, 0xfe, 0x75, 0x7c, 0xf9, 0xf3, 0xe7, - 0xcf, 0x9f, 0x3e, 0x7c, 0xf9, 0xf3, 0xe7, 0xcf, - 0x9f, 0x3e, 0x7c, 0xf9, 0xf3, 0xe7, 0xcf, 0x9f, - 0x3e, 0x7c, 0xf9, 0xf3, 0xe7, 0xcf, 0x9f, 0x3e, - 0x7c, 0xf9, 0xf3, 0xe7, 0xcf, 0x9f, 0x3e, 0x7c, - 0xf9, 0xf3, 0xe7, 0xcf, 0x9f, 0x3e, 0x7c, 0xf9, - 0xf3, 0xe7, 0xcf, 0x9f, 0x3e, 0x7c, 0xf9, 0xf3, - 0xe7, 0xcf, 0x9f, 0x3e, 0x7c, 0xf9, 0xf3, 0xe7, - 0xcf, 0x9f, 0x3e, 0x32, 0xd3, 0xff, 0xc0, 0x06, - 0xe9, 0x40, 0x00, 0x6e, 0x94, 0x00, 0x06, 0xe9, - 0x40, 0x00, 0x6e, 0x94, 0x00, 0x06, 0xe9, 0x40, - 0x00, 0x6e, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -static guint8 garbage_frame[] = { - 0xff, 0xff, 0xff, 0xff, 0xff -}; - - -GST_START_TEST (test_parse_normal) -{ - gst_parser_test_normal (ac3_frame, sizeof (ac3_frame)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_drain_single) -{ - gst_parser_test_drain_single (ac3_frame, sizeof (ac3_frame)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_drain_garbage) -{ - gst_parser_test_drain_garbage (ac3_frame, sizeof (ac3_frame), - garbage_frame, sizeof (garbage_frame)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_split) -{ - gst_parser_test_split (ac3_frame, sizeof (ac3_frame)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_skip_garbage) -{ - gst_parser_test_skip_garbage (ac3_frame, sizeof (ac3_frame), - garbage_frame, sizeof (garbage_frame)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_detect_stream) -{ - gst_parser_test_output_caps (ac3_frame, sizeof (ac3_frame), - NULL, SINK_CAPS_TMPL ",channels=1,rate=48000"); -} - -GST_END_TEST; - - -static Suite * -ac3parse_suite (void) -{ - Suite *s = suite_create ("ac3parse"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_parse_normal); - tcase_add_test (tc_chain, test_parse_drain_single); - tcase_add_test (tc_chain, test_parse_drain_garbage); - tcase_add_test (tc_chain, test_parse_split); - tcase_add_test (tc_chain, test_parse_skip_garbage); - tcase_add_test (tc_chain, test_parse_detect_stream); - - return s; -} - - -/* - * TODO: - * - Both push- and pull-modes need to be tested - * * Pull-mode & EOS - */ - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = ac3parse_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - /* init test context */ - ctx_factory = "ac3parse"; - ctx_sink_template = &sinktemplate; - ctx_src_template = &srctemplate; - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/tests/check/elements/amrparse.c b/tests/check/elements/amrparse.c deleted file mode 100644 index e5d64ca57c..0000000000 --- a/tests/check/elements/amrparse.c +++ /dev/null @@ -1,327 +0,0 @@ -/* - * GStreamer - * - * unit test for amrparse - * - * Copyright (C) 2008 Nokia Corporation. All rights reserved. - * - * Contact: Stefan Kost - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "parser.h" - -#define SRC_CAPS_NB "audio/x-amr-nb-sh" -#define SRC_CAPS_WB "audio/x-amr-wb-sh" -#define SRC_CAPS_ANY "ANY" - -#define SINK_CAPS_NB "audio/AMR, rate=8000 , channels=1" -#define SINK_CAPS_WB "audio/AMR-WB, rate=16000 , channels=1" -#define SINK_CAPS_ANY "ANY" - -#define AMR_FRAME_DURATION (GST_SECOND/50) - -static GstStaticPadTemplate sinktemplate_nb = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (SINK_CAPS_NB) - ); - -static GstStaticPadTemplate sinktemplate_wb = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (SINK_CAPS_WB) - ); - -static GstStaticPadTemplate srctemplate_nb = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (SRC_CAPS_NB) - ); - -static GstStaticPadTemplate srctemplate_wb = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (SRC_CAPS_WB) - ); - - -/* some data */ - -static guint8 frame_data_nb[] = { - 0x0c, 0x56, 0x3c, 0x52, 0xe0, 0x61, 0xbc, 0x45, - 0x0f, 0x98, 0x2e, 0x01, 0x42, 0x02 -}; - -static guint8 frame_data_wb[] = { - 0x08, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, - 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, - 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 -}; - -static guint8 frame_hdr_nb[] = { - '#', '!', 'A', 'M', 'R', '\n' -}; - -static guint8 frame_hdr_wb[] = { - '#', '!', 'A', 'M', 'R', '-', 'W', 'B', '\n' -}; - -static guint8 garbage_frame[] = { - 0xff, 0xff, 0xff, 0xff, 0xff -}; - - -GST_START_TEST (test_parse_nb_normal) -{ - gst_parser_test_normal (frame_data_nb, sizeof (frame_data_nb)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_nb_drain_single) -{ - gst_parser_test_drain_single (frame_data_nb, sizeof (frame_data_nb)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_nb_drain_garbage) -{ - gst_parser_test_drain_garbage (frame_data_nb, sizeof (frame_data_nb), - garbage_frame, sizeof (garbage_frame)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_nb_split) -{ - gst_parser_test_split (frame_data_nb, sizeof (frame_data_nb)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_nb_skip_garbage) -{ - gst_parser_test_skip_garbage (frame_data_nb, sizeof (frame_data_nb), - garbage_frame, sizeof (garbage_frame)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_nb_detect_stream) -{ - GstParserTest ptest; - GstCaps *old_ctx_caps; - - /* no input caps, override ctx */ - old_ctx_caps = ctx_input_caps; - ctx_input_caps = NULL; - - /* AMR-NB header */ - gst_parser_test_init (&ptest, frame_hdr_nb, sizeof (frame_hdr_nb), 1); - /* well, no garbage, followed by real data */ - ptest.series[2].data = frame_data_nb; - ptest.series[2].size = sizeof (frame_data_nb); - ptest.series[2].num = 10; - /* header gets dropped, so ... */ - /* buffer count will not match */ - ptest.framed = FALSE; - /* total size a bit less */ - ptest.dropped = sizeof (frame_hdr_nb); - - /* Check that the negotiated caps are as expected */ - ptest.sink_caps = gst_caps_from_string (SINK_CAPS_NB); - - gst_parser_test_run (&ptest, NULL); - - gst_caps_unref (ptest.sink_caps); - - ctx_input_caps = old_ctx_caps; -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_wb_normal) -{ - gst_parser_test_normal (frame_data_wb, sizeof (frame_data_wb)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_wb_drain_single) -{ - gst_parser_test_drain_single (frame_data_wb, sizeof (frame_data_wb)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_wb_drain_garbage) -{ - gst_parser_test_drain_garbage (frame_data_wb, sizeof (frame_data_wb), - garbage_frame, sizeof (garbage_frame)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_wb_split) -{ - gst_parser_test_split (frame_data_wb, sizeof (frame_data_wb)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_wb_skip_garbage) -{ - gst_parser_test_skip_garbage (frame_data_wb, sizeof (frame_data_wb), - garbage_frame, sizeof (garbage_frame)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_wb_detect_stream) -{ - GstParserTest ptest; - GstCaps *old_ctx_caps; - - /* no input caps, override ctx */ - old_ctx_caps = ctx_input_caps; - ctx_input_caps = NULL; - - /* AMR-WB header */ - gst_parser_test_init (&ptest, frame_hdr_wb, sizeof (frame_hdr_wb), 1); - /* well, no garbage, followed by real data */ - ptest.series[2].data = frame_data_wb; - ptest.series[2].size = sizeof (frame_data_wb); - ptest.series[2].num = 10; - /* header gets dropped, so ... */ - /* buffer count will not match */ - ptest.framed = FALSE; - /* total size a bit less */ - ptest.dropped = sizeof (frame_hdr_wb); - - /* Check that the negotiated caps are as expected */ - ptest.sink_caps = gst_caps_from_string (SINK_CAPS_WB); - - gst_parser_test_run (&ptest, NULL); - - gst_caps_unref (ptest.sink_caps); - - ctx_input_caps = old_ctx_caps; -} - -GST_END_TEST; - - - -/* - * Create test suite. - */ -static Suite * -amrnb_parse_suite (void) -{ - Suite *s = suite_create ("amrwb_parse"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - /* AMR-NB tests */ - tcase_add_test (tc_chain, test_parse_nb_normal); - tcase_add_test (tc_chain, test_parse_nb_drain_single); - tcase_add_test (tc_chain, test_parse_nb_drain_garbage); - tcase_add_test (tc_chain, test_parse_nb_split); - tcase_add_test (tc_chain, test_parse_nb_detect_stream); - tcase_add_test (tc_chain, test_parse_nb_skip_garbage); - - return s; -} - -static Suite * -amrwb_parse_suite (void) -{ - Suite *s = suite_create ("amrnb_parse"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - /* AMR-WB tests */ - tcase_add_test (tc_chain, test_parse_wb_normal); - tcase_add_test (tc_chain, test_parse_wb_drain_single); - tcase_add_test (tc_chain, test_parse_wb_drain_garbage); - tcase_add_test (tc_chain, test_parse_wb_split); - tcase_add_test (tc_chain, test_parse_wb_detect_stream); - tcase_add_test (tc_chain, test_parse_wb_skip_garbage); - - return s; -} - -/* - * TODO: - * - Both push- and pull-modes need to be tested - * * Pull-mode & EOS - */ - -int -main (int argc, char **argv) -{ - int nf; - GstCaps *caps; - - Suite *s = amrnb_parse_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - /* init test context */ - ctx_factory = "amrparse"; - ctx_sink_template = &sinktemplate_nb; - ctx_src_template = &srctemplate_nb; - caps = gst_caps_from_string (SRC_CAPS_NB); - g_assert (caps); - ctx_input_caps = caps; - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - gst_caps_unref (caps); - - s = amrwb_parse_suite (); - sr = srunner_create (s); - - ctx_sink_template = &sinktemplate_wb; - ctx_src_template = &srctemplate_wb; - caps = gst_caps_from_string (SRC_CAPS_WB); - g_assert (caps); - ctx_input_caps = caps; - - srunner_run_all (sr, CK_NORMAL); - nf += srunner_ntests_failed (sr); - srunner_free (sr); - gst_caps_unref (caps); - - return nf; -} diff --git a/tests/check/elements/assrender.c b/tests/check/elements/assrender.c index 39e0a737b5..588d953db3 100644 --- a/tests/check/elements/assrender.c +++ b/tests/check/elements/assrender.c @@ -185,6 +185,7 @@ GST_START_TEST (test_assrender_basic_##format) \ GstBus *bus; \ GMainLoop *loop; \ GstPad *pad, *blocked_pad; \ + guint bus_watch = 0; \ \ pipeline = gst_pipeline_new ("pipeline"); \ fail_unless (pipeline != NULL); \ @@ -243,7 +244,7 @@ GST_START_TEST (test_assrender_basic_##format) \ \ bus = gst_element_get_bus (pipeline); \ fail_unless (bus != NULL); \ - gst_bus_add_watch (bus, bus_handler, loop); \ + bus_watch = gst_bus_add_watch (bus, bus_handler, loop); \ gst_object_unref (bus); \ \ fail_unless_equals_int (gst_element_set_state (pipeline, GST_STATE_PLAYING), \ @@ -266,6 +267,7 @@ GST_START_TEST (test_assrender_basic_##format) \ \ g_object_unref (pipeline); \ g_main_loop_unref (loop); \ + g_source_remove (bus_watch); \ } \ \ GST_END_TEST; diff --git a/tests/check/elements/baseaudiovisualizer.c b/tests/check/elements/baseaudiovisualizer.c new file mode 100644 index 0000000000..8b97665a30 --- /dev/null +++ b/tests/check/elements/baseaudiovisualizer.c @@ -0,0 +1,183 @@ +/* GStreamer + * Copyright (C) <2011> Stefan Kost + * + * unit test for the baseaudiovisualizer class + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include + +#include +#include + +#include "gstbaseaudiovisualizer.h" + +/* dummy subclass for testing */ + +#define GST_TYPE_TEST_SCOPE (gst_test_scope_get_type()) +#define GST_TEST_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TEST_SCOPE,GstTestScope)) +#define GST_TEST_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TEST_SCOPE,GstTestScopeClass)) +typedef struct _GstTestScope GstTestScope; +typedef struct _GstTestScopeClass GstTestScopeClass; + +struct _GstTestScope +{ + GstBaseAudioVisualizer parent; +}; + +struct _GstTestScopeClass +{ + GstBaseAudioVisualizerClass parent_class; +}; + +static GstStaticPadTemplate gst_test_scope_src_template = +GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN) + ); + +static GstStaticPadTemplate gst_test_scope_sink_template = +GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS) + ); + +static GType gst_test_scope_get_type (void); + +GST_BOILERPLATE (GstTestScope, gst_test_scope, GstBaseAudioVisualizer, + GST_TYPE_BASE_AUDIO_VISUALIZER); + +static void +gst_test_scope_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_set_details_simple (element_class, "test scope", + "Visualization", + "Dummy test scope", "Stefan Kost "); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_test_scope_src_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_test_scope_sink_template)); +} + +static void +gst_test_scope_class_init (GstTestScopeClass * g_class) +{ + /* do nothing */ +} + +static void +gst_test_scope_init (GstTestScope * scope, GstTestScopeClass * g_class) +{ + /* do nothing */ +} + +/* tests */ + +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("video/x-raw-rgb, " + "bpp = (int) 32, " + "depth = (int) 24, " "endianness = (int) BIG_ENDIAN, " +#if G_BYTE_ORDER == G_BIG_ENDIAN + "red_mask = (int) 0xFF000000, " + "green_mask = (int) 0x00FF0000, " "blue_mask = (int) 0x0000FF00, " +#else + "red_mask = (int) 0x0000FF00, " + "green_mask = (int) 0x00FF0000, " "blue_mask = (int) 0xFF000000, " +#endif + "width = (int) 320, " + "height = (int) 240, " "framerate = (fraction) 30/1") + ); +static GstStaticPadTemplate srctemplate = 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) BYTE_ORDER, " + "width = (int) 16, " "depth = (int) 16, " "signed = (boolean) true") + ); + +GST_START_TEST (count_in_out) +{ + GstElement *elem; + GstPad *srcpad, *sinkpad; + GstBuffer *buffer; + + /* setup up */ + elem = gst_check_setup_element ("testscope"); + srcpad = gst_check_setup_src_pad (elem, &srctemplate, NULL); + sinkpad = gst_check_setup_sink_pad (elem, &sinktemplate, NULL); + gst_pad_set_active (srcpad, TRUE); + gst_pad_set_active (sinkpad, TRUE); + fail_unless (gst_element_set_state (elem, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + + /* push 1s audio to get 30 video-frames */ + buffer = gst_buffer_new_and_alloc (44100 * 2 * sizeof (gint16)); + gst_buffer_set_caps (buffer, GST_PAD_CAPS (srcpad)); + ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1); + + /* pushing gives away my reference ... */ + fail_unless (gst_pad_push (srcpad, buffer) == GST_FLOW_OK); + /* ... but it ends up being collected on the global buffer list */ + ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1); + fail_unless_equals_int (g_list_length (buffers), 30); + + /* clean up */ + g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); + g_list_free (buffers); + buffers = NULL; + + gst_pad_set_active (srcpad, FALSE); + gst_pad_set_active (sinkpad, FALSE); + gst_check_teardown_src_pad (elem); + gst_check_teardown_sink_pad (elem); + gst_check_teardown_element (elem); +} + +GST_END_TEST; + +static void +baseaudiovisualizer_init (void) +{ + gst_element_register (NULL, "testscope", GST_RANK_NONE, GST_TYPE_TEST_SCOPE); +} + +static Suite * +baseaudiovisualizer_suite (void) +{ + Suite *s = suite_create ("baseaudiovisualizer"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_checked_fixture (tc_chain, baseaudiovisualizer_init, NULL); + + tcase_add_test (tc_chain, count_in_out); + + return s; +} + + +GST_CHECK_MAIN (baseaudiovisualizer); diff --git a/tests/check/elements/camerabin.c b/tests/check/elements/camerabin.c index 0df4f9b5bf..53a82e9f5b 100644 --- a/tests/check/elements/camerabin.c +++ b/tests/check/elements/camerabin.c @@ -47,6 +47,7 @@ #define PHOTO_SETTING_DELAY_US 0 static GstElement *camera; +static guint bus_source; static GMainLoop *main_loop; static guint cycle_count = 0; static gboolean received_preview_msg = FALSE; @@ -156,7 +157,7 @@ static void setup_camerabin_elements (GstElement * camera) { GstElement *vfsink, *audiosrc, *videosrc, *audioenc, *videoenc, *imageenc, - *videomux, *viewfinder_filter, *imagepp, *videopp; + *videomux, *viewfinder_filter, *imagepp, *videopp, *formatter; GstCaps *audiocaps, *videocaps; /* Use fakesink for view finder */ @@ -180,6 +181,7 @@ setup_camerabin_elements (GstElement * camera) viewfinder_filter = gst_element_factory_make ("identity", NULL); imagepp = gst_element_factory_make ("identity", NULL); videopp = gst_element_factory_make ("identity", NULL); + formatter = gst_element_factory_make ("jifmux", NULL); if (set_and_check_camerabin_element (camera, "viewfinder-sink", vfsink) && set_and_check_camerabin_element (camera, "audio-source", audiosrc) @@ -193,7 +195,8 @@ setup_camerabin_elements (GstElement * camera) && set_and_check_camerabin_element (camera, "image-post-processing", imagepp) && set_and_check_camerabin_element (camera, "video-post-processing", - videopp)) { + videopp) + && set_and_check_camerabin_element (camera, "image-formatter", formatter)) { GST_INFO ("element properties set and checked"); } else { GST_WARNING ("error setting up test plugins"); @@ -290,7 +293,7 @@ setup (void) g_signal_connect (camera, "image-done", G_CALLBACK (capture_done), main_loop); bus = gst_pipeline_get_bus (GST_PIPELINE (camera)); - gst_bus_add_watch (bus, (GstBusFunc) capture_bus_cb, main_loop); + bus_source = gst_bus_add_watch (bus, (GstBusFunc) capture_bus_cb, main_loop); gst_bus_set_sync_handler (bus, bus_sync_callback, main_loop); gst_object_unref (bus); @@ -335,6 +338,8 @@ teardown (void) { gint i; + g_source_remove (bus_source); + if (camera) gst_check_teardown_element (camera); @@ -417,6 +422,7 @@ validate_taglist_foreach (const GstTagList * list, const gchar * tag, static void extract_jpeg_tags (const gchar * filename, gint num) { + guint source; GstBus *bus; GMainLoop *loop = g_main_loop_new (NULL, FALSE); const gchar *filepath = make_test_file_name (filename, num); @@ -429,12 +435,14 @@ extract_jpeg_tags (const gchar * filename, gint num) g_free (pipeline_str); bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); - gst_bus_add_watch (bus, (GstBusFunc) validity_bus_cb, loop); + source = gst_bus_add_watch (bus, (GstBusFunc) validity_bus_cb, loop); gst_element_set_state (pipeline, GST_STATE_PLAYING); g_main_loop_run (loop); gst_element_set_state (pipeline, GST_STATE_NULL); + g_main_loop_unref (loop); + g_source_remove (source); gst_object_unref (bus); gst_object_unref (pipeline); } @@ -444,6 +452,7 @@ extract_jpeg_tags (const gchar * filename, gint num) static gboolean check_file_validity (const gchar * filename, gint num, GstTagList * taglist) { + guint source; GstBus *bus; GMainLoop *loop = g_main_loop_new (NULL, FALSE); GstElement *playbin = gst_element_factory_make ("playbin2", NULL); @@ -458,7 +467,7 @@ check_file_validity (const gchar * filename, gint num, GstTagList * taglist) validation_taglist = NULL; bus = gst_pipeline_get_bus (GST_PIPELINE (playbin)); - gst_bus_add_watch (bus, (GstBusFunc) validity_bus_cb, loop); + source = gst_bus_add_watch (bus, (GstBusFunc) validity_bus_cb, loop); gst_element_set_state (playbin, GST_STATE_PLAYING); g_main_loop_run (loop); @@ -484,8 +493,10 @@ check_file_validity (const gchar * filename, gint num, GstTagList * taglist) gst_tag_list_free (validation_taglist); g_free (uri); + g_source_remove (source); gst_object_unref (bus); gst_object_unref (playbin); + g_main_loop_unref (loop); return TRUE; } diff --git a/tests/check/elements/camerabin2.c b/tests/check/elements/camerabin2.c index 53e6ccc17a..6f58a1e25a 100644 --- a/tests/check/elements/camerabin2.c +++ b/tests/check/elements/camerabin2.c @@ -120,14 +120,9 @@ gst_test_camera_src_base_init (gpointer g_class) static void gst_test_camera_src_class_init (GstTestCameraSrcClass * klass) { - GObjectClass *gobject_class; - GstElementClass *gstelement_class; GstBaseCameraSrcClass *gstbasecamera_class; - gobject_class = G_OBJECT_CLASS (klass); - gstelement_class = GST_ELEMENT_CLASS (klass); gstbasecamera_class = GST_BASE_CAMERA_SRC_CLASS (klass); - gstbasecamera_class->set_mode = gst_test_camera_src_set_mode; } @@ -167,6 +162,7 @@ gst_test_camera_src_init (GstTestCameraSrc * self, static GstElement *camera; +static guint bus_source; static GMainLoop *main_loop; guint32 test_id = 0; @@ -186,10 +182,12 @@ validate_taglist_foreach (const GstTagList * list, const gchar * tag, const GValue *val1 = gst_tag_list_get_value_index (list, tag, 0); const GValue *val2 = gst_tag_list_get_value_index (other, tag, 0); + GST_DEBUG ("checking tag '%s'", tag); + fail_if (val1 == NULL); fail_if (val2 == NULL); - fail_unless (gst_value_can_intersect (val1, val2)); + fail_unless (gst_value_compare (val1, val2) == GST_VALUE_EQUAL); } @@ -302,19 +300,21 @@ extract_jpeg_tags (const gchar * filename, gint num) gchar *pipeline_str = g_strdup_printf ("filesrc location=%s ! " "jpegparse ! fakesink", filepath); GstElement *pipeline; + guint source; pipeline = gst_parse_launch (pipeline_str, NULL); fail_unless (pipeline != NULL); g_free (pipeline_str); bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); - gst_bus_add_watch (bus, (GstBusFunc) validity_bus_cb, loop); + source = gst_bus_add_watch (bus, (GstBusFunc) validity_bus_cb, loop); gst_element_set_state (pipeline, GST_STATE_PLAYING); g_main_loop_run (loop); gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (bus); + g_source_remove (source); gst_object_unref (pipeline); } @@ -330,6 +330,7 @@ setup_wrappercamerabinsrc_videotestsrc (void) GST_INFO ("init"); test_id = g_random_int (); + bus_source = 0; main_loop = g_main_loop_new (NULL, TRUE); @@ -342,8 +343,8 @@ setup_wrappercamerabinsrc_videotestsrc (void) 320, "height", G_TYPE_INT, 240, NULL); g_object_set (G_OBJECT (testsrc), "is-live", TRUE, "peer-alloc", FALSE, NULL); - g_object_set (G_OBJECT (src), "video-src", testsrc, NULL); - g_object_set (G_OBJECT (camera), "camera-src", src, "preview-caps", + g_object_set (G_OBJECT (src), "video-source", testsrc, NULL); + g_object_set (G_OBJECT (camera), "camera-source", src, "preview-caps", preview_caps, NULL); gst_object_unref (src); gst_object_unref (testsrc); @@ -354,9 +355,11 @@ setup_wrappercamerabinsrc_videotestsrc (void) gst_object_unref (fakevideosink); bus = gst_pipeline_get_bus (GST_PIPELINE (camera)); - gst_bus_add_watch (bus, (GstBusFunc) capture_bus_cb, main_loop); + bus_source = gst_bus_add_watch (bus, (GstBusFunc) capture_bus_cb, main_loop); gst_object_unref (bus); + tags_found = NULL; + GST_INFO ("init finished"); } @@ -369,6 +372,9 @@ teardown (void) gst_check_teardown_element (camera); camera = NULL; + if (bus_source) + g_source_remove (bus_source); + if (main_loop) g_main_loop_unref (main_loop); main_loop = NULL; @@ -421,6 +427,7 @@ validity_bus_cb (GstBus * bus, GstMessage * message, gpointer data) } else { tags_found = taglist; } + GST_DEBUG ("tags: %" GST_PTR_FORMAT, tags_found); } break; default: @@ -439,15 +446,18 @@ taglist_is_subset (GstTagList * tags_a, GstTagList * tags_b) /* Validate captured files by playing them with playbin * and checking that no errors occur. */ +#define WITH_AUDIO TRUE +#define NO_AUDIO FALSE static gboolean check_file_validity (const gchar * filename, gint num, GstTagList * taglist, - gint width, gint height) + gint width, gint height, gboolean has_audio) { GstBus *bus; GstPad *pad; GstCaps *caps; gint caps_width, caps_height; GstState state; + guint source; GMainLoop *loop = g_main_loop_new (NULL, FALSE); GstElement *playbin = gst_element_factory_make ("playbin2", NULL); @@ -461,13 +471,12 @@ check_file_validity (const gchar * filename, gint num, GstTagList * taglist, "audio-sink", fakeaudio, NULL); bus = gst_pipeline_get_bus (GST_PIPELINE (playbin)); - gst_bus_add_watch (bus, (GstBusFunc) validity_bus_cb, loop); + source = gst_bus_add_watch (bus, (GstBusFunc) validity_bus_cb, loop); gst_element_set_state (playbin, GST_STATE_PAUSED); + gst_element_get_state (playbin, &state, NULL, GST_SECOND * 3); if (width != 0 && height != 0) { - gst_element_get_state (playbin, &state, NULL, GST_SECOND * 3); - g_signal_emit_by_name (playbin, "get-video-pad", 0, &pad, NULL); g_assert (pad != NULL); caps = gst_pad_get_negotiated_caps (pad); @@ -483,6 +492,11 @@ check_file_validity (const gchar * filename, gint num, GstTagList * taglist, gst_caps_unref (caps); gst_object_unref (pad); } + if (has_audio) { + g_signal_emit_by_name (playbin, "get-audio-pad", 0, &pad, NULL); + g_assert (pad != NULL); + gst_object_unref (pad); + } gst_element_set_state (playbin, GST_STATE_PLAYING); g_main_loop_run (loop); @@ -500,6 +514,7 @@ check_file_validity (const gchar * filename, gint num, GstTagList * taglist, } g_free (uri); + g_source_remove (source); gst_object_unref (bus); gst_object_unref (playbin); @@ -518,6 +533,7 @@ filter_buffer_count (GstPad * pad, GstMiniObject * obj, gpointer data) GST_START_TEST (test_single_image_capture) { + gboolean idle; if (!camera) return; @@ -534,6 +550,8 @@ GST_START_TEST (test_single_image_capture) } GST_INFO ("starting capture"); fail_unless (camera != NULL); + g_object_get (camera, "idle", &idle, NULL); + fail_unless (idle); g_signal_emit_by_name (camera, "start-capture", NULL); g_timeout_add_seconds (3, (GSourceFunc) g_main_loop_quit, main_loop); @@ -542,8 +560,10 @@ GST_START_TEST (test_single_image_capture) /* check that we got a preview image */ check_preview_image (); + g_object_get (camera, "idle", &idle, NULL); + fail_unless (idle); gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL); - check_file_validity (IMAGE_FILENAME, 0, NULL, 0, 0); + check_file_validity (IMAGE_FILENAME, 0, NULL, 0, 0, NO_AUDIO); } GST_END_TEST; @@ -551,6 +571,7 @@ GST_END_TEST; GST_START_TEST (test_multiple_image_captures) { + gboolean idle; gint i; gint widths[] = { 800, 640, 1280 }; gint heights[] = { 600, 480, 1024 }; @@ -570,6 +591,8 @@ GST_START_TEST (test_multiple_image_captures) camera = NULL; } fail_unless (camera != NULL); + g_object_get (camera, "idle", &idle, NULL); + fail_unless (idle); GST_INFO ("starting capture"); for (i = 0; i < 3; i++) { @@ -590,9 +613,12 @@ GST_START_TEST (test_multiple_image_captures) } g_usleep (G_USEC_PER_SEC * 3); + g_object_get (camera, "idle", &idle, NULL); + fail_unless (idle); gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL); for (i = 0; i < 3; i++) { - check_file_validity (IMAGE_FILENAME, i, NULL, widths[i], heights[i]); + check_file_validity (IMAGE_FILENAME, i, NULL, widths[i], heights[i], + NO_AUDIO); } } @@ -600,6 +626,7 @@ GST_END_TEST; GST_START_TEST (test_single_video_recording) { + gboolean idle; if (!camera) return; @@ -617,8 +644,13 @@ GST_START_TEST (test_single_video_recording) GST_INFO ("starting capture"); fail_unless (camera != NULL); + g_object_get (camera, "idle", &idle, NULL); + fail_unless (idle); g_signal_emit_by_name (camera, "start-capture", NULL); + g_object_get (camera, "idle", &idle, NULL); + fail_unless (!idle); + /* Record for one seconds */ g_timeout_add_seconds (VIDEO_DURATION, (GSourceFunc) g_main_loop_quit, main_loop); @@ -628,15 +660,20 @@ GST_START_TEST (test_single_video_recording) check_preview_image (); + g_usleep (G_USEC_PER_SEC * 3); + + g_object_get (camera, "idle", &idle, NULL); + fail_unless (idle); gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL); - check_file_validity (VIDEO_FILENAME, 0, NULL, 0, 0); + check_file_validity (VIDEO_FILENAME, 0, NULL, 0, 0, WITH_AUDIO); } GST_END_TEST; GST_START_TEST (test_multiple_video_recordings) { + gboolean idle; gint i; gint widths[] = { 800, 640, 1280 }; gint heights[] = { 600, 480, 1024 }; @@ -658,6 +695,8 @@ GST_START_TEST (test_multiple_video_recordings) GST_INFO ("starting capture"); fail_unless (camera != NULL); + g_object_get (camera, "idle", &idle, NULL); + fail_unless (idle); for (i = 0; i < 3; i++) { GstCaps *caps; @@ -671,6 +710,10 @@ GST_START_TEST (test_multiple_video_recordings) gst_caps_unref (caps); g_signal_emit_by_name (camera, "start-capture", NULL); + + g_object_get (camera, "idle", &idle, NULL); + fail_unless (!idle); + g_timeout_add_seconds (VIDEO_DURATION, (GSourceFunc) g_main_loop_quit, main_loop); g_main_loop_run (main_loop); @@ -678,13 +721,16 @@ GST_START_TEST (test_multiple_video_recordings) check_preview_image (); - g_timeout_add_seconds (1, (GSourceFunc) g_main_loop_quit, main_loop); + g_timeout_add_seconds (3, (GSourceFunc) g_main_loop_quit, main_loop); g_main_loop_run (main_loop); + g_object_get (camera, "idle", &idle, NULL); + fail_unless (idle); } gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL); for (i = 0; i < 3; i++) { - check_file_validity (VIDEO_FILENAME, i, NULL, widths[i], heights[i]); + check_file_validity (VIDEO_FILENAME, i, NULL, widths[i], heights[i], + WITH_AUDIO); } } @@ -692,6 +738,7 @@ GST_END_TEST; GST_START_TEST (test_image_video_cycle) { + gboolean idle; gint i; if (!camera) @@ -715,6 +762,9 @@ GST_START_TEST (test_image_video_cycle) GST_INFO ("starting capture"); for (i = 0; i < 2; i++) { + g_object_get (camera, "idle", &idle, NULL); + fail_unless (idle); + /* take a picture */ g_object_set (camera, "mode", 1, NULL); g_signal_emit_by_name (camera, "start-capture", NULL); @@ -740,8 +790,8 @@ GST_START_TEST (test_image_video_cycle) /* validate all the files */ for (i = 0; i < 2; i++) { - check_file_validity (IMAGE_FILENAME, i, NULL, 0, 0); - check_file_validity (VIDEO_FILENAME, i, NULL, 0, 0); + check_file_validity (IMAGE_FILENAME, i, NULL, 0, 0, NO_AUDIO); + check_file_validity (VIDEO_FILENAME, i, NULL, 0, 0, WITH_AUDIO); } } @@ -863,7 +913,7 @@ GST_START_TEST (test_image_capture_with_tags) gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL); for (i = 0; i < 3; i++) { - check_file_validity (IMAGE_FILENAME, i, taglists[i], 0, 0); + check_file_validity (IMAGE_FILENAME, i, taglists[i], 0, 0, NO_AUDIO); gst_tag_list_free (taglists[i]); } } @@ -935,8 +985,8 @@ GST_START_TEST (test_video_capture_with_tags) gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL); - for (i = 0; i < 2; i++) { - check_file_validity (VIDEO_FILENAME, i, taglists[i], 0, 0); + for (i = 0; i < 3; i++) { + check_file_validity (VIDEO_FILENAME, i, taglists[i], 0, 0, NO_AUDIO); gst_tag_list_free (taglists[i]); } } @@ -954,7 +1004,7 @@ GST_START_TEST (test_supported_caps) return; src = g_object_new (GST_TYPE_TEST_CAMERA_SRC, NULL); - g_object_set (camera, "camera-src", src, NULL); + g_object_set (camera, "camera-source", src, NULL); gst_object_unref (src); if (gst_element_set_state (GST_ELEMENT (camera), GST_STATE_PLAYING) == @@ -990,6 +1040,58 @@ GST_START_TEST (test_supported_caps) GST_END_TEST; +GST_START_TEST (test_idle_property) +{ + gboolean idle; + if (!camera) + return; + + /* Set video recording mode */ + g_object_set (camera, "mode", 2, + "location", make_test_file_name (VIDEO_FILENAME, -1), NULL); + + if (gst_element_set_state (GST_ELEMENT (camera), GST_STATE_PLAYING) == + GST_STATE_CHANGE_FAILURE) { + GST_WARNING ("setting camerabin to PLAYING failed"); + gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL); + gst_object_unref (camera); + camera = NULL; + } + + GST_INFO ("starting capture"); + fail_unless (camera != NULL); + g_object_get (camera, "idle", &idle, NULL); + fail_unless (idle); + g_signal_emit_by_name (camera, "start-capture", NULL); + g_object_get (camera, "idle", &idle, NULL); + fail_unless (!idle); + + /* emit a second start-capture that should be ignored */ + g_signal_emit_by_name (camera, "start-capture", NULL); + g_object_get (camera, "idle", &idle, NULL); + fail_unless (!idle); + + /* Record for one seconds */ + g_timeout_add_seconds (VIDEO_DURATION, (GSourceFunc) g_main_loop_quit, + main_loop); + g_main_loop_run (main_loop); + + g_signal_emit_by_name (camera, "stop-capture", NULL); + + check_preview_image (); + + g_usleep (3 * G_USEC_PER_SEC); + g_object_get (camera, "idle", &idle, NULL); + fail_unless (idle); + + gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL); + + check_file_validity (VIDEO_FILENAME, 0, NULL, 0, 0, WITH_AUDIO); +} + +GST_END_TEST; + + GST_START_TEST (test_image_custom_filter) { GstElement *vf_filter; @@ -1050,7 +1152,7 @@ GST_START_TEST (test_image_custom_filter) check_preview_image (); gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL); - check_file_validity (IMAGE_FILENAME, 0, NULL, 0, 0); + check_file_validity (IMAGE_FILENAME, 0, NULL, 0, 0, NO_AUDIO); fail_unless (vf_probe_counter > 0); fail_unless (image_probe_counter == 1); @@ -1122,7 +1224,7 @@ GST_START_TEST (test_video_custom_filter) check_preview_image (); gst_element_set_state (GST_ELEMENT (camera), GST_STATE_NULL); - check_file_validity (VIDEO_FILENAME, 0, NULL, 0, 0); + check_file_validity (VIDEO_FILENAME, 0, NULL, 0, 0, WITH_AUDIO); fail_unless (vf_probe_counter > 0); fail_unless (video_probe_counter > 0); @@ -1185,6 +1287,8 @@ camerabin_suite (void) tcase_add_test (tc_basic, test_video_capture_with_tags); + tcase_add_test (tc_basic, test_idle_property); + tcase_add_test (tc_basic, test_image_custom_filter); tcase_add_test (tc_basic, test_video_custom_filter); } diff --git a/tests/check/elements/faac.c b/tests/check/elements/faac.c index 34630a5d3f..cf15bd7208 100644 --- a/tests/check/elements/faac.c +++ b/tests/check/elements/faac.c @@ -37,15 +37,29 @@ static GstPad *mysrcpad, *mysinkpad; "signed = (boolean) true, " \ "endianness = (int) BYTE_ORDER " -#define AAC_CAPS_STRING "audio/mpeg, " \ +#define AAC_RAW_CAPS_STRING "audio/mpeg, " \ "mpegversion = (int) 4, " \ "rate = (int) 48000, " \ - "channels = (int) 2 " + "channels = (int) 2, " \ + "stream-format = \"raw\"," \ + "base-profile = \"lc\"" -static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", +#define AAC_ADTS_CAPS_STRING "audio/mpeg, " \ + "mpegversion = (int) 4, " \ + "rate = (int) 48000, " \ + "channels = (int) 2, " \ + "stream-format = \"adts\"," \ + "base-profile = \"lc\"" + +static GstStaticPadTemplate sinktemplate_adts = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS (AAC_CAPS_STRING)); + GST_STATIC_CAPS (AAC_ADTS_CAPS_STRING)); + +static GstStaticPadTemplate sinktemplate_raw = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (AAC_RAW_CAPS_STRING)); static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, @@ -60,10 +74,13 @@ setup_faac (gboolean adts) GST_DEBUG ("setup_faac"); faac = gst_check_setup_element ("faac"); - g_object_set (faac, "profile", 2, NULL); - g_object_set (faac, "outputformat", adts ? 1 : 0, NULL); mysrcpad = gst_check_setup_src_pad (faac, &srctemplate, NULL); - mysinkpad = gst_check_setup_sink_pad (faac, &sinktemplate, NULL); + + if (adts) + mysinkpad = gst_check_setup_sink_pad (faac, &sinktemplate_adts, NULL); + else + mysinkpad = gst_check_setup_sink_pad (faac, &sinktemplate_raw, NULL); + gst_pad_set_active (mysrcpad, TRUE); gst_pad_set_active (mysinkpad, TRUE); diff --git a/tests/check/elements/flacparse.c b/tests/check/elements/flacparse.c deleted file mode 100644 index 0c25bc6f58..0000000000 --- a/tests/check/elements/flacparse.c +++ /dev/null @@ -1,299 +0,0 @@ -/* - * GStreamer - * - * unit test for flacparse - * - * Copyright (C) 2010 Nokia Corporation. All rights reserved. - * - * Contact: Stefan Kost - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "parser.h" - -#define SRC_CAPS_TMPL "audio/x-flac, framed=(boolean)false" -#define SINK_CAPS_TMPL "audio/x-flac, framed=(boolean)true" - -GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (SINK_CAPS_TMPL) - ); - -GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (SRC_CAPS_TMPL) - ); - -/* some data */ -static guint8 streaminfo_header[] = { - 0x7f, 0x46, 0x4c, 0x41, 0x43, 0x01, 0x00, 0x00, - 0x02, 0x66, 0x4c, 0x61, 0x43, 0x00, 0x00, 0x00, - 0x22, 0x12, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0a, 0xc4, 0x40, 0xf0, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00 -}; - -static guint8 comment_header[] = { - 0x84, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 -}; - -static guint8 flac_frame[] = { - 0xff, 0xf8, 0xa9, 0x08, 0x00, 0x50, 0x18, 0x06, - 0x6a, 0x0c, 0xce, 0x13, 0x24, 0x19, 0x68, 0x00, - 0x46, 0x23, 0x08, 0xca, 0xcb, 0x58, 0x9c, 0x26, - 0x92, 0x30, 0xa6, 0x29, 0x8a, 0xca, 0xd1, 0x18, - 0xae, 0x26, 0x5c, 0x90, 0x60, 0xbf, 0x11, 0xad, - 0x43, 0x02, 0x06, 0x26, 0xbd, 0x35, 0xdd, 0xa3, - 0x11, 0xa6, 0x4d, 0x18, 0x8c, 0x9a, 0xe4, 0x62, - 0xd9, 0x23, 0x11, 0x8b, 0xcb, 0x56, 0x55, 0x45, - 0xc2, 0x18, 0x56, 0xa2, 0xe2, 0xe1, 0x18, 0x99, - 0x54, 0x98, 0x46, 0x4d, 0x08, 0x70, 0x9a, 0x64, - 0xc4, 0x18, 0x4f, 0x27, 0x64, 0x31, 0x66, 0x27, - 0x79, 0x19, 0x3c, 0x8c, 0x8c, 0xa3, 0x44, 0x18, - 0x23, 0xd2, 0x6b, 0x8b, 0x64, 0x8c, 0x21, 0x84, - 0xd6, 0x23, 0x13, 0x13, 0x2d, 0x44, 0xca, 0x5a, - 0x23, 0x09, 0x93, 0x25, 0x18, 0x10, 0x61, 0x38, - 0xb4, 0x60, 0x8f, 0x2c, 0x8d, 0x26, 0xb4, 0xc9, - 0xd9, 0x19, 0x19, 0x34, 0xd7, 0x31, 0x06, 0x10, - 0xc4, 0x30, 0x83, 0x17, 0xe2, 0x0c, 0x2c, 0xc4, - 0xc8, 0xc9, 0x3c, 0x5e, 0x93, 0x11, 0x8a, 0x62, - 0x64, 0x8c, 0x26, 0x23, 0x22, 0x30, 0x9a, 0x58, - 0x86, 0x04, 0x18, 0x4c, 0xab, 0x2b, 0x26, 0x5c, - 0x46, 0x88, 0xcb, 0xb1, 0x0d, 0x26, 0xbb, 0x5e, - 0x8c, 0xa7, 0x64, 0x31, 0x3d, 0x31, 0x06, 0x26, - 0x43, 0x17, 0xa3, 0x08, 0x61, 0x06, 0x17, 0xc4, - 0x62, 0xec, 0x4d, 0x4b, 0x2e, 0x2d, 0x4a, 0x94, - 0xa4, 0xc2, 0x31, 0x4c, 0x4c, 0x20, 0xc0, 0x83, - 0x14, 0x8c, 0x27, 0x8b, 0x31, 0x23, 0x2f, 0x23, - 0x11, 0x91, 0x94, 0x65, 0x1a, 0x20, 0xc2, 0x18, - 0x86, 0x51, 0x88, 0x62, 0x7c, 0x43, 0x2e, 0xa3, - 0x04, 0x18, 0x8c, 0x20, 0xc2, 0xf5, 0xaa, 0x94, - 0xc2, 0x31, 0x32, 0xd2, 0xb2, 0xa2, 0x30, 0xba, - 0x10, 0xc2, 0xb5, 0x89, 0xa5, 0x18, 0x10, 0x62, - 0x9a, 0x10, 0x61, 0x19, 0x72, 0x71, 0x1a, 0xb9, - 0x0c, 0x23, 0x46, 0x10, 0x62, 0x78, 0x81, 0x82, - 0x3d, 0x75, 0xea, 0x6b, 0x51, 0x8b, 0x61, 0x06, - 0x08, 0x62, 0x32, 0x5e, 0x84, 0x18, 0x27, 0x25, - 0xc2, 0x6a, 0x4b, 0x51, 0x31, 0x34, 0x5e, 0x29, - 0xa1, 0x3c, 0x4d, 0x26, 0x23, 0x10, 0xc2, 0x6b, - 0xb1, 0x0d, 0x11, 0xae, 0x46, 0x88, 0x31, 0x35, - 0xb1, 0x06, 0x08, 0x79, 0x7e, 0x4f, 0x53, 0x23, - 0x29, 0xa4, 0x30, 0x20, 0x30, 0x23, 0x5a, 0xb2, - 0xc8, 0x60, 0x9c, 0x93, 0x13, 0x17, 0x92, 0x98, - 0x46, 0x13, 0x54, 0x53, 0x08, 0xcb, 0x13, 0xa1, - 0x1a, 0x89, 0xe5, 0x46, 0x08, 0x18, 0x10, 0x30, - 0x9d, 0x68, 0xc2, 0x1c, 0x46, 0x46, 0xae, 0x62, - 0x1a, 0x46, 0x4e, 0x4d, 0x34, 0x8c, 0xbd, 0x26, - 0xc0, 0x40, 0x62, 0xc9, 0xa9, 0x31, 0x74, 0xa8, - 0x99, 0x52, 0xb0, 0x8c, 0xa9, 0x29, 0x84, 0x61, - 0x19, 0x54, 0x43, 0x02, 0x06, 0x04, 0x32, 0xe5, - 0x18, 0x21, 0x91, 0x8b, 0xf2, 0xcc, 0x10, 0x30, - 0x8e, 0x23, 0xc4, 0x76, 0x43, 0x08, 0x30, 0x83, - 0x08, 0x62, 0x6c, 0x4e, 0xe2, 0x35, 0x96, 0xd0, - 0x8e, 0x89, 0x97, 0x42, 0x18, 0x91, 0x84, 0x61, - 0x3c, 0x26, 0xa5, 0x2c, 0x4e, 0x17, 0x94, 0xb8, - 0xb5, 0xa4, 0xcb, 0x88, 0xc9, 0x84, 0x18, 0xb9, - 0x84, 0x19, 0x23, 0x2d, 0xa4, 0x64, 0x62, 0x18, - 0x86, 0x53, 0x93, 0xcb, 0x30, 0x8f, 0x2f, 0x93, - 0x55, 0xc4, 0xd7, 0x08, 0x62, 0xb8, 0x46, 0x84, - 0x68, 0xa3, 0x02, 0xaf, 0x33 -}; - -static guint8 garbage_frame[] = { - 0xff, 0xff, 0xff, 0xff, 0xff -}; - - -GST_START_TEST (test_parse_flac_normal) -{ - gst_parser_test_normal (flac_frame, sizeof (flac_frame)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_flac_drain_single) -{ - gst_parser_test_drain_single (flac_frame, sizeof (flac_frame)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_flac_drain_garbage) -{ - /* We always output the after frame garbage too because we - * have no way of detecting it - */ -#if 0 - gst_parser_test_drain_garbage (flac_frame, sizeof (flac_frame), - garbage_frame, sizeof (garbage_frame)); -#endif - guint8 frame[sizeof (flac_frame) + sizeof (garbage_frame)]; - - memcpy (frame, flac_frame, sizeof (flac_frame)); - memcpy (frame + sizeof (flac_frame), garbage_frame, sizeof (garbage_frame)); - - gst_parser_test_drain_single (frame, sizeof (frame)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_flac_split) -{ - gst_parser_test_split (flac_frame, sizeof (flac_frame)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_flac_skip_garbage) -{ - /* We always include the garbage into the frame because - * we have no easy way for finding the real end of the - * frame. The decoder will later skip the garbage - */ -#if 0 - gst_parser_test_skip_garbage (flac_frame, sizeof (flac_frame), - garbage_frame, sizeof (garbage_frame)); -#endif - guint8 frame[sizeof (flac_frame) + sizeof (garbage_frame)]; - - memcpy (frame, flac_frame, sizeof (flac_frame)); - memcpy (frame + sizeof (flac_frame), garbage_frame, sizeof (garbage_frame)); - - gst_parser_test_normal (frame, sizeof (frame)); -} - -GST_END_TEST; - - -#define structure_get_int(s,f) \ - (g_value_get_int(gst_structure_get_value(s,f))) -#define fail_unless_structure_field_int_equals(s,field,num) \ - fail_unless_equals_int (structure_get_int(s,field), num) -/* - * Test if the parser handles raw stream and codec_data info properly. - */ -GST_START_TEST (test_parse_flac_detect_stream) -{ - GstCaps *caps; - GstStructure *s; - const GValue *streamheader; - GArray *bufarr; - gint i; - - /* Push random data. It should get through since the parser should be - * initialized because it got codec_data in the caps */ - caps = gst_parser_test_get_output_caps (flac_frame, sizeof (flac_frame), - SRC_CAPS_TMPL); - fail_unless (caps != NULL); - - /* Check that the negotiated caps are as expected */ - /* When codec_data is present, parser assumes that data is version 4 */ - GST_LOG ("flac output caps: %" GST_PTR_FORMAT, caps); - s = gst_caps_get_structure (caps, 0); - fail_unless (gst_structure_has_name (s, "audio/x-flac")); - fail_unless_structure_field_int_equals (s, "channels", 1); - fail_unless_structure_field_int_equals (s, "rate", 44100); - fail_unless (gst_structure_has_field (s, "streamheader")); - streamheader = gst_structure_get_value (s, "streamheader"); - fail_unless (G_VALUE_TYPE (streamheader) == GST_TYPE_ARRAY); - bufarr = g_value_peek_pointer (streamheader); - fail_unless (bufarr->len == 2); - for (i = 0; i < bufarr->len; i++) { - GstBuffer *buf; - GValue *bufval = &g_array_index (bufarr, GValue, i); - - fail_unless (G_VALUE_TYPE (bufval) == GST_TYPE_BUFFER); - buf = g_value_peek_pointer (bufval); - if (i == 0) { - fail_unless (GST_BUFFER_SIZE (buf) == sizeof (streaminfo_header)); - fail_unless (memcmp (buf, streaminfo_header, sizeof (streaminfo_header))); - } else if (i == 1) { - fail_unless (GST_BUFFER_SIZE (buf) == sizeof (comment_header)); - fail_unless (memcmp (buf, comment_header, sizeof (comment_header))); - } - } - - gst_caps_unref (caps); -} - -GST_END_TEST; - - -static Suite * -flacparse_suite (void) -{ - Suite *s = suite_create ("flacparse"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_parse_flac_normal); - tcase_add_test (tc_chain, test_parse_flac_drain_single); - tcase_add_test (tc_chain, test_parse_flac_drain_garbage); - tcase_add_test (tc_chain, test_parse_flac_split); - tcase_add_test (tc_chain, test_parse_flac_skip_garbage); - - /* Other tests */ - tcase_add_test (tc_chain, test_parse_flac_detect_stream); - - return s; -} - - -/* - * TODO: - * - Both push- and pull-modes need to be tested - * * Pull-mode & EOS - */ - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = flacparse_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - /* init test context */ - ctx_factory = "flacparse"; - ctx_sink_template = &sinktemplate; - ctx_src_template = &srctemplate; - ctx_discard = 3; - ctx_headers[0].data = streaminfo_header; - ctx_headers[0].size = sizeof (streaminfo_header); - ctx_headers[1].data = comment_header; - ctx_headers[1].size = sizeof (comment_header); - /* custom offsets, and ts always repeatedly 0 */ - ctx_no_metadata = TRUE; - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/tests/check/elements/mpegaudioparse.c b/tests/check/elements/h263parse.c similarity index 52% rename from tests/check/elements/mpegaudioparse.c rename to tests/check/elements/h263parse.c index 69a08640fc..4c23c619d0 100644 --- a/tests/check/elements/mpegaudioparse.c +++ b/tests/check/elements/h263parse.c @@ -1,9 +1,9 @@ /* * GStreamer * - * unit test for aacparse + * unit test for h263parse * - * Copyright (C) 2008 Nokia Corporation. All rights reserved. + * Copyright (C) 2011 Nokia Corporation. All rights reserved. * * Contact: Stefan Kost * @@ -26,8 +26,8 @@ #include #include "parser.h" -#define SRC_CAPS_TMPL "audio/mpeg, parsed=(boolean)false, mpegversion=(int)1" -#define SINK_CAPS_TMPL "audio/mpeg, parsed=(boolean)true, mpegversion=(int)1" +#define SRC_CAPS_TMPL "video/x-h263, framed=(boolean)false" +#define SINK_CAPS_TMPL "video/x-h263, framed=(boolean)true" GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, @@ -41,23 +41,44 @@ GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_CAPS (SRC_CAPS_TMPL) ); -const gchar *factory = "aacparse"; - /* some data */ -static guint8 mp3_frame[384] = { - 0xff, 0xfb, 0x94, 0xc4, 0xff, 0x83, 0xc0, 0x00, - 0x01, 0xa4, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, - 0x34, 0x80, 0x00, 0x00, 0x04, 0x00, -}; -static guint8 garbage_frame[] = { - 0xff, 0xff, 0xff, 0xff, 0xff +#if 0 +static guint8 h263_iframe[] = { + /* keyframes all around */ + 0x00, 0x00, 0x80, 0x02, 0x1c, 0x88, 0x01, 0x00, + 0x11, 0xe0, 0x44, 0xc4, 0x04, 0x04, 0x04, 0x3f, + 0xff, 0xe6, 0x20, 0x20, 0x20, 0x21, 0xff, 0xff, + 0x31, 0x01, 0x01, 0x01, 0x0f, 0xff, 0xf9, 0x88, + 0x08, 0x08, 0x08, 0x7f, 0xff, 0x80 }; +#endif +static guint8 h263_iframe[] = { + /* keyframes all around */ + /* actually, this is a truncated keyframe, + * but don't tell anyone or try this at home */ + 0x00, 0x00, 0x80, 0x02, 0x0c, 0x04, 0x26, 0x20, + 0x20, 0x20, 0x21, 0xff, 0xff, 0x31, 0x01, 0x01, + 0x01, 0x0f, 0xff, 0xf9, 0x88, 0x08, 0x08, 0x08, + 0x7f, 0xff, 0xcc, 0x40, 0x40, 0x40, 0x43, 0xff, + 0xfe, 0x62, 0x02, 0x02, 0x02, 0x1f, 0xff, 0xf3, + 0x10, 0x10, 0x10, 0x10, 0xff, 0xff, 0x98, 0x80, + 0x80, 0x80, 0x87, 0xff, 0xfc, 0xc4, 0x04, 0x04, + 0x04, 0x3f, 0xff, 0xe6, 0x20, 0x20, 0x20, 0x21, + 0xff, 0xff, 0x31, 0x01, 0x01, 0x01, 0x0f, 0xff, + 0xf9, 0x88, 0x08, 0x08, 0x08, 0x7f, 0xff, 0xcc, + 0x40, 0x40, 0x40, 0x43, 0xff, 0xfe, 0x62, 0x02, + 0x02, 0x02, 0x1f, 0xff, 0xf3, 0x10, 0x10, 0x10, + 0x10, 0xff, 0xff, 0x98, 0x80, 0x80, 0x80, 0x87, + 0xff, 0xfc, 0xc4, 0x04, 0x04, 0x04, 0x3f, 0xff, + 0xe6, 0x20, 0x20, 0x20, 0x21, 0xff, 0xff, 0x31, + 0x01, 0x01, 0x01, 0x0f, 0xff, 0xf9, 0x88, 0x08 +}; GST_START_TEST (test_parse_normal) { - gst_parser_test_normal (mp3_frame, sizeof (mp3_frame)); + gst_parser_test_normal (h263_iframe, sizeof (h263_iframe)); } GST_END_TEST; @@ -65,16 +86,7 @@ GST_END_TEST; GST_START_TEST (test_parse_drain_single) { - gst_parser_test_drain_single (mp3_frame, sizeof (mp3_frame)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_drain_garbage) -{ - gst_parser_test_drain_garbage (mp3_frame, sizeof (mp3_frame), - garbage_frame, sizeof (garbage_frame)); + gst_parser_test_drain_single (h263_iframe, sizeof (h263_iframe)); } GST_END_TEST; @@ -82,16 +94,7 @@ GST_END_TEST; GST_START_TEST (test_parse_split) { - gst_parser_test_split (mp3_frame, sizeof (mp3_frame)); -} - -GST_END_TEST; - - -GST_START_TEST (test_parse_skip_garbage) -{ - gst_parser_test_skip_garbage (mp3_frame, sizeof (mp3_frame), - garbage_frame, sizeof (garbage_frame)); + gst_parser_test_split (h263_iframe, sizeof (h263_iframe)); } GST_END_TEST; @@ -104,20 +107,20 @@ GST_END_TEST; GST_START_TEST (test_parse_detect_stream) { - GstStructure *s; GstCaps *caps; + GstStructure *s; - caps = gst_parser_test_get_output_caps (mp3_frame, sizeof (mp3_frame), NULL); - + caps = gst_parser_test_get_output_caps (h263_iframe, sizeof (h263_iframe), + NULL); fail_unless (caps != NULL); - GST_LOG ("mpegaudio output caps: %" GST_PTR_FORMAT, caps); + /* Check that the negotiated caps are as expected */ + /* When codec_data is present, parser assumes that data is version 4 */ + GST_LOG ("mpegvideo output caps: %" GST_PTR_FORMAT, caps); s = gst_caps_get_structure (caps, 0); - fail_unless (gst_structure_has_name (s, "audio/mpeg")); - fail_unless_structure_field_int_equals (s, "mpegversion", 1); - fail_unless_structure_field_int_equals (s, "layer", 3); - fail_unless_structure_field_int_equals (s, "channels", 1); - fail_unless_structure_field_int_equals (s, "rate", 48000); + fail_unless (gst_structure_has_name (s, "video/x-h263")); + fail_unless_structure_field_int_equals (s, "width", 352); + fail_unless_structure_field_int_equals (s, "height", 288); gst_caps_unref (caps); } @@ -126,17 +129,15 @@ GST_END_TEST; static Suite * -mpegaudioparse_suite (void) +h263parse_suite (void) { - Suite *s = suite_create ("mpegaudioparse"); + Suite *s = suite_create ("h263parse"); TCase *tc_chain = tcase_create ("general"); suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_parse_normal); tcase_add_test (tc_chain, test_parse_drain_single); - tcase_add_test (tc_chain, test_parse_drain_garbage); tcase_add_test (tc_chain, test_parse_split); - tcase_add_test (tc_chain, test_parse_skip_garbage); tcase_add_test (tc_chain, test_parse_detect_stream); return s; @@ -154,15 +155,17 @@ main (int argc, char **argv) { int nf; - Suite *s = mpegaudioparse_suite (); + Suite *s = h263parse_suite (); SRunner *sr = srunner_create (s); gst_check_init (&argc, &argv); /* init test context */ - ctx_factory = "mpegaudioparse"; + ctx_factory = "h263parse"; ctx_sink_template = &sinktemplate; ctx_src_template = &srctemplate; + /* no timing info to parse */ + ctx_no_metadata = TRUE; srunner_run_all (sr, CK_NORMAL); nf = srunner_ntests_failed (sr); diff --git a/tests/check/elements/h264parse.c b/tests/check/elements/h264parse.c new file mode 100644 index 0000000000..b5423e5bd8 --- /dev/null +++ b/tests/check/elements/h264parse.c @@ -0,0 +1,393 @@ +/* + * GStreamer + * + * unit test for h264parse + * + * Copyright (C) 2011 Nokia Corporation. All rights reserved. + * + * Contact: Stefan Kost + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include "parser.h" + +#define SRC_CAPS_TMPL "video/x-h264, parsed=(boolean)false" +#define SINK_CAPS_TMPL "video/x-h264, parsed=(boolean)true" + +GstStaticPadTemplate sinktemplate_bs_nal = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (SINK_CAPS_TMPL + ", stream-format = (string) byte-stream, alignment = (string) nal") + ); + +GstStaticPadTemplate sinktemplate_avc_au = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (SINK_CAPS_TMPL + ", stream-format = (string) avc, alignment = (string) au") + ); + +GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (SRC_CAPS_TMPL) + ); + +/* some data */ + +/* SPS */ +static guint8 h264_sps[] = { + 0x00, 0x00, 0x00, 0x01, 0x67, 0x4d, 0x40, 0x15, + 0xec, 0xa4, 0xbf, 0x2e, 0x02, 0x20, 0x00, 0x00, + 0x03, 0x00, 0x2e, 0xe6, 0xb2, 0x80, 0x01, 0xe2, + 0xc5, 0xb2, 0xc0 +}; + +/* PPS */ +static guint8 h264_pps[] = { + 0x00, 0x00, 0x00, 0x01, 0x68, 0xeb, 0xec, 0xb2 +}; + +/* combines to this codec-data */ +static guint8 h264_codec_data[] = { + 0x01, 0x4d, 0x40, 0x15, 0xff, 0xe1, 0x00, 0x17, + 0x67, 0x4d, 0x40, 0x15, 0xec, 0xa4, 0xbf, 0x2e, + 0x02, 0x20, 0x00, 0x00, 0x03, 0x00, 0x2e, 0xe6, + 0xb2, 0x80, 0x01, 0xe2, 0xc5, 0xb2, 0xc0, 0x01, + 0x00, 0x04, 0x68, 0xeb, 0xec, 0xb2 +}; + +/* keyframes all around */ +static guint8 h264_idrframe[] = { + 0x00, 0x00, 0x00, 0x01, 0x65, 0x88, 0x84, 0x00, + 0x10, 0xff, 0xfe, 0xf6, 0xf0, 0xfe, 0x05, 0x36, + 0x56, 0x04, 0x50, 0x96, 0x7b, 0x3f, 0x53, 0xe1 +}; + +/* truncated nal */ +static guint8 garbage_frame[] = { + 0x00, 0x00, 0x00, 0x01, 0x05 +}; + +/* context to tweak tests */ +static const gchar *ctx_suite; +static gboolean ctx_codec_data; + +static gboolean +verify_buffer (buffer_verify_data_s * vdata, GstBuffer * buffer) +{ + if (vdata->discard) { + /* check separate header NALs */ + gint i = vdata->buffer_counter; + + fail_unless (i <= 1); + fail_unless (GST_BUFFER_SIZE (buffer) == ctx_headers[i].size); + fail_unless (memcmp (GST_BUFFER_DATA (buffer), ctx_headers[i].data, + GST_BUFFER_SIZE (buffer)) == 0); + } else { + fail_unless (GST_BUFFER_SIZE (buffer) > 4); + /* only need to check avc output case */ + if (GST_READ_UINT32_BE (GST_BUFFER_DATA (buffer)) == 0x01) + return FALSE; + /* header is merged in initial frame */ + if (vdata->buffer_counter == 0) { + guint8 *data = GST_BUFFER_DATA (buffer); + + fail_unless (GST_BUFFER_SIZE (buffer) == vdata->data_to_verify_size + + ctx_headers[0].size + ctx_headers[1].size); + fail_unless (GST_READ_UINT32_BE (data) == ctx_headers[0].size - 4); + fail_unless (memcmp (data + 4, ctx_headers[0].data + 4, + ctx_headers[0].size - 4) == 0); + data += ctx_headers[0].size; + fail_unless (GST_READ_UINT32_BE (data) == ctx_headers[1].size - 4); + fail_unless (memcmp (data + 4, ctx_headers[1].data + 4, + ctx_headers[1].size - 4) == 0); + data += ctx_headers[1].size; + fail_unless (GST_READ_UINT32_BE (data) == vdata->data_to_verify_size - 4); + fail_unless (memcmp (data + 4, vdata->data_to_verify + 4, + vdata->data_to_verify_size - 4) == 0); + } else { + fail_unless (GST_READ_UINT32_BE (GST_BUFFER_DATA (buffer)) == + GST_BUFFER_SIZE (buffer) - 4); + fail_unless (GST_BUFFER_SIZE (buffer) == vdata->data_to_verify_size); + fail_unless (memcmp (GST_BUFFER_DATA (buffer) + 4, + vdata->data_to_verify + 4, GST_BUFFER_SIZE (buffer) - 4) == 0); + } + return TRUE; + } + + return FALSE; +} + +GST_START_TEST (test_parse_normal) +{ + gst_parser_test_normal (h264_idrframe, sizeof (h264_idrframe)); +} + +GST_END_TEST; + + +GST_START_TEST (test_parse_drain_single) +{ + gst_parser_test_drain_single (h264_idrframe, sizeof (h264_idrframe)); +} + +GST_END_TEST; + + +GST_START_TEST (test_parse_drain_garbage) +{ + gst_parser_test_drain_garbage (h264_idrframe, sizeof (h264_idrframe), + garbage_frame, sizeof (garbage_frame)); +} + +GST_END_TEST +GST_START_TEST (test_parse_split) +{ + gst_parser_test_split (h264_idrframe, sizeof (h264_idrframe)); +} + +GST_END_TEST; + + +GST_START_TEST (test_parse_skip_garbage) +{ + gst_parser_test_skip_garbage (h264_idrframe, sizeof (h264_idrframe), + garbage_frame, sizeof (garbage_frame)); +} + +GST_END_TEST; + +#define structure_get_int(s,f) \ + (g_value_get_int(gst_structure_get_value(s,f))) +#define fail_unless_structure_field_int_equals(s,field,num) \ + fail_unless_equals_int (structure_get_int(s,field), num) + + +GST_START_TEST (test_parse_detect_stream) +{ + GstCaps *caps; + GstStructure *s; + GstBuffer *buf; + const GValue *val; + + /* parser does not really care that mpeg1 and mpeg2 frame data + * should be a bit different */ + caps = gst_parser_test_get_output_caps (h264_idrframe, sizeof (h264_idrframe), + NULL); + fail_unless (caps != NULL); + + /* Check that the negotiated caps are as expected */ + /* When codec_data is present, parser assumes that data is version 4 */ + GST_LOG ("h264 output caps: %" GST_PTR_FORMAT, caps); + s = gst_caps_get_structure (caps, 0); + fail_unless (gst_structure_has_name (s, "video/x-h264")); + fail_unless_structure_field_int_equals (s, "width", 32); + fail_unless_structure_field_int_equals (s, "height", 24); + + if (ctx_codec_data) { + fail_unless (gst_structure_has_field (s, "codec_data")); + + /* check codec-data in more detail */ + val = gst_structure_get_value (s, "codec_data"); + fail_unless (val != NULL); + buf = gst_value_get_buffer (val); + fail_unless (buf != NULL); + fail_unless (GST_BUFFER_SIZE (buf) == sizeof (h264_codec_data)); + fail_unless (memcmp (GST_BUFFER_DATA (buf), h264_codec_data, + GST_BUFFER_SIZE (buf)) == 0); + } + + gst_caps_unref (caps); +} + +GST_END_TEST; + + +static Suite * +h264parse_suite (void) +{ + Suite *s = suite_create (ctx_suite); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_parse_normal); + tcase_add_test (tc_chain, test_parse_drain_single); + tcase_add_test (tc_chain, test_parse_drain_garbage); + tcase_add_test (tc_chain, test_parse_split); + tcase_add_test (tc_chain, test_parse_skip_garbage); + tcase_add_test (tc_chain, test_parse_detect_stream); + + return s; +} + +static gboolean +verify_buffer_packetized (buffer_verify_data_s * vdata, GstBuffer * buffer) +{ + fail_unless (GST_BUFFER_SIZE (buffer) > 4); + fail_unless (GST_READ_UINT32_BE (GST_BUFFER_DATA (buffer)) == 0x01); + if (vdata->discard) { + /* check separate header NALs */ + guint8 *data; + gint size; + + if (vdata->buffer_counter == 0) { + data = h264_sps; + size = sizeof (h264_sps); + } else { + data = h264_pps; + size = sizeof (h264_pps); + } + + fail_unless (GST_BUFFER_SIZE (buffer) == size); + fail_unless (memcmp (GST_BUFFER_DATA (buffer) + 4, data + 4, + size - 4) == 0); + } else { + fail_unless (GST_BUFFER_SIZE (buffer) == vdata->data_to_verify_size); + fail_unless (memcmp (GST_BUFFER_DATA (buffer) + 4, + vdata->data_to_verify + 4, GST_BUFFER_SIZE (buffer) - 4) == 0); + } + + return TRUE; +} + +GST_START_TEST (test_parse_packetized) +{ + guint8 *frame; + GstCaps *caps; + GstBuffer *cdata; + GstStructure *s; + gchar *desc; + + /* make AVC frame */ + frame = g_malloc (sizeof (h264_idrframe)); + GST_WRITE_UINT32_BE (frame, sizeof (h264_idrframe) - 4); + memcpy (frame + 4, h264_idrframe + 4, sizeof (h264_idrframe) - 4); + + /* some caps messing */ + caps = gst_caps_from_string (SRC_CAPS_TMPL); + cdata = gst_buffer_new (); + GST_BUFFER_DATA (cdata) = h264_codec_data; + GST_BUFFER_SIZE (cdata) = sizeof (h264_codec_data); + gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, cdata, NULL); + gst_buffer_unref (cdata); + desc = gst_caps_to_string (caps); + gst_caps_unref (caps); + + caps = gst_parser_test_get_output_caps (frame, sizeof (h264_idrframe), desc); + g_free (desc); + g_free (frame); + + /* minor caps checks */ + GST_LOG ("h264 output caps: %" GST_PTR_FORMAT, caps); + s = gst_caps_get_structure (caps, 0); + fail_unless (gst_structure_has_name (s, "video/x-h264")); + fail_unless_structure_field_int_equals (s, "width", 32); + fail_unless_structure_field_int_equals (s, "height", 24); + + gst_caps_unref (caps); +} + +GST_END_TEST; + +static Suite * +h264parse_packetized_suite (void) +{ + Suite *s = suite_create (ctx_suite); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_parse_packetized); + + return s; +} + + +/* + * TODO: + * - Both push- and pull-modes need to be tested + * * Pull-mode & EOS + */ + +int +main (int argc, char **argv) +{ + int nf; + + Suite *s; + SRunner *sr; + + gst_check_init (&argc, &argv); + + /* globabl init test context */ + ctx_factory = "h264parse"; + ctx_sink_template = &sinktemplate_bs_nal; + ctx_src_template = &srctemplate; + ctx_headers[0].data = h264_sps; + ctx_headers[0].size = sizeof (h264_sps); + ctx_headers[1].data = h264_pps; + ctx_headers[1].size = sizeof (h264_pps); + ctx_verify_buffer = verify_buffer; + /* discard initial sps/pps buffers */ + ctx_discard = 2; + /* no timing info to parse */ + ctx_no_metadata = TRUE; + ctx_codec_data = FALSE; + + ctx_suite = "h264parse_to_bs_nal"; + s = h264parse_suite (); + sr = srunner_create (s); + srunner_run_all (sr, CK_NORMAL); + nf = srunner_ntests_failed (sr); + srunner_free (sr); + + /* setup and tweak to handle avc au output */ + ctx_suite = "h264parse_to_avc_au"; + ctx_sink_template = &sinktemplate_avc_au; + ctx_discard = 0; + ctx_codec_data = TRUE; + + s = h264parse_suite (); + sr = srunner_create (s); + srunner_run_all (sr, CK_NORMAL); + nf = srunner_ntests_failed (sr); + srunner_free (sr); + + /* setup and tweak to handle avc packetized input */ + ctx_suite = "h264parse_packetized"; + /* turn into separate byte stream NALs */ + ctx_sink_template = &sinktemplate_bs_nal; + /* and ignore inserted codec-data NALs */ + ctx_discard = 2; + /* no more config headers */ + ctx_headers[0].data = NULL; + ctx_headers[1].data = NULL; + ctx_headers[0].size = 0; + ctx_headers[1].size = 0; + /* and need adapter buffer check */ + ctx_verify_buffer = verify_buffer_packetized; + + s = h264parse_packetized_suite (); + sr = srunner_create (s); + srunner_run_all (sr, CK_NORMAL); + nf = srunner_ntests_failed (sr); + srunner_free (sr); + + return nf; +} diff --git a/tests/check/elements/imagecapturebin.c b/tests/check/elements/imagecapturebin.c deleted file mode 100644 index 5c5f73613b..0000000000 --- a/tests/check/elements/imagecapturebin.c +++ /dev/null @@ -1,410 +0,0 @@ -/* GStreamer unit test for the imagecapturebin element - * Copyright (C) 2010 Thiago Santos - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include - -#define N_BUFFERS 3 - -typedef struct -{ - GstElement *pipe; - GstElement *src; - GstElement *icbin; -} GstImageCaptureBinTestContext; - -static void -gstimagecapturebin_init_test_context (GstImageCaptureBinTestContext * ctx, - const gchar * src, gint num_buffers) -{ - fail_unless (ctx != NULL); - - ctx->pipe = gst_pipeline_new ("pipeline"); - fail_unless (ctx->pipe != NULL); - ctx->src = gst_element_factory_make (src, "src"); - fail_unless (ctx->src != NULL, "Failed to create src element"); - ctx->icbin = gst_element_factory_make ("imagecapturebin", "icbin"); - fail_unless (ctx->icbin != NULL, "Failed to create imagecapturebin element"); - - if (num_buffers > 0) - g_object_set (ctx->src, "num-buffers", num_buffers, NULL); - - fail_unless (gst_bin_add (GST_BIN (ctx->pipe), ctx->src)); - fail_unless (gst_bin_add (GST_BIN (ctx->pipe), ctx->icbin)); - fail_unless (gst_element_link_many (ctx->src, ctx->icbin, NULL)); -} - -static void -gstimagecapturebin_unset_test_context (GstImageCaptureBinTestContext * ctx) -{ - gst_element_set_state (ctx->pipe, GST_STATE_NULL); - gst_object_unref (ctx->pipe); - memset (ctx, 0, sizeof (GstImageCaptureBinTestContext)); -} - -static gchar * -make_test_file_name (void) -{ - return g_strdup_printf ("%s" G_DIR_SEPARATOR_S - "imagecapturebintest_%%d.cap", g_get_tmp_dir ()); -} - -static gboolean -get_file_info (const gchar * filename, gint * width, gint * height) -{ - GstElement *playbin = gst_element_factory_make ("playbin2", NULL); - GstElement *fakesink = gst_element_factory_make ("fakesink", NULL); - GstState state = GST_STATE_NULL; - GstPad *pad; - GstCaps *caps; - gchar *uri = g_strdup_printf ("file://%s", filename); - - g_object_set (playbin, "video-sink", fakesink, NULL); - g_object_set (playbin, "uri", uri, NULL); - g_free (uri); - - gst_element_set_state (playbin, GST_STATE_PAUSED); - - gst_element_get_state (playbin, &state, NULL, GST_SECOND * 5); - - fail_unless (state == GST_STATE_PAUSED); - - g_signal_emit_by_name (playbin, "get-video-pad", 0, &pad, NULL); - caps = gst_pad_get_negotiated_caps (pad); - fail_unless (gst_structure_get_int (gst_caps_get_structure (caps, 0), "width", - width)); - fail_unless (gst_structure_get_int (gst_caps_get_structure (caps, 0), - "height", height)); - - gst_object_unref (pad); - gst_element_set_state (playbin, GST_STATE_NULL); - gst_object_unref (playbin); - return TRUE; -} - -static GstBuffer * -create_video_buffer (GstCaps * caps) -{ - GstElement *pipeline; - GstElement *cf; - GstElement *sink; - GstBuffer *buffer; - - pipeline = - gst_parse_launch - ("videotestsrc num-buffers=1 ! capsfilter name=cf ! appsink name=sink", - NULL); - g_assert (pipeline != NULL); - - cf = gst_bin_get_by_name (GST_BIN (pipeline), "cf"); - sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink"); - - g_object_set (G_OBJECT (cf), "caps", caps, NULL); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - - buffer = gst_app_sink_pull_buffer (GST_APP_SINK (sink)); - - gst_element_set_state (pipeline, GST_STATE_NULL); - gst_object_unref (pipeline); - gst_object_unref (sink); - gst_object_unref (cf); - return buffer; -} - - -GST_START_TEST (test_simple_capture) -{ - GstImageCaptureBinTestContext ctx; - GstBus *bus; - GstMessage *msg; - gchar *test_file_name; - gint i; - - gstimagecapturebin_init_test_context (&ctx, "videotestsrc", N_BUFFERS); - bus = gst_element_get_bus (ctx.pipe); - - test_file_name = make_test_file_name (); - g_object_set (ctx.icbin, "location", test_file_name, NULL); - - fail_if (gst_element_set_state (ctx.pipe, GST_STATE_PLAYING) == - GST_STATE_CHANGE_FAILURE); - - msg = gst_bus_timed_pop_filtered (bus, GST_SECOND * 10, - GST_MESSAGE_EOS | GST_MESSAGE_ERROR); - fail_unless (msg != NULL); - fail_unless (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS); - gst_message_unref (msg); - - /* check there are N_BUFFERS files */ - for (i = 0; i < N_BUFFERS; i++) { - gchar *filename; - FILE *f; - - filename = g_strdup_printf (test_file_name, i); - - fail_unless (g_file_test (filename, G_FILE_TEST_EXISTS)); - fail_unless (g_file_test (filename, G_FILE_TEST_IS_REGULAR)); - fail_if (g_file_test (filename, G_FILE_TEST_IS_SYMLINK)); - - /* check the file isn't empty */ - f = fopen (filename, "r"); - fseek (f, 0, SEEK_END); - fail_unless (ftell (f) > 0); - fclose (f); - - g_free (filename); - } - - gstimagecapturebin_unset_test_context (&ctx); - gst_object_unref (bus); - g_free (test_file_name); -} - -GST_END_TEST; - - -GST_START_TEST (test_multiple_captures_different_caps) -{ - GstImageCaptureBinTestContext ctx; - GstBus *bus; - GstMessage *msg; - gchar *test_file_name; - gint i; - gint widths[] = { 100, 300, 200 }; - gint heights[] = { 300, 200, 100 }; - GstPad *pad; - - gstimagecapturebin_init_test_context (&ctx, "appsrc", N_BUFFERS); - bus = gst_element_get_bus (ctx.pipe); - - test_file_name = make_test_file_name (); - g_object_set (ctx.icbin, "location", test_file_name, NULL); - fail_if (gst_element_set_state (ctx.pipe, GST_STATE_PLAYING) == - GST_STATE_CHANGE_FAILURE); - - /* push data directly because set_caps and buffer pushes on appsrc - * are not serialized into the flow, so we can't guarantee the buffers - * have the caps we want on them when pushed */ - pad = gst_element_get_static_pad (ctx.src, "src"); - - /* push the buffers */ - for (i = 0; i < N_BUFFERS; i++) { - GstCaps *caps; - GstBuffer *buf; - - caps = gst_caps_new_simple ("video/x-raw-yuv", "width", G_TYPE_INT, - widths[i], "height", G_TYPE_INT, heights[i], "framerate", - GST_TYPE_FRACTION, 1, 1, "format", GST_TYPE_FOURCC, - GST_MAKE_FOURCC ('I', '4', '2', '0'), NULL); - - buf = create_video_buffer (caps); - fail_if (buf == NULL); - - fail_unless (gst_pad_push (pad, buf) == GST_FLOW_OK); - gst_caps_unref (caps); - } - gst_app_src_end_of_stream (GST_APP_SRC (ctx.src)); - gst_object_unref (pad); - - msg = gst_bus_timed_pop_filtered (bus, GST_SECOND * 10, - GST_MESSAGE_EOS | GST_MESSAGE_ERROR); - fail_unless (msg != NULL); - fail_unless (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS); - gst_message_unref (msg); - - /* check there are N_BUFFERS files */ - for (i = 0; i < N_BUFFERS; i++) { - gchar *filename; - FILE *f; - gint width = 0, height = 0; - - filename = g_strdup_printf (test_file_name, i); - - fail_unless (g_file_test (filename, G_FILE_TEST_EXISTS)); - fail_unless (g_file_test (filename, G_FILE_TEST_IS_REGULAR)); - fail_if (g_file_test (filename, G_FILE_TEST_IS_SYMLINK)); - - /* check the file isn't empty */ - f = fopen (filename, "r"); - fseek (f, 0, SEEK_END); - fail_unless (ftell (f) > 0); - fclose (f); - - /* get the file info */ - fail_unless (get_file_info (filename, &width, &height)); - fail_unless (width == widths[i]); - fail_unless (height == heights[i]); - - g_free (filename); - } - - gstimagecapturebin_unset_test_context (&ctx); - gst_object_unref (bus); - g_free (test_file_name); -} - -GST_END_TEST; - -GST_START_TEST (test_setting_encoder) -{ - GstImageCaptureBinTestContext ctx; - GstBus *bus; - GstMessage *msg; - GstElement *encoder; - gchar *test_file_name; - gint i; - - gstimagecapturebin_init_test_context (&ctx, "videotestsrc", N_BUFFERS); - bus = gst_element_get_bus (ctx.pipe); - - test_file_name = make_test_file_name (); - g_object_set (ctx.icbin, "location", test_file_name, NULL); - - encoder = gst_element_factory_make ("jpegenc", NULL); - g_object_set (ctx.icbin, "image-encoder", encoder, NULL); - - fail_if (gst_element_set_state (ctx.pipe, GST_STATE_PLAYING) == - GST_STATE_CHANGE_FAILURE); - - msg = gst_bus_timed_pop_filtered (bus, GST_SECOND * 10, - GST_MESSAGE_EOS | GST_MESSAGE_ERROR); - fail_unless (msg != NULL); - fail_unless (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS); - - /* check there are N_BUFFERS files */ - for (i = 0; i < N_BUFFERS; i++) { - gchar *filename; - FILE *f; - - filename = g_strdup_printf (test_file_name, i); - - fail_unless (g_file_test (filename, G_FILE_TEST_EXISTS)); - fail_unless (g_file_test (filename, G_FILE_TEST_IS_REGULAR)); - fail_if (g_file_test (filename, G_FILE_TEST_IS_SYMLINK)); - - /* check the file isn't empty */ - f = fopen (filename, "r"); - fseek (f, 0, SEEK_END); - fail_unless (ftell (f) > 0); - fclose (f); - - g_free (filename); - } - - gstimagecapturebin_unset_test_context (&ctx); - gst_object_unref (bus); - g_free (test_file_name); -} - -GST_END_TEST; - -GST_START_TEST (test_setting_muxer) -{ - GstImageCaptureBinTestContext ctx; - GstBus *bus; - GstMessage *msg; - GstElement *encoder; - gchar *test_file_name; - gint i; - - gstimagecapturebin_init_test_context (&ctx, "videotestsrc", N_BUFFERS); - bus = gst_element_get_bus (ctx.pipe); - - test_file_name = make_test_file_name (); - g_object_set (ctx.icbin, "location", test_file_name, NULL); - - encoder = gst_element_factory_make ("pngenc", NULL); - g_object_set (ctx.icbin, "image-encoder", encoder, NULL); - - encoder = gst_element_factory_make ("identity", NULL); - g_object_set (ctx.icbin, "image-muxer", encoder, NULL); - - fail_if (gst_element_set_state (ctx.pipe, GST_STATE_PLAYING) == - GST_STATE_CHANGE_FAILURE); - - msg = gst_bus_timed_pop_filtered (bus, GST_SECOND * 10, - GST_MESSAGE_EOS | GST_MESSAGE_ERROR); - fail_unless (msg != NULL); - fail_unless (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS); - - /* check there are N_BUFFERS files */ - for (i = 0; i < N_BUFFERS; i++) { - gchar *filename; - FILE *f; - - filename = g_strdup_printf (test_file_name, i); - - fail_unless (g_file_test (filename, G_FILE_TEST_EXISTS)); - fail_unless (g_file_test (filename, G_FILE_TEST_IS_REGULAR)); - fail_if (g_file_test (filename, G_FILE_TEST_IS_SYMLINK)); - - /* check the file isn't empty */ - f = fopen (filename, "r"); - fseek (f, 0, SEEK_END); - fail_unless (ftell (f) > 0); - fclose (f); - - g_free (filename); - } - - gstimagecapturebin_unset_test_context (&ctx); - gst_object_unref (bus); - g_free (test_file_name); -} - -GST_END_TEST; - -static Suite * -imagecapturebin_suite (void) -{ - GstElementFactory *jpegenc_factory; - - Suite *s = suite_create ("imagecapturebin"); - TCase *tc_chain = tcase_create ("general"); - - jpegenc_factory = gst_element_factory_find ("jpegenc"); - - suite_add_tcase (s, tc_chain); - if (jpegenc_factory) { - tcase_add_test (tc_chain, test_simple_capture); - - /* only adds this test if jpegenc contains the fix for its getcaps - * The fix on good: dcbba0932dc579abd6aab4460fa1a416374eda1b */ - if (gst_plugin_feature_check_version ((GstPluginFeature *) jpegenc_factory, - 0, 10, 27)) - tcase_add_test (tc_chain, test_multiple_captures_different_caps); - else - GST_WARNING ("Skipped test that needs gst-plugins-good 0.10.27"); - - tcase_add_test (tc_chain, test_setting_encoder); - tcase_add_test (tc_chain, test_setting_muxer); - } else - GST_WARNING ("Skipped imagecapturebin tests because jpegenc is missing"); - - return s; -} - -GST_CHECK_MAIN (imagecapturebin); diff --git a/tests/check/elements/jifmux.c b/tests/check/elements/jifmux.c index f76d77a842..9e21d1a5b0 100644 --- a/tests/check/elements/jifmux.c +++ b/tests/check/elements/jifmux.c @@ -619,6 +619,8 @@ static const GstExifTagMatch tag_map[] = { EXIF_TYPE_SRATIONAL, compare_shutter_speed}, {GST_TAG_CAPTURING_FOCAL_RATIO, EXIF_TAG_APERTURE_VALUE, EXIF_TYPE_RATIONAL, compare_aperture_value}, + {GST_TAG_CAPTURING_EXPOSURE_COMPENSATION, EXIF_TAG_EXPOSURE_BIAS_VALUE, + EXIF_TYPE_SRATIONAL}, {GST_TAG_CAPTURING_FLASH_FIRED, EXIF_TAG_FLASH, EXIF_TYPE_SHORT, compare_flash}, {GST_TAG_CAPTURING_FLASH_MODE, EXIF_TAG_FLASH, EXIF_TYPE_SHORT, @@ -810,14 +812,24 @@ check_content (ExifContent * content, void *user_data) g_free (taglist_str); } break; + case EXIF_TYPE_SRATIONAL: case EXIF_TYPE_RATIONAL:{ - ExifRational exif_rational = exif_get_rational (entry->data, - exif_data_get_byte_order (entry->parent->parent)); GValue exif_value = { 0 }; g_value_init (&exif_value, GST_TYPE_FRACTION); - gst_value_set_fraction (&exif_value, exif_rational.numerator, - exif_rational.denominator); + if (entry->format == EXIF_TYPE_RATIONAL) { + ExifRational exif_rational = exif_get_rational (entry->data, + exif_data_get_byte_order (entry->parent->parent)); + + gst_value_set_fraction (&exif_value, exif_rational.numerator, + exif_rational.denominator); + } else { + ExifSRational exif_rational = exif_get_srational (entry->data, + exif_data_get_byte_order (entry->parent->parent)); + + gst_value_set_fraction (&exif_value, exif_rational.numerator, + exif_rational.denominator); + } if (gst_tag_type == GST_TYPE_FRACTION) { const GValue *value = gst_tag_list_get_value_index (test_data->taglist, @@ -1029,6 +1041,7 @@ GST_START_TEST (test_jifmux_tags) GST_TAG_CAPTURING_ISO_SPEED, 800, GST_TAG_DATE_TIME, datetime, GST_TAG_CAPTURING_FOCAL_LENGTH, 22.5, GST_TAG_CAPTURING_DIGITAL_ZOOM_RATIO, 5.25, + GST_TAG_CAPTURING_EXPOSURE_COMPENSATION, -2.5, GST_TAG_APPLICATION_DATA, buffer, GST_TAG_CAPTURING_FLASH_FIRED, TRUE, GST_TAG_CAPTURING_FLASH_MODE, "auto", diff --git a/tests/check/elements/jpegparse.c b/tests/check/elements/jpegparse.c index 7d5c6a8778..d8d57567c3 100644 --- a/tests/check/elements/jpegparse.c +++ b/tests/check/elements/jpegparse.c @@ -43,6 +43,113 @@ guint8 test_data_extra_ff[] = { 0xff, 0xd8, 0xff, 0xff, 0xff, 0x12, 0x00, 0x03, 0x33, 0xff, 0xff, 0xff, 0xd9 }; +guint8 test_data_soi[] = { 0xff, 0xd8 }; + +guint8 test_data_app1_exif[] = { + 0xff, 0xe1, + 0x00, 0xd2, /* length = 210 */ + 0x45, 0x78, 0x69, 0x66, 0x00, /* Exif */ + 0x00, + 0x49, 0x49, + 0x2a, 0x00, + 0x08, + 0x00, 0x00, 0x00, + 0x09, /* number of entries */ + 0x00, + 0x0e, 0x01, /* tag 0x10e */ + 0x02, 0x00, /* type 2 */ + 0x0b, 0x00, /* count 11 */ + 0x00, 0x00, + 0x7a, /* offset 122 (0x7a) */ + 0x00, 0x00, 0x00, + 0x0f, 0x01, /* tag 0x10f */ + 0x02, 0x00, /* type 2 */ + 0x06, 0x00, /* count 6 */ + 0x00, 0x00, + 0x85, /* offset 133 (0x85) */ + 0x00, 0x00, 0x00, + 0x10, 0x01, /* tag 0x110 */ + 0x02, 0x00, /* type 2 */ + 0x05, 0x00, /* count 5 */ + 0x00, 0x00, + 0x8b, /* offset 139 (0x8b) */ + 0x00, 0x00, 0x00, + 0x12, 0x01, /* tag 0x112 */ + 0x03, 0x00, /* type 3 */ + 0x01, 0x00, /* count 1 */ + 0x00, 0x00, + 0x01, 0x00, 0x30, 0x2c, /* offset (0x2c300001) */ + 0x1a, 0x01, /* tag 0x11a */ + 0x05, 0x00, /* type 5 */ + 0x01, 0x00, /* count 1 */ + 0x00, 0x00, + 0x90, /* offset 144 (0x90) */ + 0x00, 0x00, 0x00, + 0x1b, 0x01, /* tag 0x11b */ + 0x05, 0x00, /* type 5 */ + 0x01, 0x00, /* count 1 */ + 0x00, 0x00, + 0x98, /* offset 152 (0x98) */ + 0x00, 0x00, 0x00, + 0x28, 0x01, /* tag 0x128 */ + 0x03, 0x00, /* type 3 */ + 0x01, 0x00, /* count 1 */ + 0x00, 0x00, + 0x02, 0x00, 0x31, 0x2f, /* offset (0x2f310002) */ + 0x31, 0x01, /* tag 0x131 */ + 0x02, 0x00, /* type 2 */ + 0x08, 0x00, /* count 8 */ + 0x00, 0x00, + 0xa0, /* offset 160 (0xa0) */ + 0x00, 0x00, 0x00, + 0x32, 0x01, /* tag 0x132 */ + 0x02, 0x00, /* type 2 */ + 0x14, 0x00, /* count 20 */ + 0x00, 0x00, + 0xa8, /* offset 168 (0xa8) */ + 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, + 0x00, + /* string */ + /* 122: */ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + /* string (NIKON) */ + /* 133: */ 0x4e, 0x49, 0x4b, 0x4f, 0x4e, 0x00, + /* string (E800) */ + /* 139: */ 0x45, 0x38, 0x30, 0x30, 0x00, + /* 144: */ 0x00, 0x00, 0x80, 0x25, /* / */ 0x00, 0x00, 0x20, 0x00, + /* 152: */ 0x00, 0x00, 0x80, 0x25, /* / */ 0x00, 0x00, 0x20, 0x00, + /* string (v984-75) */ + /* 160: */ 0x76, 0x39, 0x38, 0x34, 0x2d, 0x37, 0x35, 0x00, + /* string (2001:08:18 21:44:21) */ + /* 168: */ 0x32, 0x30, 0x30, 0x31, 0x3a, 0x30, 0x38, 0x3a, + 0x31, 0x38, 0x20, 0x32, 0x31, 0x3a, 0x34, 0x34, + 0x3a, 0x32, 0x31, 0x00, + + 0x1e, 0x21, 0x1f, 0x1e, 0x21, 0x1c, 0x20, 0x21, 0x22, 0x24, 0x24, 0x27, + 0x22, 0x20, +}; + +guint8 test_data_comment[] = { + 0xff, 0xfe, + 0x00, 0x08, /* size */ + /* xxxxx */ + 0x78, 0x78, 0x78, 0x78, 0x78, 0x00, +}; + +guint8 test_data_sof0[] = { + 0xff, 0xc0, + 0x00, 0x11, /* size */ + 0x08, /* precision */ + 0x00, 0x3c, /* width */ + 0x00, 0x50, /* height */ + 0x03, /* number of components */ + 0x01, 0x22, 0x00, /* component 1 */ + 0x02, 0x11, 0x01, /* component 2 */ + 0x03, 0x11, 0x01, /* component 3 */ +}; + +guint8 test_data_eoi[] = { 0xff, 0xd9 }; + static GList * _make_buffers_in (GList * buffer_in, guint8 * test_data, gsize test_data_size) { @@ -167,6 +274,86 @@ GST_START_TEST (test_parse_all_in_one_buf) GST_END_TEST; +static inline GstBuffer * +make_my_input_buffer (guint8 * test_data_header, gsize test_data_size) +{ + GstBuffer *buffer; + gsize total_size = 0, offset = 0; + GstCaps *caps; + + total_size += sizeof (test_data_soi); + total_size += test_data_size; + total_size += sizeof (test_data_sof0); + total_size += sizeof (test_data_eoi); + + buffer = gst_buffer_new_and_alloc (total_size); + + memcpy (GST_BUFFER_DATA (buffer) + offset, test_data_soi, + sizeof (test_data_soi)); + offset += sizeof (test_data_soi); + memcpy (GST_BUFFER_DATA (buffer) + offset, test_data_header, test_data_size); + offset += test_data_size; + memcpy (GST_BUFFER_DATA (buffer) + offset, test_data_sof0, + sizeof (test_data_sof0)); + offset += sizeof (test_data_sof0); + memcpy (GST_BUFFER_DATA (buffer) + offset, test_data_eoi, + sizeof (test_data_eoi)); + offset += sizeof (test_data_eoi); + + caps = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, FALSE, + NULL); + gst_buffer_set_caps (buffer, caps); + gst_caps_unref (caps); + + return buffer; +} + +static inline GstBuffer * +make_my_output_buffer (const GstBuffer * buffer_in) +{ + GstBuffer *buffer; + GstCaps *caps; + + buffer = gst_buffer_new (); + caps = gst_caps_new_simple ("image/jpeg", "parsed", G_TYPE_BOOLEAN, TRUE, + "framerate", GST_TYPE_FRACTION, 1, 1, "format", GST_TYPE_FOURCC, + GST_MAKE_FOURCC ('I', '4', '2', '0'), "interlaced", G_TYPE_BOOLEAN, FALSE, + "width", G_TYPE_INT, 80, "height", G_TYPE_INT, 60, NULL); + gst_buffer_set_data (buffer, GST_BUFFER_DATA (buffer_in), + GST_BUFFER_SIZE (buffer_in)); + gst_buffer_set_caps (buffer, caps); + gst_caps_unref (caps); + + return buffer; +} + + +GST_START_TEST (test_parse_app1_exif) +{ + GstBuffer *buffer_in, *buffer_out; + + buffer_in = make_my_input_buffer (test_data_app1_exif, + sizeof (test_data_app1_exif)); + buffer_out = make_my_output_buffer (buffer_in); + + gst_check_element_push_buffer ("jpegparse", buffer_in, buffer_out); +} + +GST_END_TEST; + +GST_START_TEST (test_parse_comment) +{ + GstBuffer *buffer_in, *buffer_out; + + buffer_in = make_my_input_buffer (test_data_comment, + sizeof (test_data_comment)); + buffer_out = make_my_output_buffer (buffer_in); + + gst_check_element_push_buffer ("jpegparse", buffer_in, buffer_out); +} + +GST_END_TEST; + static Suite * jpegparse_suite (void) { @@ -176,6 +363,8 @@ jpegparse_suite (void) suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_parse_single_byte); tcase_add_test (tc_chain, test_parse_all_in_one_buf); + tcase_add_test (tc_chain, test_parse_app1_exif); + tcase_add_test (tc_chain, test_parse_comment); return s; } diff --git a/tests/check/elements/logoinsert.c b/tests/check/elements/logoinsert.c new file mode 100644 index 0000000000..08f19d2a33 --- /dev/null +++ b/tests/check/elements/logoinsert.c @@ -0,0 +1,252 @@ +/* GStreamer + * + * unit test for logoinsert + * + * Copyright (C) 2011 David Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include + +static guint8 image_data[]; +/* sizeof on a forward declaration? not so fast */ +#define SIZEOF_IMAGE_DATA 1428 + +typedef struct +{ + GMainLoop *loop; + gboolean eos; +} OnMessageUserData; + +static void +on_message_cb (GstBus * bus, GstMessage * message, gpointer user_data) +{ + OnMessageUserData *d = user_data; + + switch (GST_MESSAGE_TYPE (message)) { + case GST_MESSAGE_ERROR: + case GST_MESSAGE_WARNING: + g_assert_not_reached (); + break; + case GST_MESSAGE_EOS: + g_main_loop_quit (d->loop); + d->eos = TRUE; + break; + default: + break; + } +} + +static void +run_test (const gchar * pipeline_string) +{ + GstElement *pipeline; + GstBus *bus; + GMainLoop *loop; + OnMessageUserData omud = { NULL, }; + GstStateChangeReturn ret; + GstElement *e; + GstBuffer *buffer; + + GST_DEBUG ("Testing pipeline '%s'", pipeline_string); + + pipeline = gst_parse_launch (pipeline_string, NULL); + fail_unless (pipeline != NULL); + g_object_set (G_OBJECT (pipeline), "async-handling", TRUE, NULL); + + e = gst_bin_get_by_name (GST_BIN (pipeline), "e"); + fail_unless (e != NULL); + buffer = gst_buffer_new (); + GST_BUFFER_DATA (buffer) = image_data; + GST_BUFFER_SIZE (buffer) = SIZEOF_IMAGE_DATA; + g_object_set (e, "data", buffer, NULL); + g_object_unref (e); + + loop = g_main_loop_new (NULL, FALSE); + + bus = gst_element_get_bus (pipeline); + fail_unless (bus != NULL); + gst_bus_add_signal_watch (bus); + + omud.loop = loop; + omud.eos = FALSE; + + g_signal_connect (bus, "message", (GCallback) on_message_cb, &omud); + + gst_object_unref (bus); + + ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); + fail_unless (ret == GST_STATE_CHANGE_SUCCESS + || ret == GST_STATE_CHANGE_ASYNC); + + g_main_loop_run (loop); + + fail_unless (gst_element_set_state (pipeline, + GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS); + + fail_unless (omud.eos == TRUE); + + gst_object_unref (pipeline); + g_main_loop_unref (loop); +} + +GST_START_TEST (test_logoinsert) +{ + + run_test ("videotestsrc num-buffers=250 ! coglogoinsert name=e ! fakesink"); +} + +GST_END_TEST; + +static Suite * +logoinsert_suite (void) +{ + Suite *s = suite_create ("logoinsert"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_set_timeout (tc_chain, 180); + + tcase_add_test (tc_chain, test_logoinsert); + + return s; +} + +GST_CHECK_MAIN (logoinsert); + +static guint8 image_data[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, + 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x64, 0x08, + 0x06, 0x00, 0x00, 0x00, 0x70, 0xe2, 0x95, 0x54, 0x00, 0x00, 0x00, 0x01, + 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00, 0x00, + 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0, + 0xbd, 0xa7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, + 0x00, 0x0b, 0x13, 0x00, 0x00, 0x0b, 0x13, 0x01, 0x00, 0x9a, 0x9c, 0x18, + 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, 0x4d, 0x45, 0x07, 0xdb, 0x03, 0x12, + 0x01, 0x3b, 0x19, 0x50, 0x86, 0x8e, 0x47, 0x00, 0x00, 0x00, 0x19, 0x74, + 0x45, 0x58, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x00, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, + 0x47, 0x49, 0x4d, 0x50, 0x57, 0x81, 0x0e, 0x17, 0x00, 0x00, 0x04, 0xef, + 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0xed, 0x9d, 0xcf, 0x6b, 0x1d, 0x55, + 0x14, 0xc7, 0x3f, 0xf7, 0xa1, 0x89, 0x81, 0x16, 0xa3, 0x82, 0x9a, 0x57, + 0xc4, 0x59, 0x68, 0x05, 0x05, 0x13, 0x28, 0x08, 0xba, 0x49, 0x16, 0xa2, + 0xb8, 0x90, 0x06, 0xd4, 0x45, 0x75, 0x61, 0x17, 0xfe, 0x07, 0xe2, 0xca, + 0x85, 0x8a, 0x9b, 0x82, 0x14, 0x04, 0x37, 0x5d, 0x5a, 0xfc, 0x51, 0x10, + 0xd4, 0xd6, 0xba, 0x69, 0x11, 0xac, 0x22, 0x55, 0xb0, 0xd1, 0x44, 0xd0, + 0x62, 0x57, 0x53, 0x82, 0x81, 0x46, 0x6b, 0x5f, 0xd3, 0x17, 0x34, 0x21, + 0xf5, 0xb8, 0x98, 0x33, 0xed, 0x04, 0x5e, 0x9a, 0xbe, 0xf7, 0x66, 0xee, + 0xdc, 0x99, 0x39, 0x5f, 0xb8, 0x0c, 0x59, 0xcd, 0xdc, 0xf3, 0xc9, 0xf7, + 0xdc, 0x3b, 0x77, 0xde, 0x3d, 0xd7, 0x89, 0x08, 0xa6, 0x70, 0xd4, 0xb2, + 0x10, 0x18, 0x10, 0x93, 0x01, 0x31, 0x20, 0x26, 0x03, 0x62, 0x40, 0x4c, + 0x06, 0xa4, 0xfe, 0xba, 0xa5, 0xea, 0x1d, 0x70, 0xce, 0x8d, 0x03, 0xd9, + 0x96, 0x55, 0x27, 0x6d, 0x22, 0xd2, 0xa9, 0x44, 0x7f, 0x42, 0x7f, 0x31, + 0x74, 0xce, 0x8d, 0x00, 0x6d, 0x20, 0xbd, 0x02, 0xec, 0x00, 0x1e, 0x00, + 0x22, 0x60, 0xa7, 0xfe, 0x3d, 0x72, 0x23, 0x20, 0x40, 0x0c, 0x2c, 0x00, + 0xf3, 0x21, 0xc3, 0x09, 0x12, 0x88, 0x42, 0xd8, 0x0d, 0x3c, 0xa1, 0x41, + 0x9f, 0xd0, 0xc0, 0xdf, 0xaf, 0xc1, 0xcf, 0xb6, 0x9b, 0x75, 0x79, 0x07, + 0x98, 0xd7, 0xb6, 0xa0, 0xd7, 0x38, 0x34, 0x38, 0xc1, 0x00, 0x51, 0x08, + 0x51, 0x06, 0xc4, 0x6e, 0xe0, 0xf1, 0x8c, 0x2b, 0xf2, 0xd4, 0x45, 0x60, + 0x11, 0x38, 0x03, 0x7c, 0x01, 0xcc, 0x89, 0xc8, 0x92, 0x01, 0xb9, 0x0e, + 0x63, 0x07, 0xf0, 0x34, 0xf0, 0x9c, 0x82, 0xd8, 0xe3, 0xe9, 0xd6, 0x1b, + 0x40, 0x17, 0xb8, 0x04, 0x9c, 0x03, 0x3e, 0x07, 0x8e, 0x97, 0x09, 0xa7, + 0x54, 0x20, 0x99, 0xd4, 0xf4, 0x14, 0xf0, 0xa2, 0x47, 0x10, 0xbd, 0x74, + 0x55, 0x9d, 0xb3, 0x0c, 0x7c, 0x0f, 0x1c, 0x2f, 0xc3, 0x39, 0xa5, 0x01, + 0xc9, 0xb8, 0x62, 0x5f, 0x81, 0xa9, 0x69, 0x50, 0x75, 0x15, 0xce, 0x29, + 0xe0, 0x3d, 0x11, 0x99, 0xab, 0x35, 0x10, 0x85, 0xf1, 0x2c, 0xf0, 0x6a, + 0xc9, 0xae, 0xd8, 0x4e, 0xab, 0x3a, 0xce, 0x1c, 0xf1, 0x96, 0xca, 0x44, + 0xc4, 0x6b, 0xd3, 0x99, 0xd1, 0x3e, 0xed, 0xa8, 0x54, 0xa0, 0x6d, 0x00, + 0x7f, 0x01, 0x1f, 0x03, 0x7b, 0x0a, 0x8f, 0x4f, 0x49, 0x30, 0x7e, 0xae, + 0x08, 0x8c, 0x6c, 0x5b, 0x07, 0x7e, 0xd0, 0xe7, 0x1f, 0xaf, 0x3c, 0x10, + 0x7d, 0x71, 0x9b, 0x06, 0x7e, 0xa9, 0x20, 0x8c, 0xb4, 0x5d, 0xd5, 0xe9, + 0xf2, 0x41, 0x20, 0xaa, 0x3a, 0x90, 0x87, 0x74, 0xce, 0x2f, 0x35, 0x68, + 0x5d, 0xe0, 0x23, 0x60, 0x26, 0x6f, 0xb7, 0x78, 0x19, 0xd4, 0x9d, 0x73, + 0x0f, 0x03, 0xaf, 0xeb, 0x7b, 0xc6, 0x68, 0x4d, 0xd6, 0x01, 0xd7, 0x80, + 0x9f, 0x80, 0x4f, 0x80, 0xa3, 0x22, 0x12, 0x57, 0x62, 0x71, 0xd1, 0x39, + 0xf7, 0x20, 0xf0, 0x1a, 0xf0, 0xbc, 0xa6, 0xad, 0xba, 0x68, 0x54, 0xa7, + 0xeb, 0x13, 0xc0, 0xb8, 0x73, 0xee, 0xfd, 0x3c, 0xa0, 0xb4, 0x0a, 0x86, + 0x11, 0x01, 0xaf, 0x00, 0xb3, 0x35, 0x83, 0x91, 0x55, 0x04, 0xbc, 0x0c, + 0xec, 0xd7, 0xfe, 0x86, 0x09, 0x44, 0x1f, 0x6e, 0x3f, 0xf0, 0x52, 0x8f, + 0x55, 0x58, 0x83, 0xe2, 0x13, 0x88, 0x7e, 0xa3, 0x98, 0x55, 0x20, 0xbb, + 0x68, 0x86, 0x52, 0x28, 0xb3, 0xda, 0xff, 0xa0, 0x1c, 0x32, 0x05, 0xec, + 0x25, 0x59, 0x2e, 0x6f, 0x92, 0x22, 0xed, 0xf7, 0x54, 0x30, 0x40, 0xd4, + 0xb2, 0x43, 0x3d, 0x54, 0xc5, 0x35, 0x05, 0xec, 0x1d, 0x34, 0x75, 0xb5, + 0x72, 0x86, 0x91, 0xa6, 0xaa, 0xd9, 0x06, 0x8c, 0x1b, 0x5b, 0xe9, 0x5a, + 0x0c, 0x06, 0x49, 0x5d, 0xad, 0x02, 0x2c, 0x3b, 0xad, 0xd7, 0x26, 0x6b, + 0xe0, 0x38, 0xb4, 0x0a, 0xb0, 0xeb, 0x14, 0xa6, 0x81, 0x63, 0x91, 0x1b, + 0x10, 0xb5, 0xe7, 0xa4, 0xb9, 0x63, 0x93, 0x4b, 0x26, 0xfb, 0x4d, 0x5b, + 0x2d, 0x73, 0x47, 0x58, 0x2e, 0xc9, 0x13, 0xc8, 0xa4, 0x01, 0xe9, 0x09, + 0x64, 0xd2, 0x3b, 0x10, 0xb5, 0x65, 0xd4, 0xe0, 0x99, 0xd5, 0x8d, 0x66, + 0x5c, 0x51, 0x3f, 0x69, 0xab, 0x95, 0xe3, 0x8d, 0xdb, 0x16, 0xff, 0x2d, + 0x63, 0x53, 0x0a, 0x90, 0x7b, 0x2d, 0xf6, 0x61, 0x01, 0xd9, 0x65, 0xb1, + 0x0f, 0x07, 0xc8, 0x5d, 0xc0, 0x98, 0xc5, 0x7e, 0x78, 0xe5, 0x05, 0xe4, + 0x11, 0xe0, 0x76, 0x0b, 0x67, 0x38, 0x40, 0xee, 0x33, 0x87, 0x04, 0x02, + 0xc4, 0x39, 0xd7, 0x06, 0xee, 0xc0, 0x36, 0xff, 0x6c, 0xa5, 0x74, 0x3b, + 0x84, 0x37, 0x87, 0x8c, 0x90, 0xfc, 0x12, 0xc3, 0x14, 0x08, 0x90, 0x36, + 0x70, 0xa7, 0xc5, 0x3d, 0x2c, 0x87, 0x58, 0xba, 0xea, 0xad, 0x35, 0xe0, + 0x42, 0x3f, 0x9b, 0x82, 0x2c, 0x90, 0xc5, 0xea, 0x1f, 0xe0, 0xdf, 0x32, + 0x66, 0x59, 0xa6, 0xde, 0x1a, 0x03, 0x6e, 0x33, 0x20, 0xe1, 0x68, 0x14, + 0xb8, 0xc7, 0xf7, 0xe2, 0xe2, 0x52, 0x3f, 0x83, 0x56, 0x03, 0xe5, 0x7d, + 0xe9, 0x64, 0x9d, 0x64, 0x0f, 0x85, 0x29, 0x10, 0x20, 0x4b, 0x3a, 0x78, + 0x99, 0x42, 0x00, 0x22, 0x22, 0xeb, 0x24, 0x1b, 0x25, 0xd7, 0x2c, 0xf6, + 0xc3, 0x2b, 0xaf, 0x41, 0xfd, 0x57, 0x60, 0xc5, 0xc2, 0x19, 0x0e, 0x90, + 0x45, 0x4b, 0x5b, 0x61, 0x01, 0xd9, 0x00, 0x2e, 0x5b, 0x38, 0x7b, 0xca, + 0xfb, 0xd2, 0x49, 0x3a, 0xb0, 0x9f, 0xb7, 0xd8, 0x87, 0x03, 0x64, 0x1d, + 0xf8, 0xdb, 0x62, 0x1f, 0x96, 0x43, 0xfe, 0xb0, 0xd8, 0xf7, 0x84, 0x11, + 0x7b, 0x5f, 0x5c, 0xd4, 0xa9, 0x6f, 0xac, 0x60, 0x4c, 0xd7, 0x95, 0x96, + 0x82, 0xf2, 0x3e, 0xa8, 0x03, 0x9c, 0x26, 0x29, 0xda, 0x62, 0xda, 0x0c, + 0x64, 0xbe, 0x2c, 0x20, 0xe7, 0xb4, 0x99, 0x12, 0xc5, 0xc0, 0x42, 0xbf, + 0x05, 0xd2, 0x72, 0x03, 0xa2, 0x69, 0xeb, 0x34, 0x30, 0x67, 0x2c, 0x06, + 0x73, 0x47, 0xde, 0x0e, 0x31, 0x97, 0x6c, 0x76, 0xc7, 0x37, 0x7a, 0x2d, + 0x15, 0x48, 0x0c, 0x7c, 0xda, 0x70, 0x97, 0x74, 0x80, 0xa3, 0x24, 0xd5, + 0x1d, 0xfa, 0xfe, 0x2c, 0x91, 0x6b, 0x25, 0x07, 0x11, 0x59, 0x77, 0xce, + 0x9d, 0x20, 0xd9, 0x7d, 0x3b, 0x41, 0x33, 0x7f, 0x80, 0x3d, 0x0f, 0x1c, + 0x1b, 0xb4, 0xaa, 0x43, 0xee, 0x5f, 0x0c, 0x45, 0xa4, 0x0b, 0x9c, 0x6c, + 0xe8, 0x8c, 0x2b, 0x06, 0x8e, 0x0d, 0x32, 0x76, 0x14, 0x06, 0x24, 0x33, + 0x96, 0x1c, 0x69, 0x58, 0xea, 0x5a, 0x04, 0x0e, 0x0f, 0x9a, 0xaa, 0x0a, + 0x05, 0xa2, 0x33, 0xae, 0x13, 0x24, 0x75, 0xa5, 0x9a, 0x00, 0xe5, 0x4f, + 0xe0, 0x03, 0x60, 0xf8, 0x02, 0x34, 0x9e, 0x2a, 0xc8, 0x55, 0xb9, 0x68, + 0xd9, 0x76, 0xed, 0x12, 0xf0, 0x0e, 0x39, 0x15, 0x34, 0xf3, 0x59, 0xd6, + 0xef, 0xf7, 0x1a, 0xc2, 0xb8, 0x08, 0xbc, 0x4d, 0x8e, 0xd5, 0xe5, 0x7c, + 0xd6, 0x5a, 0x9c, 0x06, 0x7e, 0xac, 0x11, 0x8c, 0x55, 0xe0, 0x2d, 0xa0, + 0x5d, 0xe5, 0x9a, 0x8b, 0x8f, 0x01, 0x67, 0x6b, 0x00, 0xe3, 0x0a, 0xf0, + 0x2e, 0x70, 0x77, 0xa5, 0xab, 0x92, 0x2a, 0x98, 0x67, 0xa8, 0x66, 0x55, + 0xd2, 0x6c, 0x9a, 0x3a, 0x50, 0x04, 0x8c, 0x52, 0x80, 0x28, 0x94, 0x27, + 0x81, 0xef, 0x2a, 0x08, 0xe3, 0x02, 0xf0, 0x66, 0x51, 0x30, 0xbc, 0x15, + 0xc1, 0xec, 0x25, 0xe7, 0xdc, 0x0c, 0xf0, 0x06, 0x49, 0x65, 0xcf, 0xd0, + 0xb5, 0xaa, 0x30, 0x0e, 0x03, 0x87, 0x44, 0x64, 0xb9, 0xa8, 0x1b, 0x95, + 0x76, 0xc2, 0x8e, 0x88, 0x9c, 0x72, 0xce, 0xa5, 0x6f, 0xb7, 0x33, 0x84, + 0x5b, 0x23, 0x65, 0x19, 0xf8, 0x5a, 0x61, 0x7c, 0x2b, 0x22, 0xab, 0x85, + 0xfe, 0xa3, 0x96, 0x7d, 0x5c, 0x85, 0x16, 0xfa, 0x9a, 0x26, 0x29, 0x07, + 0x38, 0x13, 0x18, 0x88, 0x15, 0x7d, 0xe1, 0x2b, 0xd4, 0x15, 0x41, 0x38, + 0x24, 0xe3, 0x94, 0x18, 0x88, 0x9d, 0x73, 0xe7, 0xd5, 0x2d, 0x51, 0x89, + 0x60, 0xd2, 0xd4, 0xb4, 0x02, 0x7c, 0xa6, 0x4b, 0xe8, 0x73, 0x45, 0xbb, + 0x22, 0x28, 0x87, 0xf4, 0x70, 0x4b, 0xea, 0x98, 0xc8, 0x43, 0x2a, 0xfb, + 0x4f, 0x67, 0x4d, 0x1d, 0x85, 0xf1, 0x1b, 0xf0, 0xa1, 0x8f, 0xd4, 0x54, + 0x09, 0x20, 0x5b, 0xa4, 0xb2, 0x14, 0xd2, 0xad, 0xc0, 0xa3, 0x24, 0x45, + 0x0a, 0x86, 0x5d, 0xd6, 0xbf, 0x0c, 0x7c, 0xa5, 0xab, 0x07, 0x27, 0x15, + 0xc6, 0xd9, 0xb2, 0x20, 0x54, 0x02, 0x48, 0x0f, 0x38, 0x64, 0xdc, 0x32, + 0x46, 0x72, 0x4e, 0xd5, 0x0b, 0x24, 0x35, 0xe5, 0x6f, 0x46, 0x57, 0x80, + 0x2f, 0x81, 0x83, 0x3e, 0x0f, 0x68, 0xa9, 0x25, 0x90, 0x6d, 0x60, 0xed, + 0x24, 0x39, 0x14, 0x26, 0xbd, 0x66, 0xd5, 0x25, 0x39, 0xa7, 0xa4, 0x2b, + 0x22, 0x67, 0x2a, 0xd1, 0x1f, 0x3b, 0xe0, 0x3e, 0x2c, 0xd9, 0x1e, 0x43, + 0x03, 0x62, 0x32, 0x20, 0x06, 0xc4, 0x64, 0x40, 0x0c, 0x88, 0xc9, 0x80, + 0x18, 0x10, 0x93, 0x01, 0x31, 0x20, 0x26, 0x03, 0x62, 0x32, 0x20, 0x06, + 0xc4, 0x64, 0x40, 0x0c, 0x88, 0xc9, 0x80, 0x18, 0x10, 0x93, 0x01, 0x69, + 0xb2, 0xfe, 0x07, 0xb0, 0x6d, 0xc6, 0x8c, 0x41, 0x92, 0x78, 0x97, 0x00, + 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; diff --git a/tests/check/elements/mpeg4videoparse.c b/tests/check/elements/mpeg4videoparse.c new file mode 100644 index 0000000000..bd4de015ab --- /dev/null +++ b/tests/check/elements/mpeg4videoparse.c @@ -0,0 +1,193 @@ +/* + * GStreamer + * + * unit test for mpeg4videoparse + * + * Copyright (C) 2011 Nokia Corporation. All rights reserved. + * + * Contact: Stefan Kost + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include "parser.h" + +#define SRC_CAPS_TMPL "video/mpeg, framed=(boolean)false" +#define SINK_CAPS_TMPL "video/mpeg, framed=(boolean)true" + +GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (SINK_CAPS_TMPL) + ); + +GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (SRC_CAPS_TMPL) + ); + +/* some data */ + +/* codec data; VOS up to and including GOP */ +static guint8 mpeg4_config[] = { + 0x00, 0x00, 0x01, 0xb0, 0x01, 0x00, 0x00, 0x01, + 0xb5, 0x89, 0x13, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x01, 0x20, 0x00, 0xc4, 0x8d, 0x88, 0x00, + 0xf5, 0x01, 0x04, 0x03, 0x14, 0x63, 0x00, 0x00, + 0x01, 0xb3, 0x00, 0x10, 0x07 +}; + +/* keyframes all around */ +static guint8 mpeg4_iframe[] = { + 0x00, 0x00, 0x01, 0xb6, 0x10, 0x60, 0x91, 0x82, + 0x3d, 0xb7, 0xf1, 0xb6, 0xdf, 0xc6, 0xdb, 0x7f, + 0x1b, 0x6d, 0xfb +}; + +static gboolean +verify_buffer (buffer_verify_data_s * vdata, GstBuffer * buffer) +{ + /* header is merged in initial frame */ + if (vdata->buffer_counter == 0) { + /* the whole sequence header is included */ + fail_unless (GST_BUFFER_SIZE (buffer) == + ctx_headers[0].size + vdata->data_to_verify_size); + fail_unless (memcmp (GST_BUFFER_DATA (buffer), ctx_headers[0].data, + ctx_headers[0].size) == 0); + fail_unless (memcmp (GST_BUFFER_DATA (buffer) + ctx_headers[0].size, + vdata->data_to_verify, vdata->data_to_verify_size) == 0); + return TRUE; + } + + return FALSE; +} + +GST_START_TEST (test_parse_normal) +{ + gst_parser_test_normal (mpeg4_iframe, sizeof (mpeg4_iframe)); +} + +GST_END_TEST; + + +GST_START_TEST (test_parse_drain_single) +{ + gst_parser_test_drain_single (mpeg4_iframe, sizeof (mpeg4_iframe)); +} + +GST_END_TEST; + + +GST_START_TEST (test_parse_split) +{ + gst_parser_test_split (mpeg4_iframe, sizeof (mpeg4_iframe)); +} + +GST_END_TEST; + + +#define structure_get_int(s,f) \ + (g_value_get_int(gst_structure_get_value(s,f))) +#define fail_unless_structure_field_int_equals(s,field,num) \ + fail_unless_equals_int (structure_get_int(s,field), num) + +GST_START_TEST (test_parse_detect_stream) +{ + GstCaps *caps; + GstStructure *s; + GstBuffer *buf; + const GValue *val; + + caps = gst_parser_test_get_output_caps (mpeg4_iframe, sizeof (mpeg4_iframe), + NULL); + fail_unless (caps != NULL); + + /* Check that the negotiated caps are as expected */ + /* When codec_data is present, parser assumes that data is version 4 */ + GST_LOG ("mpeg4video output caps: %" GST_PTR_FORMAT, caps); + s = gst_caps_get_structure (caps, 0); + fail_unless (gst_structure_has_name (s, "video/mpeg")); + fail_unless_structure_field_int_equals (s, "mpegversion", 4); + fail_unless_structure_field_int_equals (s, "width", 32); + fail_unless_structure_field_int_equals (s, "height", 24); + fail_unless (gst_structure_has_field (s, "codec_data")); + + /* check codec-data in more detail */ + val = gst_structure_get_value (s, "codec_data"); + fail_unless (val != NULL); + buf = gst_value_get_buffer (val); + fail_unless (buf != NULL); + /* codec-data == config header - GOP */ + fail_unless (GST_BUFFER_SIZE (buf) == sizeof (mpeg4_config) - 7); + fail_unless (memcmp (GST_BUFFER_DATA (buf), mpeg4_config, + GST_BUFFER_SIZE (buf)) == 0); + + gst_caps_unref (caps); +} + +GST_END_TEST; + + +static Suite * +mpeg4videoparse_suite (void) +{ + Suite *s = suite_create ("mpeg4videoparse"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_parse_normal); + tcase_add_test (tc_chain, test_parse_drain_single); + tcase_add_test (tc_chain, test_parse_split); + tcase_add_test (tc_chain, test_parse_detect_stream); + + return s; +} + + +/* + * TODO: + * - Both push- and pull-modes need to be tested + * * Pull-mode & EOS + */ + +int +main (int argc, char **argv) +{ + int nf; + + Suite *s = mpeg4videoparse_suite (); + SRunner *sr = srunner_create (s); + + gst_check_init (&argc, &argv); + + /* init test context */ + ctx_factory = "mpeg4videoparse"; + ctx_sink_template = &sinktemplate; + ctx_src_template = &srctemplate; + ctx_headers[0].data = mpeg4_config; + ctx_headers[0].size = sizeof (mpeg4_config); + ctx_verify_buffer = verify_buffer; + /* no timing info to parse */ + ctx_no_metadata = TRUE; + + srunner_run_all (sr, CK_NORMAL); + nf = srunner_ntests_failed (sr); + srunner_free (sr); + + return nf; +} diff --git a/tests/check/elements/mpegvideoparse.c b/tests/check/elements/mpegvideoparse.c new file mode 100644 index 0000000000..9dac4633d2 --- /dev/null +++ b/tests/check/elements/mpegvideoparse.c @@ -0,0 +1,268 @@ +/* + * GStreamer + * + * unit test for mpegvideoparse + * + * Copyright (C) 2011 Nokia Corporation. All rights reserved. + * + * Contact: Stefan Kost + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include "parser.h" + +#define SRC_CAPS_TMPL "video/mpeg, framed=(boolean)false" +#define SINK_CAPS_TMPL "video/mpeg, framed=(boolean)true" + +GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (SINK_CAPS_TMPL) + ); + +GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (SRC_CAPS_TMPL) + ); + +/* some data */ + +/* actually seq + gop */ +static guint8 mpeg2_seq[] = { + 0x00, 0x00, 0x01, 0xb3, 0x02, 0x00, 0x18, 0x15, + 0xff, 0xff, 0xe0, 0x28, 0x00, 0x00, 0x01, 0xb5, + 0x14, 0x8a, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x01, 0xb8, 0x00, 0x08, 0x00, 0x00 +}; + +/* actually seq + gop */ +static guint8 mpeg1_seq[] = { + 0x00, 0x00, 0x01, 0xb3, 0x02, 0x00, 0x18, 0x15, + 0xff, 0xff, 0xe0, 0x28, 0x00, 0x00, 0x01, 0xb8, + 0x00, 0x08, 00, 00 +}; + +/* keyframes all around */ +static guint8 mpeg2_iframe[] = { + 0x00, 0x00, 0x01, 0x00, 0x00, 0x0f, 0xff, 0xf8, + 0x00, 0x00, 0x01, 0xb5, 0x8f, 0xff, 0xf3, 0x41, + 0x80, 0x00, 0x00, 0x01, 0x01, 0x23, 0xf8, 0x7d, + 0x29, 0x48, 0x8b, 0x94, 0xa5, 0x22, 0x20, 0x00, + 0x00, 0x01, 0x02, 0x23, 0xf8, 0x7d, 0x29, 0x48, + 0x8b, 0x94, 0xa5, 0x22, 0x20 +}; + +static gboolean +verify_buffer (buffer_verify_data_s * vdata, GstBuffer * buffer) +{ + /* check initial header special case, otherwise delegate to default */ + if (vdata->discard) { + /* header is separate */ + fail_unless (GST_BUFFER_SIZE (buffer) == ctx_headers[0].size - 8); + fail_unless (memcmp (GST_BUFFER_DATA (buffer), ctx_headers[0].data, + GST_BUFFER_SIZE (buffer)) == 0); + } else { + /* header is merged in initial frame */ + if (vdata->buffer_counter == 0) { + fail_unless (GST_BUFFER_SIZE (buffer) > 4); + if (GST_READ_UINT32_BE (GST_BUFFER_DATA (buffer)) == 0x1b3) { + /* the whole sequence header is included */ + fail_unless (GST_BUFFER_SIZE (buffer) == + ctx_headers[0].size + vdata->data_to_verify_size); + fail_unless (memcmp (GST_BUFFER_DATA (buffer), ctx_headers[0].data, + ctx_headers[0].size) == 0); + fail_unless (memcmp (GST_BUFFER_DATA (buffer) + ctx_headers[0].size, + vdata->data_to_verify, vdata->data_to_verify_size) == 0); + } else { + /* sequence was separate, only gop here */ + fail_unless (GST_BUFFER_SIZE (buffer) == + 8 + vdata->data_to_verify_size); + fail_unless (memcmp (GST_BUFFER_DATA (buffer), + ctx_headers[0].data + ctx_headers[0].size - 8, 8) == 0); + fail_unless (memcmp (GST_BUFFER_DATA (buffer) + 8, + vdata->data_to_verify, vdata->data_to_verify_size) == 0); + } + return TRUE; + } + } + + return FALSE; +} + +#define GOP_SPLIT "gop-split" + +static GstElement * +setup_element (const gchar * desc) +{ + GstElement *element; + + if (strcmp (desc, GOP_SPLIT) == 0) { + element = gst_check_setup_element ("mpegvideoparse"); + g_object_set (G_OBJECT (element), "gop-split", TRUE, NULL); + } else { + element = gst_check_setup_element ("mpegvideoparse"); + } + + return element; +} + +GST_START_TEST (test_parse_normal) +{ + gst_parser_test_normal (mpeg2_iframe, sizeof (mpeg2_iframe)); +} + +GST_END_TEST; + + +GST_START_TEST (test_parse_drain_single) +{ + gst_parser_test_drain_single (mpeg2_iframe, sizeof (mpeg2_iframe)); +} + +GST_END_TEST; + + +GST_START_TEST (test_parse_split) +{ + gst_parser_test_split (mpeg2_iframe, sizeof (mpeg2_iframe)); +} + +GST_END_TEST; + + +#define structure_get_int(s,f) \ + (g_value_get_int(gst_structure_get_value(s,f))) +#define fail_unless_structure_field_int_equals(s,field,num) \ + fail_unless_equals_int (structure_get_int(s,field), num) + +static void +mpeg_video_parse_check_caps (guint version, guint8 * seq, gint size) +{ + GstCaps *caps; + GstStructure *s; + GstBuffer *buf; + const GValue *val; + + ctx_headers[0].data = seq; + ctx_headers[0].size = size; + /* parser does not really care that mpeg1 and mpeg2 frame data + * should be a bit different */ + caps = gst_parser_test_get_output_caps (mpeg2_iframe, sizeof (mpeg2_iframe), + NULL); + fail_unless (caps != NULL); + + /* Check that the negotiated caps are as expected */ + /* When codec_data is present, parser assumes that data is version 4 */ + GST_LOG ("mpegvideo output caps: %" GST_PTR_FORMAT, caps); + s = gst_caps_get_structure (caps, 0); + fail_unless (gst_structure_has_name (s, "video/mpeg")); + fail_unless_structure_field_int_equals (s, "mpegversion", version); + fail_unless_structure_field_int_equals (s, "width", 32); + fail_unless_structure_field_int_equals (s, "height", 24); + fail_unless (gst_structure_has_field (s, "codec_data")); + + /* check codec-data in more detail */ + val = gst_structure_get_value (s, "codec_data"); + fail_unless (val != NULL); + buf = gst_value_get_buffer (val); + fail_unless (buf != NULL); + /* codec-data = header - GOP */ + fail_unless (GST_BUFFER_SIZE (buf) == size - 8); + fail_unless (memcmp (GST_BUFFER_DATA (buf), seq, GST_BUFFER_SIZE (buf)) == 0); + + gst_caps_unref (caps); +} + +GST_START_TEST (test_parse_detect_stream_mpeg2) +{ + mpeg_video_parse_check_caps (2, mpeg2_seq, sizeof (mpeg2_seq)); +} + +GST_END_TEST; + + +GST_START_TEST (test_parse_detect_stream_mpeg1) +{ + mpeg_video_parse_check_caps (1, mpeg1_seq, sizeof (mpeg1_seq)); +} + +GST_END_TEST; + + +GST_START_TEST (test_parse_gop_split) +{ + ctx_factory = GOP_SPLIT; + ctx_discard = 1; + gst_parser_test_normal (mpeg2_iframe, sizeof (mpeg2_iframe)); + ctx_factory = "mpegvideoparse"; + ctx_discard = 0; +} + +GST_END_TEST; + + +static Suite * +mpegvideoparse_suite (void) +{ + Suite *s = suite_create ("mpegvideoparse"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_parse_normal); + tcase_add_test (tc_chain, test_parse_drain_single); + tcase_add_test (tc_chain, test_parse_split); + tcase_add_test (tc_chain, test_parse_detect_stream_mpeg1); + tcase_add_test (tc_chain, test_parse_detect_stream_mpeg2); + tcase_add_test (tc_chain, test_parse_gop_split); + + return s; +} + + +/* + * TODO: + * - Both push- and pull-modes need to be tested + * * Pull-mode & EOS + */ + +int +main (int argc, char **argv) +{ + int nf; + + Suite *s = mpegvideoparse_suite (); + SRunner *sr = srunner_create (s); + + gst_check_init (&argc, &argv); + + /* init test context */ + ctx_factory = "mpegvideoparse"; + ctx_sink_template = &sinktemplate; + ctx_src_template = &srctemplate; + ctx_headers[0].data = mpeg2_seq; + ctx_headers[0].size = sizeof (mpeg2_seq); + ctx_verify_buffer = verify_buffer; + ctx_setup = setup_element; + + srunner_run_all (sr, CK_NORMAL); + nf = srunner_ntests_failed (sr); + srunner_free (sr); + + return nf; +} diff --git a/tests/check/elements/mxfmux.c b/tests/check/elements/mxfmux.c index 076496bdb9..6a531606d7 100644 --- a/tests/check/elements/mxfmux.c +++ b/tests/check/elements/mxfmux.c @@ -90,8 +90,6 @@ run_test (const gchar * pipeline_string) g_signal_connect (bus, "message", (GCallback) on_message_cb, &omud); - gst_object_unref (bus); - ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); fail_unless (ret == GST_STATE_CHANGE_SUCCESS || ret == GST_STATE_CHANGE_ASYNC); @@ -105,6 +103,8 @@ run_test (const gchar * pipeline_string) gst_object_unref (pipeline); g_main_loop_unref (loop); + gst_bus_remove_signal_watch (bus); + gst_object_unref (bus); } GST_START_TEST (test_mpeg2) diff --git a/tests/check/elements/ofa.c b/tests/check/elements/ofa.c index 4ccc1ac9c6..d1d61be560 100644 --- a/tests/check/elements/ofa.c +++ b/tests/check/elements/ofa.c @@ -84,11 +84,10 @@ GST_START_TEST (test_ofa_le_1ch) GstBus *bus; GMainLoop *loop; - GstCaps *caps; - gint64 position; GstFormat fmt = GST_FORMAT_TIME; + guint bus_watch = 0; pipeline = gst_pipeline_new ("pipeline"); fail_unless (pipeline != NULL); @@ -129,7 +128,7 @@ GST_START_TEST (test_ofa_le_1ch) bus = gst_element_get_bus (pipeline); fail_unless (bus != NULL); - gst_bus_add_watch (bus, bus_handler, loop); + bus_watch = gst_bus_add_watch (bus, bus_handler, loop); gst_object_unref (bus); found_fingerprint = FALSE; @@ -144,6 +143,7 @@ GST_START_TEST (test_ofa_le_1ch) fail_unless (found_fingerprint == TRUE); g_object_unref (pipeline); g_main_loop_unref (loop); + g_source_remove (bus_watch); } GST_END_TEST; @@ -153,14 +153,12 @@ GST_START_TEST (test_ofa_be_1ch) { GstElement *pipeline; GstElement *audiotestsrc, *audioconvert, *capsfilter, *ofa, *fakesink; - GstBus *bus; GMainLoop *loop; - GstCaps *caps; - gint64 position; GstFormat fmt = GST_FORMAT_TIME; + guint bus_watch = 0; pipeline = gst_pipeline_new ("pipeline"); fail_unless (pipeline != NULL); @@ -201,7 +199,7 @@ GST_START_TEST (test_ofa_be_1ch) bus = gst_element_get_bus (pipeline); fail_unless (bus != NULL); - gst_bus_add_watch (bus, bus_handler, loop); + bus_watch = gst_bus_add_watch (bus, bus_handler, loop); gst_object_unref (bus); found_fingerprint = FALSE; @@ -216,6 +214,7 @@ GST_START_TEST (test_ofa_be_1ch) fail_unless (found_fingerprint == TRUE); g_object_unref (pipeline); g_main_loop_unref (loop); + g_source_remove (bus_watch); } GST_END_TEST; @@ -224,14 +223,12 @@ GST_START_TEST (test_ofa_le_2ch) { GstElement *pipeline; GstElement *audiotestsrc, *audioconvert, *capsfilter, *ofa, *fakesink; - GstBus *bus; GMainLoop *loop; - GstCaps *caps; - gint64 position; GstFormat fmt = GST_FORMAT_TIME; + guint bus_watch = 0; pipeline = gst_pipeline_new ("pipeline"); fail_unless (pipeline != NULL); @@ -272,7 +269,7 @@ GST_START_TEST (test_ofa_le_2ch) bus = gst_element_get_bus (pipeline); fail_unless (bus != NULL); - gst_bus_add_watch (bus, bus_handler, loop); + bus_watch = gst_bus_add_watch (bus, bus_handler, loop); gst_object_unref (bus); found_fingerprint = FALSE; @@ -287,6 +284,7 @@ GST_START_TEST (test_ofa_le_2ch) fail_unless (found_fingerprint == TRUE); g_object_unref (pipeline); g_main_loop_unref (loop); + g_source_remove (bus_watch); } GST_END_TEST; @@ -296,14 +294,12 @@ GST_START_TEST (test_ofa_be_2ch) { GstElement *pipeline; GstElement *audiotestsrc, *audioconvert, *capsfilter, *ofa, *fakesink; - GstBus *bus; GMainLoop *loop; - GstCaps *caps; - gint64 position; GstFormat fmt = GST_FORMAT_TIME; + guint bus_watch = 0; pipeline = gst_pipeline_new ("pipeline"); fail_unless (pipeline != NULL); @@ -344,7 +340,7 @@ GST_START_TEST (test_ofa_be_2ch) bus = gst_element_get_bus (pipeline); fail_unless (bus != NULL); - gst_bus_add_watch (bus, bus_handler, loop); + bus_watch = gst_bus_add_watch (bus, bus_handler, loop); gst_object_unref (bus); found_fingerprint = FALSE; @@ -359,6 +355,7 @@ GST_START_TEST (test_ofa_be_2ch) fail_unless (found_fingerprint == TRUE); g_object_unref (pipeline); g_main_loop_unref (loop); + g_source_remove (bus_watch); } GST_END_TEST; diff --git a/tests/check/elements/parser.c b/tests/check/elements/parser.c index 7596889917..392f3ce57c 100644 --- a/tests/check/elements/parser.c +++ b/tests/check/elements/parser.c @@ -36,6 +36,9 @@ GstCaps *ctx_output_caps; guint ctx_discard = 0; datablob ctx_headers[MAX_HEADERS] = { {NULL, 0}, }; +VerifyBuffer ctx_verify_buffer = NULL; +ElementSetup ctx_setup = NULL; + gboolean ctx_no_metadata = FALSE; /* helper variables */ @@ -43,20 +46,6 @@ GList *current_buf = NULL; GstPad *srcpad, *sinkpad; guint dataoffset = 0; -GstClockTime ts_counter = 0; -gint64 offset_counter = 0; -guint buffer_counter = 0; - -typedef struct -{ - guint discard; - guint buffers_before_offset_skip; - guint offset_skip_amount; - const guint8 *data_to_verify; - guint data_to_verify_size; - GstCaps *caps; - gboolean no_metadata; -} buffer_verify_data_s; /* takes a copy of the passed buffer data */ static GstBuffer * @@ -107,28 +96,33 @@ buffer_verify_data (void *buffer, void *user_data) GST_DEBUG ("discard: %d", vdata->discard); if (vdata->discard) { - buffer_counter++; - if (buffer_counter == vdata->discard) { - buffer_counter = 0; + if (ctx_verify_buffer) + ctx_verify_buffer (vdata, buffer); + vdata->buffer_counter++; + vdata->offset_counter += GST_BUFFER_SIZE (buffer); + if (vdata->buffer_counter == vdata->discard) { + vdata->buffer_counter = 0; vdata->discard = 0; } return; } - fail_unless (GST_BUFFER_SIZE (buffer) == vdata->data_to_verify_size); - fail_unless (memcmp (GST_BUFFER_DATA (buffer), vdata->data_to_verify, - vdata->data_to_verify_size) == 0); + if (!ctx_verify_buffer || !ctx_verify_buffer (vdata, buffer)) { + fail_unless (GST_BUFFER_SIZE (buffer) == vdata->data_to_verify_size); + fail_unless (memcmp (GST_BUFFER_DATA (buffer), vdata->data_to_verify, + vdata->data_to_verify_size) == 0); + } if (vdata->buffers_before_offset_skip) { /* This is for skipping the garbage in some test cases */ - if (buffer_counter == vdata->buffers_before_offset_skip) { - offset_counter += vdata->offset_skip_amount; + if (vdata->buffer_counter == vdata->buffers_before_offset_skip) { + vdata->offset_counter += vdata->offset_skip_amount; } } if (!vdata->no_metadata) { - fail_unless (GST_BUFFER_TIMESTAMP (buffer) == ts_counter); + fail_unless (GST_BUFFER_TIMESTAMP (buffer) == vdata->ts_counter); fail_unless (GST_BUFFER_DURATION (buffer) != 0); - fail_unless (GST_BUFFER_OFFSET (buffer) == offset_counter); + fail_unless (GST_BUFFER_OFFSET (buffer) == vdata->offset_counter); } if (vdata->caps) { @@ -137,20 +131,25 @@ buffer_verify_data (void *buffer, void *user_data) fail_unless (gst_caps_is_equal (GST_BUFFER_CAPS (buffer), vdata->caps)); } - ts_counter += GST_BUFFER_DURATION (buffer); - offset_counter += GST_BUFFER_SIZE (buffer); - buffer_counter++; + vdata->ts_counter += GST_BUFFER_DURATION (buffer); + vdata->offset_counter += GST_BUFFER_SIZE (buffer); + vdata->buffer_counter++; } static GstElement * -setup_element (const gchar * factory, GstStaticPadTemplate * sink_template, +setup_element (const gchar * factory, ElementSetup setup, + GstStaticPadTemplate * sink_template, GstCaps * sink_caps, GstStaticPadTemplate * src_template, GstCaps * src_caps) { GstElement *element; GstBus *bus; - element = gst_check_setup_element (factory); + if (setup) { + element = setup (factory); + } else { + element = gst_check_setup_element (factory); + } srcpad = gst_check_setup_src_pad (element, src_template, src_caps); sinkpad = gst_check_setup_sink_pad (element, sink_template, sink_caps); gst_pad_set_active (srcpad, TRUE); @@ -163,7 +162,6 @@ setup_element (const gchar * factory, GstStaticPadTemplate * sink_template, GST_STATE_PLAYING) != GST_STATE_CHANGE_FAILURE, "could not set to playing"); - ts_counter = offset_counter = buffer_counter = 0; buffers = NULL; return element; } @@ -200,6 +198,7 @@ gst_parser_test_init (GstParserTest * ptest, guint8 * data, guint size, /* basics */ memset (ptest, 0, sizeof (*ptest)); ptest->factory = ctx_factory; + ptest->factory_setup = ctx_setup; ptest->sink_template = ctx_sink_template; ptest->src_template = ctx_src_template; ptest->framed = TRUE; @@ -224,15 +223,15 @@ gst_parser_test_init (GstParserTest * ptest, guint8 * data, guint size, void gst_parser_test_run (GstParserTest * test, GstCaps ** out_caps) { - buffer_verify_data_s vdata = { 0, 0, 0, NULL, 0, NULL, FALSE }; + buffer_verify_data_s vdata = { 0, 0, 0, NULL, 0, NULL, FALSE, 0, 0, 0 }; GstElement *element; GstBuffer *buffer = NULL; GstCaps *src_caps; guint i, j, k; guint frames = 0, size = 0; - element = setup_element (test->factory, test->sink_template, NULL, - test->src_template, test->src_caps); + element = setup_element (test->factory, test->factory_setup, + test->sink_template, NULL, test->src_template, test->src_caps); /* push some setup headers */ for (j = 0; j < G_N_ELEMENTS (test->headers) && test->headers[j].data; j++) { diff --git a/tests/check/elements/parser.h b/tests/check/elements/parser.h index 470f59421a..7ae85c515e 100644 --- a/tests/check/elements/parser.h +++ b/tests/check/elements/parser.h @@ -27,11 +27,29 @@ #define MAX_HEADERS 10 +typedef struct +{ + guint discard; + guint buffers_before_offset_skip; + guint offset_skip_amount; + const guint8 *data_to_verify; + guint data_to_verify_size; + GstCaps *caps; + gboolean no_metadata; + + GstClockTime ts_counter; + gint64 offset_counter; + guint buffer_counter; +} buffer_verify_data_s; + typedef struct { guint8 *data; guint size; } datablob; +typedef gboolean (*VerifyBuffer) (buffer_verify_data_s * vdata, GstBuffer * buf); +typedef GstElement* (*ElementSetup) (const gchar * desc); + /* context state variables; to be set by test using this helper */ /* mandatory */ extern const gchar *ctx_factory; @@ -44,10 +62,14 @@ extern guint ctx_discard; extern datablob ctx_headers[MAX_HEADERS]; extern gboolean ctx_no_metadata; +extern VerifyBuffer ctx_verify_buffer; +extern ElementSetup ctx_setup; + /* no refs taken/kept, all up to caller */ typedef struct { const gchar *factory; + ElementSetup factory_setup; GstStaticPadTemplate *sink_template; GstStaticPadTemplate *src_template; /* caps that go into element */ diff --git a/tests/check/elements/qtmux.c b/tests/check/elements/qtmux.c deleted file mode 100644 index 1db618cec9..0000000000 --- a/tests/check/elements/qtmux.c +++ /dev/null @@ -1,422 +0,0 @@ -/* GStreamer - * - * unit test for qtmux - * - * Copyright (C) <2008> Mark Nauwelaerts - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include - -#include - -/* For ease of programming we use globals to keep refs for our floating - * src and sink pads we create; otherwise we always have to do get_pad, - * get_peer, and then remove references in every test function */ -static GstPad *mysrcpad, *mysinkpad; - -#define AUDIO_CAPS_STRING "audio/mpeg, " \ - "mpegversion = (int) 1, " \ - "layer = (int) 3, " \ - "channels = (int) 2, " \ - "rate = (int) 48000" -#define VIDEO_CAPS_STRING "video/mpeg, " \ - "mpegversion = (int) 4, " \ - "width = (int) 384, " \ - "height = (int) 288, " \ - "framerate = (fraction) 25/1" - -static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("video/quicktime")); -static GstStaticPadTemplate srcvideotemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (VIDEO_CAPS_STRING)); - -static GstStaticPadTemplate srcaudiotemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (AUDIO_CAPS_STRING)); - - -/* setup and teardown needs some special handling for muxer */ -static GstPad * -setup_src_pad (GstElement * element, - GstStaticPadTemplate * template, GstCaps * caps, const gchar * sinkname) -{ - GstPad *srcpad, *sinkpad; - - GST_DEBUG_OBJECT (element, "setting up sending pad"); - /* sending pad */ - srcpad = gst_pad_new_from_static_template (template, "src"); - fail_if (srcpad == NULL, "Could not create a srcpad"); - ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1); - - if (!(sinkpad = gst_element_get_static_pad (element, sinkname))) - sinkpad = gst_element_get_request_pad (element, sinkname); - fail_if (sinkpad == NULL, "Could not get sink pad from %s", - GST_ELEMENT_NAME (element)); - /* references are owned by: 1) us, 2) qtmux, 3) collect pads */ - ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 3); - if (caps) - fail_unless (gst_pad_set_caps (srcpad, caps)); - fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK, - "Could not link source and %s sink pads", GST_ELEMENT_NAME (element)); - gst_object_unref (sinkpad); /* because we got it higher up */ - - /* references are owned by: 1) qtmux, 2) collect pads */ - ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2); - - return srcpad; -} - -static void -teardown_src_pad (GstPad * srcpad) -{ - GstPad *sinkpad; - - /* clean up floating src pad */ - sinkpad = gst_pad_get_peer (srcpad); - fail_if (sinkpad == NULL); - /* pad refs held by 1) qtmux 2) collectpads and 3) us (through _get_peer) */ - ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 3); - - gst_pad_unlink (srcpad, sinkpad); - - /* after unlinking, pad refs still held by - * 1) qtmux and 2) collectpads and 3) us (through _get_peer) */ - ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 3); - gst_object_unref (sinkpad); - /* one more ref is held by element itself */ - - /* pad refs held by creator */ - ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1); - gst_object_unref (srcpad); -} - -static GstElement * -setup_qtmux (GstStaticPadTemplate * srctemplate, const gchar * sinkname) -{ - GstElement *qtmux; - - GST_DEBUG ("setup_qtmux"); - qtmux = gst_check_setup_element ("qtmux"); - mysrcpad = setup_src_pad (qtmux, srctemplate, NULL, sinkname); - mysinkpad = gst_check_setup_sink_pad (qtmux, &sinktemplate, NULL); - gst_pad_set_active (mysrcpad, TRUE); - gst_pad_set_active (mysinkpad, TRUE); - - return qtmux; -} - -static void -cleanup_qtmux (GstElement * qtmux, const gchar * sinkname) -{ - GST_DEBUG ("cleanup_qtmux"); - gst_element_set_state (qtmux, GST_STATE_NULL); - - gst_pad_set_active (mysrcpad, FALSE); - gst_pad_set_active (mysinkpad, FALSE); - teardown_src_pad (mysrcpad); - gst_check_teardown_sink_pad (qtmux); - gst_check_teardown_element (qtmux); -} - -static void -check_qtmux_pad (GstStaticPadTemplate * srctemplate, const gchar * sinkname) -{ - GstElement *qtmux; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - int num_buffers; - int i; - guint8 data0[12] = "\000\000\000\024ftypqt "; - guint8 data1[8] = "\000\000\000\001mdat"; - guint8 data2[4] = "moov"; - - qtmux = setup_qtmux (srctemplate, sinkname); - fail_unless (gst_element_set_state (qtmux, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - inbuffer = gst_buffer_new_and_alloc (1); - caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad)); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - GST_BUFFER_TIMESTAMP (inbuffer) = 0; - GST_BUFFER_DURATION (inbuffer) = 40 * GST_MSECOND; - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - - /* send eos to have moov written */ - fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()) == TRUE); - - num_buffers = g_list_length (buffers); - /* at least expect ftyp, mdat header, buffer chunk and moov */ - fail_unless (num_buffers >= 4); - - for (i = 0; i < num_buffers; ++i) { - outbuffer = GST_BUFFER (buffers->data); - fail_if (outbuffer == NULL); - buffers = g_list_remove (buffers, outbuffer); - - switch (i) { - case 0: - { - /* ftyp header */ - guint8 *data = GST_BUFFER_DATA (outbuffer); - - fail_unless (GST_BUFFER_SIZE (outbuffer) >= 20); - fail_unless (memcmp (data, data0, sizeof (data0)) == 0); - fail_unless (memcmp (data + 16, data0 + 8, 4) == 0); - break; - } - case 1: /* mdat header */ - fail_unless (GST_BUFFER_SIZE (outbuffer) == 16); - fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), data1, sizeof (data1)) - == 0); - break; - case 2: /* buffer we put in */ - fail_unless (GST_BUFFER_SIZE (outbuffer) == 1); - break; - case 3: /* moov */ - fail_unless (GST_BUFFER_SIZE (outbuffer) > 8); - fail_unless (memcmp (GST_BUFFER_DATA (outbuffer) + 4, data2, - sizeof (data2)) == 0); - break; - default: - break; - } - - ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1); - gst_buffer_unref (outbuffer); - outbuffer = NULL; - } - - g_list_free (buffers); - buffers = NULL; - - cleanup_qtmux (qtmux, sinkname); -} - -static void -check_qtmux_pad_fragmented (GstStaticPadTemplate * srctemplate, - const gchar * sinkname, gboolean streamable) -{ - GstElement *qtmux; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - int num_buffers; - int i; - guint8 data0[12] = "\000\000\000\024ftypqt "; - guint8 data1[4] = "mdat"; - guint8 data2[4] = "moov"; - guint8 data3[4] = "moof"; - guint8 data4[4] = "mfra"; - - qtmux = setup_qtmux (srctemplate, sinkname); - g_object_set (qtmux, "fragment-duration", 2000, NULL); - g_object_set (qtmux, "streamable", streamable, NULL); - fail_unless (gst_element_set_state (qtmux, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - inbuffer = gst_buffer_new_and_alloc (1); - caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad)); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - GST_BUFFER_TIMESTAMP (inbuffer) = 0; - GST_BUFFER_DURATION (inbuffer) = 40 * GST_MSECOND; - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - - /* send eos to have all written */ - fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()) == TRUE); - - num_buffers = g_list_length (buffers); - /* at least expect ftyp, moov, moof, mdat header, buffer chunk - * and optionally mfra */ - fail_unless (num_buffers >= 5); - - for (i = 0; i < num_buffers; ++i) { - outbuffer = GST_BUFFER (buffers->data); - fail_if (outbuffer == NULL); - buffers = g_list_remove (buffers, outbuffer); - - switch (i) { - case 0: - { - /* ftyp header */ - guint8 *data = GST_BUFFER_DATA (outbuffer); - - fail_unless (GST_BUFFER_SIZE (outbuffer) >= 20); - fail_unless (memcmp (data, data0, sizeof (data0)) == 0); - fail_unless (memcmp (data + 16, data0 + 8, 4) == 0); - break; - } - case 1: /* moov */ - fail_unless (GST_BUFFER_SIZE (outbuffer) > 8); - fail_unless (memcmp (GST_BUFFER_DATA (outbuffer) + 4, data2, - sizeof (data2)) == 0); - break; - case 2: /* moof */ - fail_unless (GST_BUFFER_SIZE (outbuffer) > 8); - fail_unless (memcmp (GST_BUFFER_DATA (outbuffer) + 4, data3, - sizeof (data3)) == 0); - break; - case 3: /* mdat header */ - fail_unless (GST_BUFFER_SIZE (outbuffer) == 8); - fail_unless (memcmp (GST_BUFFER_DATA (outbuffer) + 4, data1, - sizeof (data1)) == 0); - break; - case 4: /* buffer we put in */ - fail_unless (GST_BUFFER_SIZE (outbuffer) == 1); - break; - case 5: /* mfra */ - fail_unless (GST_BUFFER_SIZE (outbuffer) > 8); - fail_unless (memcmp (GST_BUFFER_DATA (outbuffer) + 4, data4, - sizeof (data4)) == 0); - break; - default: - break; - } - - ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1); - gst_buffer_unref (outbuffer); - outbuffer = NULL; - } - - g_list_free (buffers); - buffers = NULL; - - cleanup_qtmux (qtmux, sinkname); -} - - -GST_START_TEST (test_video_pad) -{ - check_qtmux_pad (&srcvideotemplate, "video_%d"); -} - -GST_END_TEST; - -GST_START_TEST (test_audio_pad) -{ - check_qtmux_pad (&srcaudiotemplate, "audio_%d"); -} - -GST_END_TEST; - - -GST_START_TEST (test_video_pad_frag) -{ - check_qtmux_pad_fragmented (&srcvideotemplate, "video_%d", FALSE); -} - -GST_END_TEST; - -GST_START_TEST (test_audio_pad_frag) -{ - check_qtmux_pad_fragmented (&srcaudiotemplate, "audio_%d", FALSE); -} - -GST_END_TEST; - - -GST_START_TEST (test_video_pad_frag_streamable) -{ - check_qtmux_pad_fragmented (&srcvideotemplate, "video_%d", TRUE); -} - -GST_END_TEST; - - -GST_START_TEST (test_audio_pad_frag_streamable) -{ - check_qtmux_pad_fragmented (&srcaudiotemplate, "audio_%d", TRUE); -} - -GST_END_TEST; - - -GST_START_TEST (test_reuse) -{ - GstElement *qtmux = setup_qtmux (&srcvideotemplate, "video_%d"); - GstBuffer *inbuffer; - GstCaps *caps; - - gst_element_set_state (qtmux, GST_STATE_PLAYING); - gst_element_set_state (qtmux, GST_STATE_NULL); - gst_element_set_state (qtmux, GST_STATE_PLAYING); - gst_pad_set_active (mysrcpad, TRUE); - gst_pad_set_active (mysinkpad, TRUE); - - inbuffer = gst_buffer_new_and_alloc (1); - fail_unless (inbuffer != NULL); - caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad)); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - GST_BUFFER_TIMESTAMP (inbuffer) = 0; - GST_BUFFER_DURATION (inbuffer) = 40 * GST_MSECOND; - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - - /* send eos to have all written */ - fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()) == TRUE); - - cleanup_qtmux (qtmux, "video_%d"); -} - -GST_END_TEST; - -static Suite * -qtmux_suite (void) -{ - Suite *s = suite_create ("qtmux"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_video_pad); - tcase_add_test (tc_chain, test_audio_pad); - tcase_add_test (tc_chain, test_video_pad_frag); - tcase_add_test (tc_chain, test_audio_pad_frag); - tcase_add_test (tc_chain, test_video_pad_frag_streamable); - tcase_add_test (tc_chain, test_audio_pad_frag_streamable); - - tcase_add_test (tc_chain, test_reuse); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = qtmux_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/tests/check/elements/voaacenc.c b/tests/check/elements/voaacenc.c new file mode 100644 index 0000000000..22b42fbb3f --- /dev/null +++ b/tests/check/elements/voaacenc.c @@ -0,0 +1,287 @@ +/* GStreamer + * + * unit test for voaacenc + * + * Copyright (C) <2009> Mark Nauwelaerts + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include + +#include +#include + +/* For ease of programming we use globals to keep refs for our floating + * src and sink pads we create; otherwise we always have to do get_pad, + * get_peer, and then remove references in every test function */ +static GstPad *mysrcpad, *mysinkpad; + +#define AUDIO_CAPS_STRING "audio/x-raw-int, " \ + "rate = (int) 48000, " \ + "channels = (int) 2, " \ + "width = (int) 16, " \ + "depth = (int) 16, " \ + "signed = (boolean) true, " \ + "endianness = (int) BYTE_ORDER " + +#define AAC_RAW_CAPS_STRING "audio/mpeg, " \ + "mpegversion = (int) 4, " \ + "rate = (int) 48000, " \ + "channels = (int) 2, " \ + "stream-format = \"raw\"" + +#define AAC_ADTS_CAPS_STRING "audio/mpeg, " \ + "mpegversion = (int) 4, " \ + "rate = (int) 48000, " \ + "channels = (int) 2, " \ + "stream-format = \"adts\"" + + +static GstStaticPadTemplate sinktemplate_adts = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (AAC_ADTS_CAPS_STRING)); + +static GstStaticPadTemplate sinktemplate_raw = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (AAC_RAW_CAPS_STRING)); + + +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (AUDIO_CAPS_STRING)); + + +static GstElement * +setup_voaacenc (gboolean adts) +{ + GstElement *voaacenc; + + GST_DEBUG ("setup_voaacenc"); + voaacenc = gst_check_setup_element ("voaacenc"); + mysrcpad = gst_check_setup_src_pad (voaacenc, &srctemplate, NULL); + + if (adts) + mysinkpad = gst_check_setup_sink_pad (voaacenc, &sinktemplate_adts, NULL); + else + mysinkpad = gst_check_setup_sink_pad (voaacenc, &sinktemplate_raw, NULL); + + gst_pad_set_active (mysrcpad, TRUE); + gst_pad_set_active (mysinkpad, TRUE); + + return voaacenc; +} + +static void +cleanup_voaacenc (GstElement * voaacenc) +{ + GST_DEBUG ("cleanup_aacenc"); + gst_element_set_state (voaacenc, GST_STATE_NULL); + + gst_pad_set_active (mysrcpad, FALSE); + gst_pad_set_active (mysinkpad, FALSE); + gst_check_teardown_src_pad (voaacenc); + gst_check_teardown_sink_pad (voaacenc); + gst_check_teardown_element (voaacenc); +} + +static void +set_channel_positions (GstCaps * caps, int channels, + GstAudioChannelPosition * channelpositions) +{ + GValue chanpos = { 0 }; + GValue pos = { 0 }; + GstStructure *structure = gst_caps_get_structure (caps, 0); + int c; + + g_value_init (&chanpos, GST_TYPE_ARRAY); + g_value_init (&pos, GST_TYPE_AUDIO_CHANNEL_POSITION); + + for (c = 0; c < channels; c++) { + g_value_set_enum (&pos, channelpositions[c]); + gst_value_array_append_value (&chanpos, &pos); + } + g_value_unset (&pos); + + gst_structure_set_value (structure, "channel-positions", &chanpos); + g_value_unset (&chanpos); +} + +static void +do_test (gboolean adts) +{ + GstElement *voaacenc; + GstBuffer *inbuffer, *outbuffer; + GstCaps *caps; + gint i, num_buffers; + const gint nbuffers = 10; + GstAudioChannelPosition channel_position_layout[2] = + { GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, + GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT + }; + + voaacenc = setup_voaacenc (adts); + fail_unless (gst_element_set_state (voaacenc, + GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, + "could not set to playing"); + + /* corresponds to audio buffer mentioned in the caps */ + inbuffer = gst_buffer_new_and_alloc (1024 * nbuffers * 2 * 2); + /* makes valgrind's memcheck happier */ + memset (GST_BUFFER_DATA (inbuffer), 0, GST_BUFFER_SIZE (inbuffer)); + caps = gst_caps_from_string (AUDIO_CAPS_STRING); + + set_channel_positions (caps, 2, channel_position_layout); + + gst_buffer_set_caps (inbuffer, caps); + gst_caps_unref (caps); + GST_BUFFER_TIMESTAMP (inbuffer) = 0; + ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); + fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); + + /* send eos to have all flushed if needed */ + fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()) == TRUE); + + num_buffers = g_list_length (buffers); + fail_unless_equals_int (num_buffers, nbuffers); + + /* clean up buffers */ + for (i = 0; i < num_buffers; ++i) { + gint size, header = 0, id; + guint8 *data; + + outbuffer = GST_BUFFER (buffers->data); + fail_if (outbuffer == NULL); + + data = GST_BUFFER_DATA (outbuffer); + size = GST_BUFFER_SIZE (outbuffer); + + if (adts) { + gboolean protection; + gint k; + + fail_if (size < 7); + protection = !(data[1] & 0x1); + /* expect only 1 raw data block */ + k = (data[6] & 0x3) + 1; + fail_if (k != 1); + + header = 7; + if (protection) + header += (k - 1) * 2 + 2; + + /* check header */ + k = GST_READ_UINT16_BE (data) & 0xFFF6; + /* sync */ + fail_unless (k == 0xFFF0); + k = data[2]; + /* profile */ + fail_unless ((k >> 6) == 0x1); + /* rate */ + fail_unless (((k >> 2) & 0xF) == 0x3); + /* channels */ + fail_unless ((k & 0x1) == 0); + k = data[3]; + fail_unless ((k >> 6) == 0x2); + + } else { + GstCaps *caps; + GstStructure *s; + const GValue *value; + GstBuffer *buf; + gint k; + + caps = gst_buffer_get_caps (outbuffer); + fail_if (caps == NULL); + s = gst_caps_get_structure (caps, 0); + fail_if (s == NULL); + value = gst_structure_get_value (s, "codec_data"); + fail_if (value == NULL); + buf = gst_value_get_buffer (value); + fail_if (buf == NULL); + data = GST_BUFFER_DATA (buf); + size = GST_BUFFER_SIZE (buf); + fail_if (size < 2); + k = GST_READ_UINT16_BE (data); + /* profile, rate, channels */ + fail_unless ((k & 0xFFF8) == ((0x02 << 11) | (0x3 << 7) | (0x02 << 3))); + gst_caps_unref (caps); + + } + + fail_if (size <= header); + id = data[header] & (0x7 << 5); + /* allow all but ID_END or ID_LFE */ + fail_if (id == 7 || id == 3); + + buffers = g_list_remove (buffers, outbuffer); + + ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1); + gst_buffer_unref (outbuffer); + outbuffer = NULL; + } + + cleanup_voaacenc (voaacenc); + g_list_free (buffers); + buffers = NULL; +} + +GST_START_TEST (test_adts) +{ + do_test (TRUE); +} + +GST_END_TEST; + +GST_START_TEST (test_raw) +{ + do_test (FALSE); +} + +GST_END_TEST; + +static Suite * +voaacenc_suite (void) +{ + Suite *s = suite_create ("voaacenc"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_adts); + tcase_add_test (tc_chain, test_raw); + + return s; +} + +int +main (int argc, char **argv) +{ + int nf; + + Suite *s = voaacenc_suite (); + SRunner *sr = srunner_create (s); + + gst_check_init (&argc, &argv); + + srunner_run_all (sr, CK_NORMAL); + nf = srunner_ntests_failed (sr); + srunner_free (sr); + + return nf; +} diff --git a/tests/check/pipelines/mxf.c b/tests/check/pipelines/mxf.c index 9693bed046..675f446ec3 100644 --- a/tests/check/pipelines/mxf.c +++ b/tests/check/pipelines/mxf.c @@ -105,8 +105,6 @@ run_test (const gchar * pipeline_string, gint n_pads_expected) g_signal_connect (bus, "message", (GCallback) on_message_cb, &omud); - gst_object_unref (bus); - ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); fail_unless (ret == GST_STATE_CHANGE_SUCCESS || ret == GST_STATE_CHANGE_ASYNC); @@ -121,6 +119,8 @@ run_test (const gchar * pipeline_string, gint n_pads_expected) gst_object_unref (pipeline); g_main_loop_unref (loop); + gst_bus_remove_signal_watch (bus); + gst_object_unref (bus); } GST_START_TEST (test_mpeg2) diff --git a/tests/check/pipelines/tagschecking.c b/tests/check/pipelines/tagschecking.c deleted file mode 100644 index 91a556c52f..0000000000 --- a/tests/check/pipelines/tagschecking.c +++ /dev/null @@ -1,350 +0,0 @@ -/* GStreamer - * Copyright (C) 2008 Nokia Corporation. (contact ) - * Copyright (C) 2010 Thiago Santos - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include - -static GstTagList *received_tags = NULL; - -static gboolean -bus_handler (GstBus * bus, GstMessage * message, gpointer data) -{ - GMainLoop *loop = (GMainLoop *) data; - - switch (message->type) { - case GST_MESSAGE_EOS: - g_main_loop_quit (loop); - break; - case GST_MESSAGE_WARNING: - case GST_MESSAGE_ERROR:{ - GError *gerror; - - gchar *debug; - - gst_message_parse_error (message, &gerror, &debug); - gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); - g_error_free (gerror); - g_free (debug); - g_main_loop_quit (loop); - break; - } - case GST_MESSAGE_TAG:{ - if (received_tags == NULL) { - gst_message_parse_tag (message, &received_tags); - } else { - GstTagList *tl = NULL, *ntl = NULL; - - gst_message_parse_tag (message, &tl); - if (tl) { - ntl = gst_tag_list_merge (received_tags, tl, GST_TAG_MERGE_PREPEND); - if (ntl) { - GST_LOG ("taglists merged: %" GST_PTR_FORMAT, ntl); - gst_tag_list_free (received_tags); - received_tags = ntl; - } - gst_tag_list_free (tl); - } - } - break; - } - default: - break; - } - - return TRUE; -} - -/* - * Creates a pipeline in the form: - * fakesrc num-buffers=1 ! caps ! muxer ! filesink location=file - * - * And sets the tags in tag_str into the muxer via tagsetter. - */ -static void -test_mux_tags (const gchar * tag_str, const gchar * caps, - const gchar * muxer, const gchar * file) -{ - GstElement *pipeline; - GstBus *bus; - GMainLoop *loop; - GstTagList *sent_tags; - GstElement *mux; - GstTagSetter *setter; - gchar *launch_str; - - GST_DEBUG ("testing xmp muxing on : %s", muxer); - - launch_str = g_strdup_printf ("fakesrc num-buffers=1 ! %s ! %s name=mux ! " - "filesink location=%s name=sink", caps, muxer, file); - pipeline = gst_parse_launch (launch_str, NULL); - g_free (launch_str); - fail_unless (pipeline != NULL); - - mux = gst_bin_get_by_name (GST_BIN (pipeline), "mux"); - fail_unless (mux != NULL); - - loop = g_main_loop_new (NULL, TRUE); - fail_unless (loop != NULL); - - bus = gst_element_get_bus (pipeline); - fail_unless (bus != NULL); - gst_bus_add_watch (bus, bus_handler, loop); - gst_object_unref (bus); - - gst_element_set_state (pipeline, GST_STATE_READY); - - setter = GST_TAG_SETTER (mux); - fail_unless (setter != NULL); - sent_tags = gst_structure_from_string (tag_str, NULL); - fail_unless (sent_tags != NULL); - gst_tag_setter_merge_tags (setter, sent_tags, GST_TAG_MERGE_REPLACE); - gst_tag_list_free (sent_tags); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - g_main_loop_run (loop); - - gst_element_set_state (pipeline, GST_STATE_NULL); - - g_main_loop_unref (loop); - g_object_unref (mux); - g_object_unref (pipeline); -} - -/* - * Makes a pipeline in the form: - * filesrc location=file ! demuxer ! fakesink - * - * And gets the tags that are posted on the bus to compare - * with the tags in 'tag_str' - */ -static void -test_demux_tags (const gchar * tag_str, const gchar * demuxer, - const gchar * file) -{ - GstElement *pipeline; - GstBus *bus; - GMainLoop *loop; - GstTagList *sent_tags; - gint i, j, n_recv, n_sent; - const gchar *name_sent, *name_recv; - const GValue *value_sent, *value_recv; - gboolean found; - gint comparison; - GstElement *demux; - gchar *launch_str; - - GST_DEBUG ("testing tags : %s", tag_str); - - if (received_tags) { - gst_tag_list_free (received_tags); - received_tags = NULL; - } - - launch_str = g_strdup_printf ("filesrc location=%s ! %s name=demux ! " - "fakesink", file, demuxer); - pipeline = gst_parse_launch (launch_str, NULL); - g_free (launch_str); - fail_unless (pipeline != NULL); - - demux = gst_bin_get_by_name (GST_BIN (pipeline), "demux"); - fail_unless (demux != NULL); - - loop = g_main_loop_new (NULL, TRUE); - fail_unless (loop != NULL); - - bus = gst_element_get_bus (pipeline); - fail_unless (bus != NULL); - gst_bus_add_watch (bus, bus_handler, loop); - gst_object_unref (bus); - - sent_tags = gst_structure_from_string (tag_str, NULL); - fail_unless (sent_tags != NULL); - - gst_element_set_state (pipeline, GST_STATE_PLAYING); - g_main_loop_run (loop); - - GST_DEBUG ("mainloop done : %p", received_tags); - - /* verify tags */ - fail_unless (received_tags != NULL); - n_recv = gst_structure_n_fields (received_tags); - n_sent = gst_structure_n_fields (sent_tags); - fail_unless (n_recv >= n_sent); - /* FIXME: compare taglits values */ - for (i = 0; i < n_sent; i++) { - name_sent = gst_structure_nth_field_name (sent_tags, i); - value_sent = gst_structure_get_value (sent_tags, name_sent); - found = FALSE; - for (j = 0; j < n_recv; j++) { - name_recv = gst_structure_nth_field_name (received_tags, j); - if (!strcmp (name_sent, name_recv)) { - value_recv = gst_structure_get_value (received_tags, name_recv); - comparison = gst_value_compare (value_sent, value_recv); - if (comparison != GST_VALUE_EQUAL) { - gchar *vs = g_strdup_value_contents (value_sent); - gchar *vr = g_strdup_value_contents (value_recv); - GST_DEBUG ("sent = %s:'%s', recv = %s:'%s'", - G_VALUE_TYPE_NAME (value_sent), vs, - G_VALUE_TYPE_NAME (value_recv), vr); - g_free (vs); - g_free (vr); - } - fail_unless (comparison == GST_VALUE_EQUAL, - "tag item %s has been received with different type or value", - name_sent); - found = TRUE; - break; - } - } - fail_unless (found, "tag item %s is lost", name_sent); - } - - gst_tag_list_free (received_tags); - received_tags = NULL; - gst_tag_list_free (sent_tags); - - gst_element_set_state (pipeline, GST_STATE_NULL); - - g_main_loop_unref (loop); - g_object_unref (demux); - g_object_unref (pipeline); -} - -/* - * Tests if the muxer/demuxer pair can serialize the tags in 'tag_str' - * to a file and recover them correctly. - * - * 'caps' are used to assure the muxer accepts the fake buffer fakesrc - * will send to it. - */ -static void -test_tags (const gchar * tag_str, const gchar * caps, const gchar * muxer, - const gchar * demuxer) -{ - gchar *tmpfile; - gchar *tmp; - - tmp = g_strdup_printf ("%s%d", "gst-check-xmp-test-", g_random_int ()); - tmpfile = g_build_filename (g_get_tmp_dir (), tmp, NULL); - g_free (tmp); - - GST_DEBUG ("testing tags : %s", tag_str); - test_mux_tags (tag_str, caps, muxer, tmpfile); - test_demux_tags (tag_str, demuxer, tmpfile); - g_free (tmpfile); -} - -#define H264_CAPS "video/x-h264, width=(int)320, height=(int)240," \ - " framerate=(fraction)30/1, codec_data=(buffer)" \ - "01401592ffe10017674d401592540a0fd8088000000300" \ - "8000001e478b175001000468ee3c80, stream-format=(string)avc" - -#define COMMON_TAGS \ - "taglist,title=test_title," \ - "artist=test_artist," \ - "keywords=\"key1,key2\"," \ - "description=test_desc" - -GST_START_TEST (test_common_tags) -{ - if (!gst_default_registry_check_feature_version ("qtdemux", 0, 10, 23)) { - GST_INFO ("Skipping test, qtdemux either not available or too old"); - return; - } - test_tags (COMMON_TAGS, H264_CAPS, "qtmux", "qtdemux"); - test_tags (COMMON_TAGS, H264_CAPS, "mp4mux", "qtdemux"); - test_tags (COMMON_TAGS, H264_CAPS, "gppmux", "qtdemux"); -} - -GST_END_TEST; - -#define GEO_LOCATION_TAGS \ - "taglist,geo-location-country=Brazil," \ - "geo-location-city=\"Campina Grande\"," \ - "geo-location-sublocation=Bodocongo," \ - "geo-location-latitude=-12.125," \ - "geo-location-longitude=56.75," \ - "geo-location-elevation=327.5" - -GST_START_TEST (test_geo_location_tags) -{ - if (!gst_default_registry_check_feature_version ("qtdemux", 0, 10, 23)) { - GST_INFO ("Skipping test, qtdemux either not available or too old"); - return; - } - test_tags (GEO_LOCATION_TAGS, H264_CAPS, "qtmux", "qtdemux"); - test_tags (GEO_LOCATION_TAGS, H264_CAPS, "mp4mux", "qtdemux"); - test_tags (GEO_LOCATION_TAGS, H264_CAPS, "gppmux", "qtdemux"); -} - -GST_END_TEST; - - -#define USER_TAGS \ - "taglist,user-rating=(uint)85" - -GST_START_TEST (test_user_tags) -{ - if (!gst_default_registry_check_feature_version ("qtdemux", 0, 10, 23)) { - GST_INFO ("Skipping test, qtdemux either not available or too old"); - return; - } - - test_tags (USER_TAGS, H264_CAPS, "qtmux", "qtdemux"); - test_tags (USER_TAGS, H264_CAPS, "mp4mux", "qtdemux"); - test_tags (USER_TAGS, H264_CAPS, "gppmux", "qtdemux"); -} - -GST_END_TEST; - -static Suite * -metadata_suite (void) -{ - Suite *s = suite_create ("tagschecking"); - - TCase *tc_chain = tcase_create ("general"); - - /* time out after 60s, not the default 3 */ - tcase_set_timeout (tc_chain, 60); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_common_tags); - tcase_add_test (tc_chain, test_geo_location_tags); - tcase_add_test (tc_chain, test_user_tags); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = metadata_suite (); - - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/tests/examples/camerabin/gst-camerabin-test.c b/tests/examples/camerabin/gst-camerabin-test.c index 73399e5953..27037fad3f 100644 --- a/tests/examples/camerabin/gst-camerabin-test.c +++ b/tests/examples/camerabin/gst-camerabin-test.c @@ -61,6 +61,7 @@ --video-enc Video encoder used in video recording --image-enc Image encoder used in still capture --image-pp Image post-processing element + --image-formatter Image metadata formatter element --video-mux Muxer used in video recording --viewfinder-sink Viewfinder sink (default = fakesink) --image-width Width for image capture @@ -126,6 +127,7 @@ static gchar *audioenc_name = NULL; static gchar *videoenc_name = NULL; static gchar *imageenc_name = NULL; static gchar *imagepp_name = NULL; +static gchar *imageformatter_name = NULL; static gchar *videomux_name = NULL; static gchar *vfsink_name = NULL; static gchar *src_csp = NULL; @@ -514,6 +516,7 @@ setup_pipeline (void) res &= setup_pipeline_element ("video-encoder", videoenc_name, NULL); res &= setup_pipeline_element ("image-encoder", imageenc_name, &ienc); + res &= setup_pipeline_element ("image-formatter", imageformatter_name, NULL); res &= setup_pipeline_element ("video-muxer", videomux_name, &vmux); if (!res) { goto error; @@ -747,6 +750,8 @@ main (int argc, char *argv[]) "Image encoder used in still capture", NULL}, {"image-pp", '\0', 0, G_OPTION_ARG_STRING, &imagepp_name, "List of image post-processing elements separated with comma", NULL}, + {"image-formatter", '\0', 0, G_OPTION_ARG_STRING, &imageformatter_name, + "Image metadata formatter used in still image capture", NULL}, {"video-mux", '\0', 0, G_OPTION_ARG_STRING, &videomux_name, "Muxer used in video recording", NULL}, {"viewfinder-sink", '\0', 0, G_OPTION_ARG_STRING, &vfsink_name, @@ -829,6 +834,7 @@ main (int argc, char *argv[]) g_free (audioenc_name); g_free (videoenc_name); g_free (imageenc_name); + g_free (imageformatter_name); g_free (imagepp_name); g_free (videomux_name); g_free (vfsink_name); diff --git a/tests/examples/camerabin2/.gitignore b/tests/examples/camerabin2/.gitignore index 4a17e8d5c2..715a3e2e70 100644 --- a/tests/examples/camerabin2/.gitignore +++ b/tests/examples/camerabin2/.gitignore @@ -1,4 +1,5 @@ gst-camera2 +gst-camerabin2-test test_*.jpg vid_* img_* diff --git a/tests/examples/camerabin2/Makefile.am b/tests/examples/camerabin2/Makefile.am index 5fa7534712..6b38bd2786 100644 --- a/tests/examples/camerabin2/Makefile.am +++ b/tests/examples/camerabin2/Makefile.am @@ -27,7 +27,27 @@ else GST_CAMERABIN_GTK_EXAMPLES = endif -noinst_PROGRAMS = $(GST_CAMERABIN_GTK_EXAMPLES) +if HAVE_X11 + +GST_CAMERABIN_X11_EXAMPLES = gst-camerabin2-test + +gst_camerabin2_test_SOURCES = gst-camerabin2-test.c +gst_camerabin2_test_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_PLUGINS_BAD_CFLAGS) +gst_camerabin2_test_LDADD = \ + $(top_builddir)/gst-libs/gst/interfaces/libgstphotography-@GST_MAJORMINOR@.la \ + $(GST_PLUGINS_BASE_LIBS) \ + -lgstinterfaces-@GST_MAJORMINOR@ \ + -lgstpbutils-@GST_MAJORMINOR@ \ + -lgstvideo-@GST_MAJORMINOR@ \ + $(GST_BASE_LIBS) \ + $(GST_LIBS) \ + $(X11_LIBS) + +else +GST_CAMERABIN_X11_EXAMPLES = +endif + +noinst_PROGRAMS = $(GST_CAMERABIN_GTK_EXAMPLES) $(GST_CAMERABIN_X11_EXAMPLES) EXTRA_DIST = $(GST_CAMERABIN_UI_FILES) diff --git a/tests/examples/camerabin2/gst-camerabin2-test.c b/tests/examples/camerabin2/gst-camerabin2-test.c new file mode 100644 index 0000000000..55d1a04d1f --- /dev/null +++ b/tests/examples/camerabin2/gst-camerabin2-test.c @@ -0,0 +1,920 @@ +/* + * GStreamer + * Copyright (C) 2010 Nokia Corporation + * Copyright (C) 2011 Thiago Santos + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + + /* + TODO review + Examples: + ./gst-camerabin2-test --image-width=2048 --image-height=1536 + ./gst-camerabin2-test --mode=2 --capture-time=10 --image-width=848 --image-height=480 --view-framerate-num=2825 \ + --view-framerate-den=100 + + gst-camerabin2-test --help + Usage: + gst-camerabin2-test [OPTION...] + + camerabin command line test application. + + Help Options: + -h, --help Show help options + --help-all Show all help options + --help-gst Show GStreamer Options + + Application Options: + --ev-compensation EV compensation (-2.5..2.5, default = 0) + --aperture Aperture (size of lens opening, default = 0 (auto)) + --flash-mode Flash mode (default = 0 (auto)) + --scene-mode Scene mode (default = 6 (auto)) + --exposure Exposure (default = 0 (auto)) + --iso-speed ISO speed (default = 0 (auto)) + --white-balance-mode White balance mode (default = 0 (auto)) + --colour-tone-mode Colour tone mode (default = 0 (auto)) + --directory Directory for capture file(s) (default is current directory) + --mode Capture mode (default = 0 (image), 1 = video) + --capture-time Time to capture video in seconds (default = 10) + --capture-total Total number of captures to be done (default = 1) + --zoom Zoom (100 = 1x (default), 200 = 2x etc.) + --wrapper-source Camera source wrapper used for setting the video source + --video-source Video source used in still capture and video recording + --video-device Video device to be set on the video source (e.g. /dev/video0) + --audio-source Audio source used in video recording + --image-pp List of image post-processing elements separated with comma + --viewfinder-sink Viewfinder sink (default = fakesink) + --image-width Width for capture (only used if the caps + arguments aren't set) + --image-height Height for capture (only used if the caps + arguments aren't set) + --view-framerate-num Framerate numerator for viewfinder + --view-framerate-den Framerate denominator for viewfinder + --preview-caps Preview caps (e.g. video/x-raw-rgb,width=320,height=240) + --viewfinder-filter Filter to process all frames going to viewfinder sink + --x-width X window width (default = 320) + --x-height X window height (default = 240) + --no-xwindow Do not create XWindow + --encoding-target Video encoding target name + --encoding-profile Video encoding profile name + --encoding-profile-filename Video encoding profile filename + --image-capture-caps Image capture caps (e.g. video/x-raw-rgb,width=640,height=480) + --viewfinder-caps Viewfinder caps (e.g. video/x-raw-rgb,width=640,height=480) + --video-capture-caps Video capture caps (e.g. video/x-raw-rgb,width=640,height=480) + + */ + +/* + * Includes + */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#define GST_USE_UNSTABLE_API 1 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +/* + * debug logging + */ +GST_DEBUG_CATEGORY_STATIC (camerabin_test); +#define GST_CAT_DEFAULT camerabin_test +typedef struct _ResultType +{ + GstClockTime avg; + GstClockTime min; + GstClockTime max; + guint32 times; +} ResultType; + +/* + * Global vars + */ +static GstElement *camerabin = NULL; +static GMainLoop *loop = NULL; + +/* commandline options */ +static gchar *videosrc_name = NULL; +static gchar *videodevice_name = NULL; +static gchar *audiosrc_name = NULL; +static gchar *wrappersrc_name = NULL; +static gchar *imagepp_name = NULL; +static gchar *vfsink_name = NULL; +static gint image_width = 0; +static gint image_height = 0; +static gint view_framerate_num = 0; +static gint view_framerate_den = 0; +static gboolean no_xwindow = FALSE; +static gchar *gep_targetname = NULL; +static gchar *gep_profilename = NULL; +static gchar *gep_filename = NULL; +static gchar *image_capture_caps_str = NULL; +static gchar *viewfinder_caps_str = NULL; +static gchar *video_capture_caps_str = NULL; + + +#define MODE_VIDEO 2 +#define MODE_IMAGE 1 +static gint mode = MODE_IMAGE; +static gint zoom = 100; + +static gint capture_time = 10; +static gint capture_count = 0; +static gint capture_total = 1; +static gulong stop_capture_cb_id = 0; + +/* photography interface command line options */ +#define EV_COMPENSATION_NONE -G_MAXFLOAT +#define APERTURE_NONE -G_MAXINT +#define FLASH_MODE_NONE -G_MAXINT +#define SCENE_MODE_NONE -G_MAXINT +#define EXPOSURE_NONE -G_MAXINT64 +#define ISO_SPEED_NONE -G_MAXINT +#define WHITE_BALANCE_MODE_NONE -G_MAXINT +#define COLOR_TONE_MODE_NONE -G_MAXINT +static gfloat ev_compensation = EV_COMPENSATION_NONE; +static gint aperture = APERTURE_NONE; +static gint flash_mode = FLASH_MODE_NONE; +static gint scene_mode = SCENE_MODE_NONE; +static gint64 exposure = EXPOSURE_NONE; +static gint iso_speed = ISO_SPEED_NONE; +static gint wb_mode = WHITE_BALANCE_MODE_NONE; +static gint color_mode = COLOR_TONE_MODE_NONE; + +static gchar *viewfinder_filter = NULL; + +static int x_width = 320; +static int x_height = 240; + +/* test configuration for common callbacks */ +static GString *filename = NULL; + +static gchar *preview_caps_name = NULL; + +/* X window variables */ +static Display *display = NULL; +static Window window = 0; + +GTimer *timer = NULL; + +/* + * Prototypes + */ +static gboolean run_pipeline (gpointer user_data); +static void set_metadata (GstElement * camera); + +static void +create_host_window (void) +{ + unsigned long valuemask; + XSetWindowAttributes attributes; + + display = XOpenDisplay (NULL); + if (display) { + window = + XCreateSimpleWindow (display, DefaultRootWindow (display), 0, 0, + x_width, x_height, 0, 0, 0); + if (window) { + valuemask = CWOverrideRedirect; + attributes.override_redirect = True; + XChangeWindowAttributes (display, window, valuemask, &attributes); + XSetWindowBackgroundPixmap (display, window, None); + XMapRaised (display, window); + XSync (display, FALSE); + } else { + GST_DEBUG ("could not create X window!"); + } + } else { + GST_DEBUG ("could not open display!"); + } +} + +static GstBusSyncReply +sync_bus_callback (GstBus * bus, GstMessage * message, gpointer data) +{ + const GstStructure *st; + const GValue *image; + GstBuffer *buf = NULL; + guint8 *data_buf = NULL; + gchar *caps_string; + guint size = 0; + gchar *preview_filename = NULL; + FILE *f = NULL; + size_t written; + + switch (GST_MESSAGE_TYPE (message)) { + case GST_MESSAGE_ELEMENT:{ + st = gst_message_get_structure (message); + if (st) { + if (gst_structure_has_name (message->structure, "prepare-xwindow-id")) { + if (!no_xwindow && window) { + gst_x_overlay_set_window_handle (GST_X_OVERLAY (GST_MESSAGE_SRC + (message)), window); + gst_message_unref (message); + message = NULL; + return GST_BUS_DROP; + } + } else if (gst_structure_has_name (st, "preview-image")) { + GST_DEBUG ("preview-image"); + /* extract preview-image from msg */ + image = gst_structure_get_value (st, "buffer"); + if (image) { + buf = gst_value_get_buffer (image); + data_buf = GST_BUFFER_DATA (buf); + size = GST_BUFFER_SIZE (buf); + preview_filename = g_strdup_printf ("test_vga.rgb"); + caps_string = gst_caps_to_string (GST_BUFFER_CAPS (buf)); + g_print ("writing buffer to %s, elapsed: %.2fs, buffer caps: %s\n", + preview_filename, g_timer_elapsed (timer, NULL), caps_string); + g_free (caps_string); + f = g_fopen (preview_filename, "w"); + if (f) { + written = fwrite (data_buf, size, 1, f); + if (!written) { + g_print ("error writing file\n"); + } + fclose (f); + } else { + g_print ("error opening file for raw image writing\n"); + } + g_free (preview_filename); + } + } + } + break; + } + default: + /* unhandled message */ + break; + } + return GST_BUS_PASS; +} + +static gboolean +bus_callback (GstBus * bus, GstMessage * message, gpointer data) +{ + switch (GST_MESSAGE_TYPE (message)) { + case GST_MESSAGE_ERROR:{ + GError *err; + gchar *debug; + + gst_message_parse_error (message, &err, &debug); + g_print ("Error: %s\n", err->message); + g_error_free (err); + g_free (debug); + + /* Write debug graph to file */ + GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (camerabin), + GST_DEBUG_GRAPH_SHOW_ALL, "camerabin.error"); + + g_main_loop_quit (loop); + break; + } + case GST_MESSAGE_STATE_CHANGED: + if (GST_IS_BIN (GST_MESSAGE_SRC (message))) { + GstState oldstate, newstate; + + gst_message_parse_state_changed (message, &oldstate, &newstate, NULL); + GST_DEBUG_OBJECT (GST_MESSAGE_SRC (message), "state-changed: %s -> %s", + gst_element_state_get_name (oldstate), + gst_element_state_get_name (newstate)); + } + break; + case GST_MESSAGE_EOS: + /* end-of-stream */ + GST_INFO ("got eos() - should not happen"); + g_main_loop_quit (loop); + break; + case GST_MESSAGE_ELEMENT: + if (GST_MESSAGE_SRC (message) == (GstObject *) camerabin) { + const GstStructure *structure = gst_message_get_structure (message); + + if (gst_structure_has_name (structure, "image-done")) { +#ifndef GST_DISABLE_GST_DEBUG + const gchar *fname = gst_structure_get_string (structure, "filename"); + + GST_DEBUG ("image done: %s", fname); +#endif + if (capture_count < capture_total) { + g_idle_add ((GSourceFunc) run_pipeline, NULL); + } else { + g_main_loop_quit (loop); + } + } + } + break; + default: + /* unhandled message */ + break; + } + return TRUE; +} + +/* + * Helpers + */ + +static void +cleanup_pipeline (void) +{ + if (camerabin) { + GST_INFO_OBJECT (camerabin, "stopping and destroying"); + gst_element_set_state (camerabin, GST_STATE_NULL); + gst_object_unref (camerabin); + camerabin = NULL; + } +} + +static GstElement * +create_ipp_bin (void) +{ + GstElement *bin = NULL, *element = NULL; + GstPad *pad = NULL; + gchar **elements; + GList *element_list = NULL, *current = NULL, *next = NULL; + int i; + + bin = gst_bin_new ("ippbin"); + + elements = g_strsplit (imagepp_name, ",", 0); + + for (i = 0; elements[i] != NULL; i++) { + element = gst_element_factory_make (elements[i], NULL); + if (element) { + element_list = g_list_append (element_list, element); + gst_bin_add (GST_BIN (bin), element); + } else + GST_WARNING ("Could create element %s for ippbin", elements[i]); + } + + for (i = 1; i < g_list_length (element_list); i++) { + current = g_list_nth (element_list, i - 1); + next = g_list_nth (element_list, i); + gst_element_link (current->data, next->data); + } + + current = g_list_first (element_list); + pad = gst_element_get_static_pad (current->data, "sink"); + gst_element_add_pad (bin, gst_ghost_pad_new ("sink", pad)); + gst_object_unref (GST_OBJECT (pad)); + + current = g_list_last (element_list); + pad = gst_element_get_static_pad (current->data, "src"); + gst_element_add_pad (bin, gst_ghost_pad_new ("src", pad)); + gst_object_unref (GST_OBJECT (pad)); + + g_list_free (element_list); + g_strfreev (elements); + + return bin; +} + +static GstEncodingProfile * +load_encoding_profile (void) +{ + GstEncodingProfile *prof = NULL; + GstEncodingTarget *target = NULL; + GError *error = NULL; + + /* if profile file was given, try to load profile from there */ + if (gep_filename && gep_profilename) { + target = gst_encoding_target_load_from_file (gep_filename, &error); + if (!target) { + GST_WARNING ("Could not load target %s from file %s", gep_targetname, + gep_filename); + if (error) { + GST_WARNING ("Error from file loading: %s", error->message); + g_error_free (error); + error = NULL; + } + } else { + prof = gst_encoding_target_get_profile (target, gep_profilename); + if (prof) + GST_DEBUG ("Loaded encoding profile %s from %s", gep_profilename, + gep_filename); + else + GST_WARNING + ("Could not load specified encoding profile %s from file %s", + gep_profilename, gep_filename); + } + /* if we could not load profile from file then try to find one from system */ + } else if (gep_profilename && gep_targetname) { + prof = gst_encoding_profile_find (gep_targetname, gep_profilename, NULL); + if (prof) + GST_DEBUG ("Loaded encoding profile %s from target %s", gep_profilename, + gep_targetname); + } else + GST_DEBUG + ("Encoding profile not set, using camerabin2 default encoding profile"); + + return prof; +} + +static gboolean +setup_pipeline_element (GstElement * element, const gchar * property_name, + const gchar * element_name, GstElement ** res_elem) +{ + gboolean res = TRUE; + GstElement *elem = NULL; + + if (element_name) { + GError *error = NULL; + + elem = gst_parse_launch (element_name, &error); + if (elem) { + g_object_set (element, property_name, elem, NULL); + } else { + GST_WARNING ("can't create element '%s' for property '%s'", element_name, + property_name); + if (error) { + GST_ERROR ("%s", error->message); + g_error_free (error); + } + res = FALSE; + } + } else { + GST_DEBUG ("no element for property '%s' given", property_name); + } + if (res_elem) + *res_elem = elem; + return res; +} + +static void +set_camerabin2_caps_from_string (void) +{ + GstCaps *caps = NULL; + if (image_capture_caps_str != NULL) { + caps = gst_caps_from_string (image_capture_caps_str); + if (GST_CAPS_IS_SIMPLE (caps) && image_width > 0 && image_height > 0) { + gst_caps_set_simple (caps, "width", G_TYPE_INT, image_width, "height", + G_TYPE_INT, image_height, NULL); + } + GST_DEBUG ("setting image-capture-caps: %" GST_PTR_FORMAT, caps); + g_object_set (camerabin, "image-capture-caps", caps, NULL); + gst_caps_unref (caps); + } + + if (viewfinder_caps_str != NULL) { + caps = gst_caps_from_string (viewfinder_caps_str); + if (GST_CAPS_IS_SIMPLE (caps) && view_framerate_num > 0 + && view_framerate_den > 0) { + gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION, + view_framerate_num, view_framerate_den, NULL); + } + GST_DEBUG ("setting viewfinder-caps: %" GST_PTR_FORMAT, caps); + g_object_set (camerabin, "viewfinder-caps", caps, NULL); + gst_caps_unref (caps); + } + + if (video_capture_caps_str != NULL) { + caps = gst_caps_from_string (video_capture_caps_str); + GST_DEBUG ("setting video-capture-caps: %" GST_PTR_FORMAT, caps); + g_object_set (camerabin, "video-capture-caps", caps, NULL); + gst_caps_unref (caps); + } +} + +static gboolean +setup_pipeline (void) +{ + gboolean res = TRUE; + GstBus *bus; + GstElement *sink = NULL, *ipp = NULL; + GstEncodingProfile *prof = NULL; + camerabin = gst_element_factory_make ("camerabin2", NULL); + if (NULL == camerabin) { + g_warning ("can't create camerabin element\n"); + goto error; + } + + bus = gst_pipeline_get_bus (GST_PIPELINE (camerabin)); + /* Add sync handler for time critical messages that need to be handled fast */ + gst_bus_set_sync_handler (bus, sync_bus_callback, NULL); + /* Handle normal messages asynchronously */ + gst_bus_add_watch (bus, bus_callback, NULL); + gst_object_unref (bus); + + GST_INFO_OBJECT (camerabin, "camerabin2 created"); + + if (videosrc_name) { + GstElement *wrapper; + GstElement *videosrc; + + if (wrappersrc_name) + wrapper = gst_element_factory_make (wrappersrc_name, NULL); + else + wrapper = gst_element_factory_make ("wrappercamerabinsrc", NULL); + + if (setup_pipeline_element (wrapper, "video-source", videosrc_name, NULL)) { + g_object_set (camerabin, "camera-source", wrapper, NULL); + } else { + GST_WARNING ("Failed to set videosrc to %s", videosrc_name); + } + + g_object_get (wrapper, "video-source", &videosrc, NULL); + if (videosrc && videodevice_name && + g_object_class_find_property (G_OBJECT_GET_CLASS (videosrc), + "device")) { + g_object_set (videosrc, "device", videodevice_name, NULL); + } + } + + /* configure used elements */ + res &= + setup_pipeline_element (camerabin, "audio-source", audiosrc_name, NULL); + res &= + setup_pipeline_element (camerabin, "viewfinder-sink", vfsink_name, &sink); + res &= + setup_pipeline_element (camerabin, "viewfinder-filter", viewfinder_filter, + NULL); + + if (imagepp_name) { + ipp = create_ipp_bin (); + if (ipp) + g_object_set (camerabin, "image-filter", ipp, NULL); + else + GST_WARNING ("Could not create ipp elements"); + } + + prof = load_encoding_profile (); + if (prof) + g_object_set (G_OBJECT (camerabin), "video-profile", prof, NULL); + + GST_INFO_OBJECT (camerabin, "elements created"); + + if (sink) + g_object_set (sink, "sync", TRUE, NULL); + + GST_INFO_OBJECT (camerabin, "elements configured"); + + /* configure a resolution and framerate */ + if (image_width > 0 && image_height > 0) { + if (mode == MODE_VIDEO) { + GstCaps *caps = NULL; + if (view_framerate_num > 0) + caps = gst_caps_new_full (gst_structure_new ("video/x-raw-yuv", + "width", G_TYPE_INT, image_width, + "height", G_TYPE_INT, image_height, + "framerate", GST_TYPE_FRACTION, view_framerate_num, + view_framerate_den, NULL), + gst_structure_new ("video/x-raw-rgb", + "width", G_TYPE_INT, image_width, + "height", G_TYPE_INT, image_height, + "framerate", GST_TYPE_FRACTION, view_framerate_num, + view_framerate_den, NULL), NULL); + else + caps = gst_caps_new_full (gst_structure_new ("video/x-raw-yuv", + "width", G_TYPE_INT, image_width, + "height", G_TYPE_INT, image_height, NULL), + gst_structure_new ("video/x-raw-rgb", + "width", G_TYPE_INT, image_width, + "height", G_TYPE_INT, image_height, NULL), NULL); + + g_object_set (camerabin, "video-capture-caps", caps, NULL); + gst_caps_unref (caps); + } else { + GstCaps *caps = gst_caps_new_full (gst_structure_new ("video/x-raw-yuv", + "width", G_TYPE_INT, image_width, + "height", G_TYPE_INT, image_height, NULL), + gst_structure_new ("video/x-raw-rgb", + "width", G_TYPE_INT, image_width, + "height", G_TYPE_INT, image_height, NULL), NULL); + + g_object_set (camerabin, "image-capture-caps", caps, NULL); + gst_caps_unref (caps); + } + } + + set_camerabin2_caps_from_string (); + + if (GST_STATE_CHANGE_FAILURE == + gst_element_set_state (camerabin, GST_STATE_READY)) { + g_warning ("can't set camerabin to ready\n"); + goto error; + } + GST_INFO_OBJECT (camerabin, "camera ready"); + + if (GST_STATE_CHANGE_FAILURE == + gst_element_set_state (camerabin, GST_STATE_PLAYING)) { + g_warning ("can't set camerabin to playing\n"); + goto error; + } + + GST_INFO_OBJECT (camerabin, "camera started"); + return TRUE; +error: + cleanup_pipeline (); + return FALSE; +} + +static void +stop_capture_cb (GObject * self, GParamSpec * pspec, gpointer user_data) +{ + gboolean idle = FALSE; + + g_object_get (camerabin, "idle", &idle, NULL); + + if (idle) { + if (capture_count < capture_total) { + g_idle_add ((GSourceFunc) run_pipeline, NULL); + } else { + g_main_loop_quit (loop); + } + } + + g_signal_handler_disconnect (camerabin, stop_capture_cb_id); +} + +static gboolean +stop_capture (gpointer user_data) +{ + stop_capture_cb_id = g_signal_connect (camerabin, "notify::idle", + (GCallback) stop_capture_cb, camerabin); + g_signal_emit_by_name (camerabin, "stop-capture", 0); + return FALSE; +} + +static void +set_metadata (GstElement * camera) +{ + GstTagSetter *setter = GST_TAG_SETTER (camera); + GTimeVal time = { 0, 0 }; + gchar *desc_str; + GDate *date = g_date_new (); + + g_get_current_time (&time); + g_date_set_time_val (date, &time); + + desc_str = g_strdup_printf ("captured by %s", g_get_real_name ()); + + gst_tag_setter_add_tags (setter, GST_TAG_MERGE_REPLACE, + GST_TAG_DATE, date, + GST_TAG_DESCRIPTION, desc_str, + GST_TAG_TITLE, "gst-camerabin-test capture", + GST_TAG_GEO_LOCATION_LONGITUDE, 1.0, + GST_TAG_GEO_LOCATION_LATITUDE, 2.0, + GST_TAG_GEO_LOCATION_ELEVATION, 3.0, + GST_TAG_DEVICE_MANUFACTURER, "gst-camerabin-test manufacturer", + GST_TAG_DEVICE_MODEL, "gst-camerabin-test model", NULL); + + g_free (desc_str); + g_date_free (date); +} + +static gboolean +run_pipeline (gpointer user_data) +{ + GstCaps *preview_caps = NULL; + gchar *filename_str = NULL; + GstElement *video_source = NULL; + const gchar *filename_suffix; + + g_object_set (camerabin, "mode", mode, NULL); + + if (preview_caps_name != NULL) { + preview_caps = gst_caps_from_string (preview_caps_name); + if (preview_caps) { + g_object_set (camerabin, "preview-caps", preview_caps, NULL); + GST_DEBUG ("Preview caps set"); + } else + GST_DEBUG ("Preview caps set but could not create caps from string"); + } + + set_metadata (camerabin); + + /* Construct filename */ + if (mode == MODE_VIDEO) + filename_suffix = ".mp4"; + else + filename_suffix = ".jpg"; + filename_str = + g_strdup_printf ("%s/test_%04u%s", filename->str, capture_count, + filename_suffix); + GST_DEBUG ("Setting filename: %s", filename_str); + g_object_set (camerabin, "location", filename_str, NULL); + g_free (filename_str); + + g_object_get (camerabin, "camera-source", &video_source, NULL); + if (video_source) { + if (GST_IS_ELEMENT (video_source) && + gst_element_implements_interface (video_source, GST_TYPE_PHOTOGRAPHY)) { + /* Set GstPhotography interface options. If option not given as + command-line parameter use default of the source element. */ + if (scene_mode != SCENE_MODE_NONE) + g_object_set (video_source, "scene-mode", scene_mode, NULL); + if (ev_compensation != EV_COMPENSATION_NONE) + g_object_set (video_source, "ev-compensation", ev_compensation, NULL); + if (aperture != APERTURE_NONE) + g_object_set (video_source, "aperture", aperture, NULL); + if (flash_mode != FLASH_MODE_NONE) + g_object_set (video_source, "flash-mode", flash_mode, NULL); + if (exposure != EXPOSURE_NONE) + g_object_set (video_source, "exposure", exposure, NULL); + if (iso_speed != ISO_SPEED_NONE) + g_object_set (video_source, "iso-speed", iso_speed, NULL); + if (wb_mode != WHITE_BALANCE_MODE_NONE) + g_object_set (video_source, "white-balance-mode", wb_mode, NULL); + if (color_mode != COLOR_TONE_MODE_NONE) + g_object_set (video_source, "colour-tone-mode", color_mode, NULL); + } + g_object_unref (video_source); + } + g_object_set (camerabin, "zoom", zoom / 100.0f, NULL); + + capture_count++; + g_timer_start (timer); + g_signal_emit_by_name (camerabin, "start-capture", 0); + + + if (mode == MODE_VIDEO) { + g_timeout_add ((capture_time * 1000), (GSourceFunc) stop_capture, NULL); + } + + return FALSE; +} + +int +main (int argc, char *argv[]) +{ + gchar *target_times = NULL; + gchar *ev_option = NULL; + gchar *fn_option = NULL; + + GOptionEntry options[] = { + {"ev-compensation", '\0', 0, G_OPTION_ARG_STRING, &ev_option, + "EV compensation for source element GstPhotography interface", NULL}, + {"aperture", '\0', 0, G_OPTION_ARG_INT, &aperture, + "Aperture (size of lens opening) for source element GstPhotography interface", + NULL}, + {"flash-mode", '\0', 0, G_OPTION_ARG_INT, + &flash_mode, + "Flash mode for source element GstPhotography interface", NULL}, + {"scene-mode", '\0', 0, G_OPTION_ARG_INT, + &scene_mode, + "Scene mode for source element GstPhotography interface", NULL}, + {"exposure", '\0', 0, G_OPTION_ARG_INT64, + &exposure, + "Exposure time (in ms) for source element GstPhotography interface", + NULL}, + {"iso-speed", '\0', 0, G_OPTION_ARG_INT, + &iso_speed, + "ISO speed for source element GstPhotography interface", NULL}, + {"white-balance-mode", '\0', 0, G_OPTION_ARG_INT, + &wb_mode, + "White balance mode for source element GstPhotography interface", NULL}, + {"colour-tone-mode", '\0', 0, G_OPTION_ARG_INT, + &color_mode, + "Colour tone mode for source element GstPhotography interface", NULL}, + {"directory", '\0', 0, G_OPTION_ARG_STRING, &fn_option, + "Directory for capture file(s) (default is current directory)", NULL}, + {"mode", '\0', 0, G_OPTION_ARG_INT, &mode, + "Capture mode (default = 1 (image), 2 = video)", NULL}, + {"capture-time", '\0', 0, G_OPTION_ARG_INT, + &capture_time, + "Time to capture video in seconds (default = 10)", NULL}, + {"capture-total", '\0', 0, G_OPTION_ARG_INT, &capture_total, + "Total number of captures to be done (default = 1)", NULL}, + {"zoom", '\0', 0, G_OPTION_ARG_INT, &zoom, + "Zoom (100 = 1x (default), 200 = 2x etc.)", NULL}, + {"wrapper-source", '\0', 0, G_OPTION_ARG_STRING, &wrappersrc_name, + "Camera source wrapper used for setting the video source (default is wrappercamerabinsrc)", + NULL}, + {"video-source", '\0', 0, G_OPTION_ARG_STRING, &videosrc_name, + "Video source used in still capture and video recording", NULL}, + {"video-device", '\0', 0, G_OPTION_ARG_STRING, &videodevice_name, + "Video device to be set on the video source", NULL}, + {"audio-source", '\0', 0, G_OPTION_ARG_STRING, &audiosrc_name, + "Audio source used in video recording", NULL}, + {"image-pp", '\0', 0, G_OPTION_ARG_STRING, &imagepp_name, + "List of image post-processing elements separated with comma", NULL}, + {"viewfinder-sink", '\0', 0, G_OPTION_ARG_STRING, &vfsink_name, + "Viewfinder sink (default = fakesink)", NULL}, + {"image-width", '\0', 0, G_OPTION_ARG_INT, &image_width, + "Width for image capture", NULL}, + {"image-height", '\0', 0, G_OPTION_ARG_INT, &image_height, + "Height for image capture", NULL}, + {"view-framerate-num", '\0', 0, G_OPTION_ARG_INT, &view_framerate_num, + "Framerate numerator for viewfinder", NULL}, + {"view-framerate-den", '\0', 0, G_OPTION_ARG_INT, &view_framerate_den, + "Framerate denominator for viewfinder", NULL}, + {"preview-caps", '\0', 0, G_OPTION_ARG_STRING, &preview_caps_name, + "Preview caps (e.g. video/x-raw-rgb,width=320,height=240)", NULL}, + {"viewfinder-filter", '\0', 0, G_OPTION_ARG_STRING, &viewfinder_filter, + "Filter to process all frames going to viewfinder sink", NULL}, + {"x-width", '\0', 0, G_OPTION_ARG_INT, &x_width, + "X window width (default = 320)", NULL}, + {"x-height", '\0', 0, G_OPTION_ARG_INT, &x_height, + "X window height (default = 240)", NULL}, + {"no-xwindow", '\0', 0, G_OPTION_ARG_NONE, &no_xwindow, + "Do not create XWindow", NULL}, + {"encoding-target", '\0', 0, G_OPTION_ARG_STRING, &gep_targetname, + "Video encoding target name", NULL}, + {"encoding-profile", '\0', 0, G_OPTION_ARG_STRING, &gep_profilename, + "Video encoding profile name", NULL}, + {"encoding-profile-filename", '\0', 0, G_OPTION_ARG_STRING, &gep_filename, + "Video encoding profile filename", NULL}, + {"image-capture-caps", '\0', 0, + G_OPTION_ARG_STRING, &image_capture_caps_str, + "Image capture caps (e.g. video/x-raw-rgb,width=640,height=480)", NULL}, + {"viewfinder-caps", '\0', 0, G_OPTION_ARG_STRING, + &viewfinder_caps_str, + "Viewfinder caps (e.g. video/x-raw-rgb,width=640,height=480)", NULL}, + {"video-capture-caps", '\0', 0, + G_OPTION_ARG_STRING, &video_capture_caps_str, + "Video capture caps (e.g. video/x-raw-rgb,width=640,height=480)", NULL}, + {NULL} + }; + + GOptionContext *ctx; + GError *err = NULL; + + if (!g_thread_supported ()) + g_thread_init (NULL); + + ctx = g_option_context_new ("\n\ncamerabin command line test application."); + g_option_context_add_main_entries (ctx, options, NULL); + g_option_context_add_group (ctx, gst_init_get_option_group ()); + if (!g_option_context_parse (ctx, &argc, &argv, &err)) { + g_print ("Error initializing: %s\n", err->message); + exit (1); + } + g_option_context_free (ctx); + + GST_DEBUG_CATEGORY_INIT (camerabin_test, "camerabin-test", 0, + "camerabin test"); + + /* if we fail to create xwindow should we care? */ + if (!no_xwindow) + create_host_window (); + + /* FIXME: error handling */ + if (ev_option != NULL) + ev_compensation = strtod (ev_option, (char **) NULL); + + if (vfsink_name == NULL) + vfsink_name = g_strdup ("fakesink"); + + filename = g_string_new (fn_option); + if (filename->len == 0) + filename = g_string_append (filename, "."); + + timer = g_timer_new (); + + /* init */ + if (setup_pipeline ()) { + loop = g_main_loop_new (NULL, FALSE); + g_idle_add ((GSourceFunc) run_pipeline, NULL); + g_main_loop_run (loop); + cleanup_pipeline (); + g_main_loop_unref (loop); + } + /* free */ + g_string_free (filename, TRUE); + g_free (ev_option); + g_free (wrappersrc_name); + g_free (videosrc_name); + g_free (videodevice_name); + g_free (audiosrc_name); + g_free (imagepp_name); + g_free (vfsink_name); + g_free (target_times); + g_free (gep_targetname); + g_free (gep_profilename); + g_free (gep_filename); + g_timer_destroy (timer); + + if (window) + XDestroyWindow (display, window); + + if (display) + XCloseDisplay (display); + + return 0; +} diff --git a/tests/examples/mxf/mxfdemux-structure.c b/tests/examples/mxf/mxfdemux-structure.c index 0678ad5429..6f735c4da3 100644 --- a/tests/examples/mxf/mxfdemux-structure.c +++ b/tests/examples/mxf/mxfdemux-structure.c @@ -151,9 +151,9 @@ on_message (GstBus * bus, GstMessage * message, gpointer data) gst_tag_list_free (tags); break; + } default: break; - } } } diff --git a/tools/Makefile.am b/tools/Makefile.am index 6412930528..ef6a74eecf 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -3,7 +3,6 @@ templatefiles=\ element-templates/audiofilter \ element-templates/audiosink \ element-templates/audiosrc \ - element-templates/base \ element-templates/baseaudiosink \ element-templates/baseaudiosrc \ element-templates/basertpdepayload \ @@ -13,17 +12,32 @@ templatefiles=\ element-templates/basetransform \ element-templates/cddabasesrc \ element-templates/element \ - element-templates/gobject \ element-templates/pushsrc \ + element-templates/tagdemux \ + element-templates/videofilter2 \ + element-templates/videosink + +templatedeps = \ + element-templates/base \ + element-templates/gobject \ element-templates/sinkpad \ element-templates/sinkpad-simple \ element-templates/srcpad \ - element-templates/srcpad-simple \ - element-templates/tagdemux \ - element-templates/videosink + element-templates/srcpad-simple EXTRA_DIST = \ gst-element-maker \ gst-app-maker \ - $(templatefiles) + $(templatefiles) \ + $(templatedeps) \ + gst-element-maker-test.sh + +# Disabled since it doesn't work in an uninstalled setup: +# +#TESTS_ENVIRONMENT = \ +# SRC_DIR=$(abs_srcdir) \ +# TEMPLATE_FILES="$(templatefiles)" \ +# CPPFLAGS="-I$(abs_srcdir)" +# +#TESTS = gst-element-maker-test.sh diff --git a/tools/element-templates/audiofilter b/tools/element-templates/audiofilter index 2d0929364f..5e7ea376bf 100644 --- a/tools/element-templates/audiofilter +++ b/tools/element-templates/audiofilter @@ -12,15 +12,56 @@ gstreamer-audio-0.10 % prototypes static gboolean gst_replace_setup (GstAudioFilter * filter, GstRingBufferSpec * format); +static gboolean +gst_replace_start (GstBaseTransform * trans); +static GstFlowReturn +gst_replace_transform_ip (GstBaseTransform * trans, GstBuffer * buf); +static gboolean +gst_replace_stop (GstBaseTransform * trans); % declare-class - GstAudioFilter *audio_filter_class = GST_AUDIO_FILTER (klass); + GstAudioFilterClass *audio_filter_class = GST_AUDIO_FILTER_CLASS (klass); + GstBaseTransformClass *base_transform_class = GST_BASE_TRANSFORM_CLASS (klass); % set-methods - audio_filter_class-> = GST_DEBUG_FUNCPTR (gst_replace_); + audio_filter_class->setup = GST_DEBUG_FUNCPTR (gst_replace_setup); + base_transform_class->start = GST_DEBUG_FUNCPTR (gst_replace_start); + base_transform_class->transform_ip = GST_DEBUG_FUNCPTR (gst_replace_transform_ip); + base_transform_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop); % methods static gboolean gst_replace_setup (GstAudioFilter * filter, GstRingBufferSpec * format) { + /* GstReplace *replace = GST_REPLACE (filter); */ + /* handle audio format changes */ + return TRUE; } + +static gboolean +gst_replace_start (GstBaseTransform * trans) +{ + /* GstReplace *replace = GST_REPLACE (trans); */ + + /* initialize processing */ + return TRUE; +} + +static GstFlowReturn +gst_replace_transform_ip (GstBaseTransform * trans, GstBuffer * buf) +{ + /* GstReplace *replace = GST_REPLACE (trans); */ + + /* process the audio data in the buffer in-place */ + return GST_FLOW_OK; +} + +static gboolean +gst_replace_stop (GstBaseTransform * trans) +{ + /* GstReplace *replace = GST_REPLACE (trans); */ + + /* finalize processing */ + return TRUE; +} + % end diff --git a/tools/element-templates/baseparse b/tools/element-templates/baseparse index ff56b3ca42..01293f68a2 100644 --- a/tools/element-templates/baseparse +++ b/tools/element-templates/baseparse @@ -5,7 +5,7 @@ GST_TYPE_BASE_PARSE % pkg-config gstreamer-base-0.10 % includes -#include +#include % prototypes static gboolean gst_replace_start (GstBaseParse *parse); static gboolean gst_replace_stop (GstBaseParse *parse); diff --git a/tools/element-templates/basertpdepayload b/tools/element-templates/basertpdepayload index 8b40e52656..b91d1c2fb8 100644 --- a/tools/element-templates/basertpdepayload +++ b/tools/element-templates/basertpdepayload @@ -18,36 +18,43 @@ static GstBuffer *gst_replace_process (GstBaseRTPDepayload * base, GstBuffer * in); static void gst_replace_set_gst_timestamp (GstBaseRTPDepayload * filter, guint32 timestamp, - Gst Buffer * buf); + GstBuffer * buf); static gboolean gst_replace_packet_lost (GstBaseRTPDepayload * filter, GstEvent * event); % declare-class - GstBaseRTPDepayload *base_rtpdepayload_class = GST_BASE_RTPDEPAYLOAD (klass); + GstBaseRTPDepayloadClass *base_rtpdepayload_class = GST_BASE_RTP_DEPAYLOAD_CLASS (klass); % set-methods - base_rtpdepayload_class-> = GST_DEBUG_FUNCPTR (gst_replace_); + base_rtpdepayload_class->set_caps = GST_DEBUG_FUNCPTR (gst_replace_set_caps); + base_rtpdepayload_class->add_to_queue = GST_DEBUG_FUNCPTR (gst_replace_add_to_queue); + base_rtpdepayload_class->process = GST_DEBUG_FUNCPTR (gst_replace_process); + base_rtpdepayload_class->set_gst_timestamp = GST_DEBUG_FUNCPTR (gst_replace_set_gst_timestamp); + base_rtpdepayload_class->packet_lost = GST_DEBUG_FUNCPTR (gst_replace_packet_lost); % methods static gboolean gst_replace_set_caps (GstBaseRTPDepayload * filter, GstCaps * caps) { + return FALSE; } static GstFlowReturn gst_replace_add_to_queue (GstBaseRTPDepayload * filter, GstBuffer * in) { + return GST_FLOW_ERROR; } static GstBuffer * gst_replace_process (GstBaseRTPDepayload * base, GstBuffer * in) { + return NULL; } static void gst_replace_set_gst_timestamp (GstBaseRTPDepayload * filter, guint32 timestamp, - Gst Buffer * buf) + GstBuffer * buf) { } @@ -56,5 +63,6 @@ static gboolean gst_replace_packet_lost (GstBaseRTPDepayload * filter, GstEvent * event) { + return FALSE; } % end diff --git a/tools/element-templates/basertppayload b/tools/element-templates/basertppayload index 1a5be183d0..0f7d6547ea 100644 --- a/tools/element-templates/basertppayload +++ b/tools/element-templates/basertppayload @@ -18,32 +18,39 @@ static gboolean gst_replace_handle_event (GstPad * pad, GstEvent * event); static GstCaps *gst_replace_get_caps (GstBaseRTPPayload * payload, GstPad * pad); % declare-class - GstBaseRTPPayload *base_rtppayload_class = GST_BASE_RTPPAYLOAD (klass); + GstBaseRTPPayloadClass *base_rtppayload_class = GST_BASE_RTP_PAYLOAD_CLASS (klass); % set-methods - base_rtppayload_class-> = GST_DEBUG_FUNCPTR (gst_replace_); + base_rtppayload_class->set_caps = GST_DEBUG_FUNCPTR (gst_replace_set_caps); + base_rtppayload_class->handle_buffer = GST_DEBUG_FUNCPTR (gst_replace_handle_buffer); + base_rtppayload_class->handle_event = GST_DEBUG_FUNCPTR (gst_replace_handle_event); + base_rtppayload_class->get_caps = GST_DEBUG_FUNCPTR (gst_replace_get_caps); % methods static gboolean gst_replace_set_caps (GstBaseRTPPayload * payload, GstCaps * caps) { + return FALSE; } static GstFlowReturn gst_replace_handle_buffer (GstBaseRTPPayload * payload, GstBuffer * buffer) { + return GST_FLOW_ERROR; } static gboolean gst_replace_handle_event (GstPad * pad, GstEvent * event) { + return FALSE; } static GstCaps * gst_replace_get_caps (GstBaseRTPPayload * payload, GstPad * pad) { + return NULL; } % end diff --git a/tools/element-templates/cddabasesrc b/tools/element-templates/cddabasesrc index d788d19c41..7de6bcf4ab 100644 --- a/tools/element-templates/cddabasesrc +++ b/tools/element-templates/cddabasesrc @@ -16,9 +16,13 @@ static GstBuffer *gst_replace_read_sector (GstCddaBaseSrc * src, gint sector); static gchar *gst_replace_get_default_device (GstCddaBaseSrc * src); static gchar **gst_replace_probe_devices (GstCddaBaseSrc * src); % declare-class - GstcddaBaseSrc *cddabase_src_class = GST_CDDABASE_SRC (klass); + GstCddaBaseSrcClass *cddabase_src_class = GST_CDDA_BASE_SRC_CLASS (klass); % set-methods - cddabase_src_class-> = GST_DEBUG_FUNCPTR (gst_replace_); + cddabase_src_class->open = GST_DEBUG_FUNCPTR (gst_replace_open); + cddabase_src_class->close = GST_DEBUG_FUNCPTR (gst_replace_close); + cddabase_src_class->read_sector = GST_DEBUG_FUNCPTR (gst_replace_read_sector); + cddabase_src_class->get_default_device = GST_DEBUG_FUNCPTR (gst_replace_get_default_device); + cddabase_src_class->probe_devices = GST_DEBUG_FUNCPTR (gst_replace_probe_devices); % methods @@ -26,6 +30,7 @@ static gboolean gst_replace_open (GstCddaBaseSrc * src, const gchar * device) { + return FALSE; } static void @@ -38,17 +43,20 @@ static GstBuffer * gst_replace_read_sector (GstCddaBaseSrc * src, gint sector) { + return NULL; } static gchar * gst_replace_get_default_device (GstCddaBaseSrc * src) { + return NULL; } static gchar ** gst_replace_probe_devices (GstCddaBaseSrc * src) { + return NULL; } % end diff --git a/tools/element-templates/gobject b/tools/element-templates/gobject index 4ef34e6c2d..85d7d37149 100644 --- a/tools/element-templates/gobject +++ b/tools/element-templates/gobject @@ -1,5 +1,8 @@ /* vim: set filetype=c: */ - +% ClassName +GstObject +% TYPE_CLASS_NAME +GST_TYPE_OBJECT % includes % prototypes @@ -23,10 +26,7 @@ void gst_replace_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { - GstReplace *replace; - - g_return_if_fail (GST_IS_REPLACE (object)); - replace = GST_REPLACE (object); + /* GstReplace *replace = GST_REPLACE (object); */ switch (property_id) { default: @@ -39,10 +39,7 @@ void gst_replace_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { - GstReplace *replace; - - g_return_if_fail (GST_IS_REPLACE (object)); - replace = GST_REPLACE (object); + /* GstReplace *replace = GST_REPLACE (object); */ switch (property_id) { default: @@ -54,10 +51,7 @@ gst_replace_get_property (GObject * object, guint property_id, void gst_replace_dispose (GObject * object) { - GstReplace *replace; - - g_return_if_fail (GST_IS_REPLACE (object)); - replace = GST_REPLACE (object); + /* GstReplace *replace = GST_REPLACE (object); */ /* clean up as possible. may be called multiple times */ @@ -67,10 +61,7 @@ gst_replace_dispose (GObject * object) void gst_replace_finalize (GObject * object) { - GstReplace *replace; - - g_return_if_fail (GST_IS_REPLACE (object)); - replace = GST_REPLACE (object); + /* GstReplace *replace = GST_REPLACE (object); */ /* clean up object here */ diff --git a/tools/element-templates/tagdemux b/tools/element-templates/tagdemux index 8517c5802f..ecfd1fe4df 100644 --- a/tools/element-templates/tagdemux +++ b/tools/element-templates/tagdemux @@ -20,9 +20,11 @@ gst_replace_parse_tag (GstTagDemux * demux, static GstTagList *gst_replace_merge_tags (GstTagDemux * demux, const GstTagList * start_tags, const GstTagList * end_tags); % declare-class - GstTagdemux *tagdemux_class = GST_TAGDEMUX (klass); + GstTagDemuxClass *tagdemux_class = GST_TAG_DEMUX_CLASS (klass); % set-methods - tagdemux_class-> = GST_DEBUG_FUNCPTR (gst_replace_); + tagdemux_class->identify_tag = GST_DEBUG_FUNCPTR (gst_replace_identify_tag); + tagdemux_class->parse_tag = GST_DEBUG_FUNCPTR (gst_replace_parse_tag); + tagdemux_class->merge_tags = GST_DEBUG_FUNCPTR (gst_replace_merge_tags); % methods @@ -31,6 +33,7 @@ gst_replace_identify_tag (GstTagDemux * demux, GstBuffer * buffer, gboolean start_tag, guint * tag_size) { + return FALSE; } static GstTagDemuxResult @@ -39,6 +42,7 @@ gst_replace_parse_tag (GstTagDemux * demux, gboolean start_tag, guint * tag_size, GstTagList ** tags) { + return GST_TAG_DEMUX_RESULT_BROKEN_TAG; } static GstTagList * @@ -46,5 +50,6 @@ gst_replace_merge_tags (GstTagDemux * demux, const GstTagList * start_tags, const GstTagList * end_tags) { + return NULL; } % end diff --git a/tools/element-templates/videofilter2 b/tools/element-templates/videofilter2 new file mode 100644 index 0000000000..faa32a6b6e --- /dev/null +++ b/tools/element-templates/videofilter2 @@ -0,0 +1,67 @@ +/* vim: set filetype=c: */ +% ClassName +GstVideoFilter2 +% TYPE_CLASS_NAME +GST_TYPE_VIDEO_FILTER2 +% pads +% pkg-config +gstreamer-base-0.10 +% pads +% includes +#include +#include +#include "../gst/videofilters/gstvideofilter2.h" +% prototypes +static gboolean gst_replace_start (GstBaseTransform * trans); +static gboolean gst_replace_stop (GstBaseTransform * trans); +static GstFlowReturn +gst_replace_prefilter (GstVideoFilter2 *videofilter2, GstBuffer * buf); + +static GstVideoFilter2Functions gst_replace_filter_functions[]; +% declare-class + GstBaseTransformClass *base_transform_class = GST_BASE_TRANSFORM_CLASS (klass); + GstVideoFilter2Class *video_filter2_class = GST_VIDEO_FILTER2_CLASS (klass); +% set-methods + base_transform_class->start = GST_DEBUG_FUNCPTR (gst_replace_start); + base_transform_class->stop = GST_DEBUG_FUNCPTR (gst_replace_stop); + video_filter2_class->prefilter = GST_DEBUG_FUNCPTR (gst_replace_prefilter); + + gst_video_filter2_class_add_functions (video_filter2_class, + gst_replace_filter_functions); +% methods + +static gboolean +gst_replace_start (GstBaseTransform * trans) +{ + + return TRUE; +} + +static gboolean +gst_replace_stop (GstBaseTransform * trans) +{ + + return TRUE; +} + +static GstFlowReturn +gst_replace_prefilter (GstVideoFilter2 *video_filter2, GstBuffer * buf) +{ + + return GST_FLOW_OK; +} + +static GstFlowReturn +gst_replace_filter_ip_I420 (GstVideoFilter2 * videofilter2, + GstBuffer * buf, int start, int end) +{ + return GST_FLOW_OK; +} + +static GstVideoFilter2Functions gst_replace_filter_functions[] = { + {GST_VIDEO_FORMAT_I420, NULL, gst_replace_filter_ip_I420}, + {GST_VIDEO_FORMAT_UNKNOWN} +}; + + +% end diff --git a/tools/gst-element-maker b/tools/gst-element-maker index 53b26cac8d..bd4cc98704 100755 --- a/tools/gst-element-maker +++ b/tools/gst-element-maker @@ -2,7 +2,8 @@ prefix=gst -templatedir=element-templates +basedir=`dirname $0` +templatedir=$basedir/element-templates while [ "$1" ] ; do case $1 in @@ -44,7 +45,7 @@ if [ "$name" = "" -o "$class" = "" ] ; then exit 1 fi -if [ ! -f "element-templates/$class" ] ; then +if [ ! -f "$templatedir/$class" ] ; then echo "Template file for $class not found." exit 1 fi @@ -54,6 +55,7 @@ PREFIX=$(echo $prefix | sed -e 's/\(.*\)/\U\1/') NAME=$(echo $name | sed -e 's/\(.*\)/\U\1/') Prefix=$(echo $prefix | sed -e 's/_\(.\)/\U\1/g' -e 's/^\(.\)/\U\1/') Name=$(echo $name | sed -e 's/_\(.\)/\U\1/g' -e 's/^\(.\)/\U\1/') +name=$(echo $name | sed -e 's/\(.*\)/\L\1/') GST_IS_REPLACE=${PREFIX}_IS_${NAME} GST_REPLACE=${PREFIX}_${NAME} @@ -237,10 +239,8 @@ static gboolean plugin_init (GstPlugin * plugin) { - gst_element_register (plugin, "replace", GST_RANK_NONE, - gst_replace_get_type ()); - - return TRUE; + return gst_element_register (plugin, "replace", GST_RANK_NONE, + GST_TYPE_REPLACE); } #ifndef VERSION @@ -377,7 +377,13 @@ gst-indent $gstreplace.c echo pkg is $pkg -gcc -Wall -fPIC $(pkg-config --cflags gstreamer-0.10 $pkg) -c -o $gstreplace.o $gstreplace.c +gcc -Wall -fPIC $CPPFLAGS $(pkg-config --cflags gstreamer-0.10 $pkg) -c -o $gstreplace.o $gstreplace.c +if test $? -ne 0; then + exit 1 +fi + gcc -shared -o $gstreplace.so $gstreplace.o $(pkg-config --libs gstreamer-0.10 $pkg) - +if test $? -ne 0; then + exit 1 +fi diff --git a/tools/gst-element-maker-test.sh b/tools/gst-element-maker-test.sh new file mode 100755 index 0000000000..fdd9bf3b35 --- /dev/null +++ b/tools/gst-element-maker-test.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +tmpdir=`mktemp --tmpdir -d gst.XXXXXXXXXX` +workdir=$PWD +cd $tmpdir +res=0 + +for file in $TEMPLATE_FILES; do + name=`basename $file element-templates` + $SRC_DIR/gst-element-maker gst$name $name + if test $? -ne 0; then + res=1 + break + fi +done + +cd $workdir +rm -rf $tmpdir +exit $res; +